Merge pull request #2870 from hathach/hcd-dwc2

Implement Host Driver support for synopsys dwc2
This commit is contained in:
Ha Thach
2024-11-09 00:10:32 +07:00
committed by GitHub
173 changed files with 4284 additions and 1642 deletions

View File

@@ -48,7 +48,7 @@
// Include MCU header
#include "bsp/board_mcu.h"
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif

View File

@@ -39,7 +39,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"
@@ -186,14 +186,14 @@ int main(void)
#endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
return 0;
}
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void)
{
main();

View File

@@ -59,7 +59,7 @@ extern "C" {
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -48,7 +48,7 @@
// Include MCU header
#include "bsp/board_mcu.h"
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif

View File

@@ -38,7 +38,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"
@@ -133,16 +133,15 @@ int main(void)
#endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
return 0;
}
#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
void app_main(void)
{
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void) {
main();
}
#endif

View File

@@ -59,7 +59,7 @@ extern "C" {
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -67,7 +67,7 @@ int main(void) {
}
}
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void) {
main();
}

View File

@@ -44,7 +44,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -48,7 +48,7 @@
// Include MCU header
#include "bsp/board_mcu.h"
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif

View File

@@ -30,7 +30,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"
@@ -111,14 +111,14 @@ int main(void) {
#endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TUP_MCU_ESPRESSIF
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
return 0;
}
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void) {
main();
}

View File

@@ -59,7 +59,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -48,7 +48,7 @@
// Include MCU header
#include "bsp/board_mcu.h"
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif

View File

@@ -31,7 +31,7 @@
#include "tusb.h"
#include "usb_descriptors.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"
@@ -113,14 +113,14 @@ int main(void)
xTimerStart(blinky_tm, 0);
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TUP_MCU_ESPRESSIF
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
return 0;
}
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void)
{
main();

View File

@@ -59,7 +59,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -292,7 +292,7 @@ void led_blinking_task(void* param) {
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define USBD_STACK_SIZE 4096
int main(void);
void app_main(void) {
@@ -352,7 +352,7 @@ void freertos_init_task(void) {
#endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TUP_MCU_ESPRESSIF
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
}

View File

@@ -58,7 +58,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -300,7 +300,7 @@ void led_blinking_task(void* param) {
#define BLINKY_STACK_SIZE configMINIMAL_STACK_SIZE
#define VIDEO_STACK_SIZE (configMINIMAL_STACK_SIZE*4)
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define USBD_STACK_SIZE 4096
int main(void);
void app_main(void) {
@@ -360,7 +360,7 @@ void freertos_init_task(void) {
#endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TUP_MCU_ESPRESSIF
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
}

View File

@@ -58,7 +58,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -28,13 +28,15 @@ target_include_directories(${PROJECT} PUBLIC
family_configure_dual_usb_example(${PROJECT} noos)
# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow
-Wno-error=cast-align
-Wno-error=cast-qual
-Wno-error=redundant-decls
-Wno-error=sign-conversion
-Wno-error=conversion
-Wno-error=sign-compare
-Wno-error=unused-function
)
if (FAMILY STREQUAL rp2040)
target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow
-Wno-error=cast-align
-Wno-error=cast-qual
-Wno-error=redundant-decls
-Wno-error=sign-conversion
-Wno-error=conversion
-Wno-error=sign-compare
-Wno-error=unused-function
)
endif ()

View File

@@ -8,7 +8,7 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
CFLAGS += -Wno-error=cast-align -Wno-error=null-dereference
CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference
SRC_C += \
src/class/hid/hid_host.c \

View File

@@ -4,3 +4,6 @@ board:mcb1800
mcu:RP2040
mcu:ra6m5
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -28,13 +28,15 @@ target_include_directories(${PROJECT} PUBLIC
family_configure_dual_usb_example(${PROJECT} noos)
# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow
-Wno-error=cast-align
-Wno-error=cast-qual
-Wno-error=redundant-decls
-Wno-error=sign-conversion
-Wno-error=conversion
-Wno-error=sign-compare
-Wno-error=unused-function
)
if (FAMILY STREQUAL rp2040)
target_compile_options(${PROJECT} PUBLIC
-Wno-error=shadow
-Wno-error=cast-align
-Wno-error=cast-qual
-Wno-error=redundant-decls
-Wno-error=sign-conversion
-Wno-error=conversion
-Wno-error=sign-compare
-Wno-error=unused-function
)
endif ()

View File

@@ -8,7 +8,7 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
CFLAGS += -Wno-error=cast-align -Wno-error=null-dereference
CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference
SRC_C += \
src/host/hub.c \

View File

@@ -4,3 +4,6 @@ board:mcb1800
mcu:RP2040
mcu:ra6m5
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -12,3 +12,6 @@ mcu:MSP432E4
mcu:RX65X
mcu:RAXXX
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -12,3 +12,6 @@ mcu:MSP432E4
mcu:RX65X
mcu:RAXXX
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -130,13 +130,12 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
//--------------------------------------------------------------------+
// look up new key in previous keys
static inline bool find_key_in_report(hid_keyboard_report_t const *report, uint8_t keycode)
{
for(uint8_t i=0; i<6; i++)
{
if (report->keycode[i] == keycode) return true;
static inline bool find_key_in_report(hid_keyboard_report_t const* report, uint8_t keycode) {
for (uint8_t i = 0; i < 6; i++) {
if (report->keycode[i] == keycode) {
return true;
}
}
return false;
}

View File

@@ -1,3 +1,4 @@
mcu:ESP32P4
mcu:LPC175X_6X
mcu:LPC177X_8X
mcu:LPC18XX
@@ -9,3 +10,6 @@ mcu:MIMXRT11XX
mcu:MSP432E4
mcu:RX65X
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -48,7 +48,7 @@
// Include MCU header
#include "bsp/board_mcu.h"
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif

View File

@@ -27,7 +27,7 @@
#include "tusb.h"
#include "bsp/board_api.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"

View File

@@ -30,7 +30,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
// ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h"
@@ -107,14 +107,14 @@ int main(void) {
xTimerStart(blinky_tm, 0);
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
#if !TUP_MCU_ESPRESSIF
#if !TUSB_MCU_VENDOR_ESPRESSIF
vTaskStartScheduler();
#endif
return 0;
}
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void) {
main();
}

View File

@@ -44,7 +44,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
#if TUP_MCU_ESPRESSIF
#if TUSB_MCU_VENDOR_ESPRESSIF
#define CFG_TUSB_OS_INC_PATH freertos/
#endif

View File

@@ -12,3 +12,6 @@ mcu:MSP432E4
mcu:RP2040
mcu:RX65X
mcu:RAXXX
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -12,3 +12,6 @@ mcu:MSP432E4
mcu:RX65X
mcu:RAXXX
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -12,3 +12,6 @@ mcu:MSP432E4
mcu:RX65X
mcu:RAXXX
mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7

View File

@@ -71,7 +71,7 @@ int main(void)
}
}
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
#if TUSB_MCU_VENDOR_ESPRESSIF
void app_main(void)
{
main();