From d834303f5e642266874b1c99be04dcb9149fefb1 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Fri, 15 Jan 2021 13:04:35 +0100 Subject: interrupt: Removed mf_vectors. --- build/scons_tools/tool_selectmcu.py | 2 +- i2c/i2c.cpp | 3 --- interrupt/interrupt.cpp | 12 ------------ interrupt/interrupt.h | 20 -------------------- 4 files changed, 1 insertion(+), 36 deletions(-) diff --git a/build/scons_tools/tool_selectmcu.py b/build/scons_tools/tool_selectmcu.py index 8d7029f..89e033b 100644 --- a/build/scons_tools/tool_selectmcu.py +++ b/build/scons_tools/tool_selectmcu.py @@ -23,7 +23,7 @@ def SelectMCU(env, mcu, variant_dir = None): RANLIB = '${TOOLCHAIN}ranlib', CCFLAGS = Split('-O2 -Wall -ggdb -ffunction-sections'), - CXXFLAGS = Split('-std=c++20 -fno-exceptions -fno-rtti -Wno-pmf-conversions'), + CXXFLAGS = Split('-std=c++20 -fno-exceptions -fno-rtti'), ASFLAGS = Split('-c -x assembler-with-cpp'), LINKFLAGS = Split('-Wall -nostartfiles -Wl,-T${LINK_SCRIPT} -Wl,--gc-sections'), diff --git a/i2c/i2c.cpp b/i2c/i2c.cpp index d4a3d3a..36ce972 100644 --- a/i2c/i2c.cpp +++ b/i2c/i2c.cpp @@ -99,9 +99,6 @@ void I2C_t::enable() { reg.TRISE = clk / 1000000 + 1; reg.CCR = clk / 2 / 100000; - Interrupt::enable(irq_ev_n, &I2C_t::irq_ev, this); - Interrupt::enable(irq_er_n, &I2C_t::irq_er, this); - reg.CR1 = 1; } diff --git a/interrupt/interrupt.cpp b/interrupt/interrupt.cpp index ebda829..b50c01e 100644 --- a/interrupt/interrupt.cpp +++ b/interrupt/interrupt.cpp @@ -1,20 +1,8 @@ #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() { - member_function_interrupt_gate(); //while(1); } diff --git a/interrupt/interrupt.h b/interrupt/interrupt.h index 80ccb76..0851c87 100644 --- a/interrupt/interrupt.h +++ b/interrupt/interrupt.h @@ -120,26 +120,6 @@ namespace Interrupt { inline void set_priority(IRQ n, uint8_t priority) { NVIC.IPR[n] = priority; } - - struct MFP { - void (*func_p)(void*); - void* instance_p; - }; - - extern MFP mf_vectors[]; - - template - inline void set_handler(IRQ n, void (T::*f)(), T* i) { - MFP& mfp = mf_vectors[16 + n]; - mfp.func_p = reinterpret_cast(f); - mfp.instance_p = i; - } - - template - inline void enable(IRQ n, void (T::*f)(), T* i) { - set_handler(n, f, i); - enable(n); - } }; template -- cgit v1.2.3