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