rename TUSB_OPT_HOST_ENABLED to CFG_TUH_ENABLED

This commit is contained in:
hathach 2022-02-23 21:49:11 +07:00
parent d10326cb4e
commit 31aa077cb0
31 changed files with 42 additions and 43 deletions

View File

@ -39,7 +39,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
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 CFG_TUD_ENABLED #if CFG_TUD_ENABLED

View File

@ -161,7 +161,7 @@ void board_init(void)
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

View File

@ -135,7 +135,7 @@ void board_init(void)
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

View File

@ -33,7 +33,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
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 CFG_TUD_ENABLED #if CFG_TUD_ENABLED
@ -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,7 +144,7 @@ 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

View File

@ -142,7 +142,7 @@ void board_init(void)
#endif #endif
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
// set portfunc to host !!! // set portfunc to host !!!
#endif #endif
} }

View File

@ -176,7 +176,7 @@ 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 CFG_TUD_ENABLED #if CFG_TUD_ENABLED

View File

@ -7,7 +7,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
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

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"

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

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"

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"

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

View File

@ -82,7 +82,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

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"

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"

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"

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

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)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@ -26,7 +26,7 @@
#include "host/hcd_attr.h" #include "host/hcd_attr.h"
#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_EHCI_TRANSDIMENSION) #if CFG_TUH_ENABLED && defined(HCD_ATTR_EHCI_TRANSDIMENSION)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE

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)

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 ) \
) )

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"

View File

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

View File

@ -26,7 +26,7 @@
#include "host/hcd_attr.h" #include "host/hcd_attr.h"
#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_OHCI) #if CFG_TUH_ENABLED && defined(HCD_ATTR_OHCI)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE

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"

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"

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;

View File

@ -27,7 +27,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \ #if CFG_TUH_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \
CFG_TUSB_MCU == OPT_MCU_RX65X || \ CFG_TUSB_MCU == OPT_MCU_RX65X || \
CFG_TUSB_MCU == OPT_MCU_RX72N ) CFG_TUSB_MCU == OPT_MCU_RX72N )
#include "host/hcd.h" #include "host/hcd.h"

View File

@ -26,7 +26,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED || CFG_TUD_ENABLED #if CFG_TUH_ENABLED || CFG_TUD_ENABLED
#include "tusb.h" #include "tusb.h"
@ -41,7 +41,7 @@ bool tusb_init(void)
TU_ASSERT ( tud_init(TUD_OPT_RHPORT) ); // init device stack TU_ASSERT ( tud_init(TUD_OPT_RHPORT) ); // init device stack
#endif #endif
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
TU_ASSERT( tuh_init(TUH_OPT_RHPORT) ); // init host stack TU_ASSERT( tuh_init(TUH_OPT_RHPORT) ); // init host stack
#endif #endif
@ -56,7 +56,7 @@ bool tusb_inited(void)
ret = ret || tud_inited(); ret = ret || tud_inited();
#endif #endif
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
ret = ret || tuh_inited(); ret = ret || tuh_inited();
#endif #endif

View File

@ -39,7 +39,7 @@
#include "common/tusb_fifo.h" #include "common/tusb_fifo.h"
//------------- HOST -------------// //------------- HOST -------------//
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
#include "host/usbh.h" #include "host/usbh.h"
#if CFG_TUH_HID #if CFG_TUH_HID

View File

@ -187,12 +187,10 @@
#define OPT_MODE_LOW_SPEED 0x10 ///< Max Low Speed #define OPT_MODE_LOW_SPEED 0x10 ///< Max Low Speed
#define OPT_MODE_HIGH_SPEED 0x20 ///< Max High Speed #define OPT_MODE_HIGH_SPEED 0x20 ///< Max High Speed
#ifndef CFG_TUSB_RHPORT0_MODE #ifndef CFG_TUSB_RHPORT0_MODE
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE #define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE
#endif #endif
#ifndef CFG_TUSB_RHPORT1_MODE #ifndef CFG_TUSB_RHPORT1_MODE
#define CFG_TUSB_RHPORT1_MODE OPT_MODE_NONE #define CFG_TUSB_RHPORT1_MODE OPT_MODE_NONE
#endif #endif
@ -203,22 +201,23 @@
#endif #endif
// Which roothub port is configured as host // Which roothub port is configured as host
#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) #define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) )
#define TUSB_OPT_HOST_ENABLED ( TUH_OPT_RHPORT >= 0 ) #define CFG_TUH_ENABLED ( TUH_OPT_RHPORT >= 0 )
// Which roothub port is configured as device // Which roothub port is configured as device
#define TUD_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE) ? 1 : -1) ) #define TUD_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE) ? 1 : -1) )
#if TUD_OPT_RHPORT == 0 #if TUD_OPT_RHPORT == 0
#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HIGH_SPEED ) #define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HIGH_SPEED )
#else #else
#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED ) #define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED )
#endif #endif
#define CFG_TUD_ENABLED ( TUD_OPT_RHPORT >= 0 ) #define CFG_TUD_ENABLED ( TUD_OPT_RHPORT >= 0 )
// For backward compatible // For backward compatible
#define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED #define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED
#define TUSB_OPT_HOST_ENABLED CFG_TUH_ENABLED
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON OPTIONS // COMMON OPTIONS
@ -316,7 +315,7 @@
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// HOST OPTIONS // HOST OPTIONS
//-------------------------------------------------------------------- //--------------------------------------------------------------------
#if TUSB_OPT_HOST_ENABLED #if CFG_TUH_ENABLED
#ifndef CFG_TUH_DEVICE_MAX #ifndef CFG_TUH_DEVICE_MAX
#define CFG_TUH_DEVICE_MAX 1 #define CFG_TUH_DEVICE_MAX 1
#endif #endif
@ -324,7 +323,7 @@
#ifndef CFG_TUH_ENUMERATION_BUFSIZE #ifndef CFG_TUH_ENUMERATION_BUFSIZE
#define CFG_TUH_ENUMERATION_BUFSIZE 256 #define CFG_TUH_ENUMERATION_BUFSIZE 256
#endif #endif
#endif // TUSB_OPT_HOST_ENABLED #endif // CFG_TUH_ENABLED
//------------- CLASS -------------// //------------- CLASS -------------//