-
Notifications
You must be signed in to change notification settings - Fork 1
/
usbdesc.h
394 lines (341 loc) · 11 KB
/
usbdesc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
/*++
Copyright (c) 1997-2008 Microsoft Corporation
Module Name:
USBDESC.H
Abstract:
This is a header file for USB descriptors which are not yet in
a standard system header file.
Environment:
user mode
Revision History:
03-06-1998 : created
03-28-2003 : minor changes to support UVC and USB200
--*/
#pragma pack(push, 1)
/*****************************************************************************
D E F I N E S
*****************************************************************************/
//
//Device Descriptor bDeviceClass values
//
#define USB_INTERFACE_CLASS_DEVICE 0x00
#define USB_COMMUNICATION_DEVICE 0x02
#define USB_HUB_DEVICE 0x09
#define USB_DEVICE_CLASS_BILLBOARD 0x11
#define USB_DIAGNOSTIC_DEVICE 0xDC
#define USB_WIRELESS_CONTROLLER_DEVICE 0xE0
#define USB_MISCELLANEOUS_DEVICE 0xEF
#define USB_VENDOR_SPECIFIC_DEVICE 0xFF
//
//Device Descriptor bDeviceSubClass values
//
#define USB_COMMON_SUB_CLASS 0x02
//
//Interface Descriptor bInterfaceClass values:
//
//#define USB_AUDIO_INTERFACE 0x01
//#define USB_CDC_CONTROL_INTERFACE 0x02
//#define USB_HID_INTERFACE 0x03
//#define USB_PHYSICAL_INTERFACE 0x05
//#define USB_IMAGE_INTERFACE 0x06
//#define USB_PRINTER_INTERFACE 0x07
//#define USB_MASS_STORAGE_INTERFACE 0x08
//#define USB_HUB_INTERFACE 0x09
#define USB_CDC_DATA_INTERFACE 0x0A
#define USB_CHIP_SMART_CARD_INTERFACE 0x0B
#define USB_CONTENT_SECURITY_INTERFACE 0x0D
#define USB_DIAGNOSTIC_DEVICE_INTERFACE 0xDC
#define USB_WIRELESS_CONTROLLER_INTERFACE 0xE0
#define USB_APPLICATION_SPECIFIC_INTERFACE 0xFE
//#define USB_VENDOR_SPECIFIC_INTERFACE 0xFF
#define USB_HID_DESCRIPTOR_TYPE 0x21
//
//IAD protocol values
//
#define USB_IAD_PROTOCOL 0x01
//
//Device class specific values
//
#define BILLBOARD_MAX_NUM_ALT_MODE 0x34
//
//USB 2.0 Specification Changes - New Descriptors
//
#define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07
#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08
#define USB_OTG_DESCRIPTOR_TYPE 0x09
#define USB_DEBUG_DESCRIPTOR_TYPE 0x0A
#define USB_IAD_DESCRIPTOR_TYPE 0x0B
//
// USB Device Class Definition for Audio Devices
// Appendix A. Audio Device Class Codes
//
// A.2 Audio Interface Subclass Codes
//
#define USB_AUDIO_SUBCLASS_UNDEFINED 0x00
#define USB_AUDIO_SUBCLASS_AUDIOCONTROL 0x01
#define USB_AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
#define USB_AUDIO_SUBCLASS_MIDISTREAMING 0x03
// A.4 Audio Class-Specific Descriptor Types
//
#define USB_AUDIO_CS_UNDEFINED 0x20
#define USB_AUDIO_CS_DEVICE 0x21
#define USB_AUDIO_CS_CONFIGURATION 0x22
#define USB_AUDIO_CS_STRING 0x23
#define USB_AUDIO_CS_INTERFACE 0x24
#define USB_AUDIO_CS_ENDPOINT 0x25
// A.5 Audio Class-Specific AC (Audio Control) Interface Descriptor Subtypes
//
#define USB_AUDIO_AC_UNDEFINED 0x00
#define USB_AUDIO_AC_HEADER 0x01
#define USB_AUDIO_AC_INPUT_TERMINAL 0x02
#define USB_AUDIO_AC_OUTPUT_TERMINAL 0x03
#define USB_AUDIO_AC_MIXER_UNIT 0x04
#define USB_AUDIO_AC_SELECTOR_UNIT 0x05
#define USB_AUDIO_AC_FEATURE_UNIT 0x06
#define USB_AUDIO_AC_PROCESSING_UNIT 0x07
#define USB_AUDIO_AC_EXTENSION_UNIT 0x08
// A.6 Audio Class-Specific AS (Audio Streaming) Interface Descriptor Subtypes
//
#define USB_AUDIO_AS_UNDEFINED 0x00
#define USB_AUDIO_AS_GENERAL 0x01
#define USB_AUDIO_AS_FORMAT_TYPE 0x02
#define USB_AUDIO_AS_FORMAT_SPECIFIC 0x03
// A.7 Processing Unit Process Types
//
#define USB_AUDIO_PROCESS_UNDEFINED 0x00
#define USB_AUDIO_PROCESS_UPDOWNMIX 0x01
#define USB_AUDIO_PROCESS_DOLBYPROLOGIC 0x02
#define USB_AUDIO_PROCESS_3DSTEREOEXTENDER 0x03
#define USB_AUDIO_PROCESS_REVERBERATION 0x04
#define USB_AUDIO_PROCESS_CHORUS 0x05
#define USB_AUDIO_PROCESS_DYNRANGECOMP 0x06
/*****************************************************************************
T Y P E D E F S
*****************************************************************************/
// HID Class HID Descriptor
//
typedef struct _USB_HID_DESCRIPTOR
{
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bcdHID;
UCHAR bCountryCode;
UCHAR bNumDescriptors;
struct
{
UCHAR bDescriptorType;
USHORT wDescriptorLength;
} OptionalDescriptors[1];
} USB_HID_DESCRIPTOR, *PUSB_HID_DESCRIPTOR;
// OTG Descriptor
//
typedef struct _USB_OTG_DESCRIPTOR
{
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bmAttributes;
} USB_OTG_DESCRIPTOR, *PUSB_OTG_DESCRIPTOR;
// IAD Descriptor
//
typedef struct _USB_IAD_DESCRIPTOR
{
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bFirstInterface;
UCHAR bInterfaceCount;
UCHAR bFunctionClass;
UCHAR bFunctionSubClass;
UCHAR bFunctionProtocol;
UCHAR iFunction;
} USB_IAD_DESCRIPTOR, *PUSB_IAD_DESCRIPTOR;
// Common Class Endpoint Descriptor
//
typedef struct _USB_ENDPOINT_DESCRIPTOR2 {
UCHAR bLength; // offset 0, size 1
UCHAR bDescriptorType; // offset 1, size 1
UCHAR bEndpointAddress; // offset 2, size 1
UCHAR bmAttributes; // offset 3, size 1
USHORT wMaxPacketSize; // offset 4, size 2
USHORT wInterval; // offset 6, size 2
UCHAR bSyncAddress; // offset 8, size 1
} USB_ENDPOINT_DESCRIPTOR2, *PUSB_ENDPOINT_DESCRIPTOR2;
// Common Class Interface Descriptor
//
typedef struct _USB_INTERFACE_DESCRIPTOR2 {
UCHAR bLength; // offset 0, size 1
UCHAR bDescriptorType; // offset 1, size 1
UCHAR bInterfaceNumber; // offset 2, size 1
UCHAR bAlternateSetting; // offset 3, size 1
UCHAR bNumEndpoints; // offset 4, size 1
UCHAR bInterfaceClass; // offset 5, size 1
UCHAR bInterfaceSubClass; // offset 6, size 1
UCHAR bInterfaceProtocol; // offset 7, size 1
UCHAR iInterface; // offset 8, size 1
USHORT wNumClasses; // offset 9, size 2
} USB_INTERFACE_DESCRIPTOR2, *PUSB_INTERFACE_DESCRIPTOR2;
//
// USB Device Class Definition for Audio Devices
//
typedef struct _USB_AUDIO_COMMON_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
} USB_AUDIO_COMMON_DESCRIPTOR,
*PUSB_AUDIO_COMMON_DESCRIPTOR;
// 4.3.2 Class-Specific AC (Audio Control) Interface Descriptor
//
typedef struct _USB_AUDIO_AC_INTERFACE_HEADER_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
USHORT bcdADC;
USHORT wTotalLength;
UCHAR bInCollection;
UCHAR baInterfaceNr[1];
} USB_AUDIO_AC_INTERFACE_HEADER_DESCRIPTOR,
*PUSB_AUDIO_AC_INTERFACE_HEADER_DESCRIPTOR;
// 4.3.2.1 Input Terminal Descriptor
//
typedef struct _USB_AUDIO_INPUT_TERMINAL_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bTerminalID;
USHORT wTerminalType;
UCHAR bAssocTerminal;
UCHAR bNrChannels;
USHORT wChannelConfig;
UCHAR iChannelNames;
UCHAR iTerminal;
} USB_AUDIO_INPUT_TERMINAL_DESCRIPTOR,
*PUSB_AUDIO_INPUT_TERMINAL_DESCRIPTOR;
// 4.3.2.2 Output Terminal Descriptor
//
typedef struct _USB_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bTerminalID;
USHORT wTerminalType;
UCHAR bAssocTerminal;
UCHAR bSourceID;
UCHAR iTerminal;
} USB_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR,
*PUSB_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR;
// 4.3.2.3 Mixer Unit Descriptor
//
typedef struct _USB_AUDIO_MIXER_UNIT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bUnitID;
UCHAR bNrInPins;
UCHAR baSourceID[1];
} USB_AUDIO_MIXER_UNIT_DESCRIPTOR,
*PUSB_AUDIO_MIXER_UNIT_DESCRIPTOR;
// 4.3.2.4 Selector Unit Descriptor
//
typedef struct _USB_AUDIO_SELECTOR_UNIT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bUnitID;
UCHAR bNrInPins;
UCHAR baSourceID[1];
} USB_AUDIO_SELECTOR_UNIT_DESCRIPTOR,
*PUSB_AUDIO_SELECTOR_UNIT_DESCRIPTOR;
// 4.3.2.5 Feature Unit Descriptor
//
typedef struct _USB_AUDIO_FEATURE_UNIT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bUnitID;
UCHAR bSourceID;
UCHAR bControlSize;
UCHAR bmaControls[1];
} USB_AUDIO_FEATURE_UNIT_DESCRIPTOR,
*PUSB_AUDIO_FEATURE_UNIT_DESCRIPTOR;
// 4.3.2.6 Processing Unit Descriptor
//
typedef struct _USB_AUDIO_PROCESSING_UNIT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bUnitID;
USHORT wProcessType;
UCHAR bNrInPins;
UCHAR baSourceID[1];
} USB_AUDIO_PROCESSING_UNIT_DESCRIPTOR,
*PUSB_AUDIO_PROCESSING_UNIT_DESCRIPTOR;
// 4.3.2.7 Extension Unit Descriptor
//
typedef struct _USB_AUDIO_EXTENSION_UNIT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bUnitID;
USHORT wExtensionCode;
UCHAR bNrInPins;
UCHAR baSourceID[1];
} USB_AUDIO_EXTENSION_UNIT_DESCRIPTOR,
*PUSB_AUDIO_EXTENSION_UNIT_DESCRIPTOR;
// 4.5.2 Class-Specific AS Interface Descriptor
//
typedef struct _USB_AUDIO_GENERAL_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bTerminalLink;
UCHAR bDelay;
USHORT wFormatTag;
} USB_AUDIO_GENERAL_DESCRIPTOR,
*PUSB_AUDIO_GENERAL_DESCRIPTOR;
// 4.6.1.2 Class-Specific AS Endpoint Descriptor
//
typedef struct _USB_AUDIO_ENDPOINT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bmAttributes;
UCHAR bLockDelayUnits;
USHORT wLockDelay;
} USB_AUDIO_ENDPOINT_DESCRIPTOR,
*PUSB_AUDIO_ENDPOINT_DESCRIPTOR;
//
// USB Device Class Definition for Audio Data Formats
//
typedef struct _USB_AUDIO_COMMON_FORMAT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bFormatType;
} USB_AUDIO_COMMON_FORMAT_DESCRIPTOR,
*PUSB_AUDIO_COMMON_FORMAT_DESCRIPTOR;
// 2.1.5 Type I Format Type Descriptor
// 2.3.1 Type III Format Type Descriptor
//
typedef struct _USB_AUDIO_TYPE_I_OR_III_FORMAT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bFormatType;
UCHAR bNrChannels;
UCHAR bSubframeSize;
UCHAR bBitResolution;
UCHAR bSamFreqType;
} USB_AUDIO_TYPE_I_OR_III_FORMAT_DESCRIPTOR,
*PUSB_AUDIO_TYPE_I_OR_III_FORMAT_DESCRIPTOR;
// 2.2.6 Type II Format Type Descriptor
//
typedef struct _USB_AUDIO_TYPE_II_FORMAT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bDescriptorSubtype;
UCHAR bFormatType;
USHORT wMaxBitRate;
USHORT wSamplesPerFrame;
UCHAR bSamFreqType;
} USB_AUDIO_TYPE_II_FORMAT_DESCRIPTOR,
*PUSB_AUDIO_TYPE_II_FORMAT_DESCRIPTOR;
#pragma pack(pop)