Contiki 2.6

cc2420-interrupt.c

00001 #include <AT91SAM7S64.h>
00002 #include <contiki-conf.h>
00003 #include <sys/process.h>
00004 #include <net/uip.h>
00005 #include <dev/cc2420.h>
00006 #include <interrupt-utils.h>
00007 
00008 static void NACKEDFUNC 
00009 cc2420_fifop_interrupt (void) /* System Interrupt Handler */ 
00010 {
00011   ISR_STORE();
00012   ISR_ENABLE_NEST();
00013   cc2420_interrupt();
00014   ISR_DISABLE_NEST(); 
00015   *AT91C_AIC_EOICR = 0;                   /* End of Interrupt */
00016   ISR_RESTORE();
00017 }
00018 
00019 void
00020 cc2420_interrupt_fifop_int_init(void)
00021 {
00022   *AT91C_PIOA_ASR = AT91C_PA30_IRQ1;
00023   *AT91C_PIOA_PDR = AT91C_PA30_IRQ1;
00024   AT91C_AIC_SMR[AT91C_ID_IRQ1] = AT91C_AIC_SRCTYPE_POSITIVE_EDGE | 4;
00025   AT91C_AIC_SVR[AT91C_ID_IRQ1] = (unsigned long)cc2420_fifop_interrupt;
00026   /* *AT91C_AIC_IECR = (1 << AT91C_ID_IRQ1); */
00027 }
00028 
00029 #ifndef __MAKING_DEPS__
00030 
00031 inline int splhigh(void)
00032 {
00033   int save;
00034 #ifndef __THUMBEL__
00035   asm("mrs %0, CPSR\n\torr r1,%0,#0x80\n\tmsr CPSR_c, r1" : "=r" (save)::"r1");
00036 #else
00037 #error Must be compiled in ARM mode
00038 #endif
00039   return save;
00040 }
00041 
00042 inline void splx(int saved)
00043 {
00044 #ifndef __THUMBELL__
00045   asm("msr CPSR_c, %0" ::"r" (saved));
00046 #else
00047 #error Must be compiled in ARM mode
00048 #endif
00049 }
00050 
00051 #endif /* __MAKING_DEPS__ */