From 7c165d29b989a15e2fd23a6d17c08d1981411bc3 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 4 Dec 2011 02:05:02 +0100 Subject: Created member function interrupt gate. --- hal/interrupt.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'hal/interrupt.cpp') diff --git a/hal/interrupt.cpp b/hal/interrupt.cpp index e9e7b24..611b09c 100644 --- a/hal/interrupt.cpp +++ b/hal/interrupt.cpp @@ -1,9 +1,21 @@ #include "interrupt.h" +namespace Interrupt { + MFP mf_vectors[16 + NUM_IRQs]; +}; + void entry(); +void member_function_interrupt_gate() { + uint32_t interrupt_num; + asm ("mrs %0, ipsr" : "=r" (interrupt_num)); + + Interrupt::mf_vectors[interrupt_num].func_p(Interrupt::mf_vectors[interrupt_num].instance_p); +} + extern "C" void unused_interrupt() { - while(1) {} + member_function_interrupt_gate(); + //while(1); } template<> void interrupt() __attribute__ ((weak, alias ("unused_interrupt"))); -- cgit v1.2.3