diff --git a/examples/device/device_virtual_com/src/tusb_descriptors.c b/examples/device/device_virtual_com/src/tusb_descriptors.c index 253bed21d..5f502fc6a 100644 --- a/examples/device/device_virtual_com/src/tusb_descriptors.c +++ b/examples/device/device_virtual_com/src/tusb_descriptors.c @@ -133,7 +133,7 @@ app_descriptor_configuration_t const desc_configuration = .cdc_acm = { - .bLength = sizeof(cdc_desc_func_abstract_control_management_t), + .bLength = sizeof(cdc_desc_func_acm_t), .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bmCapabilities = { // 0x02 diff --git a/examples/device/device_virtual_com/src/tusb_descriptors.h b/examples/device/device_virtual_com/src/tusb_descriptors.h index ae6872900..db7b00051 100644 --- a/examples/device/device_virtual_com/src/tusb_descriptors.h +++ b/examples/device/device_virtual_com/src/tusb_descriptors.h @@ -87,7 +87,7 @@ typedef struct ATTR_PACKED 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_acm_t cdc_acm; cdc_desc_func_union_t cdc_union; tusb_desc_endpoint_t cdc_endpoint_notification; diff --git a/examples/device/nrf52840/src/tusb_descriptors.c b/examples/device/nrf52840/src/tusb_descriptors.c index 253bed21d..5e1e421f1 100644 --- a/examples/device/nrf52840/src/tusb_descriptors.c +++ b/examples/device/nrf52840/src/tusb_descriptors.c @@ -86,113 +86,116 @@ app_descriptor_configuration_t const desc_configuration = }, // IAD points to CDC Interfaces - .cdc_iad = + .cdc = { - .bLength = sizeof(tusb_desc_interface_assoc_t), - .bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION, + .iad = + { + .bLength = sizeof(tusb_desc_interface_assoc_t), + .bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION, - .bFirstInterface = INTERFACE_NO_CDC, - .bInterfaceCount = 2, + .bFirstInterface = INTERFACE_NO_CDC, + .bInterfaceCount = 2, - .bFunctionClass = TUSB_CLASS_CDC, - .bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, - .bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, - .iFunction = 0 - }, + .bFunctionClass = TUSB_CLASS_CDC, + .bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, + .bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, + .iFunction = 0 + }, - //------------- CDC Communication Interface -------------// - .cdc_comm_interface = - { - .bLength = sizeof(tusb_desc_interface_t), - .bDescriptorType = TUSB_DESC_INTERFACE, - .bInterfaceNumber = INTERFACE_NO_CDC, - .bAlternateSetting = 0, - .bNumEndpoints = 1, - .bInterfaceClass = TUSB_CLASS_CDC, - .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, - .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, - .iInterface = 0x00 - }, + //------------- CDC Communication Interface -------------// + .comm_itf = + { + .bLength = sizeof(tusb_desc_interface_t), + .bDescriptorType = TUSB_DESC_INTERFACE, + .bInterfaceNumber = INTERFACE_NO_CDC, + .bAlternateSetting = 0, + .bNumEndpoints = 1, + .bInterfaceClass = TUSB_CLASS_CDC, + .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, + .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND, + .iInterface = 0x00 + }, - .cdc_header = - { - .bLength = sizeof(cdc_desc_func_header_t), - .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, - .bDescriptorSubType = CDC_FUNC_DESC_HEADER, - .bcdCDC = 0x0120 - }, + .header = + { + .bLength = sizeof(cdc_desc_func_header_t), + .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, + .bDescriptorSubType = CDC_FUNC_DESC_HEADER, + .bcdCDC = 0x0120 + }, - .cdc_call = - { - .bLength = sizeof(cdc_desc_func_call_management_t), - .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, - .bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT, - .bmCapabilities = { 0 }, - .bDataInterface = INTERFACE_NO_CDC+1, - }, + .call = + { + .bLength = sizeof(cdc_desc_func_call_management_t), + .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, + .bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT, + .bmCapabilities = { 0 }, + .bDataInterface = INTERFACE_NO_CDC+1, + }, - .cdc_acm = - { - .bLength = sizeof(cdc_desc_func_abstract_control_management_t), - .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, - .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, - .bmCapabilities = { // 0x02 - .support_line_request = 1, - } - }, + .acm = + { + .bLength = sizeof(cdc_desc_func_acm_t), + .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, + .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, + .bmCapabilities = { // 0x02 + .support_line_request = 1, + } + }, - .cdc_union = - { - .bLength = sizeof(cdc_desc_func_union_t), // plus number of - .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, - .bDescriptorSubType = CDC_FUNC_DESC_UNION, - .bControlInterface = INTERFACE_NO_CDC, - .bSubordinateInterface = INTERFACE_NO_CDC+1, - }, + .union_func = + { + .bLength = sizeof(cdc_desc_func_union_t), // plus number of + .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, + .bDescriptorSubType = CDC_FUNC_DESC_UNION, + .bControlInterface = INTERFACE_NO_CDC, + .bSubordinateInterface = INTERFACE_NO_CDC+1, + }, - .cdc_endpoint_notification = - { - .bLength = sizeof(tusb_desc_endpoint_t), - .bDescriptorType = TUSB_DESC_ENDPOINT, - .bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR, - .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, - .wMaxPacketSize = { .size = 0x08 }, - .bInterval = 0x10 - }, + .ep_notif = + { + .bLength = sizeof(tusb_desc_endpoint_t), + .bDescriptorType = TUSB_DESC_ENDPOINT, + .bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR, + .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, + .wMaxPacketSize = { .size = 0x08 }, + .bInterval = 0x10 + }, - //------------- CDC Data Interface -------------// - .cdc_data_interface = - { - .bLength = sizeof(tusb_desc_interface_t), - .bDescriptorType = TUSB_DESC_INTERFACE, - .bInterfaceNumber = INTERFACE_NO_CDC+1, - .bAlternateSetting = 0x00, - .bNumEndpoints = 2, - .bInterfaceClass = TUSB_CLASS_CDC_DATA, - .bInterfaceSubClass = 0, - .bInterfaceProtocol = 0, - .iInterface = 0x00 - }, + //------------- CDC Data Interface -------------// + .data_itf = + { + .bLength = sizeof(tusb_desc_interface_t), + .bDescriptorType = TUSB_DESC_INTERFACE, + .bInterfaceNumber = INTERFACE_NO_CDC+1, + .bAlternateSetting = 0x00, + .bNumEndpoints = 2, + .bInterfaceClass = TUSB_CLASS_CDC_DATA, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, + .iInterface = 0x00 + }, - .cdc_endpoint_out = - { - .bLength = sizeof(tusb_desc_endpoint_t), - .bDescriptorType = TUSB_DESC_ENDPOINT, - .bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR, - .bmAttributes = { .xfer = TUSB_XFER_BULK }, - .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, - .bInterval = 0 - }, + .ep_out = + { + .bLength = sizeof(tusb_desc_endpoint_t), + .bDescriptorType = TUSB_DESC_ENDPOINT, + .bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR, + .bmAttributes = { .xfer = TUSB_XFER_BULK }, + .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, + .bInterval = 0 + }, - .cdc_endpoint_in = - { - .bLength = sizeof(tusb_desc_endpoint_t), - .bDescriptorType = TUSB_DESC_ENDPOINT, - .bEndpointAddress = CDC_EDPT_DATA_IN_ADDR, - .bmAttributes = { .xfer = TUSB_XFER_BULK }, - .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, - .bInterval = 0 - }, + .ep_in = + { + .bLength = sizeof(tusb_desc_endpoint_t), + .bDescriptorType = TUSB_DESC_ENDPOINT, + .bEndpointAddress = CDC_EDPT_DATA_IN_ADDR, + .bmAttributes = { .xfer = TUSB_XFER_BULK }, + .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE }, + .bInterval = 0 + }, + } }; //--------------------------------------------------------------------+ diff --git a/examples/device/nrf52840/src/tusb_descriptors.h b/examples/device/nrf52840/src/tusb_descriptors.h index ae6872900..5a82764f4 100644 --- a/examples/device/nrf52840/src/tusb_descriptors.h +++ b/examples/device/nrf52840/src/tusb_descriptors.h @@ -78,23 +78,25 @@ //--------------------------------------------------------------------+ typedef struct ATTR_PACKED { - tusb_desc_configuration_t configuration; + tusb_desc_configuration_t configuration; - //------------- CDC -------------// - tusb_desc_interface_assoc_t cdc_iad; + struct ATTR_PACKED + { + tusb_desc_interface_assoc_t iad; - //CDC Control 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_desc_endpoint_t cdc_endpoint_notification; + //CDC Control Interface + tusb_desc_interface_t comm_itf; + cdc_desc_func_header_t header; + cdc_desc_func_call_management_t call; + cdc_desc_func_acm_t acm; + cdc_desc_func_union_t union_func; + tusb_desc_endpoint_t ep_notif; - //CDC Data Interface - tusb_desc_interface_t cdc_data_interface; - tusb_desc_endpoint_t cdc_endpoint_out; - tusb_desc_endpoint_t cdc_endpoint_in; + //CDC Data Interface + tusb_desc_interface_t data_itf; + tusb_desc_endpoint_t ep_out; + tusb_desc_endpoint_t ep_in; + }cdc; } app_descriptor_configuration_t; diff --git a/examples/obsolete/device/src/tusb_descriptors.c b/examples/obsolete/device/src/tusb_descriptors.c index 25e32cd08..671e63641 100644 --- a/examples/obsolete/device/src/tusb_descriptors.c +++ b/examples/obsolete/device/src/tusb_descriptors.c @@ -233,7 +233,7 @@ app_descriptor_configuration_t const desc_configuration = .cdc_acm = { - .bLength = sizeof(cdc_desc_func_abstract_control_management_t), + .bLength = sizeof(cdc_desc_func_acm_t), .bDescriptorType = TUSB_DESC_CLASS_SPECIFIC, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bmCapabilities = { // 0x02 diff --git a/examples/obsolete/device/src/tusb_descriptors.h b/examples/obsolete/device/src/tusb_descriptors.h index 8bcec74dd..a366a3bc1 100644 --- a/examples/obsolete/device/src/tusb_descriptors.h +++ b/examples/obsolete/device/src/tusb_descriptors.h @@ -142,7 +142,7 @@ typedef struct ATTR_PACKED 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_acm_t cdc_acm; cdc_desc_func_union_t cdc_union; tusb_desc_endpoint_t cdc_endpoint_notification; diff --git a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c index 97747ff4c..6776070df 100644 --- a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c +++ b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c @@ -101,7 +101,7 @@ const cdc_configuration_desc_t cdc_config_descriptor = .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, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bmCapabilities = { // 0x06 @@ -227,7 +227,7 @@ const cdc_configuration_desc_t rndis_config_descriptor = .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, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bmCapabilities = { 0 } diff --git a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h index 17e6189a5..761040624 100644 --- a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h +++ b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h @@ -62,7 +62,7 @@ typedef struct //CDC Control 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_acm_t cdc_acm; cdc_desc_func_union_t cdc_union; tusb_desc_endpoint_t cdc_endpoint_notification; diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c index ddb60f5df..aa062747c 100644 --- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c +++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c @@ -125,7 +125,7 @@ void test_cdch_open_length_check(void) const uint16_t expected_length = //------------- Comm Interface -------------// 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) + //------------- Data Interface -------------// sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t); diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c index 44db2a31d..438af6896 100644 --- a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c +++ b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c @@ -203,7 +203,7 @@ tusb_error_t stub_cdch_open(uint8_t dev_addr, tusb_desc_interface_t const *descr *p_length = //------------- Comm Interface -------------// 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) + //------------- Data Interface -------------// sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t); diff --git a/tests/support/descriptor_test.c b/tests/support/descriptor_test.c index da13265c8..d7e7d7521 100644 --- a/tests/support/descriptor_test.c +++ b/tests/support/descriptor_test.c @@ -287,7 +287,7 @@ const app_configuration_desc_t desc_configuration = .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, .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, .bmCapabilities = { // 0x06 diff --git a/tests/support/descriptor_test.h b/tests/support/descriptor_test.h index fc85faf18..1e5801ce4 100644 --- a/tests/support/descriptor_test.h +++ b/tests/support/descriptor_test.h @@ -103,7 +103,7 @@ typedef struct //CDC Control 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_acm_t cdc_acm; cdc_desc_func_union_t cdc_union; tusb_desc_endpoint_t cdc_endpoint_notification; diff --git a/tinyusb/class/cdc/cdc.h b/tinyusb/class/cdc/cdc.h index 6eb00e040..653704a78 100644 --- a/tinyusb/class/cdc/cdc.h +++ b/tinyusb/class/cdc/cdc.h @@ -310,7 +310,7 @@ typedef struct ATTR_PACKED uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_ cdc_acm_capability_t bmCapabilities ; -}cdc_desc_func_abstract_control_management_t; +}cdc_desc_func_acm_t; /// \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 diff --git a/tinyusb/class/cdc/cdc_device.c b/tinyusb/class/cdc/cdc_device.c index c1662eb4f..66e76ad77 100644 --- a/tinyusb/class/cdc/cdc_device.c +++ b/tinyusb/class/cdc/cdc_device.c @@ -150,7 +150,7 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface { // 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_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]; diff --git a/tinyusb/class/cdc/cdc_host.c b/tinyusb/class/cdc/cdc_host.c index 9188bb274..9b2c8816a 100644 --- a/tinyusb/class/cdc/cdc_host.c +++ b/tinyusb/class/cdc/cdc_host.c @@ -171,7 +171,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ { // 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_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];