fix potential issue with stall endpoints

NOTE: cannot able to STALL control OUT endpoints --> unsupported with data out request may got to an issue.
clean up configure, add max string descriptor configure as windows sometimes ask for string @ index 238 !!!
This commit is contained in:
hathach
2013-11-13 14:00:39 +07:00
parent 92d9c36dbc
commit 7d84139bd4
11 changed files with 34 additions and 455 deletions

View File

@@ -75,25 +75,16 @@
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
#define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor
#define TUSB_CFG_DEVICE_USE_ROM_DRIVER 0
//------------- descriptors -------------//
#define TUSB_CFG_DEVICE_STRING_MANUFACTURER "tinyusb.org"
#define TUSB_CFG_DEVICE_STRING_PRODUCT "Device Example"
#define TUSB_CFG_DEVICE_STRING_SERIAL "1234"
#define TUSB_CFG_DEVICE_VENDORID 0x1FC9 // NXP
//#define TUSB_CFG_DEVICE_PRODUCTID 0x4567
#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
#define TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT 4
#define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor, remove
//------------- CLASS -------------//
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
#define TUSB_CFG_DEVICE_HID_MOUSE 0
#define TUSB_CFG_DEVICE_HID_GENERIC 0
#define TUSB_CFG_DEVICE_MSC 0
#define TUSB_CFG_DEVICE_CDC 1
#define TUSB_CFG_DEVICE_CDC 0
//--------------------------------------------------------------------+
// COMMON CONFIGURATION

View File

@@ -151,8 +151,8 @@ tusb_descriptor_device_t app_tusb_desc_device =
.bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
.idVendor = TUSB_CFG_DEVICE_VENDORID,
.idProduct = TUSB_CFG_PRODUCT_ID,
.idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID,
.bcdDevice = 0x0100,
.iManufacturer = 0x01,
@@ -432,7 +432,7 @@ tusb_descriptor_string_t desc_str_serial =
.unicode_string = { '1', '2', '3', '4' } // len = 4
};
tusb_descriptor_string_t * const desc_str_table [] =
tusb_descriptor_string_t * const desc_str_table [TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT] =
{
&desc_str_language,
&desc_str_manufacturer,

View File

@@ -41,6 +41,10 @@
#include "tusb.h"
#define CFG_VENDORID 0x1FC9 // NXP
//#define CFG_PRODUCTID 0x4567 // use auto product id to prevent conflict with pc's driver
#define ENDPOINT_OUT_LOGICAL_TO_PHYSICAL(addr) (addr)
#define ENDPOINT_IN_LOGICAL_TO_PHYSICAL(addr) ((addr) | 0x80)
@@ -74,10 +78,10 @@
// each combination of interfaces need to have different productid, as windows will bind & remember device driver after the
// first plug.
#ifndef TUSB_CFG_PRODUCT_ID
#ifndef CFG_PRODUCTID
// Bitmap: MassStorage | Generic | Mouse | Key | CDC
#define PRODUCTID_BITMAP(interface, n) ( (TUSB_CFG_DEVICE_##interface) << (n) )
#define TUSB_CFG_PRODUCT_ID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
#define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \
PRODUCTID_BITMAP(MSC, 4) ) )
#endif
@@ -134,7 +138,7 @@ typedef ATTR_PACKED_STRUCT(struct)
//--------------------------------------------------------------------+
// STRINGS DESCRIPTOR
//--------------------------------------------------------------------+
tusb_descriptor_string_t * const desc_str_table [];
tusb_descriptor_string_t * const desc_str_table[TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT];
//--------------------------------------------------------------------+
// Export descriptors