2012-01-26 03:42:56 +00:00
|
|
|
#ifndef USBEHCI_H__
|
|
|
|
#define USBEHCI_H__
|
|
|
|
|
2014-02-03 10:50:41 +00:00
|
|
|
#include <wdm.h>
|
2012-01-26 03:42:56 +00:00
|
|
|
#include <hubbusif.h>
|
|
|
|
#include <usbbusif.h>
|
|
|
|
#include <usbdlib.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-02-25 00:35:40 +00:00
|
|
|
BOOLEAN IsFDO; // is device a FDO or PDO
|
2012-01-26 03:42:56 +00:00
|
|
|
}COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
COMMON_DEVICE_EXTENSION Common; // shared with PDO
|
|
|
|
PDRIVER_OBJECT DriverObject; // driver object
|
|
|
|
PDEVICE_OBJECT PhysicalDeviceObject; // physical device object
|
|
|
|
PDEVICE_OBJECT NextDeviceObject; // lower device object
|
|
|
|
PUSB_DEVICE_DESCRIPTOR DeviceDescriptor; // usb device descriptor
|
|
|
|
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; // usb configuration descriptor
|
|
|
|
DEVICE_CAPABILITIES Capabilities; // device capabilities
|
|
|
|
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
|
|
|
|
ULONG InterfaceListCount; // interface list count
|
|
|
|
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
|
2012-01-26 13:45:59 +00:00
|
|
|
USBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface; // bus custom enumeration interface
|
|
|
|
PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor; // usb function descriptor
|
|
|
|
ULONG FunctionDescriptorCount; // number of function descriptor
|
2012-01-26 19:11:44 +00:00
|
|
|
PDEVICE_OBJECT * ChildPDO; // child pdos
|
2012-02-03 16:03:42 +00:00
|
|
|
LIST_ENTRY ResetPortListHead; // reset port list head
|
|
|
|
LIST_ENTRY CyclePortListHead; // cycle port list head
|
|
|
|
UCHAR ResetPortActive; // reset port active
|
|
|
|
UCHAR CyclePortActive; // cycle port active
|
|
|
|
KSPIN_LOCK Lock; // reset / cycle port list lock
|
2012-01-26 03:42:56 +00:00
|
|
|
}FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
|
|
|
|
|
|
|
#define USBCCPG_TAG 'cbsu'
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
COMMON_DEVICE_EXTENSION Common; // shared with FDO
|
2012-01-26 19:11:44 +00:00
|
|
|
PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor; // function descriptor
|
|
|
|
PDEVICE_OBJECT NextDeviceObject; // next device object
|
|
|
|
DEVICE_CAPABILITIES Capabilities; // device capabilities
|
|
|
|
ULONG FunctionIndex; // function index
|
2012-01-27 20:58:58 +00:00
|
|
|
USB_DEVICE_DESCRIPTOR DeviceDescriptor; // usb device descriptor
|
|
|
|
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; // usb configuration descriptor
|
2012-01-28 19:49:53 +00:00
|
|
|
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
|
|
|
|
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
|
|
|
|
ULONG InterfaceListCount; // interface list count
|
2012-02-25 00:35:40 +00:00
|
|
|
PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to fdo's pdo list
|
2012-01-26 03:42:56 +00:00
|
|
|
}PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
|
|
|
|
2012-12-09 18:39:35 +00:00
|
|
|
/* descriptor.c */
|
|
|
|
|
|
|
|
VOID
|
|
|
|
DumpConfigurationDescriptor(
|
|
|
|
IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
|
2012-01-26 03:42:56 +00:00
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
USBCCGP_GetDescriptors(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
USBCCGP_SelectConfiguration(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PFDO_DEVICE_EXTENSION DeviceExtension);
|
|
|
|
|
2012-01-26 13:45:59 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
USBCCGP_GetDescriptor(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN UCHAR DescriptorType,
|
|
|
|
IN ULONG DescriptorLength,
|
|
|
|
IN UCHAR DescriptorIndex,
|
|
|
|
IN LANGID LanguageId,
|
|
|
|
OUT PVOID *OutDescriptor);
|
|
|
|
|
2012-02-22 21:26:36 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
USBCCGP_GetStringDescriptor(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN ULONG DescriptorLength,
|
|
|
|
IN UCHAR DescriptorIndex,
|
|
|
|
IN LANGID LanguageId,
|
|
|
|
OUT PVOID *OutDescriptor);
|
|
|
|
|
2012-01-27 20:58:58 +00:00
|
|
|
ULONG
|
|
|
|
CountInterfaceDescriptors(
|
|
|
|
IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
AllocateInterfaceDescriptorsArray(
|
|
|
|
IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
|
|
|
|
OUT PUSB_INTERFACE_DESCRIPTOR **OutArray);
|
|
|
|
|
2012-01-26 03:42:56 +00:00
|
|
|
/* misc.c */
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
USBCCGP_SyncUrbRequest(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
OUT PURB UrbRequest);
|
|
|
|
|
|
|
|
PVOID
|
|
|
|
AllocateItem(
|
|
|
|
IN POOL_TYPE PoolType,
|
|
|
|
IN ULONG ItemSize);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FreeItem(
|
|
|
|
IN PVOID Item);
|
|
|
|
|
2012-01-27 18:04:39 +00:00
|
|
|
VOID
|
|
|
|
DumpFunctionDescriptor(
|
|
|
|
IN PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor,
|
|
|
|
IN ULONG FunctionDescriptorCount);
|
|
|
|
|
2012-01-26 03:42:56 +00:00
|
|
|
/* fdo.c */
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
FDO_Dispatch(
|
2021-06-11 12:29:21 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject,
|
2012-01-26 03:42:56 +00:00
|
|
|
PIRP Irp);
|
|
|
|
|
|
|
|
/* pdo.c */
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
PDO_Dispatch(
|
2021-06-11 12:29:21 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject,
|
2012-01-26 03:42:56 +00:00
|
|
|
PIRP Irp);
|
|
|
|
|
2012-01-26 13:45:59 +00:00
|
|
|
/* function.c */
|
2012-01-26 03:42:56 +00:00
|
|
|
|
2012-01-26 13:45:59 +00:00
|
|
|
NTSTATUS
|
|
|
|
USBCCGP_QueryInterface(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
OUT PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
USBCCGP_EnumerateFunctions(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject);
|
2012-01-26 03:42:56 +00:00
|
|
|
|
2014-02-03 10:50:41 +00:00
|
|
|
#endif /* USBEHCI_H__ */
|