Contiki 2.5
dma_intr.c
Go to the documentation of this file.
1 /**
2  * \file
3  * DMA driver ISRs
4  * \author
5  * Original: Martti Huttunen <martti@sensinode.com>
6  * Port: Zach Shelby <zach@sensinode.com>
7  *
8  * DMA interrupt routines, must be stored in HOME bank
9  */
10 
11 #include <stdio.h>
12 
13 #include "contiki.h"
14 
15 #include "dev/dma.h"
16 #include "cc2430_sfr.h"
17 #include "banked.h"
18 
19 extern struct process * dma_callback[4];
20 
21 /*---------------------------------------------------------------------------*/
22 #ifdef HAVE_RF_DMA
23 extern void rf_dma_callback_isr(void);
24 #endif
25 #ifdef SPI_DMA_RX
26 extern void spi_rx_dma_callback(void);
27 #endif
28 /*---------------------------------------------------------------------------*/
29 /**
30  * DMA interrupt service routine.
31  *
32  * if callback defined a poll is made to that process
33  */
34 void
35 dma_ISR(void) __interrupt (DMA_VECTOR)
36 {
37 #ifdef HAVE_DMA
38  uint8_t i;
39 #endif
40  EA=0;
41 #ifdef HAVE_RF_DMA
42  if((DMAIRQ & 1) != 0) {
43  DMAIRQ &= ~1;
44  DMAARM=0x81;
45  rf_dma_callback_isr();
46  }
47 #endif
48 #ifdef SPI_DMA_RX
49  if((DMAIRQ & 0x08) != 0) {
50  DMAIRQ &= ~(1 << 3);
51  spi_rx_dma_callback();
52  }
53 #endif
54 #ifdef HAVE_DMA
55  for(i = 0; i < 4; i++) {
56  if((DMAIRQ & (1 << i + 1)) != 0) {
57  DMAIRQ &= ~(1 << i+1);
58  if(dma_callback[i] != 0) {
59  process_poll(dma_callback[i]);
60  }
61  }
62  }
63 #endif
64  IRCON_DMAIF = 0;
65  EA = 1;
66 }
67 /*---------------------------------------------------------------------------*/