aboutsummaryrefslogtreecommitdiff
path: root/include/isr_vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/isr_vector.h')
-rw-r--r--include/isr_vector.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/include/isr_vector.h b/include/isr_vector.h
new file mode 100644
index 0000000..d916db0
--- /dev/null
+++ b/include/isr_vector.h
@@ -0,0 +1,81 @@
+#pragma once
+
+#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;
+
+/** Default IRQ handler. This is weakly defined and can be overridden. */
+void default_irq_handler(void);
+
+/** Weakly defined interrput service routine vectors. These just alias to
+ * default_irq_handler if not overridden. */
+void irq_on_nmi(void);
+void irq_on_exc(void);
+void irq_on_systick(void);
+void irq_on_swi(void);
+void irq_on_tmr0(void);
+void irq_on_gpio_a(void);
+void irq_on_gpio_b(void);
+void irq_on_spi0(void);
+void irq_on_blel(void);
+void irq_on_bleb(void);
+void irq_on_usb(void);
+void irq_on_tmr1(void);
+void irq_on_tmr2(void);
+void irq_on_uart0(void);
+void irq_on_uart1(void);
+void irq_on_rtc(void);
+void irq_on_adc(void);
+void irq_on_pwmx(void);
+void irq_on_tmr3(void);
+void irq_on_uart2(void);
+void irq_on_uart3(void);
+void irq_on_wdog_bat(void);