1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

Merge pull request #1861 from haukepetersen/fix_cc2538_irqvector

cpu/cc2538: cleaned up IRQ vector definition
This commit is contained in:
Hauke Petersen 2014-10-24 14:40:10 +02:00
commit 9051c7be4b
5 changed files with 125 additions and 96 deletions

View File

@ -43,6 +43,8 @@ extern "C" {
#define TIMER_0_MAX_VALUE 0xffffffff
#define TIMER_0_IRQn_1 GPTIMER_0A_IRQn
#define TIMER_0_IRQn_2 GPTIMER_0B_IRQn
#define TIMER_0_ISR_1 isr_timer0_chan0
#define TIMER_0_ISR_2 isr_timer0_chan1
/* Timer 1 configuration */
#define TIMER_1_DEV GPTIMER1
@ -50,6 +52,8 @@ extern "C" {
#define TIMER_1_MAX_VALUE 0xffffffff
#define TIMER_1_IRQn_1 GPTIMER_1A_IRQn
#define TIMER_1_IRQn_2 GPTIMER_1B_IRQn
#define TIMER_1_ISR_1 isr_timer1_chan0
#define TIMER_1_ISR_2 isr_timer1_chan1
/* Timer 2 configuration */
#define TIMER_2_DEV GPTIMER2
@ -57,6 +61,8 @@ extern "C" {
#define TIMER_2_MAX_VALUE 0xffffffff
#define TIMER_2_IRQn_1 GPTIMER_2A_IRQn
#define TIMER_2_IRQn_2 GPTIMER_2B_IRQn
#define TIMER_2_ISR_1 isr_timer2_chan0
#define TIMER_2_ISR_2 isr_timer2_chan1
/* Timer 3 configuration */
#define TIMER_3_DEV GPTIMER3
@ -64,6 +70,8 @@ extern "C" {
#define TIMER_3_MAX_VALUE 0xffffffff
#define TIMER_3_IRQn_1 GPTIMER_3A_IRQn
#define TIMER_3_IRQn_2 GPTIMER_3B_IRQn
#define TIMER_3_ISR_1 isr_timer3_chan0
#define TIMER_3_ISR_2 isr_timer3_chan1
/** @} */
@ -83,6 +91,7 @@ extern "C" {
/* UART 0 device configuration */
#define UART_0_DEV UART0
#define UART_0_IRQ UART0_IRQn
#define UART_0_ISR isr_uart0
/* UART 0 pin configuration */
#define UART_0_TX_PIN GPIO_PA1
#define UART_0_RX_PIN GPIO_PA0
@ -90,6 +99,7 @@ extern "C" {
/* UART 1 device configuration */
#define UART_1_DEV UART1
#define UART_1_IRQ UART1_IRQn
#define UART_1_ISR isr_uart1
/* UART 1 pin configuration */
#define UART_1_RTS_PIN GPIO_PD3
#define UART_1_CTS_PIN GPIO_PB0

View File

@ -526,7 +526,7 @@ void gpio_write(gpio_t dev, int value)
/** @brief Interrupt service routine for Port A */
__attribute__((naked))
void gpio_port_a_isr(void)
void isr_gpioa(void)
{
int mis, bit;
gpio_state_t* state;
@ -558,7 +558,7 @@ void gpio_port_a_isr(void)
/** @brief Interrupt service routine for Port B */
__attribute__((naked))
void gpio_port_b_isr(void)
void isr_gpiob(void)
{
int mis, bit;
gpio_state_t* state;
@ -590,7 +590,7 @@ void gpio_port_b_isr(void)
/** @brief Interrupt service routine for Port C */
__attribute__((naked))
void gpio_port_c_isr(void)
void isr_gpioc(void)
{
int mis, bit;
gpio_state_t* state;
@ -622,7 +622,7 @@ void gpio_port_c_isr(void)
/** @brief Interrupt service routine for Port D */
__attribute__((naked))
void gpio_port_d_isr(void)
void isr_gpiod(void)
{
int mis, bit;
gpio_state_t* state;

View File

@ -389,7 +389,7 @@ void timer_reset(tim_t dev)
#if TIMER_0_EN
__attribute__((naked))
void isr_timer0_chan0(void)
void TIMER_0_ISR_1(void)
{
ISR_ENTER();
if (config[0].cb != NULL) config[0].cb(0);
@ -402,7 +402,7 @@ void isr_timer0_chan0(void)
}
__attribute__((naked))
void isr_timer0_chan1(void)
void TIMER_0_ISR_2(void)
{
ISR_ENTER();
if (config[0].cb != NULL) config[0].cb(1);
@ -418,7 +418,7 @@ void isr_timer0_chan1(void)
#if TIMER_1_EN
__attribute__((naked))
void isr_timer1_chan0(void)
void TIMER_1_ISR_1(void)
{
ISR_ENTER();
if (config[1].cb != NULL) config[1].cb(0);
@ -431,7 +431,7 @@ void isr_timer1_chan0(void)
}
__attribute__((naked))
void isr_timer1_chan1(void)
void TIMER_1_ISR_2(void)
{
ISR_ENTER();
if (config[1].cb != NULL) config[1].cb(1);
@ -447,7 +447,7 @@ void isr_timer1_chan1(void)
#if TIMER_2_EN
__attribute__((naked))
void isr_timer2_chan0(void)
void TIMER_2_ISR_1(void)
{
ISR_ENTER();
if (config[2].cb != NULL) config[2].cb(0);
@ -460,7 +460,7 @@ void isr_timer2_chan0(void)
}
__attribute__((naked))
void isr_timer2_chan1(void)
void TIMER_2_ISR_2(void)
{
ISR_ENTER();
if (config[2].cb != NULL) config[2].cb(1);
@ -476,7 +476,7 @@ void isr_timer2_chan1(void)
#if TIMER_3_EN
__attribute__((naked))
void isr_timer3_chan0(void)
void TIMER_3_ISR_1(void)
{
ISR_ENTER();
if (config[3].cb != NULL) config[3].cb(0);
@ -489,7 +489,7 @@ void isr_timer3_chan0(void)
}
__attribute__((naked))
void isr_timer3_chan1(void)
void TIMER_3_ISR_2(void)
{
ISR_ENTER();
if (config[3].cb != NULL) config[3].cb(1);

View File

@ -111,7 +111,7 @@ static void reset(cc2538_uart_t *u)
#if UART_0_EN
__attribute__((naked))
void isr_uart0(void)
void UART_0_ISR(void)
{
uint_fast16_t mis;
@ -144,7 +144,7 @@ void isr_uart0(void)
#if UART_1_EN
__attribute__((naked))
void isr_uart1(void)
void UART_1_ISR(void)
{
uint_fast16_t mis;

View File

@ -19,22 +19,7 @@
#include <stdint.h>
#include "cc2538-gpio.h"
#include "board.h"
#include "periph_conf.h"
/**
* @brief Convert an interrupt number to an interrupt vector offset
*
* @param[in] inum Interrupt number as defined in the "IRQn" enum, may be negative.
*
* @return Corresponding nonnegative vector offset
*/
#define INUM_TO_IVEC(inum) ( (inum) + 16 )
void isr_uart0(void) __attribute__((weak, alias("dummy_handler")));
void isr_uart1(void) __attribute__((weak, alias("dummy_handler")));
void default_handler(void) __attribute__((weak, alias("dummy_handler")));
/**
* memory markers as defined in the linker script
@ -49,7 +34,6 @@ extern uint32_t _ezero;
extern uint32_t _sstack;
extern uint32_t _estack;
/**
* @brief functions for initializing the board, std-lib and kernel
*/
@ -149,79 +133,114 @@ void isr_usage_fault(void)
}
}
/* Cortex-M specific interrupt vectors */
void isr_svc(void) __attribute__((weak, alias("dummy_handler")));
void isr_pendsv(void) __attribute__((weak, alias("dummy_handler")));
void isr_systick(void) __attribute__((weak, alias("dummy_handler")));
void isr_svc(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_pendsv(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_systick(void) __attribute__ ((weak, alias("dummy_handler")));
/* CC2538 specific interrupt vector */
void isr_gpioa(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_gpiob(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_gpioc(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_gpiod(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_uart0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_uart1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_ssi0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_i2c(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_adc(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_watchdog(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer0_chan0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer0_chan1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer1_chan0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer1_chan1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer2_chan0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer2_chan1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_comp(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_rfcoretx(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_rfcoreerr(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_icepick(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_flash(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_aes(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_pka(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_sleepmode(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_mactimer(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_ssi1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer3_chan0(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_timer3_chan1(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_usb(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_dma(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_dmaerr(void) __attribute__ ((weak, alias("dummy_handler")));
/* interrupt vector table */
__attribute__((section(".vectors")))
__attribute__ ((section(".vectors")))
const void *interrupt_vector[] = {
/* Stack pointer */
[0] = &_estack, /* pointer to the top of the empty stack */
(void*) (&_estack), /* pointer to the top of the empty stack */
/* Cortex-M handlers */
[INUM_TO_IVEC(ResetHandler_IRQn)] = reset_handler, /* entry point of the program */
[INUM_TO_IVEC(NonMaskableInt_IRQn)] = isr_nmi, /* non maskable interrupt handler */
[INUM_TO_IVEC(HardFault_IRQn)] = isr_hard_fault, /* if you end up here its not good */
[INUM_TO_IVEC(MemoryManagement_IRQn)] = isr_mem_manage, /* memory controller interrupt */
[INUM_TO_IVEC(BusFault_IRQn)] = isr_bus_fault, /* also not good to end up here */
[INUM_TO_IVEC(UsageFault_IRQn)] = isr_usage_fault, /* autsch */
[INUM_TO_IVEC(SVCall_IRQn)] = isr_svc, /* system call interrupt */
[INUM_TO_IVEC(DebugMonitor_IRQn)] = isr_debug_mon, /* debug interrupt */
[INUM_TO_IVEC(PendSV_IRQn)] = isr_pendsv, /* pendSV interrupt, used for task switching in RIOT */
[INUM_TO_IVEC(SysTick_IRQn)] = isr_systick, /* SysTick interrupt, not used in RIOT */
(void*) reset_handler, /* entry point of the program */
(void*) isr_nmi, /* non maskable interrupt handler */
(void*) isr_hard_fault, /* if you end up here its not good */
(void*) isr_mem_manage, /* memory controller interrupt */
(void*) isr_bus_fault, /* also not good to end up here */
(void*) isr_usage_fault, /* autsch */
(void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */
(void*) isr_svc, /* system call interrupt */
(void*) isr_debug_mon, /* debug interrupt */
(void*) (0UL), /* Reserved */
(void*) isr_pendsv, /* pendSV interrupt, used for task switching in RIOT */
(void*) isr_systick, /* SysTick interrupt, not used in RIOT */
/* CC2538 specific peripheral handlers */
[INUM_TO_IVEC(GPIO_PORT_A_IRQn)] = gpio_port_a_isr, /**< GPIO port A */
[INUM_TO_IVEC(GPIO_PORT_B_IRQn)] = gpio_port_b_isr, /**< GPIO port B */
[INUM_TO_IVEC(GPIO_PORT_C_IRQn)] = gpio_port_c_isr, /**< GPIO port C */
[INUM_TO_IVEC(GPIO_PORT_D_IRQn)] = gpio_port_d_isr, /**< GPIO port D */
[INUM_TO_IVEC(UART_0_IRQ)] = isr_uart0, /**< RIOT UART 0 */
[INUM_TO_IVEC(UART_1_IRQ)] = isr_uart1, /**< RIOT UART 1 */
[INUM_TO_IVEC(SSI0_IRQn)] = default_handler, /**< SSI0 */
[INUM_TO_IVEC(I2C_IRQn)] = default_handler, /**< I2C */
[INUM_TO_IVEC(ADC_IRQn)] = default_handler, /**< ADC */
[INUM_TO_IVEC(WDT_IRQn)] = default_handler, /**< Watchdog Timer */
#if TIMER_0_EN
[INUM_TO_IVEC(TIMER_0_IRQn_1)] = isr_timer0_chan0, /**< RIOT Timer 0 Channel 0 */
[INUM_TO_IVEC(TIMER_0_IRQn_2)] = isr_timer0_chan1, /**< RIOT Timer 0 Channel 1 */
#endif
#if TIMER_1_EN
[INUM_TO_IVEC(TIMER_1_IRQn_1)] = isr_timer1_chan0, /**< RIOT Timer 1 Channel 0 */
[INUM_TO_IVEC(TIMER_1_IRQn_2)] = isr_timer1_chan1, /**< RIOT Timer 1 Channel 1 */
#endif
#if TIMER_2_EN
[INUM_TO_IVEC(TIMER_2_IRQn_1)] = isr_timer2_chan0, /**< RIOT Timer 2 Channel 0 */
[INUM_TO_IVEC(TIMER_2_IRQn_2)] = isr_timer2_chan1, /**< RIOT Timer 2 Channel 1 */
#endif
#if TIMER_3_EN
[INUM_TO_IVEC(TIMER_3_IRQn_1)] = isr_timer3_chan0, /**< RIOT Timer 3 Channel 0 */
[INUM_TO_IVEC(TIMER_3_IRQn_2)] = isr_timer3_chan1, /**< RIOT Timer 3 Channel 1 */
#endif
[INUM_TO_IVEC(ADC_CMP_IRQn)] = default_handler, /**< Analog Comparator */
[INUM_TO_IVEC(RF_RXTX_ALT_IRQn)] = default_handler, /**< RF TX/RX (Alternate) */
[INUM_TO_IVEC(RF_ERR_ALT_IRQn)] = default_handler, /**< RF Error (Alternate) */
[INUM_TO_IVEC(SYS_CTRL_IRQn)] = default_handler, /**< System Control */
[INUM_TO_IVEC(FLASH_CTRL_IRQn)] = default_handler, /**< Flash memory control */
[INUM_TO_IVEC(AES_ALT_IRQn)] = default_handler, /**< AES (Alternate) */
[INUM_TO_IVEC(PKA_ALT_IRQn)] = default_handler, /**< PKA (Alternate) */
[INUM_TO_IVEC(SM_TIMER_ALT_IRQn)] = default_handler, /**< SM Timer (Alternate) */
[INUM_TO_IVEC(MAC_TIMER_ALT_IRQn)] = default_handler, /**< MAC Timer (Alternate) */
[INUM_TO_IVEC(SSI1_IRQn)] = default_handler, /**< SSI1 */
[INUM_TO_IVEC(UDMA_IRQn)] = default_handler, /**< uDMA software */
[INUM_TO_IVEC(UDMA_ERR_IRQn)] = default_handler, /**< uDMA error */
[INUM_TO_IVEC(USB_IRQn)] = default_handler, /**< USB */
[INUM_TO_IVEC(RF_RXTX_IRQn)] = default_handler, /**< RF Core Rx/Tx */
[INUM_TO_IVEC(RF_ERR_IRQn)] = default_handler, /**< RF Core Error */
[INUM_TO_IVEC(AES_IRQn)] = default_handler, /**< AES */
[INUM_TO_IVEC(PKA_IRQn)] = default_handler, /**< PKA */
[INUM_TO_IVEC(SM_TIMER_IRQn)] = default_handler, /**< SM Timer */
[INUM_TO_IVEC(MACTIMER_IRQn)] = default_handler, /**< MAC Timer */
(void*) isr_gpioa, /* 16 GPIO Port A */
(void*) isr_gpiob, /* 17 GPIO Port B */
(void*) isr_gpioc, /* 18 GPIO Port C */
(void*) isr_gpiod, /* 19 GPIO Port D */
(void*) (0UL), /* 20 none */
(void*) isr_uart0, /* 21 UART0 Rx and Tx */
(void*) isr_uart1, /* 22 UART1 Rx and Tx */
(void*) isr_ssi0, /* 23 SSI0 Rx and Tx */
(void*) isr_i2c, /* 24 I2C Master and Slave */
(void*) (0UL), /* 25 Reserved */
(void*) (0UL), /* 26 Reserved */
(void*) (0UL), /* 27 Reserved */
(void*) (0UL), /* 28 Reserved */
(void*) (0UL), /* 29 Reserved */
(void*) isr_adc, /* 30 ADC Sequence 0 */
(void*) (0UL), /* 31 Reserved */
(void*) (0UL), /* 32 Reserved */
(void*) (0UL), /* 33 Reserved */
(void*) isr_watchdog, /* 34 Watchdog timer, timer 0 */
(void*) isr_timer0_chan0, /* 35 Timer 0 subtimer A */
(void*) isr_timer0_chan1, /* 36 Timer 0 subtimer B */
(void*) isr_timer1_chan0, /* 37 Timer 1 subtimer A */
(void*) isr_timer1_chan1, /* 38 Timer 1 subtimer B */
(void*) isr_timer2_chan0, /* 39 Timer 2 subtimer A */
(void*) isr_timer2_chan1, /* 40 Timer 2 subtimer B */
(void*) isr_comp, /* 41 Analog Comparator 0 */
(void*) isr_rfcoretx, /* 42 RFCore Rx/Tx */
(void*) isr_rfcoreerr, /* 43 RFCore Error */
(void*) isr_icepick, /* 44 IcePick */
(void*) isr_flash, /* 45 FLASH Control */
(void*) isr_aes, /* 46 AES */
(void*) isr_pka, /* 47 PKA */
(void*) isr_sleepmode, /* 48 Sleep Timer */
(void*) isr_mactimer, /* 49 MacTimer */
(void*) isr_ssi1, /* 50 SSI1 Rx and Tx */
(void*) isr_timer3_chan0, /* 51 Timer 3 subtimer A */
(void*) isr_timer3_chan1, /* 52 Timer 3 subtimer B */
(void*) (0UL), /* 53 Reserved */
(void*) (0UL), /* 54 Reserved */
(void*) (0UL), /* 55 Reserved */
(void*) (0UL), /* 56 Reserved */
(void*) (0UL), /* 57 Reserved */
(void*) (0UL), /* 58 Reserved */
(void*) (0UL), /* 59 Reserved */
(void*) isr_usb, /* 60 USB 2538 */
(void*) (0UL), /* 61 Reserved */
(void*) isr_dma, /* 62 uDMA */
(void*) isr_dmaerr, /* 63 uDMA Error */
};
#if UPDATE_CCA