41 #include "contiki-msb430.h"
45 static void (*callbacks[DMA_LINES])(void);
47 interrupt(DACDMA_VECTOR) irq_dacdma(
void)
49 if(DMA0CTL & DMAIFG) {
50 DMA0CTL &= ~(DMAIFG | DMAIE);
51 if(callbacks[0] !=
NULL) {
54 _BIC_SR_IRQ(LPM3_bits);
57 if(DMA1CTL & DMAIFG) {
58 DMA1CTL &= ~(DMAIFG | DMAIE);
59 if(callbacks[1] !=
NULL) {
62 _BIC_SR_IRQ(LPM3_bits);
65 if(DMA2CTL & DMAIFG) {
66 DMA2CTL &= ~(DMAIFG | DMAIE);
67 if(callbacks[2] !=
NULL) {
70 _BIC_SR_IRQ(LPM3_bits);
73 if(DAC12_0CTL & DAC12IFG) {
74 DAC12_0CTL &= ~(DAC12IFG | DAC12IE);
77 if(DAC12_1CTL & DAC12IFG) {
78 DAC12_1CTL &= ~(DAC12IFG | DAC12IE);
83 dma_subscribe(
int line,
void (*callback)(
void))
85 if(line >= DMA_LINES) {
89 callbacks[line] = callback;
94 dma_transfer(
unsigned char *dst,
unsigned char *src,
unsigned len)
112 DMA0CTL = DMADT_0 | DMADSTINCR_0 | DMASRCINCR_3 | DMASBDB | DMALEVEL;
114 DMA0SA = (unsigned) src;
115 DMA0DA = (unsigned) dst;
118 DMA0CTL |= DMAEN | DMAIE;