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 "cc253x.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 /* Avoid referencing bits, we don't call code which use them */
36 #pragma save
37 #if CC_CONF_OPTIMIZE_STACK_SIZE
38 #pragma exclude bits
39 #endif
40 void
41 dma_isr(void) __interrupt(DMA_VECTOR)
42 {
43 #if DMA_ON
44  uint8_t i;
45 #endif
46  EA = 0;
47  DMAIF = 0;
48 #ifdef HAVE_RF_DMA
49  if((DMAIRQ & 1) != 0) {
50  DMAIRQ = ~1;
51  DMAARM = 0x81;
52  rf_dma_callback_isr();
53  }
54 #endif
55 #ifdef SPI_DMA_RX
56  if((DMAIRQ & 0x08) != 0) {
57  DMAIRQ = ~(1 << 3);
58  spi_rx_dma_callback();
59  }
60 #endif
61 #if DMA_ON
62  for(i = 0; i < DMA_CHANNEL_COUNT; i++) {
63  if((DMAIRQ & (1 << i)) != 0) {
64  DMAIRQ = ~(1 << i);
65  if(dma_callback[i] != 0) {
66  process_poll(dma_callback[i]);
67  }
68  }
69  }
70 #endif
71  EA = 1;
72 }
73 #pragma restore
74 /*---------------------------------------------------------------------------*/
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:41
Definitions for TI/Chipcon cc2530, cc2531 and cc2533 SFR registers.