[USBPORT] Add initial support for transaction translators in USBPORT_AddDevice().
[reactos.git] / drivers / usb / usbport / usbport.h
1 /*
2 * PROJECT: ReactOS USB Port Driver
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: USBPort declarations
5 * COPYRIGHT: Copyright 2017 Vadim Galyant <vgal@rambler.ru>
6 */
7
8 #ifndef USBPORT_H__
9 #define USBPORT_H__
10
11 #include <ntddk.h>
12 #include <windef.h>
13 #include <stdio.h>
14 #include <wdmguid.h>
15 #include <ntstrsafe.h>
16 #include <usb.h>
17 #include <hubbusif.h>
18 #include <usbbusif.h>
19 #include <usbdlib.h>
20 #include <usbuser.h>
21 #include <drivers/usbport/usbmport.h>
22
23 #define PCI_INTERFACE_USB_ID_UHCI 0x00
24 #define PCI_INTERFACE_USB_ID_OHCI 0x10
25 #define PCI_INTERFACE_USB_ID_EHCI 0x20
26 #define PCI_INTERFACE_USB_ID_XHCI 0x30
27
28 #ifdef USBD_TRANSFER_DIRECTION // due hubbusif.h included usbdi.h (Which overwrites...)
29 #undef USBD_TRANSFER_DIRECTION
30 #define USBD_TRANSFER_DIRECTION 0x00000001
31 #endif
32
33 #define USBPORT_RECIPIENT_HUB BMREQUEST_TO_DEVICE
34 #define USBPORT_RECIPIENT_PORT BMREQUEST_TO_OTHER
35
36 #define INVALIDATE_ENDPOINT_ONLY 0
37 #define INVALIDATE_ENDPOINT_WORKER_THREAD 1
38 #define INVALIDATE_ENDPOINT_WORKER_DPC 2
39 #define INVALIDATE_ENDPOINT_INT_NEXT_SOF 3
40
41 #define USBPORT_DMA_DIRECTION_FROM_DEVICE 1
42 #define USBPORT_DMA_DIRECTION_TO_DEVICE 2
43
44 #define USB_PORT_TAG 'pbsu'
45 #define URB_FUNCTION_MAX 0x31
46
47 /* Hub Class Feature Selectors (Recipient - Port) */
48 #define FEATURE_PORT_CONNECTION 0
49 #define FEATURE_PORT_ENABLE 1
50 #define FEATURE_PORT_SUSPEND 2
51 #define FEATURE_PORT_OVER_CURRENT 3
52 #define FEATURE_PORT_RESET 4
53 #define FEATURE_PORT_POWER 8
54 #define FEATURE_PORT_LOW_SPEED 9
55 #define FEATURE_C_PORT_CONNECTION 16
56 #define FEATURE_C_PORT_ENABLE 17
57 #define FEATURE_C_PORT_SUSPEND 18
58 #define FEATURE_C_PORT_OVER_CURRENT 19
59 #define FEATURE_C_PORT_RESET 20
60
61 /* Hub Class Feature Selectors (Recipient - Hub) */
62 #define FEATURE_C_HUB_LOCAL_POWER 0
63 #define FEATURE_C_HUB_OVER_CURRENT 1
64
65 /* Flags */
66 #define USBPORT_FLAG_INT_CONNECTED 0x00000001
67 #define USBPORT_FLAG_HC_STARTED 0x00000002
68 #define USBPORT_FLAG_HC_POLLING 0x00000004
69 #define USBPORT_FLAG_WORKER_THREAD_ON 0x00000008
70 #define USBPORT_FLAG_HC_SUSPEND 0x00000100
71 #define USBPORT_FLAG_INTERRUPT_ENABLED 0x00000400
72 #define USBPORT_FLAG_SELECTIVE_SUSPEND 0x00000800
73 #define USBPORT_FLAG_DOS_SYMBOLIC_NAME 0x00010000
74 #define USBPORT_FLAG_LEGACY_SUPPORT 0x00080000
75 #define USBPORT_FLAG_HC_WAKE_SUPPORT 0x00200000
76 #define USBPORT_FLAG_DIAGNOSTIC_MODE 0x00800000 //IOCTL_USB_DIAGNOSTIC_MODE_ON
77 #define USBPORT_FLAG_COMPANION_HC 0x01000000
78 #define USBPORT_FLAG_REGISTERED_FDO 0x02000000
79 #define USBPORT_FLAG_NO_HACTION 0x04000000
80 #define USBPORT_FLAG_BIOS_DISABLE_SS 0x08000000 //Selective Suspend
81 #define USBPORT_FLAG_PWR_AND_CHIRP_LOCK 0x10000000
82 #define USBPORT_FLAG_POWER_AND_CHIRP_OK 0x40000000
83 #define USBPORT_FLAG_RH_INIT_CALLBACK 0x80000000
84
85 /* PnP state Flags */
86 #define USBPORT_PNP_STATE_NOT_INIT 0x00000001
87 #define USBPORT_PNP_STATE_STARTED 0x00000002
88 #define USBPORT_PNP_STATE_FAILED 0x00000004
89 #define USBPORT_PNP_STATE_STOPPED 0x00000008
90
91 /* Timer Flags */
92 #define USBPORT_TMFLAG_TIMER_QUEUED 0x00000001
93 #define USBPORT_TMFLAG_HC_SUSPENDED 0x00000002
94 #define USBPORT_TMFLAG_HC_RESUME 0x00000004
95 #define USBPORT_TMFLAG_RH_SUSPENDED 0x00000008
96 #define USBPORT_TMFLAG_TIMER_STARTED 0x00000010
97 #define USBPORT_TMFLAG_WAKE 0x00000020
98 #define USBPORT_TMFLAG_IDLE_QUEUEITEM_ON 0x00000040
99
100 /* Miniport Flags */
101 #define USBPORT_MPFLAG_INTERRUPTS_ENABLED 0x00000001
102 #define USBPORT_MPFLAG_SUSPENDED 0x00000002
103
104 /* Device handle Flags (USBPORT_DEVICE_HANDLE) */
105 #define DEVICE_HANDLE_FLAG_ROOTHUB 0x00000002
106 #define DEVICE_HANDLE_FLAG_REMOVED 0x00000008
107 #define DEVICE_HANDLE_FLAG_INITIALIZED 0x00000010
108
109 /* Endpoint Flags (USBPORT_ENDPOINT) */
110 #define ENDPOINT_FLAG_DMA_TYPE 0x00000001
111 #define ENDPOINT_FLAG_ROOTHUB_EP0 0x00000002
112 #define ENDPOINT_FLAG_NUKE 0x00000008
113 #define ENDPOINT_FLAG_QUEUENE_EMPTY 0x00000010
114 #define ENDPOINT_FLAG_ABORTING 0x00000020
115 #define ENDPOINT_FLAG_IDLE 0x00000100
116 #define ENDPOINT_FLAG_OPENED 0x00000200
117 #define ENDPOINT_FLAG_CLOSED 0x00000400
118
119 /* UsbdFlags Flags (URB) */
120 #define USBD_FLAG_ALLOCATED_MDL 0x00000002
121 #define USBD_FLAG_NOT_ISO_TRANSFER 0x00000010
122 #define USBD_FLAG_ALLOCATED_TRANSFER 0x00000020
123
124 /* Pipe handle Flags (USBPORT_PIPE_HANDLE) */
125 #define PIPE_HANDLE_FLAG_CLOSED 0x00000001
126 #define PIPE_HANDLE_FLAG_NULL_PACKET_SIZE 0x00000002
127
128 /* Transfer Flags (USBPORT_TRANSFER) */
129 #define TRANSFER_FLAG_CANCELED 0x00000001
130 #define TRANSFER_FLAG_DMA_MAPPED 0x00000002
131 #define TRANSFER_FLAG_HIGH_SPEED 0x00000004
132 #define TRANSFER_FLAG_SUBMITED 0x00000008
133 #define TRANSFER_FLAG_ABORTED 0x00000010
134 #define TRANSFER_FLAG_ISO 0x00000020
135 #define TRANSFER_FLAG_DEVICE_GONE 0x00000080
136 #define TRANSFER_FLAG_SPLITED 0x00000100
137 #define TRANSFER_FLAG_COMPLETED 0x00000200
138 #define TRANSFER_FLAG_PARENT 0x00000400
139
140 extern KSPIN_LOCK USBPORT_SpinLock;
141 extern LIST_ENTRY USBPORT_MiniPortDrivers;
142
143 typedef USBD_STATUS* PUSBD_STATUS;
144
145 typedef struct _USBPORT_COMMON_BUFFER_HEADER {
146 ULONG Length;
147 ULONG_PTR BaseVA;
148 PHYSICAL_ADDRESS LogicalAddress;
149 SIZE_T BufferLength;
150 ULONG_PTR VirtualAddress;
151 ULONG_PTR PhysicalAddress;
152 } USBPORT_COMMON_BUFFER_HEADER, *PUSBPORT_COMMON_BUFFER_HEADER;
153
154 typedef struct _USBPORT_ENDPOINT *PUSBPORT_ENDPOINT;
155
156 typedef struct _USB2_HC_EXTENSION *PUSB2_HC_EXTENSION;
157 typedef struct _USB2_TT *PUSB2_TT;
158
159 typedef struct _USBPORT_PIPE_HANDLE {
160 ULONG Flags;
161 ULONG PipeFlags;
162 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
163 UCHAR Padded;
164 PUSBPORT_ENDPOINT Endpoint;
165 LIST_ENTRY PipeLink;
166 } USBPORT_PIPE_HANDLE, *PUSBPORT_PIPE_HANDLE;
167
168 typedef struct _USBPORT_CONFIGURATION_HANDLE {
169 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
170 LIST_ENTRY InterfaceHandleList;
171 //USB_CONFIGURATION_DESCRIPTOR CfgDescriptor; // Body.
172 } USBPORT_CONFIGURATION_HANDLE, *PUSBPORT_CONFIGURATION_HANDLE;
173
174 typedef struct _USBPORT_INTERFACE_HANDLE {
175 LIST_ENTRY InterfaceLink;
176 UCHAR AlternateSetting;
177 UCHAR Pad1[3];
178 USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
179 UCHAR Pad2[3];
180 USBPORT_PIPE_HANDLE PipeHandle[1];
181 } USBPORT_INTERFACE_HANDLE, *PUSBPORT_INTERFACE_HANDLE;
182
183 typedef struct _USBPORT_DEVICE_HANDLE {
184 ULONG Flags;
185 USHORT DeviceAddress;
186 USHORT PortNumber;
187 USBPORT_PIPE_HANDLE PipeHandle;
188 ULONG DeviceSpeed;
189 BOOL IsRootHub;
190 LIST_ENTRY PipeHandleList;
191 PUSBPORT_CONFIGURATION_HANDLE ConfigHandle;
192 struct _USBPORT_DEVICE_HANDLE *HubDeviceHandle;
193 USB_DEVICE_DESCRIPTOR DeviceDescriptor;
194 LIST_ENTRY DeviceHandleLink;
195 LONG DeviceHandleLock;
196 ULONG TtCount;
197 } USBPORT_DEVICE_HANDLE, *PUSBPORT_DEVICE_HANDLE;
198
199 typedef struct _USBPORT_ENDPOINT {
200 ULONG Flags;
201 PDEVICE_OBJECT FdoDevice;
202 PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer;
203 PUSBPORT_DEVICE_HANDLE DeviceHandle;
204 USBPORT_ENDPOINT_PROPERTIES EndpointProperties;
205 ULONG EndpointWorker;
206 ULONG FrameNumber;
207 /* Locks */
208 KSPIN_LOCK EndpointSpinLock;
209 KIRQL EndpointOldIrql;
210 KIRQL EndpointStateOldIrql;
211 UCHAR Padded[2];
212 LONG LockCounter;
213 LONG FlushPendingLock;
214 /* State */
215 ULONG StateLast;
216 ULONG StateNext;
217 LIST_ENTRY StateChangeLink;
218 KSPIN_LOCK StateChangeSpinLock;
219 /* Transfer lists */
220 LIST_ENTRY PendingTransferList;
221 LIST_ENTRY TransferList;
222 LIST_ENTRY CancelList;
223 LIST_ENTRY AbortList;
224 /* Links */
225 LIST_ENTRY EndpointLink;
226 LIST_ENTRY WorkerLink;
227 LIST_ENTRY CloseLink;
228 LIST_ENTRY DispatchLink;
229 LIST_ENTRY FlushLink;
230 LIST_ENTRY FlushControllerLink;
231 LIST_ENTRY FlushAbortLink;
232 } USBPORT_ENDPOINT, *PUSBPORT_ENDPOINT;
233
234 typedef struct _USBPORT_ISO_BLOCK *PUSBPORT_ISO_BLOCK;
235
236 typedef struct _USBPORT_TRANSFER {
237 ULONG Flags;
238 PIRP Irp;
239 PURB Urb;
240 PRKEVENT Event;
241 PVOID MiniportTransfer;
242 SIZE_T PortTransferLength; // Only port part
243 SIZE_T FullTransferLength; // Port + miniport
244 PUSBPORT_ENDPOINT Endpoint;
245 USBPORT_TRANSFER_PARAMETERS TransferParameters;
246 PMDL TransferBufferMDL;
247 ULONG Direction;
248 LIST_ENTRY TransferLink;
249 USBD_STATUS USBDStatus;
250 ULONG CompletedTransferLen;
251 ULONG NumberOfMapRegisters;
252 PVOID MapRegisterBase;
253 ULONG TimeOut;
254 LARGE_INTEGER Time;
255 struct _USBPORT_TRANSFER * ParentTransfer;
256 KSPIN_LOCK TransferSpinLock;
257 LIST_ENTRY SplitTransfersList; // for parent transfers
258 LIST_ENTRY SplitLink; // for splitted transfers
259 ULONG Period;
260 PUSBPORT_ISO_BLOCK IsoBlockPtr; // pointer on IsoBlock
261 // SgList should be LAST field
262 USBPORT_SCATTER_GATHER_LIST SgList; // variable length
263 //USBPORT_ISO_BLOCK IsoBlock; // variable length
264 } USBPORT_TRANSFER, *PUSBPORT_TRANSFER;
265
266 typedef struct _USBPORT_IRP_TABLE {
267 struct _USBPORT_IRP_TABLE * LinkNextTable;
268 PIRP irp[0X200];
269 } USBPORT_IRP_TABLE, *PUSBPORT_IRP_TABLE;
270
271 typedef struct _USBPORT_COMMON_DEVICE_EXTENSION {
272 PDEVICE_OBJECT SelfDevice;
273 PDEVICE_OBJECT LowerPdoDevice; // PhysicalDeviceObject
274 PDEVICE_OBJECT LowerDevice; // TopOfStackDeviceObject
275 ULONG IsPDO;
276 UNICODE_STRING SymbolicLinkName;
277 BOOL IsInterfaceEnabled;
278 DEVICE_POWER_STATE DevicePowerState;
279 ULONG PnpStateFlags;
280 } USBPORT_COMMON_DEVICE_EXTENSION, *PUSBPORT_COMMON_DEVICE_EXTENSION;
281
282 typedef struct _USBPORT_DEVICE_EXTENSION {
283 USBPORT_COMMON_DEVICE_EXTENSION CommonExtension;
284 ULONG Flags;
285 PDEVICE_OBJECT RootHubPdo; // RootHubDeviceObject
286 KSPIN_LOCK RootHubCallbackSpinLock;
287 LONG RHInitCallBackLock;
288 LONG ChirpRootPortLock;
289 KSEMAPHORE ControllerSemaphore;
290 ULONG FdoNameNumber;
291 UNICODE_STRING DosDeviceSymbolicName;
292 ULONG UsbBIOSx;
293 LIST_ENTRY ControllerLink;
294 ULONG CommonBufferLimit;
295 /* Miniport */
296 ULONG MiniPortFlags;
297 PVOID MiniPortExt;
298 PUSBPORT_MINIPORT_INTERFACE MiniPortInterface;
299 USBPORT_RESOURCES UsbPortResources;
300 PUSBPORT_COMMON_BUFFER_HEADER MiniPortCommonBuffer;
301 KSPIN_LOCK MiniportSpinLock;
302 /* Bus Interface */
303 BUS_INTERFACE_STANDARD BusInterface;
304 USHORT VendorID;
305 USHORT DeviceID;
306 UCHAR RevisionID;
307 UCHAR ProgIf;
308 UCHAR SubClass;
309 UCHAR BaseClass;
310 /* Dma Adapter */
311 PDMA_ADAPTER DmaAdapter;
312 ULONG NumberMapRegs;
313 /* Interrupt */
314 PKINTERRUPT InterruptObject;
315 KDPC IsrDpc;
316 LONG IsrDpcCounter;
317 LONG IsrDpcHandlerCounter;
318 KSPIN_LOCK MiniportInterruptsSpinLock;
319 KTIMER TimerSoftInterrupt;
320 KDPC SoftInterruptDpc;
321 /* Endpoints */
322 ULONG PeriodicEndpoints;
323 LIST_ENTRY EndpointList;
324 KSPIN_LOCK EndpointListSpinLock;
325 LIST_ENTRY EpStateChangeList;
326 KSPIN_LOCK EpStateChangeSpinLock;
327 LIST_ENTRY EndpointClosedList;
328 KSPIN_LOCK EndpointClosedSpinLock;
329 LIST_ENTRY WorkerList;
330 /* Transfers */
331 LIST_ENTRY MapTransferList;
332 KSPIN_LOCK MapTransferSpinLock;
333 LIST_ENTRY DoneTransferList;
334 KSPIN_LOCK DoneTransferSpinLock;
335 KDPC TransferFlushDpc;
336 KSPIN_LOCK FlushTransferSpinLock;
337 KSPIN_LOCK FlushPendingTransferSpinLock;
338 /* Timer */
339 ULONG TimerValue; // Timer period (500) msec. default
340 ULONG TimerFlags;
341 KTIMER TimerObject;
342 KDPC TimerDpc;
343 KSPIN_LOCK TimerFlagsSpinLock;
344 /* Worker Thread */
345 PRKTHREAD WorkerThread;
346 HANDLE WorkerThreadHandle;
347 KEVENT WorkerThreadEvent;
348 KSPIN_LOCK WorkerThreadEventSpinLock;
349 /* Usb Devices */
350 ULONG UsbAddressBitMap[4];
351 LIST_ENTRY DeviceHandleList;
352 KSPIN_LOCK DeviceHandleSpinLock;
353 KSEMAPHORE DeviceSemaphore;
354 /* Device Capabilities */
355 DEVICE_CAPABILITIES Capabilities;
356 ULONG BusNumber;
357 ULONG PciDeviceNumber;
358 ULONG PciFunctionNumber;
359 ULONG TotalBusBandwidth;
360 /* Idle */
361 LARGE_INTEGER IdleTime;
362 IO_CSQ IdleIoCsq;
363 KSPIN_LOCK IdleIoCsqSpinLock;
364 LIST_ENTRY IdleIrpList;
365 LONG IdleLockCounter;
366 /* Bad Requests */
367 IO_CSQ BadRequestIoCsq;
368 KSPIN_LOCK BadRequestIoCsqSpinLock;
369 LIST_ENTRY BadRequestList;
370 LONG BadRequestLockCounter;
371 /* Irp Queues */
372 PUSBPORT_IRP_TABLE PendingIrpTable;
373 PUSBPORT_IRP_TABLE ActiveIrpTable;
374 /* Power */
375 LONG SetPowerLockCounter;
376 KSPIN_LOCK PowerWakeSpinLock;
377 KSPIN_LOCK SetPowerD0SpinLock;
378 KDPC WorkerRequestDpc;
379 KDPC HcWakeDpc;
380 /* Usb 2.0 HC Extension */
381 PUSB2_HC_EXTENSION Usb2Extension;
382
383 /* Miniport extension should be aligned on 0x100 */
384 #if !defined(_M_X64)
385 ULONG Padded[33];
386 #else
387 ULONG Padded[0];
388 #endif
389
390 } USBPORT_DEVICE_EXTENSION, *PUSBPORT_DEVICE_EXTENSION;
391
392 #if !defined(_M_X64)
393 C_ASSERT(sizeof(USBPORT_DEVICE_EXTENSION) == 0x400);
394 #else
395 C_ASSERT(sizeof(USBPORT_DEVICE_EXTENSION) == 0x600);
396 #endif
397
398 typedef struct _USBPORT_RH_DESCRIPTORS {
399 USB_DEVICE_DESCRIPTOR DeviceDescriptor;
400 USB_CONFIGURATION_DESCRIPTOR ConfigDescriptor;
401 USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
402 USB_ENDPOINT_DESCRIPTOR EndPointDescriptor;
403 USB_HUB_DESCRIPTOR Descriptor; // Size may be: 7 + 2[1..32] (7 + 2..64)
404 } USBPORT_RH_DESCRIPTORS, *PUSBPORT_RH_DESCRIPTORS;
405
406 typedef struct _USBPORT_RHDEVICE_EXTENSION {
407 USBPORT_COMMON_DEVICE_EXTENSION CommonExtension;
408 ULONG Flags;
409 PDEVICE_OBJECT FdoDevice;
410 ULONG PdoNameNumber;
411 USBPORT_DEVICE_HANDLE DeviceHandle;
412 PUSBPORT_RH_DESCRIPTORS RootHubDescriptors;
413 PUSBPORT_ENDPOINT Endpoint;
414 ULONG ConfigurationValue;
415 PRH_INIT_CALLBACK RootHubInitCallback;
416 PVOID RootHubInitContext;
417 DEVICE_CAPABILITIES Capabilities;
418 PIRP WakeIrp;
419 } USBPORT_RHDEVICE_EXTENSION, *PUSBPORT_RHDEVICE_EXTENSION;
420
421 typedef struct _USBPORT_ASYNC_CALLBACK_DATA {
422 ULONG Reserved;
423 PDEVICE_OBJECT FdoDevice;
424 KTIMER AsyncTimer;
425 KDPC AsyncTimerDpc;
426 ASYNC_TIMER_CALLBACK *CallbackFunction;
427 ULONG CallbackContext;
428 } USBPORT_ASYNC_CALLBACK_DATA, *PUSBPORT_ASYNC_CALLBACK_DATA;
429
430 C_ASSERT(sizeof(USBPORT_ASYNC_CALLBACK_DATA) == 16 + 18 * sizeof(PVOID));
431
432 typedef struct _TIMER_WORK_QUEUE_ITEM {
433 WORK_QUEUE_ITEM WqItem;
434 PDEVICE_OBJECT FdoDevice;
435 ULONG Context;
436 } TIMER_WORK_QUEUE_ITEM, *PTIMER_WORK_QUEUE_ITEM;
437
438 /* Transaction Translator */
439 /* See Chapter 5 - USB Data Flow Model and Chapter 11 - Hub Specification */
440
441 #define USB2_FRAMES 32
442 #define USB2_MICROFRAMES 8
443 #define USB2_MAX_MICROFRAMES (USB2_FRAMES * USB2_MICROFRAMES)
444
445 #define USB2_MAX_MICROFRAME_ALLOCATION 7000 // bytes
446 #define USB2_CONTROLLER_DELAY 100
447 #define USB2_FS_MAX_PERIODIC_ALLOCATION 1157 // ((12000 / 8 bits) * 0.9) / (7/6) - 90% max, and bits stuffing
448 #define USB2_FS_SOF_TIME 6
449 #define USB2_HUB_DELAY 30
450 #define USB2_MAX_FS_LS_TRANSACTIONS_IN_UFRAME 16
451 #define USB2_FS_RAW_BYTES_IN_MICROFRAME 188 // (12000 / 8 bits / USB2_MICROFRAMES) = 187,5. But we use "best case budget"
452
453 /* Overheads */
454 #define USB2_LS_INTERRUPT_OVERHEAD 117 // FS-bytes
455 #define USB2_FS_INTERRUPT_OVERHEAD 13
456 #define USB2_HS_INTERRUPT_OUT_OVERHEAD 45
457 #define USB2_HS_INTERRUPT_IN_OVERHEAD 25
458 #define USB2_FS_ISOCHRONOUS_OVERHEAD 9
459 #define USB2_HS_ISOCHRONOUS_OUT_OVERHEAD 38
460 #define USB2_HS_ISOCHRONOUS_IN_OVERHEAD 18
461
462 typedef union _USB2_TT_ENDPOINT_PARAMS {
463 struct {
464 ULONG TransferType : 4;
465 ULONG Direction : 1;
466 USB_DEVICE_SPEED DeviceSpeed : 2;
467 ULONG EndpointMoved : 1;
468 ULONG Reserved : 24;
469 };
470 ULONG AsULONG;
471 } USB2_TT_ENDPOINT_PARAMS;
472
473 C_ASSERT(sizeof(USB2_TT_ENDPOINT_PARAMS) == sizeof(ULONG));
474
475 typedef union _USB2_TT_ENDPOINT_NUMS {
476 struct {
477 ULONG NumStarts : 4;
478 ULONG NumCompletes : 4;
479 ULONG Reserved : 24;
480 };
481 ULONG AsULONG;
482 } USB2_TT_ENDPOINT_NUMS;
483
484 C_ASSERT(sizeof(USB2_TT_ENDPOINT_NUMS) == sizeof(ULONG));
485
486 typedef struct _USB2_TT_ENDPOINT {
487 PUSB2_TT Tt;
488 PUSBPORT_ENDPOINT Endpoint;
489 struct _USB2_TT_ENDPOINT * NextTtEndpoint;
490 USB2_TT_ENDPOINT_PARAMS TtEndpointParams;
491 USB2_TT_ENDPOINT_NUMS Nums;
492 USHORT MaxPacketSize;
493 USHORT PreviosPeriod;
494 USHORT Period;
495 USHORT ActualPeriod;
496 USHORT CalcBusTime;
497 USHORT StartTime;
498 USHORT Reserved2;
499 UCHAR StartFrame;
500 UCHAR StartMicroframe;
501 } USB2_TT_ENDPOINT, *PUSB2_TT_ENDPOINT;
502
503 typedef struct _USB2_FRAME_BUDGET {
504 PUSB2_TT_ENDPOINT IsoEndpoint;
505 PUSB2_TT_ENDPOINT IntEndpoint;
506 PUSB2_TT_ENDPOINT AltEndpoint;
507 USHORT TimeUsed;
508 USHORT Reserved2;
509 } USB2_FRAME_BUDGET, *PUSB2_FRAME_BUDGET;
510
511 typedef struct _USB2_TT {
512 PUSB2_HC_EXTENSION HcExtension;
513 ULONG DelayTime;
514 ULONG MaxTime;
515 USB2_TT_ENDPOINT IntEndpoint[USB2_FRAMES];
516 USB2_TT_ENDPOINT IsoEndpoint[USB2_FRAMES];
517 USB2_FRAME_BUDGET FrameBudget[USB2_FRAMES];
518 ULONG NumStartSplits[USB2_FRAMES][USB2_MICROFRAMES];
519 ULONG TimeCS[USB2_FRAMES][USB2_MICROFRAMES];
520 } USB2_TT, *PUSB2_TT;
521
522 typedef struct _USB2_TT_EXTENSION {
523 PDEVICE_OBJECT RootHubPdo;
524 ULONG Flags;
525 ULONG BusBandwidth;
526 ULONG Bandwidth[USB2_FRAMES];
527 ULONG MaxBandwidth;
528 ULONG MinBandwidth;
529 USHORT DeviceAddress;
530 USHORT TtNumber;
531 LIST_ENTRY TtList;
532 LIST_ENTRY Link;
533 USB2_TT Tt;
534 } USB2_TT_EXTENSION, *PUSB2_TT_EXTENSION;
535
536 typedef struct _USB2_HC_EXTENSION {
537 ULONG MaxHsBusAllocation;
538 ULONG HcDelayTime;
539 ULONG TimeUsed[USB2_FRAMES][USB2_MICROFRAMES];
540 USB2_TT HcTt;
541 } USB2_HC_EXTENSION, *PUSB2_HC_EXTENSION;
542
543 /* usbport.c */
544 NTSTATUS
545 NTAPI
546 USBPORT_USBDStatusToNtStatus(
547 IN PURB Urb,
548 IN USBD_STATUS USBDStatus);
549
550 NTSTATUS
551 NTAPI
552 USBPORT_Wait(
553 IN PVOID MiniPortExtension,
554 IN ULONG Milliseconds);
555
556 VOID
557 NTAPI
558 USBPORT_TransferFlushDpc(
559 IN PRKDPC Dpc,
560 IN PVOID DeferredContext,
561 IN PVOID SystemArgument1,
562 IN PVOID SystemArgument2);
563
564 NTSTATUS
565 NTAPI
566 USBPORT_CreateWorkerThread(
567 IN PDEVICE_OBJECT FdoDevice);
568
569 BOOLEAN
570 NTAPI
571 USBPORT_StartTimer(
572 IN PDEVICE_OBJECT FdoDevice,
573 IN ULONG Time);
574
575 PUSBPORT_COMMON_BUFFER_HEADER
576 NTAPI
577 USBPORT_AllocateCommonBuffer(
578 IN PDEVICE_OBJECT FdoDevice,
579 IN SIZE_T BufferLength);
580
581 VOID
582 NTAPI
583 USBPORT_FreeCommonBuffer(
584 IN PDEVICE_OBJECT FdoDevice,
585 IN PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer);
586
587 USBD_STATUS
588 NTAPI
589 USBPORT_AllocateTransfer(
590 IN PDEVICE_OBJECT FdoDevice,
591 IN PURB Urb,
592 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
593 IN PIRP Irp,
594 IN PRKEVENT Event);
595
596 VOID
597 NTAPI
598 USBPORT_FlushMapTransfers(
599 IN PDEVICE_OBJECT FdoDevice);
600
601 VOID
602 NTAPI
603 USBPORT_IsrDpc(
604 IN PRKDPC Dpc,
605 IN PVOID DeferredContext,
606 IN PVOID SystemArgument1,
607 IN PVOID SystemArgument2);
608
609 BOOLEAN
610 NTAPI
611 USBPORT_InterruptService(
612 IN PKINTERRUPT Interrupt,
613 IN PVOID ServiceContext);
614
615 VOID
616 NTAPI
617 USBPORT_SignalWorkerThread(
618 IN PDEVICE_OBJECT FdoDevice);
619
620 VOID
621 NTAPI
622 USBPORT_CompleteTransfer(
623 IN PURB Urb,
624 IN USBD_STATUS TransferStatus);
625
626 VOID
627 NTAPI
628 USBPORT_DpcHandler(
629 IN PDEVICE_OBJECT FdoDevice);
630
631 VOID
632 NTAPI
633 USBPORT_WorkerRequestDpc(
634 IN PRKDPC Dpc,
635 IN PVOID DeferredContext,
636 IN PVOID SystemArgument1,
637 IN PVOID SystemArgument2);
638
639 BOOLEAN
640 NTAPI
641 USBPORT_QueueDoneTransfer(
642 IN PUSBPORT_TRANSFER Transfer,
643 IN USBD_STATUS USBDStatus);
644
645 VOID
646 NTAPI
647 USBPORT_MiniportInterrupts(
648 IN PDEVICE_OBJECT FdoDevice,
649 IN BOOLEAN IsEnable);
650
651 NTSTATUS
652 NTAPI
653 USBPORT_SetRegistryKeyValue(
654 IN PDEVICE_OBJECT DeviceObject,
655 IN BOOL UseDriverKey,
656 IN ULONG Type,
657 IN PCWSTR ValueNameString,
658 IN PVOID Data,
659 IN ULONG DataSize);
660
661 NTSTATUS
662 NTAPI
663 USBPORT_GetRegistryKeyValueFullInfo(
664 IN PDEVICE_OBJECT FdoDevice,
665 IN PDEVICE_OBJECT PdoDevice,
666 IN BOOL UseDriverKey,
667 IN PCWSTR SourceString,
668 IN ULONG LengthStr,
669 IN PVOID Buffer,
670 IN ULONG NumberOfBytes);
671
672 VOID
673 NTAPI
674 USBPORT_AddUSB1Fdo(
675 IN PDEVICE_OBJECT FdoDevice);
676
677 VOID
678 NTAPI
679 USBPORT_AddUSB2Fdo(
680 IN PDEVICE_OBJECT FdoDevice);
681
682 VOID
683 NTAPI
684 USBPORT_RemoveUSBxFdo(
685 IN PDEVICE_OBJECT FdoDevice);
686
687 PDEVICE_OBJECT
688 NTAPI
689 USBPORT_FindUSB2Controller(
690 IN PDEVICE_OBJECT FdoDevice);
691
692 PDEVICE_RELATIONS
693 NTAPI
694 USBPORT_FindCompanionControllers(
695 IN PDEVICE_OBJECT USB2FdoDevice,
696 IN BOOLEAN IsObRefer,
697 IN BOOLEAN IsFDOsReturned);
698
699 VOID
700 NTAPI
701 USBPORT_InvalidateControllerHandler(
702 IN PDEVICE_OBJECT FdoDevice,
703 IN ULONG Type);
704
705 VOID
706 NTAPI
707 USBPORT_DoneTransfer(
708 IN PUSBPORT_TRANSFER Transfer);
709
710 /* debug.c */
711 ULONG
712 NTAPI
713 USBPORT_DbgPrint(
714 IN PVOID MiniPortExtension,
715 IN ULONG Level,
716 IN PCH Format,
717 ...);
718
719 ULONG
720 NTAPI
721 USBPORT_TestDebugBreak(
722 IN PVOID MiniPortExtension);
723
724 ULONG
725 NTAPI
726 USBPORT_AssertFailure(
727 PVOID MiniPortExtension,
728 PVOID FailedAssertion,
729 PVOID FileName,
730 ULONG LineNumber,
731 PCHAR Message);
732
733 VOID
734 NTAPI
735 USBPORT_BugCheck(
736 IN PVOID MiniPortExtension);
737
738 ULONG
739 NTAPI
740 USBPORT_LogEntry(
741 IN PVOID MiniPortExtension,
742 IN ULONG DriverTag,
743 IN ULONG EnumTag,
744 IN ULONG P1,
745 IN ULONG P2,
746 IN ULONG P3);
747
748 VOID
749 NTAPI
750 USBPORT_DumpingDeviceDescriptor(
751 IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
752
753 VOID
754 NTAPI
755 USBPORT_DumpingConfiguration(
756 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor);
757
758 VOID
759 NTAPI
760 USBPORT_DumpingCapabilities(
761 IN PDEVICE_CAPABILITIES Capabilities);
762
763 VOID
764 NTAPI
765 USBPORT_DumpingSetupPacket(
766 IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket);
767
768 VOID
769 NTAPI
770 USBPORT_DumpingURB(
771 IN PURB Urb);
772
773 VOID
774 NTAPI
775 USBPORT_DumpingIDs(
776 IN PVOID Buffer);
777
778 /* device.c */
779 NTSTATUS
780 NTAPI
781 USBPORT_HandleSelectConfiguration(
782 IN PDEVICE_OBJECT FdoDevice,
783 IN PIRP Irp,
784 IN PURB Urb);
785
786 VOID
787 NTAPI
788 USBPORT_AddDeviceHandle(
789 IN PDEVICE_OBJECT FdoDevice,
790 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
791
792 VOID
793 NTAPI
794 USBPORT_RemoveDeviceHandle(
795 IN PDEVICE_OBJECT FdoDevice,
796 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
797
798 BOOLEAN
799 NTAPI
800 USBPORT_ValidateDeviceHandle(
801 IN PDEVICE_OBJECT FdoDevice,
802 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
803
804 NTSTATUS
805 NTAPI
806 USBPORT_CreateDevice(
807 IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
808 IN PDEVICE_OBJECT FdoDevice,
809 IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle,
810 IN USHORT PortStatus,
811 IN USHORT Port);
812
813 NTSTATUS
814 NTAPI
815 USBPORT_InitializeDevice(
816 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
817 IN PDEVICE_OBJECT FdoDevice);
818
819 NTSTATUS
820 NTAPI
821 USBPORT_GetUsbDescriptor(
822 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
823 IN PDEVICE_OBJECT FdoDevice,
824 IN UCHAR Type,
825 IN PUCHAR ConfigDesc,
826 IN PULONG ConfigDescSize);
827
828 NTSTATUS
829 NTAPI
830 USBPORT_HandleSelectInterface(
831 IN PDEVICE_OBJECT FdoDevice,
832 IN PIRP Irp,
833 IN PURB Urb);
834
835 NTSTATUS
836 NTAPI
837 USBPORT_RemoveDevice(
838 IN PDEVICE_OBJECT FdoDevice,
839 IN OUT PUSBPORT_DEVICE_HANDLE DeviceHandle,
840 IN ULONG Flags);
841
842 NTSTATUS
843 NTAPI
844 USBPORT_SendSetupPacket(
845 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
846 IN PDEVICE_OBJECT FdoDevice,
847 IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
848 IN PVOID Buffer,
849 IN ULONG Length,
850 IN OUT PULONG TransferedLen,
851 IN OUT PUSBD_STATUS pUSBDStatus);
852
853 NTSTATUS
854 NTAPI
855 USBPORT_RestoreDevice(
856 IN PDEVICE_OBJECT FdoDevice,
857 IN OUT PUSBPORT_DEVICE_HANDLE OldDeviceHandle,
858 IN OUT PUSBPORT_DEVICE_HANDLE NewDeviceHandle);
859
860 NTSTATUS
861 NTAPI
862 USBPORT_Initialize20Hub(
863 IN PDEVICE_OBJECT FdoDevice,
864 IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle,
865 IN ULONG TtCount);
866
867 /* endpoint.c */
868 NTSTATUS
869 NTAPI
870 USBPORT_OpenPipe(
871 IN PDEVICE_OBJECT FdoDevice,
872 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
873 IN PUSBPORT_PIPE_HANDLE PipeHandle,
874 IN PUSBD_STATUS UsbdStatus);
875
876 MPSTATUS
877 NTAPI
878 MiniportOpenEndpoint(
879 IN PDEVICE_OBJECT FdoDevice,
880 IN PUSBPORT_ENDPOINT Endpoint);
881
882 NTSTATUS
883 NTAPI
884 USBPORT_ReopenPipe(
885 IN PDEVICE_OBJECT FdoDevice,
886 IN PUSBPORT_ENDPOINT Endpoint);
887
888 VOID
889 NTAPI
890 USBPORT_ClosePipe(
891 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
892 IN PDEVICE_OBJECT FdoDevice,
893 IN PUSBPORT_PIPE_HANDLE PipeHandle);
894
895 VOID
896 NTAPI
897 MiniportCloseEndpoint(
898 IN PDEVICE_OBJECT FdoDevice,
899 IN PUSBPORT_ENDPOINT Endpoint);
900
901 VOID
902 NTAPI
903 USBPORT_AddPipeHandle(
904 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
905 IN PUSBPORT_PIPE_HANDLE PipeHandle);
906
907 VOID
908 NTAPI
909 USBPORT_RemovePipeHandle(
910 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
911 IN PUSBPORT_PIPE_HANDLE PipeHandle);
912
913 BOOLEAN
914 NTAPI
915 USBPORT_ValidatePipeHandle(
916 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
917 IN PUSBPORT_PIPE_HANDLE PipeHandle);
918
919 VOID
920 NTAPI
921 USBPORT_FlushClosedEndpointList(
922 IN PDEVICE_OBJECT FdoDevice);
923
924 VOID
925 NTAPI
926 USBPORT_SetEndpointState(
927 IN PUSBPORT_ENDPOINT Endpoint,
928 IN ULONG State);
929
930 ULONG
931 NTAPI
932 USBPORT_GetEndpointState(
933 IN PUSBPORT_ENDPOINT Endpoint);
934
935 VOID
936 NTAPI
937 USBPORT_InvalidateEndpointHandler(
938 IN PDEVICE_OBJECT FdoDevice,
939 IN PUSBPORT_ENDPOINT Endpoint,
940 IN ULONG Type);
941
942 BOOLEAN
943 NTAPI
944 USBPORT_EndpointWorker(
945 IN PUSBPORT_ENDPOINT Endpoint,
946 IN BOOLEAN Flag);
947
948 VOID
949 NTAPI
950 USBPORT_NukeAllEndpoints(
951 IN PDEVICE_OBJECT FdoDevice);
952
953 BOOLEAN
954 NTAPI
955 USBPORT_EndpointHasQueuedTransfers(
956 IN PDEVICE_OBJECT FdoDevice,
957 IN PUSBPORT_ENDPOINT Endpoint,
958 IN PULONG TransferCount);
959
960 /* iface.c */
961 NTSTATUS
962 NTAPI
963 USBPORT_PdoQueryInterface(
964 IN PDEVICE_OBJECT FdoDevice,
965 IN PDEVICE_OBJECT PdoDevice,
966 IN PIRP Irp);
967
968 /* ioctl.c */
969 NTSTATUS
970 NTAPI
971 USBPORT_PdoDeviceControl(
972 PDEVICE_OBJECT PdoDevice,
973 PIRP Irp);
974
975 NTSTATUS
976 NTAPI
977 USBPORT_FdoDeviceControl(
978 PDEVICE_OBJECT FdoDevice,
979 PIRP Irp);
980
981 NTSTATUS
982 NTAPI
983 USBPORT_FdoInternalDeviceControl(
984 IN PDEVICE_OBJECT FdoDevice,
985 IN PIRP Irp);
986
987 NTSTATUS
988 NTAPI
989 USBPORT_PdoInternalDeviceControl(
990 IN PDEVICE_OBJECT FdoDevice,
991 IN PIRP Irp);
992
993 NTSTATUS
994 NTAPI
995 USBPORT_GetSymbolicName(
996 IN PDEVICE_OBJECT RootHubPdo,
997 IN PUNICODE_STRING DestinationString);
998
999 /* iso.c */
1000 USBD_STATUS
1001 NTAPI
1002 USBPORT_InitializeIsoTransfer(
1003 IN PDEVICE_OBJECT FdoDevice,
1004 IN struct _URB_ISOCH_TRANSFER * Urb,
1005 IN PUSBPORT_TRANSFER Transfer);
1006
1007 ULONG
1008 NTAPI
1009 USBPORT_CompleteIsoTransfer(
1010 IN PVOID MiniPortExtension,
1011 IN PVOID MiniPortEndpoint,
1012 IN PVOID TransferParameters,
1013 IN ULONG TransferLength);
1014
1015 /* pnp.c */
1016 NTSTATUS
1017 NTAPI
1018 USBPORT_FdoPnP(
1019 IN PDEVICE_OBJECT FdoDevice,
1020 IN PIRP Irp);
1021
1022 NTSTATUS
1023 NTAPI
1024 USBPORT_PdoPnP(
1025 IN PDEVICE_OBJECT FdoDevice,
1026 IN PIRP Irp);
1027
1028 /* power.c */
1029 NTSTATUS
1030 NTAPI
1031 USBPORT_PdoPower(
1032 IN PDEVICE_OBJECT PdoDevice,
1033 IN PIRP Irp);
1034
1035 NTSTATUS
1036 NTAPI
1037 USBPORT_FdoPower(
1038 IN PDEVICE_OBJECT FdoDevice,
1039 IN PIRP Irp);
1040
1041 NTSTATUS
1042 NTAPI
1043 USBPORT_IdleNotification(
1044 IN PDEVICE_OBJECT PdoDevice,
1045 IN PIRP Irp);
1046
1047 VOID
1048 NTAPI
1049 USBPORT_AdjustDeviceCapabilities(
1050 IN PDEVICE_OBJECT FdoDevice,
1051 IN PDEVICE_OBJECT PdoDevice);
1052
1053 VOID
1054 NTAPI
1055 USBPORT_DoIdleNotificationCallback(
1056 IN PVOID Context);
1057
1058 VOID
1059 NTAPI
1060 USBPORT_CompletePdoWaitWake(
1061 IN PDEVICE_OBJECT FdoDevice);
1062
1063 VOID
1064 NTAPI
1065 USBPORT_DoSetPowerD0(
1066 IN PDEVICE_OBJECT FdoDevice);
1067
1068 VOID
1069 NTAPI
1070 USBPORT_HcWakeDpc(
1071 IN PRKDPC Dpc,
1072 IN PVOID DeferredContext,
1073 IN PVOID SystemArgument1,
1074 IN PVOID SystemArgument2);
1075
1076 VOID
1077 NTAPI
1078 USBPORT_HcQueueWakeDpc(
1079 IN PDEVICE_OBJECT FdoDevice);
1080
1081 /* queue.c */
1082 VOID
1083 NTAPI
1084 USBPORT_InsertIdleIrp(
1085 IN PIO_CSQ Csq,
1086 IN PIRP Irp);
1087
1088 VOID
1089 NTAPI
1090 USBPORT_RemoveIdleIrp(
1091 IN PIO_CSQ Csq,
1092 IN PIRP Irp);
1093
1094 PIRP
1095 NTAPI
1096 USBPORT_PeekNextIdleIrp(
1097 IN PIO_CSQ Csq,
1098 IN PIRP Irp,
1099 IN PVOID PeekContext);
1100
1101 VOID
1102 NTAPI
1103 USBPORT_AcquireIdleLock(
1104 IN PIO_CSQ Csq,
1105 IN PKIRQL Irql);
1106
1107 VOID
1108 NTAPI
1109 USBPORT_ReleaseIdleLock(
1110 IN PIO_CSQ Csq,
1111 IN KIRQL Irql);
1112
1113 VOID
1114 NTAPI
1115 USBPORT_CompleteCanceledIdleIrp(
1116 IN PIO_CSQ Csq,
1117 IN PIRP Irp);
1118
1119 VOID
1120 NTAPI
1121 USBPORT_InsertBadRequest(
1122 IN PIO_CSQ Csq,
1123 IN PIRP Irp);
1124
1125 VOID
1126 NTAPI
1127 USBPORT_RemoveBadRequest(
1128 IN PIO_CSQ Csq,
1129 IN PIRP Irp);
1130
1131 PIRP
1132 NTAPI
1133 USBPORT_PeekNextBadRequest(
1134 IN PIO_CSQ Csq,
1135 IN PIRP Irp,
1136 IN PVOID PeekContext);
1137
1138 VOID
1139 NTAPI
1140 USBPORT_AcquireBadRequestLock(
1141 IN PIO_CSQ Csq,
1142 IN PKIRQL Irql);
1143
1144 VOID
1145 NTAPI
1146 USBPORT_ReleaseBadRequestLock(
1147 IN PIO_CSQ Csq,
1148 IN KIRQL Irql);
1149
1150 VOID
1151 NTAPI
1152 USBPORT_CompleteCanceledBadRequest(
1153 IN PIO_CSQ Csq,
1154 IN PIRP Irp);
1155
1156 VOID
1157 NTAPI
1158 USBPORT_InsertIrpInTable(
1159 IN PUSBPORT_IRP_TABLE IrpTable,
1160 IN PIRP Irp);
1161
1162 PIRP
1163 NTAPI
1164 USBPORT_RemovePendingTransferIrp(
1165 IN PDEVICE_OBJECT FdoDevice,
1166 IN PIRP Irp);
1167
1168 PIRP
1169 NTAPI
1170 USBPORT_RemoveActiveTransferIrp(
1171 IN PDEVICE_OBJECT FdoDevice,
1172 IN PIRP Irp);
1173
1174 VOID
1175 NTAPI
1176 USBPORT_FindUrbInIrpTable(
1177 IN PUSBPORT_IRP_TABLE IrpTable,
1178 IN PURB Urb,
1179 IN PIRP Irp);
1180
1181 VOID
1182 NTAPI
1183 USBPORT_CancelActiveTransferIrp(
1184 IN PDEVICE_OBJECT DeviceObject,
1185 IN PIRP Irp);
1186
1187 VOID
1188 NTAPI
1189 USBPORT_FlushAbortList(
1190 IN PUSBPORT_ENDPOINT Endpoint);
1191
1192 VOID
1193 NTAPI
1194 USBPORT_FlushCancelList(
1195 IN PUSBPORT_ENDPOINT Endpoint);
1196
1197 VOID
1198 NTAPI
1199 USBPORT_QueueTransferUrb(
1200 IN PURB Urb);
1201
1202 VOID
1203 NTAPI
1204 USBPORT_FlushAllEndpoints(
1205 IN PDEVICE_OBJECT FdoDevice);
1206
1207 VOID
1208 NTAPI
1209 USBPORT_FlushPendingTransfers(
1210 IN PUSBPORT_ENDPOINT Endpoint);
1211
1212 BOOLEAN
1213 NTAPI
1214 USBPORT_QueueActiveUrbToEndpoint(
1215 IN PUSBPORT_ENDPOINT Endpoint,
1216 IN PURB Urb);
1217
1218 VOID
1219 NTAPI
1220 USBPORT_FlushController(
1221 IN PDEVICE_OBJECT FdoDevice);
1222
1223 VOID
1224 NTAPI
1225 USBPORT_BadRequestFlush(
1226 IN PDEVICE_OBJECT FdoDevice);
1227
1228 VOID
1229 NTAPI
1230 USBPORT_AbortEndpoint(
1231 IN PDEVICE_OBJECT FdoDevice,
1232 IN PUSBPORT_ENDPOINT Endpoint,
1233 IN PIRP Irp);
1234
1235 /* roothub.c */
1236 VOID
1237 NTAPI
1238 USBPORT_RootHubEndpointWorker(
1239 PUSBPORT_ENDPOINT Endpoint);
1240
1241 NTSTATUS
1242 NTAPI
1243 USBPORT_RootHubCreateDevice(
1244 IN PDEVICE_OBJECT FdoDevice,
1245 IN PDEVICE_OBJECT PdoDevice);
1246
1247 ULONG
1248 NTAPI
1249 USBPORT_InvalidateRootHub(
1250 PVOID MiniPortExtension);
1251
1252 VOID
1253 NTAPI
1254 USBPORT_RootHubPowerAndChirpAllCcPorts(
1255 IN PDEVICE_OBJECT FdoDevice);
1256
1257 /* trfsplit.c */
1258 VOID
1259 NTAPI
1260 USBPORT_SplitTransfer(
1261 IN PDEVICE_OBJECT FdoDevice,
1262 IN PUSBPORT_ENDPOINT Endpoint,
1263 IN PUSBPORT_TRANSFER Transfer,
1264 IN PLIST_ENTRY List);
1265
1266 VOID
1267 NTAPI
1268 USBPORT_DoneSplitTransfer(
1269 IN PUSBPORT_TRANSFER SplitTransfer);
1270
1271 VOID
1272 NTAPI
1273 USBPORT_CancelSplitTransfer(
1274 IN PUSBPORT_TRANSFER SplitTransfer);
1275
1276 /* urb.c */
1277 NTSTATUS
1278 NTAPI
1279 USBPORT_HandleSubmitURB(
1280 IN PDEVICE_OBJECT PdoDevice,
1281 IN PIRP Irp,
1282 IN PURB Urb);
1283
1284 /* usb2.c */
1285 BOOLEAN
1286 NTAPI
1287 USBPORT_AllocateBandwidthUSB2(
1288 IN PDEVICE_OBJECT FdoDevice,
1289 IN PUSBPORT_ENDPOINT Endpoint);
1290
1291 VOID
1292 NTAPI
1293 USBPORT_FreeBandwidthUSB2(
1294 IN PDEVICE_OBJECT FdoDevice,
1295 IN PUSBPORT_ENDPOINT Endpoint);
1296
1297 #endif /* USBPORT_H__ */