]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UsbLib.h
Code Scrub the common includes in MdePkg.
[mirror_edk2.git] / MdePkg / Include / Library / UsbLib.h
1 /** @file
2 Common Dxe Libarary for USB
3
4 Copyright (c) 2006, 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 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 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 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 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 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 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 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 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 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 UsbGetDescriptor (
216 IN EFI_USB_IO_PROTOCOL *UsbIo,
217 IN UINT16 Value,
218 IN UINT16 Index,
219 IN UINT16 DescriptorLength,
220 OUT VOID *Descriptor,
221 OUT UINT32 *Status
222 );
223
224 /**
225 Usb Set Descriptor
226
227 @param UsbIo EFI_USB_IO_PROTOCOL
228 @param Value Device Request Value
229 @param Index Device Request Index
230 @param DescriptorLength Descriptor Length
231 @param Descriptor Descriptor buffer to set
232 @param Status Transfer Status
233
234 @retval EFI_INVALID_PARAMETER Parameter is error
235 @retval EFI_SUCCESS Success
236 @retval EFI_TIMEOUT Device has no response
237
238 **/
239 EFI_STATUS
240 EFIAPI
241 UsbSetDescriptor (
242 IN EFI_USB_IO_PROTOCOL *UsbIo,
243 IN UINT16 Value,
244 IN UINT16 Index,
245 IN UINT16 DescriptorLength,
246 IN VOID *Descriptor,
247 OUT UINT32 *Status
248 );
249
250 /**
251 Usb Get Device Interface
252
253 @param UsbIo EFI_USB_IO_PROTOCOL
254 @param Index Interface index value
255 @param AltSetting Alternate setting
256 @param Status Trasnsfer status
257
258 @retval EFI_INVALID_PARAMETER Parameter is error
259 @retval EFI_SUCCESS Success
260 @retval EFI_TIMEOUT Device has no response
261
262 **/
263 EFI_STATUS
264 EFIAPI
265 UsbGetInterface (
266 IN EFI_USB_IO_PROTOCOL *UsbIo,
267 IN UINT16 Index,
268 OUT UINT8 *AltSetting,
269 OUT UINT32 *Status
270 );
271
272 /**
273 Usb Set Device Interface
274
275 @param UsbIo EFI_USB_IO_PROTOCOL
276 @param InterfaceNo Interface Number
277 @param AltSetting Alternate setting
278 @param Status Trasnsfer status
279
280 @retval EFI_INVALID_PARAMETER Parameter is error
281 @retval EFI_SUCCESS Success
282 @retval EFI_TIMEOUT Device has no response
283
284 **/
285 EFI_STATUS
286 EFIAPI
287 UsbSetInterface (
288 IN EFI_USB_IO_PROTOCOL *UsbIo,
289 IN UINT16 InterfaceNo,
290 IN UINT16 AltSetting,
291 OUT UINT32 *Status
292 );
293
294 /**
295 Usb Get Device Configuration
296
297 @param UsbIo EFI_USB_IO_PROTOCOL
298 @param ConfigValue Config Value
299 @param Status Transfer Status
300
301 @retval EFI_INVALID_PARAMETER Parameter is error
302 @retval EFI_SUCCESS Success
303 @retval EFI_TIMEOUT Device has no response
304
305 **/
306 EFI_STATUS
307 EFIAPI
308 UsbGetConfiguration (
309 IN EFI_USB_IO_PROTOCOL *UsbIo,
310 OUT UINT8 *ConfigValue,
311 OUT UINT32 *Status
312 );
313
314 /**
315 Usb Set Device Configuration
316
317 @param UsbIo EFI_USB_IO_PROTOCOL
318 @param Value Configuration Value to set
319 @param Status Transfer status
320
321 @retval EFI_INVALID_PARAMETER Parameter is error
322 @retval EFI_SUCCESS Success
323 @retval EFI_TIMEOUT Device has no response
324
325 **/
326 EFI_STATUS
327 EFIAPI
328 UsbSetConfiguration (
329 IN EFI_USB_IO_PROTOCOL *UsbIo,
330 IN UINT16 Value,
331 OUT UINT32 *Status
332 );
333
334 /**
335 Usb Set Device Feature
336
337 @param UsbIo EFI_USB_IO_PROTOCOL
338 @param Recipient Interface/Device/Endpoint
339 @param Value Request value
340 @param Target Request Index
341 @param Status Transfer status
342
343 @retval EFI_INVALID_PARAMETER Parameter is error
344 @retval EFI_SUCCESS Success
345 @retval EFI_TIMEOUT Device has no response
346
347 **/
348 EFI_STATUS
349 EFIAPI
350 UsbSetFeature (
351 IN EFI_USB_IO_PROTOCOL *UsbIo,
352 IN UINTN Recipient,
353 IN UINT16 Value,
354 IN UINT16 Target,
355 OUT UINT32 *Status
356 );
357
358 /**
359 Usb Clear Device Feature
360
361 @param UsbIo EFI_USB_IO_PROTOCOL
362 @param Recipient Interface/Device/Endpoint
363 @param Value Request value
364 @param Target Request Index
365 @param Status Transfer status
366
367 @retval EFI_INVALID_PARAMETER Parameter is error
368 @retval EFI_SUCCESS Success
369 @retval EFI_TIMEOUT Device has no response
370
371 **/
372 EFI_STATUS
373 EFIAPI
374 UsbClearFeature (
375 IN EFI_USB_IO_PROTOCOL *UsbIo,
376 IN UINTN Recipient,
377 IN UINT16 Value,
378 IN UINT16 Target,
379 OUT UINT32 *Status
380 );
381
382 /**
383 Usb Get Device Status
384
385 @param UsbIo EFI_USB_IO_PROTOCOL
386 @param Recipient Interface/Device/Endpoint
387 @param Target Request index
388 @param DevStatus Device status
389 @param Status Transfer status
390
391 @retval EFI_INVALID_PARAMETER Parameter is error
392 @retval EFI_SUCCESS Success
393 @retval EFI_TIMEOUT Device has no response
394
395 **/
396 EFI_STATUS
397 EFIAPI
398 UsbGetStatus (
399 IN EFI_USB_IO_PROTOCOL *UsbIo,
400 IN UINTN Recipient,
401 IN UINT16 Target,
402 OUT UINT16 *DevStatus,
403 OUT UINT32 *Status
404 );
405
406 /**
407 Clear endpoint stall
408
409 @param UsbIo EFI_USB_IO_PROTOCOL
410 @param EndpointNo Endpoint Number
411 @param Status Transfer Status
412
413 @retval EFI_NOT_FOUND Can't find the Endpoint
414 @retval EFI_DEVICE_ERROR Hardware error
415 @retval EFI_SUCCESS Success
416
417 **/
418 EFI_STATUS
419 EFIAPI
420 UsbClearEndpointHalt (
421 IN EFI_USB_IO_PROTOCOL *UsbIo,
422 IN UINT8 EndpointNo,
423 OUT UINT32 *Status
424 );
425
426 #endif