mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
add OPT_MODE_HIGH_SPEED
This commit is contained in:
parent
60d5ac1c39
commit
80ecf1fd54
@ -55,7 +55,12 @@
|
||||
#error CFG_TUSB_MCU should be defined using compiler flags
|
||||
#endif
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
|
||||
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
|
||||
#else
|
||||
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
|
||||
#endif
|
||||
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
|
||||
@ -121,7 +126,6 @@
|
||||
//--------------------------------------------------------------------
|
||||
// MSC
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Number of supported Logical Unit Number (At least 1)
|
||||
#define CFG_TUD_MSC_MAXLUN 1
|
||||
|
||||
|
@ -73,8 +73,12 @@ TU_VERIFY_STATIC(CFG_TUD_MSC_BUFSIZE < UINT16_MAX, "Size is not correct");
|
||||
|
||||
// TODO highspeed device is 512
|
||||
#ifndef CFG_TUD_MSC_EPSIZE
|
||||
#if TUD_OPT_HIGH_SPEED
|
||||
#define CFG_TUD_MSC_EPSIZE 512
|
||||
#else
|
||||
#define CFG_TUD_MSC_EPSIZE 64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -288,7 +288,7 @@ bool dcd_edpt_busy(uint8_t rhport, uint8_t ep_addr)
|
||||
// return !p_qhd->qtd_overlay.halted && p_qhd->qtd_overlay.active;
|
||||
}
|
||||
|
||||
bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
|
||||
bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
|
||||
{
|
||||
uint8_t const epnum = edpt_number(ep_addr);
|
||||
uint8_t const dir = edpt_dir(ep_addr);
|
||||
@ -301,9 +301,8 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
|
||||
while(LPC_USB[rhport]->ENDPTSETUPSTAT & BIT_(0)) {}
|
||||
}
|
||||
|
||||
dcd_data_t* p_dcd = dcd_data_ptr[rhport];
|
||||
dcd_qhd_t * p_qhd = &p_dcd->qhd[ep_idx];
|
||||
dcd_qtd_t * p_qtd = &p_dcd->qtd[ep_idx];
|
||||
dcd_qhd_t * p_qhd = &dcd_data_ptr[rhport]->qhd[ep_idx];
|
||||
dcd_qtd_t * p_qtd = &dcd_data_ptr[rhport]->qtd[ep_idx];
|
||||
|
||||
//------------- Prepare qtd -------------//
|
||||
qtd_init(p_qtd, buffer, total_bytes);
|
||||
|
@ -83,13 +83,16 @@
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// CONTROLLER
|
||||
// Only 1 roothub port can be configured to be device and/or host.
|
||||
// tinyusb does not support dual devices or dual host configuration
|
||||
//--------------------------------------------------------------------
|
||||
/** \defgroup group_mode Controller Mode Selection
|
||||
* \brief CFG_TUSB_CONTROLLER_N_MODE must be defined with these
|
||||
* @{ */
|
||||
#define OPT_MODE_HOST 0x02 ///< Host Mode
|
||||
#define OPT_MODE_DEVICE 0x01 ///< Device Mode
|
||||
#define OPT_MODE_NONE 0x00 ///< Disabled
|
||||
#define OPT_MODE_NONE 0x00 ///< Disabled
|
||||
#define OPT_MODE_DEVICE 0x01 ///< Device Mode
|
||||
#define OPT_MODE_HOST 0x02 ///< Host Mode
|
||||
#define OPT_MODE_HIGH_SPEED 0x10 ///< Highspeed
|
||||
/** @} */
|
||||
|
||||
#ifndef CFG_TUSB_RHPORT0_MODE
|
||||
@ -100,21 +103,28 @@
|
||||
#define CFG_TUSB_RHPORT1_MODE OPT_MODE_NONE
|
||||
#endif
|
||||
|
||||
#if ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST)) || \
|
||||
((CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE))
|
||||
#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 )
|
||||
|
||||
// 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_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE & (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)) || (CFG_TUSB_RHPORT1_MODE & (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)) )
|
||||
|
||||
#define TUSB_OPT_DEVICE_ENABLED ( TUD_OPT_RHPORT >= 0 )
|
||||
|
||||
#if ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST)) || ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE))
|
||||
#error "tinyusb does not support same modes on more than 1 roothub port"
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON OPTIONS
|
||||
|
Loading…
x
Reference in New Issue
Block a user