aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+ }
+}