Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rp2040 use of tud_disconnect #4327

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tinyusb
Submodule tinyusb updated 218 files
16 changes: 5 additions & 11 deletions ports/raspberrypi/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}