mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-19 06:40:45 +00:00
fix ci, remove use of CFG_TUSB_RHPORT0_MODE in bsp
This commit is contained in:
parent
f626916a57
commit
7187cd9a85
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user