diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-14 02:19:09 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-14 02:19:09 -0700 |
commit | d1ebd3bd806f4b4e1f74703f682ca64994c79a28 (patch) | |
tree | 248a6a35a3b7c5232bcdafe6a6bfbe556be8ad0f /include/isr_vector.h | |
parent | c9402e5a5d67ef877fa7f5f67c07a794574ded35 (diff) | |
download | ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.gz ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.bz2 ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.zip |
Get a good, basic framework for ISRs and properly handle the data sections.
Diffstat (limited to 'include/isr_vector.h')
-rw-r--r-- | include/isr_vector.h | 51 |
1 files changed, 3 insertions, 48 deletions
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 <stdint.h> -/* 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) |