1 /*
2  * Copyright (c) 2018 Intel Corporation
3  * Copyright (c) 2023 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef ZEPHYR_INCLUDE_USB_BOS_H_
9 #define ZEPHYR_INCLUDE_USB_BOS_H_
10 
11 #include <stdint.h>
12 
13 /**
14  * @brief USB Binary Device Object Store support
15  * @defgroup usb_bos USB BOS support
16  * @ingroup usb
17  * @since 1.13
18  * @version 1.0.0
19  * @{
20  */
21 
22 /** Root BOS Descriptor */
23 struct usb_bos_descriptor {
24 	uint8_t bLength;
25 	uint8_t bDescriptorType;
26 	uint16_t wTotalLength;
27 	uint8_t bNumDeviceCaps;
28 } __packed;
29 
30 /** Device capability type codes */
31 enum usb_bos_capability_types {
32 	USB_BOS_CAPABILITY_EXTENSION = 0x02,
33 	USB_BOS_CAPABILITY_PLATFORM = 0x05,
34 };
35 
36 /** BOS USB 2.0 extension capability descriptor */
37 struct usb_bos_capability_lpm {
38 	uint8_t bLength;
39 	uint8_t bDescriptorType;
40 	uint8_t bDevCapabilityType;
41 	uint32_t bmAttributes;
42 } __packed;
43 
44 /** BOS platform capability descriptor */
45 struct usb_bos_platform_descriptor {
46 	uint8_t bLength;
47 	uint8_t bDescriptorType;
48 	uint8_t bDevCapabilityType;
49 	uint8_t bReserved;
50 	uint8_t PlatformCapabilityUUID[16];
51 } __packed;
52 
53 /** WebUSB specific part of platform capability descriptor */
54 struct usb_bos_capability_webusb {
55 	uint16_t bcdVersion;
56 	uint8_t bVendorCode;
57 	uint8_t iLandingPage;
58 } __packed;
59 
60 /** Microsoft OS 2.0 descriptor specific part of platform capability descriptor */
61 struct usb_bos_capability_msos {
62 	uint32_t dwWindowsVersion;
63 	uint16_t wMSOSDescriptorSetTotalLength;
64 	uint8_t bMS_VendorCode;
65 	uint8_t bAltEnumCode;
66 } __packed;
67 
68 /**
69  * @}
70  */
71 
72 #endif	/* ZEPHYR_INCLUDE_USB_BOS_H_ */
73