2022-05-14 16:42:37 +00:00
|
|
|
#ifndef ISR_H
|
|
|
|
#define ISR_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define ERR_MAX 5
|
|
|
|
|
2022-05-15 23:02:09 +00:00
|
|
|
#define IRQ_MIN 0x20
|
|
|
|
#define IRQ_MAX 0x2f
|
|
|
|
|
|
|
|
#define IRQ0 0x20
|
|
|
|
#define IRQ1 0x21
|
|
|
|
#define IRQ2 0x22
|
|
|
|
#define IRQ3 0x23
|
|
|
|
#define IRQ4 0x24
|
|
|
|
#define IRQ5 0x25
|
|
|
|
#define IRQ6 0x26
|
|
|
|
#define IRQ7 0x27
|
|
|
|
#define IRQ8 0x28
|
|
|
|
#define IRQ9 0x29
|
|
|
|
#define IRQ10 0x2a
|
|
|
|
#define IRQ11 0x2b
|
|
|
|
#define IRQ12 0x2c
|
|
|
|
#define IRQ13 0x2d
|
|
|
|
#define IRQ14 0x2e
|
|
|
|
#define IRQ15 0x2f
|
2022-05-14 16:42:37 +00:00
|
|
|
|
2022-05-15 23:02:09 +00:00
|
|
|
static int err_count = 0;
|
2022-05-15 00:28:50 +00:00
|
|
|
|
2022-05-15 23:02:09 +00:00
|
|
|
static void (*interrupt_handlers[256]) (uint8_t vector, uint16_t err);
|
2022-05-15 00:28:50 +00:00
|
|
|
|
2022-05-14 16:42:37 +00:00
|
|
|
__attribute__((noreturn))
|
2022-05-15 21:42:53 +00:00
|
|
|
void exception_handler(uint8_t vector, uint16_t err);
|
2022-05-14 16:42:37 +00:00
|
|
|
|
2022-05-15 23:02:09 +00:00
|
|
|
int register_interrupt_handler(int vector, void (*handler)(uint8_t, uint16_t));
|
|
|
|
int unregister_interrupt_handler(int vector);
|
|
|
|
|
|
|
|
void default_handler(uint8_t vector, uint16_t err);
|
|
|
|
|
|
|
|
void fill_isr();
|
2022-05-14 16:42:37 +00:00
|
|
|
|
|
|
|
#endif
|