mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
rename to drv_len to be consistent
This commit is contained in:
parent
10cd3f24bf
commit
fb214f7cf7
@ -247,13 +247,13 @@ uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
|||||||
//------------- Control Interface -------------//
|
//------------- Control Interface -------------//
|
||||||
p_cdc->itf_num = itf_desc->bInterfaceNumber;
|
p_cdc->itf_num = itf_desc->bInterfaceNumber;
|
||||||
|
|
||||||
uint16_t len = sizeof(tusb_desc_interface_t);
|
uint16_t drv_len = sizeof(tusb_desc_interface_t);
|
||||||
uint8_t const * p_desc = tu_desc_next( itf_desc );
|
uint8_t const * p_desc = tu_desc_next( itf_desc );
|
||||||
|
|
||||||
// Communication Functional Descriptors
|
// Communication Functional Descriptors
|
||||||
while ( TUSB_DESC_CS_INTERFACE == tu_desc_type(p_desc) && len <= max_len )
|
while ( TUSB_DESC_CS_INTERFACE == tu_desc_type(p_desc) && drv_len <= max_len )
|
||||||
{
|
{
|
||||||
len += tu_desc_len(p_desc);
|
drv_len += tu_desc_len(p_desc);
|
||||||
p_desc = tu_desc_next(p_desc);
|
p_desc = tu_desc_next(p_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
|||||||
|
|
||||||
p_cdc->ep_notif = ((tusb_desc_endpoint_t const *) p_desc)->bEndpointAddress;
|
p_cdc->ep_notif = ((tusb_desc_endpoint_t const *) p_desc)->bEndpointAddress;
|
||||||
|
|
||||||
len += tu_desc_len(p_desc);
|
drv_len += tu_desc_len(p_desc);
|
||||||
p_desc = tu_desc_next(p_desc);
|
p_desc = tu_desc_next(p_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,19 +273,19 @@ uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
|||||||
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
|
(TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) )
|
||||||
{
|
{
|
||||||
// next to endpoint descriptor
|
// next to endpoint descriptor
|
||||||
len += tu_desc_len(p_desc);
|
drv_len += tu_desc_len(p_desc);
|
||||||
p_desc = tu_desc_next(p_desc);
|
p_desc = tu_desc_next(p_desc);
|
||||||
|
|
||||||
// Open endpoint pair
|
// Open endpoint pair
|
||||||
TU_ASSERT( usbd_open_edpt_pair(rhport, p_desc, 2, TUSB_XFER_BULK, &p_cdc->ep_out, &p_cdc->ep_in), 0 );
|
TU_ASSERT( usbd_open_edpt_pair(rhport, p_desc, 2, TUSB_XFER_BULK, &p_cdc->ep_out, &p_cdc->ep_in), 0 );
|
||||||
|
|
||||||
len += 2*sizeof(tusb_desc_endpoint_t);
|
drv_len += 2*sizeof(tusb_desc_endpoint_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for incoming data
|
// Prepare for incoming data
|
||||||
_prep_out_transaction(cdc_id);
|
_prep_out_transaction(cdc_id);
|
||||||
|
|
||||||
return len;
|
return drv_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked when class request DATA stage is finished.
|
// Invoked when class request DATA stage is finished.
|
||||||
|
@ -66,15 +66,15 @@ uint16_t dfu_rtd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, ui
|
|||||||
itf_desc->bInterfaceProtocol == DFU_PROTOCOL_RT, 0);
|
itf_desc->bInterfaceProtocol == DFU_PROTOCOL_RT, 0);
|
||||||
|
|
||||||
uint8_t const * p_desc = tu_desc_next( itf_desc );
|
uint8_t const * p_desc = tu_desc_next( itf_desc );
|
||||||
uint16_t len = sizeof(tusb_desc_interface_t);
|
uint16_t drv_len = sizeof(tusb_desc_interface_t);
|
||||||
|
|
||||||
if ( TUSB_DESC_FUNCTIONAL == tu_desc_type(p_desc) )
|
if ( TUSB_DESC_FUNCTIONAL == tu_desc_type(p_desc) )
|
||||||
{
|
{
|
||||||
len += tu_desc_len(p_desc);
|
drv_len += tu_desc_len(p_desc);
|
||||||
p_desc = tu_desc_next(p_desc);
|
p_desc = tu_desc_next(p_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return drv_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dfu_rtd_control_complete(uint8_t rhport, tusb_control_request_t const * request)
|
bool dfu_rtd_control_complete(uint8_t rhport, tusb_control_request_t const * request)
|
||||||
|
@ -162,10 +162,10 @@ uint16_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
|||||||
MSC_PROTOCOL_BOT == itf_desc->bInterfaceProtocol, 0);
|
MSC_PROTOCOL_BOT == itf_desc->bInterfaceProtocol, 0);
|
||||||
|
|
||||||
// msc driver length is fixed
|
// msc driver length is fixed
|
||||||
enum { _MSC_DRIVER_LEN = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t) };
|
uint16_t const drv_len = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
|
||||||
|
|
||||||
// Max length mus be at least 1 interface + 2 endpoints
|
// Max length mus be at least 1 interface + 2 endpoints
|
||||||
TU_ASSERT(max_len >= _MSC_DRIVER_LEN, 0);
|
TU_ASSERT(max_len >= drv_len, 0);
|
||||||
|
|
||||||
mscd_interface_t * p_msc = &_mscd_itf;
|
mscd_interface_t * p_msc = &_mscd_itf;
|
||||||
p_msc->itf_num = itf_desc->bInterfaceNumber;
|
p_msc->itf_num = itf_desc->bInterfaceNumber;
|
||||||
@ -180,7 +180,7 @@ uint16_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
|||||||
TU_BREAKPOINT();
|
TU_BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _MSC_DRIVER_LEN;
|
return drv_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle class control request
|
// Handle class control request
|
||||||
|
Loading…
x
Reference in New Issue
Block a user