Contiki 3.x
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 
18 #if DMA_ON
19 extern struct process *dma_callback[DMA_CHANNEL_COUNT];
20 #endif
21 
22 /*---------------------------------------------------------------------------*/
23 #ifdef HAVE_RF_DMA
24 extern void rf_dma_callback_isr(void);
25 #endif
26 #ifdef SPI_DMA_RX
27 extern void spi_rx_dma_callback(void);
28 #endif
29 /*---------------------------------------------------------------------------*/
30 /**
31  * DMA interrupt service routine.
32  *
33  * if callback defined a poll is made to that process
34  */
35 #pragma save
36 #if CC_CONF_OPTIMIZE_STACK_SIZE
37 #pragma exclude bits
38 #endif
39 void
40 dma_ISR(void) __interrupt(DMA_VECTOR)
41 {
42 #if DMA_ON
43  uint8_t i;
44 #endif
45  EA = 0;
46  IRCON_DMAIF = 0;
47 #ifdef HAVE_RF_DMA
48  if((DMAIRQ & 1) != 0) {
49  DMAIRQ &= ~1;
50  DMAARM = 0x81;
51  rf_dma_callback_isr();
52  }
53 #endif
54 #ifdef SPI_DMA_RX
55  if((DMAIRQ & 0x08) != 0) {
56  DMAIRQ &= ~(1 << 3);
57  spi_rx_dma_callback();
58  }
59 #endif
60 #if DMA_ON
61  for(i = 0; i < DMA_CHANNEL_COUNT; i++) {
62  if((DMAIRQ & (1 << i)) != 0) {
63  DMAIRQ &= ~(1 << i);
64  if(dma_callback[i] != 0) {
65  process_poll(dma_callback[i]);
66  }
67  }
68  }
69 #endif
70  EA = 1;
71 }
72 #pragma restore
73 /*---------------------------------------------------------------------------*/
CC2430 registers header file for CC2430.
void process_poll(struct process *p)
Request a process to be polled.
Definition: process.c:371
void dma_ISR(void)
DMA interrupt service routine.
Definition: dma_intr.c:40