From 725dfd5db94dada5cc38405764955c81bccc77f1 Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Thu, 9 Feb 2023 14:51:14 +0100 Subject: [PATCH] samv7: fix compilation error when only DAC1 is configured The function call dac_txdone(&g_dac1dev) was not contained in ifdef section. This was cousing compilation error if only DAC1 was configured as the structure g_dac1dev is defined only if DAC0 is used. This commit fixes the error and ensures the function is called only if corresponding DAC is configured. Signed-off-by: Michal Lenc --- arch/arm/src/samv7/sam_dac.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/samv7/sam_dac.c b/arch/arm/src/samv7/sam_dac.c index f67d57a6bb9..1601e27c226 100644 --- a/arch/arm/src/samv7/sam_dac.c +++ b/arch/arm/src/samv7/sam_dac.c @@ -189,20 +189,23 @@ static struct sam_dac_s g_dacmodule; static int dac_interrupt(int irq, void *context, void *arg) { -#ifdef CONFIG_SAMV7_DAC1 uint32_t status; status = getreg32(SAM_DACC_ISR) & getreg32(SAM_DACC_IMR); + +#ifdef CONFIG_SAMV7_DAC0 + if (status & DACC_INT_TXRDY0) + { + dac_txdone(&g_dac1dev); + } +#endif + +#ifdef CONFIG_SAMV7_DAC1 if (status & DACC_INT_TXRDY1) { dac_txdone(&g_dac2dev); } - - if (status & DACC_INT_TXRDY0) #endif - { - dac_txdone(&g_dac1dev); - } return OK; }