summaryrefslogtreecommitdiff
path: root/kc/core/pic8259.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-02-14 00:33:18 +0000
committerAda Christine <adachristine18@gmail.com>2022-02-14 00:33:18 +0000
commit86de700207fb0114ec52fafc36f84e1cbe508fd8 (patch)
tree830649e3b7081e4c43d579a6ded67f7ee18add92 /kc/core/pic8259.c
parente8a76b2f6b53d99640ceb2850bf4e45118b923f1 (diff)
entering idle loop works with timer
Diffstat (limited to 'kc/core/pic8259.c')
-rw-r--r--kc/core/pic8259.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kc/core/pic8259.c b/kc/core/pic8259.c
index f449e38..b1de903 100644
--- a/kc/core/pic8259.c
+++ b/kc/core/pic8259.c
@@ -21,11 +21,18 @@
#define OCW3_READ_ISR 0xb
#define OCW3_EOI 0x20
-typedef int (*pic8259_handler_func)(uint8_t irq);
-
pic8259_handler_func irq_handlers[PIC_ISR_COUNT];
-__attribute__((optimize("O3")))
+void pic8259_irq_install(uint8_t irq, pic8259_handler_func h)
+{
+ if (irq_handlers[irq])
+ {
+ kprintf("attempt to overwrite irq handler for %u\n", irq);
+ return;
+ }
+ irq_handlers[irq] = h;
+}
+
static void wait(void)
{
// stall for a few cycles