summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_x1000/usb-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/usb-x1000.c
parente85bc74b307365e9a7b4adab51d646638db12fbd (diff)
downloadrockbox-2b23d3ecaf2074ad640f66ff198b6043f3ea9e6e.tar.gz
rockbox-2b23d3ecaf2074ad640f66ff198b6043f3ea9e6e.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/usb-x1000.c')
-rw-r--r--firmware/target/mips/ingenic_x1000/usb-x1000.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/firmware/target/mips/ingenic_x1000/usb-x1000.c b/firmware/target/mips/ingenic_x1000/usb-x1000.c
index 1cedac4fa7..1a31d8db2e 100644
--- a/firmware/target/mips/ingenic_x1000/usb-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/usb-x1000.c
@@ -28,10 +28,6 @@
#include "gpio-x1000.h"
#include "x1000/cpm.h"
-#ifdef FIIO_M3K
-# define USB_DETECT_PIN_INT GPIOB11 // TODO remove me
-#endif
-
/*
* USB-Designware driver API
*/
@@ -150,6 +146,7 @@ void usb_dw_target_clear_irq(void)
#ifdef USB_STATUS_BY_EVENT
static volatile int usb_status = USB_EXTRACTED;
+static void usb_detect_interrupt(void);
#endif
static int __usb_detect(void)
@@ -184,6 +181,7 @@ void usb_init_device(void)
#ifdef USB_STATUS_BY_EVENT
/* Setup USB detect pin IRQ */
usb_status = __usb_detect();
+ system_set_irq_handler(GPIO_TO_IRQ(GPIO_USB_DETECT), usb_detect_interrupt);
gpio_set_function(GPIO_USB_DETECT, GPIOF_IRQ_EDGE(1));
gpio_flip_edge_irq(GPIO_USB_DETECT);
gpio_enable_irq(GPIO_USB_DETECT);
@@ -201,7 +199,7 @@ int usb_detect(void)
return usb_status;
}
-void USB_DETECT_PIN_INT(void)
+static void usb_detect_interrupt(void)
{
/* Update status and flip the IRQ trigger edge */
usb_status = __usb_detect();