summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-11 21:16:51 +0700
committerhathach <[email protected]>2018-03-11 21:16:51 +0700
commit229a7a23b82d90e34c6fd5b52ef739d3f9668dcb (patch)
tree94d90397f6acf28ccbfdc58fb141122763ec8acb /tinyusb
parentd71334c34822c1e7b5b4ecfdcc44c8c3c3843d61 (diff)
shorten TUSB_DESC_TYPE*
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/class/cdc/cdc_device.c8
-rw-r--r--tinyusb/class/cdc/cdc_host.c8
-rw-r--r--tinyusb/class/custom_class_host.c2
-rw-r--r--tinyusb/class/hid/hid_device.c2
-rw-r--r--tinyusb/class/hid/hid_host.c2
-rw-r--r--tinyusb/class/msc/msc_device.c2
-rw-r--r--tinyusb/class/msc/msc_host.c2
-rw-r--r--tinyusb/common/tusb_types.h24
-rw-r--r--tinyusb/device/usbd.c10
-rw-r--r--tinyusb/host/hub.c2
-rw-r--r--tinyusb/host/usbh.c10
11 files changed, 36 insertions, 36 deletions
diff --git a/tinyusb/class/cdc/cdc_device.c b/tinyusb/class/cdc/cdc_device.c
index 46635f968..e604f149e 100644
--- a/tinyusb/class/cdc/cdc_device.c
+++ b/tinyusb/class/cdc/cdc_device.c
@@ -142,7 +142,7 @@ tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
//------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_descriptor_interface_t);
- while( TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
+ while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
{ // Communication Functional Descriptors
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{ // save ACM bmCapabilities
@@ -153,7 +153,7 @@ tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
p_desc = descriptor_next(p_desc);
}
- if ( TUSB_DESC_TYPE_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
+ if ( TUSB_DESC_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
{ // notification endpoint if any
TU_ASSERT( tusb_dcd_edpt_open(port, (tusb_descriptor_endpoint_t const *) p_desc), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
@@ -164,7 +164,7 @@ tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
}
//------------- Data Interface (if any) -------------//
- if ( (TUSB_DESC_TYPE_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
+ if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_descriptor_interface_t const *) p_desc)->bInterfaceClass) )
{
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
@@ -174,7 +174,7 @@ tusb_error_t cdcd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
- TU_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
+ 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);
TU_ASSERT( tusb_dcd_edpt_open(port, p_endpoint), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
diff --git a/tinyusb/class/cdc/cdc_host.c b/tinyusb/class/cdc/cdc_host.c
index c4aac4f5e..fc1f8fba0 100644
--- a/tinyusb/class/cdc/cdc_host.c
+++ b/tinyusb/class/cdc/cdc_host.c
@@ -167,7 +167,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
//------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_descriptor_interface_t);
- while( TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
+ while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
{ // Communication Functional Descriptors
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{ // save ACM bmCapabilities
@@ -178,7 +178,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
p_desc = descriptor_next(p_desc);
}
- if ( TUSB_DESC_TYPE_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
+ 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);
@@ -189,7 +189,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
}
//------------- Data Interface (if any) -------------//
- if ( (TUSB_DESC_TYPE_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
+ if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_descriptor_interface_t const *) p_desc)->bInterfaceClass) )
{
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
@@ -199,7 +199,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
- ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);
+ 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);
pipe_handle_t * p_pipe_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_IN_MASK ) ?
diff --git a/tinyusb/class/custom_class_host.c b/tinyusb/class/custom_class_host.c
index ce9c5d019..be660d9db 100644
--- a/tinyusb/class/custom_class_host.c
+++ b/tinyusb/class/custom_class_host.c
@@ -117,7 +117,7 @@ tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
for(uint32_t i=0; i<2; i++)
{
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
- ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_INVALID_PARA);
+ 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 ) ?
&custom_interface[dev_addr-1].pipe_in : &custom_interface[dev_addr-1].pipe_out;
diff --git a/tinyusb/class/hid/hid_device.c b/tinyusb/class/hid/hid_device.c
index 5d0e136fe..2c8e7f8f7 100644
--- a/tinyusb/class/hid/hid_device.c
+++ b/tinyusb/class/hid/hid_device.c
@@ -266,7 +266,7 @@ tusb_error_t hidd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
//------------- Endpoint Descriptor -------------//
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
tusb_descriptor_endpoint_t const *p_desc_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
- ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_desc_endpoint->bDescriptorType, TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE);
+ ASSERT_INT(TUSB_DESC_ENDPOINT, p_desc_endpoint->bDescriptorType, TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE);
if (p_interface_desc->bInterfaceSubClass == HID_SUBCLASS_BOOT)
{
diff --git a/tinyusb/class/hid/hid_host.c b/tinyusb/class/hid/hid_host.c
index c7548f54f..a86dfa372 100644
--- a/tinyusb/class/hid/hid_host.c
+++ b/tinyusb/class/hid/hid_host.c
@@ -193,7 +193,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;
- ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint_desc->bDescriptorType, TUSB_ERROR_INVALID_PARA);
+ ASSERT_INT(TUSB_DESC_ENDPOINT, p_endpoint_desc->bDescriptorType, TUSB_ERROR_INVALID_PARA);
OSAL_SUBTASK_BEGIN
diff --git a/tinyusb/class/msc/msc_device.c b/tinyusb/class/msc/msc_device.c
index 700fc74c9..cec568264 100644
--- a/tinyusb/class/msc/msc_device.c
+++ b/tinyusb/class/msc/msc_device.c
@@ -95,7 +95,7 @@ tusb_error_t mscd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
for(uint32_t i=0; i<2; i++)
{
- TU_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType &&
+ TU_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType &&
TUSB_XFER_BULK == p_endpoint->bmAttributes.xfer, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
TU_ASSERT( tusb_dcd_edpt_open(port, p_endpoint), TUSB_ERROR_DCD_FAILED );
diff --git a/tinyusb/class/msc/msc_host.c b/tinyusb/class/msc/msc_host.c
index aceb21192..b1e8e84ca 100644
--- a/tinyusb/class/msc/msc_host.c
+++ b/tinyusb/class/msc/msc_host.c
@@ -310,7 +310,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
for(uint32_t i=0; i<2; i++)
{
- SUBTASK_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType);
+ SUBTASK_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType);
SUBTASK_ASSERT(TUSB_XFER_BULK == p_endpoint->bmAttributes.xfer);
pipe_handle_t * p_pipe_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_IN_MASK ) ?
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h
index 56fdb56d4..876c0d9e3 100644
--- a/tinyusb/common/tusb_types.h
+++ b/tinyusb/common/tusb_types.h
@@ -76,18 +76,18 @@ typedef enum
/// USB Descriptor Types (section 9.4 table 9-5)
typedef enum
{
- TUSB_DESC_TYPE_DEVICE = 0x01 ,
- TUSB_DESC_TYPE_CONFIGURATION = 0x02 ,
- TUSB_DESC_TYPE_STRING = 0x03 ,
- TUSB_DESC_TYPE_INTERFACE = 0x04 ,
- TUSB_DESC_TYPE_ENDPOINT = 0x05 ,
- TUSB_DESC_TYPE_DEVICE_QUALIFIER = 0x06 ,
- TUSB_DESC_TYPE_OTHER_SPEED_CONFIGURATION = 0x07 ,
- TUSB_DESC_TYPE_INTERFACE_POWER = 0x08 ,
- TUSB_DESC_TYPE_OTG = 0x09 ,
- TUSB_DESC_TYPE_DEBUG = 0x0A ,
- TUSB_DESC_TYPE_INTERFACE_ASSOCIATION = 0x0B ,
- TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC = 0x24
+ TUSB_DESC_DEVICE = 0x01 ,
+ TUSB_DESC_CONFIGURATION = 0x02 ,
+ TUSB_DESC_STRING = 0x03 ,
+ TUSB_DESC_INTERFACE = 0x04 ,
+ TUSB_DESC_ENDPOINT = 0x05 ,
+ TUSB_DESC_DEVICE_QUALIFIER = 0x06 ,
+ TUSB_DESC_OTHER_SPEED_CONFIG = 0x07 ,
+ TUSB_DESC_INTERFACE_POWER = 0x08 ,
+ TUSB_DESC_OTG = 0x09 ,
+ TUSB_DESC_DEBUG = 0x0A ,
+ TUSB_DESC_INTERFACE_ASSOCIATION = 0x0B ,
+ TUSB_DESC_CLASS_SPECIFIC = 0x24
}tusb_std_descriptor_type_t;
typedef enum
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 53a527fda..cb5e651fd 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -368,12 +368,12 @@ static tusb_error_t usbd_set_configure_received(uint8_t port, uint8_t config_num
while( p_desc < p_desc_config + config_total_length )
{
- if ( TUSB_DESC_TYPE_INTERFACE_ASSOCIATION == p_desc[DESCRIPTOR_OFFSET_TYPE])
+ if ( TUSB_DESC_INTERFACE_ASSOCIATION == p_desc[DESCRIPTOR_OFFSET_TYPE])
{
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; // ignore Interface Association
}else
{
- ASSERT( TUSB_DESC_TYPE_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE], TUSB_ERROR_NOT_SUPPORTED_YET );
+ 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;
@@ -408,17 +408,17 @@ static tusb_error_t get_descriptor(uint8_t port, tusb_control_request_t const *
switch(desc_type)
{
- case TUSB_DESC_TYPE_DEVICE:
+ case TUSB_DESC_DEVICE:
p_data = tusbd_descriptor_pointers.p_device;
(*p_length) = sizeof(tusb_descriptor_device_t);
break;
- case TUSB_DESC_TYPE_CONFIGURATION:
+ case TUSB_DESC_CONFIGURATION:
p_data = tusbd_descriptor_pointers.p_configuration;
(*p_length) = ((tusb_descriptor_configuration_t*)tusbd_descriptor_pointers.p_configuration)->wTotalLength;
break;
- case TUSB_DESC_TYPE_STRING:
+ case TUSB_DESC_STRING:
if ( !(desc_index < 100) ) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT; // windows sometimes ask for string at index 238 !!!
p_data = tusbd_descriptor_pointers.p_string_arr[desc_index];
diff --git a/tinyusb/host/hub.c b/tinyusb/host/hub.c
index 447867290..a5ae7ca57 100644
--- a/tinyusb/host/hub.c
+++ b/tinyusb/host/hub.c
@@ -169,7 +169,7 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t cons
tusb_descriptor_endpoint_t const *p_endpoint;
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
- SUBTASK_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType);
+ SUBTASK_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint->bDescriptorType);
SUBTASK_ASSERT(TUSB_XFER_INTERRUPT == p_endpoint->bmAttributes.xfer);
hub_data[dev_addr-1].pipe_status = hcd_pipe_open(dev_addr, p_endpoint, TUSB_CLASS_HUB);
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index b8f030cbc..3650610da 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -450,7 +450,7 @@ tusb_error_t enumeration_body_subtask(void)
//------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------//
OSAL_SUBTASK_INVOKED_AND_WAIT(
usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_TYPE_DEVICE << 8), 0,
+ TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0,
8, enum_data_buffer ),
error
);
@@ -505,7 +505,7 @@ tusb_error_t enumeration_body_subtask(void)
//------------- Get full device descriptor -------------//
OSAL_SUBTASK_INVOKED_AND_WAIT(
usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_TYPE_DEVICE << 8), 0,
+ TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0,
18, enum_data_buffer ),
error
);
@@ -522,7 +522,7 @@ tusb_error_t enumeration_body_subtask(void)
//------------- Get 9 bytes of configuration descriptor -------------//
OSAL_SUBTASK_INVOKED_AND_WAIT(
usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_TYPE_CONFIGURATION << 8) | (configure_selected - 1), 0,
+ TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
9, enum_data_buffer ),
error
);
@@ -533,7 +533,7 @@ tusb_error_t enumeration_body_subtask(void)
//------------- Get full configuration descriptor -------------//
OSAL_SUBTASK_INVOKED_AND_WAIT(
usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_TYPE_CONFIGURATION << 8) | (configure_selected - 1), 0,
+ TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
TUSB_CFG_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ),
error
);
@@ -562,7 +562,7 @@ tusb_error_t enumeration_body_subtask(void)
while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength )
{
// skip until we see interface descriptor
- if ( TUSB_DESC_TYPE_INTERFACE != p_desc[DESCRIPTOR_OFFSET_TYPE] )
+ if ( TUSB_DESC_INTERFACE != p_desc[DESCRIPTOR_OFFSET_TYPE] )
{
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; // skip the descriptor, increase by the descriptor's length
}else