Skip to content

Update tinyusb #2805

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

Merged
merged 4 commits into from
Apr 27, 2020
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 399 files
25 changes: 25 additions & 0 deletions ports/atmel-samd/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
7 changes: 2 additions & 5 deletions ports/litex/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <string.h>

#include "lib/tinyusb/src/device/usbd.h"
#include "py/mphal.h"
#include "py/mpstate.h"
#include "py/gc.h"
Expand All @@ -36,10 +37,6 @@

#include "irq.h"

#ifdef CFG_TUSB_MCU
void hal_dcd_isr(uint8_t rhport);
#endif

/*------------------------------------------------------------------*/
/* delay
*------------------------------------------------------------------*/
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion ports/mimxrt10xx/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ void init_usb_hardware(void) {
}

void USB_OTG1_IRQHandler(void) {
tud_isr(0);
tud_int_handler(0);
}
5 changes: 5 additions & 0 deletions ports/nrf/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -87,3 +88,7 @@ void init_usb_hardware(void) {
}
}
}

void USBD_IRQHandler(void) {
tud_int_handler(0);
}
9 changes: 7 additions & 2 deletions ports/stm/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -129,3 +130,7 @@ void init_usb_hardware(void) {

init_usb_vbus_sense();
}

void OTG_FS_IRQHandler(void) {
tud_int_handler(0);
}
2 changes: 1 addition & 1 deletion supervisor/shared/usb/usb_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}