Debian Codegraph @

spectro/UsbDkHelper.h

raw symbols SCIP
1 /**********************************************************************
2 * Copyright (c) 2013-2014 Red Hat, Inc.
3 *
4 * Developed by Daynix Computing LTD.
5 *
6 * Authors:
7 * Dmitry Fleytman <[email protected]>
8 * Pavel Gurvich <[email protected]>
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 * Modified to be function pointer declarations by GWG.
23 *
24 **********************************************************************/
25
26 #pragma once
27
28 // UsbDkHelper C-interface
29
30 #ifdef BUILD_DLL
31 # define DLL __declspec(dllexport)
32 #else
33 # ifdef _MSC_VER
34 # define DLL __declspec(dllimport)
35 # else
36 # define DLL
37 # endif
38 #endif
39
40 #include "UsbDkData.h"
41
42 typedef enum
43 {
44 InstallFailure,
45 InstallSuccessNeedReboot,
46 InstallSuccess,
47 InstallAborted
48 } InstallResult;
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 /* Install UsbDk Driver on the system
55 * Requires usbdk.inf , usbdk.sys, usbdkHelper.dll and
56 * wdfcoinstaller01009.dll files to exist in current directory
57 *
58 *
59 * @params
60 * None
61 *
62 * @return
63 * installation status
64 *
65 */
66 typedef DLL InstallResult (*UsbDk_InstallDriver_t)(void);
67
68 /* Uninstall UsbDk Driver from the system
69 *
70 *
71 * @params
72 * None
73 *
74 * @return
75 * TRUE if uninstall succeeds
76 *
77 */
78 typedef DLL BOOL (*UsbDk_UninstallDriver_t)(void);
79
80 /* List USB devices attached to the system
81 *
82 * @params
83 * IN - None
84 * OUT - DevicesArray pointer to array where devices will be stored
85 NumberDevices amount of returned devices
86 *
87 * @return
88 * TRUE if function succeeds
89 * @note
90 * It is caller's responsibility to release device list by
91 * using UsbDk_ReleaseDevicesList
92 *
93 */
94 typedef DLL BOOL (*UsbDk_GetDevicesList_t)(PUSB_DK_DEVICE_INFO *DevicesArray,
95 PULONG NumberDevices);
96
97 /* Release deviceArray list returned by UsbDk_GetDevicesList
98 *
99 * @params
100 * IN - DevicesArray pointer to device list to be released
101 * OUT - None
102 *
103 * @return
104 * None
105 *
106 */
107 typedef DLL void (*UsbDk_ReleaseDevicesList_t)(PUSB_DK_DEVICE_INFO DevicesArray);
108
109 /* Retrieve USB device configuration descriptor
110 *
111 * @params
112 * IN - Request pointer to descriptor request
113 * OUT - Descriptor pointer where configuration descriptor header will be stored
114 * - Length length of full descriptor
115 *
116 *
117 * @return
118 * TRUE if function succeeds
119 *
120 */
121 typedef DLL BOOL (*UsbDk_GetConfigurationDescriptor_t)(PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Request,
122 PUSB_CONFIGURATION_DESCRIPTOR *Descriptor,
123 PULONG Length);
124
125 /* Release configuration descriptor returned by UsbDk_GetConfigurationDescriptor
126 *
127 * @params
128 * IN - Descriptor - pointer to descriptor to be released
129 * OUT - None
130 *
131 * @return
132 * None
133 *
134 */
135 typedef DLL void (*UsbDk_ReleaseConfigurationDescriptor_t)
136 (PUSB_CONFIGURATION_DESCRIPTOR Descriptor);
137
138 /* Detach USB device from Windows and acquire it for exclusive access
139 *
140 * @params
141 * IN - DeviceID id of device to be acquired
142 * OUT - None
143 *
144 * @return
145 * Handle to acquired device
146 *
147 * @note
148 * Device returned to system automatically when handle is closed
149 *
150 */
151 typedef DLL HANDLE (*UsbDk_StartRedirect_t)(PUSB_DK_DEVICE_ID DeviceID);
152
153 /* Return USB device to system
154 *
155 * @params
156 * IN - DeviceHandle handle of acquired device
157 * OUT - None
158 *
159 * @return
160 * TRUE if function succeeds
161 *
162 */
163 typedef DLL BOOL (*UsbDk_StopRedirect_t)(HANDLE DeviceHandle);
164
165 /* Write to USB device pipe
166 *
167 * @params
168 * IN - DeviceHandle - handle of target USB device
169 * - Request - write request
170 * - Overlapped - asynchronous I/O definition
171 * OUT - None
172 *
173 * @return
174 * Status of transfer
175 *
176 */
177 typedef DLL TransferResult (*UsbDk_WritePipe_t)(HANDLE DeviceHandle,
178 PUSB_DK_TRANSFER_REQUEST Request,
179 LPOVERLAPPED Overlapped);
180
181 /* Read from USB device pipe
182 *
183 * @params
184 * IN - DeviceHandle - handle of target USB device
185 * - Request - read request
186 * - Overlapped - asynchronous I/O definition
187 * OUT - None
188 *
189 * @return
190 * Status of transfer
191 *
192 */
193 typedef DLL TransferResult (*UsbDk_ReadPipe_t)(HANDLE DeviceHandle,
194 PUSB_DK_TRANSFER_REQUEST Request,
195 LPOVERLAPPED Overlapped);
196
197 /* Issue an USB abort pipe request
198 *
199 * @params
200 * IN - DeviceHandle - handle of target USB device
201 * - PipeAddress - address of pipe to be aborted
202 * OUT - None
203 *
204 * @return
205 * TRUE if function succeeds
206 *
207 */
208 typedef DLL BOOL (*UsbDk_AbortPipe_t)(HANDLE DeviceHandle, ULONG64 PipeAddress);
209
210 /* Issue an USB reset pipe request
211 *
212 * @params
213 * IN - DeviceHandle - handle of target USB device
214 * - PipeAddress - address of pipe to be reset
215 * OUT - None
216 *
217 * @return
218 * TRUE if function succeeds
219 *
220 */
221 typedef DLL BOOL (*UsbDk_ResetPipe_t)(HANDLE DeviceHandle, ULONG64 PipeAddress);
222
223 /* Set active alternative settings for USB device
224 *
225 * @params
226 * IN - DeviceHandle - handle of target USB device
227 * - InterfaceIdx - interface index
228 * - AltSettingIdx - alternative settings index
229 * OUT - None
230 *
231 * @return
232 * TRUE if function succeeds
233 *
234 */
235 typedef DLL BOOL (*UsbDk_SetAltsetting_t)(HANDLE DeviceHandle,
236 ULONG64 InterfaceIdx,
237 ULONG64 AltSettingIdx);
238
239 /* Reset USB device
240 *
241 * @params
242 * IN - DeviceHandle - handle of target USB device
243 * OUT - None
244 *
245 * @return
246 * TRUE if function succeeds
247 *
248 */
249 typedef DLL BOOL (*UsbDk_ResetDevice_t)(HANDLE DeviceHandle);
250
251 /* Get system handle for asynchronous I/O cancellation requests
252 *
253 * @params
254 * IN - DeviceHandle - handle of target USB device
255 * OUT - None
256 *
257 * @return
258 * handle
259 *
260 */
261 typedef DLL HANDLE (*UsbDk_GetRedirectorSystemHandle_t)(HANDLE DeviceHandle);
262 #ifdef __cplusplus
263 }
264 #endif