summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_x1000/system-x1000.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-06-05 11:58:17 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-06-06 11:06:43 +0000
commit2b23d3ecaf2074ad640f66ff198b6043f3ea9e6e (patch)
tree465de543e13bcada2ffe2ba7346a10d57fdbe0be /firmware/target/mips/ingenic_x1000/system-x1000.c
parente85bc74b307365e9a7b4adab51d646638db12fbd (diff)
downloadrockbox-2b23d3ecaf.tar.gz
rockbox-2b23d3ecaf.zip
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
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/system-x1000.c')
-rw-r--r--firmware/target/mips/ingenic_x1000/system-x1000.c9
1 files changed, 8 insertions, 1 deletions
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)) {