shorten descriptor type

This commit is contained in:
hathach 2018-03-23 12:32:40 +07:00
parent 2c18805aa9
commit 5f26c57b28
56 changed files with 281 additions and 281 deletions

View File

@ -41,9 +41,9 @@
//--------------------------------------------------------------------+
// USB DEVICE DESCRIPTOR
//--------------------------------------------------------------------+
tusb_descriptor_device_t const desc_device =
tusb_desc_device_t const desc_device =
{
.bLength = sizeof(tusb_descriptor_device_t),
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
@ -73,7 +73,7 @@ app_descriptor_configuration_t const desc_configuration =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION,
.wTotalLength = sizeof(app_descriptor_configuration_t),
@ -88,7 +88,7 @@ app_descriptor_configuration_t const desc_configuration =
// IAD points to CDC Interfaces
.cdc_iad =
{
.bLength = sizeof(tusb_descriptor_interface_association_t),
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
.bFirstInterface = INTERFACE_NO_CDC,
@ -103,7 +103,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC,
.bAlternateSetting = 0,
@ -152,7 +152,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -163,7 +163,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC+1,
.bAlternateSetting = 0x00,
@ -176,7 +176,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -186,7 +186,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -78,23 +78,23 @@
//--------------------------------------------------------------------+
typedef struct ATTR_PACKED
{
tusb_descriptor_configuration_t configuration;
tusb_desc_configuration_t configuration;
//------------- CDC -------------//
tusb_descriptor_interface_association_t cdc_iad;
tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface
tusb_descriptor_interface_t cdc_comm_interface;
tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header;
cdc_desc_func_call_management_t cdc_call;
cdc_desc_func_abstract_control_management_t cdc_acm;
cdc_desc_func_union_t cdc_union;
tusb_descriptor_endpoint_t cdc_endpoint_notification;
tusb_desc_endpoint_t cdc_endpoint_notification;
//CDC Data Interface
tusb_descriptor_interface_t cdc_data_interface;
tusb_descriptor_endpoint_t cdc_endpoint_out;
tusb_descriptor_endpoint_t cdc_endpoint_in;
tusb_desc_interface_t cdc_data_interface;
tusb_desc_endpoint_t cdc_endpoint_out;
tusb_desc_endpoint_t cdc_endpoint_in;
} app_descriptor_configuration_t;

View File

@ -41,9 +41,9 @@
//--------------------------------------------------------------------+
// USB DEVICE DESCRIPTOR
//--------------------------------------------------------------------+
tusb_descriptor_device_t const desc_device =
tusb_desc_device_t const desc_device =
{
.bLength = sizeof(tusb_descriptor_device_t),
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
@ -73,7 +73,7 @@ app_descriptor_configuration_t const desc_configuration =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION,
.wTotalLength = sizeof(app_descriptor_configuration_t),
@ -88,7 +88,7 @@ app_descriptor_configuration_t const desc_configuration =
// IAD points to CDC Interfaces
.cdc_iad =
{
.bLength = sizeof(tusb_descriptor_interface_association_t),
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
.bFirstInterface = INTERFACE_NO_CDC,
@ -103,7 +103,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC,
.bAlternateSetting = 0,
@ -152,7 +152,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -163,7 +163,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC+1,
.bAlternateSetting = 0x00,
@ -176,7 +176,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -186,7 +186,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -78,23 +78,23 @@
//--------------------------------------------------------------------+
typedef struct ATTR_PACKED
{
tusb_descriptor_configuration_t configuration;
tusb_desc_configuration_t configuration;
//------------- CDC -------------//
tusb_descriptor_interface_association_t cdc_iad;
tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface
tusb_descriptor_interface_t cdc_comm_interface;
tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header;
cdc_desc_func_call_management_t cdc_call;
cdc_desc_func_abstract_control_management_t cdc_acm;
cdc_desc_func_union_t cdc_union;
tusb_descriptor_endpoint_t cdc_endpoint_notification;
tusb_desc_endpoint_t cdc_endpoint_notification;
//CDC Data Interface
tusb_descriptor_interface_t cdc_data_interface;
tusb_descriptor_endpoint_t cdc_endpoint_out;
tusb_descriptor_endpoint_t cdc_endpoint_in;
tusb_desc_interface_t cdc_data_interface;
tusb_desc_endpoint_t cdc_endpoint_out;
tusb_desc_endpoint_t cdc_endpoint_in;
} app_descriptor_configuration_t;

View File

@ -135,9 +135,9 @@ uint8_t const desc_mouse_report[] = {
//--------------------------------------------------------------------+
// USB DEVICE DESCRIPTOR
//--------------------------------------------------------------------+
tusb_descriptor_device_t const desc_device =
tusb_desc_device_t const desc_device =
{
.bLength = sizeof(tusb_descriptor_device_t),
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
#if TUSB_CFG_DEVICE_CDC
@ -172,7 +172,7 @@ app_descriptor_configuration_t const desc_configuration =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION,
.wTotalLength = sizeof(app_descriptor_configuration_t),
@ -188,7 +188,7 @@ app_descriptor_configuration_t const desc_configuration =
// IAD points to CDC Interfaces
.cdc_iad =
{
.bLength = sizeof(tusb_descriptor_interface_association_t),
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
.bFirstInterface = INTERFACE_NO_CDC,
@ -203,7 +203,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC,
.bAlternateSetting = 0,
@ -252,7 +252,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -263,7 +263,7 @@ app_descriptor_configuration_t const desc_configuration =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC+1,
.bAlternateSetting = 0x00,
@ -276,7 +276,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -286,7 +286,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -299,7 +299,7 @@ app_descriptor_configuration_t const desc_configuration =
#if TUSB_CFG_DEVICE_HID_KEYBOARD
.keyboard_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_HID_KEYBOARD,
.bAlternateSetting = 0x00,
@ -323,7 +323,7 @@ app_descriptor_configuration_t const desc_configuration =
.keyboard_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = HID_KEYBOARD_EDPT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -336,7 +336,7 @@ app_descriptor_configuration_t const desc_configuration =
#if TUSB_CFG_DEVICE_HID_MOUSE
.mouse_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_HID_MOUSE,
.bAlternateSetting = 0x00,
@ -360,7 +360,7 @@ app_descriptor_configuration_t const desc_configuration =
.mouse_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = HID_MOUSE_EDPT_ADDR, // TODO
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -373,7 +373,7 @@ app_descriptor_configuration_t const desc_configuration =
#if TUSB_CFG_DEVICE_MSC
.msc_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_MSC,
.bAlternateSetting = 0x00,
@ -386,7 +386,7 @@ app_descriptor_configuration_t const desc_configuration =
.msc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = MSC_EDPT_IN_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -396,7 +396,7 @@ app_descriptor_configuration_t const desc_configuration =
.msc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = MSC_EDPT_OUT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -132,45 +132,45 @@
//--------------------------------------------------------------------+
typedef struct ATTR_PACKED
{
tusb_descriptor_configuration_t configuration;
tusb_desc_configuration_t configuration;
//------------- CDC -------------//
#if TUSB_CFG_DEVICE_CDC
tusb_descriptor_interface_association_t cdc_iad;
tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface
tusb_descriptor_interface_t cdc_comm_interface;
tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header;
cdc_desc_func_call_management_t cdc_call;
cdc_desc_func_abstract_control_management_t cdc_acm;
cdc_desc_func_union_t cdc_union;
tusb_descriptor_endpoint_t cdc_endpoint_notification;
tusb_desc_endpoint_t cdc_endpoint_notification;
//CDC Data Interface
tusb_descriptor_interface_t cdc_data_interface;
tusb_descriptor_endpoint_t cdc_endpoint_out;
tusb_descriptor_endpoint_t cdc_endpoint_in;
tusb_desc_interface_t cdc_data_interface;
tusb_desc_endpoint_t cdc_endpoint_out;
tusb_desc_endpoint_t cdc_endpoint_in;
#endif
//------------- HID Keyboard -------------//
#if TUSB_CFG_DEVICE_HID_KEYBOARD
tusb_descriptor_interface_t keyboard_interface;
tusb_desc_interface_t keyboard_interface;
tusb_hid_descriptor_hid_t keyboard_hid;
tusb_descriptor_endpoint_t keyboard_endpoint;
tusb_desc_endpoint_t keyboard_endpoint;
#endif
//------------- HID Mouse -------------//
#if TUSB_CFG_DEVICE_HID_MOUSE
tusb_descriptor_interface_t mouse_interface;
tusb_desc_interface_t mouse_interface;
tusb_hid_descriptor_hid_t mouse_hid;
tusb_descriptor_endpoint_t mouse_endpoint;
tusb_desc_endpoint_t mouse_endpoint;
#endif
//------------- Mass Storage -------------//
#if TUSB_CFG_DEVICE_MSC
tusb_descriptor_interface_t msc_interface;
tusb_descriptor_endpoint_t msc_endpoint_in;
tusb_descriptor_endpoint_t msc_endpoint_out;
tusb_desc_interface_t msc_interface;
tusb_desc_endpoint_t msc_endpoint_in;
tusb_desc_endpoint_t msc_endpoint_out;
#endif
} app_descriptor_configuration_t;

View File

@ -389,7 +389,7 @@ static void normal_xact_start(uint8_t epnum, uint8_t dir)
}
}
bool tusb_dcd_edpt_open (uint8_t rhport, tusb_descriptor_endpoint_t const * desc_edpt)
bool tusb_dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
{
(void) rhport;

View File

@ -293,7 +293,7 @@ void tusb_dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
(*reg_control) &= ~(ENDPTCTRL_MASK_STALL << ((ep_addr & TUSB_DIR_IN_MASK) ? 16 : 0));
}
bool tusb_dcd_edpt_open(uint8_t rhport, tusb_descriptor_endpoint_t const * p_endpoint_desc)
bool tusb_dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc)
{
// TODO USB1 only has 4 non-control enpoint (USB0 has 5)
// TODO not support ISO yet

View File

@ -118,9 +118,9 @@ void test_dcd_init(void)
void test_dcd_configure_endpoint_in(void)
{
tusb_descriptor_endpoint_t const desc_endpoint =
tusb_desc_endpoint_t const desc_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },

View File

@ -65,7 +65,7 @@ void test_dcd_init_failed(void)
TEST_ASSERT_EQUAL(TUSB_ERROR_FAILED, usbd_init() );
}
tusb_error_t stub_hidd_init(uint8_t coreid, tusb_descriptor_interface_t const* p_interface_desc, uint16_t* p_length, int num_call)
tusb_error_t stub_hidd_init(uint8_t coreid, tusb_desc_interface_t const* p_interface_desc, uint16_t* p_length, int num_call)
{
switch(num_call)
{

View File

@ -47,7 +47,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(cdc_configuration_desc_t),
@ -62,7 +62,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
// IAD points to CDC Interfaces
.cdc_iad =
{
.bLength = sizeof(tusb_descriptor_interface_association_t),
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
.bFirstInterface = 1,
@ -80,7 +80,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 1,
.bAlternateSetting = 0,
@ -121,7 +121,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -132,7 +132,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 2,
.bAlternateSetting = 0x00,
@ -145,7 +145,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 2,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -155,7 +155,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -173,7 +173,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(cdc_configuration_desc_t),
@ -188,7 +188,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
// IAD points to CDC Interfaces
.cdc_iad =
{
.bLength = sizeof(tusb_descriptor_interface_association_t),
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
.bFirstInterface = 1,
@ -206,7 +206,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 1,
.bAlternateSetting = 0,
@ -244,7 +244,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -255,7 +255,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 2,
.bAlternateSetting = 0x00,
@ -268,7 +268,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 2,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -278,7 +278,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -55,21 +55,21 @@
typedef struct
{
tusb_descriptor_configuration_t configuration;
tusb_desc_configuration_t configuration;
tusb_descriptor_interface_association_t cdc_iad;
tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface
tusb_descriptor_interface_t cdc_comm_interface;
tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header;
cdc_desc_func_abstract_control_management_t cdc_acm;
cdc_desc_func_union_t cdc_union;
tusb_descriptor_endpoint_t cdc_endpoint_notification;
tusb_desc_endpoint_t cdc_endpoint_notification;
//CDC Data Interface
tusb_descriptor_interface_t cdc_data_interface;
tusb_descriptor_endpoint_t cdc_endpoint_out;
tusb_descriptor_endpoint_t cdc_endpoint_in;
tusb_desc_interface_t cdc_data_interface;
tusb_desc_endpoint_t cdc_endpoint_out;
tusb_desc_endpoint_t cdc_endpoint_in;
} cdc_configuration_desc_t;

View File

@ -58,10 +58,10 @@
static uint8_t dev_addr;
static uint16_t length;
static tusb_descriptor_interface_t const * p_comm_interface = &cdc_config_descriptor.cdc_comm_interface;
static tusb_descriptor_endpoint_t const * p_endpoint_notification = &cdc_config_descriptor.cdc_endpoint_notification;
static tusb_descriptor_endpoint_t const * p_endpoint_out = &cdc_config_descriptor.cdc_endpoint_out;
static tusb_descriptor_endpoint_t const * p_endpoint_in = &cdc_config_descriptor.cdc_endpoint_in;
static tusb_desc_interface_t const * p_comm_interface = &cdc_config_descriptor.cdc_comm_interface;
static tusb_desc_endpoint_t const * p_endpoint_notification = &cdc_config_descriptor.cdc_endpoint_notification;
static tusb_desc_endpoint_t const * p_endpoint_out = &cdc_config_descriptor.cdc_endpoint_out;
static tusb_desc_endpoint_t const * p_endpoint_in = &cdc_config_descriptor.cdc_endpoint_in;
extern cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX];
static cdch_data_t * p_cdc = &cdch_data[0];
@ -124,11 +124,11 @@ void test_cdch_open_length_check(void)
{
const uint16_t expected_length =
//------------- Comm Interface -------------//
sizeof(tusb_descriptor_interface_t) + sizeof(cdc_desc_func_header_t) +
sizeof(tusb_desc_interface_t) + sizeof(cdc_desc_func_header_t) +
sizeof(cdc_desc_func_abstract_control_management_t) + sizeof(cdc_desc_func_union_t) +
sizeof(tusb_descriptor_endpoint_t) +
sizeof(tusb_desc_endpoint_t) +
//------------- Data Interface -------------//
sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
pipe_handle_t dummy_hld = { .dev_addr = 1 };
hcd_pipe_open_IgnoreAndReturn(dummy_hld);

View File

@ -63,10 +63,10 @@ void tearDown(void)
static uint8_t dev_addr;
static uint16_t length;
static tusb_descriptor_interface_t const * p_comm_interface = &rndis_config_descriptor.cdc_comm_interface;
static tusb_descriptor_endpoint_t const * p_endpoint_notification = &rndis_config_descriptor.cdc_endpoint_notification;
static tusb_descriptor_endpoint_t const * p_endpoint_out = &rndis_config_descriptor.cdc_endpoint_out;
static tusb_descriptor_endpoint_t const * p_endpoint_in = &rndis_config_descriptor.cdc_endpoint_in;
static tusb_desc_interface_t const * p_comm_interface = &rndis_config_descriptor.cdc_comm_interface;
static tusb_desc_endpoint_t const * p_endpoint_notification = &rndis_config_descriptor.cdc_endpoint_notification;
static tusb_desc_endpoint_t const * p_endpoint_out = &rndis_config_descriptor.cdc_endpoint_out;
static tusb_desc_endpoint_t const * p_endpoint_in = &rndis_config_descriptor.cdc_endpoint_in;
static pipe_handle_t pipe_notification = { .dev_addr = 1, .xfer_type = TUSB_XFER_INTERRUPT };
static pipe_handle_t pipe_out = { .dev_addr = 1, .xfer_type = TUSB_XFER_BULK, .index = 0 };

View File

@ -157,9 +157,9 @@ void test_isr_disconnect_then_async_advance_control_pipe(void)
void test_bulk_pipe_close(void)
{
tusb_descriptor_endpoint_t const desc_ept_bulk_in =
tusb_desc_endpoint_t const desc_ept_bulk_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -107,9 +107,9 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
//--------------------------------------------------------------------+
// PIPE OPEN
//--------------------------------------------------------------------+
tusb_descriptor_endpoint_t const desc_ept_bulk_in =
tusb_desc_endpoint_t const desc_ept_bulk_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -117,9 +117,9 @@ tusb_descriptor_endpoint_t const desc_ept_bulk_in =
.bInterval = 0
};
tusb_descriptor_endpoint_t const desc_ept_bulk_out =
tusb_desc_endpoint_t const desc_ept_bulk_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -127,7 +127,7 @@ tusb_descriptor_endpoint_t const desc_ept_bulk_out =
.bInterval = 0
};
void verify_bulk_open_qhd(ehci_qhd_t *p_qhd, tusb_descriptor_endpoint_t const * desc_endpoint, uint8_t class_code)
void verify_bulk_open_qhd(ehci_qhd_t *p_qhd, tusb_desc_endpoint_t const * desc_endpoint, uint8_t class_code)
{
verify_open_qhd(p_qhd, desc_endpoint->bEndpointAddress, desc_endpoint->wMaxPacketSize.size);
@ -152,7 +152,7 @@ void test_open_bulk_qhd_data(void)
{
ehci_qhd_t *p_qhd;
pipe_handle_t pipe_hdl;
tusb_descriptor_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
tusb_desc_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
//------------- Code Under TEST -------------//
pipe_hdl = hcd_pipe_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
@ -186,7 +186,7 @@ void test_open_bulk_hs_out_pingstate(void)
//--------------------------------------------------------------------+
void test_bulk_close(void)
{
tusb_descriptor_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
tusb_desc_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
ehci_qhd_t *p_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];

View File

@ -64,9 +64,9 @@ static ehci_qhd_t *async_head;
static ehci_qhd_t *p_qhd_bulk;
static pipe_handle_t pipe_hdl_bulk;
tusb_descriptor_endpoint_t const desc_ept_bulk_in =
tusb_desc_endpoint_t const desc_ept_bulk_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -74,9 +74,9 @@ tusb_descriptor_endpoint_t const desc_ept_bulk_in =
.bInterval = 0
};
tusb_descriptor_endpoint_t const desc_ept_bulk_out =
tusb_desc_endpoint_t const desc_ept_bulk_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -113,16 +113,16 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
//--------------------------------------------------------------------+
// PIPE OPEN
//--------------------------------------------------------------------+
tusb_descriptor_endpoint_t const desc_ept_interrupt_out =
tusb_desc_endpoint_t const desc_ept_interrupt_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x02,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 16,
.bInterval = 4
};
void verify_int_qhd(ehci_qhd_t *p_qhd, tusb_descriptor_endpoint_t const * desc_endpoint, uint8_t class_code)
void verify_int_qhd(ehci_qhd_t *p_qhd, tusb_desc_endpoint_t const * desc_endpoint, uint8_t class_code)
{
verify_open_qhd(p_qhd, desc_endpoint->bEndpointAddress, desc_endpoint->wMaxPacketSize.size);
@ -158,7 +158,7 @@ void test_open_interrupt_qhd_hs(void)
void test_open_interrupt_hs_interval_1(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 1;
//------------- Code Under TEST -------------//
@ -173,7 +173,7 @@ void test_open_interrupt_hs_interval_1(void)
void test_open_interrupt_hs_interval_2(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 2;
//------------- Code Under TEST -------------//
@ -187,7 +187,7 @@ void test_open_interrupt_hs_interval_2(void)
void test_open_interrupt_hs_interval_3(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 3;
//------------- Code Under TEST -------------//
@ -201,7 +201,7 @@ void test_open_interrupt_hs_interval_3(void)
void test_open_interrupt_hs_interval_4(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 4;
//------------- Code Under TEST -------------//
@ -215,7 +215,7 @@ void test_open_interrupt_hs_interval_4(void)
void test_open_interrupt_hs_interval_5(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 5;
//------------- Code Under TEST -------------//
@ -229,7 +229,7 @@ void test_open_interrupt_hs_interval_5(void)
void test_open_interrupt_hs_interval_6(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 6;
//------------- Code Under TEST -------------//
@ -243,7 +243,7 @@ void test_open_interrupt_hs_interval_6(void)
void test_open_interrupt_hs_interval_7(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 7;
//------------- Code Under TEST -------------//
@ -257,7 +257,7 @@ void test_open_interrupt_hs_interval_7(void)
void test_open_interrupt_hs_interval_8(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 16;
//------------- Code Under TEST -------------//
@ -291,7 +291,7 @@ void test_open_interrupt_qhd_non_hs(void)
void test_open_interrupt_qhd_non_hs_9(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 32;
usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
@ -325,7 +325,7 @@ void test_interrupt_close(void)
void test_interrupt_256ms_close(void)
{
tusb_descriptor_endpoint_t int_edp_interval = desc_ept_interrupt_out;
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 9;
pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);

View File

@ -64,9 +64,9 @@ static ehci_qhd_t *period_head_arr;
static ehci_qhd_t *p_qhd_interrupt;
static pipe_handle_t pipe_hdl_interrupt;
static tusb_descriptor_endpoint_t const desc_ept_interrupt_in =
static tusb_desc_endpoint_t const desc_ept_interrupt_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -74,9 +74,9 @@ static tusb_descriptor_endpoint_t const desc_ept_interrupt_in =
.bInterval = 2
};
static tusb_descriptor_endpoint_t const desc_ept_interupt_out =
static tusb_desc_endpoint_t const desc_ept_interupt_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -217,7 +217,7 @@ void test_interrupt_xfer_complete_isr_interval_less_than_1ms(void)
void test_interrupt_xfer_complete_isr_interval_2ms(void)
{
tusb_descriptor_endpoint_t desc_endpoint_2ms = desc_ept_interrupt_in;
tusb_desc_endpoint_t desc_endpoint_2ms = desc_ept_interrupt_in;
desc_endpoint_2ms.bInterval = 5;
pipe_handle_t pipe_hdl_2ms = hcd_pipe_open(dev_addr, &desc_endpoint_2ms, TUSB_CLASS_HID);

View File

@ -82,9 +82,9 @@ void tearDown(void)
//--------------------------------------------------------------------+
// TODO ISOCRHONOUS PIPE
//--------------------------------------------------------------------+
tusb_descriptor_endpoint_t const desc_ept_iso_in =
tusb_desc_endpoint_t const desc_ept_iso_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_ISOCHRONOUS },

View File

@ -56,9 +56,9 @@ pipe_handle_t pipe_hdl;
extern hidh_interface_info_t keyboardh_data[TUSB_CFG_HOST_DEVICE_MAX];
tusb_descriptor_interface_t const *p_kbd_interface_desc = &desc_configuration.keyboard_interface;
tusb_desc_interface_t const *p_kbd_interface_desc = &desc_configuration.keyboard_interface;
tusb_hid_descriptor_hid_t const *p_kbh_hid_desc = &desc_configuration.keyboard_hid;
tusb_descriptor_endpoint_t const *p_kdb_endpoint_desc = &desc_configuration.keyboard_endpoint;
tusb_desc_endpoint_t const *p_kdb_endpoint_desc = &desc_configuration.keyboard_endpoint;
void setUp(void)
{
@ -80,7 +80,7 @@ void tearDown(void)
// //------------- Code Under TEST -------------//
// TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, hidh_open_subtask(dev_addr, p_kbd_interface_desc, &length) );
//
// TEST_ASSERT_EQUAL(sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t),
// TEST_ASSERT_EQUAL(sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t),
// length);
//}

View File

@ -58,8 +58,8 @@ extern hidh_interface_info_t mouseh_data[TUSB_CFG_HOST_DEVICE_MAX];
hidh_interface_info_t *p_hidh_mouse;
hid_mouse_report_t report;
tusb_descriptor_interface_t const *p_mouse_interface_desc = &desc_configuration.mouse_interface;
tusb_descriptor_endpoint_t const *p_mouse_endpoint_desc = &desc_configuration.mouse_endpoint;
tusb_desc_interface_t const *p_mouse_interface_desc = &desc_configuration.mouse_interface;
tusb_desc_endpoint_t const *p_mouse_endpoint_desc = &desc_configuration.mouse_endpoint;
uint8_t dev_addr;

View File

@ -67,8 +67,8 @@ hidh_interface_info_t *p_hidh_kbd;
hid_keyboard_report_t report;
tusb_descriptor_interface_t const *p_kbd_interface_desc = &desc_configuration.keyboard_interface;
tusb_descriptor_endpoint_t const *p_kdb_endpoint_desc = &desc_configuration.keyboard_endpoint;
tusb_desc_interface_t const *p_kbd_interface_desc = &desc_configuration.keyboard_interface;
tusb_desc_endpoint_t const *p_kdb_endpoint_desc = &desc_configuration.keyboard_endpoint;
void setUp(void)
{
@ -154,7 +154,7 @@ void test_keyboard_open_ok(void)
TEST_ASSERT_PIPE_HANDLE(pipe_hdl, p_hidh_kbd->pipe_hdl);
TEST_ASSERT_EQUAL(8, p_hidh_kbd->report_size);
TEST_ASSERT_EQUAL(sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t),
TEST_ASSERT_EQUAL(sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t),
length);
TEST_ASSERT_EQUAL(p_kbd_interface_desc->bInterfaceNumber, p_hidh_kbd->interface_number);

View File

@ -53,8 +53,8 @@ extern hidh_interface_info_t mouseh_data[TUSB_CFG_HOST_DEVICE_MAX];
hidh_interface_info_t *p_hidh_mouse;
hid_mouse_report_t report;
tusb_descriptor_interface_t const *p_mouse_interface_desc = &desc_configuration.mouse_interface;
tusb_descriptor_endpoint_t const *p_mouse_endpoint_desc = &desc_configuration.mouse_endpoint;
tusb_desc_interface_t const *p_mouse_interface_desc = &desc_configuration.mouse_interface;
tusb_desc_endpoint_t const *p_mouse_endpoint_desc = &desc_configuration.mouse_endpoint;
uint8_t dev_addr;
@ -125,7 +125,7 @@ void test_mouse_open_ok(void)
TEST_ASSERT_PIPE_HANDLE(pipe_hdl, p_hidh_mouse->pipe_hdl);
TEST_ASSERT_EQUAL(8, p_hidh_mouse->report_size);
TEST_ASSERT_EQUAL(sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t),
TEST_ASSERT_EQUAL(sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t),
length);
TEST_ASSERT_EQUAL(p_mouse_interface_desc->bInterfaceNumber, p_hidh_mouse->interface_number);

View File

@ -53,9 +53,9 @@
extern msch_interface_t msch_data[TUSB_CFG_HOST_DEVICE_MAX];
static tusb_descriptor_interface_t const *p_msc_interface_desc = &desc_configuration.msc_interface;
static tusb_descriptor_endpoint_t const *p_edp_in = &desc_configuration.msc_endpoint_in;
static tusb_descriptor_endpoint_t const *p_edp_out = &desc_configuration.msc_endpoint_out;
static tusb_desc_interface_t const *p_msc_interface_desc = &desc_configuration.msc_interface;
static tusb_desc_endpoint_t const *p_edp_in = &desc_configuration.msc_endpoint_in;
static tusb_desc_endpoint_t const *p_edp_out = &desc_configuration.msc_endpoint_out;
static msch_interface_t* p_msc;
@ -131,7 +131,7 @@ void test_open_desc_length(void)
//------------- Code Under Test -------------//
TEST_ASSERT_STATUS( msch_open_subtask(dev_addr, p_msc_interface_desc, &length) );
TEST_ASSERT_EQUAL(sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t),
TEST_ASSERT_EQUAL(sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t),
length);
}

View File

@ -186,27 +186,27 @@ tusb_error_t control_xfer_stub(uint8_t dev_addr, const tusb_control_request_t *
return TUSB_ERROR_NONE;
}
tusb_error_t stub_hidh_open(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length, int num_call)
tusb_error_t stub_hidh_open(uint8_t dev_addr, tusb_desc_interface_t const *descriptor, uint16_t *p_length, int num_call)
{
*p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t);
*p_length = sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t);
return TUSB_ERROR_NONE;
}
tusb_error_t stub_msch_open(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length, int num_call)
tusb_error_t stub_msch_open(uint8_t dev_addr, tusb_desc_interface_t const *descriptor, uint16_t *p_length, int num_call)
{
*p_length = sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
*p_length = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
return TUSB_ERROR_NONE;
}
tusb_error_t stub_cdch_open(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length, int num_call)
tusb_error_t stub_cdch_open(uint8_t dev_addr, tusb_desc_interface_t const *descriptor, uint16_t *p_length, int num_call)
{
*p_length =
//------------- Comm Interface -------------//
sizeof(tusb_descriptor_interface_t) + sizeof(cdc_desc_func_header_t) +
sizeof(tusb_desc_interface_t) + sizeof(cdc_desc_func_header_t) +
sizeof(cdc_desc_func_abstract_control_management_t) + sizeof(cdc_desc_func_union_t) +
sizeof(tusb_descriptor_endpoint_t) +
sizeof(tusb_desc_endpoint_t) +
//------------- Data Interface -------------//
sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
return TUSB_ERROR_NONE;
}
@ -271,7 +271,7 @@ void test_enum_failed_get_9byte_config_desc(void)
osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
usbh_enumeration_task(NULL);
@ -290,7 +290,7 @@ void test_enum_failed_get_full_config_desc(void)
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
usbh_enumeration_task(NULL);
@ -305,7 +305,7 @@ void test_enum_parse_config_desc(void)
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL); // fail to set configure
@ -323,7 +323,7 @@ void test_enum_set_configure(void)
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
// class open TODO more class expect
hidh_open_subtask_StubWithCallback(stub_hidh_open);

View File

@ -119,9 +119,9 @@ const uint8_t mouse_report_descriptor[] = {
TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
tusb_descriptor_device_t const desc_device =
tusb_desc_device_t const desc_device =
{
.bLength = sizeof(tusb_descriptor_device_t),
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_TYPE_DEVICE,
.bcdUSB = 0x0200,
.bDeviceClass = 0x00,
@ -147,7 +147,7 @@ const app_configuration_desc_t desc_configuration =
{
.configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bLength = sizeof(tusb_desc_configuration_t),
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
@ -162,7 +162,7 @@ const app_configuration_desc_t desc_configuration =
//------------- HID Keyboard -------------//
.keyboard_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 1,
.bAlternateSetting = 0x00,
@ -186,7 +186,7 @@ const app_configuration_desc_t desc_configuration =
.keyboard_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -197,7 +197,7 @@ const app_configuration_desc_t desc_configuration =
//------------- HID Mouse -------------//
.mouse_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 2,
.bAlternateSetting = 0x00,
@ -221,7 +221,7 @@ const app_configuration_desc_t desc_configuration =
.mouse_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x82,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -232,7 +232,7 @@ const app_configuration_desc_t desc_configuration =
//------------- Mass Storage -------------//
.msc_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 3,
.bAlternateSetting = 0x00,
@ -245,7 +245,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -255,7 +255,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x03,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -266,7 +266,7 @@ const app_configuration_desc_t desc_configuration =
//------------- CDC Serial -------------//
.cdc_comm_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 4,
.bAlternateSetting = 0,
@ -307,7 +307,7 @@ const app_configuration_desc_t desc_configuration =
.cdc_endpoint_notification =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x84,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
@ -318,7 +318,7 @@ const app_configuration_desc_t desc_configuration =
//------------- CDC Data Interface -------------//
.cdc_data_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 5,
.bAlternateSetting = 0x00,
@ -331,7 +331,7 @@ const app_configuration_desc_t desc_configuration =
.cdc_endpoint_out =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 5,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
@ -341,7 +341,7 @@ const app_configuration_desc_t desc_configuration =
.cdc_endpoint_in =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x85,
.bmAttributes = { .xfer = TUSB_XFER_BULK },

View File

@ -63,60 +63,60 @@
typedef struct
{
tusb_descriptor_configuration_t configuration;
tusb_desc_configuration_t configuration;
#if 0 //&& IAD_DESC_REQUIRED
tusb_descriptor_interface_association_t CDC_IAD;
tusb_desc_interface_assoc_t CDC_IAD;
#endif
#if 0 //&& TUSB_CFG_DEVICE_CDC
//CDC - Serial
//CDC Control Interface
tusb_descriptor_interface_t CDC_CCI_Interface;
tusb_desc_interface_t CDC_CCI_Interface;
CDC_HEADER_DESCRIPTOR CDC_Header;
CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ACM;
CDC_UNION_1SLAVE_DESCRIPTOR CDC_Union;
tusb_descriptor_endpoint_t CDC_NotificationEndpoint;
tusb_desc_endpoint_t CDC_NotificationEndpoint;
//CDC Data Interface
tusb_descriptor_interface_t CDC_DCI_Interface;
tusb_descriptor_endpoint_t CDC_DataOutEndpoint;
tusb_descriptor_endpoint_t CDC_DataInEndpoint;
tusb_desc_interface_t CDC_DCI_Interface;
tusb_desc_endpoint_t CDC_DataOutEndpoint;
tusb_desc_endpoint_t CDC_DataInEndpoint;
#endif
//------------- HID Keyboard -------------//
tusb_descriptor_interface_t keyboard_interface;
tusb_desc_interface_t keyboard_interface;
tusb_hid_descriptor_hid_t keyboard_hid;
tusb_descriptor_endpoint_t keyboard_endpoint;
tusb_desc_endpoint_t keyboard_endpoint;
//------------- HID Mouse -------------//
tusb_descriptor_interface_t mouse_interface;
tusb_desc_interface_t mouse_interface;
tusb_hid_descriptor_hid_t mouse_hid;
tusb_descriptor_endpoint_t mouse_endpoint;
tusb_desc_endpoint_t mouse_endpoint;
//------------- Mass Storage -------------//
tusb_descriptor_interface_t msc_interface;
tusb_descriptor_endpoint_t msc_endpoint_in;
tusb_descriptor_endpoint_t msc_endpoint_out;
tusb_desc_interface_t msc_interface;
tusb_desc_endpoint_t msc_endpoint_in;
tusb_desc_endpoint_t msc_endpoint_out;
//------------- CDC Serial -------------//
//CDC Control Interface
tusb_descriptor_interface_t cdc_comm_interface;
tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header;
cdc_desc_func_abstract_control_management_t cdc_acm;
cdc_desc_func_union_t cdc_union;
tusb_descriptor_endpoint_t cdc_endpoint_notification;
tusb_desc_endpoint_t cdc_endpoint_notification;
//CDC Data Interface
tusb_descriptor_interface_t cdc_data_interface;
tusb_descriptor_endpoint_t cdc_endpoint_out;
tusb_descriptor_endpoint_t cdc_endpoint_in;
tusb_desc_interface_t cdc_data_interface;
tusb_desc_endpoint_t cdc_endpoint_out;
tusb_desc_endpoint_t cdc_endpoint_in;
unsigned char ConfigDescTermination;
} app_configuration_desc_t;
extern tusb_descriptor_device_t const desc_device;
extern tusb_desc_device_t const desc_device;
extern app_configuration_desc_t const desc_configuration;
extern const uint8_t keyboard_report_descriptor[];

View File

@ -60,9 +60,9 @@
#include "usbh.h"
//------------- core -------------//
uint8_t tusbh_device_attached_cb (tusb_descriptor_device_t const *p_desc_device) ATTR_WEAK ATTR_WARN_UNUSED_RESULT;
uint8_t tusbh_device_attached_cb (tusb_desc_device_t const *p_desc_device) ATTR_WEAK ATTR_WARN_UNUSED_RESULT;
void tusbh_device_mount_succeed_cb (uint8_t dev_addr) ATTR_WEAK;
void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_descriptor_device_t const *p_desc_device) ATTR_WEAK;
void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_desc_device_t const *p_desc_device) ATTR_WEAK;
#ifdef __cplusplus
}

View File

@ -130,7 +130,7 @@ void cdcd_init(void)
}
}
tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length)
{
if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS;
@ -144,7 +144,7 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
cdcd_data_t * p_cdc = &cdcd_data[rhport];
//------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_descriptor_interface_t);
(*p_length) = sizeof(tusb_desc_interface_t);
while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
{ // Communication Functional Descriptors
@ -159,9 +159,9 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
if ( TUSB_DESC_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
{ // notification endpoint if any
TU_ASSERT( tusb_dcd_edpt_open(rhport, (tusb_descriptor_endpoint_t const *) p_desc), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
TU_ASSERT( tusb_dcd_edpt_open(rhport, (tusb_desc_endpoint_t const *) p_desc), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
p_cdc->ep_notif = ((tusb_descriptor_endpoint_t const *) p_desc)->bEndpointAddress;
p_cdc->ep_notif = ((tusb_desc_endpoint_t const *) p_desc)->bEndpointAddress;
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next(p_desc);
@ -169,7 +169,7 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
//------------- Data Interface (if any) -------------//
if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_descriptor_interface_t const *) p_desc)->bInterfaceClass) )
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
{
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next(p_desc);
@ -177,7 +177,7 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
// data endpoints expected to be in pairs
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
tusb_desc_endpoint_t const *p_endpoint = (tusb_desc_endpoint_t const *) p_desc;
TU_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
TU_ASSERT(TUSB_XFER_BULK == p_endpoint->bmAttributes.xfer, TUSB_ERROR_DESCRIPTOR_CORRUPTED);

View File

@ -90,7 +90,7 @@ void tud_cdc_rx_cb(uint8_t rhport);
#ifdef _TINY_USB_SOURCE_FILE_
void cdcd_init(void);
tusb_error_t cdcd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t cdcd_control_request_st(uint8_t rhport, tusb_control_request_t const * p_request);
tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes);
void cdcd_close(uint8_t rhport);

View File

@ -142,7 +142,7 @@ void cdch_init(void)
memclr_(cdch_data, sizeof(cdch_data_t)*TUSB_CFG_HOST_DEVICE_MAX);
}
tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
{
OSAL_SUBTASK_BEGIN
// TODO change following assert to subtask_assert
@ -165,7 +165,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
p_cdc->interface_protocol = p_interface_desc->bInterfaceProtocol; // TODO 0xff is consider as rndis candidate, other is virtual Com
//------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_descriptor_interface_t);
(*p_length) = sizeof(tusb_desc_interface_t);
while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
{ // Communication Functional Descriptors
@ -180,7 +180,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
if ( TUSB_DESC_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
{ // notification endpoint if any
p_cdc->pipe_notification = hcd_pipe_open(dev_addr, (tusb_descriptor_endpoint_t const *) p_desc, TUSB_CLASS_CDC);
p_cdc->pipe_notification = hcd_pipe_open(dev_addr, (tusb_desc_endpoint_t const *) p_desc, TUSB_CLASS_CDC);
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next(p_desc);
@ -190,7 +190,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
//------------- Data Interface (if any) -------------//
if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_descriptor_interface_t const *) p_desc)->bInterfaceClass) )
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
{
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
p_desc = descriptor_next(p_desc);
@ -198,7 +198,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
// data endpoints expected to be in pairs
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
tusb_desc_endpoint_t const *p_endpoint = (tusb_desc_endpoint_t const *) p_desc;
ASSERT_INT(TUSB_DESC_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);
ASSERT_INT(TUSB_XFER_BULK, p_endpoint->bmAttributes.xfer, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);

View File

@ -150,7 +150,7 @@ typedef struct {
extern cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO consider to move to cdch internal header file
void cdch_init(void);
tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
void cdch_close(uint8_t dev_addr);

View File

@ -72,7 +72,7 @@ tusb_error_t tusbh_custom_write(uint8_t dev_addr, uint16_t vendor_id, uint16_t p
#ifdef _TINY_USB_SOURCE_FILE_
void cush_init(void);
tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void cush_isr(pipe_handle_t pipe_hdl, tusb_event_t event);
void cush_close(uint8_t dev_addr);

View File

@ -107,7 +107,7 @@ void cush_init(void)
memclr_(&custom_interface, sizeof(custom_interface_info_t) * TUSB_CFG_HOST_DEVICE_MAX);
}
tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
{
// FIXME quick hack to test lpc1k custom class with 2 bulk endpoints
uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
@ -116,7 +116,7 @@ tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
//------------- Bulk Endpoints Descriptor -------------//
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
tusb_desc_endpoint_t const *p_endpoint = (tusb_desc_endpoint_t const *) p_desc;
ASSERT_INT(TUSB_DESC_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_INVALID_PARA);
pipe_handle_t * p_pipe_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_IN_MASK ) ?
@ -127,7 +127,7 @@ tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
p_desc = descriptor_next(p_desc);
}
(*p_length) = sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
(*p_length) = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
return TUSB_ERROR_NONE;
}

View File

@ -257,7 +257,7 @@ tusb_error_t hidd_control_request_st(uint8_t rhport, tusb_control_request_t cons
OSAL_SUBTASK_END
}
tusb_error_t hidd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
tusb_error_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length)
{
uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
@ -268,7 +268,7 @@ tusb_error_t hidd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
//------------- Endpoint Descriptor -------------//
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
tusb_descriptor_endpoint_t const *p_desc_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
tusb_desc_endpoint_t const *p_desc_endpoint = (tusb_desc_endpoint_t const *) p_desc;
ASSERT_INT(TUSB_DESC_ENDPOINT, p_desc_endpoint->bDescriptorType, TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE);
if (p_interface_desc->bInterfaceSubClass == HID_SUBCLASS_BOOT)
@ -298,7 +298,7 @@ tusb_error_t hidd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
default: // TODO unknown, unsupported protocol --> skip this interface
return TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE;
}
*p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t);
*p_length = sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t);
}else
{
// open generic

View File

@ -201,7 +201,7 @@ void tud_hid_mouse_set_report_cb(uint8_t rhport, hid_request_report_type_t repor
#ifdef _TINY_USB_SOURCE_FILE_
void hidd_init(void);
tusb_error_t hidd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t hidd_control_request_st(uint8_t rhport, tusb_control_request_t const * p_request);
tusb_error_t hidd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes);
void hidd_close(uint8_t rhport);

View File

@ -54,7 +54,7 @@
//--------------------------------------------------------------------+
// HID Interface common functions
//--------------------------------------------------------------------+
static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interface_number, tusb_descriptor_endpoint_t const *p_endpoint_desc, hidh_interface_info_t *p_hid)
static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interface_number, tusb_desc_endpoint_t const *p_endpoint_desc, hidh_interface_info_t *p_hid)
{
p_hid->pipe_hdl = hcd_pipe_open(dev_addr, p_endpoint_desc, TUSB_CLASS_HID);
p_hid->report_size = p_endpoint_desc->wMaxPacketSize.size; // TODO get size from report descriptor
@ -180,7 +180,7 @@ void hidh_init(void)
TUSB_CFG_ATTR_USBRAM uint8_t report_descriptor[256];
#endif
tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
{
tusb_error_t error;
uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
@ -192,7 +192,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
//------------- Endpoint Descriptor -------------//
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
tusb_descriptor_endpoint_t const * p_endpoint_desc = (tusb_descriptor_endpoint_t const *) p_desc;
tusb_desc_endpoint_t const * p_endpoint_desc = (tusb_desc_endpoint_t const *) p_desc;
ASSERT_INT(TUSB_DESC_ENDPOINT, p_endpoint_desc->bDescriptorType, TUSB_ERROR_INVALID_PARA);
OSAL_SUBTASK_BEGIN
@ -246,7 +246,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
STASK_RETURN(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS); // exit & restart task
}
*p_length = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_descriptor_endpoint_t);
*p_length = sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + sizeof(tusb_desc_endpoint_t);
OSAL_SUBTASK_END
}

View File

@ -216,7 +216,7 @@ typedef struct {
}hidh_interface_info_t;
void hidh_init(void);
tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
void hidh_close(uint8_t dev_addr);

View File

@ -98,7 +98,7 @@ void mscd_close(uint8_t rhport)
memclr_(&mscd_data, sizeof(mscd_interface_t));
}
tusb_error_t mscd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
tusb_error_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length)
{
VERIFY( ( MSC_SUBCLASS_SCSI == p_interface_desc->bInterfaceSubClass &&
MSC_PROTOCOL_BOT == p_interface_desc->bInterfaceProtocol ), TUSB_ERROR_MSC_UNSUPPORTED_PROTOCOL );
@ -106,7 +106,7 @@ tusb_error_t mscd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
mscd_interface_t * p_msc = &mscd_data;
//------------- Open Data Pipe -------------//
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
tusb_desc_endpoint_t const *p_endpoint = (tusb_desc_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
for(int i=0; i<2; i++)
{
TU_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType &&
@ -122,12 +122,12 @@ tusb_error_t mscd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_int
p_msc->ep_out = p_endpoint->bEndpointAddress;
}
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
p_endpoint = (tusb_desc_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
}
p_msc->interface_num = p_interface_desc->bInterfaceNumber;
(*p_length) += sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
(*p_length) += sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
//------------- Queue Endpoint OUT for Command Block Wrapper -------------//
TU_ASSERT( tusb_dcd_edpt_xfer(rhport, p_msc->ep_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cbw_t)), TUSB_ERROR_DCD_EDPT_XFER );

View File

@ -122,7 +122,7 @@ msc_csw_status_t tud_msc_scsi_cb (uint8_t rhport, uint8_t lun, uint8_t scsi_cmd[
#ifdef _TINY_USB_SOURCE_FILE_
void mscd_init(void);
tusb_error_t mscd_open(uint8_t rhport, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t mscd_control_request_st(uint8_t rhport, tusb_control_request_t const * p_request);
tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes);
void mscd_close(uint8_t rhport);

View File

@ -292,7 +292,7 @@ void msch_init(void)
msch_sem_hdl = osal_semaphore_create(1, 0);
}
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
{
tusb_error_t error;
@ -305,8 +305,8 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
}
//------------- Open Data Pipe -------------//
tusb_descriptor_endpoint_t const *p_endpoint;
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
tusb_desc_endpoint_t const *p_endpoint;
p_endpoint = (tusb_desc_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
for(uint32_t i=0; i<2; i++)
{
@ -319,11 +319,11 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
(*p_pipe_hdl) = hcd_pipe_open(dev_addr, p_endpoint, TUSB_CLASS_MSC);
STASK_ASSERT( pipehandle_is_valid(*p_pipe_hdl) );
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
p_endpoint = (tusb_desc_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
}
msch_data[dev_addr-1].interface_number = p_interface_desc->bInterfaceNumber;
(*p_length) += sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
(*p_length) += sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
//------------- Get Max Lun -------------//

View File

@ -204,7 +204,7 @@ typedef struct {
}msch_interface_t;
void msch_init(void);
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
void msch_close(uint8_t dev_addr);
#endif

View File

@ -77,7 +77,7 @@ typedef struct ATTR_PACKED
uint8_t iSerialNumber ; ///< Index of string descriptor describing the device's serial number.
uint8_t bNumConfigurations ; ///< Number of possible configurations.
} tusb_descriptor_device_t;
} tusb_desc_device_t;
/// USB Standard Configuration Descriptor (section 9.6.1 table 9-10) */
typedef struct ATTR_PACKED
@ -91,7 +91,7 @@ typedef struct ATTR_PACKED
uint8_t iConfiguration ; ///< Index of string descriptor describing this configuration
uint8_t bmAttributes ; ///< Configuration characteristics \n D7: Reserved (set to one)\n D6: Self-powered \n D5: Remote Wakeup \n D4...0: Reserved (reset to zero) \n D7 is reserved and must be set to one for historical reasons. \n A device configuration that uses power from the bus and a local source reports a non-zero value in bMaxPower to indicate the amount of bus power required and sets D6. The actual power source at runtime may be determined using the GetStatus(DEVICE) request (see USB 2.0 spec Section 9.4.5). \n If a device configuration supports remote wakeup, D5 is set to one.
uint8_t bMaxPower ; ///< Maximum power consumption of the USB device from the bus in this specific configuration when the device is fully operational. Expressed in 2 mA units (i.e., 50 = 100 mA).
} tusb_descriptor_configuration_t;
} tusb_desc_configuration_t;
/// USB Standard Interface Descriptor (section 9.6.1 table 9-12)
typedef struct ATTR_PACKED
@ -106,7 +106,7 @@ typedef struct ATTR_PACKED
uint8_t bInterfaceSubClass ; ///< Subclass code (assigned by the USB-IF). \n These codes are qualified by the value of the bInterfaceClass field. \li If the bInterfaceClass field is reset to zero, this field must also be reset to zero. \li If the bInterfaceClass field is not set to FFH, all values are reserved for assignment by the USB-IF.
uint8_t bInterfaceProtocol ; ///< Protocol code (assigned by the USB). \n These codes are qualified by the value of the bInterfaceClass and the bInterfaceSubClass fields. If an interface supports class-specific requests, this code identifies the protocols that the device uses as defined by the specification of the device class. \li If this field is reset to zero, the device does not use a class-specific protocol on this interface. \li If this field is set to FFH, the device uses a vendor-specific protocol for this interface.
uint8_t iInterface ; ///< Index of string descriptor describing this interface
} tusb_descriptor_interface_t;
} tusb_desc_interface_t;
/// USB Standard Endpoint Descriptor (section 9.6.1 table 9-13)
typedef struct ATTR_PACKED
@ -130,7 +130,7 @@ typedef struct ATTR_PACKED
}wMaxPacketSize;
uint8_t bInterval ; ///< Interval for polling endpoint for data transfers. Expressed in frames or microframes depending on the device operating speed (i.e., either 1 millisecond or 125 us units). \n- For full-/high-speed isochronous endpoints, this value must be in the range from 1 to 16. The bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$). \n- For full-/low-speed interrupt endpoints, the value of this field may be from 1 to 255. \n- For high-speed interrupt endpoints, the bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$) . This value must be from 1 to 16. \n- For high-speed bulk/control OUT endpoints, the bInterval must specify the maximum NAK rate of the endpoint. A value of 0 indicates the endpoint never NAKs. Other values indicate at most 1 NAK each bInterval number of microframes. This value must be in the range from 0 to 255. \n Refer to Chapter 5 of USB 2.0 specification for more information.
} tusb_descriptor_endpoint_t;
} tusb_desc_endpoint_t;
/// USB Other Speed Configuration Descriptor (section 9.6.1 table 9-11)
typedef struct ATTR_PACKED
@ -144,7 +144,7 @@ typedef struct ATTR_PACKED
uint8_t IConfiguration ; ///< Index of string descriptor
uint8_t bmAttributes ; ///< Same as Configuration descriptor
uint8_t bMaxPower ; ///< Same as Configuration descriptor
} tusb_descriptor_other_speed_t;
} tusb_desc_other_speed_t;
/// USB Device Qualifier Descriptor (section 9.6.1 table 9-9)
typedef struct ATTR_PACKED
@ -159,7 +159,7 @@ typedef struct ATTR_PACKED
uint8_t bMaxPacketSize0 ; ///< Maximum packet size for other speed
uint8_t bNumConfigurations ; ///< Number of Other-speed Configurations
uint8_t bReserved ; ///< Reserved for future use, must be zero
} tusb_descriptor_device_qualifier_t;
} tusb_desc_device_qualifier_t;
/// USB Interface Association Descriptor (IAD ECN)
typedef struct ATTR_PACKED
@ -175,21 +175,21 @@ typedef struct ATTR_PACKED
uint8_t bFunctionProtocol ; ///< Interface protocol ID.
uint8_t iFunction ; ///< Index of the string descriptor describing the interface association.
} tusb_descriptor_interface_association_t;
} tusb_desc_interface_assoc_t;
/// USB Header Descriptor
typedef struct ATTR_PACKED
{
uint8_t bLength ; ///< Size of this descriptor in bytes
uint8_t bDescriptorType ; ///< Descriptor Type
} tusb_descriptor_header_t;
} tusb_desc_header_t;
typedef struct ATTR_PACKED
{
uint8_t bLength ; ///< Size of this descriptor in bytes
uint8_t bDescriptorType ; ///< Descriptor Type
uint16_t unicode_string[];
} tusb_descriptor_string_t;
} tusb_desc_string_t;
#ifdef __cplusplus
}

View File

@ -102,9 +102,9 @@ enum { USBD_CLASS_DRIVER_COUNT = sizeof(usbd_class_drivers) / sizeof(usbd_class_
//tusb_descriptor_device_qualifier_t _device_qual =
//tusb_desc_device_qualifier_t _device_qual =
//{
// .bLength = sizeof(tusb_descriptor_device_qualifier_t),
// .bLength = sizeof(tusb_desc_device_qualifier_t),
// .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER,
// .bcdUSB = 0x0200,
// .bDeviceClass =
@ -404,9 +404,9 @@ static tusb_error_t proc_set_config_req(uint8_t rhport, uint8_t config_number)
//------------- parse configuration & open drivers -------------//
uint8_t const * p_desc_config = tusbd_descriptor_pointers.p_configuration;
uint8_t const * p_desc = p_desc_config + sizeof(tusb_descriptor_configuration_t);
uint8_t const * p_desc = p_desc_config + sizeof(tusb_desc_configuration_t);
uint16_t const config_total_length = ((tusb_descriptor_configuration_t*)p_desc_config)->wTotalLength;
uint16_t const config_total_length = ((tusb_desc_configuration_t*)p_desc_config)->wTotalLength;
while( p_desc < p_desc_config + config_total_length )
{
@ -418,7 +418,7 @@ static tusb_error_t proc_set_config_req(uint8_t rhport, uint8_t config_number)
ASSERT( TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE], TUSB_ERROR_NOT_SUPPORTED_YET );
uint8_t class_index;
tusb_descriptor_interface_t* p_desc_interface = (tusb_descriptor_interface_t*) p_desc;
tusb_desc_interface_t* p_desc_interface = (tusb_desc_interface_t*) p_desc;
class_index = p_desc_interface->bInterfaceClass;
@ -430,7 +430,7 @@ static tusb_error_t proc_set_config_req(uint8_t rhport, uint8_t config_number)
uint16_t length=0;
ASSERT_STATUS( usbd_class_drivers[class_index].open( rhport, p_desc_interface, &length ) );
ASSERT( length >= sizeof(tusb_descriptor_interface_t), TUSB_ERROR_FAILED );
ASSERT( length >= sizeof(tusb_desc_interface_t), TUSB_ERROR_FAILED );
p_desc += length;
}
}
@ -453,12 +453,12 @@ static uint16_t get_descriptor(uint8_t rhport, tusb_control_request_t const * co
{
case TUSB_DESC_DEVICE:
desc_data = tusbd_descriptor_pointers.p_device;
len = sizeof(tusb_descriptor_device_t);
len = sizeof(tusb_desc_device_t);
break;
case TUSB_DESC_CONFIGURATION:
desc_data = tusbd_descriptor_pointers.p_configuration;
len = ((tusb_descriptor_configuration_t*)tusbd_descriptor_pointers.p_configuration)->wTotalLength;
len = ((tusb_desc_configuration_t*)tusbd_descriptor_pointers.p_configuration)->wTotalLength;
break;
case TUSB_DESC_STRING:

View File

@ -59,8 +59,8 @@
/// \brief Descriptor pointer collector to all the needed.
typedef struct {
uint8_t const * p_device; ///< pointer to device descritpor \ref tusb_descriptor_device_t
uint8_t const * p_configuration; ///< pointer to the whole configuration descriptor, starting by \ref tusb_descriptor_configuration_t
uint8_t const * p_device; ///< pointer to device descritpor \ref tusb_desc_device_t
uint8_t const * p_configuration; ///< pointer to the whole configuration descriptor, starting by \ref tusb_desc_configuration_t
uint8_t const** p_string_arr; ///< a array of pointers to string descriptors
uint8_t const * p_hid_keyboard_report; ///< pointer to HID report descriptor of Keybaord interface. Only needed if TUSB_CFG_DEVICE_HID_KEYBOARD is enabled
@ -72,7 +72,7 @@ extern tusbd_descriptor_pointer_t tusbd_descriptor_pointers;
typedef struct {
void (* init) (void);
tusb_error_t (* open)(uint8_t rhport, tusb_descriptor_interface_t const * desc_intf, uint16_t* p_length);
tusb_error_t (* open)(uint8_t rhport, tusb_desc_interface_t const * desc_intf, uint16_t* p_length);
tusb_error_t (* control_request_st) (uint8_t rhport, tusb_control_request_t const *);
tusb_error_t (* xfer_cb) (uint8_t rhport, uint8_t ep_addr, tusb_event_t, uint32_t);
// void (* routine)(void);

View File

@ -357,7 +357,7 @@ tusb_error_t hcd_pipe_control_close(uint8_t dev_addr)
//--------------------------------------------------------------------+
// BULK/INT/ISO PIPE API
//--------------------------------------------------------------------+
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_desc_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
pipe_handle_t const null_handle = { .dev_addr = 0, .xfer_type = 0, .index = 0 };

View File

@ -95,7 +95,7 @@ tusb_error_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size) A
tusb_error_t hcd_pipe_control_xfer(uint8_t dev_addr, tusb_control_request_t const * p_request, uint8_t data[]) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hcd_pipe_control_close(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_desc_endpoint_t const * endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hcd_pipe_queue_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes) ATTR_WARN_UNUSED_RESULT; // only queue, not transferring yet
tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) /*ATTR_WARN_UNUSED_RESULT*/;

View File

@ -156,7 +156,7 @@ void hub_init(void)
// hub_enum_sem_hdl = osal_semaphore_create( OSAL_SEM_REF(hub_enum_semaphore) );
}
tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
{
tusb_error_t error;
@ -166,8 +166,8 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t cons
if ( p_interface_desc->bInterfaceProtocol > 1 ) return TUSB_ERROR_HUB_FEATURE_NOT_SUPPORTED;
//------------- Open Interrupt Status Pipe -------------//
tusb_descriptor_endpoint_t const *p_endpoint;
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
tusb_desc_endpoint_t const *p_endpoint;
p_endpoint = (tusb_desc_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
STASK_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType);
STASK_ASSERT(TUSB_XFER_INTERRUPT == p_endpoint->bmAttributes.xfer);
@ -176,7 +176,7 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t cons
STASK_ASSERT( pipehandle_is_valid(hub_data[dev_addr-1].pipe_status) );
hub_data[dev_addr-1].interface_number = p_interface_desc->bInterfaceNumber;
(*p_length) = sizeof(tusb_descriptor_interface_t) + sizeof(tusb_descriptor_endpoint_t);
(*p_length) = sizeof(tusb_desc_interface_t) + sizeof(tusb_desc_endpoint_t);
//------------- Get Hub Descriptor -------------//
STASK_INVOKE(

View File

@ -195,7 +195,7 @@ tusb_error_t hub_status_pipe_queue(uint8_t dev_addr);
#ifdef _TINY_USB_SOURCE_FILE_
void hub_init(void);
tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
void hub_close(uint8_t dev_addr);

View File

@ -417,7 +417,7 @@ static void ed_list_remove(ohci_ed_t * p_head, ohci_ed_t * p_ed)
p_ed->used = 0; // free ED
}
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_desc_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
pipe_handle_t const null_handle = { .dev_addr = 0, .xfer_type = 0, .index = 0 };

View File

@ -121,7 +121,7 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) STATIC_VAR uint8_t enum_data_buffer[TUSB_CF
//------------- Helper Function Prototypes -------------//
static inline uint8_t get_new_address(void) ATTR_ALWAYS_INLINE;
static inline uint8_t get_configure_number_for_device(tusb_descriptor_device_t* dev_desc) ATTR_ALWAYS_INLINE;
static inline uint8_t get_configure_number_for_device(tusb_desc_device_t* dev_desc) ATTR_ALWAYS_INLINE;
//--------------------------------------------------------------------+
// PUBLIC API (Parameter Verification is required)
@ -500,7 +500,7 @@ tusb_error_t enumeration_body_subtask(void)
usbh_devices[0].state = TUSB_DEVICE_STATE_UNPLUG;
// open control pipe for new address
STASK_ASSERT_STATUS ( usbh_pipe_control_open(new_addr, ((tusb_descriptor_device_t*) enum_data_buffer)->bMaxPacketSize0 ) );
STASK_ASSERT_STATUS ( usbh_pipe_control_open(new_addr, ((tusb_desc_device_t*) enum_data_buffer)->bMaxPacketSize0 ) );
//------------- Get full device descriptor -------------//
STASK_INVOKE(
@ -512,11 +512,11 @@ tusb_error_t enumeration_body_subtask(void)
STASK_ASSERT_STATUS(error);
// update device info TODO alignment issue
usbh_devices[new_addr].vendor_id = ((tusb_descriptor_device_t*) enum_data_buffer)->idVendor;
usbh_devices[new_addr].product_id = ((tusb_descriptor_device_t*) enum_data_buffer)->idProduct;
usbh_devices[new_addr].configure_count = ((tusb_descriptor_device_t*) enum_data_buffer)->bNumConfigurations;
usbh_devices[new_addr].vendor_id = ((tusb_desc_device_t*) enum_data_buffer)->idVendor;
usbh_devices[new_addr].product_id = ((tusb_desc_device_t*) enum_data_buffer)->idProduct;
usbh_devices[new_addr].configure_count = ((tusb_desc_device_t*) enum_data_buffer)->bNumConfigurations;
configure_selected = get_configure_number_for_device((tusb_descriptor_device_t*) enum_data_buffer);
configure_selected = get_configure_number_for_device((tusb_desc_device_t*) enum_data_buffer);
STASK_ASSERT(configure_selected <= usbh_devices[new_addr].configure_count); // TODO notify application when invalid configuration
//------------- Get 9 bytes of configuration descriptor -------------//
@ -527,7 +527,7 @@ tusb_error_t enumeration_body_subtask(void)
error
);
STASK_ASSERT_STATUS(error);
STASK_ASSERT_HDLR( TUSB_CFG_HOST_ENUM_BUFFER_SIZE >= ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength,
STASK_ASSERT_HDLR( TUSB_CFG_HOST_ENUM_BUFFER_SIZE >= ((tusb_desc_configuration_t*)enum_data_buffer)->wTotalLength,
tuh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG, NULL) );
//------------- Get full configuration descriptor -------------//
@ -540,7 +540,7 @@ tusb_error_t enumeration_body_subtask(void)
STASK_ASSERT_STATUS(error);
// update configuration info
usbh_devices[new_addr].interface_count = ((tusb_descriptor_configuration_t*) enum_data_buffer)->bNumInterfaces;
usbh_devices[new_addr].interface_count = ((tusb_desc_configuration_t*) enum_data_buffer)->bNumInterfaces;
//------------- Set Configure -------------//
STASK_INVOKE(
@ -556,10 +556,10 @@ tusb_error_t enumeration_body_subtask(void)
//------------- TODO Get String Descriptors -------------//
//------------- parse configuration & install drivers -------------//
p_desc = enum_data_buffer + sizeof(tusb_descriptor_configuration_t);
p_desc = enum_data_buffer + sizeof(tusb_desc_configuration_t);
// parse each interfaces
while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength )
while( p_desc < enum_data_buffer + ((tusb_desc_configuration_t*)enum_data_buffer)->wTotalLength )
{
// skip until we see interface descriptor
if ( TUSB_DESC_INTERFACE != p_desc[DESCRIPTOR_OFFSET_TYPE] )
@ -569,7 +569,7 @@ tusb_error_t enumeration_body_subtask(void)
{
static uint8_t class_index; // has to be static as it is used to call class's open_subtask
class_index = std_class_code_to_index( ((tusb_descriptor_interface_t*) p_desc)->bInterfaceClass );
class_index = std_class_code_to_index( ((tusb_desc_interface_t*) p_desc)->bInterfaceClass );
STASK_ASSERT( class_index != 0 ); // class_index == 0 means corrupted data, abort enumeration
if (usbh_class_drivers[class_index].open_subtask &&
@ -579,13 +579,13 @@ tusb_error_t enumeration_body_subtask(void)
length = 0;
STASK_INVOKE ( // parameters in task/sub_task must be static storage (static or global)
usbh_class_drivers[class_index].open_subtask( new_addr, (tusb_descriptor_interface_t*) p_desc, &length ),
usbh_class_drivers[class_index].open_subtask( new_addr, (tusb_desc_interface_t*) p_desc, &length ),
error
);
if (error == TUSB_ERROR_NONE)
{
STASK_ASSERT( length >= sizeof(tusb_descriptor_interface_t) );
STASK_ASSERT( length >= sizeof(tusb_desc_interface_t) );
usbh_devices[new_addr].flag_supported_class |= BIT_(class_index);
p_desc += length;
}else // Interface open failed, for example a subclass is not supported
@ -626,7 +626,7 @@ static inline uint8_t get_new_address(void)
return addr;
}
static inline uint8_t get_configure_number_for_device(tusb_descriptor_device_t* dev_desc)
static inline uint8_t get_configure_number_for_device(tusb_desc_device_t* dev_desc)
{
uint8_t config_num = 1;

View File

@ -65,7 +65,7 @@ typedef enum tusb_interface_status_{
typedef struct {
void (* const init) (void);
tusb_error_t (* const open_subtask)(uint8_t, tusb_descriptor_interface_t const *, uint16_t*);
tusb_error_t (* const open_subtask)(uint8_t, tusb_desc_interface_t const *, uint16_t*);
void (* const isr) (pipe_handle_t, tusb_event_t, uint32_t);
void (* const close) (uint8_t);
} host_class_driver_t;
@ -88,9 +88,9 @@ uint32_t tuh_device_get_mounted_class_flag(uint8_t dev_addr);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK
//--------------------------------------------------------------------+
ATTR_WEAK uint8_t tuh_device_attached_cb (tusb_descriptor_device_t const *p_desc_device) ATTR_WARN_UNUSED_RESULT;
ATTR_WEAK uint8_t tuh_device_attached_cb (tusb_desc_device_t const *p_desc_device) ATTR_WARN_UNUSED_RESULT;
ATTR_WEAK void tuh_device_mount_succeed_cb (uint8_t dev_addr);
ATTR_WEAK void tuh_device_mount_failed_cb(tusb_error_t error, tusb_descriptor_device_t const *p_desc_device); // TODO refractor remove desc_device
ATTR_WEAK void tuh_device_mount_failed_cb(tusb_error_t error, tusb_desc_device_t const *p_desc_device); // TODO refractor remove desc_device
//--------------------------------------------------------------------+
// CLASS-USBH & INTERNAL API

View File

@ -458,7 +458,7 @@ void tusb_dcd_edpt_clear_stall(uint8_t rhport, uint8_t edpt_addr)
}
}
edpt_hdl_t tusb_dcd_edpt_open(uint8_t rhport, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
edpt_hdl_t tusb_dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) rhport;
edpt_hdl_t const null_handle = { 0 };

View File

@ -414,7 +414,7 @@ bool tusb_dcd_control_xfer(uint8_t rhport, tusb_dir_t dir, uint8_t * p_buffer, u
//--------------------------------------------------------------------+
// BULK/INTERRUPT/ISO PIPE API
//--------------------------------------------------------------------+
edpt_hdl_t tusb_dcd_edpt_open(uint8_t rhport, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
edpt_hdl_t tusb_dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) rhport;

View File

@ -88,7 +88,7 @@ static inline void tusb_dcd_control_complete(uint8_t rhport)
bool tusb_dcd_control_xfer (uint8_t rhport, tusb_dir_t dir, uint8_t * buffer, uint16_t length);
//------------- Other Endpoints -------------//
bool tusb_dcd_edpt_open (uint8_t rhport, tusb_descriptor_endpoint_t const * p_endpoint_desc);
bool tusb_dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc);
bool tusb_dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
bool tusb_dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr);