]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UsbLib.h
Use doxygen comment style for document entity such as struct, enum, variable that...
[mirror_edk2.git] / MdePkg / Include / Library / UsbLib.h
1 /** @file
2 Common Dxe Libarary for USB.
3
4 Copyright (c) 2006 - 2008, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #ifndef __USB_DXE_LIB_H__
17 #define __USB_DXE_LIB_H__
18
19 #include <Protocol/UsbIo.h>
20
21 ///
22 /// define the timeout time as 3ms
23 ///
24 #define TIMEOUT_VALUE 3 * 1000
25
26 /**
27 Get Hid Descriptor.
28
29 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
30 @param InterfaceNum Hid interface number.
31 @param HidDescriptor Caller allocated buffer to store Usb hid descriptor if
32 successfully returned.
33
34 @return Status of getting HID descriptor through USB I/O
35 protocol's UsbControlTransfer().
36
37 **/
38 EFI_STATUS
39 EFIAPI
40 UsbGetHidDescriptor (
41 IN EFI_USB_IO_PROTOCOL *UsbIo,
42 IN UINT8 InterfaceNum,
43 OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
44 );
45
46
47 /**
48 get Report Class descriptor.
49
50 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
51 @param InterfaceNum Report interface number.
52 @param DescriptorSize Length of DescriptorBuffer.
53 @param DescriptorBuffer Caller allocated buffer to store Usb report descriptor
54 if successfully returned.
55
56 @return Status of getting Report Class descriptor through USB
57 I/O protocol's UsbControlTransfer().
58
59 **/
60 EFI_STATUS
61 EFIAPI
62 UsbGetReportDescriptor (
63 IN EFI_USB_IO_PROTOCOL *UsbIo,
64 IN UINT8 InterfaceNum,
65 IN UINT16 DescriptorSize,
66 OUT UINT8 *DescriptorBuffer
67 );
68
69 /**
70 Get Hid Protocol Request.
71
72 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
73 @param Interface Which interface the caller wants to get protocol.
74 @param Protocol Protocol value returned.
75
76 @return Status of getting Protocol Request through USB I/O
77 protocol's UsbControlTransfer().
78
79 **/
80 EFI_STATUS
81 EFIAPI
82 UsbGetProtocolRequest (
83 IN EFI_USB_IO_PROTOCOL *UsbIo,
84 IN UINT8 Interface,
85 IN UINT8 *Protocol
86 );
87
88 /**
89 Set Hid Protocol Request.
90
91 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
92 @param Interface Which interface the caller wants to set protocol.
93 @param Protocol Protocol value the caller wants to set.
94
95 @return Status of setting Protocol Request through USB I/O
96 protocol's UsbControlTransfer().
97
98 **/
99 EFI_STATUS
100 EFIAPI
101 UsbSetProtocolRequest (
102 IN EFI_USB_IO_PROTOCOL *UsbIo,
103 IN UINT8 Interface,
104 IN UINT8 Protocol
105 );
106
107 /**
108 Set Idel request.
109
110 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
111 @param Interface Which interface the caller wants to set.
112 @param ReportId Which report the caller wants to set.
113 @param Duration Idle rate the caller wants to set.
114
115 @return Status of setting IDLE Request through USB I/O
116 protocol's UsbControlTransfer().
117
118 **/
119 EFI_STATUS
120 EFIAPI
121 UsbSetIdleRequest (
122 IN EFI_USB_IO_PROTOCOL *UsbIo,
123 IN UINT8 Interface,
124 IN UINT8 ReportId,
125 IN UINT8 Duration
126 );
127
128 /**
129 Get Idel request.
130
131 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
132 @param Interface Which interface the caller wants to get.
133 @param ReportId Which report the caller wants to get.
134 @param Duration Idle rate the caller wants to get.
135
136 @return Status of getting IDLE Request through USB I/O
137 protocol's UsbControlTransfer().
138
139 **/
140 EFI_STATUS
141 EFIAPI
142 UsbGetIdleRequest (
143 IN EFI_USB_IO_PROTOCOL *UsbIo,
144 IN UINT8 Interface,
145 IN UINT8 ReportId,
146 OUT UINT8 *Duration
147 );
148
149 /**
150 Hid Set Report request.
151
152 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
153 @param Interface Which interface the caller wants to set.
154 @param ReportId Which report the caller wants to set.
155 @param ReportType Type of report.
156 @param ReportLen Length of report descriptor.
157 @param Report Report Descriptor buffer.
158
159 @return Status of setting Report Request through USB I/O
160 protocol's UsbControlTransfer().
161
162 **/
163 EFI_STATUS
164 EFIAPI
165 UsbSetReportRequest (
166 IN EFI_USB_IO_PROTOCOL *UsbIo,
167 IN UINT8 Interface,
168 IN UINT8 ReportId,
169 IN UINT8 ReportType,
170 IN UINT16 ReportLen,
171 IN UINT8 *Report
172 );
173
174 /**
175 Hid Set Report request.
176
177 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
178 @param Interface Which interface the caller wants to set.
179 @param ReportId Which report the caller wants to set.
180 @param ReportType Type of report.
181 @param ReportLen Length of report descriptor.
182 @param Report Caller allocated buffer to store Report Descriptor.
183
184 @return Status of getting Report Request through USB I/O
185 protocol's UsbControlTransfer().
186
187 **/
188 EFI_STATUS
189 EFIAPI
190 UsbGetReportRequest (
191 IN EFI_USB_IO_PROTOCOL *UsbIo,
192 IN UINT8 Interface,
193 IN UINT8 ReportId,
194 IN UINT8 ReportType,
195 IN UINT16 ReportLen,
196 IN UINT8 *Report
197 );
198
199 /**
200 Usb Get Descriptor.
201
202 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
203 @param Value Device Request Value.
204 @param Index Device Request Index.
205 @param DescriptorLength Descriptor Length.
206 @param Descriptor Descriptor buffer to contain result.
207 @param Status Transfer Status.
208
209 @retval EFI_INVALID_PARAMETER Parameter is error.
210 @retval EFI_SUCCESS Success.
211 @retval EFI_TIMEOUT Device has no response.
212
213 **/
214 EFI_STATUS
215 EFIAPI
216 UsbGetDescriptor (
217 IN EFI_USB_IO_PROTOCOL *UsbIo,
218 IN UINT16 Value,
219 IN UINT16 Index,
220 IN UINT16 DescriptorLength,
221 OUT VOID *Descriptor,
222 OUT UINT32 *Status
223 );
224
225 /**
226 Usb Set Descriptor.
227
228 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
229 @param Value Device Request Value.
230 @param Index Device Request Index.
231 @param DescriptorLength Descriptor Length.
232 @param Descriptor Descriptor buffer to set.
233 @param Status Transfer Status.
234
235 @retval EFI_INVALID_PARAMETER Parameter is error.
236 @retval EFI_SUCCESS Success.
237 @retval EFI_TIMEOUT Device has no response.
238
239 **/
240 EFI_STATUS
241 EFIAPI
242 UsbSetDescriptor (
243 IN EFI_USB_IO_PROTOCOL *UsbIo,
244 IN UINT16 Value,
245 IN UINT16 Index,
246 IN UINT16 DescriptorLength,
247 IN VOID *Descriptor,
248 OUT UINT32 *Status
249 );
250
251 /**
252 Usb Get Device Interface.
253
254 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
255 @param Index Interface index value.
256 @param AltSetting Alternate setting.
257 @param Status Trasnsfer status.
258
259 @retval EFI_INVALID_PARAMETER Parameter is error.
260 @retval EFI_SUCCESS Success.
261 @retval EFI_TIMEOUT Device has no response.
262
263 **/
264 EFI_STATUS
265 EFIAPI
266 UsbGetInterface (
267 IN EFI_USB_IO_PROTOCOL *UsbIo,
268 IN UINT16 Index,
269 OUT UINT8 *AltSetting,
270 OUT UINT32 *Status
271 );
272
273 /**
274 Usb Set Device Interface.
275
276 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
277 @param InterfaceNo Interface Number.
278 @param AltSetting Alternate setting.
279 @param Status Trasnsfer status.
280
281 @retval EFI_INVALID_PARAMETER Parameter is error.
282 @retval EFI_SUCCESS Success.
283 @retval EFI_TIMEOUT Device has no response.
284
285 **/
286 EFI_STATUS
287 EFIAPI
288 UsbSetInterface (
289 IN EFI_USB_IO_PROTOCOL *UsbIo,
290 IN UINT16 InterfaceNo,
291 IN UINT16 AltSetting,
292 OUT UINT32 *Status
293 );
294
295 /**
296 Usb Get Device Configuration.
297
298 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
299 @param ConfigValue Config Value.
300 @param Status Transfer Status.
301
302 @retval EFI_INVALID_PARAMETER Parameter is error.
303 @retval EFI_SUCCESS Success.
304 @retval EFI_TIMEOUT Device has no response.
305
306 **/
307 EFI_STATUS
308 EFIAPI
309 UsbGetConfiguration (
310 IN EFI_USB_IO_PROTOCOL *UsbIo,
311 OUT UINT8 *ConfigValue,
312 OUT UINT32 *Status
313 );
314
315 /**
316 Usb Set Device Configuration.
317
318 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
319 @param Value Configuration Value to set.
320 @param Status Transfer status.
321
322 @retval EFI_INVALID_PARAMETER Parameter is error.
323 @retval EFI_SUCCESS Success.
324 @retval EFI_TIMEOUT Device has no response.
325
326 **/
327 EFI_STATUS
328 EFIAPI
329 UsbSetConfiguration (
330 IN EFI_USB_IO_PROTOCOL *UsbIo,
331 IN UINT16 Value,
332 OUT UINT32 *Status
333 );
334
335 /**
336 Usb Set Device Feature.
337
338 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
339 @param Recipient Interface/Device/Endpoint.
340 @param Value Request value.
341 @param Target Request Index.
342 @param Status Transfer status.
343
344 @retval EFI_INVALID_PARAMETER Parameter is error.
345 @retval EFI_SUCCESS Success.
346 @retval EFI_TIMEOUT Device has no response.
347
348 **/
349 EFI_STATUS
350 EFIAPI
351 UsbSetFeature (
352 IN EFI_USB_IO_PROTOCOL *UsbIo,
353 IN UINTN Recipient,
354 IN UINT16 Value,
355 IN UINT16 Target,
356 OUT UINT32 *Status
357 );
358
359 /**
360 Usb Clear Device Feature.
361
362 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
363 @param Recipient Interface/Device/Endpoint.
364 @param Value Request value.
365 @param Target Request Index.
366 @param Status Transfer status.
367
368 @retval EFI_INVALID_PARAMETER Parameter is error.
369 @retval EFI_SUCCESS Success.
370 @retval EFI_TIMEOUT Device has no response.
371
372 **/
373 EFI_STATUS
374 EFIAPI
375 UsbClearFeature (
376 IN EFI_USB_IO_PROTOCOL *UsbIo,
377 IN UINTN Recipient,
378 IN UINT16 Value,
379 IN UINT16 Target,
380 OUT UINT32 *Status
381 );
382
383 /**
384 Usb Get Device Status.
385
386 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
387 @param Recipient Interface/Device/Endpoint.
388 @param Target Request index.
389 @param DevStatus Device status.
390 @param Status Transfer status.
391
392 @retval EFI_INVALID_PARAMETER Parameter is error.
393 @retval EFI_SUCCESS Success.
394 @retval EFI_TIMEOUT Device has no response.
395
396 **/
397 EFI_STATUS
398 EFIAPI
399 UsbGetStatus (
400 IN EFI_USB_IO_PROTOCOL *UsbIo,
401 IN UINTN Recipient,
402 IN UINT16 Target,
403 OUT UINT16 *DevStatus,
404 OUT UINT32 *Status
405 );
406
407 /**
408 Clear endpoint stall.
409
410 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
411 @param EndpointNo Endpoint Number.
412 @param Status Transfer Status.
413
414 @retval EFI_NOT_FOUND Can't find the Endpoint.
415 @retval EFI_DEVICE_ERROR Hardware error.
416 @retval EFI_SUCCESS Success.
417
418 **/
419 EFI_STATUS
420 EFIAPI
421 UsbClearEndpointHalt (
422 IN EFI_USB_IO_PROTOCOL *UsbIo,
423 IN UINT8 EndpointNo,
424 OUT UINT32 *Status
425 );
426
427 #endif