diff --git a/cpu/msp430/button.c b/cpu/msp430/button.c index 31eb9c006..6a29275bb 100644 --- a/cpu/msp430/button.c +++ b/cpu/msp430/button.c @@ -31,6 +31,7 @@ #include "contiki.h" #include "dev/button.h" +#include "isr_compat.h" #define BUTTON_PORT 2 #define BUTTON_PIN 7 @@ -57,8 +58,7 @@ button_init(struct process *proc) P2IE &= ~BV(BUTTON_PIN); } -interrupt(PORT2_VECTOR) -__button_interrupt(void) +ISR(PORT2, __button_interrupt) { static struct timer debouncetimer; diff --git a/cpu/msp430/cc2420-arch-sfd.c b/cpu/msp430/cc2420-arch-sfd.c index 21e41b9d8..856a5d2e0 100644 --- a/cpu/msp430/cc2420-arch-sfd.c +++ b/cpu/msp430/cc2420-arch-sfd.c @@ -32,6 +32,7 @@ #include "contiki.h" #include "dev/spi.h" #include "dev/cc2420.h" +#include "isr_compat.h" extern volatile uint8_t cc2420_sfd_counter; extern volatile uint16_t cc2420_sfd_start_time; @@ -39,13 +40,7 @@ extern volatile uint16_t cc2420_sfd_end_time; /*---------------------------------------------------------------------------*/ /* SFD interrupt for timestamping radio packets */ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMERB1_VECTOR -__interrupt void -#else -interrupt(TIMERB1_VECTOR) -#endif -cc24240_timerb1_interrupt(void) +ISR(TIMERB1, cc2420_timerb1_interrupt) { int tbiv; ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/cc2420-arch.c b/cpu/msp430/cc2420-arch.c index abc44fa9a..e6ad9657a 100644 --- a/cpu/msp430/cc2420-arch.c +++ b/cpu/msp430/cc2420-arch.c @@ -34,6 +34,7 @@ #include "dev/spi.h" #include "dev/cc2420.h" +#include "isr_compat.h" #ifdef CC2420_CONF_SFD_TIMESTAMPS #define CONF_SFD_TIMESTAMPS CC2420_CONF_SFD_TIMESTAMPS @@ -48,14 +49,7 @@ #endif /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=CC2420_IRQ_VECTOR -__interrupt void -#else -interrupt(CC2420_IRQ_VECTOR) -#endif - -cc24240_port1_interrupt(void) +ISR(CC2420_IRQ, cc2420_port1_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); @@ -65,7 +59,6 @@ cc24240_port1_interrupt(void) ENERGEST_OFF(ENERGEST_TYPE_IRQ); } - /*---------------------------------------------------------------------------*/ void cc2420_arch_init(void) diff --git a/cpu/msp430/cc2520-arch-sfd.c b/cpu/msp430/cc2520-arch-sfd.c index e24090d09..ff47a48c8 100644 --- a/cpu/msp430/cc2520-arch-sfd.c +++ b/cpu/msp430/cc2520-arch-sfd.c @@ -30,6 +30,7 @@ #include "contiki.h" #include "dev/spi.h" #include "dev/cc2520.h" +#include "isr_compat.h" extern volatile uint8_t cc2520_sfd_counter; extern volatile uint16_t cc2520_sfd_start_time; @@ -37,13 +38,7 @@ extern volatile uint16_t cc2520_sfd_end_time; /*---------------------------------------------------------------------------*/ /* SFD interrupt for timestamping radio packets */ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMERB1_VECTOR -__interrupt void -#else -interrupt(TIMERB1_VECTOR) -#endif -cc2520_timerb1_interrupt(void) +ISR(TIMERB1, cc2520_timerb1_interrupt) { int tbiv; ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/cc2520-arch.c b/cpu/msp430/cc2520-arch.c index f6613dade..e8792b86a 100644 --- a/cpu/msp430/cc2520-arch.c +++ b/cpu/msp430/cc2520-arch.c @@ -32,6 +32,7 @@ #include "dev/spi.h" #include "dev/cc2520.h" +#include "isr_compat.h" #ifdef CC2520_CONF_SFD_TIMESTAMPS #define CONF_SFD_TIMESTAMPS CC2520_CONF_SFD_TIMESTAMPS @@ -46,13 +47,7 @@ #endif /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=CC2520_IRQ_VECTOR -__interrupt void -#else -interrupt(CC2520_IRQ_VECTOR) -#endif -cc2520_port1_interrupt(void) +ISR(CC2520_IRQ, cc2520_port1_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f1xxx/clock.c b/cpu/msp430/f1xxx/clock.c index b133eaa6e..8e0be8728 100644 --- a/cpu/msp430/f1xxx/clock.c +++ b/cpu/msp430/f1xxx/clock.c @@ -35,6 +35,7 @@ #include "sys/etimer.h" #include "rtimer-arch.h" #include "dev/watchdog.h" +#include "isr_compat.h" #define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND) @@ -46,13 +47,7 @@ static volatile clock_time_t count = 0; /* last_tar is used for calculating clock_fine */ static volatile uint16_t last_tar = 0; /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMERA1_VECTOR -__interrupt void -#else -interrupt(TIMERA1_VECTOR) -#endif -timera1 (void) +ISR(TIMERA1, timera1) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f1xxx/rtimer-arch.c b/cpu/msp430/f1xxx/rtimer-arch.c index 9584ee4e7..a1ef89a6f 100644 --- a/cpu/msp430/f1xxx/rtimer-arch.c +++ b/cpu/msp430/f1xxx/rtimer-arch.c @@ -44,6 +44,7 @@ #include "sys/rtimer.h" #include "sys/process.h" #include "dev/watchdog.h" +#include "isr_compat.h" #define DEBUG 0 #if DEBUG @@ -54,13 +55,7 @@ #endif /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMERA0_VECTOR -__interrupt void -#else -interrupt(TIMERA0_VECTOR) -#endif -timera0 (void) +ISR(TIMERA0, timera0) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f1xxx/uart1.c b/cpu/msp430/f1xxx/uart1.c index f9bf8ce52..123b542ad 100644 --- a/cpu/msp430/f1xxx/uart1.c +++ b/cpu/msp430/f1xxx/uart1.c @@ -39,6 +39,7 @@ #include "dev/watchdog.h" #include "sys/ctimer.h" #include "lib/ringbuf.h" +#include "isr_compat.h" static int (*uart1_input_handler)(unsigned char c); static volatile uint8_t rx_in_progress; @@ -236,13 +237,7 @@ uart1_init(unsigned long ubr) } /*---------------------------------------------------------------------------*/ #if !RX_WITH_DMA -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=UART1RX_VECTOR -__interrupt void -#else -interrupt(UART1RX_VECTOR) -#endif -uart1_rx_interrupt(void) +ISR(UART1RX, uart1_rx_interrupt) { uint8_t c; ENERGEST_ON(ENERGEST_TYPE_IRQ); @@ -273,13 +268,7 @@ uart1_rx_interrupt(void) #endif /* !RX_WITH_DMA */ /*---------------------------------------------------------------------------*/ #if TX_WITH_INTERRUPT -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=UART1TX_VECTOR -__interrupt void -#else -interrupt(UART1TX_VECTOR) -#endif -uart1_tx_interrupt(void) +ISR(UART1TX, uart1_tx_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f2xxx/uart0.c b/cpu/msp430/f2xxx/uart0.c index e79abacc1..d0ad49730 100644 --- a/cpu/msp430/f2xxx/uart0.c +++ b/cpu/msp430/f2xxx/uart0.c @@ -41,6 +41,7 @@ #include "dev/watchdog.h" #include "lib/ringbuf.h" #include "dev/leds.h" +#include "isr_compat.h" static int (*uart0_input_handler)(unsigned char c); @@ -138,14 +139,7 @@ uart0_init(unsigned long ubr) #endif /* TX_WITH_INTERRUPT */ } /*---------------------------------------------------------------------------*/ - -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCIAB0RX_VECTOR -__interrupt void -#else -interrupt(USCIAB0RX_VECTOR) -#endif -uart0_rx_interrupt(void) +ISR(USCIAB0RX, uart0_rx_interrupt) { uint8_t c; @@ -165,13 +159,7 @@ uart0_rx_interrupt(void) } /*---------------------------------------------------------------------------*/ #if TX_WITH_INTERRUPT -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCIAB0TX_VECTOR -__interrupt void -#else -interrupt(USCIAB0TX_VECTOR) -#endif -uart0_tx_interrupt(void) +ISR(USCIAB0TX, uart0_tx_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); if((IFG2 & UCA0TXIFG)){ diff --git a/cpu/msp430/f2xxx/uart1.c b/cpu/msp430/f2xxx/uart1.c index d300e455a..b2ab64101 100644 --- a/cpu/msp430/f2xxx/uart1.c +++ b/cpu/msp430/f2xxx/uart1.c @@ -37,8 +37,8 @@ #include "sys/energest.h" #include "dev/uart1.h" #include "dev/watchdog.h" - #include "lib/ringbuf.h" +#include "isr_compat.h" static int (*uart1_input_handler)(unsigned char c); @@ -120,8 +120,7 @@ uart1_init(unsigned long ubr) } /*---------------------------------------------------------------------------*/ -interrupt(USCIAB1RX_VECTOR) -uart1_rx_interrupt(void) +ISR(USCIAB1RX, uart1_rx_interrupt) { uint8_t c; ENERGEST_ON(ENERGEST_TYPE_IRQ); @@ -141,8 +140,7 @@ uart1_rx_interrupt(void) } /*---------------------------------------------------------------------------*/ #if TX_WITH_INTERRUPT -interrupt(USCIAB1TX_VECTOR) -uart1_tx_interrupt(void) +ISR(USCIAB1TX, uart1_tx_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); if(IFG2 & UCA0TXIFG) { diff --git a/cpu/msp430/f5xxx/clock.c b/cpu/msp430/f5xxx/clock.c index 49d693dde..d0cca7e83 100644 --- a/cpu/msp430/f5xxx/clock.c +++ b/cpu/msp430/f5xxx/clock.c @@ -35,6 +35,7 @@ #include "sys/etimer.h" #include "rtimer-arch.h" #include "dev/watchdog.h" +#include "isr_compat.h" #define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND) @@ -46,13 +47,7 @@ static volatile clock_time_t count = 0; /* last_tar is used for calculating clock_fine, last_ccr might be better? */ static volatile uint16_t last_tar = 0; /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMER1_A1_VECTOR -__interrupt void -#else -interrupt(TIMER1_A1_VECTOR) -#endif -timera1 (void) +ISR(TIMER1_A1, timera1) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f5xxx/rtimer-arch.c b/cpu/msp430/f5xxx/rtimer-arch.c index 910d76b9c..80f50ae8d 100644 --- a/cpu/msp430/f5xxx/rtimer-arch.c +++ b/cpu/msp430/f5xxx/rtimer-arch.c @@ -41,6 +41,7 @@ #include "sys/rtimer.h" #include "sys/process.h" #include "dev/watchdog.h" +#include "isr_compat.h" #define DEBUG 0 #if DEBUG @@ -51,13 +52,7 @@ #endif /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=TIMER1_A0_VECTOR -__interrupt void -#else -interrupt(TIMER1_A0_VECTOR) -#endif -timera0 (void) +ISR(TIMER1_A0, timera0) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/msp430/f5xxx/uart0.c b/cpu/msp430/f5xxx/uart0.c index 7c1e26b31..563da896f 100644 --- a/cpu/msp430/f5xxx/uart0.c +++ b/cpu/msp430/f5xxx/uart0.c @@ -38,6 +38,7 @@ #include "sys/energest.h" #include "dev/uart0.h" #include "dev/watchdog.h" +#include "isr_compat.h" static int (*uart0_input_handler)(unsigned char c); @@ -98,18 +99,12 @@ uart0_init(unsigned long ubr) UCA0IE |= UCRXIE; /* Enable UCA0 RX interrupt */ } /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCI_A0_VECTOR -__interrupt void -#else -interrupt(USCI_A0_VECTOR) -#endif -uart0_rx_interrupt(void) +ISR(USCI_A0, uart0_rx_interrupt) { uint8_t c; ENERGEST_ON(ENERGEST_TYPE_IRQ); - if (UCA0IV == 2) { + if(UCA0IV == 2) { if(UCA0STAT & UCRXERR) { c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */ } else { diff --git a/cpu/msp430/f5xxx/uart1.c b/cpu/msp430/f5xxx/uart1.c index f8e6d6a68..8680b1867 100644 --- a/cpu/msp430/f5xxx/uart1.c +++ b/cpu/msp430/f5xxx/uart1.c @@ -38,6 +38,7 @@ #include "sys/energest.h" #include "dev/uart1.h" #include "dev/watchdog.h" +#include "isr_compat.h" static int (*uart1_input_handler)(unsigned char c); @@ -103,13 +104,7 @@ uart1_init(unsigned long ubr) UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */ } /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCI_A1_VECTOR -__interrupt void -#else -interrupt(USCI_A1_VECTOR) -#endif -uart1_rx_interrupt(void) +ISR(USCI_A1, uart1_rx_interrupt) { uint8_t c; diff --git a/cpu/msp430/isr_compat.h b/cpu/msp430/isr_compat.h new file mode 100644 index 000000000..5d1a2dcff --- /dev/null +++ b/cpu/msp430/isr_compat.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2005 Steve Underwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _ISR_COMPAT_H_ +#define _ISR_COMPAT_H_ + +/* Cross compiler interrupt service routine compatibility definitions */ +/* This code currently allows for: + MSPGCC - the GNU tools for the MSP430 + Quadravox AQ430 + IAR Version 1 (old syntax) + IAR Versions 2, 3, 4, 5 (new syntax) + Rowley Crossworks + Code Composer Essentials + + These macros allow us to define interrupt routines for all + compilers with a common syntax: + + ISR(, ) + { + } + + e.g. + + ISR(ADC12, adc_service_routine) + { + ADC12CTL0 &= ~ENC; + ADC12CTL0 |= ENC; + } +*/ + +/* 2012-03-02: minor update to support IAR version 4 and 5 */ + +/* A tricky #define to stringify _Pragma parameters */ +#define __PRAGMA__(x) _Pragma(#x) + +#if defined(__GNUC__) && defined(__MSP430__) + /* This is the MSPGCC compiler */ +#define ISR(a,b) interrupt(a ## _VECTOR) b(void) +#elif defined(__AQCOMPILER__) + /* This is the Quadravox compiler */ +#define ISR(a,b) void _INTERRUPT[a ## _VECTOR] b(void) +#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 200) + /* This is V1.xx of the IAR compiler. */ +#define ISR(a,b) interrupt[a ## _VECTOR] void b(void) +#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 600) + /* This is V2.xx, V3.xx, V4.xx, V5.xx of the IAR compiler. */ +#define ISR(a,b) \ +__PRAGMA__(vector=a ##_VECTOR) \ +__interrupt void b(void) +#elif defined(__CROSSWORKS_MSP430) + /* This is the Rowley Crossworks compiler */ +#define ISR(a,b) void b __interrupt[a ## _VECTOR](void) +#elif defined(__TI_COMPILER_VERSION__) + /* This is the Code Composer Essentials compiler. */ +#define ISR(a,b) __interrupt void b(void); \ +a ## _ISR(b) \ +__interrupt void b(void) +#else + #error Compiler not recognised. +#endif + +#endif diff --git a/cpu/msp430/watchdog.c b/cpu/msp430/watchdog.c index 6ac86994c..b38db161d 100644 --- a/cpu/msp430/watchdog.c +++ b/cpu/msp430/watchdog.c @@ -33,6 +33,7 @@ #include "contiki.h" #include "dev/watchdog.h" +#include "isr_compat.h" static int counter = 0; @@ -70,13 +71,7 @@ printstring(char *s) #endif /* CONTIKI_TARGET_SKY */ #endif /* PRINT_STACK_ON_REBOOT */ /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=WDT_VECTOR -__interrupt void -#else -interrupt(WDT_VECTOR) -#endif -watchdog_interrupt(void) +ISR(WDT, watchdog_interrupt) { #ifdef CONTIKI_TARGET_SKY #if PRINT_STACK_ON_REBOOT diff --git a/platform/esb/dev/button-sensor.c b/platform/esb/dev/button-sensor.c index 4956fb51f..eb6a81f8a 100644 --- a/platform/esb/dev/button-sensor.c +++ b/platform/esb/dev/button-sensor.c @@ -33,7 +33,7 @@ #include "dev/button-sensor.h" #include "dev/hwconf.h" -#include +#include "isr_compat.h" const struct sensors_sensor button_sensor; @@ -43,8 +43,7 @@ HWCONF_PIN(BUTTON, 2, 7); HWCONF_IRQ(BUTTON, 2, 7); /*---------------------------------------------------------------------------*/ -interrupt(PORT2_VECTOR) - irq_p2(void) +ISR(PORT2, irq_p2) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/platform/esb/dev/ir.c b/platform/esb/dev/ir.c index 5a5bdefb1..56ac46a27 100644 --- a/platform/esb/dev/ir.c +++ b/platform/esb/dev/ir.c @@ -78,6 +78,7 @@ Contributors: Thomas Pietsch, Bjoern Lichtblau #include "dev/leds.h" #include "dev/beep.h" +#include "isr_compat.h" PROCESS(ir_process, "IR receiver"); process_event_t ir_event_received; @@ -202,7 +203,7 @@ static void clearDataAvailableBit(void){ recvdata &= 0xEFFF; } /// Timer B0 interrupt service routine -interrupt(TIMERB1_VECTOR) Timer_B1 (void) { +ISR(TIMERB1, Timer_B1) { /*P2OUT = (P2OUT & 0xf7) | (8 - (P2OUT & 0x08));*/ diff --git a/platform/esb/dev/irq.c b/platform/esb/dev/irq.c index d16d4de87..bf5ef6649 100644 --- a/platform/esb/dev/irq.c +++ b/platform/esb/dev/irq.c @@ -34,6 +34,7 @@ #include "lib/sensors.h" #include "dev/irq.h" #include "dev/lpm.h" +#include "isr_compat.h" #define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno] @@ -42,8 +43,7 @@ static int (* port1_irq[8])(void); static unsigned char adcflags; /*---------------------------------------------------------------------------*/ -interrupt(PORT1_VECTOR) - irq_p1(void) +ISR(PORT1, irq_p1) { int i; ENERGEST_ON(ENERGEST_TYPE_IRQ); @@ -58,8 +58,7 @@ interrupt(PORT1_VECTOR) ENERGEST_OFF(ENERGEST_TYPE_IRQ); } /*---------------------------------------------------------------------------*/ -interrupt (ADC_VECTOR) - irq_adc(void) +ISR(ADC, irq_adc) { int i; ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/platform/esb/dev/rs232.c b/platform/esb/dev/rs232.c index 79c9d737b..239ee3181 100644 --- a/platform/esb/dev/rs232.c +++ b/platform/esb/dev/rs232.c @@ -47,12 +47,12 @@ #include #include "contiki-esb.h" +#include "isr_compat.h" static int (* input_handler)(unsigned char) = NULL; /*---------------------------------------------------------------------------*/ -interrupt(UART1RX_VECTOR) - rs232_rx_usart1(void) +ISR(UART1RX, rs232_rx_usart1) { ENERGEST_ON(ENERGEST_TYPE_IRQ); /* Check status register for receive errors. - before reading RXBUF since diff --git a/platform/esb/dev/tr1001-gcr.c b/platform/esb/dev/tr1001-gcr.c index 744d6b358..4defcc9bf 100644 --- a/platform/esb/dev/tr1001-gcr.c +++ b/platform/esb/dev/tr1001-gcr.c @@ -59,6 +59,7 @@ #include "lib/crc16.h" #include "net/netstack.h" #include "net/rime/rimestats.h" +#include "isr_compat.h" #include @@ -385,8 +386,7 @@ tr1001_init(void) return 1; } /*---------------------------------------------------------------------------*/ -interrupt (UART0RX_VECTOR) - tr1001_rxhandler(void) +ISR(UART0RX, tr1001_rxhandler) { ENERGEST_ON(ENERGEST_TYPE_IRQ); tr1001_default_rxhandler_pt(RXBUF0); diff --git a/platform/esb/dev/tr1001.c b/platform/esb/dev/tr1001.c index 13cfe42bd..de6ded2f1 100644 --- a/platform/esb/dev/tr1001.c +++ b/platform/esb/dev/tr1001.c @@ -59,6 +59,7 @@ #include "lib/crc16.h" #include "net/netstack.h" #include "net/rime/rimestats.h" +#include "isr_compat.h" #include @@ -376,8 +377,7 @@ tr1001_init(void) return 1; } /*---------------------------------------------------------------------------*/ -interrupt (UART0RX_VECTOR) - tr1001_rxhandler(void) +ISR(UART0RX, tr1001_rxhandler) { ENERGEST_ON(ENERGEST_TYPE_IRQ); tr1001_default_rxhandler_pt(RXBUF0); diff --git a/platform/msb430/dev/cc1020.c b/platform/msb430/dev/cc1020.c index 1e8e1a0a6..b050c7931 100644 --- a/platform/msb430/dev/cc1020.c +++ b/platform/msb430/dev/cc1020.c @@ -52,6 +52,7 @@ #include "net/rime/rimestats.h" #include "dev/dma.h" #include "sys/energest.h" +#include "isr_compat.h" #define DEBUG 0 #if DEBUG @@ -458,7 +459,7 @@ PROCESS_THREAD(cc1020_receiver_process, ev, data) PROCESS_END(); } -interrupt(UART0RX_VECTOR) cc1020_rxhandler(void) +ISR(UART0RX, cc1020_rxhandler) { static signed char syncbs; static union { diff --git a/platform/msb430/dev/dma.c b/platform/msb430/dev/dma.c index 811416e76..ce175ee12 100644 --- a/platform/msb430/dev/dma.c +++ b/platform/msb430/dev/dma.c @@ -41,10 +41,11 @@ #include "contiki-msb430.h" #include "dev/cc1020.h" #include "dev/dma.h" +#include "isr_compat.h" static void (*callbacks[DMA_LINES])(void); -interrupt(DACDMA_VECTOR) irq_dacdma(void) +ISR(DACDMA, irq_dacdma) { if(DMA0CTL & DMAIFG) { DMA0CTL &= ~(DMAIFG | DMAIE); diff --git a/platform/msb430/dev/msb430-uart1.c b/platform/msb430/dev/msb430-uart1.c index 997648931..d8ce6a44c 100644 --- a/platform/msb430/dev/msb430-uart1.c +++ b/platform/msb430/dev/msb430-uart1.c @@ -55,6 +55,7 @@ Berlin, 2007 #include #include "dev/msb430-uart1.h" #include "dev/lpm.h" +#include "isr_compat.h" #ifndef U1ME #define U1ME ME2 @@ -204,8 +205,7 @@ uart_get_mode(void) return uart_mode; } /*---------------------------------------------------------------------------*/ -interrupt(UART1RX_VECTOR) -uart_rx(void) +ISR(UART1RX, uart_rx) { uart_handler_t handler = uart_handler[uart_mode]; int c; diff --git a/platform/sky/dev/button-sensor.c b/platform/sky/dev/button-sensor.c index 30a281eb0..51f0acf93 100644 --- a/platform/sky/dev/button-sensor.c +++ b/platform/sky/dev/button-sensor.c @@ -34,6 +34,7 @@ #include "lib/sensors.h" #include "dev/hwconf.h" #include "dev/button-sensor.h" +#include "isr_compat.h" const struct sensors_sensor button_sensor; @@ -44,13 +45,7 @@ HWCONF_PIN(BUTTON, 2, 7); HWCONF_IRQ(BUTTON, 2, 7); /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=PORT2_VECTOR -__interrupt void -#else -interrupt(PORT2_VECTOR) -#endif - irq_p2(void) +ISR(PORT2, irq_p2) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/platform/wismote/dev/button-sensor.c b/platform/wismote/dev/button-sensor.c index 51bf38c2f..e0e6c9375 100644 --- a/platform/wismote/dev/button-sensor.c +++ b/platform/wismote/dev/button-sensor.c @@ -31,6 +31,7 @@ #include "lib/sensors.h" #include "dev/hwconf.h" #include "dev/button-sensor.h" +#include "isr_compat.h" const struct sensors_sensor button_sensor; @@ -41,13 +42,7 @@ HWCONF_PIN(BUTTON, 2, 7); HWCONF_IRQ(BUTTON, 2, 7); /*---------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=PORT2_VECTOR -__interrupt void -#else -interrupt(PORT2_VECTOR) -#endif - irq_p2(void) +ISR(PORT2, irq_p2) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/platform/z1/dev/adxl345.c b/platform/z1/dev/adxl345.c index c19ad0031..df653d7f8 100644 --- a/platform/z1/dev/adxl345.c +++ b/platform/z1/dev/adxl345.c @@ -44,6 +44,7 @@ #include "adxl345.h" #include "cc2420.h" #include "i2cmaster.h" +#include "isr_compat.h" /* Callback pointers when interrupt occurs */ void (*accm_int1_cb)(uint8_t reg); @@ -375,13 +376,8 @@ PROCESS_THREAD(accmeter_process, ev, data) { #if 1 static struct timer suppressTimer1, suppressTimer2; -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=PORT1_VECTOR -__interrupt void -#else -interrupt (PORT1_VECTOR) -#endif -port1_isr (void) { +ISR(PORT1, port1_isr) +{ ENERGEST_ON(ENERGEST_TYPE_IRQ); /* ADXL345_IFG.x goes high when interrupt occurs, use to check what interrupted */ if ((ADXL345_IFG & ADXL345_INT1_PIN) && !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){ diff --git a/platform/z1/dev/button-sensor.c b/platform/z1/dev/button-sensor.c index bea5b3669..0c1fff35e 100644 --- a/platform/z1/dev/button-sensor.c +++ b/platform/z1/dev/button-sensor.c @@ -35,6 +35,7 @@ #include "lib/sensors.h" #include "dev/hwconf.h" #include "dev/button-sensor.h" +#include "isr_compat.h" const struct sensors_sensor button_sensor; @@ -45,14 +46,7 @@ HWCONF_PIN(BUTTON, 2, 5); HWCONF_IRQ(BUTTON, 2, 5); /*---------------------------------------------------------------------------*/ - -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=PORT2_VECTOR -__interrupt void -#else -interrupt(PORT2_VECTOR) -#endif - irq_p2(void) +ISR(PORT2, irq_p2) { ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/platform/z1/dev/cc2420-arch.c b/platform/z1/dev/cc2420-arch.c index 5fcfa07b4..2e3d2f18a 100644 --- a/platform/z1/dev/cc2420-arch.c +++ b/platform/z1/dev/cc2420-arch.c @@ -33,6 +33,7 @@ #include "contiki-net.h" #include "dev/spi.h" #include "dev/cc2420.h" +#include "isr_compat.h" #ifndef CONF_SFD_TIMESTAMPS #define CONF_SFD_TIMESTAMPS 0 @@ -45,8 +46,7 @@ /*---------------------------------------------------------------------------*/ #if 0 // this is now handled in the ADXL345 accelerometer code as it uses irq on port1 too. -interrupt(CC2420_IRQ_VECTOR) -cc24240_port1_interrupt(void) +ISR(CC2420_IRQ, cc24240_port1_interrupt) { ENERGEST_ON(ENERGEST_TYPE_IRQ); if(cc2420_interrupt()) { diff --git a/platform/z1/dev/i2cmaster.c b/platform/z1/dev/i2cmaster.c index 54871467a..c2bad507d 100644 --- a/platform/z1/dev/i2cmaster.c +++ b/platform/z1/dev/i2cmaster.c @@ -39,6 +39,7 @@ */ #include "i2cmaster.h" +#include "isr_compat.h" signed char tx_byte_ctr, rx_byte_ctr; unsigned char rx_buf[2]; @@ -201,13 +202,8 @@ i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf) { } /*----------------------------------------------------------------------------*/ -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCIAB1TX_VECTOR -__interrupt void -#else -interrupt (USCIAB1TX_VECTOR) -#endif -i2c_tx_interrupt (void) { +ISR(USCIAB1TX, i2c_tx_interrupt) +{ // TX Part if (UC1IFG & UCB1TXIFG) { // TX int. condition if (tx_byte_ctr == 0) { @@ -237,18 +233,11 @@ i2c_tx_interrupt (void) { #endif } -#ifdef __IAR_SYSTEMS_ICC__ -#pragma vector=USCIAB1RX_VECTOR -__interrupt void -#else -interrupt (USCIAB1RX_VECTOR) -#endif -i2c_rx_interrupt(void) { - if (UCB1STAT & UCNACKIFG){ +ISR(USCIAB1RX, i2c_rx_interrupt) +{ + if(UCB1STAT & UCNACKIFG) { PRINTFDEBUG("!!! NACK received in RX\n"); UCB1CTL1 |= UCTXSTP; UCB1STAT &= ~UCNACKIFG; } } - -