ReactOS  0.4.15-dev-3165-gdf6fff7
fxusbinterface.hpp
Go to the documentation of this file.
1 //
2 // Copyright (C) Microsoft. All rights reserved.
3 //
4 #ifndef _FXUSBINTERFACE_H_
5 #define _FXUSBINTERFACE_H_
6 
7 extern "C" {
8 #include <usbdrivr.h>
9 #include <wdfusb.h>
10 }
11 
12 #include "fxusbrequestcontext.hpp"
13 
14 #define FX_USB_INTERFACE_TAG 'uItG' //using a random uniqure value
15 
16 
17 
20 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
21 
22 
23 
24 
25 
26 
27 
29 #endif
30 };
31 
32 class FxUsbInterface : public FxNonPagedObject { //any base class
33 public:
34  friend FxUsbDevice;
35  friend FxUsbPipe;
36  //friend FxUsbTarget;
37 
39  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
42  );
43 
44  VOID
45  SetInfo(
47  );
48 
49  VOID
51  __in BOOLEAN ClearDestroyCallback
52  );
53 
55  NTSTATUS
58  __in PURB Urb
59  );
60 
61  UCHAR
63  VOID
64  )
65  {
67  }
68 
69  UCHAR
71  VOID
72  )
73  {
74  return m_InterfaceNumber;
75  }
76 
77  UCHAR
79  VOID
80  )
81  {
82  return m_NumSettings;
83  }
84 
85  UCHAR
88  );
89 
90  VOID
95  );
96 
97  VOID
99  __in PUSB_INTERFACE_DESCRIPTOR UsbInterfaceDescriptor,
101  );
102 
103  //post config
104 
105  UCHAR
107  VOID
108  ) ;
109 
110  WDFUSBPIPE
114  );
115 
117  NTSTATUS
119  VOID
120  );
121 
122  VOID
124  __in UCHAR NumberOfPipes
125  )
126  {
127  m_NumberOfConfiguredPipes = NumberOfPipes;
128  }
129 
130  VOID
132  __in FxUsbPipe **ppPipes
133  )
134  {
135  m_ConfiguredPipes = ppPipes;
136  }
137 
138  BOOLEAN
140  VOID
141  )
142  {
143  return m_ConfiguredPipes != NULL ? TRUE : FALSE;
144  }
145 
147  NTSTATUS
151  );
152 
154  NTSTATUS
158  );
159 
160  VOID
163  __in PUSB_ENDPOINT_DESCRIPTOR EndpointDesc,
165  );
166 
167  ULONG
169  VOID
170  );
171 
172  WDFUSBINTERFACE
174  {
175  return (WDFUSBINTERFACE) GetObjectHandle();
176  }
177 
180  __in UCHAR Setting
181  );
182 
183  NTSTATUS
186  );
187 
188  NTSTATUS
191  );
192 
193 protected:
195  VOID
196  );
197 
198  VOID
201  );
202 
203  VOID
206  __in USHORT NumEndpoints,
207  __in UCHAR SettingNumber
208  );
209 
210 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
211 public:
212  NTSTATUS
214  _In_ UCHAR FrameworkInterfaceIndex
215  );
216 
217  NTSTATUS
220  __in UCHAR NumPipes
221  );
222 #endif
223 
224 protected:
225  //
226  // Backpointer to the owning device
227  //
229 
230  //
231  // Array of pipe pointers
232  //
234 
235  //
236  // Array of alternative settings for the interface
237  //
239 
240  //
241  // Number of elements in m_Settings
242  //
244 
245  //
246  // Number of elements in m_ConfiguredPipes
247  //
249 
250  //
251  // Information out of the interface descriptor
252  //
258 
259 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
260 private:
261  //
262  // Handle to USB interface exposed by WinUsb
263  //
264  WINUSB_INTERFACE_HANDLE m_WinUsbHandle;
265 #endif
266 };
267 
268 
269 #endif // _FXUSBINTERFACE_H_
270 
#define __in_bcount(x)
Definition: dbghelp.h:41
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
__field_ecount(m_NumSettings) FxUsbInterfaceSetting *m_Settings
FxUsbDevice * m_UsbDevice
VOID GetDescriptor(__in PUSB_INTERFACE_DESCRIPTOR UsbInterfaceDescriptor, __in UCHAR SettingIndex)
#define TRUE
Definition: types.h:120
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition: wdfusb.h:2329
WDFUSBPIPE GetConfiguredPipe(__in UCHAR PipeIndex, __out_opt PWDF_USB_PIPE_INFORMATION PipeInfo)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS SetWinUsbHandle(_In_ UCHAR FrameworkInterfaceIndex)
#define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes)
Definition: usbdlib.h:117
_Must_inspect_result_ NTSTATUS SelectSettingByDescriptor(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor)
FxUsbPipe ** m_ConfiguredPipes
NTSTATUS UpdatePipeAttributes(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes)
VOID SetNumConfiguredPipes(__in UCHAR NumberOfPipes)
VOID SetConfiguredPipes(__in FxUsbPipe **ppPipes)
_Must_inspect_result_ NTSTATUS SelectSettingByIndex(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in UCHAR SettingIndex)
VOID CopyEndpointFieldsFromDescriptor(__in PWDF_USB_PIPE_INFORMATION PipeInfo, __in PUSB_ENDPOINT_DESCRIPTOR EndpointDesc, __in UCHAR SettingIndex)
VOID FormatSelectSettingUrb(__in_bcount(GET_SELECT_INTERFACE_REQUEST_SIZE(NumEndpoints)) PURB Urb, __in USHORT NumEndpoints, __in UCHAR SettingNumber)
_In_ WDFUSBINTERFACE _In_ UCHAR PipeIndex
Definition: wdfusb.h:2538
#define __out_opt
Definition: dbghelp.h:65
UCHAR m_NumberOfConfiguredPipes
#define FALSE
Definition: types.h:117
VOID SetInfo(__in PUSBD_INTERFACE_INFORMATION Interface)
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
UCHAR GetNumSettings(VOID)
unsigned char BOOLEAN
FxUsbInterface(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ FxUsbDevice *UsbDevice, _In_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor)
#define _In_
Definition: ms_sal.h:308
ULONG DetermineDefaultMaxTransferSize(VOID)
VOID GetEndpointInformation(__in UCHAR SettingIndex, __in UCHAR PipeIndex, __in PWDF_USB_PIPE_INFORMATION PipeInfo)
UCHAR GetNumConfiguredPipes(VOID)
_Must_inspect_result_ NTSTATUS SelectSetting(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb)
PUSB_INTERFACE_DESCRIPTOR GetSettingDescriptor(__in UCHAR Setting)
VOID CleanUpAndDelete(__in BOOLEAN ClearDestroyCallback)
UCHAR GetInterfaceNumber(VOID)
USB_INTERFACE_DESCRIPTOR InterfaceDescriptorAlloc
UCHAR GetNumEndpoints(__in UCHAR SettingIndex)
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFUSBDEVICE * UsbDevice
Definition: wdfusb.h:901
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
WDFUSBINTERFACE GetHandle(VOID)
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ _In_ WDFUSBINTERFACE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipesAttributes
Definition: wdfusb.h:2388
_In_ WDFUSBPIPE Pipe
Definition: wdfusb.h:1741
UCHAR GetConfiguredSettingIndex(VOID)
#define _Must_inspect_result_
Definition: ms_sal.h:558
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_opt_ PWDF_USB_PIPE_INFORMATION PipeInfo
Definition: wdfusb.h:2538
NTSTATUS MakeAndConfigurePipes(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in UCHAR NumPipes)
BOOLEAN IsInterfaceConfigured(VOID)
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
Definition: usb.h:529
VOID RemoveDeletedPipe(__in FxUsbPipe *Pipe)
unsigned short USHORT
Definition: pedump.c:61
#define NULL
Definition: types.h:112
_Must_inspect_result_ NTSTATUS CreateSettings(VOID)
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS CheckAndSelectSettingByIndex(__in UCHAR SettingIndex)
#define __in
Definition: dbghelp.h:35
_In_ WDFUSBINTERFACE _In_ UCHAR SettingIndex
Definition: wdfusb.h:2300