diff options
| author | hathach <[email protected]> | 2018-07-13 17:48:26 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-07-13 17:48:26 +0700 |
| commit | 1efb552bfd097a23651bbb5ad29b6d8eb3bc9ccd (patch) | |
| tree | 2d6301a8058d3a631dde379515b3185992ab1422 /src/class | |
| parent | cd5b5d3a53adb465ac614b6027e16c8ec987b09e (diff) | |
add ep2drv, rename descriptor offset
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/cdc/cdc_device.c | 12 | ||||
| -rw-r--r-- | src/class/cdc/cdc_host.c | 14 | ||||
| -rw-r--r-- | src/class/hid/hid_device.c | 4 | ||||
| -rw-r--r-- | src/class/hid/hid_host.c | 4 |
4 files changed, 17 insertions, 17 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 643706269..76526d40b 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -192,31 +192,31 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface (*p_length) = sizeof(tusb_desc_interface_t);
// Communication Functional Descriptors
- while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
+ while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESC_OFFSET_TYPE] )
{
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
}
- if ( TUSB_DESC_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
+ if ( TUSB_DESC_ENDPOINT == p_desc[DESC_OFFSET_TYPE])
{ // notification endpoint if any
TU_ASSERT( dcd_edpt_open(rhport, (tusb_desc_endpoint_t const *) p_desc), TUSB_ERROR_DCD_OPEN_PIPE_FAILED);
p_cdc->ep_notif = ((tusb_desc_endpoint_t const *) p_desc)->bEndpointAddress;
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
}
//------------- Data Interface (if any) -------------//
- if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
+ if ( (TUSB_DESC_INTERFACE == p_desc[DESC_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
{
// p_cdc->itf_num =
p_cdc->ep_count += ((tusb_desc_interface_t const *) p_desc)->bNumEndpoints;
// next to endpoint descritpor
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
// Open endpoint pair with usbd helper
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index bd5b5e32c..6950759d1 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -167,32 +167,32 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ //------------- Communication Interface -------------//
(*p_length) = sizeof(tusb_desc_interface_t);
- while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
+ while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESC_OFFSET_TYPE] )
{ // Communication Functional Descriptors
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{ // save ACM bmCapabilities
p_cdc->acm_capability = ((cdc_desc_func_acm_t const *) p_desc)->bmCapabilities;
}
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
}
- if ( TUSB_DESC_ENDPOINT == p_desc[DESCRIPTOR_OFFSET_TYPE])
+ if ( TUSB_DESC_ENDPOINT == p_desc[DESC_OFFSET_TYPE])
{ // notification endpoint if any
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_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
TU_ASSERT(pipehandle_is_valid(p_cdc->pipe_notification), TUSB_ERROR_HCD_OPEN_PIPE_FAILED);
}
//------------- Data Interface (if any) -------------//
- if ( (TUSB_DESC_INTERFACE == p_desc[DESCRIPTOR_OFFSET_TYPE]) &&
+ if ( (TUSB_DESC_INTERFACE == p_desc[DESC_OFFSET_TYPE]) &&
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
{
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next(p_desc);
// data endpoints expected to be in pairs
@@ -208,7 +208,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ (*p_pipe_hdl) = hcd_pipe_open(dev_addr, p_endpoint, TUSB_CLASS_CDC);
TU_ASSERT ( pipehandle_is_valid(*p_pipe_hdl), TUSB_ERROR_HCD_OPEN_PIPE_FAILED );
- (*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ (*p_length) += p_desc[DESC_OFFSET_LEN];
p_desc = descriptor_next( p_desc );
}
}
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index bc2ee8c64..9f22697a6 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -259,12 +259,12 @@ tusb_error_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
//------------- HID descriptor -------------//
- p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ p_desc += p_desc[DESC_OFFSET_LEN];
tusb_hid_descriptor_hid_t const *p_desc_hid = (tusb_hid_descriptor_hid_t const *) p_desc;
TU_ASSERT(HID_DESC_TYPE_HID == p_desc_hid->bDescriptorType, TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE);
//------------- Endpoint Descriptor -------------//
- p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ p_desc += p_desc[DESC_OFFSET_LEN];
tusb_desc_endpoint_t const *p_desc_endpoint = (tusb_desc_endpoint_t const *) p_desc;
TU_ASSERT(TUSB_DESC_ENDPOINT == p_desc_endpoint->bDescriptorType, TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE);
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 69f86ee0b..fe0b7748b 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -186,12 +186,12 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ uint8_t const *p_desc = (uint8_t const *) p_interface_desc;
//------------- HID descriptor -------------//
- p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ p_desc += p_desc[DESC_OFFSET_LEN];
tusb_hid_descriptor_hid_t const *p_desc_hid = (tusb_hid_descriptor_hid_t const *) p_desc;
TU_ASSERT(HID_DESC_TYPE_HID == p_desc_hid->bDescriptorType, TUSB_ERROR_INVALID_PARA);
//------------- Endpoint Descriptor -------------//
- p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
+ p_desc += p_desc[DESC_OFFSET_LEN];
tusb_desc_endpoint_t const * p_endpoint_desc = (tusb_desc_endpoint_t const *) p_desc;
TU_ASSERT(TUSB_DESC_ENDPOINT == p_endpoint_desc->bDescriptorType, TUSB_ERROR_INVALID_PARA);
|
