-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusb.bi
More file actions
1257 lines (1110 loc) · 46.7 KB
/
usb.bi
File metadata and controls
1257 lines (1110 loc) · 46.7 KB
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#include once "winapifamily.bi"
#include once "pshpack1.bi"
#include once "poppack.bi"
#define __USB_H__
type PIRP as PVOID
type PMDL as PVOID
const USBDI_VERSION = &h00000600
#define __USBSPEC_H__
type _USB_DEVICE_SPEED as long
enum
UsbLowSpeed = 0
UsbFullSpeed
UsbHighSpeed
UsbSuperSpeed
end enum
type USB_DEVICE_SPEED as _USB_DEVICE_SPEED
type _USB_DEVICE_TYPE as long
enum
Usb11Device = 0
Usb20Device
end enum
type USB_DEVICE_TYPE as _USB_DEVICE_TYPE
union _BM_REQUEST_TYPE
'' TODO: __C89_NAMELESS struct _BM { UCHAR Recipient:2; UCHAR Reserved:3; UCHAR Type:2; UCHAR Dir:1; };
B as UCHAR
end union
type BM_REQUEST_TYPE as _BM_REQUEST_TYPE
type PBM_REQUEST_TYPE as _BM_REQUEST_TYPE ptr
union _wValue
'' TODO: __C89_NAMELESS struct { UCHAR LowByte; UCHAR HiByte; };
W as USHORT
end union
union _wIndex
'' TODO: __C89_NAMELESS struct { UCHAR LowByte; UCHAR HiByte; };
W as USHORT
end union
type _USB_DEFAULT_PIPE_SETUP_PACKET
bmRequestType as BM_REQUEST_TYPE
bRequest as UCHAR
wValue as _wValue
wIndex as _wIndex
wLength as USHORT
end type
type USB_DEFAULT_PIPE_SETUP_PACKET as _USB_DEFAULT_PIPE_SETUP_PACKET
type PUSB_DEFAULT_PIPE_SETUP_PACKET as _USB_DEFAULT_PIPE_SETUP_PACKET ptr
const BMREQUEST_HOST_TO_DEVICE = 0
const BMREQUEST_DEVICE_TO_HOST = 1
const BMREQUEST_STANDARD = 0
const BMREQUEST_CLASS = 1
const BMREQUEST_VENDOR = 2
const BMREQUEST_TO_DEVICE = 0
const BMREQUEST_TO_INTERFACE = 1
const BMREQUEST_TO_ENDPOINT = 2
const BMREQUEST_TO_OTHER = 3
'' TODO: #define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT) (((USHORT) d) << 8 | i))
const USB_REQUEST_GET_STATUS = &h00
const USB_REQUEST_CLEAR_FEATURE = &h01
const USB_REQUEST_SET_FEATURE = &h03
const USB_REQUEST_SET_ADDRESS = &h05
const USB_REQUEST_GET_DESCRIPTOR = &h06
const USB_REQUEST_SET_DESCRIPTOR = &h07
const USB_REQUEST_GET_CONFIGURATION = &h08
const USB_REQUEST_SET_CONFIGURATION = &h09
const USB_REQUEST_GET_INTERFACE = &h0a
const USB_REQUEST_SET_INTERFACE = &h0b
const USB_REQUEST_SYNC_FRAME = &h0c
const USB_REQUEST_SET_SEL = &h30
const USB_REQUEST_ISOCH_DELAY = &h31
const USB_DEVICE_DESCRIPTOR_TYPE = &h01
const USB_CONFIGURATION_DESCRIPTOR_TYPE = &h02
const USB_STRING_DESCRIPTOR_TYPE = &h03
const USB_INTERFACE_DESCRIPTOR_TYPE = &h04
const USB_ENDPOINT_DESCRIPTOR_TYPE = &h05
const USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE = &h06
const USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE = &h07
const USB_INTERFACE_POWER_DESCRIPTOR_TYPE = &h08
const USB_OTG_DESCRIPTOR_TYPE = &h09
const USB_DEBUG_DESCRIPTOR_TYPE = &h0a
const USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE = &h0b
const USB_BOS_DESCRIPTOR_TYPE = &h0f
const USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE = &h10
const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_TYPE = &h30
const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR_TYPE = &h31
const USB_RESERVED_DESCRIPTOR_TYPE = &h06
const USB_CONFIG_POWER_DESCRIPTOR_TYPE = &h07
const USB_FEATURE_ENDPOINT_STALL = &h00
const USB_FEATURE_REMOTE_WAKEUP = &h01
const USB_FEATURE_TEST_MODE = &h02
const USB_FEATURE_FUNCTION_SUSPEND = &h00
const USB_FEATURE_U1_ENABLE = &h30
const USB_FEATURE_U2_ENABLE = &h31
const USB_FEATURE_LTM_ENABLE = &h32
const USB_FEATURE_LDM_ENABLE = &h35
const USB_FEATURE_BATTERY_WAKE_MASK = &h28
const USB_FEATURE_OS_IS_PD_AWARE = &h29
const USB_FEATURE_POLICY_MODE = &h2A
const USB_FEATURE_CHARGING_POLICY = &h36
const USB_CHARGING_POLICY_DEFAULT = &h00
const USB_CHARGING_POLICY_ICCHPF = &h01
const USB_CHARGING_POLICY_ICCLPF = &h02
const USB_CHARGING_POLICY_NO_POWER = &h03
const USB_STATUS_PORT_STATUS = &h00
const USB_STATUS_PD_STATUS = &h01
const USB_STATUS_EXT_PORT_STATUS = &h02
const USB_GETSTATUS_SELF_POWERED = &h01
const USB_GETSTATUS_REMOTE_WAKEUP_ENABLED = &h02
const USB_GETSTATUS_U1_ENABLE = &h04
const USB_GETSTATUS_U2_ENABLE = &h08
const USB_GETSTATUS_LTM_ENABLE = &h10
union _USB_DEVICE_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT SelfPowered : 1; USHORT RemoteWakeup : 1; USHORT U1Enable : 1; USHORT U2Enable : 1; USHORT LtmEnable : 1; USHORT Reserved : 11; };
end union
type USB_DEVICE_STATUS as _USB_DEVICE_STATUS
type PUSB_DEVICE_STATUS as _USB_DEVICE_STATUS ptr
union _USB_INTERFACE_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT RemoteWakeupCapable : 1; USHORT RemoteWakeupEnabled : 1; USHORT Reserved : 14; };
end union
type USB_INTERFACE_STATUS as _USB_INTERFACE_STATUS
type PUSB_INTERFACE_STATUS as _USB_INTERFACE_STATUS ptr
union _USB_ENDPOINT_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT Halt : 1; USHORT Reserved : 15; };
end union
type USB_ENDPOINT_STATUS as _USB_ENDPOINT_STATUS
type PUSB_ENDPOINT_STATUS as _USB_ENDPOINT_STATUS ptr
type _USB_COMMON_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
end type
type USB_COMMON_DESCRIPTOR as _USB_COMMON_DESCRIPTOR
type PUSB_COMMON_DESCRIPTOR as _USB_COMMON_DESCRIPTOR ptr
type _USB_DEVICE_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bcdUSB as USHORT
bDeviceClass as UCHAR
bDeviceSubClass as UCHAR
bDeviceProtocol as UCHAR
bMaxPacketSize0 as UCHAR
idVendor as USHORT
idProduct as USHORT
bcdDevice as USHORT
iManufacturer as UCHAR
iProduct as UCHAR
iSerialNumber as UCHAR
bNumConfigurations as UCHAR
end type
type USB_DEVICE_DESCRIPTOR as _USB_DEVICE_DESCRIPTOR
type PUSB_DEVICE_DESCRIPTOR as _USB_DEVICE_DESCRIPTOR ptr
const USB_DEVICE_CLASS_RESERVED = &h00
const USB_DEVICE_CLASS_AUDIO = &h01
const USB_DEVICE_CLASS_COMMUNICATIONS = &h02
const USB_DEVICE_CLASS_HUMAN_INTERFACE = &h03
const USB_DEVICE_CLASS_MONITOR = &h04
const USB_DEVICE_CLASS_PHYSICAL_INTERFACE = &h05
const USB_DEVICE_CLASS_POWER = &h06
const USB_DEVICE_CLASS_IMAGE = &h06
const USB_DEVICE_CLASS_PRINTER = &h07
const USB_DEVICE_CLASS_STORAGE = &h08
const USB_DEVICE_CLASS_HUB = &h09
const USB_DEVICE_CLASS_CDC_DATA = &h0a
const USB_DEVICE_CLASS_SMART_CARD = &h0b
const USB_DEVICE_CLASS_CONTENT_SECURITY = &h0d
const USB_DEVICE_CLASS_VIDEO = &h0e
const USB_DEVICE_CLASS_PERSONAL_HEALTHCARE = &h0f
const USB_DEVICE_CLASS_AUDIO_VIDEO = &h10
const USB_DEVICE_CLASS_BILLBOARD = &h11
const USB_DEVICE_CLASS_DIAGNOSTIC_DEVICE = &hdc
const USB_DEVICE_CLASS_WIRELESS_CONTROLLER = &he0
const USB_DEVICE_CLASS_MISCELLANEOUS = &hef
const USB_DEVICE_CLASS_APPLICATION_SPECIFIC = &hfe
const USB_DEVICE_CLASS_VENDOR_SPECIFIC = &hff
type _USB_DEVICE_QUALIFIER_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bcdUSB as USHORT
bDeviceClass as UCHAR
bDeviceSubClass as UCHAR
bDeviceProtocol as UCHAR
bMaxPacketSize0 as UCHAR
bNumConfigurations as UCHAR
bReserved as UCHAR
end type
type USB_DEVICE_QUALIFIER_DESCRIPTOR as _USB_DEVICE_QUALIFIER_DESCRIPTOR
type PUSB_DEVICE_QUALIFIER_DESCRIPTOR as _USB_DEVICE_QUALIFIER_DESCRIPTOR ptr
type _USB_BOS_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
wTotalLength as USHORT
bNumDeviceCaps as UCHAR
end type
type USB_BOS_DESCRIPTOR as _USB_BOS_DESCRIPTOR
type PUSB_BOS_DESCRIPTOR as _USB_BOS_DESCRIPTOR ptr
const USB_DEVICE_CAPABILITY_WIRELESS_USB = &h01
const USB_DEVICE_CAPABILITY_USB20_EXTENSION = &h02
const USB_DEVICE_CAPABILITY_SUPERSPEED_USB = &h03
const USB_DEVICE_CAPABILITY_CONTAINER_ID = &h04
const USB_DEVICE_CAPABILITY_PLATFORM = &h05
const USB_DEVICE_CAPABILITY_POWER_DELIVERY = &h06
const USB_DEVICE_CAPABILITY_BATTERY_INFO = &h07
const USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT = &h08
const USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT = &h09
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB = &h0A
const USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT = &h0B
const USB_DEVICE_CAPABILITY_BILLBOARD = &h0D
union _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes
AsUlong as ULONG
'' TODO: __C89_NAMELESS struct { ULONG Reserved:1; ULONG LPMCapable:1; ULONG BESLAndAlternateHIRDSupported:1; ULONG BaselineBESLValid:1; ULONG DeepBESLValid:1; ULONG Reserved1:3; ULONG BaselineBESL:4; ULONG DeepBESL:4; ULONG Reserved2:16; };
end union
type _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bmAttributes as _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes
end type
type USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR as _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR as _USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR ptr
const USB_DEVICE_CAPABILITY_USB20_EXTENSION_BMATTRIBUTES_RESERVED_MASK = &hffff00e1
union _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes
AsUlong as ULONG
'' TODO: __C89_NAMELESS struct { ULONG Reserved1:1; ULONG BatteryCharging:1; ULONG USBPowerDelivery:1; ULONG Provider:1; ULONG Consumer:1; ULONG ChargingPolicy:1; ULONG TypeCCurrent:1; ULONG Reserved2:1; ULONG ACSupply:1; ULONG Battery:1; ULONG Other:1; ULONG NumBatteries:3; ULONG UsesVbus:1; ULONG Reserved3:17; };
end union
type _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bReserved as UCHAR
bmAttributes as _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes
bmProviderPorts as USHORT
bmConsumerPorts as USHORT
bcdBCVersion as USHORT
bcdPDVersion as USHORT
bcdUSBTypeCVersion as USHORT
end type
type USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR as _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR as _USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR ptr
union _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities
AsUshort as USHORT
'' TODO: __C89_NAMELESS struct { USHORT BatteryCharging:1; USHORT USBPowerDelivery:1; USHORT USBTypeCCurrent:1; USHORT Reserved:13; };
end union
type _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bReserved as UCHAR
bmCapabilities as _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities
wMinVoltage as USHORT
wMaxVoltage as USHORT
wReserved as USHORT
dwMaxOperatingPower as ULONG
dwMaxPeakPower as ULONG
dwMaxPeakPowerTime as ULONG
end type
type USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR as _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR as _USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR ptr
type _USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bmAttributes as UCHAR
wSpeedsSupported as USHORT
bFunctionalitySupport as UCHAR
bU1DevExitLat as UCHAR
wU2DevExitLat as USHORT
end type
type USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR as _USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR as _USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR ptr
const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_RESERVED_MASK = &hfd
const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_LTM_CAPABLE = &h02
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_RESERVED_MASK = &hfff0
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW = &h0001
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL = &h0002
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH = &h0004
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER = &h0008
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW = &h0001
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL = &h0002
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH = &h0004
const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER = &h0008
const USB_DEVICE_CAPABILITY_SUPERSPEED_U1_DEVICE_EXIT_MAX_VALUE = &h0a
const USB_DEVICE_CAPABILITY_SUPERSPEED_U2_DEVICE_EXIT_MAX_VALUE = &h07ff
const USB_DEVICE_CAPABILITY_MAX_U1_LATENCY = &h0a
const USB_DEVICE_CAPABILITY_MAX_U2_LATENCY = &h07ff
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_BPS = 0
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_KBPS = 1
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_MBPS = 2
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_GBPS = 3
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_SYMMETRIC = 0
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_ASYMMETRIC = 1
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_RX = 0
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_TX = 1
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SS = 0
const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SSP = 1
union _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED
AsUlong32 as ULONG
'' TODO: __C89_NAMELESS struct { ULONG SublinkSpeedAttrID:4; ULONG LaneSpeedExponent:2; ULONG SublinkTypeMode:1; ULONG SublinkTypeDir:1; ULONG Reserved:6; ULONG LinkProtocol:2; ULONG LaneSpeedMantissa:16; };
end union
type USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED
type PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED ptr
union _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes
AsUlong as ULONG
'' TODO: __C89_NAMELESS struct { ULONG SublinkSpeedAttrCount:5; ULONG SublinkSpeedIDCount:4; ULONG Reserved:23; };
end union
union _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport
AsUshort as USHORT
'' TODO: __C89_NAMELESS struct { USHORT SublinkSpeedAttrID:4; USHORT Reserved:4; USHORT MinRxLaneCount:4; USHORT MinTxLaneCount:4; };
end union
type _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bReserved as UCHAR
bmAttributes as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes
wFunctionalitySupport as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport
wReserved as USHORT
bmSublinkSpeedAttr(0 to 0) as USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED
end type
type USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR as _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR ptr
type _USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bReserved as UCHAR
ContainerID(0 to 15) as UCHAR
end type
type USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR as _USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR as _USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR ptr
type _USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
bReserved as UCHAR
PlatformCapabilityUuid as GUID
CapabililityData(0 to 0) as UCHAR
end type
type USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR as _USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR as _USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR ptr
union _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower
AsUshort as USHORT
'' TODO: __C89_NAMELESS struct { USHORT VConnPowerNeededForFullFunctionality:3; USHORT Reserved:12; USHORT NoVconnPowerRequired:1; };
end union
type _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
iAddtionalInfoURL as UCHAR
bNumberOfAlternateModes as UCHAR
bPreferredAlternateMode as UCHAR
VconnPower as _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower
bmConfigured(0 to 31) as UCHAR
bReserved as ULONG
'' TODO: __C89_NAMELESS struct { USHORT wSVID; UCHAR bAlternateMode; UCHAR iAlternateModeSetting; } AlternateMode[1];
end type
type USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR as _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR as _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR ptr
'' TODO: DEFINE_GUID(GUID_USB_MSOS20_PLATFORM_CAPABILITY_ID, 0xD8DD60DF, 0x4589, 0x4CC7, 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F);
type _USB_DEVICE_CAPABILITY_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bDevCapabilityType as UCHAR
end type
type USB_DEVICE_CAPABILITY_DESCRIPTOR as _USB_DEVICE_CAPABILITY_DESCRIPTOR
type PUSB_DEVICE_CAPABILITY_DESCRIPTOR as _USB_DEVICE_CAPABILITY_DESCRIPTOR ptr
type _USB_CONFIGURATION_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
wTotalLength as USHORT
bNumInterfaces as UCHAR
bConfigurationValue as UCHAR
iConfiguration as UCHAR
bmAttributes as UCHAR
MaxPower as UCHAR
end type
type USB_CONFIGURATION_DESCRIPTOR as _USB_CONFIGURATION_DESCRIPTOR
type PUSB_CONFIGURATION_DESCRIPTOR as _USB_CONFIGURATION_DESCRIPTOR ptr
const USB_CONFIG_POWERED_MASK = &hc0
const USB_CONFIG_BUS_POWERED = &h80
const USB_CONFIG_SELF_POWERED = &h40
const USB_CONFIG_REMOTE_WAKEUP = &h20
const USB_CONFIG_RESERVED = &h1f
type _USB_INTERFACE_ASSOCIATION_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bFirstInterface as UCHAR
bInterfaceCount as UCHAR
bFunctionClass as UCHAR
bFunctionSubClass as UCHAR
bFunctionProtocol as UCHAR
iFunction as UCHAR
end type
type USB_INTERFACE_ASSOCIATION_DESCRIPTOR as _USB_INTERFACE_ASSOCIATION_DESCRIPTOR
type PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR as _USB_INTERFACE_ASSOCIATION_DESCRIPTOR ptr
type _USB_INTERFACE_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bInterfaceNumber as UCHAR
bAlternateSetting as UCHAR
bNumEndpoints as UCHAR
bInterfaceClass as UCHAR
bInterfaceSubClass as UCHAR
bInterfaceProtocol as UCHAR
iInterface as UCHAR
end type
type USB_INTERFACE_DESCRIPTOR as _USB_INTERFACE_DESCRIPTOR
type PUSB_INTERFACE_DESCRIPTOR as _USB_INTERFACE_DESCRIPTOR ptr
type _USB_ENDPOINT_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bEndpointAddress as UCHAR
bmAttributes as UCHAR
wMaxPacketSize as USHORT
bInterval as UCHAR
end type
type USB_ENDPOINT_DESCRIPTOR as _USB_ENDPOINT_DESCRIPTOR
type PUSB_ENDPOINT_DESCRIPTOR as _USB_ENDPOINT_DESCRIPTOR ptr
const USB_ENDPOINT_DIRECTION_MASK = &h80
#define USB_ENDPOINT_DIRECTION_OUT(addr) (((addr) and USB_ENDPOINT_DIRECTION_MASK) = 0)
#define USB_ENDPOINT_DIRECTION_IN(addr) ((addr) and USB_ENDPOINT_DIRECTION_MASK)
const USB_ENDPOINT_ADDRESS_MASK = &h0f
const USB_ENDPOINT_TYPE_MASK = &h03
const USB_ENDPOINT_TYPE_CONTROL = &h00
const USB_ENDPOINT_TYPE_ISOCHRONOUS = &h01
const USB_ENDPOINT_TYPE_BULK = &h02
const USB_ENDPOINT_TYPE_INTERRUPT = &h03
const USB_ENDPOINT_TYPE_BULK_RESERVED_MASK = &hfc
const USB_ENDPOINT_TYPE_CONTROL_RESERVED_MASK = &hfc
const USB_20_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK = &hfc
const USB_30_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK = &hcc
const USB_ENDPOINT_TYPE_ISOCHRONOUS_RESERVED_MASK = &hc0
const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK = &h30
const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_PERIODIC = &h00
const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_NOTIFICATION = &h10
const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED10 = &h20
const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED11 = &h30
#define USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE(bmAttr) (bmAttr and USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK)
const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK = &h0c
const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_NO_SYNCHRONIZATION = &h00
const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ASYNCHRONOUS = &h04
const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ADAPTIVE = &h08
const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_SYNCHRONOUS = &h0c
#define USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION(bmAttr) (bmAttr and USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK)
const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK = &h30
const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_DATA_ENDOINT = &h00
const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_FEEDBACK_ENDPOINT = &h10
const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_IMPLICIT_FEEDBACK_DATA_ENDPOINT = &h20
const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_RESERVED = &h30
#define USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE(bmAttr) (bmAttr and USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK)
union _USB_HIGH_SPEED_MAXPACKET
'' TODO: __C89_NAMELESS struct _MP { USHORT MaxPacket : 11; USHORT HSmux : 2; USHORT Reserved : 3; };
us as USHORT
end union
type USB_HIGH_SPEED_MAXPACKET as _USB_HIGH_SPEED_MAXPACKET
type PUSB_HIGH_SPEED_MAXPACKET as _USB_HIGH_SPEED_MAXPACKET ptr
const USB_ENDPOINT_SUPERSPEED_BULK_MAX_PACKET_SIZE = 1024
const USB_ENDPOINT_SUPERSPEED_CONTROL_MAX_PACKET_SIZE = 512
const USB_ENDPOINT_SUPERSPEED_ISO_MAX_PACKET_SIZE = 1024
const USB_ENDPOINT_SUPERSPEED_INTERRUPT_MAX_PACKET_SIZE = 1024
type _USB_STRING_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bString(0 to 0) as WCHAR
end type
type USB_STRING_DESCRIPTOR as _USB_STRING_DESCRIPTOR
type PUSB_STRING_DESCRIPTOR as _USB_STRING_DESCRIPTOR ptr
const MAXIMUM_USB_STRING_LENGTH = 255
type _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk
MaxStreams : 5 as UCHAR
Reserved1 : 3 as UCHAR
end type
type _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous
Mult : 2 as UCHAR
Reserved2 : 5 as UCHAR
SspCompanion : 1 as UCHAR
end type
union _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes
AsUchar as UCHAR
Bulk as _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk
Isochronous as _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous
end union
type _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bMaxBurst as UCHAR
bmAttributes as _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes
wBytesPerInterval as USHORT
end type
type USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR as _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
type PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR as _USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR ptr
const USB_SUPERSPEED_ISOCHRONOUS_MAX_MULTIPLIER = 2
type _USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
wReserved as USHORT
dwBytesPerInterval as ULONG
end type
type USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR as _USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR
type PUSB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR as _USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR ptr
const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MIN_BYTESPERINTERVAL = &hc001
const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MAX_BYTESPERINTERVAL = &hffffff
type _USB_HUB_DESCRIPTOR
bDescriptorLength as UCHAR
bDescriptorType as UCHAR
bNumberOfPorts as UCHAR
wHubCharacteristics as USHORT
bPowerOnToPowerGood as UCHAR
bHubControlCurrent as UCHAR
bRemoveAndPowerMask(0 to 63) as UCHAR
end type
type USB_HUB_DESCRIPTOR as _USB_HUB_DESCRIPTOR
type PUSB_HUB_DESCRIPTOR as _USB_HUB_DESCRIPTOR ptr
const USB_20_HUB_DESCRIPTOR_TYPE = &h29
type _USB_30_HUB_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bNumberOfPorts as UCHAR
wHubCharacteristics as USHORT
bPowerOnToPowerGood as UCHAR
bHubControlCurrent as UCHAR
bHubHdrDecLat as UCHAR
wHubDelay as USHORT
DeviceRemovable as USHORT
end type
type USB_30_HUB_DESCRIPTOR as _USB_30_HUB_DESCRIPTOR
type PUSB_30_HUB_DESCRIPTOR as _USB_30_HUB_DESCRIPTOR ptr
const USB_30_HUB_DESCRIPTOR_TYPE = &h2a
const USB_REQUEST_GET_STATE = &h02
const USB_REQUEST_CLEAR_TT_BUFFER = &h08
const USB_REQUEST_RESET_TT = &h09
const USB_REQUEST_GET_TT_STATE = &h0a
const USB_REQUEST_STOP_TT = &h0b
const USB_REQUEST_SET_HUB_DEPTH = &h0c
const USB_REQUEST_GET_PORT_ERR_COUNT = &h0d
union _USB_HUB_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT LocalPowerLost:1; USHORT OverCurrent:1; USHORT Reserved:14; };
end union
type USB_HUB_STATUS as _USB_HUB_STATUS
type PUSB_HUB_STATUS as _USB_HUB_STATUS ptr
union _USB_HUB_CHANGE
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT LocalPowerChange:1; USHORT OverCurrentChange:1; USHORT Reserved:14; };
end union
type USB_HUB_CHANGE as _USB_HUB_CHANGE
type PUSB_HUB_CHANGE as _USB_HUB_CHANGE ptr
union _USB_HUB_STATUS_AND_CHANGE
AsUlong32 as ULONG
'' TODO: __C89_NAMELESS struct { USB_HUB_STATUS HubStatus; USB_HUB_CHANGE HubChange; };
end union
type USB_HUB_STATUS_AND_CHANGE as _USB_HUB_STATUS_AND_CHANGE
type PUSB_HUB_STATUS_AND_CHANGE as _USB_HUB_STATUS_AND_CHANGE ptr
union _USB_20_PORT_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT CurrentConnectStatus:1; USHORT PortEnabledDisabled:1; USHORT Suspend:1; USHORT OverCurrent:1; USHORT Reset:1; USHORT Reserved0:3; USHORT PortPower:1; USHORT LowSpeedDeviceAttached:1; USHORT HighSpeedDeviceAttached:1; USHORT PortTestMode:1; USHORT PortIndicatorControl:1; USHORT Reserved1:3; };
end union
type USB_20_PORT_STATUS as _USB_20_PORT_STATUS
type PUSB_20_PORT_STATUS as _USB_20_PORT_STATUS ptr
const USB_PORT_STATUS_CONNECT = &h0001
const USB_PORT_STATUS_ENABLE = &h0002
const USB_PORT_STATUS_SUSPEND = &h0004
const USB_PORT_STATUS_OVER_CURRENT = &h0008
const USB_PORT_STATUS_RESET = &h0010
const USB_PORT_STATUS_POWER = &h0100
const USB_PORT_STATUS_LOW_SPEED = &h0200
const USB_PORT_STATUS_HIGH_SPEED = &h0400
union _USB_20_PORT_CHANGE
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT ConnectStatusChange:1; USHORT PortEnableDisableChange:1; USHORT SuspendChange:1; USHORT OverCurrentIndicatorChange:1; USHORT ResetChange:1; USHORT Reserved2:11; };
end union
type USB_20_PORT_CHANGE as _USB_20_PORT_CHANGE
type PUSB_20_PORT_CHANGE as _USB_20_PORT_CHANGE ptr
union _USB_30_PORT_STATUS
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT CurrentConnectStatus:1; USHORT PortEnabledDisabled:1; USHORT Reserved0:1; USHORT OverCurrent:1; USHORT Reset:1; USHORT PortLinkState:4; USHORT PortPower:1; USHORT NegotiatedDeviceSpeed:3; USHORT Reserved1:3; };
end union
type USB_30_PORT_STATUS as _USB_30_PORT_STATUS
type PUSB_30_PORT_STATUS as _USB_30_PORT_STATUS ptr
const PORT_LINK_STATE_U0 = 0
const PORT_LINK_STATE_U1 = 1
const PORT_LINK_STATE_U2 = 2
const PORT_LINK_STATE_U3 = 3
const PORT_LINK_STATE_DISABLED = 4
const PORT_LINK_STATE_RX_DETECT = 5
const PORT_LINK_STATE_INACTIVE = 6
const PORT_LINK_STATE_POLLING = 7
const PORT_LINK_STATE_RECOVERY = 8
const PORT_LINK_STATE_HOT_RESET = 9
const PORT_LINK_STATE_COMPLIANCE_MODE = 10
const PORT_LINK_STATE_LOOPBACK = 11
const PORT_LINK_STATE_TEST_MODE = 11
union _USB_30_PORT_CHANGE
AsUshort16 as USHORT
'' TODO: __C89_NAMELESS struct { USHORT ConnectStatusChange:1; USHORT Reserved2:2; USHORT OverCurrentIndicatorChange:1; USHORT ResetChange:1; USHORT BHResetChange:1; USHORT PortLinkStateChange:1; USHORT PortConfigErrorChange:1; USHORT Reserved3:8; };
end union
type USB_30_PORT_CHANGE as _USB_30_PORT_CHANGE
type PUSB_30_PORT_CHANGE as _USB_30_PORT_CHANGE ptr
union _USB_PORT_STATUS
AsUshort16 as USHORT
Usb20PortStatus as USB_20_PORT_STATUS
Usb30PortStatus as USB_30_PORT_STATUS
end union
type USB_PORT_STATUS as _USB_PORT_STATUS
type PUSB_PORT_STATUS as _USB_PORT_STATUS ptr
union _USB_PORT_CHANGE
AsUshort16 as USHORT
Usb20PortChange as USB_20_PORT_CHANGE
Usb30PortChange as USB_30_PORT_CHANGE
end union
type USB_PORT_CHANGE as _USB_PORT_CHANGE
type PUSB_PORT_CHANGE as _USB_PORT_CHANGE ptr
union _USB_PORT_EXT_STATUS
AsUlong32 as ULONG
'' TODO: __C89_NAMELESS struct { ULONG RxSublinkSpeedID:4; ULONG TxSublinkSpeedID:4; ULONG RxLaneCount:4; ULONG TxLaneCount:4; ULONG Reserved:16; };
end union
type USB_PORT_EXT_STATUS as _USB_PORT_EXT_STATUS
type PUSB_PORT_EXT_STATUS as _USB_PORT_EXT_STATUS ptr
union _USB_PORT_STATUS_AND_CHANGE
AsUlong32 as ULONG
'' TODO: __C89_NAMELESS struct { USB_PORT_STATUS PortStatus; USB_PORT_CHANGE PortChange; };
end union
type USB_PORT_STATUS_AND_CHANGE as _USB_PORT_STATUS_AND_CHANGE
type PUSB_PORT_STATUS_AND_CHANGE as _USB_PORT_STATUS_AND_CHANGE ptr
union _USB_PORT_EXT_STATUS_AND_CHANGE
AsUlong64 as ULONG64
'' TODO: __C89_NAMELESS struct { USB_PORT_STATUS_AND_CHANGE PortStatusChange; USB_PORT_EXT_STATUS PortExtStatus; };
end union
type USB_PORT_EXT_STATUS_AND_CHANGE as _USB_PORT_EXT_STATUS_AND_CHANGE
type PUSB_PORT_EXT_STATUS_AND_CHANGE as _USB_PORT_EXT_STATUS_AND_CHANGE ptr
union _USB_HUB_30_PORT_REMOTE_WAKE_MASK
AsUchar8 as UCHAR
'' TODO: __C89_NAMELESS struct { UCHAR ConnectRemoteWakeEnable:1; UCHAR DisconnectRemoteWakeEnable:1; UCHAR OverCurrentRemoteWakeEnable:1; UCHAR Reserved0:5; };
end union
type USB_HUB_30_PORT_REMOTE_WAKE_MASK as _USB_HUB_30_PORT_REMOTE_WAKE_MASK
type PUSB_HUB_30_PORT_REMOTE_WAKE_MASK as _USB_HUB_30_PORT_REMOTE_WAKE_MASK ptr
union _USB_FUNCTION_SUSPEND_OPTIONS
AsUchar as UCHAR
'' TODO: __C89_NAMELESS struct { UCHAR PowerState:1; UCHAR RemoteWakeEnabled:1; UCHAR Reserved:6; };
end union
type USB_FUNCTION_SUSPEND_OPTIONS as _USB_FUNCTION_SUSPEND_OPTIONS
type PUSB_FUNCTION_SUSPEND_OPTIONS as _USB_FUNCTION_SUSPEND_OPTIONS ptr
const USB_FEATURE_INTERFACE_POWER_D0 = &h0002
const USB_FEATURE_INTERFACE_POWER_D1 = &h0003
const USB_FEATURE_INTERFACE_POWER_D2 = &h0004
const USB_FEATURE_INTERFACE_POWER_D3 = &h0005
const USB_SUPPORT_D0_COMMAND = &h01
const USB_SUPPORT_D1_COMMAND = &h02
const USB_SUPPORT_D2_COMMAND = &h04
const USB_SUPPORT_D3_COMMAND = &h08
const USB_SUPPORT_D1_WAKEUP = &h10
const USB_SUPPORT_D2_WAKEUP = &h20
type _USB_CONFIGURATION_POWER_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
SelfPowerConsumedD0(0 to 2) as UCHAR
bPowerSummaryId as UCHAR
bBusPowerSavingD1 as UCHAR
bSelfPowerSavingD1 as UCHAR
bBusPowerSavingD2 as UCHAR
bSelfPowerSavingD2 as UCHAR
bBusPowerSavingD3 as UCHAR
bSelfPowerSavingD3 as UCHAR
TransitionTimeFromD1 as USHORT
TransitionTimeFromD2 as USHORT
TransitionTimeFromD3 as USHORT
end type
type USB_CONFIGURATION_POWER_DESCRIPTOR as _USB_CONFIGURATION_POWER_DESCRIPTOR
type PUSB_CONFIGURATION_POWER_DESCRIPTOR as _USB_CONFIGURATION_POWER_DESCRIPTOR ptr
type _USB_INTERFACE_POWER_DESCRIPTOR
bLength as UCHAR
bDescriptorType as UCHAR
bmCapabilitiesFlags as UCHAR
bBusPowerSavingD1 as UCHAR
bSelfPowerSavingD1 as UCHAR
bBusPowerSavingD2 as UCHAR
bSelfPowerSavingD2 as UCHAR
bBusPowerSavingD3 as UCHAR
bSelfPowerSavingD3 as UCHAR
TransitionTimeFromD1 as USHORT
TransitionTimeFromD2 as USHORT
TransitionTimeFromD3 as USHORT
end type
type USB_INTERFACE_POWER_DESCRIPTOR as _USB_INTERFACE_POWER_DESCRIPTOR
type PUSB_INTERFACE_POWER_DESCRIPTOR as _USB_INTERFACE_POWER_DESCRIPTOR ptr
#define __USB200_H__
const USB_PORTATTR_NO_CONNECTOR = &h00000001
const USB_PORTATTR_SHARED_USB2 = &h00000002
const USB_PORTATTR_MINI_CONNECTOR = &h00000004
const USB_PORTATTR_OEM_CONNECTOR = &h00000008
const USB_PORTATTR_OWNED_BY_CC = &h01000000
const USB_PORTATTR_NO_OVERCURRENT_UI = &h02000000
type _USB_CONTROLLER_FLAVOR as long
enum
USB_HcGeneric = 0
OHCI_Generic = 100
OHCI_Hydra
OHCI_NEC
UHCI_Generic = 200
UHCI_Piix4 = 201
UHCI_Piix3 = 202
UHCI_Ich2 = 203
UHCI_Reserved204 = 204
UHCI_Ich1 = 205
UHCI_Ich3m = 206
UHCI_Ich4 = 207
UHCI_Ich5 = 208
UHCI_Ich6 = 209
UHCI_Intel = 249
UHCI_VIA = 250
UHCI_VIA_x01 = 251
UHCI_VIA_x02 = 252
UHCI_VIA_x03 = 253
UHCI_VIA_x04 = 254
UHCI_VIA_x0E_FIFO = 264
EHCI_Generic = 1000
EHCI_NEC = 2000
EHCI_Lucent = 3000
EHCI_NVIDIA_Tegra2 = 4000
EHCI_NVIDIA_Tegra3 = 4001
EHCI_Intel_Medfield = 5001
end enum
type USB_CONTROLLER_FLAVOR as _USB_CONTROLLER_FLAVOR
const USB_DEFAULT_DEVICE_ADDRESS = 0
const USB_DEFAULT_ENDPOINT_ADDRESS = 0
const USB_DEFAULT_MAX_PACKET = 64
#define URB_FROM_IRP(Irp) IoGetCurrentIrpStackLocation(Irp)->Parameters.Others.Argument1
const URB_FUNCTION_SELECT_CONFIGURATION = &h0000
const URB_FUNCTION_SELECT_INTERFACE = &h0001
const URB_FUNCTION_ABORT_PIPE = &h0002
const URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL = &h0003
const URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL = &h0004
const URB_FUNCTION_GET_FRAME_LENGTH = &h0005
const URB_FUNCTION_SET_FRAME_LENGTH = &h0006
const URB_FUNCTION_GET_CURRENT_FRAME_NUMBER = &h0007
const URB_FUNCTION_CONTROL_TRANSFER = &h0008
const URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER = &h0009
const URB_FUNCTION_ISOCH_TRANSFER = &h000a
const URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE = &h000b
const URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE = &h000c
const URB_FUNCTION_SET_FEATURE_TO_DEVICE = &h000d
const URB_FUNCTION_SET_FEATURE_TO_INTERFACE = &h000e
const URB_FUNCTION_SET_FEATURE_TO_ENDPOINT = &h000f
const URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE = &h0010
const URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE = &h0011
const URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT = &h0012
const URB_FUNCTION_GET_STATUS_FROM_DEVICE = &h0013
const URB_FUNCTION_GET_STATUS_FROM_INTERFACE = &h0014
const URB_FUNCTION_GET_STATUS_FROM_ENDPOINT = &h0015
const URB_FUNCTION_RESERVED_0X0016 = &h0016
const URB_FUNCTION_VENDOR_DEVICE = &h0017
const URB_FUNCTION_VENDOR_INTERFACE = &h0018
const URB_FUNCTION_VENDOR_ENDPOINT = &h0019
const URB_FUNCTION_CLASS_DEVICE = &h001a
const URB_FUNCTION_CLASS_INTERFACE = &h001b
const URB_FUNCTION_CLASS_ENDPOINT = &h001c
const URB_FUNCTION_RESERVE_0X001D = &h001d
const URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL = &h001e
const URB_FUNCTION_CLASS_OTHER = &h001f
const URB_FUNCTION_VENDOR_OTHER = &h0020
const URB_FUNCTION_GET_STATUS_FROM_OTHER = &h0021
const URB_FUNCTION_CLEAR_FEATURE_TO_OTHER = &h0022
const URB_FUNCTION_SET_FEATURE_TO_OTHER = &h0023
const URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT = &h0024
const URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT = &h0025
const URB_FUNCTION_GET_CONFIGURATION = &h0026
const URB_FUNCTION_GET_INTERFACE = &h0027
const URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE = &h0028
const URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE = &h0029
const URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR = &h002a
const URB_FUNCTION_RESERVE_0X002B = &h002b
const URB_FUNCTION_RESERVE_0X002C = &h002c
const URB_FUNCTION_RESERVE_0X002D = &h002d
const URB_FUNCTION_RESERVE_0X002E = &h002e
const URB_FUNCTION_RESERVE_0X002F = &h002f
const URB_FUNCTION_SYNC_RESET_PIPE = &h0030
const URB_FUNCTION_SYNC_CLEAR_STALL = &h0031
const URB_FUNCTION_RESET_PIPE = URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
const USBD_TRANSFER_DIRECTION = &h00000001
const USBD_SHORT_TRANSFER_OK = &h00000002
const USBD_START_ISO_TRANSFER_ASAP = &h00000004
const USBD_DEFAULT_PIPE_TRANSFER = &h00000008
#define USBD_TRANSFER_DIRECTION_FLAG(flags) ((flags) and USBD_TRANSFER_DIRECTION)
const USBD_TRANSFER_DIRECTION_OUT = 0
const USBD_TRANSFER_DIRECTION_IN = 1
const VALID_TRANSFER_FLAGS_MASK = ((USBD_SHORT_TRANSFER_OK or USBD_TRANSFER_DIRECTION) or USBD_START_ISO_TRANSFER_ASAP) or USBD_DEFAULT_PIPE_TRANSFER
const USBD_ISO_START_FRAME_RANGE = 1024
type USBD_STATUS as LONG
#define USBD_SUCCESS(Status) (cast(USBD_STATUS, (Status)) >= 0)
#define USBD_PENDING(Status) ((ULONG(Status) shr 30) = 1)
#define USBD_ERROR(Status) (cast(USBD_STATUS, (Status)) < 0)
const USBD_STATUS_SUCCESS = cast(USBD_STATUS, &h00000000)
const USBD_STATUS_PENDING = cast(USBD_STATUS, &h40000000)
const USBD_STATUS_CRC = cast(USBD_STATUS, &hc0000001)
const USBD_STATUS_BTSTUFF = cast(USBD_STATUS, &hc0000002)
const USBD_STATUS_DATA_TOGGLE_MISMATCH = cast(USBD_STATUS, &hc0000003)
const USBD_STATUS_STALL_PID = cast(USBD_STATUS, &hc0000004)
const USBD_STATUS_DEV_NOT_RESPONDING = cast(USBD_STATUS, &hc0000005)
const USBD_STATUS_PID_CHECK_FAILURE = cast(USBD_STATUS, &hc0000006)
const USBD_STATUS_UNEXPECTED_PID = cast(USBD_STATUS, &hc0000007)
const USBD_STATUS_DATA_OVERRUN = cast(USBD_STATUS, &hc0000008)
const USBD_STATUS_DATA_UNDERRUN = cast(USBD_STATUS, &hc0000009)
const USBD_STATUS_RESERVED1 = cast(USBD_STATUS, &hc000000a)
const USBD_STATUS_RESERVED2 = cast(USBD_STATUS, &hc000000b)
const USBD_STATUS_BUFFER_OVERRUN = cast(USBD_STATUS, &hc000000c)
const USBD_STATUS_BUFFER_UNDERRUN = cast(USBD_STATUS, &hc000000d)
const USBD_STATUS_NOT_ACCESSED = cast(USBD_STATUS, &hc000000f)
const USBD_STATUS_FIFO = cast(USBD_STATUS, &hc0000010)
const USBD_STATUS_XACT_ERROR = cast(USBD_STATUS, &hc0000011)
const USBD_STATUS_BABBLE_DETECTED = cast(USBD_STATUS, &hc0000012)
const USBD_STATUS_DATA_BUFFER_ERROR = cast(USBD_STATUS, &hc0000013)
const USBD_STATUS_NO_PING_RESPONSE = cast(USBD_STATUS, &hc0000014)
const USBD_STATUS_INVALID_STREAM_TYPE = cast(USBD_STATUS, &hc0000015)
const USBD_STATUS_INVALID_STREAM_ID = cast(USBD_STATUS, &hc0000016)
const USBD_STATUS_ENDPOINT_HALTED = cast(USBD_STATUS, &hc0000030)
const USBD_STATUS_INVALID_URB_FUNCTION = cast(USBD_STATUS, &h80000200)
const USBD_STATUS_INVALID_PARAMETER = cast(USBD_STATUS, &h80000300)
const USBD_STATUS_ERROR_BUSY = cast(USBD_STATUS, &h80000400)
const USBD_STATUS_INVALID_PIPE_HANDLE = cast(USBD_STATUS, &h80000600)
const USBD_STATUS_NO_BANDWIDTH = cast(USBD_STATUS, &h80000700)
const USBD_STATUS_INTERNAL_HC_ERROR = cast(USBD_STATUS, &h80000800)
const USBD_STATUS_ERROR_SHORT_TRANSFER = cast(USBD_STATUS, &h80000900)
const USBD_STATUS_BAD_START_FRAME = cast(USBD_STATUS, &hc0000a00)
const USBD_STATUS_ISOCH_REQUEST_FAILED = cast(USBD_STATUS, &hc0000b00)
const USBD_STATUS_FRAME_CONTROL_OWNED = cast(USBD_STATUS, &hc0000c00)
const USBD_STATUS_FRAME_CONTROL_NOT_OWNED = cast(USBD_STATUS, &hc0000d00)
const USBD_STATUS_NOT_SUPPORTED = cast(USBD_STATUS, &hc0000e00)
const USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR = cast(USBD_STATUS, &hc0000f00)
const USBD_STATUS_INSUFFICIENT_RESOURCES = cast(USBD_STATUS, &hc0001000)
const USBD_STATUS_SET_CONFIG_FAILED = cast(USBD_STATUS, &hc0002000)
const USBD_STATUS_BUFFER_TOO_SMALL = cast(USBD_STATUS, &hc0003000)
const USBD_STATUS_INTERFACE_NOT_FOUND = cast(USBD_STATUS, &hc0004000)
const USBD_STATUS_INAVLID_PIPE_FLAGS = cast(USBD_STATUS, &hc0005000)
const USBD_STATUS_TIMEOUT = cast(USBD_STATUS, &hc0006000)
const USBD_STATUS_DEVICE_GONE = cast(USBD_STATUS, &hc0007000)
const USBD_STATUS_STATUS_NOT_MAPPED = cast(USBD_STATUS, &hc0008000)
const USBD_STATUS_HUB_INTERNAL_ERROR = cast(USBD_STATUS, &hc0009000)
const USBD_STATUS_CANCELED = cast(USBD_STATUS, &hc0010000)
const USBD_STATUS_ISO_NOT_ACCESSED_BY_HW = cast(USBD_STATUS, &hc0020000)
const USBD_STATUS_ISO_TD_ERROR = cast(USBD_STATUS, &hc0030000)
const USBD_STATUS_ISO_NA_LATE_USBPORT = cast(USBD_STATUS, &hc0040000)
const USBD_STATUS_ISO_NOT_ACCESSED_LATE = cast(USBD_STATUS, &hc0050000)
const USBD_STATUS_BAD_DESCRIPTOR = cast(USBD_STATUS, &hc0100000)
const USBD_STATUS_BAD_DESCRIPTOR_BLEN = cast(USBD_STATUS, &hc0100001)
const USBD_STATUS_BAD_DESCRIPTOR_TYPE = cast(USBD_STATUS, &hc0100002)
const USBD_STATUS_BAD_INTERFACE_DESCRIPTOR = cast(USBD_STATUS, &hc0100003)
const USBD_STATUS_BAD_ENDPOINT_DESCRIPTOR = cast(USBD_STATUS, &hc0100004)
const USBD_STATUS_BAD_INTERFACE_ASSOC_DESCRIPTOR = cast(USBD_STATUS, &hc0100005)
const USBD_STATUS_BAD_CONFIG_DESC_LENGTH = cast(USBD_STATUS, &hc0100006)
const USBD_STATUS_BAD_NUMBER_OF_INTERFACES = cast(USBD_STATUS, &hc0100007)
const USBD_STATUS_BAD_NUMBER_OF_ENDPOINTS = cast(USBD_STATUS, &hc0100008)
const USBD_STATUS_BAD_ENDPOINT_ADDRESS = cast(USBD_STATUS, &hc0100009)
type USBD_PIPE_HANDLE as PVOID
type USBD_CONFIGURATION_HANDLE as PVOID
type USBD_INTERFACE_HANDLE as PVOID
const USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE = &hffffffff
type _USBD_VERSION_INFORMATION
USBDI_Version as ULONG
Supported_USB_Version as ULONG
end type
type USBD_VERSION_INFORMATION as _USBD_VERSION_INFORMATION
type PUSBD_VERSION_INFORMATION as _USBD_VERSION_INFORMATION ptr
type _USBD_PIPE_TYPE as long
enum
UsbdPipeTypeControl
UsbdPipeTypeIsochronous
UsbdPipeTypeBulk
UsbdPipeTypeInterrupt
end enum
type USBD_PIPE_TYPE as _USBD_PIPE_TYPE
#define USBD_PIPE_DIRECTION_IN(pipeInformation) ((pipeInformation)->EndpointAddress and USB_ENDPOINT_DIRECTION_MASK)
type _USBD_DEVICE_INFORMATION
OffsetNext as ULONG
UsbdDeviceHandle as PVOID
DeviceDescriptor as USB_DEVICE_DESCRIPTOR
end type
type USBD_DEVICE_INFORMATION as _USBD_DEVICE_INFORMATION
type PUSBD_DEVICE_INFORMATION as _USBD_DEVICE_INFORMATION ptr
type _USBD_PIPE_INFORMATION
MaximumPacketSize as USHORT
EndpointAddress as UCHAR
Interval as UCHAR
PipeType as USBD_PIPE_TYPE