ReactOS 0.4.15-dev-7889-g76290a6
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
7extern "C" {
8#include <usbdrivr.h>
9#include <wdfusb.h>
10}
11
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
32class FxUsbInterface : public FxNonPagedObject { //any base class
33public:
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
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
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
151 );
152
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
186 );
187
191 );
192
193protected:
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)
211public:
214 _In_ UCHAR FrameworkInterfaceIndex
215 );
216
220 __in UCHAR NumPipes
221 );
222#endif
223
224protected:
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)
260private:
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
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
FxUsbPipe ** m_ConfiguredPipes
ULONG DetermineDefaultMaxTransferSize(VOID)
_Must_inspect_result_ NTSTATUS SelectSettingByIndex(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in UCHAR SettingIndex)
VOID FormatSelectSettingUrb(__in_bcount(GET_SELECT_INTERFACE_REQUEST_SIZE(NumEndpoints)) PURB Urb, __in USHORT NumEndpoints, __in UCHAR SettingNumber)
VOID GetEndpointInformation(__in UCHAR SettingIndex, __in UCHAR PipeIndex, __in PWDF_USB_PIPE_INFORMATION PipeInfo)
VOID CleanUpAndDelete(__in BOOLEAN ClearDestroyCallback)
UCHAR GetNumSettings(VOID)
VOID SetConfiguredPipes(__in FxUsbPipe **ppPipes)
UCHAR GetInterfaceNumber(VOID)
VOID RemoveDeletedPipe(__in FxUsbPipe *Pipe)
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
__field_ecount(m_NumSettings) FxUsbInterfaceSetting *m_Settings
BOOLEAN IsInterfaceConfigured(VOID)
NTSTATUS SetWinUsbHandle(_In_ UCHAR FrameworkInterfaceIndex)
VOID CopyEndpointFieldsFromDescriptor(__in PWDF_USB_PIPE_INFORMATION PipeInfo, __in PUSB_ENDPOINT_DESCRIPTOR EndpointDesc, __in UCHAR SettingIndex)
VOID GetDescriptor(__in PUSB_INTERFACE_DESCRIPTOR UsbInterfaceDescriptor, __in UCHAR SettingIndex)
PUSB_INTERFACE_DESCRIPTOR GetSettingDescriptor(__in UCHAR Setting)
_Must_inspect_result_ NTSTATUS SelectSettingByDescriptor(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor)
WDFUSBPIPE GetConfiguredPipe(__in UCHAR PipeIndex, __out_opt PWDF_USB_PIPE_INFORMATION PipeInfo)
WDFUSBINTERFACE GetHandle(VOID)
NTSTATUS CheckAndSelectSettingByIndex(__in UCHAR SettingIndex)
UCHAR m_NumberOfConfiguredPipes
_Must_inspect_result_ NTSTATUS CreateSettings(VOID)
UCHAR GetNumEndpoints(__in UCHAR SettingIndex)
FxUsbDevice * m_UsbDevice
VOID SetInfo(__in PUSBD_INTERFACE_INFORMATION Interface)
VOID SetNumConfiguredPipes(__in UCHAR NumberOfPipes)
UCHAR GetNumConfiguredPipes(VOID)
NTSTATUS UpdatePipeAttributes(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes)
_Must_inspect_result_ NTSTATUS SelectSetting(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb)
NTSTATUS MakeAndConfigurePipes(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in UCHAR NumPipes)
#define __out_opt
Definition: dbghelp.h:65
#define __in
Definition: dbghelp.h:35
#define __in_bcount(x)
Definition: dbghelp.h:41
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
return pObject GetObjectHandle()
return pUsbInterface GetConfiguredSettingIndex()
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _In_
Definition: ms_sal.h:308
unsigned short USHORT
Definition: pedump.c:61
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
USB_INTERFACE_DESCRIPTOR InterfaceDescriptorAlloc
Definition: usb.h:529
uint32_t ULONG
Definition: typedefs.h:59
#define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes)
Definition: usbdlib.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_opt_ PWDF_USB_PIPE_INFORMATION PipeInfo
Definition: wdfusb.h:2543
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition: wdfusb.h:2334
_In_ WDFUSBINTERFACE _In_ UCHAR PipeIndex
Definition: wdfusb.h:2540
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFUSBDEVICE * UsbDevice
Definition: wdfusb.h:906
_Must_inspect_result_ _In_ WDFUSBINTERFACE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipesAttributes
Definition: wdfusb.h:2390
_In_ WDFUSBPIPE Pipe
Definition: wdfusb.h:1741
_In_ WDFUSBINTERFACE _In_ UCHAR SettingIndex
Definition: wdfusb.h:2303
unsigned char UCHAR
Definition: xmlstorage.h:181