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  * @{
18  */
19 
20 /** Root BOS Descriptor */
21 struct usb_bos_descriptor {
22 	uint8_t bLength;
23 	uint8_t bDescriptorType;
24 	uint16_t wTotalLength;
25 	uint8_t bNumDeviceCaps;
26 } __packed;
27 
28 /** Device capability type codes */
29 enum usb_bos_capability_types {
30 	USB_BOS_CAPABILITY_EXTENSION = 0x02,
31 	USB_BOS_CAPABILITY_PLATFORM = 0x05,
32 };
33 
34 /** BOS USB 2.0 extension capability descriptor */
35 struct usb_bos_capability_lpm {
36 	uint8_t bLength;
37 	uint8_t bDescriptorType;
38 	uint8_t bDevCapabilityType;
39 	uint32_t bmAttributes;
40 } __packed;
41 
42 /** BOS platform capability descriptor */
43 struct usb_bos_platform_descriptor {
44 	uint8_t bLength;
45 	uint8_t bDescriptorType;
46 	uint8_t bDevCapabilityType;
47 	uint8_t bReserved;
48 	uint8_t PlatformCapabilityUUID[16];
49 } __packed;
50 
51 /** WebUSB specific part of platform capability descriptor */
52 struct usb_bos_capability_webusb {
53 	uint16_t bcdVersion;
54 	uint8_t bVendorCode;
55 	uint8_t iLandingPage;
56 } __packed;
57 
58 /** Microsoft OS 2.0 descriptor specific part of platform capability descriptor */
59 struct usb_bos_capability_msos {
60 	uint32_t dwWindowsVersion;
61 	uint16_t wMSOSDescriptorSetTotalLength;
62 	uint8_t bMS_VendorCode;
63 	uint8_t bAltEnumCode;
64 } __packed;
65 
66 /**
67  * @}
68  */
69 
70 #endif	/* ZEPHYR_INCLUDE_USB_BOS_H_ */
71