mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
rename CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE to CFG_TUSB_DEVICE_ENDOINT0_SIZE
This commit is contained in:
parent
3c24671960
commit
81935c91e9
@ -57,7 +57,7 @@
|
||||
/** \defgroup CFG_TUSB_DEVICE Device Options
|
||||
* @{ */
|
||||
|
||||
#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE ///< Max packet size of Cotnrol Endpoint, default is 64
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE ///< Max packet size of Cotnrol Endpoint, default is 64
|
||||
|
||||
/// Application MUST define this variable and initialize its pointers's member to all required USB descriptors including
|
||||
/// Device Descriptor, Configuration Descriptor, String Descriptors, HID Report Descriptors etc ...
|
||||
|
@ -54,23 +54,23 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 0
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 0
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 0
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 0
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
|
||||
//#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
|
||||
//#define CFG_TUSB_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
|
||||
#define CFG_TUSB_TICKS_HZ 1000
|
||||
#define CFG_TUSB_TICKS_HZ 1000
|
||||
|
||||
//#define CFG_TUSB_OS TUSB_OS_NONE
|
||||
|
||||
|
@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device =
|
||||
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
|
||||
.bDeviceProtocol = MISC_PROTOCOL_IAD,
|
||||
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE,
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE,
|
||||
|
||||
.idVendor = CFG_VENDORID,
|
||||
.idProduct = CFG_PRODUCTID,
|
||||
|
@ -48,29 +48,28 @@
|
||||
//--------------------------------------------------------------------+
|
||||
//#define CFG_TUSB_MCU will be passed from IDE/command line for easy board/mcu switching
|
||||
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
|
||||
//#define CFG_TUSB_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 0
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 0
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
|
||||
#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
|
||||
#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
|
||||
//#define CFG_TUSB_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
|
||||
#define CFG_TUSB_TICKS_HZ 1000
|
||||
#define CFG_TUSB_TICKS_HZ 1000
|
||||
|
||||
//#define CFG_TUSB_OS TUSB_OS_NONE
|
||||
|
||||
|
@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device =
|
||||
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
|
||||
.bDeviceProtocol = MISC_PROTOCOL_IAD,
|
||||
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE,
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE,
|
||||
|
||||
.idVendor = CFG_VENDORID,
|
||||
.idProduct = CFG_PRODUCTID,
|
||||
|
@ -54,19 +54,19 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 1
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 1
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
|
||||
//#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
|
||||
//#define CFG_TUSB_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
|
||||
|
@ -152,7 +152,7 @@ tusb_desc_device_t const desc_device =
|
||||
.bDeviceProtocol = 0x00,
|
||||
#endif
|
||||
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE,
|
||||
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE,
|
||||
|
||||
.idVendor = CFG_VENDORID,
|
||||
.idProduct = CFG_PRODUCTID,
|
||||
|
@ -47,26 +47,26 @@
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
//#define CFG_TUSB_MCU will be passed from IDE for easy board/mcu switching
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_HOST)
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_HOST)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_HOST_HUB 1
|
||||
#define CFG_TUSB_HOST_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_HOST_HID_MOUSE 1
|
||||
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
|
||||
#define CFG_TUSB_HOST_MSC 1
|
||||
#define CFG_TUSB_HOST_CDC 1
|
||||
#define CFG_TUSB_HOST_HUB 1
|
||||
#define CFG_TUSB_HOST_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_HOST_HID_MOUSE 1
|
||||
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
|
||||
#define CFG_TUSB_HOST_MSC 1
|
||||
#define CFG_TUSB_HOST_CDC 1
|
||||
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUSB_HOST_HUB ? 5 : 1) // normal hub has 4 ports
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUSB_HOST_HUB ? 5 : 1) // normal hub has 4 ports
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
#define CFG_TUSB_DEBUG 2
|
||||
|
||||
//#define CFG_TUSB_OS TUSB_OS_NONE // defined using eclipse build
|
||||
//#define CFG_TUSB_OS_TASK_PRIO 0 // defined using eclipse build
|
||||
|
@ -46,22 +46,22 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_HOST | TUSB_MODE_DEVICE)
|
||||
#define CFG_TUSB_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_HOST | TUSB_MODE_DEVICE)
|
||||
#define CFG_TUSB_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX 5 // TODO be a part of HUB config
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX 5 // TODO be a part of HUB config
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_HOST_HUB 0
|
||||
#define CFG_TUSB_HOST_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_HOST_HID_MOUSE 1
|
||||
#define CFG_TUSB_HOST_HID_GENERIC 0
|
||||
#define CFG_TUSB_HOST_MSC 1
|
||||
#define CFG_TUSB_HOST_CDC 1
|
||||
#define CFG_TUSB_HOST_CDC_RNDIS 0
|
||||
#define CFG_TUSB_HOST_HUB 0
|
||||
#define CFG_TUSB_HOST_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_HOST_HID_MOUSE 1
|
||||
#define CFG_TUSB_HOST_MSC 1
|
||||
#define CFG_TUSB_HOST_HID_GENERIC 0
|
||||
#define CFG_TUSB_HOST_CDC 1
|
||||
#define CFG_TUSB_HOST_CDC_RNDIS 0
|
||||
|
||||
// Test support
|
||||
#define TEST_CONTROLLER_HOST_START_INDEX \
|
||||
@ -70,14 +70,14 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 1
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1
|
||||
#define CFG_TUSB_DEVICE_HID_MOUSE 1
|
||||
#define CFG_TUSB_DEVICE_HID_GENERIC 0
|
||||
#define CFG_TUSB_DEVICE_MSC 1
|
||||
#define CFG_TUSB_DEVICE_CDC 1
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -128,8 +128,8 @@ bool dcd_init(uint8_t rhport)
|
||||
|
||||
//------------- user manual 11.13 usb device controller initialization -------------// LPC_USB->USBEpInd = 0;
|
||||
// step 6 : set up control endpoint
|
||||
edpt_set_max_packet_size(0, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
|
||||
edpt_set_max_packet_size(1, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
|
||||
edpt_set_max_packet_size(0, CFG_TUSB_DEVICE_ENDOINT0_SIZE);
|
||||
edpt_set_max_packet_size(1, CFG_TUSB_DEVICE_ENDOINT0_SIZE);
|
||||
|
||||
bus_reset();
|
||||
|
||||
@ -312,7 +312,7 @@ static inline uint16_t length_byte2dword(uint16_t length_in_bytes)
|
||||
|
||||
static tusb_error_t pipe_control_xfer(uint8_t ep_id, uint8_t* p_buffer, uint16_t length)
|
||||
{
|
||||
uint16_t const packet_len = min16_of(length, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
|
||||
uint16_t const packet_len = min16_of(length, CFG_TUSB_DEVICE_ENDOINT0_SIZE);
|
||||
|
||||
if (ep_id)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ static void bus_reset(uint8_t rhport)
|
||||
|
||||
//------------- Set up Control Endpoints (0 OUT, 1 IN) -------------//
|
||||
p_dcd->qhd[0].zero_length_termination = p_dcd->qhd[1].zero_length_termination = 1;
|
||||
p_dcd->qhd[0].max_package_size = p_dcd->qhd[1].max_package_size = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE;
|
||||
p_dcd->qhd[0].max_package_size = p_dcd->qhd[1].max_package_size = CFG_TUSB_DEVICE_ENDOINT0_SIZE;
|
||||
p_dcd->qhd[0].qtd_overlay.next = p_dcd->qhd[1].qtd_overlay.next = QTD_NEXT_INVALID;
|
||||
|
||||
p_dcd->qhd[0].int_on_setup = 1; // OUT only
|
||||
|
@ -143,6 +143,28 @@
|
||||
#define tu_free free
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE OPTIONS
|
||||
//--------------------------------------------------------------------+
|
||||
#if MODE_DEVICE_SUPPORTED
|
||||
|
||||
#define DEVICE_CLASS_HID ( CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + CFG_TUSB_DEVICE_HID_GENERIC )
|
||||
|
||||
#ifndef CFG_TUSB_DEVICE_ENDOINT0_SIZE
|
||||
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_TUSB_DEVICE_ENDOINT0_SIZE > 64
|
||||
#error Control Endpoint Max Package Size cannot larger than 64
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE
|
||||
#define CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
#endif // MODE_DEVICE_SUPPORTED
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST OPTIONS
|
||||
//--------------------------------------------------------------------+
|
||||
@ -170,23 +192,6 @@
|
||||
//------------- CLASS -------------//
|
||||
#endif // MODE_HOST_SUPPORTED
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE OPTIONS
|
||||
//--------------------------------------------------------------------+
|
||||
#if MODE_DEVICE_SUPPORTED
|
||||
|
||||
#define DEVICE_CLASS_HID ( CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + CFG_TUSB_DEVICE_HID_GENERIC )
|
||||
|
||||
#if CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE > 64
|
||||
#error Control Endpoint Max Package Size cannot larger than 64
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE
|
||||
#define CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
#endif // MODE_DEVICE_SUPPORTED
|
||||
|
||||
#endif /* _TUSB_TUSB_OPTION_H_ */
|
||||
|
||||
/** @} */
|
||||
|
Loading…
x
Reference in New Issue
Block a user