8edf7a9f5526b79358517863a049733e7c56fe09
[reactos.git] / reactos / include / psdk / usb.h
1 #pragma once
2
3 /* Helper macro to enable gcc's extension. */
4 #ifndef __GNU_EXTENSION
5 #ifdef __GNUC__
6 #define __GNU_EXTENSION __extension__
7 #else
8 #define __GNU_EXTENSION
9 #endif
10 #endif
11
12 #ifdef OSR21_COMPAT
13 #pragma message("WARNING: OSR21_COMPAT SWITCH NOT SUPPORTED")
14 #endif
15
16 #ifndef _NTDDK_
17 #ifndef _WDMDDK_
18 typedef PVOID PIRP;
19 typedef PVOID PMDL;
20 #endif
21 #endif
22
23 #define USBDI_VERSION 0x00000600
24
25 #include "usb200.h"
26
27 #define USB_PORTATTR_NO_CONNECTOR 0x00000001
28 #define USB_PORTATTR_SHARED_USB2 0x00000002
29 #define USB_PORTATTR_MINI_CONNECTOR 0x00000004
30 #define USB_PORTATTR_OEM_CONNECTOR 0x00000008
31 #define USB_PORTATTR_OWNED_BY_CC 0x01000000
32 #define USB_PORTATTR_NO_OVERCURRENT_UI 0x02000000
33
34 typedef enum _USB_CONTROLLER_FLAVOR {
35 USB_HcGeneric = 0,
36 OHCI_Generic = 100,
37 OHCI_Hydra,
38 OHCI_NEC,
39 UHCI_Generic = 200,
40 UHCI_Piix4 = 201,
41 UHCI_Piix3 = 202,
42 UHCI_Ich2 = 203,
43 UHCI_Reserved204 = 204,
44 UHCI_Ich1 = 205,
45 UHCI_Ich3m = 206,
46 UHCI_Ich4 = 207,
47 UHCI_Ich5 = 208,
48 UHCI_Ich6 = 209,
49 UHCI_Intel = 249,
50 UHCI_VIA = 250,
51 UHCI_VIA_x01 = 251,
52 UHCI_VIA_x02 = 252,
53 UHCI_VIA_x03 = 253,
54 UHCI_VIA_x04 = 254,
55 UHCI_VIA_x0E_FIFO = 264,
56 EHCI_Generic = 1000,
57 EHCI_NEC = 2000,
58 EHCI_Lucent = 3000
59 } USB_CONTROLLER_FLAVOR;
60
61
62 #define USB_DEFAULT_DEVICE_ADDRESS 0
63 #define USB_DEFAULT_ENDPOINT_ADDRESS 0
64 #define USB_DEFAULT_MAX_PACKET 64
65 #define URB_FROM_IRP(Irp) ((IoGetCurrentIrpStackLocation(Irp))->Parameters.Others.Argument1)
66 #define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
67 #define URB_FUNCTION_SELECT_INTERFACE 0x0001
68 #define URB_FUNCTION_ABORT_PIPE 0x0002
69 #define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
70 #define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
71 #define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
72 #define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
73 #define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
74 #define URB_FUNCTION_CONTROL_TRANSFER 0x0008
75 #define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
76 #define URB_FUNCTION_ISOCH_TRANSFER 0x000A
77 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
78 #define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
79 #define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
80 #define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
81 #define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
82 #define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
83 #define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
84 #define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
85 #define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
86 #define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
87 #define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
88 #define URB_FUNCTION_RESERVED_0X0016 0x0016
89 #define URB_FUNCTION_VENDOR_DEVICE 0x0017
90 #define URB_FUNCTION_VENDOR_INTERFACE 0x0018
91 #define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
92 #define URB_FUNCTION_CLASS_DEVICE 0x001A
93 #define URB_FUNCTION_CLASS_INTERFACE 0x001B
94 #define URB_FUNCTION_CLASS_ENDPOINT 0x001C
95 #define URB_FUNCTION_RESERVE_0X001D 0x001D
96 #define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E
97 #define URB_FUNCTION_CLASS_OTHER 0x001F
98 #define URB_FUNCTION_VENDOR_OTHER 0x0020
99 #define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
100 #define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
101 #define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
102 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
103 #define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
104 #define URB_FUNCTION_GET_CONFIGURATION 0x0026
105 #define URB_FUNCTION_GET_INTERFACE 0x0027
106 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
107 #define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
108
109 #if (_WIN32_WINNT >= 0x0501)
110
111 #define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A
112 #define URB_FUNCTION_SYNC_RESET_PIPE 0x0030
113 #define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031
114
115 #endif
116
117 #if (_WIN32_WINNT >= 0x0600)
118
119 #define URB_FUNCTION_CONTROL_TRANSFER_EX 0x0032
120 #define URB_FUNCTION_RESERVE_0X0033 0x0033
121 #define URB_FUNCTION_RESERVE_0X0034 0x0034
122
123 #endif
124
125 #define URB_FUNCTION_RESERVE_0X002B 0x002B
126 #define URB_FUNCTION_RESERVE_0X002C 0x002C
127 #define URB_FUNCTION_RESERVE_0X002D 0x002D
128 #define URB_FUNCTION_RESERVE_0X002E 0x002E
129 #define URB_FUNCTION_RESERVE_0X002F 0x002F
130
131 #define URB_FUNCTION_RESET_PIPE URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
132
133 #define USBD_TRANSFER_DIRECTION 0x00000001
134 #define USBD_SHORT_TRANSFER_OK 0x00000002
135 #define USBD_START_ISO_TRANSFER_ASAP 0x00000004
136 #define USBD_DEFAULT_PIPE_TRANSFER 0x00000008
137 #define USBD_TRANSFER_DIRECTION_FLAG(flags) ((flags) & USBD_TRANSFER_DIRECTION)
138
139 #define USBD_TRANSFER_DIRECTION_OUT 0
140 #define USBD_TRANSFER_DIRECTION_IN 1
141 #define VALID_TRANSFER_FLAGS_MASK (USBD_SHORT_TRANSFER_OK | USBD_TRANSFER_DIRECTION | \
142 USBD_START_ISO_TRANSFER_ASAP | USBD_DEFAULT_PIPE_TRANSFER)
143 #define USBD_ISO_START_FRAME_RANGE 1024
144
145 typedef LONG USBD_STATUS;
146
147 #define USBD_SUCCESS(Status) ((USBD_STATUS)(Status) >= 0)
148 #define USBD_PENDING(Status) ((ULONG)(Status) >> 30 == 1)
149 #define USBD_ERROR(Status) ((USBD_STATUS)(Status) < 0)
150 #define USBD_STATUS_SUCCESS ((USBD_STATUS)0x00000000L)
151 #define USBD_STATUS_PENDING ((USBD_STATUS)0x40000000L)
152 #define USBD_STATUS_CRC ((USBD_STATUS)0xC0000001L)
153 #define USBD_STATUS_BTSTUFF ((USBD_STATUS)0xC0000002L)
154 #define USBD_STATUS_DATA_TOGGLE_MISMATCH ((USBD_STATUS)0xC0000003L)
155 #define USBD_STATUS_STALL_PID ((USBD_STATUS)0xC0000004L)
156 #define USBD_STATUS_DEV_NOT_RESPONDING ((USBD_STATUS)0xC0000005L)
157 #define USBD_STATUS_PID_CHECK_FAILURE ((USBD_STATUS)0xC0000006L)
158 #define USBD_STATUS_UNEXPECTED_PID ((USBD_STATUS)0xC0000007L)
159 #define USBD_STATUS_DATA_OVERRUN ((USBD_STATUS)0xC0000008L)
160 #define USBD_STATUS_DATA_UNDERRUN ((USBD_STATUS)0xC0000009L)
161 #define USBD_STATUS_RESERVED1 ((USBD_STATUS)0xC000000AL)
162 #define USBD_STATUS_RESERVED2 ((USBD_STATUS)0xC000000BL)
163 #define USBD_STATUS_BUFFER_OVERRUN ((USBD_STATUS)0xC000000CL)
164 #define USBD_STATUS_BUFFER_UNDERRUN ((USBD_STATUS)0xC000000DL)
165 #define USBD_STATUS_NOT_ACCESSED ((USBD_STATUS)0xC000000FL)
166 #define USBD_STATUS_FIFO ((USBD_STATUS)0xC0000010L)
167 #define USBD_STATUS_XACT_ERROR ((USBD_STATUS)0xC0000011L)
168 #define USBD_STATUS_BABBLE_DETECTED ((USBD_STATUS)0xC0000012L)
169 #define USBD_STATUS_DATA_BUFFER_ERROR ((USBD_STATUS)0xC0000013L)
170 #define USBD_STATUS_ENDPOINT_HALTED ((USBD_STATUS)0xC0000030L)
171 #define USBD_STATUS_INVALID_URB_FUNCTION ((USBD_STATUS)0x80000200L)
172 #define USBD_STATUS_INVALID_PARAMETER ((USBD_STATUS)0x80000300L)
173 #define USBD_STATUS_ERROR_BUSY ((USBD_STATUS)0x80000400L)
174 #define USBD_STATUS_INVALID_PIPE_HANDLE ((USBD_STATUS)0x80000600L)
175 #define USBD_STATUS_NO_BANDWIDTH ((USBD_STATUS)0x80000700L)
176 #define USBD_STATUS_INTERNAL_HC_ERROR ((USBD_STATUS)0x80000800L)
177 #define USBD_STATUS_ERROR_SHORT_TRANSFER ((USBD_STATUS)0x80000900L)
178 #define USBD_STATUS_BAD_START_FRAME ((USBD_STATUS)0xC0000A00L)
179 #define USBD_STATUS_ISOCH_REQUEST_FAILED ((USBD_STATUS)0xC0000B00L)
180 #define USBD_STATUS_FRAME_CONTROL_OWNED ((USBD_STATUS)0xC0000C00L)
181 #define USBD_STATUS_FRAME_CONTROL_NOT_OWNED ((USBD_STATUS)0xC0000D00L)
182 #define USBD_STATUS_NOT_SUPPORTED ((USBD_STATUS)0xC0000E00L)
183 #define USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR ((USBD_STATUS)0xC0000F00L)
184 #define USBD_STATUS_INSUFFICIENT_RESOURCES ((USBD_STATUS)0xC0001000L)
185 #define USBD_STATUS_SET_CONFIG_FAILED ((USBD_STATUS)0xC0002000L)
186 #define USBD_STATUS_BUFFER_TOO_SMALL ((USBD_STATUS)0xC0003000L)
187 #define USBD_STATUS_INTERFACE_NOT_FOUND ((USBD_STATUS)0xC0004000L)
188 #define USBD_STATUS_INAVLID_PIPE_FLAGS ((USBD_STATUS)0xC0005000L)
189 #define USBD_STATUS_TIMEOUT ((USBD_STATUS)0xC0006000L)
190 #define USBD_STATUS_DEVICE_GONE ((USBD_STATUS)0xC0007000L)
191 #define USBD_STATUS_STATUS_NOT_MAPPED ((USBD_STATUS)0xC0008000L)
192 #define USBD_STATUS_HUB_INTERNAL_ERROR ((USBD_STATUS)0xC0009000L)
193 #define USBD_STATUS_CANCELED ((USBD_STATUS)0xC0010000L)
194 #define USBD_STATUS_ISO_NOT_ACCESSED_BY_HW ((USBD_STATUS)0xC0020000L)
195 #define USBD_STATUS_ISO_TD_ERROR ((USBD_STATUS)0xC0030000L)
196 #define USBD_STATUS_ISO_NA_LATE_USBPORT ((USBD_STATUS)0xC0040000L)
197 #define USBD_STATUS_ISO_NOT_ACCESSED_LATE ((USBD_STATUS)0xC0050000L)
198 #define USBD_STATUS_BAD_DESCRIPTOR ((USBD_STATUS)0xC0100000L)
199 #define USBD_STATUS_BAD_DESCRIPTOR_BLEN ((USBD_STATUS)0xC0100001L)
200 #define USBD_STATUS_BAD_DESCRIPTOR_TYPE ((USBD_STATUS)0xC0100002L)
201 #define USBD_STATUS_BAD_INTERFACE_DESCRIPTOR ((USBD_STATUS)0xC0100003L)
202 #define USBD_STATUS_BAD_ENDPOINT_DESCRIPTOR ((USBD_STATUS)0xC0100004L)
203 #define USBD_STATUS_BAD_INTERFACE_ASSOC_DESCRIPTOR ((USBD_STATUS)0xC0100005L)
204 #define USBD_STATUS_BAD_CONFIG_DESC_LENGTH ((USBD_STATUS)0xC0100006L)
205 #define USBD_STATUS_BAD_NUMBER_OF_INTERFACES ((USBD_STATUS)0xC0100007L)
206 #define USBD_STATUS_BAD_NUMBER_OF_ENDPOINTS ((USBD_STATUS)0xC0100008L)
207 #define USBD_STATUS_BAD_ENDPOINT_ADDRESS ((USBD_STATUS)0xC0100009L)
208
209 typedef PVOID USBD_PIPE_HANDLE;
210 typedef PVOID USBD_CONFIGURATION_HANDLE;
211 typedef PVOID USBD_INTERFACE_HANDLE;
212
213 #if (_WIN32_WINNT >= 0x0501)
214 #define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE 0xFFFFFFFF
215 #else
216 #define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE PAGE_SIZE
217 #endif
218
219 typedef struct _USBD_VERSION_INFORMATION {
220 ULONG USBDI_Version;
221 ULONG Supported_USB_Version;
222 } USBD_VERSION_INFORMATION, *PUSBD_VERSION_INFORMATION;
223
224 typedef enum _USBD_PIPE_TYPE {
225 UsbdPipeTypeControl,
226 UsbdPipeTypeIsochronous,
227 UsbdPipeTypeBulk,
228 UsbdPipeTypeInterrupt
229 } USBD_PIPE_TYPE;
230
231 #define USBD_PIPE_DIRECTION_IN(pipeInformation) ((pipeInformation)->EndpointAddress & USB_ENDPOINT_DIRECTION_MASK)
232
233 typedef struct _USBD_DEVICE_INFORMATION {
234 ULONG OffsetNext;
235 PVOID UsbdDeviceHandle;
236 USB_DEVICE_DESCRIPTOR DeviceDescriptor;
237 } USBD_DEVICE_INFORMATION, *PUSBD_DEVICE_INFORMATION;
238
239 typedef struct _USBD_PIPE_INFORMATION {
240 USHORT MaximumPacketSize;
241 UCHAR EndpointAddress;
242 UCHAR Interval;
243 USBD_PIPE_TYPE PipeType;
244 USBD_PIPE_HANDLE PipeHandle;
245 ULONG MaximumTransferSize;
246 ULONG PipeFlags;
247 } USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION;
248
249 #define USBD_PF_CHANGE_MAX_PACKET 0x00000001
250 #define USBD_PF_SHORT_PACKET_OPT 0x00000002
251 #define USBD_PF_ENABLE_RT_THREAD_ACCESS 0x00000004
252 #define USBD_PF_MAP_ADD_TRANSFERS 0x00000008
253 #define USBD_PF_VALID_MASK (USBD_PF_CHANGE_MAX_PACKET | USBD_PF_SHORT_PACKET_OPT | \
254 USBD_PF_ENABLE_RT_THREAD_ACCESS | USBD_PF_MAP_ADD_TRANSFERS)
255
256 typedef struct _USBD_INTERFACE_INFORMATION {
257 USHORT Length;
258 UCHAR InterfaceNumber;
259 UCHAR AlternateSetting;
260 UCHAR Class;
261 UCHAR SubClass;
262 UCHAR Protocol;
263 UCHAR Reserved;
264 USBD_INTERFACE_HANDLE InterfaceHandle;
265 ULONG NumberOfPipes;
266 USBD_PIPE_INFORMATION Pipes[1];
267 } USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION;
268
269 struct _URB_HCD_AREA {
270 PVOID Reserved8[8];
271 };
272
273 struct _URB_HEADER {
274 USHORT Length;
275 USHORT Function;
276 USBD_STATUS Status;
277 PVOID UsbdDeviceHandle;
278 ULONG UsbdFlags;
279 };
280
281 struct _URB_SELECT_INTERFACE {
282 struct _URB_HEADER Hdr;
283 USBD_CONFIGURATION_HANDLE ConfigurationHandle;
284 USBD_INTERFACE_INFORMATION Interface;
285 };
286
287 struct _URB_SELECT_CONFIGURATION {
288 struct _URB_HEADER Hdr;
289 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
290 USBD_CONFIGURATION_HANDLE ConfigurationHandle;
291 USBD_INTERFACE_INFORMATION Interface;
292 };
293
294 struct _URB_PIPE_REQUEST {
295 struct _URB_HEADER Hdr;
296 USBD_PIPE_HANDLE PipeHandle;
297 ULONG Reserved;
298 };
299
300 struct _URB_FRAME_LENGTH_CONTROL {
301 struct _URB_HEADER Hdr;
302 };
303
304 struct _URB_GET_FRAME_LENGTH {
305 struct _URB_HEADER Hdr;
306 ULONG FrameLength;
307 ULONG FrameNumber;
308 };
309
310 struct _URB_SET_FRAME_LENGTH {
311 struct _URB_HEADER Hdr;
312 LONG FrameLengthDelta;
313 };
314
315 struct _URB_GET_CURRENT_FRAME_NUMBER {
316 struct _URB_HEADER Hdr;
317 ULONG FrameNumber;
318 };
319
320 struct _URB_CONTROL_DESCRIPTOR_REQUEST {
321 struct _URB_HEADER Hdr;
322 PVOID Reserved;
323 ULONG Reserved0;
324 ULONG TransferBufferLength;
325 PVOID TransferBuffer;
326 PMDL TransferBufferMDL;
327 struct _URB *UrbLink;
328 struct _URB_HCD_AREA hca;
329 USHORT Reserved1;
330 UCHAR Index;
331 UCHAR DescriptorType;
332 USHORT LanguageId;
333 USHORT Reserved2;
334 };
335
336 struct _URB_CONTROL_GET_STATUS_REQUEST {
337 struct _URB_HEADER Hdr;
338 PVOID Reserved;
339 ULONG Reserved0;
340 ULONG TransferBufferLength;
341 PVOID TransferBuffer;
342 PMDL TransferBufferMDL;
343 struct _URB *UrbLink;
344 struct _URB_HCD_AREA hca;
345 UCHAR Reserved1[4];
346 USHORT Index;
347 USHORT Reserved2;
348 };
349
350 struct _URB_CONTROL_FEATURE_REQUEST {
351 struct _URB_HEADER Hdr;
352 PVOID Reserved;
353 ULONG Reserved2;
354 ULONG Reserved3;
355 PVOID Reserved4;
356 PMDL Reserved5;
357 struct _URB *UrbLink;
358 struct _URB_HCD_AREA hca;
359 USHORT Reserved0;
360 USHORT FeatureSelector;
361 USHORT Index;
362 USHORT Reserved1;
363 };
364
365 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST {
366 struct _URB_HEADER Hdr;
367 PVOID Reserved;
368 ULONG TransferFlags;
369 ULONG TransferBufferLength;
370 PVOID TransferBuffer;
371 PMDL TransferBufferMDL;
372 struct _URB *UrbLink;
373 struct _URB_HCD_AREA hca;
374 UCHAR RequestTypeReservedBits;
375 UCHAR Request;
376 USHORT Value;
377 USHORT Index;
378 USHORT Reserved1;
379 };
380
381 struct _URB_CONTROL_GET_INTERFACE_REQUEST {
382 struct _URB_HEADER Hdr;
383 PVOID Reserved;
384 ULONG Reserved0;
385 ULONG TransferBufferLength;
386 PVOID TransferBuffer;
387 PMDL TransferBufferMDL;
388 struct _URB *UrbLink;
389 struct _URB_HCD_AREA hca;
390 UCHAR Reserved1[4];
391 USHORT Interface;
392 USHORT Reserved2;
393 };
394
395 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST {
396 struct _URB_HEADER Hdr;
397 PVOID Reserved;
398 ULONG Reserved0;
399 ULONG TransferBufferLength;
400 PVOID TransferBuffer;
401 PMDL TransferBufferMDL;
402 struct _URB *UrbLink;
403 struct _URB_HCD_AREA hca;
404 UCHAR Reserved1[8];
405 };
406
407 #if (_WIN32_WINNT >= 0x0501)
408
409 #define OS_STRING_DESCRIPTOR_INDEX 0xEE
410 #define MS_GENRE_DESCRIPTOR_INDEX 0x0001
411 #define MS_POWER_DESCRIPTOR_INDEX 0x0002
412 #define MS_OS_STRING_SIGNATURE L"MSFT100"
413 #define MS_OS_FLAGS_CONTAINERID 0x02
414
415 typedef struct _OS_STRING {
416 UCHAR bLength;
417 UCHAR bDescriptorType;
418 WCHAR MicrosoftString[7];
419 UCHAR bVendorCode;
420 union {
421 UCHAR bPad;
422 UCHAR bFlags;
423 };
424 } OS_STRING, *POS_STRING;
425
426 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST {
427 struct _URB_HEADER Hdr;
428 PVOID Reserved;
429 ULONG Reserved0;
430 ULONG TransferBufferLength;
431 PVOID TransferBuffer;
432 PMDL TransferBufferMDL;
433 struct _URB *UrbLink;
434 struct _URB_HCD_AREA hca;
435 UCHAR Recipient:5;
436 UCHAR Reserved1:3;
437 UCHAR Reserved2;
438 UCHAR InterfaceNumber;
439 UCHAR MS_PageIndex;
440 USHORT MS_FeatureDescriptorIndex;
441 USHORT Reserved3;
442 };
443
444 #endif
445
446 struct _URB_CONTROL_TRANSFER {
447 struct _URB_HEADER Hdr;
448 USBD_PIPE_HANDLE PipeHandle;
449 ULONG TransferFlags;
450 ULONG TransferBufferLength;
451 PVOID TransferBuffer;
452 PMDL TransferBufferMDL;
453 struct _URB *UrbLink;
454 struct _URB_HCD_AREA hca;
455 UCHAR SetupPacket[8];
456 };
457
458 #if (_WIN32_WINNT >= 0x0600)
459
460 struct _URB_CONTROL_TRANSFER_EX {
461 struct _URB_HEADER Hdr;
462 USBD_PIPE_HANDLE PipeHandle;
463 ULONG TransferFlags;
464 ULONG TransferBufferLength;
465 PVOID TransferBuffer;
466 PMDL TransferBufferMDL;
467 ULONG Timeout;
468 #ifdef WIN64
469 ULONG Pad;
470 #endif
471 struct _URB_HCD_AREA hca;
472 UCHAR SetupPacket[8];
473 };
474
475 #endif
476
477 struct _URB_BULK_OR_INTERRUPT_TRANSFER {
478 struct _URB_HEADER Hdr;
479 USBD_PIPE_HANDLE PipeHandle;
480 ULONG TransferFlags;
481 ULONG TransferBufferLength;
482 PVOID TransferBuffer;
483 PMDL TransferBufferMDL;
484 struct _URB *UrbLink;
485 struct _URB_HCD_AREA hca;
486 };
487
488 typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
489 ULONG Offset;
490 ULONG Length;
491 USBD_STATUS Status;
492 } USBD_ISO_PACKET_DESCRIPTOR, *PUSBD_ISO_PACKET_DESCRIPTOR;
493
494 struct _URB_ISOCH_TRANSFER {
495 struct _URB_HEADER Hdr;
496 USBD_PIPE_HANDLE PipeHandle;
497 ULONG TransferFlags;
498 ULONG TransferBufferLength;
499 PVOID TransferBuffer;
500 PMDL TransferBufferMDL;
501 struct _URB *UrbLink;
502 struct _URB_HCD_AREA hca;
503 ULONG StartFrame;
504 ULONG NumberOfPackets;
505 ULONG ErrorCount;
506 USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1];
507 };
508
509 typedef struct _URB {
510 __GNU_EXTENSION union {
511 struct _URB_HEADER UrbHeader;
512 struct _URB_SELECT_INTERFACE UrbSelectInterface;
513 struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration;
514 struct _URB_PIPE_REQUEST UrbPipeRequest;
515 struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl;
516 struct _URB_GET_FRAME_LENGTH UrbGetFrameLength;
517 struct _URB_SET_FRAME_LENGTH UrbSetFrameLength;
518 struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber;
519 struct _URB_CONTROL_TRANSFER UrbControlTransfer;
520 #if (_WIN32_WINNT >= 0x0600)
521 struct _URB_CONTROL_TRANSFER_EX UrbControlTransferEx;
522 #endif
523 struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer;
524 struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer;
525 struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest;
526 struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest;
527 struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest;
528 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest;
529 struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest;
530 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest;
531 #if (_WIN32_WINNT >= 0x0501)
532 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST UrbOSFeatureDescriptorRequest;
533 #endif
534 };
535 } URB, *PURB;