Merge pull request #4327 from hathach/fix-4066-rp2040-hanged-tud_disconnect

fix rp2040 use of tud_disconnect
This commit is contained in:
Dan Halbert 2021-03-04 10:50:26 -05:00 committed by GitHub
commit 627c5f5bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

@ -1 +1 @@
Subproject commit 280297bdb7aec67adf347ec046943a48a71647df
Subproject commit 5285548c7543354ac8e13da37499019e204b1c49

View File

@ -31,23 +31,17 @@
#include "src/rp2_common/pico_platform/include/pico/platform.h"
#include "src/rp2040/hardware_regs/include/hardware/regs/intctrl.h"
static background_callback_t usb_callback;
static void usb_background_do(void* unused) {
usb_background();
}
static void queue_background(void) {
background_callback_add(&usb_callback, usb_background_do, NULL);
}
void init_usb_hardware(void) {
}
void post_usb_init(void) {
irq_set_enabled(USBCTRL_IRQ, false);
irq_handler_t usb_handler = irq_get_exclusive_handler(USBCTRL_IRQ);
if (usb_handler) {
irq_remove_handler(USBCTRL_IRQ, usb_handler);
irq_add_shared_handler(USBCTRL_IRQ, usb_handler, PICO_DEFAULT_IRQ_PRIORITY);
}
irq_add_shared_handler(USBCTRL_IRQ, queue_background, PICO_LOWEST_IRQ_PRIORITY);
irq_set_exclusive_handler(USBCTRL_IRQ, usb_irq_handler);
irq_set_enabled(USBCTRL_IRQ, true);
}