*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
DMAIRQ = 0;
DMAIF = 0;
IEN1 |= IEN1_DMAIE;
+ DMA0CFGH = ((uint16_t) (&ao_dma_config[0])) >> 8;
+ DMA0CFGL = ((uint16_t) (&ao_dma_config[0]));
+ DMA1CFGH = ((uint16_t) (&ao_dma_config[1])) >> 8;
+ DMA1CFGL = ((uint16_t) (&ao_dma_config[1]));
}
return id;
ao_dma_config[id].len_low = count;
ao_dma_config[id].cfg0 = cfg0;
ao_dma_config[id].cfg1 = cfg1 | DMA_CFG1_IRQMASK;
- if (id == 0) {
- DMA0CFGH = ((uint16_t) (&ao_dma_config[0])) >> 8;
- DMA0CFGL = ((uint16_t) (&ao_dma_config[0]));
- } else {
- DMA1CFGH = ((uint16_t) (&ao_dma_config[1])) >> 8;
- DMA1CFGL = ((uint16_t) (&ao_dma_config[1]));
- }
}
-#define nop() _asm nop _endasm;
+#define nop() __asm nop __endasm;
void
ao_dma_start(uint8_t id)
{
uint8_t mask = (1 << id);
DMAIRQ &= ~mask;
- DMAARM = 0x80 | mask;
- nop(); nop(); nop(); nop();
- nop(); nop(); nop(); nop();
+ if (DMAARM & mask) {
+ DMAARM = 0x80 | mask;
+ nop(); nop(); nop(); nop();
+ nop(); nop(); nop(); nop();
+ }
*(ao_dma_done[id]) = 0;
DMAARM = mask;
nop(); nop(); nop(); nop();