[USBPORT] Add support for transaction translators in USBPORT_OpenPipe().
[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 typedef struct _USB2_TT_EXTENSION {
532 PDEVICE_OBJECT RootHubPdo;
533 ULONG Flags;
534 ULONG BusBandwidth;
535 ULONG Bandwidth[USB2_FRAMES];
536 ULONG MaxBandwidth;
537 ULONG MinBandwidth;
538 USHORT DeviceAddress;
539 USHORT TtNumber;
540 LIST_ENTRY TtList;
541 LIST_ENTRY Link;
542 USB2_TT Tt;
543 } USB2_TT_EXTENSION, *PUSB2_TT_EXTENSION;
544
545 typedef struct _USB2_HC_EXTENSION {
546 ULONG MaxHsBusAllocation;
547 ULONG HcDelayTime;
548 ULONG TimeUsed[USB2_FRAMES][USB2_MICROFRAMES];
549 USB2_TT HcTt;
550 } USB2_HC_EXTENSION, *PUSB2_HC_EXTENSION;
551
552 /* usbport.c */
553 NTSTATUS
554 NTAPI
555 USBPORT_USBDStatusToNtStatus(
556 IN PURB Urb,
557 IN USBD_STATUS USBDStatus);
558
559 NTSTATUS
560 NTAPI
561 USBPORT_Wait(
562 IN PVOID MiniPortExtension,
563 IN ULONG Milliseconds);
564
565 VOID
566 NTAPI
567 USBPORT_TransferFlushDpc(
568 IN PRKDPC Dpc,
569 IN PVOID DeferredContext,
570 IN PVOID SystemArgument1,
571 IN PVOID SystemArgument2);
572
573 NTSTATUS
574 NTAPI
575 USBPORT_CreateWorkerThread(
576 IN PDEVICE_OBJECT FdoDevice);
577
578 BOOLEAN
579 NTAPI
580 USBPORT_StartTimer(
581 IN PDEVICE_OBJECT FdoDevice,
582 IN ULONG Time);
583
584 PUSBPORT_COMMON_BUFFER_HEADER
585 NTAPI
586 USBPORT_AllocateCommonBuffer(
587 IN PDEVICE_OBJECT FdoDevice,
588 IN SIZE_T BufferLength);
589
590 VOID
591 NTAPI
592 USBPORT_FreeCommonBuffer(
593 IN PDEVICE_OBJECT FdoDevice,
594 IN PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer);
595
596 USBD_STATUS
597 NTAPI
598 USBPORT_AllocateTransfer(
599 IN PDEVICE_OBJECT FdoDevice,
600 IN PURB Urb,
601 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
602 IN PIRP Irp,
603 IN PRKEVENT Event);
604
605 VOID
606 NTAPI
607 USBPORT_FlushMapTransfers(
608 IN PDEVICE_OBJECT FdoDevice);
609
610 VOID
611 NTAPI
612 USBPORT_IsrDpc(
613 IN PRKDPC Dpc,
614 IN PVOID DeferredContext,
615 IN PVOID SystemArgument1,
616 IN PVOID SystemArgument2);
617
618 BOOLEAN
619 NTAPI
620 USBPORT_InterruptService(
621 IN PKINTERRUPT Interrupt,
622 IN PVOID ServiceContext);
623
624 VOID
625 NTAPI
626 USBPORT_SignalWorkerThread(
627 IN PDEVICE_OBJECT FdoDevice);
628
629 VOID
630 NTAPI
631 USBPORT_CompleteTransfer(
632 IN PURB Urb,
633 IN USBD_STATUS TransferStatus);
634
635 VOID
636 NTAPI
637 USBPORT_DpcHandler(
638 IN PDEVICE_OBJECT FdoDevice);
639
640 VOID
641 NTAPI
642 USBPORT_WorkerRequestDpc(
643 IN PRKDPC Dpc,
644 IN PVOID DeferredContext,
645 IN PVOID SystemArgument1,
646 IN PVOID SystemArgument2);
647
648 BOOLEAN
649 NTAPI
650 USBPORT_QueueDoneTransfer(
651 IN PUSBPORT_TRANSFER Transfer,
652 IN USBD_STATUS USBDStatus);
653
654 VOID
655 NTAPI
656 USBPORT_MiniportInterrupts(
657 IN PDEVICE_OBJECT FdoDevice,
658 IN BOOLEAN IsEnable);
659
660 NTSTATUS
661 NTAPI
662 USBPORT_SetRegistryKeyValue(
663 IN PDEVICE_OBJECT DeviceObject,
664 IN BOOL UseDriverKey,
665 IN ULONG Type,
666 IN PCWSTR ValueNameString,
667 IN PVOID Data,
668 IN ULONG DataSize);
669
670 NTSTATUS
671 NTAPI
672 USBPORT_GetRegistryKeyValueFullInfo(
673 IN PDEVICE_OBJECT FdoDevice,
674 IN PDEVICE_OBJECT PdoDevice,
675 IN BOOL UseDriverKey,
676 IN PCWSTR SourceString,
677 IN ULONG LengthStr,
678 IN PVOID Buffer,
679 IN ULONG NumberOfBytes);
680
681 VOID
682 NTAPI
683 USBPORT_AddUSB1Fdo(
684 IN PDEVICE_OBJECT FdoDevice);
685
686 VOID
687 NTAPI
688 USBPORT_AddUSB2Fdo(
689 IN PDEVICE_OBJECT FdoDevice);
690
691 VOID
692 NTAPI
693 USBPORT_RemoveUSBxFdo(
694 IN PDEVICE_OBJECT FdoDevice);
695
696 PDEVICE_OBJECT
697 NTAPI
698 USBPORT_FindUSB2Controller(
699 IN PDEVICE_OBJECT FdoDevice);
700
701 PDEVICE_RELATIONS
702 NTAPI
703 USBPORT_FindCompanionControllers(
704 IN PDEVICE_OBJECT USB2FdoDevice,
705 IN BOOLEAN IsObRefer,
706 IN BOOLEAN IsFDOsReturned);
707
708 VOID
709 NTAPI
710 USBPORT_InvalidateControllerHandler(
711 IN PDEVICE_OBJECT FdoDevice,
712 IN ULONG Type);
713
714 VOID
715 NTAPI
716 USBPORT_DoneTransfer(
717 IN PUSBPORT_TRANSFER Transfer);
718
719 /* debug.c */
720 ULONG
721 NTAPI
722 USBPORT_DbgPrint(
723 IN PVOID MiniPortExtension,
724 IN ULONG Level,
725 IN PCH Format,
726 ...);
727
728 ULONG
729 NTAPI
730 USBPORT_TestDebugBreak(
731 IN PVOID MiniPortExtension);
732
733 ULONG
734 NTAPI
735 USBPORT_AssertFailure(
736 PVOID MiniPortExtension,
737 PVOID FailedAssertion,
738 PVOID FileName,
739 ULONG LineNumber,
740 PCHAR Message);
741
742 VOID
743 NTAPI
744 USBPORT_BugCheck(
745 IN PVOID MiniPortExtension);
746
747 ULONG
748 NTAPI
749 USBPORT_LogEntry(
750 IN PVOID MiniPortExtension,
751 IN ULONG DriverTag,
752 IN ULONG EnumTag,
753 IN ULONG P1,
754 IN ULONG P2,
755 IN ULONG P3);
756
757 VOID
758 NTAPI
759 USBPORT_DumpingDeviceDescriptor(
760 IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
761
762 VOID
763 NTAPI
764 USBPORT_DumpingConfiguration(
765 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor);
766
767 VOID
768 NTAPI
769 USBPORT_DumpingCapabilities(
770 IN PDEVICE_CAPABILITIES Capabilities);
771
772 VOID
773 NTAPI
774 USBPORT_DumpingSetupPacket(
775 IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket);
776
777 VOID
778 NTAPI
779 USBPORT_DumpingURB(
780 IN PURB Urb);
781
782 VOID
783 NTAPI
784 USBPORT_DumpingIDs(
785 IN PVOID Buffer);
786
787 /* device.c */
788 NTSTATUS
789 NTAPI
790 USBPORT_HandleSelectConfiguration(
791 IN PDEVICE_OBJECT FdoDevice,
792 IN PIRP Irp,
793 IN PURB Urb);
794
795 VOID
796 NTAPI
797 USBPORT_AddDeviceHandle(
798 IN PDEVICE_OBJECT FdoDevice,
799 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
800
801 VOID
802 NTAPI
803 USBPORT_RemoveDeviceHandle(
804 IN PDEVICE_OBJECT FdoDevice,
805 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
806
807 BOOLEAN
808 NTAPI
809 USBPORT_ValidateDeviceHandle(
810 IN PDEVICE_OBJECT FdoDevice,
811 IN PUSBPORT_DEVICE_HANDLE DeviceHandle);
812
813 NTSTATUS
814 NTAPI
815 USBPORT_CreateDevice(
816 IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
817 IN PDEVICE_OBJECT FdoDevice,
818 IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle,
819 IN USHORT PortStatus,
820 IN USHORT Port);
821
822 NTSTATUS
823 NTAPI
824 USBPORT_InitializeDevice(
825 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
826 IN PDEVICE_OBJECT FdoDevice);
827
828 NTSTATUS
829 NTAPI
830 USBPORT_GetUsbDescriptor(
831 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
832 IN PDEVICE_OBJECT FdoDevice,
833 IN UCHAR Type,
834 IN PUCHAR ConfigDesc,
835 IN PULONG ConfigDescSize);
836
837 NTSTATUS
838 NTAPI
839 USBPORT_HandleSelectInterface(
840 IN PDEVICE_OBJECT FdoDevice,
841 IN PIRP Irp,
842 IN PURB Urb);
843
844 NTSTATUS
845 NTAPI
846 USBPORT_RemoveDevice(
847 IN PDEVICE_OBJECT FdoDevice,
848 IN OUT PUSBPORT_DEVICE_HANDLE DeviceHandle,
849 IN ULONG Flags);
850
851 NTSTATUS
852 NTAPI
853 USBPORT_SendSetupPacket(
854 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
855 IN PDEVICE_OBJECT FdoDevice,
856 IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
857 IN PVOID Buffer,
858 IN ULONG Length,
859 IN OUT PULONG TransferedLen,
860 IN OUT PUSBD_STATUS pUSBDStatus);
861
862 NTSTATUS
863 NTAPI
864 USBPORT_RestoreDevice(
865 IN PDEVICE_OBJECT FdoDevice,
866 IN OUT PUSBPORT_DEVICE_HANDLE OldDeviceHandle,
867 IN OUT PUSBPORT_DEVICE_HANDLE NewDeviceHandle);
868
869 NTSTATUS
870 NTAPI
871 USBPORT_Initialize20Hub(
872 IN PDEVICE_OBJECT FdoDevice,
873 IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle,
874 IN ULONG TtCount);
875
876 /* endpoint.c */
877 NTSTATUS
878 NTAPI
879 USBPORT_OpenPipe(
880 IN PDEVICE_OBJECT FdoDevice,
881 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
882 IN PUSBPORT_PIPE_HANDLE PipeHandle,
883 IN PUSBD_STATUS UsbdStatus);
884
885 MPSTATUS
886 NTAPI
887 MiniportOpenEndpoint(
888 IN PDEVICE_OBJECT FdoDevice,
889 IN PUSBPORT_ENDPOINT Endpoint);
890
891 NTSTATUS
892 NTAPI
893 USBPORT_ReopenPipe(
894 IN PDEVICE_OBJECT FdoDevice,
895 IN PUSBPORT_ENDPOINT Endpoint);
896
897 VOID
898 NTAPI
899 USBPORT_ClosePipe(
900 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
901 IN PDEVICE_OBJECT FdoDevice,
902 IN PUSBPORT_PIPE_HANDLE PipeHandle);
903
904 VOID
905 NTAPI
906 MiniportCloseEndpoint(
907 IN PDEVICE_OBJECT FdoDevice,
908 IN PUSBPORT_ENDPOINT Endpoint);
909
910 VOID
911 NTAPI
912 USBPORT_AddPipeHandle(
913 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
914 IN PUSBPORT_PIPE_HANDLE PipeHandle);
915
916 VOID
917 NTAPI
918 USBPORT_RemovePipeHandle(
919 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
920 IN PUSBPORT_PIPE_HANDLE PipeHandle);
921
922 BOOLEAN
923 NTAPI
924 USBPORT_ValidatePipeHandle(
925 IN PUSBPORT_DEVICE_HANDLE DeviceHandle,
926 IN PUSBPORT_PIPE_HANDLE PipeHandle);
927
928 VOID
929 NTAPI
930 USBPORT_FlushClosedEndpointList(
931 IN PDEVICE_OBJECT FdoDevice);
932
933 VOID
934 NTAPI
935 USBPORT_SetEndpointState(
936 IN PUSBPORT_ENDPOINT Endpoint,
937 IN ULONG State);
938
939 ULONG
940 NTAPI
941 USBPORT_GetEndpointState(
942 IN PUSBPORT_ENDPOINT Endpoint);
943
944 VOID
945 NTAPI
946 USBPORT_InvalidateEndpointHandler(
947 IN PDEVICE_OBJECT FdoDevice,
948 IN PUSBPORT_ENDPOINT Endpoint,
949 IN ULONG Type);
950
951 BOOLEAN
952 NTAPI
953 USBPORT_EndpointWorker(
954 IN PUSBPORT_ENDPOINT Endpoint,
955 IN BOOLEAN Flag);
956
957 VOID
958 NTAPI
959 USBPORT_NukeAllEndpoints(
960 IN PDEVICE_OBJECT FdoDevice);
961
962 BOOLEAN
963 NTAPI
964 USBPORT_EndpointHasQueuedTransfers(
965 IN PDEVICE_OBJECT FdoDevice,
966 IN PUSBPORT_ENDPOINT Endpoint,
967 IN PULONG TransferCount);
968
969 /* iface.c */
970 NTSTATUS
971 NTAPI
972 USBPORT_PdoQueryInterface(
973 IN PDEVICE_OBJECT FdoDevice,
974 IN PDEVICE_OBJECT PdoDevice,
975 IN PIRP Irp);
976
977 /* ioctl.c */
978 NTSTATUS
979 NTAPI
980 USBPORT_PdoDeviceControl(
981 PDEVICE_OBJECT PdoDevice,
982 PIRP Irp);
983
984 NTSTATUS
985 NTAPI
986 USBPORT_FdoDeviceControl(
987 PDEVICE_OBJECT FdoDevice,
988 PIRP Irp);
989
990 NTSTATUS
991 NTAPI
992 USBPORT_FdoInternalDeviceControl(
993 IN PDEVICE_OBJECT FdoDevice,
994 IN PIRP Irp);
995
996 NTSTATUS
997 NTAPI
998 USBPORT_PdoInternalDeviceControl(
999 IN PDEVICE_OBJECT FdoDevice,
1000 IN PIRP Irp);
1001
1002 NTSTATUS
1003 NTAPI
1004 USBPORT_GetSymbolicName(
1005 IN PDEVICE_OBJECT RootHubPdo,
1006 IN PUNICODE_STRING DestinationString);
1007
1008 /* iso.c */
1009 USBD_STATUS
1010 NTAPI
1011 USBPORT_InitializeIsoTransfer(
1012 IN PDEVICE_OBJECT FdoDevice,
1013 IN struct _URB_ISOCH_TRANSFER * Urb,
1014 IN PUSBPORT_TRANSFER Transfer);
1015
1016 ULONG
1017 NTAPI
1018 USBPORT_CompleteIsoTransfer(
1019 IN PVOID MiniPortExtension,
1020 IN PVOID MiniPortEndpoint,
1021 IN PVOID TransferParameters,
1022 IN ULONG TransferLength);
1023
1024 /* pnp.c */
1025 NTSTATUS
1026 NTAPI
1027 USBPORT_FdoPnP(
1028 IN PDEVICE_OBJECT FdoDevice,
1029 IN PIRP Irp);
1030
1031 NTSTATUS
1032 NTAPI
1033 USBPORT_PdoPnP(
1034 IN PDEVICE_OBJECT FdoDevice,
1035 IN PIRP Irp);
1036
1037 /* power.c */
1038 NTSTATUS
1039 NTAPI
1040 USBPORT_PdoPower(
1041 IN PDEVICE_OBJECT PdoDevice,
1042 IN PIRP Irp);
1043
1044 NTSTATUS
1045 NTAPI
1046 USBPORT_FdoPower(
1047 IN PDEVICE_OBJECT FdoDevice,
1048 IN PIRP Irp);
1049
1050 NTSTATUS
1051 NTAPI
1052 USBPORT_IdleNotification(
1053 IN PDEVICE_OBJECT PdoDevice,
1054 IN PIRP Irp);
1055
1056 VOID
1057 NTAPI
1058 USBPORT_AdjustDeviceCapabilities(
1059 IN PDEVICE_OBJECT FdoDevice,
1060 IN PDEVICE_OBJECT PdoDevice);
1061
1062 VOID
1063 NTAPI
1064 USBPORT_DoIdleNotificationCallback(
1065 IN PVOID Context);
1066
1067 VOID
1068 NTAPI
1069 USBPORT_CompletePdoWaitWake(
1070 IN PDEVICE_OBJECT FdoDevice);
1071
1072 VOID
1073 NTAPI
1074 USBPORT_DoSetPowerD0(
1075 IN PDEVICE_OBJECT FdoDevice);
1076
1077 VOID
1078 NTAPI
1079 USBPORT_HcWakeDpc(
1080 IN PRKDPC Dpc,
1081 IN PVOID DeferredContext,
1082 IN PVOID SystemArgument1,
1083 IN PVOID SystemArgument2);
1084
1085 VOID
1086 NTAPI
1087 USBPORT_HcQueueWakeDpc(
1088 IN PDEVICE_OBJECT FdoDevice);
1089
1090 /* queue.c */
1091 VOID
1092 NTAPI
1093 USBPORT_InsertIdleIrp(
1094 IN PIO_CSQ Csq,
1095 IN PIRP Irp);
1096
1097 VOID
1098 NTAPI
1099 USBPORT_RemoveIdleIrp(
1100 IN PIO_CSQ Csq,
1101 IN PIRP Irp);
1102
1103 PIRP
1104 NTAPI
1105 USBPORT_PeekNextIdleIrp(
1106 IN PIO_CSQ Csq,
1107 IN PIRP Irp,
1108 IN PVOID PeekContext);
1109
1110 VOID
1111 NTAPI
1112 USBPORT_AcquireIdleLock(
1113 IN PIO_CSQ Csq,
1114 IN PKIRQL Irql);
1115
1116 VOID
1117 NTAPI
1118 USBPORT_ReleaseIdleLock(
1119 IN PIO_CSQ Csq,
1120 IN KIRQL Irql);
1121
1122 VOID
1123 NTAPI
1124 USBPORT_CompleteCanceledIdleIrp(
1125 IN PIO_CSQ Csq,
1126 IN PIRP Irp);
1127
1128 VOID
1129 NTAPI
1130 USBPORT_InsertBadRequest(
1131 IN PIO_CSQ Csq,
1132 IN PIRP Irp);
1133
1134 VOID
1135 NTAPI
1136 USBPORT_RemoveBadRequest(
1137 IN PIO_CSQ Csq,
1138 IN PIRP Irp);
1139
1140 PIRP
1141 NTAPI
1142 USBPORT_PeekNextBadRequest(
1143 IN PIO_CSQ Csq,
1144 IN PIRP Irp,
1145 IN PVOID PeekContext);
1146
1147 VOID
1148 NTAPI
1149 USBPORT_AcquireBadRequestLock(
1150 IN PIO_CSQ Csq,
1151 IN PKIRQL Irql);
1152
1153 VOID
1154 NTAPI
1155 USBPORT_ReleaseBadRequestLock(
1156 IN PIO_CSQ Csq,
1157 IN KIRQL Irql);
1158
1159 VOID
1160 NTAPI
1161 USBPORT_CompleteCanceledBadRequest(
1162 IN PIO_CSQ Csq,
1163 IN PIRP Irp);
1164
1165 VOID
1166 NTAPI
1167 USBPORT_InsertIrpInTable(
1168 IN PUSBPORT_IRP_TABLE IrpTable,
1169 IN PIRP Irp);
1170
1171 PIRP
1172 NTAPI
1173 USBPORT_RemovePendingTransferIrp(
1174 IN PDEVICE_OBJECT FdoDevice,
1175 IN PIRP Irp);
1176
1177 PIRP
1178 NTAPI
1179 USBPORT_RemoveActiveTransferIrp(
1180 IN PDEVICE_OBJECT FdoDevice,
1181 IN PIRP Irp);
1182
1183 VOID
1184 NTAPI
1185 USBPORT_FindUrbInIrpTable(
1186 IN PUSBPORT_IRP_TABLE IrpTable,
1187 IN PURB Urb,
1188 IN PIRP Irp);
1189
1190 VOID
1191 NTAPI
1192 USBPORT_CancelActiveTransferIrp(
1193 IN PDEVICE_OBJECT DeviceObject,
1194 IN PIRP Irp);
1195
1196 VOID
1197 NTAPI
1198 USBPORT_FlushAbortList(
1199 IN PUSBPORT_ENDPOINT Endpoint);
1200
1201 VOID
1202 NTAPI
1203 USBPORT_FlushCancelList(
1204 IN PUSBPORT_ENDPOINT Endpoint);
1205
1206 VOID
1207 NTAPI
1208 USBPORT_QueueTransferUrb(
1209 IN PURB Urb);
1210
1211 VOID
1212 NTAPI
1213 USBPORT_FlushAllEndpoints(
1214 IN PDEVICE_OBJECT FdoDevice);
1215
1216 VOID
1217 NTAPI
1218 USBPORT_FlushPendingTransfers(
1219 IN PUSBPORT_ENDPOINT Endpoint);
1220
1221 BOOLEAN
1222 NTAPI
1223 USBPORT_QueueActiveUrbToEndpoint(
1224 IN PUSBPORT_ENDPOINT Endpoint,
1225 IN PURB Urb);
1226
1227 VOID
1228 NTAPI
1229 USBPORT_FlushController(
1230 IN PDEVICE_OBJECT FdoDevice);
1231
1232 VOID
1233 NTAPI
1234 USBPORT_BadRequestFlush(
1235 IN PDEVICE_OBJECT FdoDevice);
1236
1237 VOID
1238 NTAPI
1239 USBPORT_AbortEndpoint(
1240 IN PDEVICE_OBJECT FdoDevice,
1241 IN PUSBPORT_ENDPOINT Endpoint,
1242 IN PIRP Irp);
1243
1244 /* roothub.c */
1245 VOID
1246 NTAPI
1247 USBPORT_RootHubEndpointWorker(
1248 PUSBPORT_ENDPOINT Endpoint);
1249
1250 NTSTATUS
1251 NTAPI
1252 USBPORT_RootHubCreateDevice(
1253 IN PDEVICE_OBJECT FdoDevice,
1254 IN PDEVICE_OBJECT PdoDevice);
1255
1256 ULONG
1257 NTAPI
1258 USBPORT_InvalidateRootHub(
1259 PVOID MiniPortExtension);
1260
1261 VOID
1262 NTAPI
1263 USBPORT_RootHubPowerAndChirpAllCcPorts(
1264 IN PDEVICE_OBJECT FdoDevice);
1265
1266 /* trfsplit.c */
1267 VOID
1268 NTAPI
1269 USBPORT_SplitTransfer(
1270 IN PDEVICE_OBJECT FdoDevice,
1271 IN PUSBPORT_ENDPOINT Endpoint,
1272 IN PUSBPORT_TRANSFER Transfer,
1273 IN PLIST_ENTRY List);
1274
1275 VOID
1276 NTAPI
1277 USBPORT_DoneSplitTransfer(
1278 IN PUSBPORT_TRANSFER SplitTransfer);
1279
1280 VOID
1281 NTAPI
1282 USBPORT_CancelSplitTransfer(
1283 IN PUSBPORT_TRANSFER SplitTransfer);
1284
1285 /* urb.c */
1286 NTSTATUS
1287 NTAPI
1288 USBPORT_HandleSubmitURB(
1289 IN PDEVICE_OBJECT PdoDevice,
1290 IN PIRP Irp,
1291 IN PURB Urb);
1292
1293 /* usb2.c */
1294 BOOLEAN
1295 NTAPI
1296 USBPORT_AllocateBandwidthUSB2(
1297 IN PDEVICE_OBJECT FdoDevice,
1298 IN PUSBPORT_ENDPOINT Endpoint);
1299
1300 VOID
1301 NTAPI
1302 USBPORT_FreeBandwidthUSB2(
1303 IN PDEVICE_OBJECT FdoDevice,
1304 IN PUSBPORT_ENDPOINT Endpoint);
1305
1306 VOID
1307 NTAPI
1308 USBPORT_UpdateAllocatedBwTt(
1309 IN PUSB2_TT_EXTENSION TtExtension);
1310
1311 VOID
1312 NTAPI
1313 USB2_InitTT(
1314 IN PUSB2_HC_EXTENSION HcExtension,
1315 IN PUSB2_TT Tt);
1316
1317 VOID
1318 NTAPI
1319 USB2_InitController(
1320 IN PUSB2_HC_EXTENSION HcExtension);
1321
1322 #endif /* USBPORT_H__ */