rename MODE_HOST_SUPPORTED to TUSB_OPT_HOST_ENABLED

This commit is contained in:
hathach 2018-12-07 23:38:52 +07:00
parent e019916263
commit 607658d047
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
17 changed files with 22 additions and 29 deletions

View File

@ -148,7 +148,7 @@ void board_init(void)
LPC_USB->OTGClkCtrl = clk_en;
while ( (LPC_USB->OTGClkSt & clk_en) != clk_en );
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
// set portfunc to host !!!
LPC_USB->StCtrl = 0x3; // should be 1
#endif

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_HOST_SUPPORTED && CFG_TUH_CDC)
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC)
#define _TINY_USB_SOURCE_FILE_

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_HOST_SUPPORTED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS)
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS)
#define _TINY_USB_SOURCE_FILE_

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_HOST_SUPPORTED && CFG_TUSB_HOST_CUSTOM_CLASS)
#if (TUSB_OPT_HOST_ENABLED && CFG_TUSB_HOST_CUSTOM_CLASS)
#define _TINY_USB_SOURCE_FILE_

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_HOST_SUPPORTED && HOST_CLASS_HID)
#if (TUSB_OPT_HOST_ENABLED && HOST_CLASS_HID)
#define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if MODE_HOST_SUPPORTED & CFG_TUH_MSC
#if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC
#define _TINY_USB_SOURCE_FILE_

View File

@ -38,7 +38,7 @@
#include "common/tusb_common.h"
#if MODE_HOST_SUPPORTED && (CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX)
#if TUSB_OPT_HOST_ENABLED && (CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX)
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+

View File

@ -79,7 +79,7 @@ typedef struct
} hcd_event_t;
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
// Max number of endpoints per device
enum {
HCD_MAX_ENDPOINT = CFG_TUH_HUB + CFG_TUH_HID_KEYBOARD + CFG_TUH_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC +

View File

@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_HOST_SUPPORTED && CFG_TUH_HUB)
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB)
#define _TINY_USB_SOURCE_FILE_

View File

@ -38,7 +38,7 @@
#include <common/tusb_common.h>
#if MODE_HOST_SUPPORTED && (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC40XX)
#if TUSB_OPT_HOST_ENABLED && (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC40XX)
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+

View File

@ -38,7 +38,7 @@
#include "common/tusb_common.h"
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
#define _TINY_USB_SOURCE_FILE_

View File

@ -134,7 +134,7 @@ extern void dcd_int_disable(uint8_t rhport);
extern void dcd_int_enable(uint8_t rhport);
#endif
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
extern void hcd_int_disable(uint8_t rhport);
extern void hcd_int_enable(uint8_t rhport);
#endif
@ -167,7 +167,7 @@ static inline void _osal_q_lock(osal_queue_t qhdl)
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_disable(TUD_OPT_RHPORT);
#endif
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
if (qhdl->role == OPT_MODE_HOST) hcd_int_disable(TUH_OPT_RHPORT);
#endif
}
@ -179,7 +179,7 @@ static inline void _osal_q_unlock(osal_queue_t qhdl)
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_enable(TUD_OPT_RHPORT);
#endif
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
if (qhdl->role == OPT_MODE_HOST) hcd_int_enable(TUH_OPT_RHPORT);
#endif
}

View File

@ -47,7 +47,7 @@ extern void hal_dcd_isr(uint8_t rhport);
void USB_IRQHandler(void)
{
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
hal_hcd_isr(0);
#endif

View File

@ -48,7 +48,7 @@ extern void hal_hcd_isr(uint8_t hostid);
#if CFG_TUSB_RHPORT0_MODE
void USB0_IRQHandler(void)
{
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
hal_hcd_isr(0);
#endif
@ -61,7 +61,7 @@ void USB0_IRQHandler(void)
#if CFG_TUSB_RHPORT1_MODE
void USB1_IRQHandler(void)
{
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
hal_hcd_isr(1);
#endif

View File

@ -55,7 +55,7 @@ bool tusb_init(void)
// skip if already initialized
if (_initialized) return true;
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
TU_VERIFY( usbh_init() ); // init host stack
#endif
@ -71,7 +71,7 @@ bool tusb_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
void tusb_task(void)
{
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
usbh_task(NULL);
#endif

View File

@ -52,7 +52,7 @@
#include "common/tusb_fifo.h"
//------------- HOST -------------//
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
#include "host/usbh.h"
#if HOST_CLASS_HID

View File

@ -109,13 +109,6 @@
#error "tinyusb does not support same modes on more than 1 roothub port"
#endif
// TODO remove
#define CONTROLLER_HOST_NUMBER (\
((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST) ? 1 : 0) + \
((CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST) ? 1 : 0))
#define MODE_HOST_SUPPORTED (CONTROLLER_HOST_NUMBER > 0)
// 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 TUSB_OPT_HOST_ENABLED ( TUH_OPT_RHPORT >= 0 )
@ -206,7 +199,7 @@
//--------------------------------------------------------------------
// HOST OPTIONS
//--------------------------------------------------------------------
#if MODE_HOST_SUPPORTED
#if TUSB_OPT_HOST_ENABLED
#ifndef CFG_TUSB_HOST_DEVICE_MAX
#define CFG_TUSB_HOST_DEVICE_MAX 1
#warning CFG_TUSB_HOST_DEVICE_MAX is not defined, default value is 1
@ -228,7 +221,7 @@
#endif
//------------- CLASS -------------//
#endif // MODE_HOST_SUPPORTED
#endif // TUSB_OPT_HOST_ENABLED
//------------------------------------------------------------------