Line data Source code
1 1 : /*
2 : * Copyright (c) 2023 Nordic Semiconductor ASA
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : /**
8 : * @file
9 : * @brief MS OS 2.0 descriptor definitions
10 : *
11 : */
12 :
13 : #ifndef ZEPHYR_INCLUDE_USB_MSOS_DESC_H
14 : #define ZEPHYR_INCLUDE_USB_MSOS_DESC_H
15 :
16 : #include <stdint.h>
17 :
18 0 : enum msosv2_descriptor_index {
19 : MS_OS_20_DESCRIPTOR_INDEX = 0x07,
20 : MS_OS_20_SET_ALT_ENUMERATION = 0x08,
21 : };
22 :
23 0 : enum msosv2_descriptor_type {
24 : MS_OS_20_SET_HEADER_DESCRIPTOR = 0x00,
25 : MS_OS_20_SUBSET_HEADER_CONFIGURATION = 0x01,
26 : MS_OS_20_SUBSET_HEADER_FUNCTION = 0x02,
27 : MS_OS_20_FEATURE_COMPATIBLE_ID = 0x03,
28 : MS_OS_20_FEATURE_REG_PROPERTY = 0x04,
29 : MS_OS_20_FEATURE_MIN_RESUME_TIME = 0x05,
30 : MS_OS_20_FEATURE_MODEL_ID = 0x06,
31 : MS_OS_20_FEATURE_CCGP_DEVICE = 0x07,
32 : MS_OS_20_FEATURE_VENDOR_REVISION = 0x08
33 : };
34 :
35 0 : enum msosv2_property_data_type {
36 : MS_OS_20_PROPERTY_DATA_RESERVED = 0,
37 : MS_OS_20_PROPERTY_DATA_REG_SZ = 1,
38 : MS_OS_20_PROPERTY_DATA_REG_EXPAND_SZ = 2,
39 : MS_OS_20_PROPERTY_DATA_REG_BINARY = 3,
40 : MS_OS_20_PROPERTY_DATA_REG_DWORD_LITTLE_ENDIAN = 4,
41 : MS_OS_20_PROPERTY_DATA_REG_DWORD_BIG_ENDIAN = 5,
42 : MS_OS_20_PROPERTY_DATA_REG_LINK = 6,
43 : MS_OS_20_PROPERTY_DATA_REG_MULTI_SZ = 7
44 : };
45 :
46 : /* Microsoft OS 2.0 descriptor set header */
47 0 : struct msosv2_descriptor_set_header {
48 0 : uint16_t wLength;
49 0 : uint16_t wDescriptorType;
50 0 : uint32_t dwWindowsVersion;
51 0 : uint16_t wTotalLength;
52 : } __packed;
53 :
54 : /* Microsoft OS 2.0 configuration subset header
55 : * This header is for composite devices with multiple configurations.
56 : */
57 0 : struct msosv2_configuration_subset_header {
58 0 : uint16_t wLength;
59 0 : uint16_t wDescriptorType;
60 0 : uint8_t bConfigurationValue;
61 0 : uint8_t bReserved;
62 0 : uint16_t wTotalLength;
63 : } __packed;
64 :
65 : /* Microsoft OS 2.0 function subset header
66 : * Note: This must be used if your device has multiple interfaces and cannot be used otherwise.
67 : */
68 0 : struct msosv2_function_subset_header {
69 0 : uint16_t wLength;
70 0 : uint16_t wDescriptorType;
71 0 : uint8_t bFirstInterface;
72 0 : uint8_t bReserved;
73 0 : uint16_t wSubsetLength;
74 : } __packed;
75 :
76 : /* Microsoft OS 2.0 compatible ID descriptor */
77 0 : struct msosv2_compatible_id {
78 0 : uint16_t wLength;
79 0 : uint16_t wDescriptorType;
80 0 : uint8_t CompatibleID[8];
81 0 : uint8_t SubCompatibleID[8];
82 : } __packed;
83 :
84 : /* Microsoft OS 2.0 Registry property descriptor: DeviceInterfaceGUIDs */
85 0 : struct msosv2_guids_property {
86 0 : uint16_t wLength;
87 0 : uint16_t wDescriptorType;
88 0 : uint16_t wPropertyDataType;
89 0 : uint16_t wPropertyNameLength;
90 0 : uint8_t PropertyName[42];
91 0 : uint16_t wPropertyDataLength;
92 0 : uint8_t bPropertyData[80];
93 : } __packed;
94 :
95 : /* DeviceInterfaceGUIDs */
96 0 : #define DEVICE_INTERFACE_GUIDS_PROPERTY_NAME \
97 : 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, \
98 : 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, \
99 : 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, \
100 : 'D', 0x00, 's', 0x00, 0x00, 0x00
101 :
102 : /* Microsoft OS 2.0 minimum USB resume time descriptor */
103 0 : struct msosv2_resume_time {
104 0 : uint16_t wLength;
105 0 : uint16_t wDescriptorType;
106 0 : uint8_t bResumeRecoveryTime;
107 0 : uint8_t bResumeSignalingTime;
108 : } __packed;
109 :
110 : /* Microsoft OS 2.0 model ID descriptor */
111 0 : struct msosv2_model_id {
112 0 : uint16_t wLength;
113 0 : uint16_t wDescriptorType;
114 0 : uint8_t ModelID[16];
115 : } __packed;
116 :
117 : /* Microsoft OS 2.0 CCGP device descriptor */
118 0 : struct msosv2_ccgp_device {
119 0 : uint16_t wLength;
120 0 : uint16_t wDescriptorType;
121 : } __packed;
122 :
123 : /* Microsoft OS 2.0 vendor revision descriptor */
124 0 : struct msosv2_vendor_revision {
125 0 : uint16_t wLength;
126 0 : uint16_t wDescriptorType;
127 0 : uint16_t VendorRevision;
128 : } __packed;
129 :
130 :
131 : #endif /* ZEPHYR_INCLUDE_USB_MSOS_DESC_H */
|