diff --git a/lib/tinyusb b/lib/tinyusb index 1f95f439e1..c59fa77427 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 1f95f439e11f519e69d75a4a8b7b9f28eaf5060e +Subproject commit c59fa774274b13790a3ae0fc19d9651eeba560ab diff --git a/ports/atmel-samd/supervisor/usb.c b/ports/atmel-samd/supervisor/usb.c index d13ca0ef13..b8a94790d7 100644 --- a/ports/atmel-samd/supervisor/usb.c +++ b/ports/atmel-samd/supervisor/usb.c @@ -28,6 +28,7 @@ #include "hpl/pm/hpl_pm_base.h" #include "hpl/gclk/hpl_gclk_base.h" #include "hal_gpio.h" +#include "lib/tinyusb/src/device/usbd.h" void init_usb_hardware(void) { #ifdef SAMD21 @@ -57,3 +58,27 @@ void init_usb_hardware(void) { gpio_set_pin_function(PIN_PA25, PINMUX_PA25H_USB_DP); #endif } + +#ifdef SAMD21 +void USB_Handler(void) { + tud_int_handler(0); +} +#endif + +#ifdef SAMD51 +void USB_0_Handler (void) { + tud_int_handler(0); +} + +void USB_1_Handler (void) { + tud_int_handler(0); +} + +void USB_2_Handler (void) { + tud_int_handler(0); +} + +void USB_3_Handler (void) { + tud_int_handler(0); +} +#endif diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 0b8f012985..689487791e 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -27,6 +27,7 @@ #include +#include "lib/tinyusb/src/device/usbd.h" #include "py/mphal.h" #include "py/mpstate.h" #include "py/gc.h" @@ -36,10 +37,6 @@ #include "irq.h" -#ifdef CFG_TUSB_MCU - void hal_dcd_isr(uint8_t rhport); -#endif - /*------------------------------------------------------------------*/ /* delay *------------------------------------------------------------------*/ @@ -72,7 +69,7 @@ void isr(void) { #ifdef CFG_TUSB_MCU if (irqs & (1 << USB_INTERRUPT)) - hal_dcd_isr(0); + tud_int_handler(0); #endif if (irqs & (1 << TIMER0_INTERRUPT)) SysTick_Handler(); diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index 051fcca9de..1bc7ea9b56 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -56,5 +56,5 @@ void init_usb_hardware(void) { } void USB_OTG1_IRQHandler(void) { - tud_isr(0); + tud_int_handler(0); } diff --git a/ports/nrf/supervisor/usb.c b/ports/nrf/supervisor/usb.c index bb9d78101c..11a5a1561f 100644 --- a/ports/nrf/supervisor/usb.c +++ b/ports/nrf/supervisor/usb.c @@ -30,6 +30,7 @@ #include "supervisor/usb.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" +#include "lib/tinyusb/src/device/usbd.h" #ifdef SOFTDEVICE_PRESENT #include "nrf_sdm.h" @@ -87,3 +88,7 @@ void init_usb_hardware(void) { } } } + +void USBD_IRQHandler(void) { + tud_int_handler(0); +} diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index b66107b7ba..b2f3ad86bd 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -30,6 +30,7 @@ #include "supervisor/usb.h" #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" +#include "lib/tinyusb/src/device/usbd.h" #include "py/mpconfig.h" @@ -63,13 +64,13 @@ STATIC void init_usb_vbus_sense(void) { } void init_usb_hardware(void) { - //TODO: if future chips overload this with options, move to peripherals management. + //TODO: if future chips overload this with options, move to peripherals management. GPIO_InitTypeDef GPIO_InitStruct = {0}; /**USB_OTG_FS GPIO Configuration PA10 ------> USB_OTG_FS_ID PA11 ------> USB_OTG_FS_DM - PA12 ------> USB_OTG_FS_DP + PA12 ------> USB_OTG_FS_DP */ __HAL_RCC_GPIOA_CLK_ENABLE(); @@ -129,3 +130,7 @@ void init_usb_hardware(void) { init_usb_vbus_sense(); } + +void OTG_FS_IRQHandler(void) { + tud_int_handler(0); +} diff --git a/supervisor/shared/usb/usb_desc.c b/supervisor/shared/usb/usb_desc.c index 9b333d6fea..080187ebc5 100644 --- a/supervisor/shared/usb/usb_desc.c +++ b/supervisor/shared/usb/usb_desc.c @@ -52,7 +52,7 @@ uint8_t const * tud_hid_descriptor_report_cb(void) { // Invoked when received GET STRING DESCRIPTOR request // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete -uint16_t const* tud_descriptor_string_cb(uint8_t index) { +uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) { uint8_t const max_index = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]); return (index < max_index) ? string_desc_arr[index] : NULL; }