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 <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2023-02-09 14:51:14 +01:00 committed by Xiang Xiao
parent becaf3bf9d
commit 725dfd5db9
1 changed files with 9 additions and 6 deletions

View File

@ -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;
}