fix ci, remove use of CFG_TUSB_RHPORT0_MODE in bsp

This commit is contained in:
hathach
2022-06-06 12:51:10 +07:00
parent f626916a57
commit 7187cd9a85
11 changed files with 114 additions and 58 deletions

View File

@@ -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