From d1ebd3bd806f4b4e1f74703f682ca64994c79a28 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 14 Nov 2024 02:19:09 -0700 Subject: Get a good, basic framework for ISRs and properly handle the data sections. --- include/isr_vector.h | 51 +++------------------------------------------------ 1 file changed, 3 insertions(+), 48 deletions(-) (limited to 'include/isr_vector.h') diff --git a/include/isr_vector.h b/include/isr_vector.h index d916db0..bd5786a 100644 --- a/include/isr_vector.h +++ b/include/isr_vector.h @@ -2,55 +2,8 @@ #include -/* Type def to a void function to make things mor ereadable. */ -typedef void (*isr_routine)(void); - -typedef struct { - // What NULL points to. nothing useful. - uint32_t reserved__; - // Called when the device boots or reset is pressed. - isr_routine reset_cb; - isr_routine nmi_cb; - isr_routine exc_cb; - - uint32_t _reserved_1[8]; - - isr_routine systick_cb; - - uint32_t _reserved_2; - - isr_routine swi_cb; - - uint32_t _reserved_3; - - isr_routine tmr0_cb; - isr_routine gpio_a_cb; - isr_routine gpio_b_cb; - isr_routine spi0_cb; - isr_routine blel_cb; - isr_routine bleb_cb; - isr_routine usb_cb; - - uint32_t _reserved_4; - - isr_routine tmr1_cb; - isr_routine tmr2_cb; - isr_routine uart0_cb; - isr_routine uart1_cb; - isr_routine rtc_cb; - isr_routine adc_cb; - - uint32_t _reserved_5; - - isr_routine pwmx_cb; - isr_routine tmr3_cb; - isr_routine uart2_cb; - isr_routine uart3_cb; - isr_routine wdog_bat_cb; -} isr_vector_t; - /** Reference to the global ISR vector. */ -extern isr_vector_t isr_vector; +extern char isr_vector; /** Default IRQ handler. This is weakly defined and can be overridden. */ void default_irq_handler(void); @@ -79,3 +32,5 @@ void irq_on_tmr3(void); void irq_on_uart2(void); void irq_on_uart3(void); void irq_on_wdog_bat(void); + +#define IRQ(name) void __attribute__((__section__(".isr_vector"))) name(void) -- cgit