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