dma_intr.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <stdio.h>
00012
00013 #include "contiki.h"
00014
00015 #include "dev/dma.h"
00016 #include "cc2430_sfr.h"
00017 #include "banked.h"
00018
00019 extern struct process * dma_callback[4];
00020
00021
00022 #ifdef HAVE_RF_DMA
00023 extern void rf_dma_callback_isr(void);
00024 #endif
00025 #ifdef SPI_DMA_RX
00026 extern void spi_rx_dma_callback(void);
00027 #endif
00028
00029
00030
00031
00032
00033
00034 void
00035 dma_ISR(void) __interrupt (DMA_VECTOR)
00036 {
00037 #ifdef HAVE_DMA
00038 uint8_t i;
00039 #endif
00040 EA=0;
00041 #ifdef HAVE_RF_DMA
00042 if((DMAIRQ & 1) != 0) {
00043 DMAIRQ &= ~1;
00044 DMAARM=0x81;
00045 rf_dma_callback_isr();
00046 }
00047 #endif
00048 #ifdef SPI_DMA_RX
00049 if((DMAIRQ & 0x08) != 0) {
00050 DMAIRQ &= ~(1 << 3);
00051 spi_rx_dma_callback();
00052 }
00053 #endif
00054 #ifdef HAVE_DMA
00055 for(i = 0; i < 4; i++) {
00056 if((DMAIRQ & (1 << i + 1)) != 0) {
00057 DMAIRQ &= ~(1 << i+1);
00058 if(dma_callback[i] != 0) {
00059 process_poll(dma_callback[i]);
00060 }
00061 }
00062 }
00063 #endif
00064 IRCON_DMAIF = 0;
00065 EA = 1;
00066 }
00067