File tree 2 files changed +9
-12
lines changed
ports/raspberrypi/supervisor
2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,8 @@ STATIC void _usb_irq_wrapper(void) {
39
39
}
40
40
41
41
void post_usb_init (void ) {
42
- irq_set_enabled (USBCTRL_IRQ , false);
43
-
44
- irq_handler_t usb_handler = irq_get_exclusive_handler (USBCTRL_IRQ );
45
- if (usb_handler ) {
46
- irq_remove_handler (USBCTRL_IRQ , usb_handler );
47
- }
48
- irq_set_exclusive_handler (USBCTRL_IRQ , _usb_irq_wrapper );
49
-
50
- irq_set_enabled (USBCTRL_IRQ , true);
42
+ irq_add_shared_handler (USBCTRL_IRQ , _usb_irq_wrapper ,
43
+ PICO_SHARED_IRQ_HANDLER_LOWEST_ORDER_PRIORITY );
51
44
52
45
// There is a small window where the USB interrupt may be handled by the
53
46
// pico-sdk instead of CircuitPython. If that is the case, then we'll have
Original file line number Diff line number Diff line change @@ -225,13 +225,17 @@ void usb_background_schedule(void) {
225
225
}
226
226
227
227
void usb_irq_handler (int instance ) {
228
+ #if CFG_TUSB_MCU != OPT_MCU_RP2040
229
+ // For rp2040, IRQ handler is already installed and invoked automatically
228
230
if (instance == CIRCUITPY_USB_DEVICE_INSTANCE ) {
229
231
tud_int_handler (instance );
230
- } else if (instance == CIRCUITPY_USB_HOST_INSTANCE ) {
231
- #if CIRCUITPY_USB_HOST
232
+ }
233
+ #if CIRCUITPY_USB_HOST
234
+ else if (instance == CIRCUITPY_USB_HOST_INSTANCE ) {
232
235
tuh_int_handler (instance );
233
- #endif
234
236
}
237
+ #endif
238
+ #endif
235
239
236
240
usb_background_schedule ();
237
241
}
You can’t perform that action at this time.
0 commit comments