|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef ZEPHYR_TEST_USB_HOST_SAMPLE_DESC_H_ |
| 8 | +#define ZEPHYR_TEST_USB_HOST_SAMPLE_DESC_H_ |
| 9 | + |
| 10 | +#include <stddef.h> |
| 11 | +#include <stdint.h> |
| 12 | + |
| 13 | +#define _LE16(n) ((n) & 0xff), ((n) >> 8) |
| 14 | + |
| 15 | +/* |
| 16 | + * Obtained with lsusb then verified against the |
| 17 | + * USB 2.0 standard's sample HUB descriptor |
| 18 | + */ |
| 19 | + |
| 20 | +#define TEST_HUB_DEVICE_DESCRIPTOR \ |
| 21 | + 18, /* bLength */ \ |
| 22 | + 1, /* bDescriptorType */ \ |
| 23 | + _LE16(0x0200), /* bcdUSB */ \ |
| 24 | + 0x09, /* bDeviceClass */ \ |
| 25 | + 0x00, /* bDeviceSubClass */ \ |
| 26 | + 0x02, /* bDeviceProtocol */ \ |
| 27 | + 64, /* bMaxPacketSize0 */ \ |
| 28 | + _LE16(0x0bda), /* idVendor */ \ |
| 29 | + _LE16(0x5411), /* idProduct */ \ |
| 30 | + _LE16(0x0001), /* bcdDevice */ \ |
| 31 | + 0, /* iManufacturer */ \ |
| 32 | + 0, /* iProduct */ \ |
| 33 | + 0, /* iSerial */ \ |
| 34 | + 1, /* bNumConfigurations */ |
| 35 | + |
| 36 | +#define TEST_HUB_CONFIG_DESCRIPTOR \ |
| 37 | + 9, /* bLength */ \ |
| 38 | + 2, /* bDescriptorType */ \ |
| 39 | + _LE16(0x0029), /* wTotalLength */ \ |
| 40 | + 1, /* bNumInterfaces */ \ |
| 41 | + 1, /* bConfigurationValue */ \ |
| 42 | + 0, /* iConfiguration */ \ |
| 43 | + 0xe0, /* bmAttributes */ \ |
| 44 | + 0, /* MaxPower */ |
| 45 | + |
| 46 | +#define TEST_HUB_INTERFACE_ALT0_DESCRIPTOR \ |
| 47 | + 9, /* bLength */ \ |
| 48 | + 4, /* bDescriptorType */ \ |
| 49 | + 0, /* bInterfaceNumber */ \ |
| 50 | + 0, /* bAlternateSetting */ \ |
| 51 | + 1, /* bNumEndpoints */ \ |
| 52 | + 9, /* bInterfaceClass */ \ |
| 53 | + 0, /* bInterfaceSubClass */ \ |
| 54 | + 1, /* bInterfaceProtocol */ \ |
| 55 | + 0, /* iInterface */ |
| 56 | + |
| 57 | +#define TEST_HUB_INTERFACE_ALT1_DESCRIPTOR \ |
| 58 | + 9, /* bLength */ \ |
| 59 | + 4, /* bDescriptorType */ \ |
| 60 | + 0, /* bInterfaceNumber */ \ |
| 61 | + 1, /* bAlternateSetting */ \ |
| 62 | + 1, /* bNumEndpoints */ \ |
| 63 | + 9, /* bInterfaceClass */ \ |
| 64 | + 0, /* bInterfaceSubClass */ \ |
| 65 | + 2, /* bInterfaceProtocol */ \ |
| 66 | + 0, /* iInterface */ |
| 67 | + |
| 68 | +#define TEST_HUB_ENDPOINT_DESCRIPTOR \ |
| 69 | + 7, /* bLength */ \ |
| 70 | + 5, /* bDescriptorType */ \ |
| 71 | + 0x81, /* bEndpointAddress */ \ |
| 72 | + 0x03, /* bmAttributes */ \ |
| 73 | + _LE16(1), /* wMaxPacketSize */ \ |
| 74 | + 12, /* bInterval */ |
| 75 | + |
| 76 | +#define TEST_HUB_DESCRIPTOR \ |
| 77 | + TEST_HUB_DEVICE_DESCRIPTOR \ |
| 78 | + TEST_HUB_CONFIG_DESCRIPTOR \ |
| 79 | + TEST_HUB_INTERFACE_ALT0_DESCRIPTOR \ |
| 80 | + TEST_HUB_ENDPOINT_DESCRIPTOR \ |
| 81 | + TEST_HUB_INTERFACE_ALT1_DESCRIPTOR \ |
| 82 | + TEST_HUB_ENDPOINT_DESCRIPTOR |
| 83 | + |
| 84 | +#endif /* ZEPHYR_TEST_USB_HOST_SAMPLE_DESC_H_ */ |
0 commit comments