/*++ Copyright (c) 1995 Microsoft Corporation Module Name: HCDI.H Abstract: structures common to the usbd and hcd device drivers. Environment: Kernel & user mode Revision History: 09-29-95 : created --*/ #ifndef __HCDI_H__ #define __HCDI_H__ typedef NTSTATUS ROOT_HUB_POWER_FUNCTION(PDEVICE_OBJECT DeviceObject, PIRP Irp); typedef NTSTATUS HCD_DEFFERED_START_FUNCTION(PDEVICE_OBJECT DeviceObject, PIRP Irp); typedef NTSTATUS HCD_SET_DEVICE_POWER_STATE(PDEVICE_OBJECT DeviceObject, PIRP Irp, DEVICE_POWER_STATE DeviceState); typedef NTSTATUS HCD_GET_CURRENT_FRAME(PDEVICE_OBJECT DeviceObject, PULONG CurrentFrame); typedef NTSTATUS HCD_GET_CONSUMED_BW(PDEVICE_OBJECT DeviceObject); typedef NTSTATUS HCD_SUBMIT_ISO_URB(PDEVICE_OBJECT DeviceObject, PURB Urb); // // values for DeviceExtension Flags // #define USBDFLAG_PDO_REMOVED 0x00000001 #define USBDFLAG_HCD_SHUTDOWN 0x00000002 #define USBDFLAG_HCD_STARTED 0x00000004 #define USBDFLAG_HCD_D0_COMPLETE_PENDING 0x00000008 #define USBDFLAG_RH_DELAY_SET_D0 0x00000010 #define USBDFLAG_NEED_NEW_HCWAKEIRP 0x00000020 typedef struct _USBD_EXTENSION { // ptr to true device extension or NULL if this // is the true extension PVOID TrueDeviceExtension; ULONG Flags; // size of this structure ULONG Length; ROOT_HUB_POWER_FUNCTION *RootHubPower; HCD_DEFFERED_START_FUNCTION *HcdDeferredStartDevice; HCD_SET_DEVICE_POWER_STATE *HcdSetDevicePowerState; HCD_GET_CURRENT_FRAME *HcdGetCurrentFrame; HCD_GET_CONSUMED_BW *HcdGetConsumedBW; HCD_SUBMIT_ISO_URB *HcdSubmitIsoUrb; DEVICE_POWER_STATE HcCurrentDevicePowerState; KEVENT PnpStartEvent; // // Owner of frame length control for this HC // PVOID FrameLengthControlOwner; // // HCD device object we are connected to. // PDEVICE_OBJECT HcdDeviceObject; // wake irp passed to us by the hub driver // for the root hub PIRP PendingWakeIrp; // wakeup irp we send down the HC stack PIRP HcWakeIrp; // // device object for top of the HCD stack // this = HcdDeviceObject when no filters // are present. // PDEVICE_OBJECT HcdTopOfStackDeviceObject; PDEVICE_OBJECT HcdTopOfPdoStackDeviceObject; // // copy of the host controller device // capabilities // DEVICE_CAPABILITIES HcDeviceCapabilities; DEVICE_CAPABILITIES RootHubDeviceCapabilities; PIRP PowerIrp; // // Used to serialize open/close endpoint and // device configuration // KSEMAPHORE UsbDeviceMutex; // // Bitmap of assigned USB addresses // ULONG AddressList[4]; // // Remember the Root Hub PDO we created. // PDEVICE_OBJECT RootHubPDO; PDRIVER_OBJECT DriverObject; // // symbolic link created for HCD stack // UNICODE_STRING DeviceLinkUnicodeString; BOOLEAN DiagnosticMode; BOOLEAN DiagIgnoreHubs; BOOLEAN Reserved; // used to be supportNonComp UCHAR HcWakeFlags; ULONG DeviceHackFlags; KSPIN_LOCK WaitWakeSpin; // // Store away the PDO // PDEVICE_OBJECT HcdPhysicalDeviceObject; PVOID RootHubDeviceData; DEVICE_POWER_STATE RootHubDeviceState; // current USB defined power state of the bus // during last suspend. DEVICE_POWER_STATE SuspendPowerState; UNICODE_STRING RootHubSymbolicLinkName; KSPIN_LOCK RootHubPowerSpin; PDEVICE_OBJECT RootHubPowerDeviceObject; PIRP RootHubPowerIrp; PIRP IdleNotificationIrp; BOOLEAN IsPIIX3or4; BOOLEAN WakeSupported; } USBD_EXTENSION, *PUSBD_EXTENSION; #define HC_ENABLED_FOR_WAKEUP 0x01 #define HC_WAKE_PENDING 0x02 // device hack flags, these flags alter the stacks default behavior // in order to support certain broken "legacy" devices #define USBD_DEVHACK_SLOW_ENUMERATION 0x00000001 #define USBD_DEVHACK_DISABLE_SN 0x00000002 // // This macro returns the true device object for the HCD give // either the true device_object or a PDO owned by the HCD/BUS // driver. // // // HCD specific URB commands // #define URB_FUNCTION_HCD_OPEN_ENDPOINT 0x1000 #define URB_FUNCTION_HCD_CLOSE_ENDPOINT 0x1001 #define URB_FUNCTION_HCD_GET_ENDPOINT_STATE 0x1002 #define URB_FUNCTION_HCD_SET_ENDPOINT_STATE 0x1003 #define URB_FUNCTION_HCD_ABORT_ENDPOINT 0x1004 // this bit is set for all functions that must be handled by HCD #define HCD_URB_FUNCTION 0x1000 // this bit is set in the function code by USBD to indicate that // this is an internal call originating from USBD #define HCD_NO_USBD_CALL 0x2000 // // values for HcdEndpointState // // // set if the current state of the endpoint in the HCD is 'stalled' // #define HCD_ENDPOINT_HALTED_BIT 0 #define HCD_ENDPOINT_HALTED (1<