From c0ea13ba8557bf210012bf2b0da84c5ad2cc74fe Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 12 May 2021 11:45:57 +0200 Subject: [PATCH] tests: usb: use new USB framework header Replace all macros with the new ones from usb/usb_ch9.h header. Signed-off-by: Johann Fischer --- tests/subsys/usb/bos/src/test_bos.c | 13 ++++++------- tests/subsys/usb/desc_sections/src/desc_sections.c | 11 +++++------ tests/subsys/usb/device/src/main.c | 7 +++---- tests/subsys/usb/os_desc/src/usb_osdesc.c | 5 ++--- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/subsys/usb/bos/src/test_bos.c b/tests/subsys/usb/bos/src/test_bos.c index 34007bc84e5..5789c663f6f 100644 --- a/tests/subsys/usb/bos/src/test_bos.c +++ b/tests/subsys/usb/bos/src/test_bos.c @@ -9,7 +9,6 @@ #include #include -#include #include @@ -33,7 +32,7 @@ static struct webusb_bos_desc { } __packed webusb_bos_descriptor = { .bos = { .bLength = sizeof(struct usb_bos_descriptor), - .bDescriptorType = USB_BINARY_OBJECT_STORE_DESC, + .bDescriptorType = USB_DESC_BOS, .wTotalLength = sizeof(struct webusb_bos_desc), .bNumDeviceCaps = 2, }, @@ -43,7 +42,7 @@ static struct webusb_bos_desc { .platform_webusb = { .bLength = sizeof(struct usb_bos_platform_descriptor) + sizeof(struct usb_bos_capability_webusb), - .bDescriptorType = USB_DEVICE_CAPABILITY_DESC, + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, .bReserved = 0, /* WebUSB Platform Capability UUID @@ -72,7 +71,7 @@ static struct webusb_bos_desc { .platform_msos = { .bLength = sizeof(struct usb_bos_platform_descriptor) + sizeof(struct usb_bos_capability_msos), - .bDescriptorType = USB_DEVICE_CAPABILITY_DESC, + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, .bReserved = 0, .PlatformCapabilityUUID = { @@ -113,7 +112,7 @@ USB_DEVICE_BOS_DESC_DEFINE_CAP struct usb_bos_webusb { .platform = { .bLength = sizeof(struct usb_bos_platform_descriptor) + sizeof(struct usb_bos_capability_webusb), - .bDescriptorType = USB_DEVICE_CAPABILITY_DESC, + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, .bReserved = 0, /* WebUSB Platform Capability UUID @@ -141,7 +140,7 @@ USB_DEVICE_BOS_DESC_DEFINE_CAP struct usb_bos_msosv2 { .platform = { .bLength = sizeof(struct usb_bos_platform_descriptor) + sizeof(struct usb_bos_capability_msos), - .bDescriptorType = USB_DEVICE_CAPABILITY_DESC, + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, .bReserved = 0, .PlatformCapabilityUUID = { @@ -203,7 +202,7 @@ static void test_usb_bos(void) /* Already registered due to previous test */ - setup.wValue = (DESCRIPTOR_TYPE_BOS & 0xFF) << 8; + setup.wValue = (USB_DESC_BOS & 0xFF) << 8; ret = usb_handle_bos(&setup, &len, &data); diff --git a/tests/subsys/usb/desc_sections/src/desc_sections.c b/tests/subsys/usb/desc_sections/src/desc_sections.c index 0941130f556..d03f4b8a973 100644 --- a/tests/subsys/usb/desc_sections/src/desc_sections.c +++ b/tests/subsys/usb/desc_sections/src/desc_sections.c @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -40,11 +39,11 @@ struct usb_test_config { #define INITIALIZER_IF \ { \ .bLength = sizeof(struct usb_if_descriptor), \ - .bDescriptorType = USB_INTERFACE_DESC, \ + .bDescriptorType = USB_DESC_INTERFACE, \ .bInterfaceNumber = 0, \ .bAlternateSetting = 0, \ .bNumEndpoints = 3, \ - .bInterfaceClass = CUSTOM_CLASS, \ + .bInterfaceClass = USB_BCC_VENDOR, \ .bInterfaceSubClass = 0, \ .bInterfaceProtocol = 0, \ .iInterface = 0, \ @@ -53,7 +52,7 @@ struct usb_test_config { #define INITIALIZER_IF_EP(addr, attr, mps) \ { \ .bLength = sizeof(struct usb_ep_descriptor), \ - .bDescriptorType = USB_ENDPOINT_DESC, \ + .bDescriptorType = USB_DESC_ENDPOINT, \ .bEndpointAddress = addr, \ .bmAttributes = attr, \ .wMaxPacketSize = sys_cpu_to_le16(mps), \ @@ -163,7 +162,7 @@ static void check_endpoint_allocation(struct usb_desc_header *head) uint8_t ep_count = 0; while (head->bLength != 0) { - if (head->bDescriptorType == USB_INTERFACE_DESC) { + if (head->bDescriptorType == USB_DESC_INTERFACE) { struct usb_if_descriptor *if_descr = (void *)head; ep_count = 0; @@ -180,7 +179,7 @@ static void check_endpoint_allocation(struct usb_desc_header *head) zassert_not_null(cfg_data, "Check available cfg data"); } - if (head->bDescriptorType == USB_ENDPOINT_DESC) { + if (head->bDescriptorType == USB_DESC_ENDPOINT) { struct usb_ep_descriptor *ep_descr = (struct usb_ep_descriptor *)head; diff --git a/tests/subsys/usb/device/src/main.c b/tests/subsys/usb/device/src/main.c index a85bea6a48d..fc9388c490f 100644 --- a/tests/subsys/usb/device/src/main.c +++ b/tests/subsys/usb/device/src/main.c @@ -9,7 +9,6 @@ #include #include -#include /* Max packet size for endpoints */ #define BULK_EP_MPS 64 @@ -27,11 +26,11 @@ struct usb_device_desc { #define INITIALIZER_IF \ { \ .bLength = sizeof(struct usb_if_descriptor), \ - .bDescriptorType = USB_INTERFACE_DESC, \ + .bDescriptorType = USB_DESC_INTERFACE, \ .bInterfaceNumber = 0, \ .bAlternateSetting = 0, \ .bNumEndpoints = 1, \ - .bInterfaceClass = CUSTOM_CLASS, \ + .bInterfaceClass = USB_BCC_VENDOR, \ .bInterfaceSubClass = 0, \ .bInterfaceProtocol = 0, \ .iInterface = 0, \ @@ -40,7 +39,7 @@ struct usb_device_desc { #define INITIALIZER_IF_EP(addr, attr, mps, interval) \ { \ .bLength = sizeof(struct usb_ep_descriptor), \ - .bDescriptorType = USB_ENDPOINT_DESC, \ + .bDescriptorType = USB_DESC_ENDPOINT, \ .bEndpointAddress = addr, \ .bmAttributes = attr, \ .wMaxPacketSize = sys_cpu_to_le16(mps), \ diff --git a/tests/subsys/usb/os_desc/src/usb_osdesc.c b/tests/subsys/usb/os_desc/src/usb_osdesc.c index b5bf15e88b5..1cc970721c8 100644 --- a/tests/subsys/usb/os_desc/src/usb_osdesc.c +++ b/tests/subsys/usb/os_desc/src/usb_osdesc.c @@ -9,7 +9,6 @@ #include #include -#include #include #define MSOS_STRING_LENGTH 18 @@ -21,7 +20,7 @@ static struct string_desc { uint8_t bPad; } __packed msosv1_string_descriptor = { .bLength = MSOS_STRING_LENGTH, - .bDescriptorType = USB_STRING_DESC, + .bDescriptorType = USB_DESC_STRING, /* Signature MSFT100 */ .bString = { 'M', 0x00, 'S', 0x00, 'F', 0x00, 'T', 0x00, @@ -94,7 +93,7 @@ static void test_handle_os_desc(void) uint8_t *data = NULL; int ret; - setup.wValue = (USB_STRING_DESC & 0xFF) << 8; + setup.wValue = (USB_DESC_STRING & 0xFF) << 8; setup.wValue |= USB_OSDESC_STRING_DESC_INDEX; ret = usb_handle_os_desc(&setup, &len, &data);