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