[USBPORT]
[reactos.git] / reactos / sdk / include / reactos / drivers / usbport / usbmport.h
1 #ifndef USBMPORT_H__
2 #define USBMPORT_H__
3
4 #define USBPORT_HCI_MN 0x10000001
5
6 /* Tranfer types */
7 #define USBPORT_TRANSFER_TYPE_ISOCHRONOUS 0
8 #define USBPORT_TRANSFER_TYPE_CONTROL 1
9 #define USBPORT_TRANSFER_TYPE_BULK 2
10 #define USBPORT_TRANSFER_TYPE_INTERRUPT 3
11
12 /* Endpoint states */
13 #define USBPORT_ENDPOINT_UNKNOWN 0
14 #define USBPORT_ENDPOINT_PAUSED 2
15 #define USBPORT_ENDPOINT_ACTIVE 3
16 #define USBPORT_ENDPOINT_REMOVE 4
17 #define USBPORT_ENDPOINT_CLOSED 5
18
19 /* Endpoint status */
20 #define USBPORT_ENDPOINT_RUN 0
21 #define USBPORT_ENDPOINT_HALT 1
22 #define USBPORT_ENDPOINT_CONTROL 4
23
24 /* Types of resources. For USBPORT_RESOURCES::ResourcesTypes */
25 #define USBPORT_RESOURCES_PORT 1
26 #define USBPORT_RESOURCES_INTERRUPT 2
27 #define USBPORT_RESOURCES_MEMORY 4
28
29 typedef struct _USBPORT_RESOURCES {
30 ULONG ResourcesTypes;
31 ULONG HcFlavor;
32 ULONG InterruptVector;
33 KIRQL InterruptLevel;
34 UCHAR Padded1[3];
35 KAFFINITY InterruptAffinity;
36 BOOLEAN ShareVector;
37 UCHAR Padded2[3];
38 KINTERRUPT_MODE InterruptMode;
39 ULONG Reserved;
40 PVOID ResourceBase;
41 SIZE_T IoSpaceLength;
42 PVOID StartVA;
43 PVOID StartPA;
44 UCHAR LegacySupport;
45 BOOLEAN IsChirpHandled;
46 UCHAR Reserved2;
47 UCHAR Reserved3;
48 } USBPORT_RESOURCES, *PUSBPORT_RESOURCES;
49
50 C_ASSERT(sizeof(USBPORT_RESOURCES) == 52);
51
52 typedef ULONG MPSTATUS; // Miniport status
53 typedef ULONG RHSTATUS; // Roothub status
54
55 #define MP_STATUS_SUCCESS 0
56 #define MP_STATUS_FAILURE 1
57 #define MP_STATUS_NO_RESOURCES 2
58 #define MP_STATUS_NO_BANDWIDTH 3
59 #define MP_STATUS_ERROR 4
60 #define MP_STATUS_RESERVED1 5
61 #define MP_STATUS_NOT_SUPPORTED 6
62 #define MP_STATUS_HW_ERROR 7
63 #define MP_STATUS_UNSUCCESSFUL 8
64
65 #define RH_STATUS_SUCCESS 0
66 #define RH_STATUS_NO_CHANGES 1
67 #define RH_STATUS_UNSUCCESSFUL 2
68
69 typedef USB_20_PORT_CHANGE USB_PORT_STATUS_CHANGE;
70
71 typedef union _USBHUB_PORT_STATUS {
72 struct {
73 USB_PORT_STATUS UsbPortStatus;
74 USB_PORT_STATUS_CHANGE UsbPortStatusChange;
75 };
76 ULONG AsULONG;
77 } USBHUB_PORT_STATUS, *PUSBHUB_PORT_STATUS;
78
79 /* Additional USB Class Codes from USB.org */
80 #define USBC_DEVICE_CLASS_AUDIO_VIDEO 0x10
81 #define USBC_DEVICE_CLASS_BILLBOARD 0x11
82 #define USBC_DEVICE_CLASS_TYPE_C_BRIDGE 0x12
83
84 /* Miniport functions */
85 typedef MPSTATUS
86 (NTAPI *PHCI_OPEN_ENDPOINT)(
87 PVOID,
88 PVOID,
89 PVOID);
90
91 typedef MPSTATUS
92 (NTAPI *PHCI_REOPEN_ENDPOINT)(
93 PVOID,
94 PVOID,
95 PVOID);
96
97 typedef VOID
98 (NTAPI *PHCI_QUERY_ENDPOINT_REQUIREMENTS)(
99 PVOID,
100 PVOID,
101 PULONG);
102
103 typedef VOID
104 (NTAPI *PHCI_CLOSE_ENDPOINT)(
105 PVOID,
106 PVOID,
107 BOOLEAN);
108
109 typedef MPSTATUS
110 (NTAPI *PHCI_START_CONTROLLER)(
111 PVOID,
112 PUSBPORT_RESOURCES);
113
114 typedef VOID
115 (NTAPI *PHCI_STOP_CONTROLLER)(
116 PVOID,
117 BOOLEAN);
118
119 typedef VOID
120 (NTAPI *PHCI_SUSPEND_CONTROLLER)(PVOID);
121
122 typedef MPSTATUS
123 (NTAPI *PHCI_RESUME_CONTROLLER)(PVOID);
124
125 typedef BOOLEAN
126 (NTAPI *PHCI_INTERRUPT_SERVICE)(PVOID);
127
128 typedef VOID
129 (NTAPI *PHCI_INTERRUPT_DPC)(
130 PVOID,
131 BOOLEAN);
132
133 typedef MPSTATUS
134 (NTAPI *PHCI_SUBMIT_TRANSFER)(
135 PVOID,
136 PVOID,
137 PVOID,
138 PVOID,
139 PVOID);
140
141 typedef MPSTATUS
142 (NTAPI *PHCI_SUBMIT_ISO_TRANSFER)(
143 PVOID,
144 PVOID,
145 PVOID,
146 PVOID,
147 PVOID);
148
149 typedef VOID
150 (NTAPI *PHCI_ABORT_TRANSFER)(
151 PVOID,
152 PVOID,
153 PVOID,
154 PULONG);
155
156 typedef ULONG
157 (NTAPI *PHCI_GET_ENDPOINT_STATE)(
158 PVOID,
159 PVOID);
160
161 typedef VOID
162 (NTAPI *PHCI_SET_ENDPOINT_STATE)(
163 PVOID,
164 PVOID,
165 ULONG);
166
167 typedef VOID
168 (NTAPI *PHCI_POLL_ENDPOINT)(
169 PVOID,
170 PVOID);
171
172 typedef VOID
173 (NTAPI *PHCI_CHECK_CONTROLLER)(PVOID);
174
175 typedef ULONG
176 (NTAPI *PHCI_GET_32BIT_FRAME_NUMBER)(PVOID);
177
178 typedef VOID
179 (NTAPI *PHCI_INTERRUPT_NEXT_SOF)(PVOID);
180
181 typedef VOID
182 (NTAPI *PHCI_ENABLE_INTERRUPTS)(PVOID);
183
184 typedef VOID
185 (NTAPI *PHCI_DISABLE_INTERRUPTS)(PVOID);
186
187 typedef VOID
188 (NTAPI *PHCI_POLL_CONTROLLER)(PVOID);
189
190 typedef VOID
191 (NTAPI *PHCI_SET_ENDPOINT_DATA_TOGGLE)(
192 PVOID,
193 PVOID,
194 ULONG);
195
196 typedef ULONG
197 (NTAPI *PHCI_GET_ENDPOINT_STATUS)(
198 PVOID,
199 PVOID);
200
201 typedef VOID
202 (NTAPI *PHCI_SET_ENDPOINT_STATUS)(
203 PVOID,
204 PVOID,
205 ULONG);
206
207 typedef VOID
208 (NTAPI *PHCI_RESET_CONTROLLER)(PVOID);
209
210 /* Roothub functions */
211 typedef VOID
212 (NTAPI *PHCI_RH_GET_ROOT_HUB_DATA)(
213 PVOID,
214 PVOID);
215
216 typedef MPSTATUS
217 (NTAPI *PHCI_RH_GET_STATUS)(
218 PVOID,
219 PUSHORT);
220
221 typedef MPSTATUS
222 (NTAPI *PHCI_RH_GET_PORT_STATUS)(
223 PVOID,
224 USHORT,
225 PUSBHUB_PORT_STATUS);
226
227 typedef MPSTATUS
228 (NTAPI *PHCI_RH_GET_HUB_STATUS)(
229 PVOID,
230 PUSB_HUB_STATUS_AND_CHANGE);
231
232 typedef MPSTATUS
233 (NTAPI *PHCI_RH_SET_FEATURE_PORT_RESET)(
234 PVOID,
235 USHORT);
236
237 typedef MPSTATUS
238 (NTAPI *PHCI_RH_SET_FEATURE_PORT_POWER)(
239 PVOID,
240 USHORT);
241
242 typedef MPSTATUS
243 (NTAPI *PHCI_RH_SET_FEATURE_PORT_ENABLE)(
244 PVOID,
245 USHORT);
246
247 typedef MPSTATUS
248 (NTAPI *PHCI_RH_SET_FEATURE_PORT_SUSPEND)(
249 PVOID,
250 USHORT);
251
252 typedef MPSTATUS
253 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_ENABLE)(
254 PVOID,
255 USHORT);
256
257 typedef MPSTATUS
258 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_POWER)(
259 PVOID,
260 USHORT);
261
262 typedef MPSTATUS
263 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_SUSPEND)(
264 PVOID,
265 USHORT);
266
267 typedef MPSTATUS
268 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_ENABLE_CHANGE)(
269 PVOID,
270 USHORT);
271
272 typedef MPSTATUS
273 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_CONNECT_CHANGE)(
274 PVOID,
275 USHORT);
276
277 typedef MPSTATUS
278 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_RESET_CHANGE)(
279 PVOID,
280 USHORT);
281
282 typedef MPSTATUS
283 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_SUSPEND_CHANGE)(
284 PVOID,
285 USHORT);
286
287 typedef MPSTATUS
288 (NTAPI *PHCI_RH_CLEAR_FEATURE_PORT_OVERCURRENT_CHANGE)(
289 PVOID,
290 USHORT);
291
292 typedef VOID
293 (NTAPI *PHCI_RH_DISABLE_IRQ)(PVOID);
294
295 typedef VOID
296 (NTAPI *PHCI_RH_ENABLE_IRQ)(PVOID);
297
298 /* Miniport ioctl functions */
299 typedef MPSTATUS
300 (NTAPI *PHCI_START_SEND_ONE_PACKET)(
301 PVOID,
302 PVOID,
303 PVOID,
304 PULONG,
305 PVOID,
306 PVOID,
307 ULONG,
308 USBD_STATUS *);
309
310 typedef MPSTATUS
311 (NTAPI *PHCI_END_SEND_ONE_PACKET)(
312 PVOID,
313 PVOID,
314 PVOID,
315 PULONG,
316 PVOID,
317 PVOID,
318 ULONG,
319 USBD_STATUS *);
320
321 typedef MPSTATUS
322 (NTAPI *PHCI_PASS_THRU)(
323 PVOID,
324 PVOID,
325 ULONG,
326 PVOID);
327
328 /* Port functions */
329 typedef ULONG
330 (NTAPI *PUSBPORT_DBG_PRINT)(
331 PVOID,
332 ULONG,
333 PCH,
334 ...);
335
336 typedef ULONG
337 (NTAPI *PUSBPORT_TEST_DEBUG_BREAK)(PVOID);
338
339 typedef ULONG
340 (NTAPI *PUSBPORT_ASSERT_FAILURE)(
341 PVOID,
342 PVOID,
343 PVOID,
344 ULONG,
345 PCHAR);
346
347 typedef MPSTATUS
348 (NTAPI *PUSBPORT_GET_MINIPORT_REGISTRY_KEY_VALUE)(
349 PVOID,
350 BOOL,
351 PCWSTR,
352 SIZE_T,
353 PVOID,
354 SIZE_T);
355
356 typedef ULONG
357 (NTAPI *PUSBPORT_INVALIDATE_ROOT_HUB)(PVOID);
358
359 typedef ULONG
360 (NTAPI *PUSBPORT_INVALIDATE_ENDPOINT)(
361 PVOID,
362 PVOID);
363
364 typedef ULONG
365 (NTAPI *PUSBPORT_COMPLETE_TRANSFER)(
366 PVOID,
367 PVOID,
368 PVOID,
369 USBD_STATUS,
370 SIZE_T);
371
372 typedef ULONG
373 (NTAPI *PUSBPORT_COMPLETE_ISO_TRANSFER)(
374 PVOID,
375 PVOID,
376 PVOID,
377 ULONG);
378
379 typedef ULONG
380 (NTAPI *PUSBPORT_LOG_ENTRY)(
381 PVOID,
382 ULONG,
383 ULONG,
384 ULONG,
385 ULONG,
386 ULONG);
387
388 typedef PVOID
389 (NTAPI *PUSBPORT_GET_MAPPED_VIRTUAL_ADDRESS)(
390 PVOID,
391 PVOID,
392 PVOID);
393
394 typedef VOID
395 (NTAPI ASYNC_TIMER_CALLBACK)(
396 IN PVOID MiniportExtension,
397 IN PVOID CallBackContext);
398
399 typedef ULONG
400 (NTAPI *PUSBPORT_REQUEST_ASYNC_CALLBACK)(
401 PVOID,
402 ULONG,
403 PVOID,
404 SIZE_T,
405 ASYNC_TIMER_CALLBACK *);
406
407 typedef MPSTATUS
408 (NTAPI *PUSBPORT_READ_WRITE_CONFIG_SPACE)(
409 PVOID,
410 BOOLEAN,
411 PVOID,
412 ULONG,
413 ULONG);
414
415 typedef NTSTATUS
416 (NTAPI *PUSBPORT_WAIT)(
417 PVOID,
418 ULONG);
419
420 typedef ULONG
421 (NTAPI *PUSBPORT_INVALIDATE_CONTROLLER)(
422 PVOID,
423 ULONG);
424
425 typedef VOID
426 (NTAPI *PUSBPORT_BUG_CHECK)(PVOID);
427
428 typedef ULONG
429 (NTAPI *PUSBPORT_NOTIFY_DOUBLE_BUFFER)(
430 PVOID,
431 PVOID,
432 PVOID,
433 SIZE_T);
434
435 /* Miniport functions */
436 typedef VOID
437 (NTAPI *PHCI_REBALANCE_ENDPOINT)(
438 PVOID,
439 PVOID,
440 PVOID);
441
442 typedef VOID
443 (NTAPI *PHCI_FLUSH_INTERRUPTS)(PVOID);
444
445 typedef MPSTATUS
446 (NTAPI *PHCI_RH_CHIRP_ROOT_PORT)(
447 PVOID,
448 USHORT);
449
450 typedef VOID
451 (NTAPI *PHCI_TAKE_PORT_CONTROL)(PVOID);
452
453 #define USB_MINIPORT_VERSION_OHCI 0x01
454 #define USB_MINIPORT_VERSION_UHCI 0x02
455 #define USB_MINIPORT_VERSION_EHCI 0x03
456 #define USB_MINIPORT_VERSION_XHCI 0x04
457
458 #define USB_MINIPORT_FLAGS_INTERRUPT 0x0001
459 #define USB_MINIPORT_FLAGS_PORT_IO 0x0002
460 #define USB_MINIPORT_FLAGS_MEMORY_IO 0x0004
461 #define USB_MINIPORT_FLAGS_USB2 0x0010
462 #define USB_MINIPORT_FLAGS_DISABLE_SS 0x0020
463 #define USB_MINIPORT_FLAGS_NOT_LOCK_INT 0x0040
464 #define USB_MINIPORT_FLAGS_POLLING 0x0080
465 #define USB_MINIPORT_FLAGS_NO_DMA 0x0100
466 #define USB_MINIPORT_FLAGS_WAKE_SUPPORT 0x0200
467
468 typedef struct _USBPORT_REGISTRATION_PACKET {
469 ULONG MiniPortVersion;
470 ULONG MiniPortFlags;
471 ULONG MiniPortBusBandwidth;
472 ULONG Reserved1;
473 SIZE_T MiniPortExtensionSize;
474 SIZE_T MiniPortEndpointSize;
475 SIZE_T MiniPortTransferSize;
476 ULONG Reserved2;
477 ULONG Reserved3;
478 SIZE_T MiniPortResourcesSize;
479
480 /* Miniport */
481 PHCI_OPEN_ENDPOINT OpenEndpoint;
482 PHCI_REOPEN_ENDPOINT ReopenEndpoint;
483 PHCI_QUERY_ENDPOINT_REQUIREMENTS QueryEndpointRequirements;
484 PHCI_CLOSE_ENDPOINT CloseEndpoint;
485 PHCI_START_CONTROLLER StartController;
486 PHCI_STOP_CONTROLLER StopController;
487 PHCI_SUSPEND_CONTROLLER SuspendController;
488 PHCI_RESUME_CONTROLLER ResumeController;
489 PHCI_INTERRUPT_SERVICE InterruptService;
490 PHCI_INTERRUPT_DPC InterruptDpc;
491 PHCI_SUBMIT_TRANSFER SubmitTransfer;
492 PHCI_SUBMIT_ISO_TRANSFER SubmitIsoTransfer;
493 PHCI_ABORT_TRANSFER AbortTransfer;
494 PHCI_GET_ENDPOINT_STATE GetEndpointState;
495 PHCI_SET_ENDPOINT_STATE SetEndpointState;
496 PHCI_POLL_ENDPOINT PollEndpoint;
497 PHCI_CHECK_CONTROLLER CheckController;
498 PHCI_GET_32BIT_FRAME_NUMBER Get32BitFrameNumber;
499 PHCI_INTERRUPT_NEXT_SOF InterruptNextSOF;
500 PHCI_ENABLE_INTERRUPTS EnableInterrupts;
501 PHCI_DISABLE_INTERRUPTS DisableInterrupts;
502 PHCI_POLL_CONTROLLER PollController;
503 PHCI_SET_ENDPOINT_DATA_TOGGLE SetEndpointDataToggle;
504 PHCI_GET_ENDPOINT_STATUS GetEndpointStatus;
505 PHCI_SET_ENDPOINT_STATUS SetEndpointStatus;
506 PHCI_RESET_CONTROLLER ResetController;
507
508 /* Roothub */
509 PHCI_RH_GET_ROOT_HUB_DATA RH_GetRootHubData;
510 PHCI_RH_GET_STATUS RH_GetStatus;
511 PHCI_RH_GET_PORT_STATUS RH_GetPortStatus;
512 PHCI_RH_GET_HUB_STATUS RH_GetHubStatus;
513 PHCI_RH_SET_FEATURE_PORT_RESET RH_SetFeaturePortReset;
514 PHCI_RH_SET_FEATURE_PORT_POWER RH_SetFeaturePortPower;
515 PHCI_RH_SET_FEATURE_PORT_ENABLE RH_SetFeaturePortEnable;
516 PHCI_RH_SET_FEATURE_PORT_SUSPEND RH_SetFeaturePortSuspend;
517 PHCI_RH_CLEAR_FEATURE_PORT_ENABLE RH_ClearFeaturePortEnable;
518 PHCI_RH_CLEAR_FEATURE_PORT_POWER RH_ClearFeaturePortPower;
519 PHCI_RH_CLEAR_FEATURE_PORT_SUSPEND RH_ClearFeaturePortSuspend;
520 PHCI_RH_CLEAR_FEATURE_PORT_ENABLE_CHANGE RH_ClearFeaturePortEnableChange;
521 PHCI_RH_CLEAR_FEATURE_PORT_CONNECT_CHANGE RH_ClearFeaturePortConnectChange;
522 PHCI_RH_CLEAR_FEATURE_PORT_RESET_CHANGE RH_ClearFeaturePortResetChange;
523 PHCI_RH_CLEAR_FEATURE_PORT_SUSPEND_CHANGE RH_ClearFeaturePortSuspendChange;
524 PHCI_RH_CLEAR_FEATURE_PORT_OVERCURRENT_CHANGE RH_ClearFeaturePortOvercurrentChange;
525 PHCI_RH_DISABLE_IRQ RH_DisableIrq;
526 PHCI_RH_ENABLE_IRQ RH_EnableIrq;
527
528 /* Miniport ioctl */
529 PHCI_START_SEND_ONE_PACKET StartSendOnePacket;
530 PHCI_END_SEND_ONE_PACKET EndSendOnePacket;
531 PHCI_PASS_THRU PassThru;
532
533 /* Port */
534 PUSBPORT_DBG_PRINT UsbPortDbgPrint;
535 PUSBPORT_TEST_DEBUG_BREAK UsbPortTestDebugBreak;
536 PUSBPORT_ASSERT_FAILURE UsbPortAssertFailure;
537 PUSBPORT_GET_MINIPORT_REGISTRY_KEY_VALUE UsbPortGetMiniportRegistryKeyValue;
538 PUSBPORT_INVALIDATE_ROOT_HUB UsbPortInvalidateRootHub;
539 PUSBPORT_INVALIDATE_ENDPOINT UsbPortInvalidateEndpoint;
540 PUSBPORT_COMPLETE_TRANSFER UsbPortCompleteTransfer;
541 PUSBPORT_COMPLETE_ISO_TRANSFER UsbPortCompleteIsoTransfer;
542 PUSBPORT_LOG_ENTRY UsbPortLogEntry;
543 PUSBPORT_GET_MAPPED_VIRTUAL_ADDRESS UsbPortGetMappedVirtualAddress;
544 PUSBPORT_REQUEST_ASYNC_CALLBACK UsbPortRequestAsyncCallback;
545 PUSBPORT_READ_WRITE_CONFIG_SPACE UsbPortReadWriteConfigSpace;
546 PUSBPORT_WAIT UsbPortWait;
547 PUSBPORT_INVALIDATE_CONTROLLER UsbPortInvalidateController;
548 PUSBPORT_BUG_CHECK UsbPortBugCheck;
549 PUSBPORT_NOTIFY_DOUBLE_BUFFER UsbPortNotifyDoubleBuffer;
550
551 /* Miniport */
552 PHCI_REBALANCE_ENDPOINT RebalanceEndpoint;
553 PHCI_FLUSH_INTERRUPTS FlushInterrupts;
554 PHCI_RH_CHIRP_ROOT_PORT RH_ChirpRootPort;
555 PHCI_TAKE_PORT_CONTROL TakePortControl;
556 ULONG Reserved4;
557 ULONG Reserved5;
558 } USBPORT_REGISTRATION_PACKET, *PUSBPORT_REGISTRATION_PACKET;
559
560 typedef struct _USBPORT_MINIPORT_INTERFACE {
561 PDRIVER_OBJECT DriverObject;
562 LIST_ENTRY DriverLink;
563 PDRIVER_UNLOAD DriverUnload;
564 ULONG Version;
565 USBPORT_REGISTRATION_PACKET Packet;
566 } USBPORT_MINIPORT_INTERFACE, *PUSBPORT_MINIPORT_INTERFACE;
567
568 C_ASSERT(sizeof(USBPORT_MINIPORT_INTERFACE) == 336);
569
570 typedef struct _USBPORT_ENDPOINT_PROPERTIES {
571 USHORT DeviceAddress;
572 USHORT EndpointAddress;
573 USHORT TotalMaxPacketSize; // TransactionPerMicroframe * MaxPacketSize
574 UCHAR Period;
575 UCHAR Reserved1;
576 USB_DEVICE_SPEED DeviceSpeed;
577 ULONG UsbBandwidth;
578 ULONG ScheduleOffset;
579 ULONG TransferType;
580 ULONG Direction;
581 ULONG_PTR BufferVA;
582 ULONG_PTR BufferPA;
583 ULONG BufferLength;
584 ULONG Reserved3;
585 ULONG MaxTransferSize;
586 USHORT HubAddr;
587 USHORT PortNumber;
588 UCHAR InterruptScheduleMask;
589 UCHAR SplitCompletionMask;
590 UCHAR TransactionPerMicroframe; // 1 + additional transactions. Total: from 1 to 3)
591 UCHAR Reserved4;
592 ULONG MaxPacketSize;
593 ULONG Reserved6;
594 } USBPORT_ENDPOINT_PROPERTIES, *PUSBPORT_ENDPOINT_PROPERTIES;
595
596 C_ASSERT(sizeof(USBPORT_ENDPOINT_PROPERTIES) == 64);
597
598 typedef struct _USBPORT_SCATTER_GATHER_ELEMENT {
599 PHYSICAL_ADDRESS SgPhysicalAddress;
600 ULONG Reserved1;
601 ULONG SgTransferLength;
602 ULONG SgOffset;
603 ULONG Reserved2;
604 } USBPORT_SCATTER_GATHER_ELEMENT, *PUSBPORT_SCATTER_GATHER_ELEMENT;
605
606 C_ASSERT(sizeof(USBPORT_SCATTER_GATHER_ELEMENT) == 24);
607
608 typedef struct _USBPORT_SCATTER_GATHER_LIST {
609 ULONG Flags;
610 ULONG_PTR CurrentVa;
611 PVOID MappedSystemVa;
612 ULONG SgElementCount;
613 USBPORT_SCATTER_GATHER_ELEMENT SgElement[1];
614 } USBPORT_SCATTER_GATHER_LIST, *PUSBPORT_SCATTER_GATHER_LIST;
615
616 C_ASSERT(sizeof(USBPORT_SCATTER_GATHER_LIST) == 40);
617
618 typedef struct _USBPORT_TRANSFER_PARAMETERS {
619 ULONG TransferFlags;
620 ULONG TransferBufferLength;
621 ULONG TransferCounter;
622 ULONG Reserved1;
623 ULONG Reserved2;
624 USB_DEFAULT_PIPE_SETUP_PACKET SetupPacket;
625 } USBPORT_TRANSFER_PARAMETERS, *PUSBPORT_TRANSFER_PARAMETERS;
626
627 C_ASSERT(sizeof(USBPORT_TRANSFER_PARAMETERS) == 28);
628
629 /* For USB1.1 or USB3 Hub Descriptors */
630 typedef union _USBPORT_HUB_11_CHARACTERISTICS {
631 struct {
632 USHORT PowerControlMode :1;
633 USHORT NoPowerSwitching :1; // Reserved. Used only on 1.0 compliant hubs that implement no power switching.
634 USHORT PartOfCompoundDevice :1;
635 USHORT OverCurrentProtectionMode :1;
636 USHORT NoOverCurrentProtection :1;
637 USHORT Reserved1 :11;
638 };
639 USHORT AsUSHORT;
640 } USBPORT_HUB_11_CHARACTERISTICS;
641
642 C_ASSERT(sizeof(USBPORT_HUB_11_CHARACTERISTICS) == sizeof(USHORT));
643
644 /* For USB2.0 Hub Descriptors */
645 typedef union _USBPORT_HUB_20_CHARACTERISTICS {
646 struct {
647 USHORT PowerControlMode :1;
648 USHORT NoPowerSwitching :1; // Reserved. Used only on 1.0 compliant hubs that implement no power switching.
649 USHORT PartOfCompoundDevice :1;
650 USHORT OverCurrentProtectionMode :1;
651 USHORT NoOverCurrentProtection :1;
652 USHORT TtThinkTime :2;
653 USHORT PortIndicatorsSupported :1;
654 USHORT Reserved1 :8;
655 };
656 USHORT AsUSHORT;
657 } USBPORT_HUB_20_CHARACTERISTICS;
658
659 C_ASSERT(sizeof(USBPORT_HUB_20_CHARACTERISTICS) == sizeof(USHORT));
660
661 typedef USBPORT_HUB_11_CHARACTERISTICS USBPORT_HUB_30_CHARACTERISTICS;
662
663 typedef union _USBPORT_HUB_CHARACTERISTICS {
664 USHORT AsUSHORT;
665 USBPORT_HUB_11_CHARACTERISTICS Usb11HubCharacteristics;
666 USBPORT_HUB_20_CHARACTERISTICS Usb20HubCharacteristics;
667 USBPORT_HUB_30_CHARACTERISTICS Usb30HubCharacteristics;
668 } USBPORT_HUB_CHARACTERISTICS;
669
670 C_ASSERT(sizeof(USBPORT_HUB_CHARACTERISTICS) == sizeof(USHORT));
671
672 typedef struct _USBPORT_ROOT_HUB_DATA {
673 ULONG NumberOfPorts;
674 USBPORT_HUB_CHARACTERISTICS HubCharacteristics;
675 USHORT Padded1;
676 ULONG PowerOnToPowerGood;
677 ULONG HubControlCurrent;
678 } USBPORT_ROOT_HUB_DATA, *PUSBPORT_ROOT_HUB_DATA;
679
680 C_ASSERT(sizeof(USBPORT_ROOT_HUB_DATA) == 16);
681
682 ULONG
683 NTAPI
684 USBPORT_GetHciMn(VOID);
685
686 NTSTATUS
687 NTAPI
688 USBPORT_RegisterUSBPortDriver(
689 IN PDRIVER_OBJECT DriverObject,
690 IN ULONG Version,
691 IN PUSBPORT_REGISTRATION_PACKET RegistrationPacket);
692
693 #endif /* USBMPORT_H__ */