ReactOS  0.4.14-dev-49-gfb4591c
usbport.h File Reference
#include <ntddk.h>
#include <windef.h>
#include <stdio.h>
#include <wdmguid.h>
#include <ntstrsafe.h>
#include <usb.h>
#include <hubbusif.h>
#include <usbbusif.h>
#include <usbdlib.h>
#include <usbuser.h>
#include <drivers/usbport/usbmport.h>
Include dependency graph for usbport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _USBPORT_COMMON_BUFFER_HEADER
 
struct  _USBPORT_PIPE_HANDLE
 
struct  _USBPORT_CONFIGURATION_HANDLE
 
struct  _USBPORT_INTERFACE_HANDLE
 
struct  _USBPORT_DEVICE_HANDLE
 
struct  _USBPORT_ENDPOINT
 
struct  _USBPORT_TRANSFER
 
struct  _USBPORT_IRP_TABLE
 
struct  _USBPORT_COMMON_DEVICE_EXTENSION
 
struct  _USBPORT_DEVICE_EXTENSION
 
struct  _USBPORT_RH_DESCRIPTORS
 
struct  _USBPORT_RHDEVICE_EXTENSION
 
struct  _USBPORT_ASYNC_CALLBACK_DATA
 
struct  _TIMER_WORK_QUEUE_ITEM
 
union  _USB2_TT_ENDPOINT_PARAMS
 
union  _USB2_TT_ENDPOINT_NUMS
 
struct  _USB2_TT_ENDPOINT
 
struct  _USB2_FRAME_BUDGET
 
struct  _USB2_TT
 
struct  _USB2_TT_EXTENSION
 
struct  _USB2_HC_EXTENSION
 
struct  _USB2_REBALANCE
 

Macros

#define PCI_INTERFACE_USB_ID_UHCI   0x00
 
#define PCI_INTERFACE_USB_ID_OHCI   0x10
 
#define PCI_INTERFACE_USB_ID_EHCI   0x20
 
#define PCI_INTERFACE_USB_ID_XHCI   0x30
 
#define USBPORT_RECIPIENT_HUB   BMREQUEST_TO_DEVICE
 
#define USBPORT_RECIPIENT_PORT   BMREQUEST_TO_OTHER
 
#define INVALIDATE_ENDPOINT_ONLY   0
 
#define INVALIDATE_ENDPOINT_WORKER_THREAD   1
 
#define INVALIDATE_ENDPOINT_WORKER_DPC   2
 
#define INVALIDATE_ENDPOINT_INT_NEXT_SOF   3
 
#define USBPORT_DMA_DIRECTION_FROM_DEVICE   1
 
#define USBPORT_DMA_DIRECTION_TO_DEVICE   2
 
#define USB_PORT_TAG   'pbsu'
 
#define URB_FUNCTION_MAX   0x31
 
#define FEATURE_PORT_CONNECTION   0
 
#define FEATURE_PORT_ENABLE   1
 
#define FEATURE_PORT_SUSPEND   2
 
#define FEATURE_PORT_OVER_CURRENT   3
 
#define FEATURE_PORT_RESET   4
 
#define FEATURE_PORT_POWER   8
 
#define FEATURE_PORT_LOW_SPEED   9
 
#define FEATURE_C_PORT_CONNECTION   16
 
#define FEATURE_C_PORT_ENABLE   17
 
#define FEATURE_C_PORT_SUSPEND   18
 
#define FEATURE_C_PORT_OVER_CURRENT   19
 
#define FEATURE_C_PORT_RESET   20
 
#define FEATURE_C_HUB_LOCAL_POWER   0
 
#define FEATURE_C_HUB_OVER_CURRENT   1
 
#define USBPORT_FLAG_INT_CONNECTED   0x00000001
 
#define USBPORT_FLAG_HC_STARTED   0x00000002
 
#define USBPORT_FLAG_HC_POLLING   0x00000004
 
#define USBPORT_FLAG_WORKER_THREAD_ON   0x00000008
 
#define USBPORT_FLAG_HC_SUSPEND   0x00000100
 
#define USBPORT_FLAG_INTERRUPT_ENABLED   0x00000400
 
#define USBPORT_FLAG_SELECTIVE_SUSPEND   0x00000800
 
#define USBPORT_FLAG_DOS_SYMBOLIC_NAME   0x00010000
 
#define USBPORT_FLAG_LEGACY_SUPPORT   0x00080000
 
#define USBPORT_FLAG_HC_WAKE_SUPPORT   0x00200000
 
#define USBPORT_FLAG_DIAGNOSTIC_MODE   0x00800000
 
#define USBPORT_FLAG_COMPANION_HC   0x01000000
 
#define USBPORT_FLAG_REGISTERED_FDO   0x02000000
 
#define USBPORT_FLAG_NO_HACTION   0x04000000
 
#define USBPORT_FLAG_BIOS_DISABLE_SS   0x08000000
 
#define USBPORT_FLAG_PWR_AND_CHIRP_LOCK   0x10000000
 
#define USBPORT_FLAG_POWER_AND_CHIRP_OK   0x40000000
 
#define USBPORT_FLAG_RH_INIT_CALLBACK   0x80000000
 
#define USBPORT_PNP_STATE_NOT_INIT   0x00000001
 
#define USBPORT_PNP_STATE_STARTED   0x00000002
 
#define USBPORT_PNP_STATE_FAILED   0x00000004
 
#define USBPORT_PNP_STATE_STOPPED   0x00000008
 
#define USBPORT_TMFLAG_TIMER_QUEUED   0x00000001
 
#define USBPORT_TMFLAG_HC_SUSPENDED   0x00000002
 
#define USBPORT_TMFLAG_HC_RESUME   0x00000004
 
#define USBPORT_TMFLAG_RH_SUSPENDED   0x00000008
 
#define USBPORT_TMFLAG_TIMER_STARTED   0x00000010
 
#define USBPORT_TMFLAG_WAKE   0x00000020
 
#define USBPORT_TMFLAG_IDLE_QUEUEITEM_ON   0x00000040
 
#define USBPORT_MPFLAG_INTERRUPTS_ENABLED   0x00000001
 
#define USBPORT_MPFLAG_SUSPENDED   0x00000002
 
#define DEVICE_HANDLE_FLAG_ROOTHUB   0x00000002
 
#define DEVICE_HANDLE_FLAG_REMOVED   0x00000008
 
#define DEVICE_HANDLE_FLAG_USB2HUB   0x00000010
 
#define ENDPOINT_FLAG_DMA_TYPE   0x00000001
 
#define ENDPOINT_FLAG_ROOTHUB_EP0   0x00000002
 
#define ENDPOINT_FLAG_NUKE   0x00000008
 
#define ENDPOINT_FLAG_QUEUENE_EMPTY   0x00000010
 
#define ENDPOINT_FLAG_ABORTING   0x00000020
 
#define ENDPOINT_FLAG_IDLE   0x00000100
 
#define ENDPOINT_FLAG_OPENED   0x00000200
 
#define ENDPOINT_FLAG_CLOSED   0x00000400
 
#define USBD_FLAG_ALLOCATED_MDL   0x00000002
 
#define USBD_FLAG_NOT_ISO_TRANSFER   0x00000010
 
#define USBD_FLAG_ALLOCATED_TRANSFER   0x00000020
 
#define PIPE_HANDLE_FLAG_CLOSED   0x00000001
 
#define PIPE_HANDLE_FLAG_NULL_PACKET_SIZE   0x00000002
 
#define TRANSFER_FLAG_CANCELED   0x00000001
 
#define TRANSFER_FLAG_DMA_MAPPED   0x00000002
 
#define TRANSFER_FLAG_HIGH_SPEED   0x00000004
 
#define TRANSFER_FLAG_SUBMITED   0x00000008
 
#define TRANSFER_FLAG_ABORTED   0x00000010
 
#define TRANSFER_FLAG_ISO   0x00000020
 
#define TRANSFER_FLAG_DEVICE_GONE   0x00000080
 
#define TRANSFER_FLAG_SPLITED   0x00000100
 
#define TRANSFER_FLAG_COMPLETED   0x00000200
 
#define TRANSFER_FLAG_PARENT   0x00000400
 
#define USB2_FRAMES   32
 
#define USB2_MICROFRAMES   8
 
#define USB2_MAX_MICROFRAMES   (USB2_FRAMES * USB2_MICROFRAMES)
 
#define USB2_PREV_MICROFRAME   0xFF
 
#define USB2_MAX_MICROFRAME_ALLOCATION   7000
 
#define USB2_CONTROLLER_DELAY   100
 
#define USB2_FS_MAX_PERIODIC_ALLOCATION   1157
 
#define USB2_FS_SOF_TIME   6
 
#define USB2_HUB_DELAY   30
 
#define USB2_MAX_FS_LS_TRANSACTIONS_IN_UFRAME   16
 
#define USB2_FS_RAW_BYTES_IN_MICROFRAME   188
 
#define USB2_LS_INTERRUPT_OVERHEAD   117
 
#define USB2_FS_INTERRUPT_OVERHEAD   13
 
#define USB2_HS_INTERRUPT_OUT_OVERHEAD   45
 
#define USB2_HS_INTERRUPT_IN_OVERHEAD   25
 
#define USB2_FS_ISOCHRONOUS_OVERHEAD   9
 
#define USB2_HS_ISOCHRONOUS_OUT_OVERHEAD   38
 
#define USB2_HS_ISOCHRONOUS_IN_OVERHEAD   18
 
#define USB2_HS_SS_INTERRUPT_OUT_OVERHEAD   58
 
#define USB2_HS_CS_INTERRUPT_OUT_OVERHEAD   36
 
#define USB2_HS_SS_INTERRUPT_IN_OVERHEAD   39
 
#define USB2_HS_CS_INTERRUPT_IN_OVERHEAD   38
 
#define USB2_HS_SS_ISOCHRONOUS_OUT_OVERHEAD   58
 
#define USB2_HS_SS_ISOCHRONOUS_IN_OVERHEAD   39
 
#define USB2_HS_CS_ISOCHRONOUS_IN_OVERHEAD   38
 
#define USB2_BIT_STUFFING_OVERHEAD   (8 * (7/6))
 
#define USB2_TT_EXTENSION_FLAG_DELETED   1
 

Typedefs

typedef USBD_STATUSPUSBD_STATUS
 
typedef struct _USBPORT_COMMON_BUFFER_HEADER USBPORT_COMMON_BUFFER_HEADER
 
typedef struct _USBPORT_COMMON_BUFFER_HEADERPUSBPORT_COMMON_BUFFER_HEADER
 
typedef struct _USBPORT_ENDPOINTPUSBPORT_ENDPOINT
 
typedef struct _USB2_HC_EXTENSIONPUSB2_HC_EXTENSION
 
typedef struct _USB2_TT_EXTENSIONPUSB2_TT_EXTENSION
 
typedef struct _USB2_TTPUSB2_TT
 
typedef struct _USB2_TT_ENDPOINTPUSB2_TT_ENDPOINT
 
typedef struct _USBPORT_PIPE_HANDLE USBPORT_PIPE_HANDLE
 
typedef struct _USBPORT_PIPE_HANDLEPUSBPORT_PIPE_HANDLE
 
typedef struct _USBPORT_CONFIGURATION_HANDLE USBPORT_CONFIGURATION_HANDLE
 
typedef struct _USBPORT_CONFIGURATION_HANDLEPUSBPORT_CONFIGURATION_HANDLE
 
typedef struct _USBPORT_INTERFACE_HANDLE USBPORT_INTERFACE_HANDLE
 
typedef struct _USBPORT_INTERFACE_HANDLEPUSBPORT_INTERFACE_HANDLE
 
typedef struct _USBPORT_DEVICE_HANDLE USBPORT_DEVICE_HANDLE
 
typedef struct _USBPORT_DEVICE_HANDLEPUSBPORT_DEVICE_HANDLE
 
typedef struct _USBPORT_ENDPOINT USBPORT_ENDPOINT
 
typedef struct _USBPORT_ISO_BLOCK * PUSBPORT_ISO_BLOCK
 
typedef struct _USBPORT_TRANSFER USBPORT_TRANSFER
 
typedef struct _USBPORT_TRANSFERPUSBPORT_TRANSFER
 
typedef struct _USBPORT_IRP_TABLE USBPORT_IRP_TABLE
 
typedef struct _USBPORT_IRP_TABLEPUSBPORT_IRP_TABLE
 
typedef struct _USBPORT_COMMON_DEVICE_EXTENSION USBPORT_COMMON_DEVICE_EXTENSION
 
typedef struct _USBPORT_COMMON_DEVICE_EXTENSIONPUSBPORT_COMMON_DEVICE_EXTENSION
 
typedef struct _USBPORT_DEVICE_EXTENSION USBPORT_DEVICE_EXTENSION
 
typedef struct _USBPORT_DEVICE_EXTENSIONPUSBPORT_DEVICE_EXTENSION
 
typedef struct _USBPORT_RH_DESCRIPTORS USBPORT_RH_DESCRIPTORS
 
typedef struct _USBPORT_RH_DESCRIPTORSPUSBPORT_RH_DESCRIPTORS
 
typedef struct _USBPORT_RHDEVICE_EXTENSION USBPORT_RHDEVICE_EXTENSION
 
typedef struct _USBPORT_RHDEVICE_EXTENSIONPUSBPORT_RHDEVICE_EXTENSION
 
typedef struct _USBPORT_ASYNC_CALLBACK_DATA USBPORT_ASYNC_CALLBACK_DATA
 
typedef struct _USBPORT_ASYNC_CALLBACK_DATAPUSBPORT_ASYNC_CALLBACK_DATA
 
typedef struct _TIMER_WORK_QUEUE_ITEM TIMER_WORK_QUEUE_ITEM
 
typedef struct _TIMER_WORK_QUEUE_ITEMPTIMER_WORK_QUEUE_ITEM
 
typedef union _USB2_TT_ENDPOINT_PARAMS USB2_TT_ENDPOINT_PARAMS
 
typedef union _USB2_TT_ENDPOINT_NUMS USB2_TT_ENDPOINT_NUMS
 
typedef struct _USB2_TT_ENDPOINT USB2_TT_ENDPOINT
 
typedef struct _USB2_FRAME_BUDGET USB2_FRAME_BUDGET
 
typedef struct _USB2_FRAME_BUDGETPUSB2_FRAME_BUDGET
 
typedef struct _USB2_TT USB2_TT
 
typedef struct _USB2_TT_EXTENSION USB2_TT_EXTENSION
 
typedef struct _USB2_HC_EXTENSION USB2_HC_EXTENSION
 
typedef struct _USB2_REBALANCE USB2_REBALANCE
 
typedef struct _USB2_REBALANCEPUSB2_REBALANCE
 

Functions

 C_ASSERT (sizeof(USBPORT_DEVICE_EXTENSION)==0x500)
 
 C_ASSERT (sizeof(USBPORT_ASYNC_CALLBACK_DATA)==16+18 *sizeof(PVOID))
 
 C_ASSERT (sizeof(USB2_TT_ENDPOINT_PARAMS)==sizeof(ULONG))
 
 C_ASSERT (sizeof(USB2_TT_ENDPOINT_NUMS)==sizeof(ULONG))
 
NTSTATUS NTAPI USBPORT_USBDStatusToNtStatus (IN PURB Urb, IN USBD_STATUS USBDStatus)
 
NTSTATUS NTAPI USBPORT_Wait (IN PVOID MiniPortExtension, IN ULONG Milliseconds)
 
VOID NTAPI USBPORT_TransferFlushDpc (IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
NTSTATUS NTAPI USBPORT_CreateWorkerThread (IN PDEVICE_OBJECT FdoDevice)
 
BOOLEAN NTAPI USBPORT_StartTimer (IN PDEVICE_OBJECT FdoDevice, IN ULONG Time)
 
PUSBPORT_COMMON_BUFFER_HEADER NTAPI USBPORT_AllocateCommonBuffer (IN PDEVICE_OBJECT FdoDevice, IN SIZE_T BufferLength)
 
VOID NTAPI USBPORT_FreeCommonBuffer (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer)
 
USBD_STATUS NTAPI USBPORT_AllocateTransfer (IN PDEVICE_OBJECT FdoDevice, IN PURB Urb, IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PIRP Irp, IN PRKEVENT Event)
 
VOID NTAPI USBPORT_FlushMapTransfers (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_IsrDpc (IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
BOOLEAN NTAPI USBPORT_InterruptService (IN PKINTERRUPT Interrupt, IN PVOID ServiceContext)
 
VOID NTAPI USBPORT_SignalWorkerThread (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_CompleteTransfer (IN PURB Urb, IN USBD_STATUS TransferStatus)
 
VOID NTAPI USBPORT_DpcHandler (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_WorkerRequestDpc (IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
BOOLEAN NTAPI USBPORT_QueueDoneTransfer (IN PUSBPORT_TRANSFER Transfer, IN USBD_STATUS USBDStatus)
 
VOID NTAPI USBPORT_MiniportInterrupts (IN PDEVICE_OBJECT FdoDevice, IN BOOLEAN IsEnable)
 
NTSTATUS NTAPI USBPORT_SetRegistryKeyValue (IN PDEVICE_OBJECT DeviceObject, IN BOOL UseDriverKey, IN ULONG Type, IN PCWSTR ValueNameString, IN PVOID Data, IN ULONG DataSize)
 
NTSTATUS NTAPI USBPORT_GetRegistryKeyValueFullInfo (IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_OBJECT PdoDevice, IN BOOL UseDriverKey, IN PCWSTR SourceString, IN ULONG LengthStr, IN PVOID Buffer, IN ULONG NumberOfBytes)
 
VOID NTAPI USBPORT_AddUSB1Fdo (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_AddUSB2Fdo (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_RemoveUSBxFdo (IN PDEVICE_OBJECT FdoDevice)
 
PDEVICE_OBJECT NTAPI USBPORT_FindUSB2Controller (IN PDEVICE_OBJECT FdoDevice)
 
PDEVICE_RELATIONS NTAPI USBPORT_FindCompanionControllers (IN PDEVICE_OBJECT USB2FdoDevice, IN BOOLEAN IsObRefer, IN BOOLEAN IsFDOsReturned)
 
VOID NTAPI USBPORT_InvalidateControllerHandler (IN PDEVICE_OBJECT FdoDevice, IN ULONG Type)
 
VOID NTAPI USBPORT_DoneTransfer (IN PUSBPORT_TRANSFER Transfer)
 
ULONG NTAPI USBPORT_DbgPrint (IN PVOID MiniPortExtension, IN ULONG Level, IN PCH Format,...)
 
ULONG NTAPI USBPORT_TestDebugBreak (IN PVOID MiniPortExtension)
 
ULONG NTAPI USBPORT_AssertFailure (PVOID MiniPortExtension, PVOID FailedAssertion, PVOID FileName, ULONG LineNumber, PCHAR Message)
 
VOID NTAPI USBPORT_BugCheck (IN PVOID MiniPortExtension)
 
ULONG NTAPI USBPORT_LogEntry (IN PVOID MiniPortExtension, IN ULONG DriverTag, IN ULONG EnumTag, IN ULONG P1, IN ULONG P2, IN ULONG P3)
 
VOID NTAPI USBPORT_DumpingDeviceDescriptor (IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor)
 
VOID NTAPI USBPORT_DumpingConfiguration (IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor)
 
VOID NTAPI USBPORT_DumpingCapabilities (IN PDEVICE_CAPABILITIES Capabilities)
 
VOID NTAPI USBPORT_DumpingSetupPacket (IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket)
 
VOID NTAPI USBPORT_DumpingURB (IN PURB Urb)
 
VOID NTAPI USBPORT_DumpingIDs (IN PVOID Buffer)
 
NTSTATUS NTAPI USBPORT_HandleSelectConfiguration (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp, IN PURB Urb)
 
VOID NTAPI USBPORT_AddDeviceHandle (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
 
VOID NTAPI USBPORT_RemoveDeviceHandle (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
 
BOOLEAN NTAPI USBPORT_ValidateDeviceHandle (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
 
NTSTATUS NTAPI USBPORT_CreateDevice (IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle, IN USHORT PortStatus, IN USHORT Port)
 
NTSTATUS NTAPI USBPORT_InitializeDevice (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice)
 
NTSTATUS NTAPI USBPORT_GetUsbDescriptor (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN UCHAR Type, IN PUCHAR ConfigDesc, IN PULONG ConfigDescSize)
 
NTSTATUS NTAPI USBPORT_HandleSelectInterface (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp, IN PURB Urb)
 
NTSTATUS NTAPI USBPORT_RemoveDevice (IN PDEVICE_OBJECT FdoDevice, IN OUT PUSBPORT_DEVICE_HANDLE DeviceHandle, IN ULONG Flags)
 
NTSTATUS NTAPI USBPORT_SendSetupPacket (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN PVOID Buffer, IN ULONG Length, IN OUT PULONG TransferedLen, IN OUT PUSBD_STATUS pUSBDStatus)
 
NTSTATUS NTAPI USBPORT_RestoreDevice (IN PDEVICE_OBJECT FdoDevice, IN OUT PUSBPORT_DEVICE_HANDLE OldDeviceHandle, IN OUT PUSBPORT_DEVICE_HANDLE NewDeviceHandle)
 
NTSTATUS NTAPI USBPORT_Initialize20Hub (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle, IN ULONG TtCount)
 
NTSTATUS NTAPI USBPORT_OpenPipe (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle, IN PUSBD_STATUS UsbdStatus)
 
MPSTATUS NTAPI MiniportOpenEndpoint (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
 
NTSTATUS NTAPI USBPORT_ReopenPipe (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_ClosePipe (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_PIPE_HANDLE PipeHandle)
 
VOID NTAPI MiniportCloseEndpoint (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_AddPipeHandle (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle)
 
VOID NTAPI USBPORT_RemovePipeHandle (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle)
 
BOOLEAN NTAPI USBPORT_ValidatePipeHandle (IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle)
 
VOID NTAPI USBPORT_FlushClosedEndpointList (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_SetEndpointState (IN PUSBPORT_ENDPOINT Endpoint, IN ULONG State)
 
ULONG NTAPI USBPORT_GetEndpointState (IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_InvalidateEndpointHandler (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN ULONG Type)
 
BOOLEAN NTAPI USBPORT_EndpointWorker (IN PUSBPORT_ENDPOINT Endpoint, IN BOOLEAN Flag)
 
VOID NTAPI USBPORT_NukeAllEndpoints (IN PDEVICE_OBJECT FdoDevice)
 
BOOLEAN NTAPI USBPORT_EndpointHasQueuedTransfers (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN PULONG TransferCount)
 
NTSTATUS NTAPI USBPORT_PdoQueryInterface (IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_OBJECT PdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_PdoDeviceControl (PDEVICE_OBJECT PdoDevice, PIRP Irp)
 
NTSTATUS NTAPI USBPORT_FdoDeviceControl (PDEVICE_OBJECT FdoDevice, PIRP Irp)
 
NTSTATUS NTAPI USBPORT_FdoInternalDeviceControl (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_PdoInternalDeviceControl (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_GetSymbolicName (IN PDEVICE_OBJECT RootHubPdo, IN PUNICODE_STRING DestinationString)
 
USBD_STATUS NTAPI USBPORT_InitializeIsoTransfer (IN PDEVICE_OBJECT FdoDevice, IN struct _URB_ISOCH_TRANSFER *Urb, IN PUSBPORT_TRANSFER Transfer)
 
ULONG NTAPI USBPORT_CompleteIsoTransfer (IN PVOID MiniPortExtension, IN PVOID MiniPortEndpoint, IN PVOID TransferParameters, IN ULONG TransferLength)
 
NTSTATUS NTAPI USBPORT_FdoPnP (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_PdoPnP (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_PdoPower (IN PDEVICE_OBJECT PdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_FdoPower (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
NTSTATUS NTAPI USBPORT_IdleNotification (IN PDEVICE_OBJECT PdoDevice, IN PIRP Irp)
 
VOID NTAPI USBPORT_AdjustDeviceCapabilities (IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_OBJECT PdoDevice)
 
VOID NTAPI USBPORT_DoIdleNotificationCallback (IN PVOID Context)
 
VOID NTAPI USBPORT_CompletePdoWaitWake (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_DoSetPowerD0 (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_HcWakeDpc (IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
VOID NTAPI USBPORT_HcQueueWakeDpc (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_InsertIdleIrp (IN PIO_CSQ Csq, IN PIRP Irp)
 
VOID NTAPI USBPORT_RemoveIdleIrp (IN PIO_CSQ Csq, IN PIRP Irp)
 
PIRP NTAPI USBPORT_PeekNextIdleIrp (IN PIO_CSQ Csq, IN PIRP Irp, IN PVOID PeekContext)
 
VOID NTAPI USBPORT_AcquireIdleLock (IN PIO_CSQ Csq, IN PKIRQL Irql)
 
VOID NTAPI USBPORT_ReleaseIdleLock (IN PIO_CSQ Csq, IN KIRQL Irql)
 
VOID NTAPI USBPORT_CompleteCanceledIdleIrp (IN PIO_CSQ Csq, IN PIRP Irp)
 
VOID NTAPI USBPORT_InsertBadRequest (IN PIO_CSQ Csq, IN PIRP Irp)
 
VOID NTAPI USBPORT_RemoveBadRequest (IN PIO_CSQ Csq, IN PIRP Irp)
 
PIRP NTAPI USBPORT_PeekNextBadRequest (IN PIO_CSQ Csq, IN PIRP Irp, IN PVOID PeekContext)
 
VOID NTAPI USBPORT_AcquireBadRequestLock (IN PIO_CSQ Csq, IN PKIRQL Irql)
 
VOID NTAPI USBPORT_ReleaseBadRequestLock (IN PIO_CSQ Csq, IN KIRQL Irql)
 
VOID NTAPI USBPORT_CompleteCanceledBadRequest (IN PIO_CSQ Csq, IN PIRP Irp)
 
VOID NTAPI USBPORT_InsertIrpInTable (IN PUSBPORT_IRP_TABLE IrpTable, IN PIRP Irp)
 
PIRP NTAPI USBPORT_RemovePendingTransferIrp (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
PIRP NTAPI USBPORT_RemoveActiveTransferIrp (IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
 
VOID NTAPI USBPORT_FindUrbInIrpTable (IN PUSBPORT_IRP_TABLE IrpTable, IN PURB Urb, IN PIRP Irp)
 
VOID NTAPI USBPORT_CancelActiveTransferIrp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
VOID NTAPI USBPORT_FlushAbortList (IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_FlushCancelList (IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_QueueTransferUrb (IN PURB Urb)
 
VOID NTAPI USBPORT_FlushAllEndpoints (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_FlushPendingTransfers (IN PUSBPORT_ENDPOINT Endpoint)
 
BOOLEAN NTAPI USBPORT_QueueActiveUrbToEndpoint (IN PUSBPORT_ENDPOINT Endpoint, IN PURB Urb)
 
VOID NTAPI USBPORT_FlushController (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_BadRequestFlush (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_AbortEndpoint (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN PIRP Irp)
 
VOID NTAPI USBPORT_RootHubEndpointWorker (PUSBPORT_ENDPOINT Endpoint)
 
NTSTATUS NTAPI USBPORT_RootHubCreateDevice (IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_OBJECT PdoDevice)
 
ULONG NTAPI USBPORT_InvalidateRootHub (PVOID MiniPortExtension)
 
VOID NTAPI USBPORT_RootHubPowerAndChirpAllCcPorts (IN PDEVICE_OBJECT FdoDevice)
 
VOID NTAPI USBPORT_SplitTransfer (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN PUSBPORT_TRANSFER Transfer, IN PLIST_ENTRY List)
 
VOID NTAPI USBPORT_DoneSplitTransfer (IN PUSBPORT_TRANSFER SplitTransfer)
 
VOID NTAPI USBPORT_CancelSplitTransfer (IN PUSBPORT_TRANSFER SplitTransfer)
 
NTSTATUS NTAPI USBPORT_HandleSubmitURB (IN PDEVICE_OBJECT PdoDevice, IN PIRP Irp, IN PURB Urb)
 
BOOLEAN NTAPI USBPORT_AllocateBandwidthUSB2 (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_FreeBandwidthUSB2 (IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
 
VOID NTAPI USBPORT_UpdateAllocatedBwTt (IN PUSB2_TT_EXTENSION TtExtension)
 
VOID NTAPI USB2_InitTT (IN PUSB2_HC_EXTENSION HcExtension, IN PUSB2_TT Tt)
 
VOID NTAPI USB2_InitController (IN PUSB2_HC_EXTENSION HcExtension)
 
VOID NTAPI USBPORT_DumpingEndpointProperties (IN PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties)
 
VOID NTAPI USBPORT_DumpingTtEndpoint (IN PUSB2_TT_ENDPOINT TtEndpoint)
 

Variables

KSPIN_LOCK USBPORT_SpinLock
 
LIST_ENTRY USBPORT_MiniPortDrivers
 

Macro Definition Documentation

◆ DEVICE_HANDLE_FLAG_REMOVED

#define DEVICE_HANDLE_FLAG_REMOVED   0x00000008

Definition at line 106 of file usbport.h.

◆ DEVICE_HANDLE_FLAG_ROOTHUB

#define DEVICE_HANDLE_FLAG_ROOTHUB   0x00000002

Definition at line 105 of file usbport.h.

◆ DEVICE_HANDLE_FLAG_USB2HUB

#define DEVICE_HANDLE_FLAG_USB2HUB   0x00000010

Definition at line 107 of file usbport.h.

◆ ENDPOINT_FLAG_ABORTING

#define ENDPOINT_FLAG_ABORTING   0x00000020

Definition at line 114 of file usbport.h.

◆ ENDPOINT_FLAG_CLOSED

#define ENDPOINT_FLAG_CLOSED   0x00000400

Definition at line 117 of file usbport.h.

◆ ENDPOINT_FLAG_DMA_TYPE

#define ENDPOINT_FLAG_DMA_TYPE   0x00000001

Definition at line 110 of file usbport.h.

◆ ENDPOINT_FLAG_IDLE

#define ENDPOINT_FLAG_IDLE   0x00000100

Definition at line 115 of file usbport.h.

◆ ENDPOINT_FLAG_NUKE

#define ENDPOINT_FLAG_NUKE   0x00000008

Definition at line 112 of file usbport.h.

◆ ENDPOINT_FLAG_OPENED

#define ENDPOINT_FLAG_OPENED   0x00000200

Definition at line 116 of file usbport.h.

◆ ENDPOINT_FLAG_QUEUENE_EMPTY

#define ENDPOINT_FLAG_QUEUENE_EMPTY   0x00000010

Definition at line 113 of file usbport.h.

◆ ENDPOINT_FLAG_ROOTHUB_EP0

#define ENDPOINT_FLAG_ROOTHUB_EP0   0x00000002

Definition at line 111 of file usbport.h.

◆ FEATURE_C_HUB_LOCAL_POWER

#define FEATURE_C_HUB_LOCAL_POWER   0

Definition at line 62 of file usbport.h.

◆ FEATURE_C_HUB_OVER_CURRENT

#define FEATURE_C_HUB_OVER_CURRENT   1

Definition at line 63 of file usbport.h.

◆ FEATURE_C_PORT_CONNECTION

#define FEATURE_C_PORT_CONNECTION   16

Definition at line 55 of file usbport.h.

◆ FEATURE_C_PORT_ENABLE

#define FEATURE_C_PORT_ENABLE   17

Definition at line 56 of file usbport.h.

◆ FEATURE_C_PORT_OVER_CURRENT

#define FEATURE_C_PORT_OVER_CURRENT   19

Definition at line 58 of file usbport.h.

◆ FEATURE_C_PORT_RESET

#define FEATURE_C_PORT_RESET   20

Definition at line 59 of file usbport.h.

◆ FEATURE_C_PORT_SUSPEND

#define FEATURE_C_PORT_SUSPEND   18

Definition at line 57 of file usbport.h.

◆ FEATURE_PORT_CONNECTION

#define FEATURE_PORT_CONNECTION   0

Definition at line 48 of file usbport.h.

◆ FEATURE_PORT_ENABLE

#define FEATURE_PORT_ENABLE   1

Definition at line 49 of file usbport.h.

◆ FEATURE_PORT_LOW_SPEED

#define FEATURE_PORT_LOW_SPEED   9

Definition at line 54 of file usbport.h.

◆ FEATURE_PORT_OVER_CURRENT

#define FEATURE_PORT_OVER_CURRENT   3

Definition at line 51 of file usbport.h.

◆ FEATURE_PORT_POWER

#define FEATURE_PORT_POWER   8

Definition at line 53 of file usbport.h.

◆ FEATURE_PORT_RESET

#define FEATURE_PORT_RESET   4

Definition at line 52 of file usbport.h.

◆ FEATURE_PORT_SUSPEND

#define FEATURE_PORT_SUSPEND   2

Definition at line 50 of file usbport.h.

◆ INVALIDATE_ENDPOINT_INT_NEXT_SOF

#define INVALIDATE_ENDPOINT_INT_NEXT_SOF   3

Definition at line 39 of file usbport.h.

◆ INVALIDATE_ENDPOINT_ONLY

#define INVALIDATE_ENDPOINT_ONLY   0

Definition at line 36 of file usbport.h.

◆ INVALIDATE_ENDPOINT_WORKER_DPC

#define INVALIDATE_ENDPOINT_WORKER_DPC   2

Definition at line 38 of file usbport.h.

◆ INVALIDATE_ENDPOINT_WORKER_THREAD

#define INVALIDATE_ENDPOINT_WORKER_THREAD   1

Definition at line 37 of file usbport.h.

◆ PCI_INTERFACE_USB_ID_EHCI

#define PCI_INTERFACE_USB_ID_EHCI   0x20

Definition at line 25 of file usbport.h.

◆ PCI_INTERFACE_USB_ID_OHCI

#define PCI_INTERFACE_USB_ID_OHCI   0x10

Definition at line 24 of file usbport.h.

◆ PCI_INTERFACE_USB_ID_UHCI

#define PCI_INTERFACE_USB_ID_UHCI   0x00

Definition at line 23 of file usbport.h.

◆ PCI_INTERFACE_USB_ID_XHCI

#define PCI_INTERFACE_USB_ID_XHCI   0x30

Definition at line 26 of file usbport.h.

◆ PIPE_HANDLE_FLAG_CLOSED

#define PIPE_HANDLE_FLAG_CLOSED   0x00000001

Definition at line 125 of file usbport.h.

◆ PIPE_HANDLE_FLAG_NULL_PACKET_SIZE

#define PIPE_HANDLE_FLAG_NULL_PACKET_SIZE   0x00000002

Definition at line 126 of file usbport.h.

◆ TRANSFER_FLAG_ABORTED

#define TRANSFER_FLAG_ABORTED   0x00000010

Definition at line 133 of file usbport.h.

◆ TRANSFER_FLAG_CANCELED

#define TRANSFER_FLAG_CANCELED   0x00000001

Definition at line 129 of file usbport.h.

◆ TRANSFER_FLAG_COMPLETED

#define TRANSFER_FLAG_COMPLETED   0x00000200

Definition at line 137 of file usbport.h.

◆ TRANSFER_FLAG_DEVICE_GONE

#define TRANSFER_FLAG_DEVICE_GONE   0x00000080

Definition at line 135 of file usbport.h.

◆ TRANSFER_FLAG_DMA_MAPPED

#define TRANSFER_FLAG_DMA_MAPPED   0x00000002

Definition at line 130 of file usbport.h.

◆ TRANSFER_FLAG_HIGH_SPEED

#define TRANSFER_FLAG_HIGH_SPEED   0x00000004

Definition at line 131 of file usbport.h.

◆ TRANSFER_FLAG_ISO

#define TRANSFER_FLAG_ISO   0x00000020

Definition at line 134 of file usbport.h.

◆ TRANSFER_FLAG_PARENT

#define TRANSFER_FLAG_PARENT   0x00000400

Definition at line 138 of file usbport.h.

◆ TRANSFER_FLAG_SPLITED

#define TRANSFER_FLAG_SPLITED   0x00000100

Definition at line 136 of file usbport.h.

◆ TRANSFER_FLAG_SUBMITED

#define TRANSFER_FLAG_SUBMITED   0x00000008

Definition at line 132 of file usbport.h.

◆ URB_FUNCTION_MAX

#define URB_FUNCTION_MAX   0x31

Definition at line 45 of file usbport.h.

◆ USB2_BIT_STUFFING_OVERHEAD

#define USB2_BIT_STUFFING_OVERHEAD   (8 * (7/6))

Definition at line 482 of file usbport.h.

◆ USB2_CONTROLLER_DELAY

#define USB2_CONTROLLER_DELAY   100

Definition at line 457 of file usbport.h.

◆ USB2_FRAMES

#define USB2_FRAMES   32

Definition at line 451 of file usbport.h.

◆ USB2_FS_INTERRUPT_OVERHEAD

#define USB2_FS_INTERRUPT_OVERHEAD   13

Definition at line 466 of file usbport.h.

◆ USB2_FS_ISOCHRONOUS_OVERHEAD

#define USB2_FS_ISOCHRONOUS_OVERHEAD   9

Definition at line 469 of file usbport.h.

◆ USB2_FS_MAX_PERIODIC_ALLOCATION

#define USB2_FS_MAX_PERIODIC_ALLOCATION   1157

Definition at line 458 of file usbport.h.

◆ USB2_FS_RAW_BYTES_IN_MICROFRAME

#define USB2_FS_RAW_BYTES_IN_MICROFRAME   188

Definition at line 462 of file usbport.h.

◆ USB2_FS_SOF_TIME

#define USB2_FS_SOF_TIME   6

Definition at line 459 of file usbport.h.

◆ USB2_HS_CS_INTERRUPT_IN_OVERHEAD

#define USB2_HS_CS_INTERRUPT_IN_OVERHEAD   38

Definition at line 476 of file usbport.h.

◆ USB2_HS_CS_INTERRUPT_OUT_OVERHEAD

#define USB2_HS_CS_INTERRUPT_OUT_OVERHEAD   36

Definition at line 474 of file usbport.h.

◆ USB2_HS_CS_ISOCHRONOUS_IN_OVERHEAD

#define USB2_HS_CS_ISOCHRONOUS_IN_OVERHEAD   38

Definition at line 480 of file usbport.h.

◆ USB2_HS_INTERRUPT_IN_OVERHEAD

#define USB2_HS_INTERRUPT_IN_OVERHEAD   25

Definition at line 468 of file usbport.h.

◆ USB2_HS_INTERRUPT_OUT_OVERHEAD

#define USB2_HS_INTERRUPT_OUT_OVERHEAD   45

Definition at line 467 of file usbport.h.

◆ USB2_HS_ISOCHRONOUS_IN_OVERHEAD

#define USB2_HS_ISOCHRONOUS_IN_OVERHEAD   18

Definition at line 471 of file usbport.h.

◆ USB2_HS_ISOCHRONOUS_OUT_OVERHEAD

#define USB2_HS_ISOCHRONOUS_OUT_OVERHEAD   38

Definition at line 470 of file usbport.h.

◆ USB2_HS_SS_INTERRUPT_IN_OVERHEAD

#define USB2_HS_SS_INTERRUPT_IN_OVERHEAD   39

Definition at line 475 of file usbport.h.

◆ USB2_HS_SS_INTERRUPT_OUT_OVERHEAD

#define USB2_HS_SS_INTERRUPT_OUT_OVERHEAD   58

Definition at line 473 of file usbport.h.

◆ USB2_HS_SS_ISOCHRONOUS_IN_OVERHEAD

#define USB2_HS_SS_ISOCHRONOUS_IN_OVERHEAD   39

Definition at line 479 of file usbport.h.

◆ USB2_HS_SS_ISOCHRONOUS_OUT_OVERHEAD

#define USB2_HS_SS_ISOCHRONOUS_OUT_OVERHEAD   58

Definition at line 478 of file usbport.h.

◆ USB2_HUB_DELAY

#define USB2_HUB_DELAY   30

Definition at line 460 of file usbport.h.

◆ USB2_LS_INTERRUPT_OVERHEAD

#define USB2_LS_INTERRUPT_OVERHEAD   117

Definition at line 465 of file usbport.h.

◆ USB2_MAX_FS_LS_TRANSACTIONS_IN_UFRAME

#define USB2_MAX_FS_LS_TRANSACTIONS_IN_UFRAME   16

Definition at line 461 of file usbport.h.

◆ USB2_MAX_MICROFRAME_ALLOCATION

#define USB2_MAX_MICROFRAME_ALLOCATION   7000

Definition at line 456 of file usbport.h.

◆ USB2_MAX_MICROFRAMES

#define USB2_MAX_MICROFRAMES   (USB2_FRAMES * USB2_MICROFRAMES)

Definition at line 453 of file usbport.h.

◆ USB2_MICROFRAMES

#define USB2_MICROFRAMES   8

Definition at line 452 of file usbport.h.

◆ USB2_PREV_MICROFRAME

#define USB2_PREV_MICROFRAME   0xFF

Definition at line 454 of file usbport.h.

◆ USB2_TT_EXTENSION_FLAG_DELETED

#define USB2_TT_EXTENSION_FLAG_DELETED   1

Definition at line 545 of file usbport.h.

◆ USB_PORT_TAG

#define USB_PORT_TAG   'pbsu'

Definition at line 44 of file usbport.h.

◆ USBD_FLAG_ALLOCATED_MDL

#define USBD_FLAG_ALLOCATED_MDL   0x00000002

Definition at line 120 of file usbport.h.

◆ USBD_FLAG_ALLOCATED_TRANSFER

#define USBD_FLAG_ALLOCATED_TRANSFER   0x00000020

Definition at line 122 of file usbport.h.

◆ USBD_FLAG_NOT_ISO_TRANSFER

#define USBD_FLAG_NOT_ISO_TRANSFER   0x00000010

Definition at line 121 of file usbport.h.

◆ USBPORT_DMA_DIRECTION_FROM_DEVICE

#define USBPORT_DMA_DIRECTION_FROM_DEVICE   1

Definition at line 41 of file usbport.h.

◆ USBPORT_DMA_DIRECTION_TO_DEVICE

#define USBPORT_DMA_DIRECTION_TO_DEVICE   2

Definition at line 42 of file usbport.h.

◆ USBPORT_FLAG_BIOS_DISABLE_SS

#define USBPORT_FLAG_BIOS_DISABLE_SS   0x08000000

Definition at line 80 of file usbport.h.

◆ USBPORT_FLAG_COMPANION_HC

#define USBPORT_FLAG_COMPANION_HC   0x01000000

Definition at line 77 of file usbport.h.

◆ USBPORT_FLAG_DIAGNOSTIC_MODE

#define USBPORT_FLAG_DIAGNOSTIC_MODE   0x00800000

Definition at line 76 of file usbport.h.

◆ USBPORT_FLAG_DOS_SYMBOLIC_NAME

#define USBPORT_FLAG_DOS_SYMBOLIC_NAME   0x00010000

Definition at line 73 of file usbport.h.

◆ USBPORT_FLAG_HC_POLLING

#define USBPORT_FLAG_HC_POLLING   0x00000004

Definition at line 68 of file usbport.h.

◆ USBPORT_FLAG_HC_STARTED

#define USBPORT_FLAG_HC_STARTED   0x00000002

Definition at line 67 of file usbport.h.

◆ USBPORT_FLAG_HC_SUSPEND

#define USBPORT_FLAG_HC_SUSPEND   0x00000100

Definition at line 70 of file usbport.h.

◆ USBPORT_FLAG_HC_WAKE_SUPPORT

#define USBPORT_FLAG_HC_WAKE_SUPPORT   0x00200000

Definition at line 75 of file usbport.h.

◆ USBPORT_FLAG_INT_CONNECTED

#define USBPORT_FLAG_INT_CONNECTED   0x00000001

Definition at line 66 of file usbport.h.

◆ USBPORT_FLAG_INTERRUPT_ENABLED

#define USBPORT_FLAG_INTERRUPT_ENABLED   0x00000400

Definition at line 71 of file usbport.h.

◆ USBPORT_FLAG_LEGACY_SUPPORT

#define USBPORT_FLAG_LEGACY_SUPPORT   0x00080000

Definition at line 74 of file usbport.h.

◆ USBPORT_FLAG_NO_HACTION

#define USBPORT_FLAG_NO_HACTION   0x04000000

Definition at line 79 of file usbport.h.

◆ USBPORT_FLAG_POWER_AND_CHIRP_OK

#define USBPORT_FLAG_POWER_AND_CHIRP_OK   0x40000000

Definition at line 82 of file usbport.h.

◆ USBPORT_FLAG_PWR_AND_CHIRP_LOCK

#define USBPORT_FLAG_PWR_AND_CHIRP_LOCK   0x10000000

Definition at line 81 of file usbport.h.

◆ USBPORT_FLAG_REGISTERED_FDO

#define USBPORT_FLAG_REGISTERED_FDO   0x02000000

Definition at line 78 of file usbport.h.

◆ USBPORT_FLAG_RH_INIT_CALLBACK

#define USBPORT_FLAG_RH_INIT_CALLBACK   0x80000000

Definition at line 83 of file usbport.h.

◆ USBPORT_FLAG_SELECTIVE_SUSPEND

#define USBPORT_FLAG_SELECTIVE_SUSPEND   0x00000800

Definition at line 72 of file usbport.h.

◆ USBPORT_FLAG_WORKER_THREAD_ON

#define USBPORT_FLAG_WORKER_THREAD_ON   0x00000008

Definition at line 69 of file usbport.h.

◆ USBPORT_MPFLAG_INTERRUPTS_ENABLED

#define USBPORT_MPFLAG_INTERRUPTS_ENABLED   0x00000001

Definition at line 101 of file usbport.h.

◆ USBPORT_MPFLAG_SUSPENDED

#define USBPORT_MPFLAG_SUSPENDED   0x00000002

Definition at line 102 of file usbport.h.

◆ USBPORT_PNP_STATE_FAILED

#define USBPORT_PNP_STATE_FAILED   0x00000004

Definition at line 88 of file usbport.h.

◆ USBPORT_PNP_STATE_NOT_INIT

#define USBPORT_PNP_STATE_NOT_INIT   0x00000001

Definition at line 86 of file usbport.h.

◆ USBPORT_PNP_STATE_STARTED

#define USBPORT_PNP_STATE_STARTED   0x00000002

Definition at line 87 of file usbport.h.

◆ USBPORT_PNP_STATE_STOPPED

#define USBPORT_PNP_STATE_STOPPED   0x00000008

Definition at line 89 of file usbport.h.

◆ USBPORT_RECIPIENT_HUB

#define USBPORT_RECIPIENT_HUB   BMREQUEST_TO_DEVICE

Definition at line 33 of file usbport.h.

◆ USBPORT_RECIPIENT_PORT

#define USBPORT_RECIPIENT_PORT   BMREQUEST_TO_OTHER

Definition at line 34 of file usbport.h.

◆ USBPORT_TMFLAG_HC_RESUME

#define USBPORT_TMFLAG_HC_RESUME   0x00000004

Definition at line 94 of file usbport.h.

◆ USBPORT_TMFLAG_HC_SUSPENDED

#define USBPORT_TMFLAG_HC_SUSPENDED   0x00000002

Definition at line 93 of file usbport.h.

◆ USBPORT_TMFLAG_IDLE_QUEUEITEM_ON

#define USBPORT_TMFLAG_IDLE_QUEUEITEM_ON   0x00000040

Definition at line 98 of file usbport.h.

◆ USBPORT_TMFLAG_RH_SUSPENDED

#define USBPORT_TMFLAG_RH_SUSPENDED   0x00000008

Definition at line 95 of file usbport.h.

◆ USBPORT_TMFLAG_TIMER_QUEUED

#define USBPORT_TMFLAG_TIMER_QUEUED   0x00000001

Definition at line 92 of file usbport.h.

◆ USBPORT_TMFLAG_TIMER_STARTED

#define USBPORT_TMFLAG_TIMER_STARTED   0x00000010

Definition at line 96 of file usbport.h.

◆ USBPORT_TMFLAG_WAKE

#define USBPORT_TMFLAG_WAKE   0x00000020

Definition at line 97 of file usbport.h.

Typedef Documentation

◆ PTIMER_WORK_QUEUE_ITEM

◆ PUSB2_FRAME_BUDGET

◆ PUSB2_HC_EXTENSION

Definition at line 156 of file usbport.h.

◆ PUSB2_REBALANCE

◆ PUSB2_TT

Definition at line 158 of file usbport.h.

◆ PUSB2_TT_ENDPOINT

Definition at line 159 of file usbport.h.

◆ PUSB2_TT_EXTENSION

Definition at line 157 of file usbport.h.

◆ PUSBD_STATUS

Definition at line 143 of file usbport.h.

◆ PUSBPORT_ASYNC_CALLBACK_DATA

◆ PUSBPORT_COMMON_BUFFER_HEADER

◆ PUSBPORT_COMMON_DEVICE_EXTENSION

◆ PUSBPORT_CONFIGURATION_HANDLE

◆ PUSBPORT_DEVICE_EXTENSION

◆ PUSBPORT_DEVICE_HANDLE

◆ PUSBPORT_ENDPOINT

Definition at line 154 of file usbport.h.

◆ PUSBPORT_INTERFACE_HANDLE

◆ PUSBPORT_IRP_TABLE

◆ PUSBPORT_ISO_BLOCK

typedef struct _USBPORT_ISO_BLOCK* PUSBPORT_ISO_BLOCK

Definition at line 242 of file usbport.h.

◆ PUSBPORT_PIPE_HANDLE

◆ PUSBPORT_RH_DESCRIPTORS

◆ PUSBPORT_RHDEVICE_EXTENSION

◆ PUSBPORT_TRANSFER

◆ TIMER_WORK_QUEUE_ITEM

◆ USB2_FRAME_BUDGET

◆ USB2_HC_EXTENSION

◆ USB2_REBALANCE

◆ USB2_TT

◆ USB2_TT_ENDPOINT

◆ USB2_TT_ENDPOINT_NUMS

◆ USB2_TT_ENDPOINT_PARAMS

◆ USB2_TT_EXTENSION

◆ USBPORT_ASYNC_CALLBACK_DATA

◆ USBPORT_COMMON_BUFFER_HEADER

◆ USBPORT_COMMON_DEVICE_EXTENSION

◆ USBPORT_CONFIGURATION_HANDLE

◆ USBPORT_DEVICE_EXTENSION

◆ USBPORT_DEVICE_HANDLE

◆ USBPORT_ENDPOINT

◆ USBPORT_INTERFACE_HANDLE

◆ USBPORT_IRP_TABLE

◆ USBPORT_PIPE_HANDLE

◆ USBPORT_RH_DESCRIPTORS

◆ USBPORT_RHDEVICE_EXTENSION

◆ USBPORT_TRANSFER

Function Documentation

◆ C_ASSERT() [1/4]

C_ASSERT ( sizeof(USBPORT_DEVICE_EXTENSION = =0x500)

◆ C_ASSERT() [2/4]

C_ASSERT ( sizeof(USBPORT_ASYNC_CALLBACK_DATA = =16+18 *sizeof(PVOID))

◆ C_ASSERT() [3/4]

◆ C_ASSERT() [4/4]

◆ MiniportCloseEndpoint()

VOID NTAPI MiniportCloseEndpoint ( IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_ENDPOINT  Endpoint 
)

Definition at line 549 of file endpoint.c.

551 {
554  BOOLEAN IsDoDisablePeriodic;
555  ULONG TransferType;
556  KIRQL OldIrql;
557 
558  DPRINT("MiniportCloseEndpoint: Endpoint - %p\n", Endpoint);
559 
560  FdoExtension = FdoDevice->DeviceExtension;
561  Packet = &FdoExtension->MiniPortInterface->Packet;
562 
563  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
564 
565  if (Endpoint->Flags & ENDPOINT_FLAG_OPENED)
566  {
567  TransferType = Endpoint->EndpointProperties.TransferType;
568 
569  if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT ||
570  TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS)
571  {
572  --FdoExtension->PeriodicEndpoints;
573  }
574 
575  IsDoDisablePeriodic = FdoExtension->PeriodicEndpoints == 0;
576 
577  Packet->CloseEndpoint(FdoExtension->MiniPortExt,
578  Endpoint + 1,
579  IsDoDisablePeriodic);
580 
581  Endpoint->Flags &= ~ENDPOINT_FLAG_OPENED;
582  Endpoint->Flags |= ENDPOINT_FLAG_CLOSED;
583  }
584 
585  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
586 }
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
#define ENDPOINT_FLAG_OPENED
Definition: usbport.h:116
UCHAR KIRQL
Definition: env_spec_w32.h:591
unsigned char BOOLEAN
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define USBPORT_TRANSFER_TYPE_INTERRUPT
Definition: usbmport.h:10
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define USBPORT_TRANSFER_TYPE_ISOCHRONOUS
Definition: usbmport.h:7
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
unsigned int ULONG
Definition: retypes.h:1
#define ENDPOINT_FLAG_CLOSED
Definition: usbport.h:117

Referenced by USBPORT_DeleteEndpoint(), USBPORT_ReopenPipe(), and USBPORT_RestoreDevice().

◆ MiniportOpenEndpoint()

MPSTATUS NTAPI MiniportOpenEndpoint ( IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_ENDPOINT  Endpoint 
)

Definition at line 722 of file endpoint.c.

724 {
727  KIRQL OldIrql;
728  ULONG TransferType;
729  MPSTATUS MpStatus;
730 
731  DPRINT("MiniportOpenEndpoint: Endpoint - %p\n", Endpoint);
732 
733  FdoExtension = FdoDevice->DeviceExtension;
734  Packet = &FdoExtension->MiniPortInterface->Packet;
735 
736  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
737 
738  Endpoint->Flags &= ~ENDPOINT_FLAG_CLOSED;
739 
740  MpStatus = Packet->OpenEndpoint(FdoExtension->MiniPortExt,
741  &Endpoint->EndpointProperties,
742  Endpoint + 1);
743 
744  if (!MpStatus)
745  {
746  TransferType = Endpoint->EndpointProperties.TransferType;
747 
748  if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT ||
749  TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS)
750  {
751  ++FdoExtension->PeriodicEndpoints;
752  }
753 
754  Endpoint->Flags |= ENDPOINT_FLAG_OPENED;
755  }
756 
757  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
758  return MpStatus;
759 }
ULONG MPSTATUS
Definition: usbmport.h:131
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
#define ENDPOINT_FLAG_OPENED
Definition: usbport.h:116
UCHAR KIRQL
Definition: env_spec_w32.h:591
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define USBPORT_TRANSFER_TYPE_INTERRUPT
Definition: usbmport.h:10
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define USBPORT_TRANSFER_TYPE_ISOCHRONOUS
Definition: usbmport.h:7
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
unsigned int ULONG
Definition: retypes.h:1
#define ENDPOINT_FLAG_CLOSED
Definition: usbport.h:117

Referenced by USBPORT_OpenPipe(), USBPORT_ReopenPipe(), and USBPORT_RestoreDevice().

◆ USB2_InitController()

VOID NTAPI USB2_InitController ( IN PUSB2_HC_EXTENSION  HcExtension)

Definition at line 2217 of file usb2.c.

2218 {
2219  ULONG ix;
2220  ULONG jx;
2221 
2222  DPRINT("USB2_InitController: HcExtension - %p\n", HcExtension);
2223 
2224  HcExtension->MaxHsBusAllocation = USB2_MAX_MICROFRAME_ALLOCATION;
2225 
2226  for (ix = 0; ix < USB2_FRAMES; ix++)
2227  {
2228  for (jx = 0; jx < USB2_MICROFRAMES; jx++)
2229  {
2230  HcExtension->TimeUsed[ix][jx] = 0;
2231  }
2232  }
2233 
2234  HcExtension->HcDelayTime = USB2_CONTROLLER_DELAY;
2235 
2236  USB2_InitTT(HcExtension, &HcExtension->HcTt);
2237 }
#define USB2_MICROFRAMES
Definition: usbport.h:452
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI USB2_InitTT(IN PUSB2_HC_EXTENSION HcExtension, IN PUSB2_TT Tt)
Definition: usb2.c:2160
#define USB2_CONTROLLER_DELAY
Definition: usbport.h:457
#define USB2_MAX_MICROFRAME_ALLOCATION
Definition: usbport.h:456
#define USB2_FRAMES
Definition: usbport.h:451
unsigned int ULONG
Definition: retypes.h:1

Referenced by USBPORT_AddDevice().

◆ USB2_InitTT()

VOID NTAPI USB2_InitTT ( IN PUSB2_HC_EXTENSION  HcExtension,
IN PUSB2_TT  Tt 
)

Definition at line 2160 of file usb2.c.

2162 {
2163  ULONG ix;
2164  ULONG jx;
2165 
2166  DPRINT("USB2_InitTT: HcExtension - %p, Tt - %p\n", HcExtension, Tt);
2167 
2168  Tt->HcExtension = HcExtension;
2169  Tt->DelayTime = 1;
2170  Tt->MaxTime = USB2_FS_MAX_PERIODIC_ALLOCATION;
2171 
2172  for (ix = 0; ix < USB2_FRAMES; ix++)
2173  {
2174  Tt->FrameBudget[ix].TimeUsed = USB2_MAX_MICROFRAMES;
2175  Tt->FrameBudget[ix].AltEndpoint = NULL;
2176 
2177  for (jx = 0; jx < USB2_MICROFRAMES; jx++)
2178  {
2179  Tt->TimeCS[ix][jx] = 0;
2180  Tt->NumStartSplits[ix][jx] = 0;
2181  }
2182 
2183  Tt->FrameBudget[ix].IsoEndpoint = &Tt->IsoEndpoint[ix];
2184 
2185  USB2_InitTtEndpoint(&Tt->IsoEndpoint[ix],
2188  UsbFullSpeed,
2189  USB2_FRAMES,
2190  0,
2191  Tt);
2192 
2193  Tt->IsoEndpoint[ix].ActualPeriod = USB2_FRAMES;
2194  Tt->IsoEndpoint[ix].CalcBusTime = USB2_FS_SOF_TIME + USB2_HUB_DELAY;
2195  Tt->IsoEndpoint[ix].StartFrame = ix;
2196  Tt->IsoEndpoint[ix].StartMicroframe = USB2_PREV_MICROFRAME;
2197 
2198  Tt->FrameBudget[ix].IntEndpoint = &Tt->IntEndpoint[ix];
2199 
2200  USB2_InitTtEndpoint(&Tt->IntEndpoint[ix],
2203  UsbFullSpeed,
2204  USB2_FRAMES,
2205  0,
2206  Tt);
2207 
2208  Tt->IntEndpoint[ix].ActualPeriod = USB2_FRAMES;
2209  Tt->IntEndpoint[ix].CalcBusTime = USB2_FS_SOF_TIME + USB2_HUB_DELAY;
2210  Tt->IntEndpoint[ix].StartFrame = ix;
2211  Tt->IntEndpoint[ix].StartMicroframe = USB2_PREV_MICROFRAME;
2212  }
2213 }
#define USB2_MICROFRAMES
Definition: usbport.h:452
#define USB2_PREV_MICROFRAME
Definition: usbport.h:454
#define USBPORT_TRANSFER_DIRECTION_OUT
Definition: usbmport.h:649
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define USB2_HUB_DELAY
Definition: usbport.h:460
#define USBPORT_TRANSFER_TYPE_INTERRUPT
Definition: usbmport.h:10
#define USBPORT_TRANSFER_TYPE_ISOCHRONOUS
Definition: usbmport.h:7
VOID NTAPI USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, IN UCHAR TransferType, IN UCHAR Direction, IN UCHAR DeviceSpeed, IN USHORT Period, IN USHORT MaxPacketSize, IN PUSB2_TT Tt)
Definition: usb2.c:279
#define USB2_FS_SOF_TIME
Definition: usbport.h:459
#define USB2_MAX_MICROFRAMES
Definition: usbport.h:453
#define USB2_FRAMES
Definition: usbport.h:451
unsigned int ULONG
Definition: retypes.h:1
#define USB2_FS_MAX_PERIODIC_ALLOCATION
Definition: usbport.h:458

Referenced by USB2_InitController(), and USBPORT_InitializeTT().

◆ USBPORT_AbortEndpoint()

VOID NTAPI USBPORT_AbortEndpoint ( IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_ENDPOINT  Endpoint,
IN PIRP  Irp 
)

Definition at line 1354 of file queue.c.

1357 {
1358  PLIST_ENTRY PendingList;
1359  PUSBPORT_TRANSFER PendingTransfer;
1360  PLIST_ENTRY ActiveList;
1361  PUSBPORT_TRANSFER ActiveTransfer;
1362 
1363  DPRINT_CORE("USBPORT_AbortEndpoint: Irp - %p\n", Irp);
1364 
1365  KeAcquireSpinLock(&Endpoint->EndpointSpinLock, &Endpoint->EndpointOldIrql);
1366 
1367  if (Irp)
1368  {
1369  InsertTailList(&Endpoint->AbortList, &Irp->Tail.Overlay.ListEntry);
1370  }
1371 
1372  PendingList = Endpoint->PendingTransferList.Flink;
1373 
1374  while (PendingList && PendingList != &Endpoint->PendingTransferList)
1375  {
1376  PendingTransfer = CONTAINING_RECORD(PendingList,
1378  TransferLink);
1379 
1380  DPRINT_CORE("USBPORT_AbortEndpoint: Abort PendingTransfer - %p\n",
1381  PendingTransfer);
1382 
1383  PendingTransfer->Flags |= TRANSFER_FLAG_ABORTED;
1384 
1385  PendingList = PendingTransfer->TransferLink.Flink;
1386  }
1387 
1388  ActiveList = Endpoint->TransferList.Flink;
1389 
1390  while (ActiveList && ActiveList != &Endpoint->TransferList)
1391  {
1392  ActiveTransfer = CONTAINING_RECORD(ActiveList,
1394  TransferLink);
1395 
1396  DPRINT_CORE("USBPORT_AbortEndpoint: Abort ActiveTransfer - %p\n",
1397  ActiveTransfer);
1398 
1399  ActiveTransfer->Flags |= TRANSFER_FLAG_ABORTED;
1400 
1401  if (Endpoint->Flags & ENDPOINT_FLAG_ABORTING)
1402  {
1403  ActiveTransfer->Flags |= TRANSFER_FLAG_DEVICE_GONE;
1404  }
1405 
1406  ActiveList = ActiveTransfer->TransferLink.Flink;
1407  }
1408 
1409  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
1410 
1412  Endpoint,
1414 
1416  USBPORT_FlushCancelList(Endpoint);
1417 }
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
_In_ PIRP Irp
Definition: csq.h:116
#define TRANSFER_FLAG_DEVICE_GONE
Definition: usbport.h:135
#define InsertTailList(ListHead, Entry)
#define INVALIDATE_ENDPOINT_INT_NEXT_SOF
Definition: usbport.h:39
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
LIST_ENTRY TransferLink
Definition: usbport.h:256
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
VOID NTAPI USBPORT_FlushPendingTransfers(IN PUSBPORT_ENDPOINT Endpoint)
Definition: queue.c:785
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define TRANSFER_FLAG_ABORTED
Definition: usbport.h:133
Definition: typedefs.h:117
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define ENDPOINT_FLAG_ABORTING
Definition: usbport.h:114
VOID NTAPI USBPORT_InvalidateEndpointHandler(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN ULONG Type)
Definition: endpoint.c:1317
VOID NTAPI USBPORT_FlushCancelList(IN PUSBPORT_ENDPOINT Endpoint)
Definition: queue.c:714

Referenced by USBPORT_AbortPipe(), and USBPORT_AbortTransfers().

◆ USBPORT_AcquireBadRequestLock()

VOID NTAPI USBPORT_AcquireBadRequestLock ( IN PIO_CSQ  Csq,
IN PKIRQL  Irql 
)

Definition at line 214 of file queue.c.

216 {
218 
219  DPRINT_QUEUE("USBPORT_AcquireBadRequestLock: ... \n");
220 
223  BadRequestIoCsq);
224 
225  KeAcquireSpinLock(&FdoExtension->BadRequestIoCsqSpinLock, Irql);
226 }
#define DPRINT_QUEUE(...)
Definition: usbdebug.h:148
_Out_ PKIRQL Irql
Definition: csq.h:179
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
IO_CSQ Csq
Definition: csqrtns.c:46

Referenced by USBPORT_StartDevice().

◆ USBPORT_AcquireIdleLock()

VOID NTAPI USBPORT_AcquireIdleLock ( IN PIO_CSQ  Csq,
IN PKIRQL  Irql 
)

Definition at line 91 of file queue.c.

93 {
95 
96  DPRINT_QUEUE("USBPORT_AcquireIdleLock: ... \n");
97 
100  IdleIoCsq);
101 
102  KeAcquireSpinLock(&FdoExtension->IdleIoCsqSpinLock, Irql);
103 }
#define DPRINT_QUEUE(...)
Definition: usbdebug.h:148
_Out_ PKIRQL Irql
Definition: csq.h:179
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
IO_CSQ Csq
Definition: csqrtns.c:46

Referenced by USBPORT_StartDevice().

◆ USBPORT_AddDeviceHandle()

VOID NTAPI USBPORT_AddDeviceHandle ( IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_DEVICE_HANDLE  DeviceHandle 
)

Definition at line 769 of file device.c.

771 {
773 
774  DPRINT("USBPORT_AddDeviceHandle: ... \n");
775 
776  FdoExtension = FdoDevice->DeviceExtension;
777 
778  InsertTailList(&FdoExtension->DeviceHandleList,
779  &DeviceHandle->DeviceHandleLink);
780 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define InsertTailList(ListHead, Entry)
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by USBPORT_CreateDevice(), and USBPORT_RootHubCreateDevice().

◆ USBPORT_AddPipeHandle()

VOID NTAPI USBPORT_AddPipeHandle ( IN PUSBPORT_DEVICE_HANDLE  DeviceHandle,
IN PUSBPORT_PIPE_HANDLE  PipeHandle 
)

Definition at line 444 of file endpoint.c.

446 {
447  DPRINT("USBPORT_AddPipeHandle: DeviceHandle - %p, PipeHandle - %p\n",
448  DeviceHandle,
449  PipeHandle);
450 
451  InsertTailList(&DeviceHandle->PipeHandleList, &PipeHandle->PipeLink);
452 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define InsertTailList(ListHead, Entry)
void DPRINT(...)
Definition: polytest.cpp:61
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21

Referenced by USBPORT_OpenPipe(), and USBPORT_RestoreDevice().

◆ USBPORT_AddUSB1Fdo()

VOID NTAPI USBPORT_AddUSB1Fdo ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 66 of file usbport.c.

67 {
69 
70  DPRINT("USBPORT_AddUSB1Fdo: FdoDevice - %p\n", FdoDevice);
71 
72  FdoExtension = FdoDevice->DeviceExtension;
74 
76  &FdoExtension->ControllerLink,
78 }
LIST_ENTRY USBPORT_USB1FdoList
Definition: usbport.c:19
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
void DPRINT(...)
Definition: polytest.cpp:61
#define USBPORT_FLAG_REGISTERED_FDO
Definition: usbport.h:78
KSPIN_LOCK USBPORT_SpinLock
Definition: usbport.c:22

Referenced by USBPORT_FdoPnP().

◆ USBPORT_AddUSB2Fdo()

VOID NTAPI USBPORT_AddUSB2Fdo ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 82 of file usbport.c.

83 {
85 
86  DPRINT("USBPORT_AddUSB2Fdo: FdoDevice - %p\n", FdoDevice);
87 
88  FdoExtension = FdoDevice->DeviceExtension;
90 
92  &FdoExtension->ControllerLink,
94 }
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
LIST_ENTRY USBPORT_USB2FdoList
Definition: usbport.c:20
void DPRINT(...)
Definition: polytest.cpp:61
#define USBPORT_FLAG_REGISTERED_FDO
Definition: usbport.h:78
KSPIN_LOCK USBPORT_SpinLock
Definition: usbport.c:22

Referenced by USBPORT_FdoPnP().

◆ USBPORT_AdjustDeviceCapabilities()

VOID NTAPI USBPORT_AdjustDeviceCapabilities ( IN PDEVICE_OBJECT  FdoDevice,
IN PDEVICE_OBJECT  PdoDevice 
)

Definition at line 668 of file power.c.

670 {
674 
675  DPRINT("USBPORT_AdjustDeviceCapabilities: ... \n");
676 
677  FdoExtension = FdoDevice->DeviceExtension;
678  PdoExtension = PdoDevice->DeviceExtension;
679  Capabilities = &PdoExtension->Capabilities;
680 
682  &FdoExtension->Capabilities,
683  sizeof(DEVICE_CAPABILITIES));
684 
685  Capabilities->DeviceD1 = FALSE;
686  Capabilities->DeviceD2 = TRUE;
687 
688  Capabilities->Removable = FALSE;
689  Capabilities->UniqueID = FALSE;
690 
691  Capabilities->WakeFromD0 = TRUE;
692  Capabilities->WakeFromD1 = FALSE;
693  Capabilities->WakeFromD2 = TRUE;
694  Capabilities->WakeFromD3 = FALSE;
695 
696  Capabilities->Address = 0;
697  Capabilities->UINumber = 0;
698 
699  if (Capabilities->SystemWake == PowerSystemUnspecified)
700  Capabilities->SystemWake = PowerSystemWorking;
701 
702  Capabilities->DeviceWake = PowerDeviceD2;
703 
708 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
DEVICE_CAPABILITIES
Definition: iotypes.h:928
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
void DPRINT(...)
Definition: polytest.cpp:61
* PDEVICE_CAPABILITIES
Definition: iotypes.h:928

Referenced by USBPORT_CreatePdo().

◆ USBPORT_AllocateBandwidthUSB2()

BOOLEAN NTAPI USBPORT_AllocateBandwidthUSB2 ( IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_ENDPOINT  Endpoint 
)

Definition at line 1799 of file usb2.c.

1801 {
1803  PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties;
1804  PUSB2_TT_EXTENSION TtExtension;
1805  ULONG TransferType;
1806  PUSB2_REBALANCE Rebalance;
1807  LIST_ENTRY RebalanceList;
1808  ULONG RebalanceListEntries;
1809  PUSB2_TT_ENDPOINT TtEndpoint;
1810  PUSB2_TT_ENDPOINT RebalanceTtEndpoint;
1811  PUSB2_TT Tt;
1813  ULONG Period;
1814  ULONG AllocedBusTime;
1815  ULONG EndpointBandwidth;
1816  ULONG ScheduleOffset;
1817  ULONG Factor;
1818  ULONG ix;
1819  ULONG n;
1821  UCHAR SMask;
1822  UCHAR CMask;
1823  UCHAR ActualPeriod;
1824  BOOLEAN Result;
1825 
1826  DPRINT("USBPORT_AllocateBandwidthUSB2: FdoDevice - %p, Endpoint - %p\n",
1827  FdoDevice,
1828  Endpoint);
1829 
1830  EndpointProperties = &Endpoint->EndpointProperties;
1831  EndpointProperties->ScheduleOffset = 0;
1832 
1833  if (Endpoint->Flags & ENDPOINT_FLAG_ROOTHUB_EP0)
1834  {
1835  DPRINT("USBPORT_AllocateBandwidthUSB2: ENDPOINT_FLAG_ROOTHUB_EP0\n");
1836  return TRUE;
1837  }
1838 
1839  FdoExtension = FdoDevice->DeviceExtension;
1840 
1841  TransferType = EndpointProperties->TransferType;
1842  DPRINT("USBPORT_AllocateBandwidthUSB2: TransferType - %X\n", TransferType);
1843 
1844  if (TransferType == USBPORT_TRANSFER_TYPE_CONTROL ||
1845  TransferType == USBPORT_TRANSFER_TYPE_BULK)
1846  {
1847  return TRUE;
1848  }
1849 
1850  if (Endpoint->TtExtension)
1851  TtExtension = Endpoint->TtExtension;
1852  else
1853  TtExtension = NULL;
1854 
1855  InitializeListHead(&RebalanceList);
1856 
1857  Rebalance = ExAllocatePoolWithTag(NonPagedPool,
1858  sizeof(USB2_REBALANCE),
1859  USB_PORT_TAG);
1860 
1861  DPRINT("USBPORT_AllocateBandwidthUSB2: Rebalance - %p, TtExtension - %p\n",
1862  Rebalance,
1863  TtExtension);
1864 
1865  if (Rebalance)
1866  {
1867  RtlZeroMemory(Rebalance, sizeof(USB2_REBALANCE));
1868 
1869  TtEndpoint = Endpoint->TtEndpoint;
1870  TtEndpoint->Endpoint = Endpoint;
1871 
1872  Direction = EndpointProperties->Direction == USBPORT_TRANSFER_DIRECTION_OUT;
1873  DeviceSpeed = EndpointProperties->DeviceSpeed;
1874 
1875  switch (DeviceSpeed)
1876  {
1877  case UsbLowSpeed:
1878  case UsbFullSpeed:
1879  {
1880  Tt = &TtExtension->Tt;
1881  Period = USB2_FRAMES;
1882 
1883  while (Period > 0 && Period > EndpointProperties->Period)
1884  {
1885  Period >>= 1;
1886  }
1887 
1888  DPRINT("USBPORT_AllocateBandwidthUSB2: Period - %X\n", Period);
1889  break;
1890  }
1891 
1892  case UsbHighSpeed:
1893  {
1894  Tt = &FdoExtension->Usb2Extension->HcTt;
1895  Period = EndpointProperties->Period;
1896 
1897  break;
1898  }
1899 
1900  default:
1901  {
1902  DPRINT1("USBPORT_AllocateBandwidthUSB2: DeviceSpeed - %X!\n",
1903  DeviceSpeed);
1904 
1905  DbgBreakPoint();
1906 
1907  Tt = &TtExtension->Tt;
1908  break;
1909  }
1910  }
1911 
1912  USB2_InitTtEndpoint(TtEndpoint,
1913  TransferType,
1914  Direction,
1915  DeviceSpeed,
1916  Period,
1917  EndpointProperties->MaxPacketSize,
1918  Tt);
1919 
1920  RebalanceListEntries = USB2_FRAMES - 2;
1921 
1922  Result = USB2_AllocateTimeForEndpoint(TtEndpoint,
1923  Rebalance,
1924  &RebalanceListEntries);
1925 
1926  if (Result)
1927  {
1928  Result = USB2_PromotePeriods(TtEndpoint,
1929  Rebalance,
1930  &RebalanceListEntries);
1931  }
1932 
1933  RebalanceListEntries = 0;
1934 
1935  for (ix = 0; Rebalance->RebalanceEndpoint[ix]; ix++)
1936  {
1937  RebalanceListEntries = ix + 1;
1938  }
1939  }
1940  else
1941  {
1942  RebalanceListEntries = 0;
1943  Result = FALSE;
1944  }
1945 
1946  DPRINT("USBPORT_AllocateBandwidthUSB2: RebalanceListEntries - %X, Result - %X\n",
1947  RebalanceListEntries,
1948  Result);
1949 
1950  for (ix = 0; ix < RebalanceListEntries; ix++)
1951  {
1952  RebalanceTtEndpoint = Rebalance->RebalanceEndpoint[ix];
1953 
1954  DPRINT("USBPORT_AllocateBandwidthUSB2: RebalanceTtEndpoint[%X] - %p, RebalanceTtEndpoint - %p, RebalanceLink - %p\n",
1955  ix,
1956  RebalanceTtEndpoint,
1957  &RebalanceTtEndpoint->Endpoint->RebalanceLink);
1958 
1959  InsertTailList(&RebalanceList,
1960  &RebalanceTtEndpoint->Endpoint->RebalanceLink);
1961  }
1962 
1963  if (Rebalance)
1964  ExFreePoolWithTag(Rebalance, USB_PORT_TAG);
1965 
1966  if (Result)
1967  {
1968  SMask = USB2_GetSMASK(Endpoint->TtEndpoint);
1969  EndpointProperties->InterruptScheduleMask = SMask;
1970 
1971  CMask = USB2_GetCMASK(Endpoint->TtEndpoint);
1972  EndpointProperties->SplitCompletionMask = CMask;
1973 
1974  AllocedBusTime = TtEndpoint->CalcBusTime;
1975 
1976  EndpointBandwidth = USB2_MICROFRAMES * AllocedBusTime;
1977  EndpointProperties->UsbBandwidth = EndpointBandwidth;
1978 
1979  ActualPeriod = Endpoint->TtEndpoint->ActualPeriod;
1980  EndpointProperties->Period = ActualPeriod;
1981 
1982  ScheduleOffset = Endpoint->TtEndpoint->StartFrame;
1983  EndpointProperties->ScheduleOffset = ScheduleOffset;
1984 
1985  ASSERT(ActualPeriod);
1986  Factor = USB2_FRAMES / ActualPeriod;
1987  n = ScheduleOffset * Factor;
1988 
1989  if (TtExtension)
1990  {
1991  for (ix = 0; ix < Factor; ix++)
1992  {
1993  TtExtension->Bandwidth[n + ix] -= EndpointBandwidth;
1994  }
1995  }
1996  else
1997  {
1998  for (ix = 1; ix < Factor; ix++)
1999  {
2000  FdoExtension->Bandwidth[n + ix] -= EndpointBandwidth;
2001  }
2002  }
2003 
2004  USBPORT_DumpingEndpointProperties(EndpointProperties);
2005  USBPORT_DumpingTtEndpoint(Endpoint->TtEndpoint);
2006 
2007  if (AllocedBusTime >= (USB2_FS_MAX_PERIODIC_ALLOCATION / 2))
2008  {
2009  DPRINT1("USBPORT_AllocateBandwidthUSB2: AllocedBusTime >= 0.5 * MAX_ALLOCATION \n");
2010  }
2011  }
2012 
2013  USB2_Rebalance(FdoDevice, &RebalanceList);
2014 
2015  if (!TtExtension)
2016  {
2017  DPRINT("USBPORT_AllocateBandwidthUSB2: Result - %X\n", Result);
2018  return Result;
2019  }
2020 
2021  for (ix = 0; ix < USB2_FRAMES; ix++)
2022  {
2023  FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth;
2024  }
2025 
2026  USBPORT_UpdateAllocatedBwTt(TtExtension);
2027 
2028  for (ix = 0; ix < USB2_FRAMES; ix++)
2029  {
2030  FdoExtension->Bandwidth[ix] -= TtExtension->MaxBandwidth;
2031  }
2032 
2033  DPRINT("USBPORT_AllocateBandwidthUSB2: Result - %X\n", Result);
2034 
2035  return Result;
2036 }
#define USB2_MICROFRAMES
Definition: usbport.h:452
#define USBPORT_TRANSFER_TYPE_BULK
Definition: usbmport.h:9
#define TRUE
Definition: types.h:120
#define USBPORT_TRANSFER_DIRECTION_OUT
Definition: usbmport.h:649
GLdouble n
Definition: glext.h:7729
_In_ LARGE_INTEGER _In_ ULONG Period
Definition: kefuncs.h:1268
ULONG MaxBandwidth
Definition: usbport.h:552
#define USBPORT_TRANSFER_TYPE_CONTROL
Definition: usbmport.h:8
#define ENDPOINT_FLAG_ROOTHUB_EP0
Definition: usbport.h:111
#define InsertTailList(ListHead, Entry)
USB_DEVICE_SPEED DeviceSpeed
Definition: usbmport.h:73
void DbgBreakPoint()
Definition: mach.c:553
#define USB_PORT_TAG
Definition: usbport.h:44
VOID NTAPI USB2_Rebalance(IN PDEVICE_OBJECT FdoDevice, IN PLIST_ENTRY RebalanceList)
Definition: usb2.c:942
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
UCHAR NTAPI USB2_GetSMASK(IN PUSB2_TT_ENDPOINT TtEndpoint)
Definition: usb2.c:757
void DPRINT(...)
Definition: polytest.cpp:61
enum _USB_DEVICE_SPEED USB_DEVICE_SPEED
BOOLEAN NTAPI USB2_PromotePeriods(IN PUSB2_TT_ENDPOINT TtEndpoint, IN PUSB2_REBALANCE Rebalance, IN PULONG RebalanceListEntries)
Definition: usb2.c:1665
ULONG Bandwidth[USB2_FRAMES]
Definition: usbport.h:551
UCHAR NTAPI USB2_GetCMASK(IN PUSB2_TT_ENDPOINT TtEndpoint)
Definition: usb2.c:787
PUSBPORT_ENDPOINT Endpoint
Definition: usbport.h:510
_Inout_ PSIZE_T _In_opt_ PMDLX _In_ MM_ROTATE_DIRECTION Direction
Definition: mmfuncs.h:773
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NTAPI USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, IN PUSB2_REBALANCE Rebalance, IN PULONG RebalanceListEntries)
Definition: usb2.c:1290
USHORT CalcBusTime
Definition: usbport.h:519
VOID NTAPI USBPORT_DumpingEndpointProperties(IN PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties)
Definition: debug.c:281
Definition: typedefs.h:117
VOID NTAPI USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, IN UCHAR TransferType, IN UCHAR Direction, IN UCHAR DeviceSpeed, IN USHORT Period, IN USHORT MaxPacketSize, IN PUSB2_TT Tt)
Definition: usb2.c:279
PUSB2_TT_ENDPOINT RebalanceEndpoint[USB2_FRAMES - 2]
Definition: usbport.h:569
LIST_ENTRY RebalanceLink
Definition: usbport.h:239
VOID NTAPI USBPORT_DumpingTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint)
Definition: debug.c:301
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID NTAPI USBPORT_UpdateAllocatedBwTt(IN PUSB2_TT_EXTENSION TtExtension)
Definition: usb2.c:1768
#define DPRINT1
Definition: precomp.h:8
#define USB2_FRAMES
Definition: usbport.h:451
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USB2_FS_MAX_PERIODIC_ALLOCATION
Definition: usbport.h:458
_In_ PUSBD_PIPE_INFORMATION _In_ USB_DEVICE_SPEED DeviceSpeed
Definition: hubbusif.h:294

Referenced by USBPORT_OpenPipe().

◆ USBPORT_AllocateCommonBuffer()

PUSBPORT_COMMON_BUFFER_HEADER NTAPI USBPORT_AllocateCommonBuffer ( IN PDEVICE_OBJECT  FdoDevice,
IN SIZE_T  BufferLength 
)

Definition at line 1686 of file usbport.c.

1688 {
1689  PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer = NULL;
1691  PDMA_ADAPTER DmaAdapter;
1692  PDMA_OPERATIONS DmaOperations;
1693  SIZE_T HeaderSize;
1694  ULONG Length = 0;
1695  ULONG LengthPadded;
1696  PHYSICAL_ADDRESS LogicalAddress;
1697  ULONG_PTR BaseVA;
1698  ULONG_PTR StartBufferVA;
1699  ULONG StartBufferPA;
1700 
1701  DPRINT("USBPORT_AllocateCommonBuffer: FdoDevice - %p, BufferLength - %p\n",
1702  FdoDevice,
1703  BufferLength);
1704 
1705  if (BufferLength == 0)
1706  goto Exit;
1707 
1708  FdoExtension = FdoDevice->DeviceExtension;
1709 
1710  DmaAdapter = FdoExtension->DmaAdapter;
1711  DmaOperations = DmaAdapter->DmaOperations;
1712 
1713  HeaderSize = sizeof(USBPORT_COMMON_BUFFER_HEADER);
1714  Length = ROUND_TO_PAGES(BufferLength + HeaderSize);
1715  LengthPadded = Length - (BufferLength + HeaderSize);
1716 
1717  BaseVA = (ULONG_PTR)DmaOperations->AllocateCommonBuffer(DmaAdapter,
1718  Length,
1719  &LogicalAddress,
1720  TRUE);
1721 
1722  if (!BaseVA)
1723  goto Exit;
1724 
1725  StartBufferVA = BaseVA & ~(PAGE_SIZE - 1);
1726  StartBufferPA = LogicalAddress.LowPart & ~(PAGE_SIZE - 1);
1727 
1728  HeaderBuffer = (PUSBPORT_COMMON_BUFFER_HEADER)(StartBufferVA +
1729  BufferLength +
1730  LengthPadded);
1731 
1732  HeaderBuffer->Length = Length;
1733  HeaderBuffer->BaseVA = BaseVA;
1734  HeaderBuffer->LogicalAddress = LogicalAddress;
1735 
1736  HeaderBuffer->BufferLength = BufferLength + LengthPadded;
1737  HeaderBuffer->VirtualAddress = StartBufferVA;
1738  HeaderBuffer->PhysicalAddress = StartBufferPA;
1739 
1740  RtlZeroMemory((PVOID)StartBufferVA, BufferLength + LengthPadded);
1741 
1742 Exit:
1743  return HeaderBuffer;
1744 }
PALLOCATE_COMMON_BUFFER AllocateCommonBuffer
Definition: iotypes.h:2312
#define TRUE
Definition: types.h:120
struct _USBPORT_COMMON_BUFFER_HEADER USBPORT_COMMON_BUFFER_HEADER
struct _USBPORT_COMMON_BUFFER_HEADER * PUSBPORT_COMMON_BUFFER_HEADER
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ ULONG BufferLength
Definition: usbdlib.h:225
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static void Exit(void)
Definition: sock.c:1331
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG LowPart
Definition: typedefs.h:104
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define ROUND_TO_PAGES(Size)
PHYSICAL_ADDRESS LogicalAddress
Definition: usbport.h:148
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101

Referenced by USBPORT_OpenPipe(), USBPORT_ReopenPipe(), and USBPORT_StartDevice().

◆ USBPORT_AllocateTransfer()

USBD_STATUS NTAPI USBPORT_AllocateTransfer ( IN PDEVICE_OBJECT  FdoDevice,
IN PURB  Urb,
IN PUSBPORT_DEVICE_HANDLE  DeviceHandle,
IN PIRP  Irp,
IN PRKEVENT  Event 
)

Definition at line 2521 of file usbport.c.

2526 {
2528  SIZE_T TransferLength;
2529  PMDL Mdl;
2530  ULONG_PTR VirtualAddr;
2531  ULONG PagesNeed = 0;
2532  SIZE_T PortTransferLength;
2533  SIZE_T FullTransferLength;
2534  PUSBPORT_TRANSFER Transfer;
2536  USBD_STATUS USBDStatus;
2537  SIZE_T IsoBlockLen = 0;
2538 
2539  DPRINT_CORE("USBPORT_AllocateTransfer: FdoDevice - %p, Urb - %p, DeviceHandle - %p, Irp - %p, Event - %p\n",
2540  FdoDevice,
2541  Urb,
2542  DeviceHandle,
2543  Irp,
2544  Event);
2545 
2546  FdoExtension = FdoDevice->DeviceExtension;
2547 
2548  TransferLength = Urb->UrbControlTransfer.TransferBufferLength;
2549  PipeHandle = Urb->UrbControlTransfer.PipeHandle;
2550 
2551  if (TransferLength)
2552  {
2553  Mdl = Urb->UrbControlTransfer.TransferBufferMDL;
2554  VirtualAddr = (ULONG_PTR)MmGetMdlVirtualAddress(Mdl);
2555 
2556  PagesNeed = ADDRESS_AND_SIZE_TO_SPAN_PAGES(VirtualAddr,
2557  TransferLength);
2558  if (PagesNeed > 0)
2559  {
2560  PagesNeed--;
2561  }
2562  }
2563 
2564  if (Urb->UrbHeader.Function == URB_FUNCTION_ISOCH_TRANSFER)
2565  {
2566  DPRINT1("USBPORT_AllocateTransfer: ISOCH_TRANSFER UNIMPLEMENTED. FIXME\n");
2567 
2568  //IsoBlockLen = sizeof(USBPORT_ISO_BLOCK) +
2569  // Urb->UrbIsochronousTransfer.NumberOfPackets *
2570  // sizeof(USBPORT_ISO_BLOCK_PACKET);
2571  }
2572 
2573  PortTransferLength = sizeof(USBPORT_TRANSFER) +
2574  PagesNeed * sizeof(USBPORT_SCATTER_GATHER_ELEMENT) +
2575  IsoBlockLen;
2576 
2577  FullTransferLength = PortTransferLength +
2578  FdoExtension->MiniPortInterface->Packet.MiniPortTransferSize;
2579 
2581  FullTransferLength,
2582  USB_PORT_TAG);
2583 
2584  if (!Transfer)
2585  {
2586  DPRINT1("USBPORT_AllocateTransfer: Transfer not allocated!\n");
2588  }
2589 
2590  RtlZeroMemory(Transfer, FullTransferLength);
2591 
2592  Transfer->Irp = Irp;
2593  Transfer->Urb = Urb;
2594  Transfer->Endpoint = PipeHandle->Endpoint;
2595  Transfer->Event = Event;
2596  Transfer->PortTransferLength = PortTransferLength;
2597  Transfer->FullTransferLength = FullTransferLength;
2598  Transfer->IsoBlockPtr = NULL;
2599  Transfer->Period = 0;
2600  Transfer->ParentTransfer = Transfer;
2601 
2602  if (IsoBlockLen)
2603  {
2604  Transfer->IsoBlockPtr = (PVOID)((ULONG_PTR)Transfer +
2605  PortTransferLength - IsoBlockLen);
2606 
2607  Transfer->Period = PipeHandle->Endpoint->EndpointProperties.Period;
2608  Transfer->Flags |= TRANSFER_FLAG_ISO;
2609  }
2610 
2611  Transfer->MiniportTransfer = (PVOID)((ULONG_PTR)Transfer +
2612  PortTransferLength);
2613 
2615 
2616  Urb->UrbControlTransfer.hca.Reserved8[0] = Transfer;
2617  Urb->UrbHeader.UsbdFlags |= USBD_FLAG_ALLOCATED_TRANSFER;
2618 
2619  USBDStatus = USBD_STATUS_SUCCESS;
2620 
2621  DPRINT_CORE("USBPORT_AllocateTransfer: return USBDStatus - %x\n",
2622  USBDStatus);
2623 
2624  return USBDStatus;
2625 }
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
struct _USBPORT_TRANSFER USBPORT_TRANSFER
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define MmGetMdlVirtualAddress(_Mdl)
_In_ PIRP Irp
Definition: csq.h:116
#define USBD_FLAG_ALLOCATED_TRANSFER
Definition: usbport.h:122
PRKEVENT Event
Definition: usbport.h:248
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define USBD_STATUS_INSUFFICIENT_RESOURCES
Definition: usb.h:204
#define USB_PORT_TAG
Definition: usbport.h:44
struct _USBPORT_TRANSFER * ParentTransfer
Definition: usbport.h:263
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
SIZE_T PortTransferLength
Definition: usbport.h:250
PUSBPORT_ENDPOINT Endpoint
Definition: usbport.h:252
PVOID MiniportTransfer
Definition: usbport.h:249
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define USBD_STATUS_SUCCESS
Definition: usb.h:170
LONG USBD_STATUS
Definition: usb.h:165
#define TRANSFER_FLAG_ISO
Definition: usbport.h:134
SIZE_T FullTransferLength
Definition: usbport.h:251
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define URB_FUNCTION_ISOCH_TRANSFER
Definition: usb.h:96
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define DPRINT1
Definition: precomp.h:8
PUSBPORT_ISO_BLOCK IsoBlockPtr
Definition: usbport.h:268
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
KSPIN_LOCK TransferSpinLock
Definition: usbport.h:264

Referenced by USBPORT_SendSetupPacket(), and USBPORT_ValidateURB().

◆ USBPORT_AssertFailure()

ULONG NTAPI USBPORT_AssertFailure ( PVOID  MiniPortExtension,
PVOID  FailedAssertion,
PVOID  FileName,
ULONG  LineNumber,
PCHAR  Message 
)

Definition at line 39 of file debug.c.

44 {
45  DPRINT("USBPORT_AssertFailure: ... \n");
46  RtlAssert(FailedAssertion, FileName, LineNumber, Message);
47  return 0;
48 }
VOID NTAPI RtlAssert(IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL)
Definition: debug.c:480
void DPRINT(...)
Definition: polytest.cpp:61
CHAR Message[80]
Definition: alive.c:5
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1206

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_BadRequestFlush()

VOID NTAPI USBPORT_BadRequestFlush ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 1328 of file queue.c.

1329 {
1331  PIRP Irp;
1332 
1333  DPRINT_QUEUE("USBPORT_BadRequestFlush: ... \n");
1334 
1335  FdoExtension = FdoDevice->DeviceExtension;
1336 
1337  while (TRUE)
1338  {
1339  Irp = IoCsqRemoveNextIrp(&FdoExtension->BadRequestIoCsq, 0);
1340 
1341  if (!Irp)
1342  break;
1343 
1344  DPRINT1("USBPORT_BadRequestFlush: Irp - %p\n", Irp);
1345 
1346  Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
1347  Irp->IoStatus.Information = 0;
1349  }
1350 }
#define DPRINT_QUEUE(...)
Definition: usbdebug.h:148
#define TRUE
Definition: types.h:120
NTKERNELAPI PIRP NTAPI IoCsqRemoveNextIrp(_Inout_ PIO_CSQ Csq, _In_opt_ PVOID PeekContext)
IoCsqRemoveNextIrp - Removes the next IRP from the queue.
Definition: csq.c:398
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566

Referenced by USBHI_FlushTransfers(), and USBPORT_TimerDpc().

◆ USBPORT_BugCheck()

VOID NTAPI USBPORT_BugCheck ( IN PVOID  MiniPortExtension)

Definition at line 52 of file debug.c.

53 {
54  DPRINT1("USBPORT_BugCheck: FIXME \n");
55  //KeBugCheckEx(BUGCODE_USB_DRIVER, ...);
56  ASSERT(FALSE);
57 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DPRINT1
Definition: precomp.h:8

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_CancelActiveTransferIrp()

VOID NTAPI USBPORT_CancelActiveTransferIrp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 529 of file queue.c.

531 {
533  PDEVICE_OBJECT FdoDevice;
535  PURB Urb;
536  PUSBPORT_TRANSFER Transfer;
537  PUSBPORT_ENDPOINT Endpoint;
538  PIRP irp;
539  PUSBPORT_TRANSFER SplitTransfer;
541  KIRQL OldIrql;
542 
543  DPRINT_CORE("USBPORT_CancelActiveTransferIrp: Irp - %p\n", Irp);
544 
546  FdoDevice = PdoExtension->FdoDevice;
547  FdoExtension = FdoDevice->DeviceExtension;
548 
549  IoReleaseCancelSpinLock(Irp->CancelIrql);
550 
551  KeAcquireSpinLock(&FdoExtension->FlushTransferSpinLock, &OldIrql);
552 
553  irp = USBPORT_FindActiveTransferIrp(FdoDevice, Irp);
554 
555  if (!irp)
556  {
557  KeReleaseSpinLock(&FdoExtension->FlushTransferSpinLock, OldIrql);
558  return;
559  }
560 
561  Urb = URB_FROM_IRP(irp);
562  Transfer = Urb->UrbControlTransfer.hca.Reserved8[0];
563  Endpoint = Transfer->Endpoint;
564 
565  DPRINT_CORE("USBPORT_CancelActiveTransferIrp: irp - %p, Urb - %p, Transfer - %p\n",
566  irp,
567  Urb,
568  Transfer);
569 
571 
572  Transfer->Flags |= TRANSFER_FLAG_CANCELED;
573 
574  if (Transfer->Flags & TRANSFER_FLAG_PARENT)
575  {
577 
578  Entry = Transfer->SplitTransfersList.Flink;
579 
580  while (Entry && Entry != &Transfer->SplitTransfersList)
581  {
582  SplitTransfer = CONTAINING_RECORD(Entry,
584  SplitLink);
585 
586  SplitTransfer->Flags |= TRANSFER_FLAG_CANCELED;
587 
588  Entry = Entry->Flink;
589  }
590 
592  }
593 
595  KeReleaseSpinLock(&FdoExtension->FlushTransferSpinLock, OldIrql);
596 
598  Endpoint,
600  return;
601 }
#define TRANSFER_FLAG_CANCELED
Definition: usbport.h:129
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
#define URB_FROM_IRP(Irp)
Definition: usb.h:85
struct _Entry Entry
Definition: kefuncs.h:640
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
#define TRANSFER_FLAG_PARENT
Definition: usbport.h:138
PIRP NTAPI USBPORT_FindActiveTransferIrp(IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
Definition: queue.c:467
UCHAR KIRQL
Definition: env_spec_w32.h:591
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PUSBPORT_ENDPOINT Endpoint
Definition: usbport.h:252
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
struct _URB_CONTROL_TRANSFER UrbControlTransfer
Definition: usb.h:539
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
Definition: usb.h:529
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
LIST_ENTRY SplitTransfersList
Definition: usbport.h:265
#define INVALIDATE_ENDPOINT_WORKER_THREAD
Definition: usbport.h:37
KSPIN_LOCK TransferSpinLock
Definition: usbport.h:264
VOID NTAPI USBPORT_InvalidateEndpointHandler(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN ULONG Type)
Definition: endpoint.c:1317
KSPIN_LOCK EndpointSpinLock
Definition: usbport.h:214
base of all file and directory entries
Definition: entries.h:82

Referenced by USBPORT_FlushPendingTransfers().

◆ USBPORT_CancelSplitTransfer()

VOID NTAPI USBPORT_CancelSplitTransfer ( IN PUSBPORT_TRANSFER  SplitTransfer)

Definition at line 314 of file trfsplit.c.

315 {
316  PUSBPORT_TRANSFER ParentTransfer;
317  PUSBPORT_ENDPOINT Endpoint;
318  KIRQL OldIrql;
319 
320  DPRINT("USBPORT_CancelSplitTransfer \n");
321 
322  Endpoint = SplitTransfer->Endpoint;
323  ParentTransfer = SplitTransfer->ParentTransfer;
324  ParentTransfer->CompletedTransferLen += SplitTransfer->CompletedTransferLen;
325 
326  KeAcquireSpinLock(&ParentTransfer->TransferSpinLock, &OldIrql);
327  RemoveEntryList(&SplitTransfer->SplitLink);
328  KeReleaseSpinLock(&ParentTransfer->TransferSpinLock, OldIrql);
329 
330  ExFreePool(SplitTransfer);
331 
332  if (IsListEmpty(&ParentTransfer->SplitTransfersList))
333  {
334  InsertTailList(&Endpoint->CancelList, &ParentTransfer->TransferLink);
335  }
336 }
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
struct _USBPORT_TRANSFER * ParentTransfer
Definition: usbport.h:263
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY TransferLink
Definition: usbport.h:256
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
LIST_ENTRY SplitTransfersList
Definition: usbport.h:265
KSPIN_LOCK TransferSpinLock
Definition: usbport.h:264
ULONG CompletedTransferLen
Definition: usbport.h:258
LIST_ENTRY CancelList
Definition: usbport.h:228
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by USBPORT_DmaEndpointPaused().

◆ USBPORT_ClosePipe()

VOID NTAPI USBPORT_ClosePipe ( IN PUSBPORT_DEVICE_HANDLE  DeviceHandle,
IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_PIPE_HANDLE  PipeHandle 
)

Definition at line 590 of file endpoint.c.

593 {
596  PUSBPORT_ENDPOINT Endpoint;
598  PUSB2_TT_EXTENSION TtExtension;
599  ULONG ix;
600  BOOLEAN IsReady;
601  KIRQL OldIrql;
602 
603  DPRINT1("USBPORT_ClosePipe \n");
604 
605  FdoExtension = FdoDevice->DeviceExtension;
606 
607  if (PipeHandle->Flags & PIPE_HANDLE_FLAG_CLOSED)
608  return;
609 
611 
613 
615  {
617  return;
618  }
619 
620  Endpoint = PipeHandle->Endpoint;
621 
622  KeAcquireSpinLock(&FdoExtension->EndpointListSpinLock, &OldIrql);
623 
624  if ((Endpoint->Flags & ENDPOINT_FLAG_ROOTHUB_EP0) &&
626  {
627  PdoExtension = FdoExtension->RootHubPdo->DeviceExtension;
628  PdoExtension->Endpoint = NULL;
629  }
630 
631  KeReleaseSpinLock(&FdoExtension->EndpointListSpinLock, OldIrql);
632 
633  while (TRUE)
634  {
635  IsReady = TRUE;
636 
638  &Endpoint->EndpointOldIrql);
639 
640  if (!IsListEmpty(&Endpoint->PendingTransferList))
641  IsReady = FALSE;
642 
643  if (!IsListEmpty(&Endpoint->TransferList))
644  IsReady = FALSE;
645 
646  if (!IsListEmpty(&Endpoint->CancelList))
647  IsReady = FALSE;
648 
649  if (!IsListEmpty(&Endpoint->AbortList))
650  IsReady = FALSE;
651 
653  if (Endpoint->StateLast != Endpoint->StateNext)
654  IsReady = FALSE;
656 
658  Endpoint->EndpointOldIrql);
659 
660  if (InterlockedIncrement(&Endpoint->LockCounter))
661  IsReady = FALSE;
662  InterlockedDecrement(&Endpoint->LockCounter);
663 
664  if (IsReady == TRUE)
665  break;
666 
667  USBPORT_Wait(FdoDevice, 1);
668  }
669 
670  Endpoint->DeviceHandle = NULL;
671  Packet = &FdoExtension->MiniPortInterface->Packet;
672 
673  if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2)
674  {
675  USBPORT_FreeBandwidthUSB2(FdoDevice, Endpoint);
676 
677  KeAcquireSpinLock(&FdoExtension->TtSpinLock, &OldIrql);
678 
679  TtExtension = Endpoint->TtExtension;
680  DPRINT1("USBPORT_ClosePipe: TtExtension - %p\n", TtExtension);
681 
682  if (TtExtension)
683  {
684  RemoveEntryList(&Endpoint->TtLink);
685 
686  Endpoint->TtLink.Flink = NULL;
687  Endpoint->TtLink.Blink = NULL;
688 
689  if (TtExtension->Flags & USB2_TT_EXTENSION_FLAG_DELETED)
690  {
691  if (IsListEmpty(&TtExtension->EndpointList))
692  {
693  USBPORT_UpdateAllocatedBwTt(TtExtension);
694 
695  for (ix = 0; ix < USB2_FRAMES; ix++)
696  {
697  FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth;
698  }
699 
700  DPRINT1("USBPORT_ClosePipe: ExFreePoolWithTag TtExtension - %p\n", TtExtension);
701  ExFreePoolWithTag(TtExtension, USB_PORT_TAG);
702  }
703  }
704  }
705 
706  KeReleaseSpinLock(&FdoExtension->TtSpinLock, OldIrql);
707  }
708  else
709  {
710  USBPORT_FreeBandwidth(FdoDevice, Endpoint);
711  }
712 
713  KeAcquireSpinLock(&Endpoint->EndpointSpinLock, &Endpoint->EndpointOldIrql);
715  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
716 
717  USBPORT_SignalWorkerThread(FdoDevice);
718 }
#define PIPE_HANDLE_FLAG_CLOSED
Definition: usbport.h:125
#define TRUE
Definition: types.h:120
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
VOID NTAPI USBPORT_FreeBandwidth(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
Definition: endpoint.c:171
VOID NTAPI USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint)
Definition: usb2.c:2040
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
#define PIPE_HANDLE_FLAG_NULL_PACKET_SIZE
Definition: usbport.h:126
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
ULONG MaxBandwidth
Definition: usbport.h:552
#define ENDPOINT_FLAG_ROOTHUB_EP0
Definition: usbport.h:111
LIST_ENTRY AbortList
Definition: usbport.h:229
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
KSPIN_LOCK StateChangeSpinLock
Definition: usbport.h:224
PUSB2_TT_EXTENSION TtExtension
Definition: usbport.h:208
#define USB2_TT_EXTENSION_FLAG_DELETED
Definition: usbport.h:545
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define USB_PORT_TAG
Definition: usbport.h:44
UCHAR KIRQL
Definition: env_spec_w32.h:591
LIST_ENTRY EndpointList
Definition: usbport.h:556
NTSTATUS NTAPI USBPORT_Wait(IN PVOID MiniPortExtension, IN ULONG Milliseconds)
Definition: usbport.c:543
#define USB_MINIPORT_FLAGS_USB2
Definition: usbmport.h:534
LIST_ENTRY PendingTransferList
Definition: usbport.h:226
LIST_ENTRY TransferList
Definition: usbport.h:227
KIRQL EndpointOldIrql
Definition: usbport.h:215
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI USBPORT_SetEndpointState(IN PUSBPORT_ENDPOINT Endpoint, IN ULONG State)
Definition: endpoint.c:363
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
VOID NTAPI USBPORT_RemovePipeHandle(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle)
Definition: endpoint.c:456
#define USBPORT_ENDPOINT_REMOVE
Definition: usbmport.h:16
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
PUSBPORT_DEVICE_HANDLE DeviceHandle
Definition: usbport.h:207
VOID NTAPI USBPORT_SignalWorkerThread(IN PDEVICE_OBJECT FdoDevice)
Definition: usbport.c:1111
#define USBPORT_TRANSFER_TYPE_INTERRUPT
Definition: usbmport.h:10
#define InterlockedDecrement
Definition: armddk.h:52
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
USBPORT_ENDPOINT_PROPERTIES EndpointProperties
Definition: usbport.h:210
#define InterlockedIncrement
Definition: armddk.h:53
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
VOID NTAPI USBPORT_UpdateAllocatedBwTt(IN PUSB2_TT_EXTENSION TtExtension)
Definition: usb2.c:1768
#define DPRINT1
Definition: precomp.h:8
#define USB2_FRAMES
Definition: usbport.h:451
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
LIST_ENTRY TtLink
Definition: usbport.h:238
LIST_ENTRY CancelList
Definition: usbport.h:228
KSPIN_LOCK EndpointSpinLock
Definition: usbport.h:214

Referenced by USBPORT_CloseConfiguration(), USBPORT_CreateDevice(), USBPORT_HandleSelectInterface(), USBPORT_RemoveDevice(), and USBPORT_RestoreDevice().

◆ USBPORT_CompleteCanceledBadRequest()

VOID NTAPI USBPORT_CompleteCanceledBadRequest ( IN PIO_CSQ  Csq,
IN PIRP  Irp 
)

Definition at line 246 of file queue.c.

248 {
250 
251  DPRINT_QUEUE("USBPORT_CompleteCanceledBadRequest: Irp - %p\n", Irp);
252 
255  BadRequestIoCsq);
256 
257  InterlockedDecrement(&FdoExtension->BadRequestLockCounter);
258 
259  Irp->IoStatus.Status = STATUS_CANCELLED;
260  Irp->IoStatus.Information = 0;
262 }
#define DPRINT_QUEUE(...)
Definition: usbdebug.h:148
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define InterlockedDecrement
Definition: armddk.h:52
IO_CSQ Csq
Definition: csqrtns.c:46
#define IO_NO_INCREMENT
Definition: iotypes.h:566

Referenced by USBPORT_StartDevice().

◆ USBPORT_CompleteCanceledIdleIrp()

VOID NTAPI USBPORT_CompleteCanceledIdleIrp ( IN PIO_CSQ  Csq,
IN PIRP  Irp 
)

Definition at line 123 of file queue.c.

125 {
127 
128  DPRINT_QUEUE("USBPORT_CompleteCanceledIdleIrp: ... \n");
129 
132  IdleIoCsq);
133 
134  InterlockedDecrement(&FdoExtension->IdleLockCounter);
135 
136  Irp->IoStatus.Status = STATUS_CANCELLED;
137  Irp->IoStatus.Information = 0;
139 }
#define DPRINT_QUEUE(...)
Definition: usbdebug.h:148
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define InterlockedDecrement
Definition: armddk.h:52
IO_CSQ Csq
Definition: csqrtns.c:46
#define IO_NO_INCREMENT
Definition: iotypes.h:566

Referenced by USBPORT_StartDevice().

◆ USBPORT_CompleteIsoTransfer()

ULONG NTAPI USBPORT_CompleteIsoTransfer ( IN PVOID  MiniPortExtension,
IN PVOID  MiniPortEndpoint,
IN PVOID  TransferParameters,
IN ULONG  TransferLength 
)

Definition at line 25 of file iso.c.

29 {
30  DPRINT1("USBPORT_CompleteIsoTransfer: UNIMPLEMENTED. FIXME.\n");
31  return 0;
32 }
#define DPRINT1
Definition: precomp.h:8

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_CompletePdoWaitWake()

VOID NTAPI USBPORT_CompletePdoWaitWake ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 15 of file power.c.

16 {
18  PDEVICE_OBJECT PdoDevice;
20  PIRP Irp;
21  KIRQL OldIrql;
22 
23  DPRINT("USBPORT_CompletePdoWaitWake: ... \n");
24 
25  FdoExtension = FdoDevice->DeviceExtension;
26  PdoDevice = FdoExtension->RootHubPdo;
27  PdoExtension = PdoDevice->DeviceExtension;
28 
29  KeAcquireSpinLock(&FdoExtension->PowerWakeSpinLock, &OldIrql);
30 
31  Irp = PdoExtension->WakeIrp;
32 
33  if (Irp && IoSetCancelRoutine(Irp, NULL))
34  {
35  PdoExtension->WakeIrp = NULL;
36  KeReleaseSpinLock(&FdoExtension->PowerWakeSpinLock, OldIrql);
37 
38  DPRINT("USBPORT_CompletePdoWaitWake: Complete Irp - %p\n", Irp);
39 
40  Irp->IoStatus.Status = STATUS_SUCCESS;
41  Irp->IoStatus.Information = 0;
43 
44  return;
45  }
46 
47  KeReleaseSpinLock(&FdoExtension->PowerWakeSpinLock, OldIrql);
48 }
_In_ PIRP Irp
Definition: csq.h:116
IoSetCancelRoutine(Irp, CancelRoutine)
UCHAR KIRQL
Definition: env_spec_w32.h:591
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by USBPORT_HcWakeDpc(), USBPORT_IsrDpc(), and USBPORT_PdoDevicePowerState().

◆ USBPORT_CompleteTransfer()

VOID NTAPI USBPORT_CompleteTransfer ( IN PURB  Urb,
IN USBD_STATUS  TransferStatus 
)

Definition at line 2176 of file usbport.c.

2178 {
2179  struct _URB_CONTROL_TRANSFER *UrbTransfer;
2180  PUSBPORT_TRANSFER Transfer;
2181  NTSTATUS Status;
2182  PIRP Irp;
2183  KIRQL OldIrql;
2184  PRKEVENT Event;
2185  BOOLEAN WriteToDevice;
2186  BOOLEAN IsFlushSuccess;
2187  PMDL Mdl;
2188  ULONG_PTR CurrentVa;
2189  SIZE_T TransferLength;
2190  PUSBPORT_ENDPOINT Endpoint;
2191  PDEVICE_OBJECT FdoDevice;
2193  PDMA_OPERATIONS DmaOperations;
2194 
2195  DPRINT("USBPORT_CompleteTransfer: Urb - %p, TransferStatus - %X\n",
2196  Urb,
2197  TransferStatus);
2198 
2199  UrbTransfer = &Urb->UrbControlTransfer;
2200  Transfer = UrbTransfer->hca.Reserved8[0];
2201 
2202  Transfer->USBDStatus = TransferStatus;
2203  Status = USBPORT_USBDStatusToNtStatus(Urb, TransferStatus);
2204 
2205  UrbTransfer->TransferBufferLength = Transfer->CompletedTransferLen;
2206 
2207  if (Transfer->Flags & TRANSFER_FLAG_DMA_MAPPED)
2208  {
2209  Endpoint = Transfer->Endpoint;
2210  FdoDevice = Endpoint->FdoDevice;
2211  FdoExtension = FdoDevice->DeviceExtension;
2212  DmaOperations = FdoExtension->DmaAdapter->DmaOperations;
2213 
2214  WriteToDevice = Transfer->Direction == USBPORT_DMA_DIRECTION_TO_DEVICE;
2215  Mdl = UrbTransfer->TransferBufferMDL;
2216  CurrentVa = (ULONG_PTR)MmGetMdlVirtualAddress(Mdl);
2217  TransferLength = UrbTransfer->TransferBufferLength;
2218 
2219  IsFlushSuccess = DmaOperations->FlushAdapterBuffers(FdoExtension->DmaAdapter,
2220  Mdl,
2221  Transfer->MapRegisterBase,
2222  (PVOID)CurrentVa,
2223  TransferLength,
2224  WriteToDevice);
2225 
2226  if (!IsFlushSuccess)
2227  {
2228  DPRINT("USBPORT_CompleteTransfer: no FlushAdapterBuffers !!!\n");
2229  ASSERT(FALSE);
2230  }
2231 
2233 
2234  DmaOperations->FreeMapRegisters(FdoExtension->DmaAdapter,
2235  Transfer->MapRegisterBase,
2236  Transfer->NumberOfMapRegisters);
2237 
2239  }
2240 
2241  if (Urb->UrbHeader.UsbdFlags & USBD_FLAG_ALLOCATED_MDL)
2242  {
2243  IoFreeMdl(Transfer->TransferBufferMDL);
2244  Urb->UrbHeader.UsbdFlags |= ~USBD_FLAG_ALLOCATED_MDL;
2245  }
2246 
2247  Urb->UrbControlTransfer.hca.Reserved8[0] = NULL;
2248  Urb->UrbHeader.UsbdFlags |= ~USBD_FLAG_ALLOCATED_TRANSFER;
2249 
2250  Irp = Transfer->Irp;
2251 
2252  if (Irp)
2253  {
2254  if (!NT_SUCCESS(Status))
2255  {
2256  //DbgBreakPoint();
2257  DPRINT1("USBPORT_CompleteTransfer: Irp - %p complete with Status - %lx\n",
2258  Irp,
2259  Status);
2260 
2261  USBPORT_DumpingURB(Urb);
2262  }
2263 
2264  Irp->IoStatus.Status = Status;
2265  Irp->IoStatus.Information = 0;
2266 
2270  }
2271 
2272  Event = Transfer->Event;
2273 
2274  if (Event)
2275  {
2277  }
2278 
2279  ExFreePoolWithTag(Transfer, USB_PORT_TAG);
2280 
2281  DPRINT_CORE("USBPORT_CompleteTransfer: exit\n");
2282 }
ULONG NumberOfMapRegisters
Definition: usbport.h:259
#define USBPORT_DMA_DIRECTION_TO_DEVICE
Definition: usbport.h:42
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
VOID NTAPI USBPORT_DumpingURB(IN PURB Urb)
Definition: debug.c:225
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define MmGetMdlVirtualAddress(_Mdl)
_In_ PIRP Irp
Definition: csq.h:116
PFREE_MAP_REGISTERS FreeMapRegisters
Definition: iotypes.h:2317
LONG NTSTATUS
Definition: precomp.h:26
#define USBD_FLAG_ALLOCATED_TRANSFER
Definition: usbport.h:122
PMDL TransferBufferMDL
Definition: usbport.h:254
PRKEVENT Event
Definition: usbport.h:248
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define TRANSFER_FLAG_DMA_MAPPED
Definition: usbport.h:130
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define USB_PORT_TAG
Definition: usbport.h:44
UCHAR KIRQL
Definition: env_spec_w32.h:591
PDEVICE_OBJECT FdoDevice
Definition: usbport.h:205
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
struct _URB_HCD_AREA hca
Definition: usb.h:474
PUSBPORT_ENDPOINT Endpoint
Definition: usbport.h:252
PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers
Definition: iotypes.h:2315
PMDL TransferBufferMDL
Definition: usb.h:472
#define USBD_FLAG_ALLOCATED_MDL
Definition: usbport.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
NTSTATUS NTAPI USBPORT_USBDStatusToNtStatus(IN PURB Urb, IN USBD_STATUS USBDStatus)
Definition: usbport.c:485
Status
Definition: gdiplustypes.h:24
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define EVENT_INCREMENT
Definition: iotypes.h:565
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define ULONG_PTR
Definition: config.h:101
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
USBD_STATUS USBDStatus
Definition: usbport.h:257
ULONG CompletedTransferLen
Definition: usbport.h:258
PVOID MapRegisterBase
Definition: usbport.h:260
ULONG TransferBufferLength
Definition: usb.h:470

Referenced by USBPORT_CancelPendingTransferIrp(), USBPORT_DoneTransfer(), USBPORT_FlushCancelList(), USBPORT_FlushPendingTransfers(), and USBPORT_QueuePendingTransferIrp().

◆ USBPORT_CreateDevice()

NTSTATUS NTAPI USBPORT_CreateDevice ( IN OUT PUSB_DEVICE_HANDLE pUsbdDeviceHandle,
IN PDEVICE_OBJECT  FdoDevice,
IN PUSBPORT_DEVICE_HANDLE  HubDeviceHandle,
IN USHORT  PortStatus,
IN USHORT  Port 
)

Definition at line 982 of file device.c.

987 {
988  PUSBPORT_DEVICE_HANDLE TtDeviceHandle = NULL;
989  PUSB2_TT_EXTENSION TtExtension = NULL;
990  USHORT port;
993  BOOL IsOpenedPipe;
996  ULONG TransferedLen;
997  ULONG DescriptorMinSize;
998  UCHAR MaxPacketSize;
1001  NTSTATUS Status;
1002 
1003  DPRINT("USBPORT_CreateDevice: PortStatus - %p, Port - %x\n",
1004  PortStatus,
1005  Port);
1006 
1007  FdoExtension = FdoDevice->DeviceExtension;
1008  Packet = &FdoExtension->MiniPortInterface->Packet;
1009 
1010  KeWaitForSingleObject(&FdoExtension->DeviceSemaphore,
1011  Executive,
1012  KernelMode,
1013  FALSE,
1014  NULL);
1015 
1017  {
1018  KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
1020  1,
1021  FALSE);
1022 
1023  DPRINT1("USBPORT_CreateDevice: Not valid hub DeviceHandle\n");
1025  }
1026 
1027  port = Port;
1028 
1029  if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2 &&
1031  {
1032  DPRINT1("USBPORT_CreateDevice: USB1 device connected to USB2 port\n");
1033 
1034  TtExtension = USBPORT_GetTt(FdoDevice,
1036  &port,
1037  &TtDeviceHandle);
1038 
1039  DPRINT("USBPORT_CreateDevice: TtDeviceHandle - %p, port - %x\n",
1040  TtDeviceHandle,
1041  port);
1042  }
1043 
1044  KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
1046  1,
1047  FALSE);
1048 
1050  sizeof(USBPORT_DEVICE_HANDLE),
1051  USB_PORT_TAG);
1052 
1053  if (!DeviceHandle)
1054  {
1055  DPRINT1("USBPORT_CreateDevice: Not allocated DeviceHandle\n");
1057  }
1058 
1060 
1061  *pUsbdDeviceHandle = NULL;
1062 
1063  DeviceHandle->TtExtension = TtExtension;
1064  DeviceHandle->PortNumber = Port;
1065  DeviceHandle->HubDeviceHandle = HubDeviceHandle;
1066 
1068  {
1069  DeviceHandle->DeviceSpeed = UsbLowSpeed;
1070  }
1072  {
1073  DeviceHandle->DeviceSpeed = UsbHighSpeed;
1074  }
1075  else
1076  {
1077  DeviceHandle->DeviceSpeed = UsbFullSpeed;
1078  }
1079 
1080  KeWaitForSingleObject(&FdoExtension->DeviceSemaphore,
1081  Executive,
1082  KernelMode,
1083  FALSE,
1084  NULL);
1085 
1086  PipeHandle = &DeviceHandle->PipeHandle;
1087 
1089 
1090  PipeHandle->EndpointDescriptor.bLength = sizeof(PipeHandle->EndpointDescriptor);
1091  PipeHandle->EndpointDescriptor.bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE;
1092 
1093  if (DeviceHandle->DeviceSpeed == UsbLowSpeed)
1094  {
1095  PipeHandle->EndpointDescriptor.wMaxPacketSize = 8;
1096  }
1097  else
1098  {
1099  PipeHandle->EndpointDescriptor.wMaxPacketSize = USB_DEFAULT_MAX_PACKET;
1100  }
1101 
1102  InitializeListHead(&DeviceHandle->PipeHandleList);
1103  InitializeListHead(&DeviceHandle->TtList);
1104 
1105  Status = USBPORT_OpenPipe(FdoDevice,
1106  DeviceHandle,
1107  PipeHandle,
1108  NULL);
1109 
1110  IsOpenedPipe = NT_SUCCESS(Status);
1111 
1112  if (NT_ERROR(Status))
1113  {
1114  DPRINT1("USBPORT_CreateDevice: USBPORT_OpenPipe return - %lx\n", Status);
1115 
1116  KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
1118  1,
1119  FALSE);
1120 
1122 
1123  return Status;
1124  }
1125 
1128  USB_PORT_TAG);
1129 
1130  if (!DeviceDescriptor)
1131  {
1132  DPRINT1("USBPORT_CreateDevice: Not allocated DeviceDescriptor\n");
1133  goto ErrorExit;
1134  }
1135 
1138 
1139  SetupPacket.bmRequestType.Dir = BMREQUEST_DEVICE_TO_HOST;
1141  SetupPacket.wValue.HiByte = USB_DEVICE_DESCRIPTOR_TYPE;
1143 
1144  TransferedLen = 0;
1145 
1147  FdoDevice,
1148  &SetupPacket,
1151  &TransferedLen,
1152  NULL);
1153 
1154  RtlCopyMemory(&DeviceHandle->DeviceDescriptor,
1156  sizeof(USB_DEVICE_DESCRIPTOR));
1157 
1159 
1160  DescriptorMinSize = RTL_SIZEOF_THROUGH_FIELD(USB_DEVICE_DESCRIPTOR,
1161  bMaxPacketSize0);
1162 
1163  if ((TransferedLen == DescriptorMinSize) && !NT_SUCCESS(Status))
1164  {
1166  }
1167 
1168  if (NT_SUCCESS(Status) && (TransferedLen >= DescriptorMinSize))
1169  {
1170  if ((DeviceHandle->DeviceDescriptor.bLength >= sizeof(USB_DEVICE_DESCRIPTOR)) &&
1171  (DeviceHandle->DeviceDescriptor.bDescriptorType == USB_DEVICE_DESCRIPTOR_TYPE))
1172  {
1173  MaxPacketSize = DeviceHandle->DeviceDescriptor.bMaxPacketSize0;
1174 
1175  if (MaxPacketSize == 8 ||
1176  MaxPacketSize == 16 ||
1177  MaxPacketSize == 32 ||
1178  MaxPacketSize == 64)
1179  {
1181 
1182  *pUsbdDeviceHandle = DeviceHandle;
1183 
1184  KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
1186  1,
1187  FALSE);
1188 
1189  return Status;
1190  }
1191  }
1192  }
1193 
1194  DPRINT1("USBPORT_CreateDevice: ERROR!!! TransferedLen - %x, Status - %lx\n",
1195  TransferedLen,
1196  Status);
1197 
1198 ErrorExit:
1199 
1200  if (TtExtension && TtDeviceHandle)
1201  {
1202  SetupPacket.bmRequestType.Recipient = BMREQUEST_TO_OTHER;
1203  SetupPacket.bmRequestType.Reserved = 0;
1204  SetupPacket.bmRequestType.Type = BMREQUEST_CLASS;
1205  SetupPacket.bmRequestType.Dir = BMREQUEST_HOST_TO_DEVICE;
1206 
1207  /* Table 11-15. Hub Class Requests */
1208  if (TtDeviceHandle == HubDeviceHandle)
1209  {
1210  SetupPacket.bRequest = USB_REQUEST_RESET_TT;
1211  }
1212  else
1213  {
1215  }
1216 
1217  SetupPacket.wValue.LowByte = 0;
1218  SetupPacket.wValue.HiByte = 0;
1219  SetupPacket.wIndex.W = port;
1220  SetupPacket.wLength = 0;
1221 
1222  USBPORT_SendSetupPacket(TtDeviceHandle,
1223  FdoDevice,
1224  &SetupPacket,
1225  NULL,
1226  0,
1227  NULL,
1228  NULL);
1229  }
1230 
1232 
1233  if (IsOpenedPipe)
1234  {
1236  }
1237 
1238  KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
1240  1,
1241  FALSE);
1242 
1244 
1245  return Status;
1246 }
#define USB_REQUEST_RESET_TT
Definition: usb200.h:283
#define USB_PORT_STATUS_LOW_SPEED
Definition: usb200.h:157
#define PIPE_HANDLE_FLAG_CLOSED
Definition: usbport.h:125
CPPORT Port[4]
Definition: headless.c:34
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
NTSTATUS NTAPI USBPORT_SendSetupPacket(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN PVOID Buffer, IN ULONG Length, IN OUT PULONG TransferedLen, IN OUT PUSBD_STATUS pUSBDStatus)
Definition: device.c:15
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
LONG NTSTATUS
Definition: precomp.h:26
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE HubDeviceHandle
Definition: hubbusif.h:40
VOID NTAPI USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_PIPE_HANDLE PipeHandle)
Definition: endpoint.c:590
#define LOW_REALTIME_PRIORITY
#define BMREQUEST_HOST_TO_DEVICE
Definition: usb100.h:31
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define USB_PORT_STATUS_HIGH_SPEED
Definition: usb200.h:158
#define USB_PORT_TAG
Definition: usbport.h:44
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define USB_MINIPORT_FLAGS_USB2
Definition: usbmport.h:534
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BMREQUEST_DEVICE_TO_HOST
Definition: usb100.h:32
#define USB_REQUEST_CLEAR_TT_BUFFER
Definition: usb200.h:282
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define BMREQUEST_TO_OTHER
Definition: usb100.h:41
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
NTSTATUS NTAPI USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle, IN OUT PUSBD_STATUS UsbdStatus)
Definition: endpoint.c:763
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI USBPORT_AddDeviceHandle(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
Definition: device.c:769
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:679
#define NT_ERROR(Status)
Definition: umtypes.h:106
BOOLEAN NTAPI USBPORT_ValidateDeviceHandle(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
Definition: device.c:801
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb100.h:82
unsigned char UCHAR
Definition: xmlstorage.h:181
#define BMREQUEST_CLASS
Definition: usb100.h:35
PUSB2_TT_EXTENSION NTAPI USBPORT_GetTt(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle, OUT PUSHORT OutPort, OUT PUSBPORT_DEVICE_HANDLE *OutHubDeviceHandle)
Definition: device.c:912
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
#define USB_DEFAULT_MAX_PACKET
Definition: usb.h:84
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
Status
Definition: gdiplustypes.h:24
UCHAR SetupPacket[8]
Definition: usb.h:475
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
Definition: semphobj.c:54
unsigned short USHORT
Definition: pedump.c:61
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966
USHORT port
Definition: uri.c:227
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159

Referenced by USBHI_CreateUsbDevice().

◆ USBPORT_CreateWorkerThread()

NTSTATUS NTAPI USBPORT_CreateWorkerThread ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 1422 of file usbport.c.

1423 {
1425  NTSTATUS Status;
1426 
1427  DPRINT("USBPORT_CreateWorkerThread ... \n");
1428 
1429  FdoExtension = FdoDevice->DeviceExtension;
1430 
1432 
1433  KeInitializeEvent(&FdoExtension->WorkerThreadEvent,
1435  FALSE);
1436 
1437  Status = PsCreateSystemThread(&FdoExtension->WorkerThreadHandle,
1439  NULL,
1440  NULL,
1441  NULL,
1443  (PVOID)FdoDevice);
1444 
1445  return Status;
1446 }
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define USBPORT_FLAG_WORKER_THREAD_ON
Definition: usbport.h:69
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID NTAPI USBPORT_WorkerThread(IN PVOID StartContext)
Definition: usbport.c:1368
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602

Referenced by USBPORT_StartDevice().

◆ USBPORT_DbgPrint()

ULONG NTAPI USBPORT_DbgPrint ( IN PVOID  MiniPortExtension,
IN ULONG  Level,
IN PCH  Format,
  ... 
)

Definition at line 20 of file debug.c.

24 {
25  DPRINT("USBPORT_DbgPrint: UNIMPLEMENTED. FIXME. \n");
26  return 0;
27 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by USBPORT_RegisterUSBPortDriver().

◆ USBPORT_DoIdleNotificationCallback()

VOID NTAPI USBPORT_DoIdleNotificationCallback ( IN PVOID  Context)

Definition at line 545 of file power.c.

546 {
547  PIO_STACK_LOCATION IoStack;
548  PDEVICE_OBJECT FdoDevice;
551  PIRP NextIrp;
552  LARGE_INTEGER CurrentTime = {{0, 0}};
553  PTIMER_WORK_QUEUE_ITEM IdleQueueItem;
554  PDEVICE_OBJECT PdoDevice;
555  PUSB_IDLE_CALLBACK_INFO IdleCallbackInfo;
556  KIRQL OldIrql;
557 
558  DPRINT("USBPORT_DoIdleNotificationCallback \n");
559 
560  IdleQueueItem = Context;
561 
562  FdoDevice = IdleQueueItem->FdoDevice;
563  FdoExtension = FdoDevice->DeviceExtension;
564  PdoDevice = FdoExtension->RootHubPdo;
565  PdoExtension = PdoDevice->DeviceExtension;
566 
567  KeQuerySystemTime(&CurrentTime);
568 
569  if ((FdoExtension->IdleTime.QuadPart == 0) ||
570  (((CurrentTime.QuadPart - FdoExtension->IdleTime.QuadPart) / 10000) >= 500))
571  {
572  if (PdoExtension->CommonExtension.DevicePowerState == PowerDeviceD0 &&
573  FdoExtension->CommonExtension.DevicePowerState == PowerDeviceD0)
574  {
575  NextIrp = IoCsqRemoveNextIrp(&FdoExtension->IdleIoCsq, NULL);
576 
577  if (NextIrp)
578  {
579  IoStack = IoGetCurrentIrpStackLocation(NextIrp);
580  IdleCallbackInfo = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
581 
582  if (IdleCallbackInfo && IdleCallbackInfo->IdleCallback)
583  {
584  IdleCallbackInfo->IdleCallback(IdleCallbackInfo->IdleContext);
585  }
586 
587  if (NextIrp->Cancel)
588  {
589  InterlockedDecrement(&FdoExtension->IdleLockCounter);
590 
591  NextIrp->IoStatus.Status = STATUS_CANCELLED;
592  NextIrp->IoStatus.Information = 0;
594  }
595  else
596  {
597  IoCsqInsertIrp(&FdoExtension->IdleIoCsq, NextIrp, NULL);
598  }
599  }
600  }
601  }
602 
603  KeAcquireSpinLock(&FdoExtension->TimerFlagsSpinLock, &OldIrql);
605  KeReleaseSpinLock(&FdoExtension->TimerFlagsSpinLock, OldIrql);
606 
607  ExFreePoolWithTag(IdleQueueItem, USB_PORT_TAG);
608 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define USBPORT_TMFLAG_IDLE_QUEUEITEM_ON
Definition: usbport.h:98
PDEVICE_OBJECT FdoDevice
Definition: usbport.h:444
NTKERNELAPI PIRP NTAPI IoCsqRemoveNextIrp(_Inout_ PIO_CSQ Csq, _In_opt_ PVOID PeekContext)
IoCsqRemoveNextIrp - Removes the next IRP from the queue.
Definition: csq.c:398
NTKERNELAPI VOID NTAPI IoCsqInsertIrp(_Inout_ PIO_CSQ Csq, _Inout_ PIRP Irp, _Out_opt_ PIO_CSQ_IRP_CONTEXT Context)
Insert an IRP into the CSQ.
Definition: csq.c:177
#define USB_PORT_TAG
Definition: usbport.h:44
UCHAR KIRQL
Definition: env_spec_w32.h:591
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define InterlockedDecrement
Definition: armddk.h:52
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
struct tagContext Context
Definition: acpixf.h:1024
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by USBPORT_TimerDpc().

◆ USBPORT_DoneSplitTransfer()

VOID NTAPI USBPORT_DoneSplitTransfer ( IN PUSBPORT_TRANSFER  SplitTransfer)

Definition at line 278 of file trfsplit.c.

279 {
280  PUSBPORT_TRANSFER ParentTransfer;
281  KIRQL OldIrql;
282 
283  DPRINT("USBPORT_DoneSplitTransfer: ... \n");
284 
285  ParentTransfer = SplitTransfer->ParentTransfer;
286  ParentTransfer->CompletedTransferLen += SplitTransfer->CompletedTransferLen;
287 
288  if (SplitTransfer->USBDStatus != USBD_STATUS_SUCCESS)
289  {
290  DPRINT1("USBPORT_DoneSplitTransfer: SplitTransfer->USBDStatus - %X\n",
291  SplitTransfer->USBDStatus);
292 
293  ParentTransfer->USBDStatus = SplitTransfer->USBDStatus;
294  }
295 
296  KeAcquireSpinLock(&ParentTransfer->TransferSpinLock, &OldIrql);
297 
298  RemoveEntryList(&SplitTransfer->SplitLink);
299  ExFreePoolWithTag(SplitTransfer, USB_PORT_TAG);
300 
301  if (IsListEmpty(&ParentTransfer->SplitTransfersList))
302  {
303  KeReleaseSpinLock(&ParentTransfer->TransferSpinLock, OldIrql);
304  USBPORT_DoneTransfer(ParentTransfer);
305  }
306  else
307  {
308  KeReleaseSpinLock(&ParentTransfer->TransferSpinLock, OldIrql);
309  }
310 }
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define USB_PORT_TAG
Definition: usbport.h:44
UCHAR KIRQL
Definition: env_spec_w32.h:591
struct _USBPORT_TRANSFER * ParentTransfer
Definition: usbport.h:263
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
VOID NTAPI USBPORT_DoneTransfer(IN PUSBPORT_TRANSFER Transfer)
Definition: usbport.c:724
#define USBD_STATUS_SUCCESS
Definition: usb.h:170
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
LIST_ENTRY SplitTransfersList
Definition: usbport.h:265
#define DPRINT1
Definition: precomp.h:8
KSPIN_LOCK TransferSpinLock
Definition: usbport.h:264
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
USBD_STATUS USBDStatus
Definition: usbport.h:257
ULONG CompletedTransferLen
Definition: usbport.h:258

Referenced by USBPORT_FlushDoneTransfers().

◆ USBPORT_DoneTransfer()

VOID NTAPI USBPORT_DoneTransfer ( IN PUSBPORT_TRANSFER  Transfer)

Definition at line 724 of file usbport.c.

725 {
726  PUSBPORT_ENDPOINT Endpoint;
727  PDEVICE_OBJECT FdoDevice;
729  PURB Urb;
730  PIRP Irp;
731  KIRQL CancelIrql;
732  KIRQL OldIrql;
733 
734  DPRINT_CORE("USBPORT_DoneTransfer: Transfer - %p\n", Transfer);
735 
736  Endpoint = Transfer->Endpoint;
737  FdoDevice = Endpoint->FdoDevice;
738  FdoExtension = FdoDevice->DeviceExtension;
739 
740  Urb = Transfer->Urb;
741  Irp = Transfer->Irp;
742 
743  KeAcquireSpinLock(&FdoExtension->FlushTransferSpinLock, &OldIrql);
744 
745  if (Irp)
746  {
747  IoAcquireCancelSpinLock(&CancelIrql);
749  IoReleaseCancelSpinLock(CancelIrql);
750 
752  }
753 
754  KeReleaseSpinLock(&FdoExtension->FlushTransferSpinLock, OldIrql);
755 
756  USBPORT_USBDStatusToNtStatus(Transfer->Urb, Transfer->USBDStatus);
757  USBPORT_CompleteTransfer(Urb, Urb->UrbHeader.Status);
758 
759  DPRINT_CORE("USBPORT_DoneTransfer: exit\n");
760 }
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
VOID NTAPI USBPORT_CompleteTransfer(IN PURB Urb, IN USBD_STATUS TransferStatus)
Definition: usbport.c:2176
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
IoSetCancelRoutine(Irp, CancelRoutine)
UCHAR KIRQL
Definition: env_spec_w32.h:591
PDEVICE_OBJECT FdoDevice
Definition: usbport.h:205
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
struct _URB_HEADER UrbHeader
Definition: usb.h:531
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
NTSTATUS NTAPI USBPORT_USBDStatusToNtStatus(IN PURB Urb, IN USBD_STATUS USBDStatus)
Definition: usbport.c:485
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
Definition: usb.h:529
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
PIRP NTAPI USBPORT_RemoveActiveTransferIrp(IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp)
Definition: queue.c:357

Referenced by USBPORT_DoneSplitTransfer(), and USBPORT_FlushDoneTransfers().

◆ USBPORT_DoSetPowerD0()

VOID NTAPI USBPORT_DoSetPowerD0 ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 104 of file power.c.

105 {
106  DPRINT("USBPORT_DoSetPowerD0: FIXME!\n");
107  return;
108 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by USBPORT_WorkerThread().

◆ USBPORT_DpcHandler()

VOID NTAPI USBPORT_DpcHandler ( IN PDEVICE_OBJECT  FdoDevice)

Definition at line 864 of file usbport.c.

865 {
867  PUSBPORT_ENDPOINT Endpoint;
870  LONG LockCounter;
871 
872  DPRINT_CORE("USBPORT_DpcHandler: ... \n");
873 
874  FdoExtension = FdoDevice->DeviceExtension;
875 
877 
878  KeAcquireSpinLockAtDpcLevel(&FdoExtension->EndpointListSpinLock);
879  Entry = FdoExtension->EndpointList.Flink;
880 
881  while (Entry && Entry != &FdoExtension->EndpointList)
882  {
883  Endpoint = CONTAINING_RECORD(Entry,
885  EndpointLink);
886 
887  LockCounter = InterlockedIncrement(&Endpoint->LockCounter);
888 
890  LockCounter ||
891  Endpoint->Flags & ENDPOINT_FLAG_ROOTHUB_EP0)
892  {
893  InterlockedDecrement(&Endpoint->LockCounter);
894  }
895  else
896  {
897  InsertTailList(&List, &Endpoint->DispatchLink);
898 
899  if (Endpoint->WorkerLink.Flink && Endpoint->WorkerLink.Blink)
900  {
901  RemoveEntryList(&Endpoint->WorkerLink);
902 
903  Endpoint->WorkerLink.Flink = NULL;
904  Endpoint->WorkerLink.Blink = NULL;
905  }
906  }
907 
908  Entry = Endpoint->EndpointLink.Flink;
909  }
910 
911  KeReleaseSpinLockFromDpcLevel(&FdoExtension->EndpointListSpinLock);
912 
913  while (!IsListEmpty(&List))
914  {
915  Endpoint = CONTAINING_RECORD(List.Flink,
917  DispatchLink);
918 
920  Endpoint->DispatchLink.Flink = NULL;
921  Endpoint->DispatchLink.Blink = NULL;
922 
923  USBPORT_EndpointWorker(Endpoint, TRUE);
925  }
926 
927  KeAcquireSpinLockAtDpcLevel(&FdoExtension->EndpointListSpinLock);
928 
929  if (!IsListEmpty(&FdoExtension->WorkerList))
930  {
931  USBPORT_SignalWorkerThread(FdoDevice);
932  }
933 
934  KeReleaseSpinLockFromDpcLevel(&FdoExtension->EndpointListSpinLock);
935 
936  USBPORT_FlushDoneTransfers(FdoDevice);
937 }
#define USBPORT_ENDPOINT_ACTIVE
Definition: usbmport.h:15
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
LIST_ENTRY EndpointLink
Definition: usbport.h:231
#define TRUE
Definition: types.h:120
LIST_ENTRY WorkerLink
Definition: usbport.h:232
struct _Entry Entry
Definition: kefuncs.h:640
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
BOOLEAN NTAPI USBPORT_EndpointWorker(IN PUSBPORT_ENDPOINT Endpoint, IN BOOLEAN LockNotChecked)
Definition: endpoint.c:1656
#define ENDPOINT_FLAG_ROOTHUB_EP0
Definition: usbport.h:111
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
LIST_ENTRY DispatchLink
Definition: usbport.h:234
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
long LONG
Definition: pedump.c:60
VOID NTAPI USBPORT_FlushDoneTransfers(IN PDEVICE_OBJECT FdoDevice)
Definition: usbport.c:764
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
VOID NTAPI USBPORT_FlushPendingTransfers(IN PUSBPORT_ENDPOINT Endpoint)
Definition: queue.c:785
LIST_ENTRY List
Definition: psmgr.c:57
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
VOID NTAPI USBPORT_SignalWorkerThread(IN PDEVICE_OBJECT FdoDevice)
Definition: usbport.c:1111
ULONG NTAPI USBPORT_GetEndpointState(IN PUSBPORT_ENDPOINT Endpoint)
Definition: endpoint.c:332
#define InterlockedDecrement
Definition: armddk.h:52
Definition: typedefs.h:117
#define InterlockedIncrement
Definition: armddk.h:53
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
base of all file and directory entries
Definition: entries.h:82

Referenced by USBPORT_IsrDpcHandler(), and USBPORT_WorkerRequestDpc().

◆ USBPORT_DumpingCapabilities()

VOID NTAPI USBPORT_DumpingCapabilities ( IN PDEVICE_CAPABILITIES  Capabilities)

Definition at line 171 of file debug.c.

172 {
173  if (!Capabilities)
174  {
175  return;
176  }
177 
178  DPRINT("Capabilities->Size - %x\n", Capabilities->Size);
179  DPRINT("Capabilities->Version - %x\n", Capabilities->Version);
180 
181  DPRINT("Capabilities->DeviceD1 - %x\n", Capabilities->DeviceD1);
182  DPRINT("Capabilities->DeviceD2 - %x\n", Capabilities->DeviceD2);
183  DPRINT("Capabilities->LockSupported - %x\n", Capabilities->LockSupported);
184  DPRINT("Capabilities->EjectSupported - %x\n", Capabilities->EjectSupported);
185  DPRINT("Capabilities->Removable - %x\n", Capabilities->Removable);
186  DPRINT("Capabilities->DockDevice - %x\n", Capabilities->DockDevice);
187  DPRINT("Capabilities->UniqueID - %x\n", Capabilities->UniqueID);
188  DPRINT("Capabilities->SilentInstall - %x\n", Capabilities->SilentInstall);
189  DPRINT("Capabilities->RawDeviceOK - %x\n", Capabilities->RawDeviceOK);
190  DPRINT("Capabilities->SurpriseRemovalOK - %x\n", Capabilities->SurpriseRemovalOK);
191 
192  DPRINT("Capabilities->Address - %x\n", Capabilities->Address);
193  DPRINT("Capabilities->UINumber - %x\n", Capabilities->UINumber);
194 
195  DPRINT("Capabilities->DeviceState[0] - %x\n", Capabilities->DeviceState[0]);
196  DPRINT("Capabilities->DeviceState[1] - %x\n", Capabilities->DeviceState[1]);
197  DPRINT("Capabilities->DeviceState[2] - %x\n", Capabilities->DeviceState[2]);
198  DPRINT("Capabilities->DeviceState[3] - %x\n", Capabilities->DeviceState[3]);
199  DPRINT("Capabilities->DeviceState[4] - %x\n", Capabilities->DeviceState[4]);
200  DPRINT("Capabilities->DeviceState[5] - %x\n", Capabilities->DeviceState[5]);
201  DPRINT("Capabilities->DeviceState[6] - %x\n", Capabilities->DeviceState[6]);
202 
203  DPRINT("Capabilities->SystemWake - %x\n", Capabilities->SystemWake);
204  DPRINT("Capabilities->DeviceWake - %x\n", Capabilities->DeviceWake);
205 
206  DPRINT("Capabilities->D1Latency - %x\n", Capabilities->D1Latency);
207  DPRINT("Capabilities->D2Latency - %x\n", Capabilities->D2Latency);
208  DPRINT("Capabilities->D3Latency - %x\n", Capabilities->D3Latency);
209 }
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by USBPORT_QueryCapabilities().

◆ USBPORT_DumpingConfiguration()

VOID NTAPI USBPORT_DumpingConfiguration ( IN PUSB_CONFIGURATION_DESCRIPTOR  ConfigDescriptor)

Definition at line 106 of file debug.c.

107 {
108  PUSB_INTERFACE_DESCRIPTOR iDescriptor;
110  ULONG ix;
111 
112  if (!ConfigDescriptor ||
113  ConfigDescriptor->bLength < sizeof(USB_CONFIGURATION_DESCRIPTOR))
114  {
115  return;
116  }
117 
118  DPRINT_URB("Dumping ConfigDescriptor - %p\n", ConfigDescriptor);
119  DPRINT_URB("bLength - %x\n", ConfigDescriptor->bLength);
120  DPRINT_URB("bDescriptorType - %x\n", ConfigDescriptor->bDescriptorType);
121  DPRINT_URB("wTotalLength - %x\n", ConfigDescriptor->wTotalLength);
122  DPRINT_URB("bNumInterfaces - %x\n", ConfigDescriptor->bNumInterfaces);
123  DPRINT_URB("bConfigurationValue - %x\n", ConfigDescriptor->bConfigurationValue);
124  DPRINT_URB("iConfiguration - %x\n", ConfigDescriptor->iConfiguration);
125  DPRINT_URB("bmAttributes - %x\n", ConfigDescriptor->bmAttributes);
126  DPRINT_URB("MaxPower - %x\n", ConfigDescriptor->MaxPower);
127 
128  iDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)ConfigDescriptor +
129  ConfigDescriptor->bLength);
130 
131  if (iDescriptor->bLength < sizeof(USB_INTERFACE_DESCRIPTOR))
132  {
133  return;
134  }
135 
136  DPRINT_URB("Dumping iDescriptor - %p\n", iDescriptor);
137  DPRINT_URB("bLength - %x\n", iDescriptor->bLength);
138  DPRINT_URB("bDescriptorType - %x\n", iDescriptor->bDescriptorType);
139  DPRINT_URB("bInterfaceNumber - %x\n", iDescriptor->bInterfaceNumber);
140  DPRINT_URB("bAlternateSetting - %x\n", iDescriptor->bAlternateSetting);
141  DPRINT_URB("bNumEndpoints - %x\n", iDescriptor->bNumEndpoints);
142  DPRINT_URB("bInterfaceClass - %x\n", iDescriptor->bInterfaceClass);
143  DPRINT_URB("bInterfaceSubClass - %x\n", iDescriptor->bInterfaceSubClass);
144  DPRINT_URB("bInterfaceProtocol - %x\n", iDescriptor->bInterfaceProtocol);
145  DPRINT_URB("iInterface - %x\n", iDescriptor->iInterface);
146 
148  iDescriptor->bLength);
149 
150  for (ix = 0; ix < iDescriptor->bNumEndpoints; ix++)
151  {
152  if (Descriptor->bLength < sizeof(USB_ENDPOINT_DESCRIPTOR))
153  {
154  return;
155  }
156 
157  DPRINT_URB("Dumping Descriptor - %p\n", Descriptor);
158  DPRINT_URB("bLength - %x\n", Descriptor->bLength);
159  DPRINT_URB("bDescriptorType - %x\n", Descriptor->bDescriptorType);
160  DPRINT_URB("bEndpointAddress - %x\n", Descriptor->bEndpointAddress);
161  DPRINT_URB("bmAttributes - %x\n", Descriptor->bmAttributes);
162  DPRINT_URB("wMaxPacketSize - %x\n", Descriptor->wMaxPacketSize);
163  DPRINT_URB("bInterval - %x\n", Descriptor->bInterval);
164 
165  Descriptor += 1;
166  }
167 }
#define DPRINT_URB(...)
Definition: usbdebug.h:145
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _USB_ENDPOINT_DESCRIPTOR * PUSB_ENDPOINT_DESCRIPTOR
unsigned int ULONG
Definition: retypes.h:1
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by USBPORT_HandleSelectConfiguration().

◆ USBPORT_DumpingDeviceDescriptor()

VOID NTAPI USBPORT_DumpingDeviceDescriptor ( IN PUSB_DEVICE_DESCRIPTOR  DeviceDescriptor)

Definition at line 80 of file debug.c.