source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/usbspec.h@ 1194

Last change on this file since 1194 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 25.2 KB
RevLine 
[1166]1/**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5
6#ifndef __USBSPEC_H__
7#define __USBSPEC_H__
8
9#include <winapifamily.h>
10
11#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
12#include <pshpack1.h>
13
14typedef enum _USB_DEVICE_SPEED {
15 UsbLowSpeed = 0,
16 UsbFullSpeed,
17 UsbHighSpeed,
18 UsbSuperSpeed
19} USB_DEVICE_SPEED;
20
21typedef enum _USB_DEVICE_TYPE {
22 Usb11Device = 0,
23 Usb20Device
24} USB_DEVICE_TYPE;
25
26typedef union _BM_REQUEST_TYPE {
27 __C89_NAMELESS struct _BM {
28 UCHAR Recipient:2;
29 UCHAR Reserved:3;
30 UCHAR Type:2;
31 UCHAR Dir:1;
32 };
33 UCHAR B;
34} BM_REQUEST_TYPE,*PBM_REQUEST_TYPE;
35
36typedef struct _USB_DEFAULT_PIPE_SETUP_PACKET {
37 BM_REQUEST_TYPE bmRequestType;
38 UCHAR bRequest;
39 union _wValue {
40 __C89_NAMELESS struct {
41 UCHAR LowByte;
42 UCHAR HiByte;
43 };
44 USHORT W;
45 } wValue;
46 union _wIndex {
47 __C89_NAMELESS struct {
48 UCHAR LowByte;
49 UCHAR HiByte;
50 };
51 USHORT W;
52 } wIndex;
53 USHORT wLength;
54} USB_DEFAULT_PIPE_SETUP_PACKET,*PUSB_DEFAULT_PIPE_SETUP_PACKET;
55
56#define BMREQUEST_HOST_TO_DEVICE 0
57#define BMREQUEST_DEVICE_TO_HOST 1
58
59#define BMREQUEST_STANDARD 0
60#define BMREQUEST_CLASS 1
61#define BMREQUEST_VENDOR 2
62
63#define BMREQUEST_TO_DEVICE 0
64#define BMREQUEST_TO_INTERFACE 1
65#define BMREQUEST_TO_ENDPOINT 2
66#define BMREQUEST_TO_OTHER 3
67
68#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT) (((USHORT) d) << 8 | i))
69
70#define USB_REQUEST_GET_STATUS 0x00
71#define USB_REQUEST_CLEAR_FEATURE 0x01
72#define USB_REQUEST_SET_FEATURE 0x03
73#define USB_REQUEST_SET_ADDRESS 0x05
74#define USB_REQUEST_GET_DESCRIPTOR 0x06
75#define USB_REQUEST_SET_DESCRIPTOR 0x07
76#define USB_REQUEST_GET_CONFIGURATION 0x08
77#define USB_REQUEST_SET_CONFIGURATION 0x09
78#define USB_REQUEST_GET_INTERFACE 0x0a
79#define USB_REQUEST_SET_INTERFACE 0x0b
80#define USB_REQUEST_SYNC_FRAME 0x0c
81
82#define USB_REQUEST_SET_SEL 0x30
83#define USB_REQUEST_ISOCH_DELAY 0x31
84
85#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
86#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
87#define USB_STRING_DESCRIPTOR_TYPE 0x03
88#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
89#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
90#define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 0x06
91#define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07
92#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08
93#define USB_OTG_DESCRIPTOR_TYPE 0x09
94#define USB_DEBUG_DESCRIPTOR_TYPE 0x0a
95#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 0x0b
96#define USB_BOS_DESCRIPTOR_TYPE 0x0f
97#define USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE 0x10
98#define USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_TYPE 0x30
99#define USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR_TYPE 0x31
100
101#define USB_RESERVED_DESCRIPTOR_TYPE 0x06
102#define USB_CONFIG_POWER_DESCRIPTOR_TYPE 0x07
103
104#define USB_FEATURE_ENDPOINT_STALL 0x00
105#define USB_FEATURE_REMOTE_WAKEUP 0x01
106#define USB_FEATURE_TEST_MODE 0x02
107
108#define USB_FEATURE_FUNCTION_SUSPEND 0x00
109#define USB_FEATURE_U1_ENABLE 0x30
110#define USB_FEATURE_U2_ENABLE 0x31
111#define USB_FEATURE_LTM_ENABLE 0x32
112#define USB_FEATURE_LDM_ENABLE 0x35
113
114#define USB_FEATURE_BATTERY_WAKE_MASK 0x28
115#define USB_FEATURE_OS_IS_PD_AWARE 0x29
116#define USB_FEATURE_POLICY_MODE 0x2A
117#define USB_FEATURE_CHARGING_POLICY 0x36
118
119#define USB_CHARGING_POLICY_DEFAULT 0x00
120#define USB_CHARGING_POLICY_ICCHPF 0x01
121#define USB_CHARGING_POLICY_ICCLPF 0x02
122#define USB_CHARGING_POLICY_NO_POWER 0x03
123
124#define USB_STATUS_PORT_STATUS 0x00
125#define USB_STATUS_PD_STATUS 0x01
126#define USB_STATUS_EXT_PORT_STATUS 0x02
127
128#define USB_GETSTATUS_SELF_POWERED 0x01
129#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
130
131#define USB_GETSTATUS_U1_ENABLE 0x04
132#define USB_GETSTATUS_U2_ENABLE 0x08
133#define USB_GETSTATUS_LTM_ENABLE 0x10
134
135typedef union _USB_DEVICE_STATUS {
136 USHORT AsUshort16;
137 __C89_NAMELESS struct {
138 USHORT SelfPowered : 1;
139 USHORT RemoteWakeup : 1;
140 USHORT U1Enable : 1;
141 USHORT U2Enable : 1;
142 USHORT LtmEnable : 1;
143 USHORT Reserved : 11;
144 };
145} USB_DEVICE_STATUS,*PUSB_DEVICE_STATUS;
146
147typedef union _USB_INTERFACE_STATUS {
148 USHORT AsUshort16;
149 __C89_NAMELESS struct {
150 USHORT RemoteWakeupCapable : 1;
151 USHORT RemoteWakeupEnabled : 1;
152 USHORT Reserved : 14;
153 };
154} USB_INTERFACE_STATUS,*PUSB_INTERFACE_STATUS;
155
156typedef union _USB_ENDPOINT_STATUS {
157 USHORT AsUshort16;
158 __C89_NAMELESS struct {
159 USHORT Halt : 1;
160 USHORT Reserved : 15;
161 };
162} USB_ENDPOINT_STATUS,*PUSB_ENDPOINT_STATUS;
163
164typedef struct _USB_COMMON_DESCRIPTOR {
165 UCHAR bLength;
166 UCHAR bDescriptorType;
167} USB_COMMON_DESCRIPTOR,*PUSB_COMMON_DESCRIPTOR;
168
169typedef struct _USB_DEVICE_DESCRIPTOR {
170 UCHAR bLength;
171 UCHAR bDescriptorType;
172 USHORT bcdUSB;
173 UCHAR bDeviceClass;
174 UCHAR bDeviceSubClass;
175 UCHAR bDeviceProtocol;
176 UCHAR bMaxPacketSize0;
177 USHORT idVendor;
178 USHORT idProduct;
179 USHORT bcdDevice;
180 UCHAR iManufacturer;
181 UCHAR iProduct;
182 UCHAR iSerialNumber;
183 UCHAR bNumConfigurations;
184} USB_DEVICE_DESCRIPTOR,*PUSB_DEVICE_DESCRIPTOR;
185
186#define USB_DEVICE_CLASS_RESERVED 0x00
187#define USB_DEVICE_CLASS_AUDIO 0x01
188#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
189#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
190#define USB_DEVICE_CLASS_MONITOR 0x04
191#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
192#define USB_DEVICE_CLASS_POWER 0x06
193#define USB_DEVICE_CLASS_IMAGE 0x06
194#define USB_DEVICE_CLASS_PRINTER 0x07
195#define USB_DEVICE_CLASS_STORAGE 0x08
196#define USB_DEVICE_CLASS_HUB 0x09
197#define USB_DEVICE_CLASS_CDC_DATA 0x0a
198#define USB_DEVICE_CLASS_SMART_CARD 0x0b
199#define USB_DEVICE_CLASS_CONTENT_SECURITY 0x0d
200#define USB_DEVICE_CLASS_VIDEO 0x0e
201#define USB_DEVICE_CLASS_PERSONAL_HEALTHCARE 0x0f
202#define USB_DEVICE_CLASS_AUDIO_VIDEO 0x10
203#define USB_DEVICE_CLASS_BILLBOARD 0x11
204#define USB_DEVICE_CLASS_DIAGNOSTIC_DEVICE 0xdc
205#define USB_DEVICE_CLASS_WIRELESS_CONTROLLER 0xe0
206#define USB_DEVICE_CLASS_MISCELLANEOUS 0xef
207#define USB_DEVICE_CLASS_APPLICATION_SPECIFIC 0xfe
208#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xff
209
210typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR {
211 UCHAR bLength;
212 UCHAR bDescriptorType;
213 USHORT bcdUSB;
214 UCHAR bDeviceClass;
215 UCHAR bDeviceSubClass;
216 UCHAR bDeviceProtocol;
217 UCHAR bMaxPacketSize0;
218 UCHAR bNumConfigurations;
219 UCHAR bReserved;
220} USB_DEVICE_QUALIFIER_DESCRIPTOR,*PUSB_DEVICE_QUALIFIER_DESCRIPTOR;
221
222typedef struct _USB_BOS_DESCRIPTOR {
223 UCHAR bLength;
224 UCHAR bDescriptorType;
225 USHORT wTotalLength;
226 UCHAR bNumDeviceCaps;
227} USB_BOS_DESCRIPTOR,*PUSB_BOS_DESCRIPTOR;
228
229#define USB_DEVICE_CAPABILITY_WIRELESS_USB 0x01
230#define USB_DEVICE_CAPABILITY_USB20_EXTENSION 0x02
231#define USB_DEVICE_CAPABILITY_SUPERSPEED_USB 0x03
232#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04
233#define USB_DEVICE_CAPABILITY_PLATFORM 0x05
234#define USB_DEVICE_CAPABILITY_POWER_DELIVERY 0x06
235#define USB_DEVICE_CAPABILITY_BATTERY_INFO 0x07
236#define USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT 0x08
237#define USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT 0x09
238#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB 0x0A
239#define USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT 0x0B
240#define USB_DEVICE_CAPABILITY_BILLBOARD 0x0D
241
242typedef struct _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR {
243 UCHAR bLength;
244 UCHAR bDescriptorType;
245 UCHAR bDevCapabilityType;
246 union {
247 ULONG AsUlong;
248 __C89_NAMELESS struct {
249 ULONG Reserved:1;
250 ULONG LPMCapable:1;
251 ULONG BESLAndAlternateHIRDSupported:1;
252 ULONG BaselineBESLValid:1;
253 ULONG DeepBESLValid:1;
254 ULONG Reserved1:3;
255 ULONG BaselineBESL:4;
256 ULONG DeepBESL:4;
257 ULONG Reserved2:16;
258 };
259 } bmAttributes;
260} USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR;
261
262#define USB_DEVICE_CAPABILITY_USB20_EXTENSION_BMATTRIBUTES_RESERVED_MASK 0xffff00e1
263
264typedef struct _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR {
265 UCHAR bLength;
266 UCHAR bDescriptorType;
267 UCHAR bDevCapabilityType;
268 UCHAR bReserved;
269 union {
270 ULONG AsUlong;
271 __C89_NAMELESS struct {
272 ULONG Reserved1:1;
273 ULONG BatteryCharging:1;
274 ULONG USBPowerDelivery:1;
275 ULONG Provider:1;
276 ULONG Consumer:1;
277 ULONG ChargingPolicy:1;
278 ULONG TypeCCurrent:1;
279 ULONG Reserved2:1;
280 ULONG ACSupply:1;
281 ULONG Battery:1;
282 ULONG Other:1;
283 ULONG NumBatteries:3;
284 ULONG UsesVbus:1;
285 ULONG Reserved3:17;
286 };
287 } bmAttributes;
288 USHORT bmProviderPorts;
289 USHORT bmConsumerPorts;
290 USHORT bcdBCVersion;
291 USHORT bcdPDVersion;
292 USHORT bcdUSBTypeCVersion;
293} USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR;
294
295typedef struct _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR {
296 UCHAR bLength;
297 UCHAR bDescriptorType;
298 UCHAR bDevCapabilityType;
299 UCHAR bReserved;
300 union {
301 USHORT AsUshort;
302 __C89_NAMELESS struct {
303 USHORT BatteryCharging:1;
304 USHORT USBPowerDelivery:1;
305 USHORT USBTypeCCurrent:1;
306 USHORT Reserved:13;
307 };
308 } bmCapabilities;
309 USHORT wMinVoltage;
310 USHORT wMaxVoltage;
311 USHORT wReserved;
312 ULONG dwMaxOperatingPower;
313 ULONG dwMaxPeakPower;
314 ULONG dwMaxPeakPowerTime;
315} USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR;
316
317typedef struct _USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR {
318 UCHAR bLength;
319 UCHAR bDescriptorType;
320 UCHAR bDevCapabilityType;
321 UCHAR bmAttributes;
322 USHORT wSpeedsSupported;
323 UCHAR bFunctionalitySupport;
324 UCHAR bU1DevExitLat;
325 USHORT wU2DevExitLat;
326} USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR;
327
328#define USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_RESERVED_MASK 0xfd
329#define USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_LTM_CAPABLE 0x02
330
331#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_RESERVED_MASK 0xfff0
332#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW 0x0001
333#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL 0x0002
334#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH 0x0004
335#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER 0x0008
336
337#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW 0x0001
338#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL 0x0002
339#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH 0x0004
340#define USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER 0x0008
341
342#define USB_DEVICE_CAPABILITY_SUPERSPEED_U1_DEVICE_EXIT_MAX_VALUE 0x0a
343
344#define USB_DEVICE_CAPABILITY_SUPERSPEED_U2_DEVICE_EXIT_MAX_VALUE 0x07ff
345
346#define USB_DEVICE_CAPABILITY_MAX_U1_LATENCY 0x0a
347#define USB_DEVICE_CAPABILITY_MAX_U2_LATENCY 0x07ff
348
349#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_BPS 0
350#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_KBPS 1
351#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_MBPS 2
352#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_GBPS 3
353
354#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_SYMMETRIC 0
355#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_ASYMMETRIC 1
356#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_RX 0
357#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_TX 1
358
359#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SS 0
360#define USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SSP 1
361
362typedef union _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED {
363 ULONG AsUlong32;
364 __C89_NAMELESS struct {
365 ULONG SublinkSpeedAttrID:4;
366 ULONG LaneSpeedExponent:2;
367 ULONG SublinkTypeMode:1;
368 ULONG SublinkTypeDir:1;
369 ULONG Reserved:6;
370 ULONG LinkProtocol:2;
371 ULONG LaneSpeedMantissa:16;
372 };
373} USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED,*PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED;
374
375typedef struct _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR {
376 UCHAR bLength;
377 UCHAR bDescriptorType;
378 UCHAR bDevCapabilityType;
379 UCHAR bReserved;
380 union {
381 ULONG AsUlong;
382 __C89_NAMELESS struct {
383 ULONG SublinkSpeedAttrCount:5;
384 ULONG SublinkSpeedIDCount:4;
385 ULONG Reserved:23;
386 };
387 } bmAttributes;
388 union {
389 USHORT AsUshort;
390 __C89_NAMELESS struct {
391 USHORT SublinkSpeedAttrID:4;
392 USHORT Reserved:4;
393 USHORT MinRxLaneCount:4;
394 USHORT MinTxLaneCount:4;
395 };
396 } wFunctionalitySupport;
397 USHORT wReserved;
398 USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED bmSublinkSpeedAttr[1];
399} USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR;
400
401typedef struct _USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR {
402 UCHAR bLength;
403 UCHAR bDescriptorType;
404 UCHAR bDevCapabilityType;
405 UCHAR bReserved;
406 UCHAR ContainerID[16];
407} USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR;
408
409typedef struct _USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR {
410 UCHAR bLength;
411 UCHAR bDescriptorType;
412 UCHAR bDevCapabilityType;
413 UCHAR bReserved;
414 GUID PlatformCapabilityUuid;
415 UCHAR CapabililityData[1];
416} USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR;
417
418typedef struct _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR {
419 UCHAR bLength;
420 UCHAR bDescriptorType;
421 UCHAR bDevCapabilityType;
422 UCHAR iAddtionalInfoURL;
423 UCHAR bNumberOfAlternateModes;
424 UCHAR bPreferredAlternateMode;
425 union {
426 USHORT AsUshort;
427 __C89_NAMELESS struct {
428 USHORT VConnPowerNeededForFullFunctionality:3;
429 USHORT Reserved:12;
430 USHORT NoVconnPowerRequired:1;
431 };
432 } VconnPower;
433 UCHAR bmConfigured[32];
434 ULONG bReserved;
435 __C89_NAMELESS struct {
436 USHORT wSVID;
437 UCHAR bAlternateMode;
438 UCHAR iAlternateModeSetting;
439 } AlternateMode[1];
440} USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR;
441
442DEFINE_GUID(GUID_USB_MSOS20_PLATFORM_CAPABILITY_ID, 0xD8DD60DF, 0x4589, 0x4CC7, 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F);
443
444typedef struct _USB_DEVICE_CAPABILITY_DESCRIPTOR {
445 UCHAR bLength;
446 UCHAR bDescriptorType;
447 UCHAR bDevCapabilityType;
448} USB_DEVICE_CAPABILITY_DESCRIPTOR,*PUSB_DEVICE_CAPABILITY_DESCRIPTOR;
449
450typedef struct _USB_CONFIGURATION_DESCRIPTOR {
451 UCHAR bLength;
452 UCHAR bDescriptorType;
453 USHORT wTotalLength;
454 UCHAR bNumInterfaces;
455 UCHAR bConfigurationValue;
456 UCHAR iConfiguration;
457 UCHAR bmAttributes;
458 UCHAR MaxPower;
459} USB_CONFIGURATION_DESCRIPTOR,*PUSB_CONFIGURATION_DESCRIPTOR;
460
461#define USB_CONFIG_POWERED_MASK 0xc0
462#define USB_CONFIG_BUS_POWERED 0x80
463#define USB_CONFIG_SELF_POWERED 0x40
464#define USB_CONFIG_REMOTE_WAKEUP 0x20
465#define USB_CONFIG_RESERVED 0x1f
466
467typedef struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR {
468 UCHAR bLength;
469 UCHAR bDescriptorType;
470 UCHAR bFirstInterface;
471 UCHAR bInterfaceCount;
472 UCHAR bFunctionClass;
473 UCHAR bFunctionSubClass;
474 UCHAR bFunctionProtocol;
475 UCHAR iFunction;
476} USB_INTERFACE_ASSOCIATION_DESCRIPTOR,*PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR;
477
478typedef struct _USB_INTERFACE_DESCRIPTOR {
479 UCHAR bLength;
480 UCHAR bDescriptorType;
481 UCHAR bInterfaceNumber;
482 UCHAR bAlternateSetting;
483 UCHAR bNumEndpoints;
484 UCHAR bInterfaceClass;
485 UCHAR bInterfaceSubClass;
486 UCHAR bInterfaceProtocol;
487 UCHAR iInterface;
488} USB_INTERFACE_DESCRIPTOR,*PUSB_INTERFACE_DESCRIPTOR;
489
490typedef struct _USB_ENDPOINT_DESCRIPTOR {
491 UCHAR bLength;
492 UCHAR bDescriptorType;
493 UCHAR bEndpointAddress;
494 UCHAR bmAttributes;
495 USHORT wMaxPacketSize;
496 UCHAR bInterval;
497} USB_ENDPOINT_DESCRIPTOR,*PUSB_ENDPOINT_DESCRIPTOR;
498
499#define USB_ENDPOINT_DIRECTION_MASK 0x80
500#define USB_ENDPOINT_DIRECTION_OUT(addr) (! ((addr) & USB_ENDPOINT_DIRECTION_MASK))
501#define USB_ENDPOINT_DIRECTION_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK)
502
503#define USB_ENDPOINT_ADDRESS_MASK 0x0f
504
505#define USB_ENDPOINT_TYPE_MASK 0x03
506#define USB_ENDPOINT_TYPE_CONTROL 0x00
507#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
508#define USB_ENDPOINT_TYPE_BULK 0x02
509#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
510
511#define USB_ENDPOINT_TYPE_BULK_RESERVED_MASK 0xfc
512#define USB_ENDPOINT_TYPE_CONTROL_RESERVED_MASK 0xfc
513#define USB_20_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK 0xfc
514#define USB_30_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK 0xcc
515#define USB_ENDPOINT_TYPE_ISOCHRONOUS_RESERVED_MASK 0xc0
516
517#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK 0x30
518#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_PERIODIC 0x00
519#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_NOTIFICATION 0x10
520#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED10 0x20
521#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED11 0x30
522#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE(bmAttr) (bmAttr &USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK)
523
524#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK 0x0c
525#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_NO_SYNCHRONIZATION 0x00
526#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ASYNCHRONOUS 0x04
527#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ADAPTIVE 0x08
528#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_SYNCHRONOUS 0x0c
529#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION(bmAttr) (bmAttr &USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK)
530
531#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK 0x30
532#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_DATA_ENDOINT 0x00
533#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_FEEDBACK_ENDPOINT 0x10
534#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_IMPLICIT_FEEDBACK_DATA_ENDPOINT 0x20
535#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_RESERVED 0x30
536#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE(bmAttr) (bmAttr &USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK)
537
538typedef union _USB_HIGH_SPEED_MAXPACKET {
539 __C89_NAMELESS struct _MP {
540 USHORT MaxPacket : 11;
541 USHORT HSmux : 2;
542 USHORT Reserved : 3;
543 };
544 USHORT us;
545} USB_HIGH_SPEED_MAXPACKET,*PUSB_HIGH_SPEED_MAXPACKET;
546
547#define USB_ENDPOINT_SUPERSPEED_BULK_MAX_PACKET_SIZE 1024
548#define USB_ENDPOINT_SUPERSPEED_CONTROL_MAX_PACKET_SIZE 512
549#define USB_ENDPOINT_SUPERSPEED_ISO_MAX_PACKET_SIZE 1024
550#define USB_ENDPOINT_SUPERSPEED_INTERRUPT_MAX_PACKET_SIZE 1024
551
552typedef struct _USB_STRING_DESCRIPTOR {
553 UCHAR bLength;
554 UCHAR bDescriptorType;
555 WCHAR bString[1];
556} USB_STRING_DESCRIPTOR,*PUSB_STRING_DESCRIPTOR;
557
558#define MAXIMUM_USB_STRING_LENGTH 255
559
560typedef struct _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR {
561 UCHAR bLength;
562 UCHAR bDescriptorType;
563 UCHAR bMaxBurst;
564 union {
565 UCHAR AsUchar;
566 struct {
567 UCHAR MaxStreams:5;
568 UCHAR Reserved1:3;
569 } Bulk;
570 struct {
571 UCHAR Mult:2;
572 UCHAR Reserved2:5;
573 UCHAR SspCompanion:1;
574 } Isochronous;
575 } bmAttributes;
576 USHORT wBytesPerInterval;
577} USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR,*PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR;
578
579#define USB_SUPERSPEED_ISOCHRONOUS_MAX_MULTIPLIER 2
580
581typedef struct _USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR {
582 UCHAR bLength;
583 UCHAR bDescriptorType;
584 USHORT wReserved;
585 ULONG dwBytesPerInterval;
586} USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR,*PUSB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR;
587
588#define USB_SUPERSPEEDPLUS_ISOCHRONOUS_MIN_BYTESPERINTERVAL 0xc001
589#define USB_SUPERSPEEDPLUS_ISOCHRONOUS_MAX_BYTESPERINTERVAL 0xffffff
590
591typedef struct _USB_HUB_DESCRIPTOR {
592 UCHAR bDescriptorLength;
593 UCHAR bDescriptorType;
594 UCHAR bNumberOfPorts;
595 USHORT wHubCharacteristics;
596 UCHAR bPowerOnToPowerGood;
597 UCHAR bHubControlCurrent;
598 UCHAR bRemoveAndPowerMask[64];
599} USB_HUB_DESCRIPTOR,*PUSB_HUB_DESCRIPTOR;
600
601#define USB_20_HUB_DESCRIPTOR_TYPE 0x29
602
603typedef struct _USB_30_HUB_DESCRIPTOR {
604 UCHAR bLength;
605 UCHAR bDescriptorType;
606 UCHAR bNumberOfPorts;
607 USHORT wHubCharacteristics;
608 UCHAR bPowerOnToPowerGood;
609 UCHAR bHubControlCurrent;
610 UCHAR bHubHdrDecLat;
611 USHORT wHubDelay;
612 USHORT DeviceRemovable;
613} USB_30_HUB_DESCRIPTOR,*PUSB_30_HUB_DESCRIPTOR;
614
615#define USB_30_HUB_DESCRIPTOR_TYPE 0x2a
616
617#define USB_REQUEST_GET_STATE 0x02
618
619#define USB_REQUEST_CLEAR_TT_BUFFER 0x08
620#define USB_REQUEST_RESET_TT 0x09
621#define USB_REQUEST_GET_TT_STATE 0x0a
622#define USB_REQUEST_STOP_TT 0x0b
623
624#define USB_REQUEST_SET_HUB_DEPTH 0x0c
625#define USB_REQUEST_GET_PORT_ERR_COUNT 0x0d
626
627typedef union _USB_HUB_STATUS {
628 USHORT AsUshort16;
629 __C89_NAMELESS struct {
630 USHORT LocalPowerLost:1;
631 USHORT OverCurrent:1;
632 USHORT Reserved:14;
633 };
634} USB_HUB_STATUS,*PUSB_HUB_STATUS;
635
636typedef union _USB_HUB_CHANGE {
637 USHORT AsUshort16;
638 __C89_NAMELESS struct {
639 USHORT LocalPowerChange:1;
640 USHORT OverCurrentChange:1;
641 USHORT Reserved:14;
642 };
643} USB_HUB_CHANGE,*PUSB_HUB_CHANGE;
644
645typedef union _USB_HUB_STATUS_AND_CHANGE {
646 ULONG AsUlong32;
647 __C89_NAMELESS struct {
648 USB_HUB_STATUS HubStatus;
649 USB_HUB_CHANGE HubChange;
650 };
651} USB_HUB_STATUS_AND_CHANGE,*PUSB_HUB_STATUS_AND_CHANGE;
652
653typedef union _USB_20_PORT_STATUS {
654 USHORT AsUshort16;
655 __C89_NAMELESS struct {
656 USHORT CurrentConnectStatus:1;
657 USHORT PortEnabledDisabled:1;
658 USHORT Suspend:1;
659 USHORT OverCurrent:1;
660 USHORT Reset:1;
661 USHORT Reserved0:3;
662 USHORT PortPower:1;
663 USHORT LowSpeedDeviceAttached:1;
664 USHORT HighSpeedDeviceAttached:1;
665 USHORT PortTestMode:1;
666 USHORT PortIndicatorControl:1;
667 USHORT Reserved1:3;
668 };
669} USB_20_PORT_STATUS,*PUSB_20_PORT_STATUS;
670
671#define USB_PORT_STATUS_CONNECT 0x0001
672#define USB_PORT_STATUS_ENABLE 0x0002
673#define USB_PORT_STATUS_SUSPEND 0x0004
674#define USB_PORT_STATUS_OVER_CURRENT 0x0008
675#define USB_PORT_STATUS_RESET 0x0010
676#define USB_PORT_STATUS_POWER 0x0100
677#define USB_PORT_STATUS_LOW_SPEED 0x0200
678#define USB_PORT_STATUS_HIGH_SPEED 0x0400
679
680typedef union _USB_20_PORT_CHANGE {
681 USHORT AsUshort16;
682 __C89_NAMELESS struct {
683 USHORT ConnectStatusChange:1;
684 USHORT PortEnableDisableChange:1;
685 USHORT SuspendChange:1;
686 USHORT OverCurrentIndicatorChange:1;
687 USHORT ResetChange:1;
688 USHORT Reserved2:11;
689 };
690} USB_20_PORT_CHANGE,*PUSB_20_PORT_CHANGE;
691
692typedef union _USB_30_PORT_STATUS {
693 USHORT AsUshort16;
694 __C89_NAMELESS struct {
695 USHORT CurrentConnectStatus:1;
696 USHORT PortEnabledDisabled:1;
697 USHORT Reserved0:1;
698 USHORT OverCurrent:1;
699 USHORT Reset:1;
700 USHORT PortLinkState:4;
701 USHORT PortPower:1;
702 USHORT NegotiatedDeviceSpeed:3;
703 USHORT Reserved1:3;
704 };
705} USB_30_PORT_STATUS,*PUSB_30_PORT_STATUS;
706
707#define PORT_LINK_STATE_U0 0
708#define PORT_LINK_STATE_U1 1
709#define PORT_LINK_STATE_U2 2
710#define PORT_LINK_STATE_U3 3
711#define PORT_LINK_STATE_DISABLED 4
712#define PORT_LINK_STATE_RX_DETECT 5
713#define PORT_LINK_STATE_INACTIVE 6
714#define PORT_LINK_STATE_POLLING 7
715#define PORT_LINK_STATE_RECOVERY 8
716#define PORT_LINK_STATE_HOT_RESET 9
717#define PORT_LINK_STATE_COMPLIANCE_MODE 10
718#define PORT_LINK_STATE_LOOPBACK 11
719#define PORT_LINK_STATE_TEST_MODE 11
720
721typedef union _USB_30_PORT_CHANGE {
722 USHORT AsUshort16;
723 __C89_NAMELESS struct {
724 USHORT ConnectStatusChange:1;
725 USHORT Reserved2:2;
726 USHORT OverCurrentIndicatorChange:1;
727 USHORT ResetChange:1;
728 USHORT BHResetChange:1;
729 USHORT PortLinkStateChange:1;
730 USHORT PortConfigErrorChange:1;
731 USHORT Reserved3:8;
732 };
733} USB_30_PORT_CHANGE,*PUSB_30_PORT_CHANGE;
734
735typedef union _USB_PORT_STATUS {
736 USHORT AsUshort16;
737 USB_20_PORT_STATUS Usb20PortStatus;
738 USB_30_PORT_STATUS Usb30PortStatus;
739} USB_PORT_STATUS,*PUSB_PORT_STATUS;
740
741typedef union _USB_PORT_CHANGE {
742 USHORT AsUshort16;
743 USB_20_PORT_CHANGE Usb20PortChange;
744 USB_30_PORT_CHANGE Usb30PortChange;
745} USB_PORT_CHANGE,*PUSB_PORT_CHANGE;
746
747typedef union _USB_PORT_EXT_STATUS {
748 ULONG AsUlong32;
749 __C89_NAMELESS struct {
750 ULONG RxSublinkSpeedID:4;
751 ULONG TxSublinkSpeedID:4;
752 ULONG RxLaneCount:4;
753 ULONG TxLaneCount:4;
754 ULONG Reserved:16;
755 };
756} USB_PORT_EXT_STATUS,*PUSB_PORT_EXT_STATUS;
757
758typedef union _USB_PORT_STATUS_AND_CHANGE {
759 ULONG AsUlong32;
760 __C89_NAMELESS struct {
761 USB_PORT_STATUS PortStatus;
762 USB_PORT_CHANGE PortChange;
763 };
764} USB_PORT_STATUS_AND_CHANGE,*PUSB_PORT_STATUS_AND_CHANGE;
765
766typedef union _USB_PORT_EXT_STATUS_AND_CHANGE {
767 ULONG64 AsUlong64;
768 __C89_NAMELESS struct {
769 USB_PORT_STATUS_AND_CHANGE PortStatusChange;
770 USB_PORT_EXT_STATUS PortExtStatus;
771 };
772} USB_PORT_EXT_STATUS_AND_CHANGE,*PUSB_PORT_EXT_STATUS_AND_CHANGE;
773
774typedef union _USB_HUB_30_PORT_REMOTE_WAKE_MASK {
775 UCHAR AsUchar8;
776 __C89_NAMELESS struct {
777 UCHAR ConnectRemoteWakeEnable:1;
778 UCHAR DisconnectRemoteWakeEnable:1;
779 UCHAR OverCurrentRemoteWakeEnable:1;
780 UCHAR Reserved0:5;
781 };
782} USB_HUB_30_PORT_REMOTE_WAKE_MASK,*PUSB_HUB_30_PORT_REMOTE_WAKE_MASK;
783
784typedef union _USB_FUNCTION_SUSPEND_OPTIONS {
785 UCHAR AsUchar;
786 __C89_NAMELESS struct {
787 UCHAR PowerState:1;
788 UCHAR RemoteWakeEnabled:1;
789 UCHAR Reserved:6;
790 };
791} USB_FUNCTION_SUSPEND_OPTIONS,*PUSB_FUNCTION_SUSPEND_OPTIONS;
792
793#define USB_FEATURE_INTERFACE_POWER_D0 0x0002
794#define USB_FEATURE_INTERFACE_POWER_D1 0x0003
795#define USB_FEATURE_INTERFACE_POWER_D2 0x0004
796#define USB_FEATURE_INTERFACE_POWER_D3 0x0005
797
798#define USB_SUPPORT_D0_COMMAND 0x01
799#define USB_SUPPORT_D1_COMMAND 0x02
800#define USB_SUPPORT_D2_COMMAND 0x04
801#define USB_SUPPORT_D3_COMMAND 0x08
802#define USB_SUPPORT_D1_WAKEUP 0x10
803#define USB_SUPPORT_D2_WAKEUP 0x20
804
805typedef struct _USB_CONFIGURATION_POWER_DESCRIPTOR {
806 UCHAR bLength;
807 UCHAR bDescriptorType;
808 UCHAR SelfPowerConsumedD0[3];
809 UCHAR bPowerSummaryId;
810 UCHAR bBusPowerSavingD1;
811 UCHAR bSelfPowerSavingD1;
812 UCHAR bBusPowerSavingD2;
813 UCHAR bSelfPowerSavingD2;
814 UCHAR bBusPowerSavingD3;
815 UCHAR bSelfPowerSavingD3;
816 USHORT TransitionTimeFromD1;
817 USHORT TransitionTimeFromD2;
818 USHORT TransitionTimeFromD3;
819} USB_CONFIGURATION_POWER_DESCRIPTOR,*PUSB_CONFIGURATION_POWER_DESCRIPTOR;
820
821typedef struct _USB_INTERFACE_POWER_DESCRIPTOR {
822 UCHAR bLength;
823 UCHAR bDescriptorType;
824 UCHAR bmCapabilitiesFlags;
825 UCHAR bBusPowerSavingD1;
826 UCHAR bSelfPowerSavingD1;
827 UCHAR bBusPowerSavingD2;
828 UCHAR bSelfPowerSavingD2;
829 UCHAR bBusPowerSavingD3;
830 UCHAR bSelfPowerSavingD3;
831 USHORT TransitionTimeFromD1;
832 USHORT TransitionTimeFromD2;
833 USHORT TransitionTimeFromD3;
834} USB_INTERFACE_POWER_DESCRIPTOR,*PUSB_INTERFACE_POWER_DESCRIPTOR;
835
836#include <poppack.h>
837
838#endif
839#endif
Note: See TracBrowser for help on using the repository browser.