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