more shorten name

This commit is contained in:
hathach 2018-03-23 12:42:30 +07:00
parent 5f26c57b28
commit 3e5e1f70bf
15 changed files with 128 additions and 123 deletions

View File

@ -133,7 +133,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_acm = .cdc_acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { // 0x02 .bmCapabilities = { // 0x02

View File

@ -87,7 +87,7 @@ typedef struct ATTR_PACKED
tusb_desc_interface_t cdc_comm_interface; tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header; cdc_desc_func_header_t cdc_header;
cdc_desc_func_call_management_t cdc_call; cdc_desc_func_call_management_t cdc_call;
cdc_desc_func_abstract_control_management_t cdc_acm; cdc_desc_func_acm_t cdc_acm;
cdc_desc_func_union_t cdc_union; cdc_desc_func_union_t cdc_union;
tusb_desc_endpoint_t cdc_endpoint_notification; tusb_desc_endpoint_t cdc_endpoint_notification;

View File

@ -86,113 +86,116 @@ app_descriptor_configuration_t const desc_configuration =
}, },
// IAD points to CDC Interfaces // IAD points to CDC Interfaces
.cdc_iad = .cdc =
{ {
.bLength = sizeof(tusb_desc_interface_assoc_t), .iad =
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION, {
.bLength = sizeof(tusb_desc_interface_assoc_t),
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
.bFirstInterface = INTERFACE_NO_CDC, .bFirstInterface = INTERFACE_NO_CDC,
.bInterfaceCount = 2, .bInterfaceCount = 2,
.bFunctionClass = TUSB_CLASS_CDC, .bFunctionClass = TUSB_CLASS_CDC,
.bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, .bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
.bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, .bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
.iFunction = 0 .iFunction = 0
}, },
//------------- CDC Communication Interface -------------// //------------- CDC Communication Interface -------------//
.cdc_comm_interface = .comm_itf =
{ {
.bLength = sizeof(tusb_desc_interface_t), .bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC, .bInterfaceNumber = INTERFACE_NO_CDC,
.bAlternateSetting = 0, .bAlternateSetting = 0,
.bNumEndpoints = 1, .bNumEndpoints = 1,
.bInterfaceClass = TUSB_CLASS_CDC, .bInterfaceClass = TUSB_CLASS_CDC,
.bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
.bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
.iInterface = 0x00 .iInterface = 0x00
}, },
.cdc_header = .header =
{ {
.bLength = sizeof(cdc_desc_func_header_t), .bLength = sizeof(cdc_desc_func_header_t),
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_HEADER, .bDescriptorSubType = CDC_FUNC_DESC_HEADER,
.bcdCDC = 0x0120 .bcdCDC = 0x0120
}, },
.cdc_call = .call =
{ {
.bLength = sizeof(cdc_desc_func_call_management_t), .bLength = sizeof(cdc_desc_func_call_management_t),
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT,
.bmCapabilities = { 0 }, .bmCapabilities = { 0 },
.bDataInterface = INTERFACE_NO_CDC+1, .bDataInterface = INTERFACE_NO_CDC+1,
}, },
.cdc_acm = .acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { // 0x02 .bmCapabilities = { // 0x02
.support_line_request = 1, .support_line_request = 1,
} }
}, },
.cdc_union = .union_func =
{ {
.bLength = sizeof(cdc_desc_func_union_t), // plus number of .bLength = sizeof(cdc_desc_func_union_t), // plus number of
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_UNION, .bDescriptorSubType = CDC_FUNC_DESC_UNION,
.bControlInterface = INTERFACE_NO_CDC, .bControlInterface = INTERFACE_NO_CDC,
.bSubordinateInterface = INTERFACE_NO_CDC+1, .bSubordinateInterface = INTERFACE_NO_CDC+1,
}, },
.cdc_endpoint_notification = .ep_notif =
{ {
.bLength = sizeof(tusb_desc_endpoint_t), .bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR, .bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = { .size = 0x08 }, .wMaxPacketSize = { .size = 0x08 },
.bInterval = 0x10 .bInterval = 0x10
}, },
//------------- CDC Data Interface -------------// //------------- CDC Data Interface -------------//
.cdc_data_interface = .data_itf =
{ {
.bLength = sizeof(tusb_desc_interface_t), .bLength = sizeof(tusb_desc_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_INTERFACE,
.bInterfaceNumber = INTERFACE_NO_CDC+1, .bInterfaceNumber = INTERFACE_NO_CDC+1,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 2, .bNumEndpoints = 2,
.bInterfaceClass = TUSB_CLASS_CDC_DATA, .bInterfaceClass = TUSB_CLASS_CDC_DATA,
.bInterfaceSubClass = 0, .bInterfaceSubClass = 0,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.iInterface = 0x00 .iInterface = 0x00
}, },
.cdc_endpoint_out = .ep_out =
{ {
.bLength = sizeof(tusb_desc_endpoint_t), .bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR, .bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
.bInterval = 0 .bInterval = 0
}, },
.cdc_endpoint_in = .ep_in =
{ {
.bLength = sizeof(tusb_desc_endpoint_t), .bLength = sizeof(tusb_desc_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_ENDPOINT,
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR, .bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
.bInterval = 0 .bInterval = 0
}, },
}
}; };
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@ -78,23 +78,25 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
typedef struct ATTR_PACKED typedef struct ATTR_PACKED
{ {
tusb_desc_configuration_t configuration; tusb_desc_configuration_t configuration;
//------------- CDC -------------// struct ATTR_PACKED
tusb_desc_interface_assoc_t cdc_iad; {
tusb_desc_interface_assoc_t iad;
//CDC Control Interface //CDC Control Interface
tusb_desc_interface_t cdc_comm_interface; tusb_desc_interface_t comm_itf;
cdc_desc_func_header_t cdc_header; cdc_desc_func_header_t header;
cdc_desc_func_call_management_t cdc_call; cdc_desc_func_call_management_t call;
cdc_desc_func_abstract_control_management_t cdc_acm; cdc_desc_func_acm_t acm;
cdc_desc_func_union_t cdc_union; cdc_desc_func_union_t union_func;
tusb_desc_endpoint_t cdc_endpoint_notification; tusb_desc_endpoint_t ep_notif;
//CDC Data Interface //CDC Data Interface
tusb_desc_interface_t cdc_data_interface; tusb_desc_interface_t data_itf;
tusb_desc_endpoint_t cdc_endpoint_out; tusb_desc_endpoint_t ep_out;
tusb_desc_endpoint_t cdc_endpoint_in; tusb_desc_endpoint_t ep_in;
}cdc;
} app_descriptor_configuration_t; } app_descriptor_configuration_t;

View File

@ -233,7 +233,7 @@ app_descriptor_configuration_t const desc_configuration =
.cdc_acm = .cdc_acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { // 0x02 .bmCapabilities = { // 0x02

View File

@ -142,7 +142,7 @@ typedef struct ATTR_PACKED
tusb_desc_interface_t cdc_comm_interface; tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header; cdc_desc_func_header_t cdc_header;
cdc_desc_func_call_management_t cdc_call; cdc_desc_func_call_management_t cdc_call;
cdc_desc_func_abstract_control_management_t cdc_acm; cdc_desc_func_acm_t cdc_acm;
cdc_desc_func_union_t cdc_union; cdc_desc_func_union_t cdc_union;
tusb_desc_endpoint_t cdc_endpoint_notification; tusb_desc_endpoint_t cdc_endpoint_notification;

View File

@ -101,7 +101,7 @@ const cdc_configuration_desc_t cdc_config_descriptor =
.cdc_acm = .cdc_acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { // 0x06 .bmCapabilities = { // 0x06
@ -227,7 +227,7 @@ const cdc_configuration_desc_t rndis_config_descriptor =
.cdc_acm = .cdc_acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { 0 } .bmCapabilities = { 0 }

View File

@ -62,7 +62,7 @@ typedef struct
//CDC Control Interface //CDC Control Interface
tusb_desc_interface_t cdc_comm_interface; tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header; cdc_desc_func_header_t cdc_header;
cdc_desc_func_abstract_control_management_t cdc_acm; cdc_desc_func_acm_t cdc_acm;
cdc_desc_func_union_t cdc_union; cdc_desc_func_union_t cdc_union;
tusb_desc_endpoint_t cdc_endpoint_notification; tusb_desc_endpoint_t cdc_endpoint_notification;

View File

@ -125,7 +125,7 @@ void test_cdch_open_length_check(void)
const uint16_t expected_length = const uint16_t expected_length =
//------------- Comm Interface -------------// //------------- Comm Interface -------------//
sizeof(tusb_desc_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(cdc_desc_func_acm_t) + sizeof(cdc_desc_func_union_t) +
sizeof(tusb_desc_endpoint_t) + sizeof(tusb_desc_endpoint_t) +
//------------- Data Interface -------------// //------------- Data Interface -------------//
sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t); sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);

View File

@ -203,7 +203,7 @@ tusb_error_t stub_cdch_open(uint8_t dev_addr, tusb_desc_interface_t const *descr
*p_length = *p_length =
//------------- Comm Interface -------------// //------------- Comm Interface -------------//
sizeof(tusb_desc_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(cdc_desc_func_acm_t) + sizeof(cdc_desc_func_union_t) +
sizeof(tusb_desc_endpoint_t) + sizeof(tusb_desc_endpoint_t) +
//------------- Data Interface -------------// //------------- Data Interface -------------//
sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t); sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);

View File

@ -287,7 +287,7 @@ const app_configuration_desc_t desc_configuration =
.cdc_acm = .cdc_acm =
{ {
.bLength = sizeof(cdc_desc_func_abstract_control_management_t), .bLength = sizeof(cdc_desc_func_acm_t),
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
.bmCapabilities = { // 0x06 .bmCapabilities = { // 0x06

View File

@ -103,7 +103,7 @@ typedef struct
//CDC Control Interface //CDC Control Interface
tusb_desc_interface_t cdc_comm_interface; tusb_desc_interface_t cdc_comm_interface;
cdc_desc_func_header_t cdc_header; cdc_desc_func_header_t cdc_header;
cdc_desc_func_abstract_control_management_t cdc_acm; cdc_desc_func_acm_t cdc_acm;
cdc_desc_func_union_t cdc_union; cdc_desc_func_union_t cdc_union;
tusb_desc_endpoint_t cdc_endpoint_notification; tusb_desc_endpoint_t cdc_endpoint_notification;

View File

@ -310,7 +310,7 @@ typedef struct ATTR_PACKED
uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific
uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_ uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_
cdc_acm_capability_t bmCapabilities ; cdc_acm_capability_t bmCapabilities ;
}cdc_desc_func_abstract_control_management_t; }cdc_desc_func_acm_t;
/// \brief Direct Line Management Functional Descriptor /// \brief Direct Line Management Functional Descriptor
/// \details This functional descriptor describes the commands supported by the Communications Class interface with SubClass code of \ref CDC_FUNC_DESC_DIRECT_LINE_MANAGEMENT /// \details This functional descriptor describes the commands supported by the Communications Class interface with SubClass code of \ref CDC_FUNC_DESC_DIRECT_LINE_MANAGEMENT

View File

@ -150,7 +150,7 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface
{ // Communication Functional Descriptors { // Communication Functional Descriptors
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) ) if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{ // save ACM bmCapabilities { // save ACM bmCapabilities
p_cdc->acm_capability = ((cdc_desc_func_abstract_control_management_t const *) p_desc)->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[DESCRIPTOR_OFFSET_LENGTH];

View File

@ -171,7 +171,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_
{ // Communication Functional Descriptors { // Communication Functional Descriptors
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) ) if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{ // save ACM bmCapabilities { // save ACM bmCapabilities
p_cdc->acm_capability = ((cdc_desc_func_abstract_control_management_t const *) p_desc)->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[DESCRIPTOR_OFFSET_LENGTH];