55e080646127523ffc41b0c9628051f28831aba4
[reactos.git] / drivers / usb / usbccgp / usbccgp.h
1 #ifndef USBEHCI_H__
2 #define USBEHCI_H__
3
4 #include <ntddk.h>
5 #define NDEBUG
6 #include <debug.h>
7 #include <initguid.h>
8 #include <hubbusif.h>
9 #include <usbbusif.h>
10 #include <usbioctl.h>
11 #include <usbdlib.h>
12
13 //
14 // FIXME:
15 // #include <usbprotocoldefs.h>
16 //
17 #include <usb.h>
18 #include <stdio.h>
19 #include <wdmguid.h>
20
21 typedef struct
22 {
23 BOOLEAN IsFDO; // is device a FDO or PDO
24 }COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
25
26 typedef struct
27 {
28 COMMON_DEVICE_EXTENSION Common; // shared with PDO
29 PDRIVER_OBJECT DriverObject; // driver object
30 PDEVICE_OBJECT PhysicalDeviceObject; // physical device object
31 PDEVICE_OBJECT NextDeviceObject; // lower device object
32 PUSB_DEVICE_DESCRIPTOR DeviceDescriptor; // usb device descriptor
33 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; // usb configuration descriptor
34 DEVICE_CAPABILITIES Capabilities; // device capabilities
35 PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
36 ULONG InterfaceListCount; // interface list count
37 USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
38 USBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface; // bus custom enumeration interface
39 PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor; // usb function descriptor
40 ULONG FunctionDescriptorCount; // number of function descriptor
41 PDEVICE_OBJECT * ChildPDO; // child pdos
42 }FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
43
44 #define USBCCPG_TAG 'cbsu'
45
46 typedef struct
47 {
48 COMMON_DEVICE_EXTENSION Common; // shared with FDO
49 PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor; // function descriptor
50 PDEVICE_OBJECT NextDeviceObject; // next device object
51 DEVICE_CAPABILITIES Capabilities; // device capabilities
52 ULONG FunctionIndex; // function index
53 USB_DEVICE_DESCRIPTOR DeviceDescriptor; // usb device descriptor
54 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; // usb configuration descriptor
55 USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
56 PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
57 ULONG InterfaceListCount; // interface list count
58 PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to fdo's pdo list
59 }PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
60
61 /* descriptor.c */
62
63 NTSTATUS
64 USBCCGP_GetDescriptors(
65 IN PDEVICE_OBJECT DeviceObject);
66
67 NTSTATUS
68 USBCCGP_SelectConfiguration(
69 IN PDEVICE_OBJECT DeviceObject,
70 IN PFDO_DEVICE_EXTENSION DeviceExtension);
71
72 NTSTATUS
73 NTAPI
74 USBCCGP_GetDescriptor(
75 IN PDEVICE_OBJECT DeviceObject,
76 IN UCHAR DescriptorType,
77 IN ULONG DescriptorLength,
78 IN UCHAR DescriptorIndex,
79 IN LANGID LanguageId,
80 OUT PVOID *OutDescriptor);
81
82 ULONG
83 CountInterfaceDescriptors(
84 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
85
86 NTSTATUS
87 AllocateInterfaceDescriptorsArray(
88 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
89 OUT PUSB_INTERFACE_DESCRIPTOR **OutArray);
90
91 /* misc.c */
92
93 NTSTATUS
94 NTAPI
95 USBCCGP_SyncForwardIrp(
96 PDEVICE_OBJECT DeviceObject,
97 PIRP Irp);
98
99 NTSTATUS
100 USBCCGP_SyncUrbRequest(
101 IN PDEVICE_OBJECT DeviceObject,
102 OUT PURB UrbRequest);
103
104 PVOID
105 AllocateItem(
106 IN POOL_TYPE PoolType,
107 IN ULONG ItemSize);
108
109 VOID
110 FreeItem(
111 IN PVOID Item);
112
113 VOID
114 DumpFunctionDescriptor(
115 IN PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor,
116 IN ULONG FunctionDescriptorCount);
117
118 /* fdo.c */
119
120 NTSTATUS
121 FDO_Dispatch(
122 PDEVICE_OBJECT DeviceObject,
123 PIRP Irp);
124
125 /* pdo.c */
126
127 NTSTATUS
128 PDO_Dispatch(
129 PDEVICE_OBJECT DeviceObject,
130 PIRP Irp);
131
132 /* function.c */
133
134 NTSTATUS
135 USBCCGP_QueryInterface(
136 IN PDEVICE_OBJECT DeviceObject,
137 OUT PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface);
138
139 NTSTATUS
140 USBCCGP_EnumerateFunctions(
141 IN PDEVICE_OBJECT DeviceObject);
142
143 #endif