2 Common Dxe Libarary for USB.
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
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.
16 #ifndef __USB_DXE_LIB_H__
17 #define __USB_DXE_LIB_H__
19 #include <Protocol/UsbIo.h>
22 // define the timeout time as 3ms
24 #define TIMEOUT_VALUE 3 * 1000
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.
34 @return Status of getting HID descriptor through USB I/O
35 protocol's UsbControlTransfer().
41 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
42 IN UINT8 InterfaceNum
,
43 OUT EFI_USB_HID_DESCRIPTOR
*HidDescriptor
48 get Report Class descriptor.
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.
56 @return Status of getting Report Class descriptor through USB
57 I/O protocol's UsbControlTransfer().
62 UsbGetReportDescriptor (
63 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
64 IN UINT8 InterfaceNum
,
65 IN UINT16 DescriptorSize
,
66 OUT UINT8
*DescriptorBuffer
70 Get Hid Protocol Request.
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.
76 @return Status of getting Protocol Request through USB I/O
77 protocol's UsbControlTransfer().
82 UsbGetProtocolRequest (
83 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
89 Set Hid Protocol Request.
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.
95 @return Status of setting Protocol Request through USB I/O
96 protocol's UsbControlTransfer().
101 UsbSetProtocolRequest (
102 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
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.
115 @return Status of setting IDLE Request through USB I/O
116 protocol's UsbControlTransfer().
122 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
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.
136 @return Status of getting IDLE Request through USB I/O
137 protocol's UsbControlTransfer().
143 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
150 Hid Set Report request.
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.
159 @return Status of setting Report Request through USB I/O
160 protocol's UsbControlTransfer().
165 UsbSetReportRequest (
166 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
175 Hid Set Report request.
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.
184 @return Status of getting Report Request through USB I/O
185 protocol's UsbControlTransfer().
190 UsbGetReportRequest (
191 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
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.
209 @retval EFI_INVALID_PARAMETER Parameter is error.
210 @retval EFI_SUCCESS Success.
211 @retval EFI_TIMEOUT Device has no response.
217 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
220 IN UINT16 DescriptorLength
,
221 OUT VOID
*Descriptor
,
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.
235 @retval EFI_INVALID_PARAMETER Parameter is error.
236 @retval EFI_SUCCESS Success.
237 @retval EFI_TIMEOUT Device has no response.
243 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
246 IN UINT16 DescriptorLength
,
252 Usb Get Device Interface.
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.
259 @retval EFI_INVALID_PARAMETER Parameter is error.
260 @retval EFI_SUCCESS Success.
261 @retval EFI_TIMEOUT Device has no response.
267 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
269 OUT UINT8
*AltSetting
,
274 Usb Set Device Interface.
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.
281 @retval EFI_INVALID_PARAMETER Parameter is error.
282 @retval EFI_SUCCESS Success.
283 @retval EFI_TIMEOUT Device has no response.
289 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
290 IN UINT16 InterfaceNo
,
291 IN UINT16 AltSetting
,
296 Usb Get Device Configuration.
298 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
299 @param ConfigValue Config Value.
300 @param Status Transfer Status.
302 @retval EFI_INVALID_PARAMETER Parameter is error.
303 @retval EFI_SUCCESS Success.
304 @retval EFI_TIMEOUT Device has no response.
309 UsbGetConfiguration (
310 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
311 OUT UINT8
*ConfigValue
,
316 Usb Set Device Configuration.
318 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
319 @param Value Configuration Value to set.
320 @param Status Transfer status.
322 @retval EFI_INVALID_PARAMETER Parameter is error.
323 @retval EFI_SUCCESS Success.
324 @retval EFI_TIMEOUT Device has no response.
329 UsbSetConfiguration (
330 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
336 Usb Set Device Feature.
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.
344 @retval EFI_INVALID_PARAMETER Parameter is error.
345 @retval EFI_SUCCESS Success.
346 @retval EFI_TIMEOUT Device has no response.
352 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
360 Usb Clear Device Feature.
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.
368 @retval EFI_INVALID_PARAMETER Parameter is error.
369 @retval EFI_SUCCESS Success.
370 @retval EFI_TIMEOUT Device has no response.
376 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
384 Usb Get Device Status.
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.
392 @retval EFI_INVALID_PARAMETER Parameter is error.
393 @retval EFI_SUCCESS Success.
394 @retval EFI_TIMEOUT Device has no response.
400 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
403 OUT UINT16
*DevStatus
,
408 Clear endpoint stall.
410 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
411 @param EndpointNo Endpoint Number.
412 @param Status Transfer Status.
414 @retval EFI_NOT_FOUND Can't find the Endpoint.
415 @retval EFI_DEVICE_ERROR Hardware error.
416 @retval EFI_SUCCESS Success.
421 UsbClearEndpointHalt (
422 IN EFI_USB_IO_PROTOCOL
*UsbIo
,