aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-24 17:03:08 -0700
committerChristian Cunningham <cc@localhost>2022-03-24 17:06:08 -0700
commitd7b3c5bdc5d59b908e1835839c124d6463a5f1e0 (patch)
tree83e806ca3a6e5cceabdb723a57a884f063d96ebb
parent6839008c6aa82ef257231ed1f8087c32266d2d66 (diff)
Started unsubscribe irq functionality
-rw-r--r--include/cpu/irq.h1
-rw-r--r--kernel/cpu/irq.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/include/cpu/irq.h b/include/cpu/irq.h
index c5e59bb..11740ad 100644
--- a/include/cpu/irq.h
+++ b/include/cpu/irq.h
@@ -34,5 +34,6 @@ static inline void disablefiq(void)
unsigned long c_irq_handler(void);
unsigned long c_fiq_handler(void);
void subscribe_irq(unsigned long irq_num, void* handler, void* handler_info);
+void unsubscribe_irq(unsigned long irq_num);
#endif
diff --git a/kernel/cpu/irq.c b/kernel/cpu/irq.c
index 6e48ab1..e7ab8c0 100644
--- a/kernel/cpu/irq.c
+++ b/kernel/cpu/irq.c
@@ -133,3 +133,28 @@ void subscribe_irq(unsigned long irq_num, void* handler, void* handler_info)
break;
}
}
+
+void unsubscribe_irq(unsigned long irq_num)
+{
+ if (irq_num >= MAX_IRQS)
+ return;
+ irqs[irq_num].handler = 0;
+ irqs[irq_num].handler_info = 0;
+ switch (irq_num) {
+ case UART_IRQ:
+ store32(1<<25, IRQ_DISABLE2);
+ break;
+ case SYS_TIMER_0_IRQ:
+ store32(SYS_TIMER_SC_M0, IRQ_DISABLE1);
+ break;
+ case SYS_TIMER_1_IRQ:
+ store32(SYS_TIMER_SC_M1, IRQ_DISABLE1);
+ break;
+ case SYS_TIMER_2_IRQ:
+ store32(SYS_TIMER_SC_M2, IRQ_DISABLE1);
+ break;
+ case SYS_TIMER_3_IRQ:
+ store32(SYS_TIMER_SC_M3, IRQ_DISABLE1);
+ break;
+ }
+}