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