Merge pull request #1350 from hathach/enhance-multipl-ports

Enhance rhports management
This commit is contained in:
Ha Thach
2022-02-26 01:00:07 +07:00
committed by GitHub
112 changed files with 308 additions and 480 deletions
@@ -39,11 +39,7 @@ extern "C" {
#error CFG_TUSB_MCU must be defined #error CFG_TUSB_MCU must be defined
#endif #endif
#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#endif
#ifndef CFG_TUSB_OS #ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE #define CFG_TUSB_OS OPT_OS_NONE
@@ -39,11 +39,7 @@ extern "C" {
#error CFG_TUSB_MCU must be defined #error CFG_TUSB_MCU must be defined
#endif #endif
#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#endif
#ifndef CFG_TUSB_OS #ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE #define CFG_TUSB_OS OPT_OS_NONE
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 || CFG_TUSB_MCU == OPT_MCU_SAMX7X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
+2 -8
View File
@@ -45,15 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX, OPT_MCU_MIMXRT10XX, OPT_MCU_NUC505) ||\ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711) ||\
TU_CHECK_MCU(OPT_MCU_FT90X, OPT_MCU_FT93X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
+2 -7
View File
@@ -27,14 +27,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -27,14 +27,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,15 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 || CFG_TUSB_MCU == OPT_MCU_SAMX7X || \
CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,15 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX, OPT_MCU_MIMXRT10XX, OPT_MCU_NUC505) ||\ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711) ||\
TU_CHECK_MCU(OPT_MCU_FT90X, OPT_MCU_FT93X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,15 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 || \
CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
+2 -8
View File
@@ -45,15 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 || \
CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -42,11 +42,7 @@ extern "C" {
#error CFG_TUSB_MCU must be defined #error CFG_TUSB_MCU must be defined
#endif #endif
#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#endif
#ifndef CFG_TUSB_OS #ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE #define CFG_TUSB_OS OPT_OS_NONE
+2 -7
View File
@@ -27,14 +27,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -40,14 +40,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
@@ -45,14 +45,9 @@
#endif #endif
// RHPort max operational speed can defined by board.mk // RHPort max operational speed can defined by board.mk
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed // Default to max (auto) speed for MCU with internal HighSpeed PHY
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_DEFAULT_SPEED
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
#endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk
+1 -1
View File
@@ -120,7 +120,7 @@ static inline void board_delay(uint32_t ms)
uint32_t start_ms = board_millis(); uint32_t start_ms = board_millis();
while (board_millis() - start_ms < ms) while (board_millis() - start_ms < ms)
{ {
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
// take chance to run usb background // take chance to run usb background
tud_task(); tud_task();
#endif #endif
+3 -3
View File
@@ -30,7 +30,7 @@
#include <registers/ft900_registers.h> #include <registers/ft900_registers.h>
#include <ft900.h> #include <ft900.h>
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
int8_t board_ft90x_vbus(void); // Board specific implementation of VBUS detection for USB device. int8_t board_ft90x_vbus(void); // Board specific implementation of VBUS detection for USB device.
extern void ft90x_usbd_pm_ISR(uint16_t pmcfg); // Interrupt handler for USB device power management extern void ft90x_usbd_pm_ISR(uint16_t pmcfg); // Interrupt handler for USB device power management
#endif #endif
@@ -152,14 +152,14 @@ void board_pm_ISR(void)
MASK_SYS_PMCFG_HOST_RESUME_DEV) MASK_SYS_PMCFG_HOST_RESUME_DEV)
) )
{ {
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
ft90x_usbd_pm_ISR(pmcfg); ft90x_usbd_pm_ISR(pmcfg);
#endif #endif
} }
#endif #endif
} }
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
int8_t board_ft90x_vbus(void) int8_t board_ft90x_vbus(void)
{ {
return gpio_read(USBD_VBUS_DTC_PIN); return gpio_read(USBD_VBUS_DTC_PIN);
+1 -1
View File
@@ -270,7 +270,7 @@ void board_init(void)
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
#if CFG_TUSB_DEBUG >= 2 #if CFG_TUSB_DEBUG >= 2
uart_send_str(BOARD_NAME " USB device enabled\n"); uart_send_str(BOARD_NAME " USB device enabled\n");
#endif #endif
+1 -1
View File
@@ -73,7 +73,7 @@ void board_init(void)
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock / 1000); SysTick_Config(SystemCoreClock / 1000);
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
// This board is USB powered there is no need to monitor // This board is USB powered there is no need to monitor
// VBUS line. Notify driver that VBUS is present. // VBUS line. Notify driver that VBUS is present.
tusb_vbus_changed(true); tusb_vbus_changed(true);
+2 -2
View File
@@ -36,7 +36,7 @@ void USB_IRQHandler(void)
tud_int_handler(0); tud_int_handler(0);
} }
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
// DA146xx driver function that must be called whenever VBUS changes // DA146xx driver function that must be called whenever VBUS changes
extern void tusb_vbus_changed(bool present); extern void tusb_vbus_changed(bool present);
@@ -85,7 +85,7 @@ void board_init(void)
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock / 1000); SysTick_Config(SystemCoreClock / 1000);
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
// Setup interrupt for both connect and disconnect // Setup interrupt for both connect and disconnect
CRG_TOP->VBUS_IRQ_MASK_REG = CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_FALL_Msk | CRG_TOP->VBUS_IRQ_MASK_REG = CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_FALL_Msk |
CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_RISE_Msk; CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_RISE_Msk;
+2 -2
View File
@@ -39,10 +39,10 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void USB0_IRQHandler(void) void USB0_IRQHandler(void)
{ {
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
tuh_int_handler(0); tuh_int_handler(0);
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
tud_int_handler(0); tud_int_handler(0);
#endif #endif
} }
+2 -2
View File
@@ -156,12 +156,12 @@ void board_init(void)
// 0x1B // Host + Device + OTG + AHB // 0x1B // Host + Device + OTG + AHB
}; };
uint32_t const clk_en = TUSB_OPT_DEVICE_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; uint32_t const clk_en = CFG_TUD_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST;
LPC_USB->OTGClkCtrl = clk_en; LPC_USB->OTGClkCtrl = clk_en;
while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); while ( (LPC_USB->OTGClkSt & clk_en) != clk_en );
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// set portfunc to host !!! // set portfunc to host !!!
LPC_USB->StCtrl = 0x3; // should be 1 LPC_USB->StCtrl = 0x3; // should be 1
#endif #endif
+2 -2
View File
@@ -130,12 +130,12 @@ void board_init(void)
// 0x1B // Host + Device + OTG + AHB // 0x1B // Host + Device + OTG + AHB
}; };
uint32_t const clk_en = TUSB_OPT_DEVICE_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; uint32_t const clk_en = CFG_TUD_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST;
LPC_USB->OTGClkCtrl = clk_en; LPC_USB->OTGClkCtrl = clk_en;
while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); while ( (LPC_USB->OTGClkSt & clk_en) != clk_en );
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// set portfunc to host !!! // set portfunc to host !!!
LPC_USB->StCtrl = 0x3; // should be 1 LPC_USB->StCtrl = 0x3; // should be 1
#endif #endif
+5 -5
View File
@@ -33,10 +33,10 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void USB0_IRQHandler(void) void USB0_IRQHandler(void)
{ {
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
tuh_int_handler(0); tuh_int_handler(0);
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
tud_int_handler(0); tud_int_handler(0);
#endif #endif
} }
@@ -123,7 +123,7 @@ void board_init(void)
GPIOB->AMSEL = TU_BIT(0) | TU_BIT(1); GPIOB->AMSEL = TU_BIT(0) | TU_BIT(1);
GPIOL->AMSEL = TU_BIT(6) | TU_BIT(7); GPIOL->AMSEL = TU_BIT(6) | TU_BIT(7);
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
/* USB PD6(EPEN) */ /* USB PD6(EPEN) */
bits = TU_BIT(3); bits = TU_BIT(3);
SYSCTL->RCGCGPIO |= bits; SYSCTL->RCGCGPIO |= bits;
@@ -144,11 +144,11 @@ void board_init(void)
USB0->CC = USB_CC_CLKEN | (3u << USB_CC_CLKDIV_S); /* 60MHz = 240MHz / 4 */ USB0->CC = USB_CC_CLKEN | (3u << USB_CC_CLKDIV_S); /* 60MHz = 240MHz / 4 */
__DMB(); /* Wait for completion of opening of the clock gate */ __DMB(); /* Wait for completion of opening of the clock gate */
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
USB0->GPCS = USB_GPCS_DEVMOD_OTG; USB0->GPCS = USB_GPCS_DEVMOD_OTG;
USB0->EPC = USB_EPC_EPENDE | USB_EPC_EPEN_HIGH; USB0->EPC = USB_EPC_EPENDE | USB_EPC_EPEN_HIGH;
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
USB0->GPCS = USB_GPCS_DEVMOD_DEVVBUS; USB0->GPCS = USB_GPCS_DEVMOD_DEVVBUS;
#endif #endif
} }
+1 -1
View File
@@ -100,7 +100,7 @@ void board_init(void)
nrfx_uarte_init(&_uart_id, &uart_cfg, NULL); //uart_handler); nrfx_uarte_init(&_uart_id, &uart_cfg, NULL); //uart_handler);
//------------- USB -------------// //------------- USB -------------//
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice // Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice
// 2 is highest for application // 2 is highest for application
NVIC_SetPriority(USBD_IRQn, 2); NVIC_SetPriority(USBD_IRQn, 2);
+2 -2
View File
@@ -138,11 +138,11 @@ void board_init(void)
#endif #endif
// todo probably set up device mode? // todo probably set up device mode?
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
#endif #endif
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// set portfunc to host !!! // set portfunc to host !!!
#endif #endif
} }
+2 -2
View File
@@ -176,10 +176,10 @@ void INT_Excep_SCI5_RXI5(void)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void INT_Excep_USB0_USBI0(void) void INT_Excep_USB0_USBI0(void)
{ {
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
tuh_int_handler(0); tuh_int_handler(0);
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
tud_int_handler(0); tud_int_handler(0);
#endif #endif
} }
+1 -1
View File
@@ -223,7 +223,7 @@ void board_init(void)
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
#if CFG_TUSB_DEBUG >= 2 #if CFG_TUSB_DEBUG >= 2
uart_send_str(BOARD_NAME " USB device enabled\n"); uart_send_str(BOARD_NAME " USB device enabled\n");
#endif #endif
+2 -2
View File
@@ -7,11 +7,11 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void USB0_Handler(void) void USB0_Handler(void)
{ {
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
tuh_int_handler(0); tuh_int_handler(0);
#endif #endif
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
tud_int_handler(0); tud_int_handler(0);
#endif #endif
} }
+2 -2
View File
@@ -50,7 +50,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_AUDIO) #if (CFG_TUD_ENABLED && CFG_TUD_AUDIO)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
@@ -2291,4 +2291,4 @@ uint8_t audiod_get_audio_fct_idx(audiod_function_t * audio)
return 0; return 0;
} }
#endif //TUSB_OPT_DEVICE_ENABLED && CFG_TUD_AUDIO #endif //CFG_TUD_ENABLED && CFG_TUD_AUDIO
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_BTH) #if (CFG_TUD_ENABLED && CFG_TUD_BTH)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC) #if (CFG_TUD_ENABLED && CFG_TUD_CDC)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC) #if (CFG_TUH_ENABLED && CFG_TUH_CDC)
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h" #include "host/usbh_classdriver.h"
+11 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS) #if (CFG_TUH_ENABLED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
@@ -35,6 +35,16 @@
#include "cdc_host.h" #include "cdc_host.h"
#include "cdc_rndis_host.h" #include "cdc_rndis_host.h"
#if 0 // TODO remove subtask related macros later
// Sub Task
#define OSAL_SUBTASK_BEGIN
#define OSAL_SUBTASK_END return TUSB_ERROR_NONE;
#define STASK_RETURN(_error) return _error;
#define STASK_INVOKE(_subtask, _status) (_status) = _subtask
#define STASK_ASSERT(_cond) TU_VERIFY(_cond, TUSB_ERROR_OSAL_TASK_FAILED)
#endif
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF // MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU) #if (CFG_TUD_ENABLED && CFG_TUD_DFU)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_RUNTIME) #if (CFG_TUD_ENABLED && CFG_TUD_DFU_RUNTIME)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_HID) #if (CFG_TUD_ENABLED && CFG_TUD_HID)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HID) #if (CFG_TUH_ENABLED && CFG_TUH_HID)
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h" #include "host/usbh_classdriver.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MIDI) #if (CFG_TUD_ENABLED && CFG_TUD_MIDI)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MSC) #if (CFG_TUD_ENABLED && CFG_TUD_MSC)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC #if CFG_TUH_ENABLED && CFG_TUH_MSC
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h" #include "host/usbh_classdriver.h"
+1 -1
View File
@@ -27,7 +27,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_ECM_RNDIS ) #if ( CFG_TUD_ENABLED && CFG_TUD_ECM_RNDIS )
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -28,7 +28,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_NCM ) #if ( CFG_TUD_ENABLED && CFG_TUD_NCM )
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -68,7 +68,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_USBTMC) #if (CFG_TUD_ENABLED && CFG_TUD_USBTMC)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VENDOR) #if (CFG_TUD_ENABLED && CFG_TUD_VENDOR)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_VENDOR) #if (CFG_TUH_ENABLED && CFG_TUH_VENDOR)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -27,7 +27,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VIDEO && CFG_TUD_VIDEO_STREAMING) #if (CFG_TUD_ENABLED && CFG_TUD_VIDEO && CFG_TUD_VIDEO_STREAMING)
#include "device/usbd.h" #include "device/usbd.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+2
View File
@@ -64,6 +64,8 @@ typedef enum
#if CFG_TUSB_DEBUG #if CFG_TUSB_DEBUG
/// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0 /// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0
extern char const* const tusb_strerr[TUSB_ERROR_COUNT]; extern char const* const tusb_strerr[TUSB_ERROR_COUNT];
extern char const* const tusb_speed_str[];
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@@ -24,16 +24,16 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#ifndef TUSB_DCD_ATTR_H_ #ifndef TUSB_MCU_ATTR_H_
#define TUSB_DCD_ATTR_H_ #define TUSB_MCU_ATTR_H_
#include "tusb_option.h" /* USB Controller Attributes for Device, Host or MCU (both)
* - ENDPOINT_MAX: max (logical) number of endpoint
// Attribute includes * - ENDPOINT_EXCLUSIVE_NUMBER: endpoint number with different direction IN and OUT aren't allowed,
// - ENDPOINT_MAX: max (logical) number of endpoint * e.g EP1 OUT & EP1 IN cannot exist together
// - ENDPOINT_EXCLUSIVE_NUMBER: endpoint number with different direction IN and OUT aren't allowed, * - RHPORT_HIGHSPEED: mask to indicate which port support highspeed mode (without external PHY)
// e.g EP1 OUT & EP1 IN cannot exist together * bit0 for port0 and so on.
// - PORT_HIGHSPEED: mask to indicate which port support highspeed mode, bit0 for port0 and so on. */
//------------- NXP -------------// //------------- NXP -------------//
#if TU_CHECK_MCU(OPT_MCU_LPC11UXX, OPT_MCU_LPC13XX, OPT_MCU_LPC15XX) #if TU_CHECK_MCU(OPT_MCU_LPC11UXX, OPT_MCU_LPC13XX, OPT_MCU_LPC15XX)
@@ -41,11 +41,15 @@
#elif TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC40XX) #elif TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC40XX)
#define DCD_ATTR_ENDPOINT_MAX 16 #define DCD_ATTR_ENDPOINT_MAX 16
#define HCD_ATTR_OHCI
#elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX) #elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX)
// TODO USB0 has 6, USB1 has 4 // TODO USB0 has 6, USB1 has 4
#define DCD_ATTR_CONTROLLER_CHIPIDEA_HS #define MCU_ATTR_CONTROLLER_CHIPIDEA_HS
#define DCD_ATTR_ENDPOINT_MAX 6 #define DCD_ATTR_ENDPOINT_MAX 6
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01 // Port0 HS, Port1 FS
#define HCD_ATTR_EHCI
#elif TU_CHECK_MCU(OPT_MCU_LPC51UXX) #elif TU_CHECK_MCU(OPT_MCU_LPC51UXX)
#define DCD_ATTR_ENDPOINT_MAX 5 #define DCD_ATTR_ENDPOINT_MAX 5
@@ -59,8 +63,11 @@
#define DCD_ATTR_ENDPOINT_MAX 6 #define DCD_ATTR_ENDPOINT_MAX 6
#elif TU_CHECK_MCU(OPT_MCU_MIMXRT10XX) #elif TU_CHECK_MCU(OPT_MCU_MIMXRT10XX)
#define DCD_ATTR_CONTROLLER_CHIPIDEA_HS #define MCU_ATTR_CONTROLLER_CHIPIDEA_HS
#define DCD_ATTR_ENDPOINT_MAX 8 #define DCD_ATTR_ENDPOINT_MAX 8
#define DCD_ATTR_RHPORT_HIGHSPEED 0x03 // Port0 HS, Port1 HS
#define HCD_ATTR_EHCI
#elif TU_CHECK_MCU(OPT_MCU_MKL25ZXX, OPT_MCU_K32L2BXX) #elif TU_CHECK_MCU(OPT_MCU_MKL25ZXX, OPT_MCU_K32L2BXX)
#define DCD_ATTR_ENDPOINT_MAX 16 #define DCD_ATTR_ENDPOINT_MAX 16
@@ -83,7 +90,8 @@
#define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER #define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER
#elif TU_CHECK_MCU(OPT_MCU_SAMX7X) #elif TU_CHECK_MCU(OPT_MCU_SAMX7X)
#define DCD_ATTR_ENDPOINT_MAX 10 #define DCD_ATTR_ENDPOINT_MAX 10
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
#define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER #define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER
#elif TU_CHECK_MCU(OPT_MCU_PIC32MZ) #elif TU_CHECK_MCU(OPT_MCU_PIC32MZ)
@@ -145,7 +153,8 @@
//------------- Sony -------------// //------------- Sony -------------//
#elif TU_CHECK_MCU(OPT_MCU_CXD56) #elif TU_CHECK_MCU(OPT_MCU_CXD56)
#define DCD_ATTR_ENDPOINT_MAX 7 #define DCD_ATTR_ENDPOINT_MAX 7
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
#define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER #define DCD_ATTR_ENDPOINT_EXCLUSIVE_NUMBER
//------------- TI -------------// //------------- TI -------------//
@@ -167,7 +176,8 @@
#define DCD_ATTR_ENDPOINT_MAX 6 #define DCD_ATTR_ENDPOINT_MAX 6
#elif TU_CHECK_MCU(OPT_MCU_NUC505) #elif TU_CHECK_MCU(OPT_MCU_NUC505)
#define DCD_ATTR_ENDPOINT_MAX 12 #define DCD_ATTR_ENDPOINT_MAX 12
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
//------------- Espressif -------------// //------------- Espressif -------------//
#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3) #elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
@@ -195,7 +205,8 @@
//------------- Broadcom -------------// //------------- Broadcom -------------//
#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837) #elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837)
#define DCD_ATTR_ENDPOINT_MAX 8 #define DCD_ATTR_ENDPOINT_MAX 8
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
//------------- Broadcom -------------// //------------- Broadcom -------------//
#elif TU_CHECK_MCU(OPT_MCU_XMC4000) #elif TU_CHECK_MCU(OPT_MCU_XMC4000)
@@ -203,23 +214,31 @@
//------------- BridgeTek -------------// //------------- BridgeTek -------------//
#elif TU_CHECK_MCU(OPT_MCU_FT90X) #elif TU_CHECK_MCU(OPT_MCU_FT90X)
#define DCD_ATTR_ENDPOINT_MAX 8 #define DCD_ATTR_ENDPOINT_MAX 8
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
#elif TU_CHECK_MCU(OPT_MCU_FT93X) #elif TU_CHECK_MCU(OPT_MCU_FT93X)
#define DCD_ATTR_ENDPOINT_MAX 16 #define DCD_ATTR_ENDPOINT_MAX 16
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01
//------------ Allwinner -------------// //------------ Allwinner -------------//
#elif TU_CHECK_MCU(OPT_MCU_F1C100S) #elif TU_CHECK_MCU(OPT_MCU_F1C100S)
#define DCD_ATTR_ENDPOINT_MAX 4 #define DCD_ATTR_ENDPOINT_MAX 4
#else #endif
//--------------------------------------------------------------------+
// Default Values
//--------------------------------------------------------------------+
#ifndef DCD_ATTR_ENDPOINT_MAX
#warning "DCD_ATTR_ENDPOINT_MAX is not defined for this MCU, default to 8" #warning "DCD_ATTR_ENDPOINT_MAX is not defined for this MCU, default to 8"
#define DCD_ATTR_ENDPOINT_MAX 8 #define DCD_ATTR_ENDPOINT_MAX 8
#endif #endif
// Default to fullspeed if not defined // Default to fullspeed if not defined
//#ifndef PORT_HIGHSPEED #ifndef DCD_ATTR_RHPORT_HIGHSPEED
// #define DCD_ATTR_PORT_HIGHSPEED 0x00 #define DCD_ATTR_RHPORT_HIGHSPEED 0x00
//#endif #endif
#endif #endif
-1
View File
@@ -30,7 +30,6 @@
#include "common/tusb_common.h" #include "common/tusb_common.h"
#include "osal/osal.h" #include "osal/osal.h"
#include "common/tusb_fifo.h" #include "common/tusb_fifo.h"
#include "dcd_attr.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
+22 -12
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
#include "tusb.h" #include "tusb.h"
#include "device/usbd.h" #include "device/usbd.h"
@@ -269,11 +269,12 @@ static inline usbd_class_driver_t const * get_driver(uint8_t drvid)
// DCD Event // DCD Event
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
static bool _usbd_initialized = false; enum { RHPORT_INVALID = 0xFFu };
static uint8_t _usbd_rhport = RHPORT_INVALID;
// Event queue // Event queue
// OPT_MODE_DEVICE is used by OS NONE for mutex (disable usb isr) // OPT_MODE_DEVICE is used by OS NONE for mutex (disable usb isr)
OSAL_QUEUE_DEF(OPT_MODE_DEVICE, _usbd_qdef, CFG_TUD_TASK_QUEUE_SZ, dcd_event_t); OSAL_QUEUE_DEF(usbd_int_set, _usbd_qdef, CFG_TUD_TASK_QUEUE_SZ, dcd_event_t);
static osal_queue_t _usbd_q; static osal_queue_t _usbd_q;
// Mutex for claiming endpoint, only needed when using with preempted RTOS // Mutex for claiming endpoint, only needed when using with preempted RTOS
@@ -331,8 +332,6 @@ static char const* const _tusb_std_request_str[] =
"Synch Frame" "Synch Frame"
}; };
static char const* const _tusb_speed_str[] = { "Full", "Low", "High" };
// for usbd_control to print the name of control complete driver // for usbd_control to print the name of control complete driver
void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback) void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback)
{ {
@@ -376,21 +375,21 @@ bool tud_remote_wakeup(void)
{ {
// only wake up host if this feature is supported and enabled and we are suspended // only wake up host if this feature is supported and enabled and we are suspended
TU_VERIFY (_usbd_dev.suspended && _usbd_dev.remote_wakeup_support && _usbd_dev.remote_wakeup_en ); TU_VERIFY (_usbd_dev.suspended && _usbd_dev.remote_wakeup_support && _usbd_dev.remote_wakeup_en );
dcd_remote_wakeup(TUD_OPT_RHPORT); dcd_remote_wakeup(_usbd_rhport);
return true; return true;
} }
bool tud_disconnect(void) bool tud_disconnect(void)
{ {
TU_VERIFY(dcd_disconnect); TU_VERIFY(dcd_disconnect);
dcd_disconnect(TUD_OPT_RHPORT); dcd_disconnect(_usbd_rhport);
return true; return true;
} }
bool tud_connect(void) bool tud_connect(void)
{ {
TU_VERIFY(dcd_connect); TU_VERIFY(dcd_connect);
dcd_connect(TUD_OPT_RHPORT); dcd_connect(_usbd_rhport);
return true; return true;
} }
@@ -399,13 +398,13 @@ bool tud_connect(void)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
bool tud_inited(void) bool tud_inited(void)
{ {
return _usbd_initialized; return _usbd_rhport != RHPORT_INVALID;
} }
bool tud_init (uint8_t rhport) bool tud_init (uint8_t rhport)
{ {
// skip if already initialized // skip if already initialized
if (_usbd_initialized) return _usbd_initialized; if ( tud_inited() ) return true;
TU_LOG2("USBD init\r\n"); TU_LOG2("USBD init\r\n");
@@ -439,7 +438,7 @@ bool tud_init (uint8_t rhport)
dcd_init(rhport); dcd_init(rhport);
dcd_int_enable(rhport); dcd_int_enable(rhport);
_usbd_initialized = true; _usbd_rhport = rhport;
return true; return true;
} }
@@ -508,7 +507,7 @@ void tud_task (void)
switch ( event.event_id ) switch ( event.event_id )
{ {
case DCD_EVENT_BUS_RESET: case DCD_EVENT_BUS_RESET:
TU_LOG2(": %s Speed\r\n", _tusb_speed_str[event.bus_reset.speed]); TU_LOG2(": %s Speed\r\n", tusb_speed_str[event.bus_reset.speed]);
usbd_reset(event.rhport); usbd_reset(event.rhport);
_usbd_dev.speed = event.bus_reset.speed; _usbd_dev.speed = event.bus_reset.speed;
break; break;
@@ -1173,6 +1172,17 @@ void dcd_event_xfer_complete (uint8_t rhport, uint8_t ep_addr, uint32_t xferred_
// USBD API For Class Driver // USBD API For Class Driver
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
void usbd_int_set(bool enabled)
{
if (enabled)
{
dcd_int_enable(_usbd_rhport);
}else
{
dcd_int_disable(_usbd_rhport);
}
}
// Parse consecutive endpoint descriptors (IN & OUT) // Parse consecutive endpoint descriptors (IN & OUT)
bool usbd_open_edpt_pair(uint8_t rhport, uint8_t const* p_desc, uint8_t ep_count, uint8_t xfer_type, uint8_t* ep_out, uint8_t* ep_in) bool usbd_open_edpt_pair(uint8_t rhport, uint8_t const* p_desc, uint8_t ep_count, uint8_t xfer_type, uint8_t* ep_out, uint8_t* ep_in)
{ {
+4 -4
View File
@@ -453,7 +453,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
/* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\ /* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\
TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\ TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\ /* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\
TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epin, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 0x04 : 0x01),\ TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epin, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\ /* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\
TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000) TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000)
@@ -502,7 +502,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
/* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\ /* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\
TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\ TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\ /* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\
TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epin, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 0x04 : 0x01),\ TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epin, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\ /* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\
TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000) TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000)
@@ -550,7 +550,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
/* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\ /* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\
TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\ TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\ /* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\
TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epout, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 0x04 : 0x01),\ TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epout, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\ /* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\
TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000),\ TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000),\
/* Standard AS Isochronous Feedback Endpoint Descriptor(4.10.2.1) */\ /* Standard AS Isochronous Feedback Endpoint Descriptor(4.10.2.1) */\
@@ -558,7 +558,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
// Calculate wMaxPacketSize of Endpoints // Calculate wMaxPacketSize of Endpoints
#define TUD_AUDIO_EP_SIZE(_maxFrequency, _nBytesPerSample, _nChannels) \ #define TUD_AUDIO_EP_SIZE(_maxFrequency, _nBytesPerSample, _nChannels) \
((((_maxFrequency + ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 7999 : 999)) / ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 8000 : 1000)) + 1) * _nBytesPerSample * _nChannels) ((((_maxFrequency + (TUD_OPT_HIGH_SPEED ? 7999 : 999)) / (TUD_OPT_HIGH_SPEED ? 8000 : 1000)) + 1) * _nBytesPerSample * _nChannels)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED #if CFG_TUD_ENABLED
#include "tusb.h" #include "tusb.h"
#include "device/usbd_pvt.h" #include "device/usbd_pvt.h"
+2
View File
@@ -58,6 +58,8 @@ usbd_class_driver_t const* usbd_app_driver_get_cb(uint8_t* driver_count) TU_ATTR
typedef bool (*usbd_control_xfer_cb_t)(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); typedef bool (*usbd_control_xfer_cb_t)(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
void usbd_int_set(bool enabled);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// USBD Endpoint API // USBD Endpoint API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
+1 -2
View File
@@ -30,7 +30,6 @@
#include "common/tusb_common.h" #include "common/tusb_common.h"
#include "osal/osal.h" #include "osal/osal.h"
#include "common/tusb_fifo.h" #include "common/tusb_fifo.h"
#include "hcd_attr.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -82,7 +81,7 @@ typedef struct
} hcd_event_t; } hcd_event_t;
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// Max number of endpoints per device // Max number of endpoints per device
enum { enum {
// TODO better computation // TODO better computation
-105
View File
@@ -1,105 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021, Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
#ifndef TUSB_HCD_ATTR_H_
#define TUSB_HCD_ATTR_H_
#include "tusb_option.h"
// Attribute includes
// - ENDPOINT_MAX: max (logical) number of endpoint
// - PORT_HIGHSPEED: mask to indicate which port support highspeed mode, bit0 for port0 and so on.
//------------- NXP -------------//
#if TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC40XX)
#define HCD_ATTR_OHCI
#elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX)
#define HCD_ATTR_EHCI_TRANSDIMENSION
#elif TU_CHECK_MCU(OPT_MCU_LPC54XXX)
// #define HCD_ATTR_EHCI_NXP_PTD
#elif TU_CHECK_MCU(OPT_MCU_LPC55XX)
// #define HCD_ATTR_EHCI_NXP_PTD
#elif TU_CHECK_MCU(OPT_MCU_MIMXRT10XX)
#define HCD_ATTR_EHCI_TRANSDIMENSION
#elif TU_CHECK_MCU(OPT_MCU_MKL25ZXX)
//------------- Microchip -------------//
#elif TU_CHECK_MCU(OPT_MCU_SAMD21, OPT_MCU_SAMD51, OPT_MCU_SAME5X) || \
TU_CHECK_MCU(OPT_MCU_SAMD11, OPT_MCU_SAML21, OPT_MCU_SAML22)
#elif TU_CHECK_MCU(OPT_MCU_SAMG)
#elif TU_CHECK_MCU(OPT_MCU_SAMX7X)
//------------- ST -------------//
#elif TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F1, OPT_MCU_STM32F3) || \
TU_CHECK_MCU(OPT_MCU_STM32L0, OPT_MCU_STM32L1, OPT_MCU_STM32L4)
#elif TU_CHECK_MCU(OPT_MCU_STM32F2, OPT_MCU_STM32F3, OPT_MCU_STM32F4)
#elif TU_CHECK_MCU(OPT_MCU_STM32F7)
#elif TU_CHECK_MCU(OPT_MCU_STM32H7)
//------------- Sony -------------//
#elif TU_CHECK_MCU(OPT_MCU_CXD56)
//------------- Nuvoton -------------//
#elif TU_CHECK_MCU(OPT_MCU_NUC505)
//------------- Espressif -------------//
#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
//------------- Raspberry Pi -------------//
#elif TU_CHECK_MCU(OPT_MCU_RP2040)
//------------- Silabs -------------//
#elif TU_CHECK_MCU(OPT_MCU_EFM32GG)
//------------- Renesas -------------//
#elif TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N)
//#elif TU_CHECK_MCU(OPT_MCU_MM32F327X)
// #define DCD_ATTR_ENDPOINT_MAX not known yet
//------------- GigaDevice -------------//
#elif TU_CHECK_MCU(OPT_MCU_GD32VF103)
#else
// #warning "DCD_ATTR_ENDPOINT_MAX is not defined for this MCU, default to 8"
#endif
// Default to fullspeed if not defined
//#ifndef PORT_HIGHSPEED
// #define DCD_ATTR_PORT_HIGHSPEED 0x00
//#endif
#endif
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB) #if (CFG_TUH_ENABLED && CFG_TUH_HUB)
#include "usbh.h" #include "usbh.h"
#include "usbh_classdriver.h" #include "usbh_classdriver.h"
+15 -2
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
#include "tusb.h" #include "tusb.h"
#include "host/usbh.h" #include "host/usbh.h"
@@ -215,7 +215,7 @@ CFG_TUSB_MEM_SECTION usbh_device_t _usbh_devices[CFG_TUH_DEVICE_MAX + CFG_TUH_HU
// Event queue // Event queue
// role device/host is used by OS NONE for mutex (disable usb isr) // role device/host is used by OS NONE for mutex (disable usb isr)
OSAL_QUEUE_DEF(OPT_MODE_HOST, _usbh_qdef, CFG_TUH_TASK_QUEUE_SZ, hcd_event_t); OSAL_QUEUE_DEF(usbh_int_set, _usbh_qdef, CFG_TUH_TASK_QUEUE_SZ, hcd_event_t);
static osal_queue_t _usbh_q; static osal_queue_t _usbh_q;
CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static uint8_t _usbh_ctrl_buf[CFG_TUH_ENUMERATION_BUFSIZE]; CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN static uint8_t _usbh_ctrl_buf[CFG_TUH_ENUMERATION_BUFSIZE];
@@ -434,6 +434,18 @@ uint8_t* usbh_get_enum_buf(void)
return _usbh_ctrl_buf; return _usbh_ctrl_buf;
} }
void usbh_int_set(bool enabled)
{
// TODO all host controller
if (enabled)
{
hcd_int_enable(TUH_OPT_RHPORT);
}else
{
hcd_int_disable(TUH_OPT_RHPORT);
}
}
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// HCD Event Handler // HCD Event Handler
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@@ -697,6 +709,7 @@ static bool enum_new_device(hcd_event_t* event)
if ( !hcd_port_connect_status(_dev0.rhport) ) return true; if ( !hcd_port_connect_status(_dev0.rhport) ) return true;
_dev0.speed = hcd_port_speed_get(_dev0.rhport ); _dev0.speed = hcd_port_speed_get(_dev0.rhport );
TU_LOG2("%s Speed\r\n", tusb_speed_str[_dev0.speed]);
enum_request_addr0_device_desc(); enum_request_addr0_device_desc();
} }
+2
View File
@@ -57,6 +57,8 @@ uint8_t usbh_get_rhport(uint8_t dev_addr);
uint8_t* usbh_get_enum_buf(void); uint8_t* usbh_get_enum_buf(void);
void usbh_int_set(bool enabled);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// USBH Endpoint API // USBH Endpoint API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
#include "tusb.h" #include "tusb.h"
#include "usbh_classdriver.h" #include "usbh_classdriver.h"
+16 -40
View File
@@ -31,9 +31,6 @@
extern "C" { extern "C" {
#endif #endif
/** \addtogroup group_osal
* @{ */
#include "common/tusb_common.h" #include "common/tusb_common.h"
// Return immediately // Return immediately
@@ -67,47 +64,26 @@ typedef void (*osal_task_func_t)( void * );
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// OSAL Porting API // OSAL Porting API
// Should be implemented as static inline function in osal_port.h header
/*
static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef);
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr);
static inline bool osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec);
static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl); // TODO removed
static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef);
static inline bool osal_mutex_lock (osal_mutex_t sem_hdl, uint32_t msec);
static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl);
static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef);
static inline bool osal_queue_receive(osal_queue_t qhdl, void* data);
static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr);
static inline bool osal_queue_empty(osal_queue_t qhdl);
*/
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if __GNUC__ && !defined(__ARMCC_VERSION)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
//------------- Semaphore -------------//
static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef);
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr);
static inline bool osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec);
static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl); // TODO removed
//------------- Mutex -------------//
static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef);
static inline bool osal_mutex_lock (osal_mutex_t sem_hdl, uint32_t msec);
static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl);
//------------- Queue -------------//
static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef);
static inline bool osal_queue_receive(osal_queue_t qhdl, void* data);
static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr);
static inline bool osal_queue_empty(osal_queue_t qhdl);
#if __GNUC__ && !defined(__ARMCC_VERSION)
#pragma GCC diagnostic pop
#endif
#if 0 // TODO remove subtask related macros later
// Sub Task
#define OSAL_SUBTASK_BEGIN
#define OSAL_SUBTASK_END return TUSB_ERROR_NONE;
#define STASK_RETURN(_error) return _error;
#define STASK_INVOKE(_subtask, _status) (_status) = _subtask
#define STASK_ASSERT(_cond) TU_VERIFY(_cond, TUSB_ERROR_OSAL_TASK_FAILED)
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/** @} */
#endif /* _TUSB_OSAL_H_ */ #endif /* _TUSB_OSAL_H_ */
+1 -1
View File
@@ -115,7 +115,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
static _type _name##_##buf[_depth];\ static _type _name##_##buf[_depth];\
osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf }; osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf };
+1 -1
View File
@@ -96,7 +96,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
static _type _name##_##buf[_depth];\ static _type _name##_##buf[_depth];\
static struct os_event _name##_##evbuf[_depth];\ static struct os_event _name##_##evbuf[_depth];\
osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf, .evbuf = _name##_##evbuf};\ osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf, .evbuf = _name##_##evbuf};\
+8 -33
View File
@@ -103,59 +103,34 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#include "common/tusb_fifo.h" #include "common/tusb_fifo.h"
// extern to avoid including dcd.h and hcd.h
#if TUSB_OPT_DEVICE_ENABLED
extern void dcd_int_disable(uint8_t rhport);
extern void dcd_int_enable(uint8_t rhport);
#endif
#if TUSB_OPT_HOST_ENABLED
extern void hcd_int_disable(uint8_t rhport);
extern void hcd_int_enable(uint8_t rhport);
#endif
typedef struct typedef struct
{ {
uint8_t role; // device or host void (*interrupt_set)(bool);
tu_fifo_t ff; tu_fifo_t ff;
}osal_queue_def_t; }osal_queue_def_t;
typedef osal_queue_def_t* osal_queue_t; typedef osal_queue_def_t* osal_queue_t;
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
uint8_t _name##_buf[_depth*sizeof(_type)]; \ uint8_t _name##_buf[_depth*sizeof(_type)]; \
osal_queue_def_t _name = { \ osal_queue_def_t _name = { \
.role = _role, \ .interrupt_set = _int_set, \
.ff = TU_FIFO_INIT(_name##_buf, _depth, _type, false) \ .ff = TU_FIFO_INIT(_name##_buf, _depth, _type, false) \
} }
// lock queue by disable USB interrupt // lock queue by disable USB interrupt
static inline void _osal_q_lock(osal_queue_t qhdl) static inline void _osal_q_lock(osal_queue_t qhdl)
{ {
(void) qhdl; // disable dcd/hcd interrupt
qhdl->interrupt_set(false);
#if TUSB_OPT_DEVICE_ENABLED
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_disable(TUD_OPT_RHPORT);
#endif
#if TUSB_OPT_HOST_ENABLED
if (qhdl->role == OPT_MODE_HOST) hcd_int_disable(TUH_OPT_RHPORT);
#endif
} }
// unlock queue // unlock queue
static inline void _osal_q_unlock(osal_queue_t qhdl) static inline void _osal_q_unlock(osal_queue_t qhdl)
{ {
(void) qhdl; // enable dcd/hcd interrupt
qhdl->interrupt_set(true);
#if TUSB_OPT_DEVICE_ENABLED
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_enable(TUD_OPT_RHPORT);
#endif
#if TUSB_OPT_HOST_ENABLED
if (qhdl->role == OPT_MODE_HOST) hcd_int_enable(TUH_OPT_RHPORT);
#endif
} }
static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
+2 -2
View File
@@ -100,7 +100,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#include "common/tusb_fifo.h" #include "common/tusb_fifo.h"
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
extern void hcd_int_disable(uint8_t rhport); extern void hcd_int_disable(uint8_t rhport);
extern void hcd_int_enable(uint8_t rhport); extern void hcd_int_enable(uint8_t rhport);
#endif #endif
@@ -114,7 +114,7 @@ typedef struct
typedef osal_queue_def_t* osal_queue_t; typedef osal_queue_def_t* osal_queue_t;
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
uint8_t _name##_buf[_depth*sizeof(_type)]; \ uint8_t _name##_buf[_depth*sizeof(_type)]; \
osal_queue_def_t _name = { \ osal_queue_def_t _name = { \
.ff = TU_FIFO_INIT(_name##_buf, _depth, _type, false) \ .ff = TU_FIFO_INIT(_name##_buf, _depth, _type, false) \
+1 -1
View File
@@ -90,7 +90,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl) {
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
static _type _name##_##buf[_depth]; \ static _type _name##_##buf[_depth]; \
osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf }; osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf };
+1 -1
View File
@@ -111,7 +111,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// role device/host is used by OS NONE for mutex (disable usb isr) only // role device/host is used by OS NONE for mutex (disable usb isr) only
#define OSAL_QUEUE_DEF(_role, _name, _depth, _type) \ #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
os_mbx_declare(_name##__mbox, _depth); \ os_mbx_declare(_name##__mbox, _depth); \
_declare_box(_name##__pool, sizeof(_type), _depth); \ _declare_box(_name##__pool, sizeof(_type), _depth); \
osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .pool = _name##__pool, .mbox = _name##__mbox }; osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .pool = _name##__pool, .mbox = _name##__mbox };
+1 -1
View File
@@ -31,7 +31,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X) (CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X)
#include <stdint.h> #include <stdint.h>
@@ -29,7 +29,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_BCM2711 ) \ (CFG_TUSB_MCU == OPT_MCU_BCM2711 ) \
+1 -2
View File
@@ -25,9 +25,8 @@
*/ */
#include "tusb_option.h" #include "tusb_option.h"
#include "device/dcd_attr.h"
#if TUSB_OPT_DEVICE_ENABLED && defined(DCD_ATTR_CONTROLLER_CHIPIDEA_HS) #if CFG_TUD_ENABLED && defined(MCU_ATTR_CONTROLLER_CHIPIDEA_HS)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -28,7 +28,7 @@
// Chipidea Highspeed USB IP implement EHCI for host functionality // Chipidea Highspeed USB IP implement EHCI for host functionality
#if TUSB_OPT_HOST_ENABLED && \ #if CFG_TUH_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_DA1469X #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_DA1469X
#include "mcu/mcu.h" #include "mcu/mcu.h"
+3 -3
View File
@@ -24,9 +24,9 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "host/hcd_attr.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_EHCI_TRANSDIMENSION) #if CFG_TUH_ENABLED && defined(HCD_ATTR_EHCI)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
@@ -45,7 +45,7 @@
#define EHCI_DBG 2 #define EHCI_DBG 2
// Framelist size as small as possible to save SRAM // Framelist size as small as possible to save SRAM
#ifdef HCD_ATTR_EHCI_TRANSDIMENSION #ifdef MCU_ATTR_CONTROLLER_CHIPIDEA_HS
// NXP Transdimension: 8 elements // NXP Transdimension: 8 elements
#define FRAMELIST_SIZE_BIT_VALUE 7u #define FRAMELIST_SIZE_BIT_VALUE 7u
#define FRAMELIST_SIZE_USBCMD_VALUE (((FRAMELIST_SIZE_BIT_VALUE & 3) << EHCI_USBCMD_POS_FRAMELIST_SIZE) | \ #define FRAMELIST_SIZE_USBCMD_VALUE (((FRAMELIST_SIZE_BIT_VALUE & 3) << EHCI_USBCMD_POS_FRAMELIST_SIZE) | \
+1 -1
View File
@@ -28,7 +28,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && TUSB_OPT_DEVICE_ENABLED) #if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED)
// Espressif // Espressif
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129) TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129)
#if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED) #if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED)
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && \ #if CFG_TUH_ENABLED && \
TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129) TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129)
#if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED) #if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED)
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_PIC32MZ #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_PIC32MZ
#include <common/tusb_common.h> #include <common/tusb_common.h>
#include <device/dcd.h> #include <device/dcd.h>
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_SAMD11 || CFG_TUSB_MCU == OPT_MCU_SAMD21 || \ (CFG_TUSB_MCU == OPT_MCU_SAMD11 || CFG_TUSB_MCU == OPT_MCU_SAMD21 || \
CFG_TUSB_MCU == OPT_MCU_SAMD51 || CFG_TUSB_MCU == OPT_MCU_SAME5X || \ CFG_TUSB_MCU == OPT_MCU_SAMD51 || CFG_TUSB_MCU == OPT_MCU_SAME5X || \
CFG_TUSB_MCU == OPT_MCU_SAML22 || CFG_TUSB_MCU == OPT_MCU_SAML21) CFG_TUSB_MCU == OPT_MCU_SAML22 || CFG_TUSB_MCU == OPT_MCU_SAML21)
+1 -1
View File
@@ -27,7 +27,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMX7X #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMX7X
#include "device/dcd.h" #include "device/dcd.h"
#include "sam.h" #include "sam.h"
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MM32F327X ) #if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MM32F327X )
#include "reg_usb_otg_fs.h" #include "reg_usb_otg_fs.h"
#include "mm32_device.h" #include "mm32_device.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X
#include "nrf.h" #include "nrf.h"
#include "nrf_clock.h" #include "nrf_clock.h"
+1 -1
View File
@@ -35,7 +35,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC120) #if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC120)
#include "device/dcd.h" #include "device/dcd.h"
#include "NUC100Series.h" #include "NUC100Series.h"
+1 -1
View File
@@ -35,7 +35,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && ( (CFG_TUSB_MCU == OPT_MCU_NUC121) || (CFG_TUSB_MCU == OPT_MCU_NUC126) ) #if CFG_TUD_ENABLED && ( (CFG_TUSB_MCU == OPT_MCU_NUC121) || (CFG_TUSB_MCU == OPT_MCU_NUC126) )
#include "device/dcd.h" #include "device/dcd.h"
#include "NuMicro.h" #include "NuMicro.h"
+1 -1
View File
@@ -35,7 +35,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505) #if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505)
#include "device/dcd.h" #include "device/dcd.h"
#include "NUC505Series.h" #include "NUC505Series.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && ( \ #if CFG_TUD_ENABLED && ( \
( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \ ( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \
) )
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && ( \ #if CFG_TUH_ENABLED && ( \
( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \ ( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \
) )
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX) (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX)
#include "device/dcd.h" #include "device/dcd.h"
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && \ #if CFG_TUH_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX) (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX)
#include "chip.h" #include "chip.h"
+1 -1
View File
@@ -34,7 +34,7 @@
* - LPC54114 * - LPC54114
* - LPC55s69 * - LPC55s69
*/ */
#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_LPC11UXX || \ #if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_LPC11UXX || \
CFG_TUSB_MCU == OPT_MCU_LPC13XX || \ CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
CFG_TUSB_MCU == OPT_MCU_LPC15XX || \ CFG_TUSB_MCU == OPT_MCU_LPC15XX || \
CFG_TUSB_MCU == OPT_MCU_LPC51UXX || \ CFG_TUSB_MCU == OPT_MCU_LPC51UXX || \
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && \ #if CFG_TUD_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX)
#warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly" #warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly"
@@ -28,7 +28,7 @@
// NXP Trans-Dimension USB IP implement EHCI for host functionality // NXP Trans-Dimension USB IP implement EHCI for host functionality
#if TUSB_OPT_HOST_ENABLED && \ #if CFG_TUH_ENABLED && \
(CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX)
#warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly" #warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly"
+2 -2
View File
@@ -24,9 +24,9 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "host/hcd_attr.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_OHCI) #if CFG_TUH_ENABLED && defined(HCD_ATTR_OHCI)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
+1 -1
View File
@@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040
#include "pico.h" #include "pico.h"
#include "rp2040_usb.h" #include "rp2040_usb.h"
+1 -1
View File
@@ -27,7 +27,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 #if CFG_TUH_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040
#include "pico.h" #include "pico.h"
#include "rp2040_usb.h" #include "rp2040_usb.h"
+1 -1
View File
@@ -87,7 +87,7 @@ void _hw_endpoint_buffer_control_update32(struct hw_endpoint *ep, uint32_t and_m
*ep->buffer_control = value & ~USB_BUF_CTRL_AVAIL; *ep->buffer_control = value & ~USB_BUF_CTRL_AVAIL;
// 12 cycle delay.. (should be good for 48*12Mhz = 576Mhz) // 12 cycle delay.. (should be good for 48*12Mhz = 576Mhz)
// Don't need delay in host mode as host is in charge // Don't need delay in host mode as host is in charge
#if !TUSB_OPT_HOST_ENABLED #if !CFG_TUH_ENABLED
__asm volatile ( __asm volatile (
"b 1f\n" "b 1f\n"
"1: b 1f\n" "1: b 1f\n"
+1 -1
View File
@@ -56,7 +56,7 @@ typedef struct hw_endpoint
// Interrupt, bulk, etc // Interrupt, bulk, etc
uint8_t transfer_type; uint8_t transfer_type;
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// Only needed for host // Only needed for host
uint8_t dev_addr; uint8_t dev_addr;

Some files were not shown because too many files have changed in this diff Show More