diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-05 11:58:17 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-06 11:06:43 +0000 |
commit | 2b23d3ecaf2074ad640f66ff198b6043f3ea9e6e (patch) | |
tree | 465de543e13bcada2ffe2ba7346a10d57fdbe0be /firmware/target/mips/ingenic_x1000/usb-x1000.c | |
parent | e85bc74b307365e9a7b4adab51d646638db12fbd (diff) | |
download | rockbox-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.c | 8 |
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 @@ | |||
28 | #include "gpio-x1000.h" | 28 | #include "gpio-x1000.h" |
29 | #include "x1000/cpm.h" | 29 | #include "x1000/cpm.h" |
30 | 30 | ||
31 | #ifdef FIIO_M3K | ||
32 | # define USB_DETECT_PIN_INT GPIOB11 // TODO remove me | ||
33 | #endif | ||
34 | |||
35 | /* | 31 | /* |
36 | * USB-Designware driver API | 32 | * USB-Designware driver API |
37 | */ | 33 | */ |
@@ -150,6 +146,7 @@ void usb_dw_target_clear_irq(void) | |||
150 | 146 | ||
151 | #ifdef USB_STATUS_BY_EVENT | 147 | #ifdef USB_STATUS_BY_EVENT |
152 | static volatile int usb_status = USB_EXTRACTED; | 148 | static volatile int usb_status = USB_EXTRACTED; |
149 | static void usb_detect_interrupt(void); | ||
153 | #endif | 150 | #endif |
154 | 151 | ||
155 | static int __usb_detect(void) | 152 | static int __usb_detect(void) |
@@ -184,6 +181,7 @@ void usb_init_device(void) | |||
184 | #ifdef USB_STATUS_BY_EVENT | 181 | #ifdef USB_STATUS_BY_EVENT |
185 | /* Setup USB detect pin IRQ */ | 182 | /* Setup USB detect pin IRQ */ |
186 | usb_status = __usb_detect(); | 183 | usb_status = __usb_detect(); |
184 | system_set_irq_handler(GPIO_TO_IRQ(GPIO_USB_DETECT), usb_detect_interrupt); | ||
187 | gpio_set_function(GPIO_USB_DETECT, GPIOF_IRQ_EDGE(1)); | 185 | gpio_set_function(GPIO_USB_DETECT, GPIOF_IRQ_EDGE(1)); |
188 | gpio_flip_edge_irq(GPIO_USB_DETECT); | 186 | gpio_flip_edge_irq(GPIO_USB_DETECT); |
189 | gpio_enable_irq(GPIO_USB_DETECT); | 187 | gpio_enable_irq(GPIO_USB_DETECT); |
@@ -201,7 +199,7 @@ int usb_detect(void) | |||
201 | return usb_status; | 199 | return usb_status; |
202 | } | 200 | } |
203 | 201 | ||
204 | void USB_DETECT_PIN_INT(void) | 202 | static void usb_detect_interrupt(void) |
205 | { | 203 | { |
206 | /* Update status and flip the IRQ trigger edge */ | 204 | /* Update status and flip the IRQ trigger edge */ |
207 | usb_status = __usb_detect(); | 205 | usb_status = __usb_detect(); |