aboutsummaryrefslogtreecommitdiff
path: root/src/pic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pic.h')
-rw-r--r--src/pic.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pic.h b/src/pic.h
index f020f55..d4228e1 100644
--- a/src/pic.h
+++ b/src/pic.h
@@ -76,6 +76,28 @@ get_pic2_isr()
return inb(PORT_PIC2_CMD);
}
+// post.c
+void __set_irq(int vector, void *loc);
+
+static inline void
+__enable_hwirq(int hwirq, void (*func)(void))
+{
+ int vector;
+ if (hwirq < 8) {
+ unmask_pic1(1 << hwirq);
+ vector = 0x08 + hwirq;
+ } else {
+ unmask_pic2(1 << (hwirq - 8));
+ vector = 0x70 + hwirq - 8;
+ }
+ __set_irq(vector, func);
+}
+
+#define enable_hwirq(irq, func) do { \
+ extern void func (void); \
+ __enable_hwirq(irq, func); \
+ } while (0)
+
void pic_setup();
#endif // pic.h