From 2b23d3ecaf2074ad640f66ff198b6043f3ea9e6e Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 5 Jun 2021 11:58:17 +0100 Subject: x1000: Allow setting IRQ handlers dynamically Avoids having to #define the names of GPIO pin interrupt handlers, as they can now be set at runtime instead. Change-Id: Ib5da1bdb475ff7b64280fe7cdd00adab63389152 --- firmware/target/mips/ingenic_x1000/system-x1000.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'firmware/target/mips/ingenic_x1000/system-x1000.c') diff --git a/firmware/target/mips/ingenic_x1000/system-x1000.c b/firmware/target/mips/ingenic_x1000/system-x1000.c index c0b0dbc65e..779bb2055c 100644 --- a/firmware/target/mips/ingenic_x1000/system-x1000.c +++ b/firmware/target/mips/ingenic_x1000/system-x1000.c @@ -233,7 +233,7 @@ intr(OST); #undef intr -static void(*const irqvector[])(void) = { +static void(*irqvector[])(void) = { /* ICSR0: 0 - 31 */ DMIC, AIC, UIRQ, UIRQ, UIRQ, UIRQ, UIRQ, SFC, SSI0, UIRQ, PDMA, PDMAD, UIRQ, UIRQ, UIRQ, UIRQ, @@ -263,6 +263,13 @@ static void(*const irqvector[])(void) = { GPIOD00, GPIOD01, GPIOD02, GPIOD03, GPIOD04, GPIOD05, }; +irq_handler_t system_set_irq_handler(int irq, irq_handler_t handler) +{ + irq_handler_t old_handler = irqvector[irq]; + irqvector[irq] = handler; + return old_handler; +} + void system_enable_irq(int irq) { if(IRQ_IS_GROUP0(irq)) { -- cgit v1.2.3