Cross compiler interrupt service routine compatibility definitions for MSP430 based platforms based on isr_compat.h by Steve Underwood.

This commit is contained in:
Niclas Finne 2012-03-07 01:14:54 +01:00
parent 7eac4393c2
commit 684c3edfa6
31 changed files with 157 additions and 182 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)){

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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;

87
cpu/msp430/isr_compat.h Normal file
View File

@ -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(<interrupt>, <routine name>)
{
}
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

View File

@ -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

View File

@ -33,7 +33,7 @@
#include "dev/button-sensor.h"
#include "dev/hwconf.h"
#include <signal.h>
#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);

View File

@ -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));*/

View File

@ -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);

View File

@ -47,12 +47,12 @@
#include <string.h>
#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

View File

@ -59,6 +59,7 @@
#include "lib/crc16.h"
#include "net/netstack.h"
#include "net/rime/rimestats.h"
#include "isr_compat.h"
#include <string.h>
@ -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);

View File

@ -59,6 +59,7 @@
#include "lib/crc16.h"
#include "net/netstack.h"
#include "net/rime/rimestats.h"
#include "isr_compat.h"
#include <string.h>
@ -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);

View File

@ -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 {

View File

@ -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);

View File

@ -55,6 +55,7 @@ Berlin, 2007
#include <string.h>
#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;

View File

@ -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);

View File

@ -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);

View File

@ -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))){

View File

@ -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);

View File

@ -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()) {

View File

@ -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;
}
}