summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-06 12:51:10 +0700
committerhathach <[email protected]>2022-06-06 12:51:10 +0700
commit7187cd9a8528bfe2b570567ca2d0a2ae36b7c478 (patch)
tree69420646c32dea57cde33784e39fbb99fba35808
parentf626916a5733fc7beff29ff6f907433e28ff14e0 (diff)
fix ci, remove use of CFG_TUSB_RHPORT0_MODE in bsp
-rw-r--r--hw/bsp/ea4088qs/ea4088qs.c6
-rw-r--r--hw/bsp/ea4357/ea4357.c36
-rw-r--r--hw/bsp/fomu/fomu.c2
-rw-r--r--hw/bsp/imxrt/family.c38
-rw-r--r--hw/bsp/lpc54/family.c19
-rw-r--r--hw/bsp/lpc55/family.c16
-rw-r--r--hw/bsp/lpcxpresso1769/lpcxpresso1769.c8
-rw-r--r--hw/bsp/mbed1768/mbed1768.c8
-rw-r--r--hw/bsp/ngx4330/ngx4330.c35
-rw-r--r--hw/bsp/samg55xplained/samg55xplained.c2
-rw-r--r--src/portable/bridgetek/ft9xx/dcd_ft9xx.c2
11 files changed, 114 insertions, 58 deletions
diff --git a/hw/bsp/ea4088qs/ea4088qs.c b/hw/bsp/ea4088qs/ea4088qs.c
index b25f9101c..fa905b2f9 100644
--- a/hw/bsp/ea4088qs/ea4088qs.c
+++ b/hw/bsp/ea4088qs/ea4088qs.c
@@ -32,11 +32,11 @@
//--------------------------------------------------------------------+
void USB_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
+ #if CFG_TUD_ENABLED
tuh_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
+ #if CFG_TUH_ENABLED
tud_int_handler(0);
#endif
}
@@ -115,7 +115,7 @@ void board_init(void)
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
- NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
+ NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
Chip_GPIO_Init(LPC_GPIO);
diff --git a/hw/bsp/ea4357/ea4357.c b/hw/bsp/ea4357/ea4357.c
index aa206a28d..2c1d08770 100644
--- a/hw/bsp/ea4357/ea4357.c
+++ b/hw/bsp/ea4357/ea4357.c
@@ -53,6 +53,18 @@
// {0x02, 7, 0, 7 }, // SW6
//};
+#ifdef BOARD_TUD_RHPORT
+ #define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_DEVICE(_n) 0
+#endif
+
+#ifdef BOARD_TUH_RHPORT
+ #define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_HOST(_n) 0
+#endif
+
/*------------------------------------------------------------------*/
/* BOARD API
*------------------------------------------------------------------*/
@@ -116,7 +128,7 @@ void board_init(void)
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
- //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
+ NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
Chip_GPIO_Init(LPC_GPIO_PORT);
@@ -170,7 +182,7 @@ void board_init(void)
* - Insert jumpers in position 2-3 in JP17/JP18/JP19
* - Insert jumpers in JP31 (OTG)
*/
-#if CFG_TUSB_RHPORT0_MODE
+#if PORT_SUPPORT_DEVICE(0) || PORT_SUPPORT_HOST(0)
Chip_USB0_Init();
#endif
@@ -195,14 +207,14 @@ void board_init(void)
* - LED34 lights green when +5V is available on J20.
* - JP15 shall not be inserted. JP16 has no effect
*/
-#if CFG_TUSB_RHPORT1_MODE
+#if PORT_SUPPORT_DEVICE(1) || PORT_SUPPORT_HOST(1)
Chip_USB1_Init();
#endif
// USB0 Vbus Power: P2_3 on EA4357 channel B U20 GPIO26 active low (base board)
Chip_SCU_PinMuxSet(2, 3, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC7);
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
+ #if PORT_SUPPORT_DEVICE(0)
// P9_5 (GPIO5[18]) (GPIO28 on oem base) as USB connect, active low.
Chip_SCU_PinMuxSet(9, 5, SCU_MODE_PULLDOWN | SCU_MODE_FUNC4);
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 5, 18);
@@ -217,23 +229,23 @@ void board_init(void)
//--------------------------------------------------------------------+
void USB0_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
- tuh_int_handler(0);
+ #if PORT_SUPPORT_DEVICE(0)
+ tud_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
- tud_int_handler(0);
+ #if PORT_SUPPORT_HOST(0)
+ tuh_int_handler(0);
#endif
}
void USB1_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
- tuh_int_handler(1);
+ #if PORT_SUPPORT_DEVICE(1)
+ tud_int_handler(1);
#endif
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
- tud_int_handler(1);
+ #if PORT_SUPPORT_HOST(1)
+ tuh_int_handler(1);
#endif
}
diff --git a/hw/bsp/fomu/fomu.c b/hw/bsp/fomu/fomu.c
index 12b7bfd18..33c630303 100644
--- a/hw/bsp/fomu/fomu.c
+++ b/hw/bsp/fomu/fomu.c
@@ -61,7 +61,7 @@ void isr(void)
irqs = irq_pending() & irq_getmask();
-#if CFG_TUSB_RHPORT0_MODE == OPT_MODE_DEVICE
+#if CFG_TUD_ENABLED
if (irqs & (1 << USB_INTERRUPT)) {
tud_int_handler(0);
}
diff --git a/hw/bsp/imxrt/family.c b/hw/bsp/imxrt/family.c
index 8d34d4b9f..e5f630108 100644
--- a/hw/bsp/imxrt/family.c
+++ b/hw/bsp/imxrt/family.c
@@ -34,9 +34,25 @@
#include "clock_config.h"
+#ifdef BOARD_TUD_RHPORT
+ #define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_DEVICE(_n) 0
+#endif
+
+#ifdef BOARD_TUH_RHPORT
+ #define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_HOST(_n) 0
+#endif
+
// needed by fsl_flexspi_nor_boot
const uint8_t dcd_data[] = { 0x00 };
+//--------------------------------------------------------------------+
+//
+//--------------------------------------------------------------------+
+
void board_init(void)
{
// Init clock
@@ -51,9 +67,9 @@ void board_init(void)
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
- NVIC_SetPriority(USB_OTG1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
-#ifdef USB_OTG2_IRQn
- NVIC_SetPriority(USB_OTG2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
+ NVIC_SetPriority(USB_OTG1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
+#ifdef USBPHY2
+ NVIC_SetPriority(USB_OTG2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
#endif
@@ -149,23 +165,23 @@ void board_init(void)
//--------------------------------------------------------------------+
void USB_OTG1_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
- tuh_int_handler(0);
+ #if PORT_SUPPORT_DEVICE(0)
+ tud_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
- tud_int_handler(0);
+ #if PORT_SUPPORT_HOST(0)
+ tuh_int_handler(0);
#endif
}
void USB_OTG2_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
- tuh_int_handler(1);
+ #if PORT_SUPPORT_DEVICE(1)
+ tud_int_handler(1);
#endif
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
- tud_int_handler(1);
+ #if PORT_SUPPORT_HOST(1)
+ tuh_int_handler(1);
#endif
}
diff --git a/hw/bsp/lpc54/family.c b/hw/bsp/lpc54/family.c
index 4f1199c3a..9bb341e73 100644
--- a/hw/bsp/lpc54/family.c
+++ b/hw/bsp/lpc54/family.c
@@ -33,6 +33,18 @@
#include "bsp/board.h"
#include "board.h"
+#ifdef BOARD_TUD_RHPORT
+ #define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_DEVICE(_n) 0
+#endif
+
+#ifdef BOARD_TUH_RHPORT
+ #define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_HOST(_n) 0
+#endif
+
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
@@ -152,8 +164,7 @@ void board_init(void)
#if defined(FSL_FEATURE_SOC_USBHSD_COUNT) && FSL_FEATURE_SOC_USBHSD_COUNT
// LPC546xx and LPC540xx has OTG 1 FS + 1 HS rhports
-
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
+ #if PORT_SUPPORT_DEVICE(0)
// Port0 is Full Speed
POWER_DisablePD(kPDRUNCFG_PD_USB0_PHY); /*< Turn on USB Phy */
CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1, false);
@@ -167,7 +178,7 @@ void board_init(void)
CLOCK_EnableUsbfs0DeviceClock(kCLOCK_UsbSrcFro, CLOCK_GetFroHfFreq());
#endif
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
+ #if PORT_SUPPORT_DEVICE(1)
// Port1 is High Speed
POWER_DisablePD(kPDRUNCFG_PD_USB1_PHY);
@@ -178,10 +189,8 @@ void board_init(void)
CLOCK_EnableUsbhs0DeviceClock(kCLOCK_UsbSrcUsbPll, 0U);
#endif
-
#else
// LPC5411x series only has full speed device
-
POWER_DisablePD(kPDRUNCFG_PD_USB0_PHY); // Turn on USB Phy
CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcFro, CLOCK_GetFreq(kCLOCK_FroHf)); /* enable USB IP clock */
#endif
diff --git a/hw/bsp/lpc55/family.c b/hw/bsp/lpc55/family.c
index f037a9f5b..e7aed5759 100644
--- a/hw/bsp/lpc55/family.c
+++ b/hw/bsp/lpc55/family.c
@@ -34,6 +34,18 @@
#include "fsl_sctimer.h"
#include "sct_neopixel.h"
+#ifdef BOARD_TUD_RHPORT
+ #define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_DEVICE(_n) 0
+#endif
+
+#ifdef BOARD_TUH_RHPORT
+ #define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_HOST(_n) 0
+#endif
+
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
@@ -164,7 +176,7 @@ void board_init(void)
/* PORT0 PIN22 configured as USB0_VBUS */
IOCON_PinMuxSet(IOCON, 0U, 22U, IOCON_PIO_DIG_FUNC7_EN);
-#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
+#if PORT_SUPPORT_DEVICE(0)
// Port0 is Full Speed
/* Turn on USB0 Phy */
@@ -189,7 +201,7 @@ void board_init(void)
CLOCK_EnableUsbfs0DeviceClock(kCLOCK_UsbfsSrcFro, CLOCK_GetFreq(kCLOCK_FroHf));
#endif
-#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
+#if PORT_SUPPORT_DEVICE(1)
// Port1 is High Speed
/* Turn on USB1 Phy */
diff --git a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
index b82e5ffe0..b7bce93d2 100644
--- a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
+++ b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c
@@ -32,12 +32,12 @@
//--------------------------------------------------------------------+
void USB_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
- tuh_int_handler(0);
+ #if CFG_TUD_ENABLED
+ tud_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
- tud_int_handler(0);
+ #if CFG_TUH_ENABLED
+ tuh_int_handler(0);
#endif
}
diff --git a/hw/bsp/mbed1768/mbed1768.c b/hw/bsp/mbed1768/mbed1768.c
index 7c2b37016..08cf3adbd 100644
--- a/hw/bsp/mbed1768/mbed1768.c
+++ b/hw/bsp/mbed1768/mbed1768.c
@@ -146,12 +146,12 @@ void board_init(void)
//--------------------------------------------------------------------+
void USB_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
- tuh_int_handler(0);
+ #if CFG_TUD_ENABLED
+ tud_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
- tud_int_handler(0);
+ #if CFG_TUH_ENABLED
+ tuh_int_handler(0);
#endif
}
diff --git a/hw/bsp/ngx4330/ngx4330.c b/hw/bsp/ngx4330/ngx4330.c
index b63f9b894..4fc314165 100644
--- a/hw/bsp/ngx4330/ngx4330.c
+++ b/hw/bsp/ngx4330/ngx4330.c
@@ -40,6 +40,18 @@
#define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD
#define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD
+#ifdef BOARD_TUD_RHPORT
+ #define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_DEVICE(_n) 0
+#endif
+
+#ifdef BOARD_TUH_RHPORT
+ #define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
+#else
+ #define PORT_SUPPORT_HOST(_n) 0
+#endif
+
/*------------------------------------------------------------------*/
/* BOARD API
*------------------------------------------------------------------*/
@@ -120,7 +132,7 @@ void board_init(void)
SysTick_Config(SystemCoreClock / 1000);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
- //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
+ NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif
Chip_GPIO_Init(LPC_GPIO_PORT);
@@ -167,9 +179,7 @@ void board_init(void)
* status feedback from the distribution switch. GPIO54 is used for VBUS sensing. 15Kohm pull-down
* resistors are always active
*/
-#if CFG_TUSB_RHPORT0_MODE
Chip_USB0_Init();
-#endif
/* USB1
* When USB channel #1 is used as USB Host, 15Kohm pull-down resistors are needed on the USB data
@@ -189,12 +199,9 @@ void board_init(void)
* of VBUS can be read via U31.
* JP16 shall not be inserted.
*/
-#if CFG_TUSB_RHPORT1_MODE
Chip_USB1_Init();
-
// Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 5, 6); /* GPIO5[6] = USB1_PWR_EN */
// Chip_GPIO_SetPinState(LPC_GPIO_PORT, 5, 6, true); /* GPIO5[6] output high */
-#endif
}
//--------------------------------------------------------------------+
@@ -202,23 +209,23 @@ void board_init(void)
//--------------------------------------------------------------------+
void USB0_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
- tuh_int_handler(0);
+ #if PORT_SUPPORT_DEVICE(0)
+ tud_int_handler(0);
#endif
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
- tud_int_handler(0);
+ #if PORT_SUPPORT_HOST(0)
+ tuh_int_handler(0);
#endif
}
void USB1_IRQHandler(void)
{
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
- tuh_int_handler(1);
+ #if PORT_SUPPORT_DEVICE(1)
+ tud_int_handler(1);
#endif
- #if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
- tud_int_handler(1);
+ #if PORT_SUPPORT_HOST(1)
+ tuh_int_handler(1);
#endif
}
diff --git a/hw/bsp/samg55xplained/samg55xplained.c b/hw/bsp/samg55xplained/samg55xplained.c
index ed106b06b..027c88e2f 100644
--- a/hw/bsp/samg55xplained/samg55xplained.c
+++ b/hw/bsp/samg55xplained/samg55xplained.c
@@ -99,7 +99,7 @@ void board_init(void)
//--------------------------------------------------------------------+
void UDP_Handler(void)
{
- #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
+ #if CFG_TUD_ENABLED
tud_int_handler(0);
#endif
}
diff --git a/src/portable/bridgetek/ft9xx/dcd_ft9xx.c b/src/portable/bridgetek/ft9xx/dcd_ft9xx.c
index 7a65cf5d0..2445593fe 100644
--- a/src/portable/bridgetek/ft9xx/dcd_ft9xx.c
+++ b/src/portable/bridgetek/ft9xx/dcd_ft9xx.c
@@ -312,7 +312,7 @@ static void _dcd_ft90x_detach(void)
// Determine the speed of the USB to which we are connected.
// Set the speed of the PHY accordingly.
-// High speed can be disabled through CFG_TUSB_RHPORT0_MODE settings.
+// High speed can be disabled through CFG_TUSB_RHPORT0_MODE or CFG_TUD_MAX_SPEED settings.
static void _ft90x_usb_speed(void)
{
uint8_t fctrl_val;