reactos/drivers/usb/usbhub_new/usbhub.h
Michael Martin e9fe271ad6 [USBHUB_NEW]
- The lower level driver completes the SCE IRP whenever the change state has been modified for a port. When handling the SCE IRP completion only check for flags in change state. The Change flags must be cleared else the hub driver will get non stop SCE IRP completions.
- Allocate IRP from Pool vice calling IoAllocateIrp. Dont free the IRP in the completion routine as the port driver, oddly, frees them.
- GetUsbDeviceDescriptor: Remove use of MDL and use only buffer instead to make our new usbehci happy.
- When calling the interface routines, correctly use the BusContext returned from the interface instead of the RootHubPdo. This worked on windows as it just happened they were the same.
- Implement RootHubInitCallbackFunction, which only job currently is to send the first SCE IRP.
- For Start Device for child device objects fake success for now. Will be implemented later.
- Implement returning IRP_MN_QUERY_IDs, IRP_MN_QUERY_DEVICE_TEXTs and IRP_MN_QUERY_BUS_INFORMATION.
- Add basic handling for IRP_MJ_POWER.
- Misc code changes.
 

svn path=/branches/usb-bringup/; revision=51620
2011-05-07 14:49:02 +00:00

159 lines
3.8 KiB
C

#pragma once
#include <ntifs.h>
#include <ntddk.h>
#include <wdmguid.h>
#include <hubbusif.h>
#include <usbbusif.h>
#include <usbioctl.h>
#include <usb.h>
#include <stdio.h>
#include <usbdlib.h>
#include <debug.h>
//BROKEN: #include <usbprotocoldefs.h>
#include <pseh/pseh2.h>
#define USB_HUB_TAG 'hbsu'
#define USB_MAXCHILDREN 127
// Lifted from broken header above
#define C_HUB_LOCAL_POWER 0
#define C_HUB_OVER_CURRENT 1
#define PORT_CONNECTION 0
#define PORT_ENABLE 1
#define PORT_SUSPEND 2
#define PORT_OVER_CURRENT 3
#define PORT_RESET 4
#define PORT_POWER 8
#define PORT_LOW_SPEED 9
#define C_PORT_CONNECTION 16
#define C_PORT_ENABLE 17
#define C_PORT_SUSPEND 18
#define C_PORT_OVER_CURRENT 19
#define C_PORT_RESET 20
#define PORT_TEST 21
#define PORT_INDICATOR 22
typedef struct _PORT_STATUS_CHANGE
{
USHORT Status;
USHORT Change;
} PORT_STATUS_CHANGE, *PPORT_STATUS_CHANGE;
typedef struct _WORK_ITEM_DATA
{
WORK_QUEUE_ITEM WorkItem;
PVOID Context;
} WORK_ITEM_DATA, *PWORK_ITEM_DATA;
typedef struct
{
BOOLEAN IsFDO;
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
typedef struct _HUB_CHILDDEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT ParentDeviceObject;
PUSB_DEVICE_HANDLE UsbDeviceHandle;
PWCHAR DeviceId;
PWCHAR InstanceId;
PWCHAR HardwareIds;
PWCHAR CompatibleIds;
PWCHAR TextDescription;
USB_DEVICE_DESCRIPTOR DeviceDesc;
USB_CONFIGURATION_DESCRIPTOR ConfigDesc;
UNICODE_STRING SymbolicLinkName;
} HUB_CHILDDEVICE_EXTENSION, *PHUB_CHILDDEVICE_EXTENSION;
typedef struct _HUB_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT LowerDeviceObject;
ULONG ChildCount;
PDEVICE_OBJECT ChildDeviceObject[USB_MAXCHILDREN];
PDEVICE_OBJECT RootHubPhysicalDeviceObject;
PDEVICE_OBJECT RootHubFunctionalDeviceObject;
ULONG NumberOfHubs;
PORT_STATUS_CHANGE *PortStatusChange;
URB PendingSCEUrb;
PIRP PendingSCEIrp;
USB_BUS_INTERFACE_HUB_V5 HubInterface;
USB_BUS_INTERFACE_USBDI_V2 UsbDInterface;
USB_HUB_DESCRIPTOR HubDescriptor;
USB_DEVICE_DESCRIPTOR HubDeviceDescriptor;
USB_CONFIGURATION_DESCRIPTOR HubConfigDescriptor;
USB_INTERFACE_DESCRIPTOR HubInterfaceDescriptor;
USB_ENDPOINT_DESCRIPTOR HubEndPointDescriptor;
USB_EXTHUB_INFORMATION_0 UsbExtHubInfo;
USB_DEVICE_INFORMATION_0 DeviceInformation;
USBD_CONFIGURATION_HANDLE ConfigurationHandle;
USBD_PIPE_HANDLE PipeHandle;
PVOID RootHubHandle;
UNICODE_STRING SymbolicLinkName;
} HUB_DEVICE_EXTENSION, *PHUB_DEVICE_EXTENSION;
// createclose.c
NTSTATUS NTAPI
USBHUB_Create(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
USBHUB_Close(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
USBHUB_Cleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
// fdo.c
NTSTATUS
USBHUB_FdoHandleDeviceControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp);
NTSTATUS
USBHUB_FdoHandlePnp(
PDEVICE_OBJECT DeviceObject,
PIRP Irp);
// misc.c
NTSTATUS
ForwardIrpAndWait(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
ForwardIrpAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
// pdo.c
NTSTATUS
USBHUB_PdoHandlePnp(
PDEVICE_OBJECT DeviceObject,
PIRP Irp);
NTSTATUS
USBHUB_PdoHandleInternalDeviceControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp);
VOID
DumpDeviceDescriptor(
PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
VOID
DumpConfigurationDescriptor(
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);