2 Provides most usb APIs to support the Hid requests defined in Usb Hid 1.1 spec
3 and the standard requests defined in Usb 1.1 spec.
5 Copyright (c) 2006 - 2008, Intel Corporation<BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef __USB_DXE_LIB_H__
18 #define __USB_DXE_LIB_H__
20 #include <Protocol/UsbIo.h>
23 /// define the timeout time as 3ms
25 #define TIMEOUT_VALUE 3 * 1000
30 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
31 @param InterfaceNum Hid interface number.
32 @param HidDescriptor Caller allocated buffer to store Usb hid descriptor if
33 successfully returned.
35 @return Status of getting HID descriptor through USB I/O
36 protocol's UsbControlTransfer().
42 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
43 IN UINT8 InterfaceNum
,
44 OUT EFI_USB_HID_DESCRIPTOR
*HidDescriptor
49 get Report Class descriptor.
51 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
52 @param InterfaceNum Report interface number.
53 @param DescriptorSize Length of DescriptorBuffer.
54 @param DescriptorBuffer Caller allocated buffer to store Usb report descriptor
55 if successfully returned.
57 @return Status of getting Report Class descriptor through USB
58 I/O protocol's UsbControlTransfer().
63 UsbGetReportDescriptor (
64 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
65 IN UINT8 InterfaceNum
,
66 IN UINT16 DescriptorSize
,
67 OUT UINT8
*DescriptorBuffer
71 Get Hid Protocol Request.
73 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
74 @param Interface Which interface the caller wants to get protocol.
75 @param Protocol Protocol value returned.
77 @return Status of getting Protocol Request through USB I/O
78 protocol's UsbControlTransfer().
83 UsbGetProtocolRequest (
84 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
90 Set Hid Protocol Request.
92 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
93 @param Interface Which interface the caller wants to set protocol.
94 @param Protocol Protocol value the caller wants to set.
96 @return Status of setting Protocol Request through USB I/O
97 protocol's UsbControlTransfer().
102 UsbSetProtocolRequest (
103 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
111 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
112 @param Interface Which interface the caller wants to set.
113 @param ReportId Which report the caller wants to set.
114 @param Duration Idle rate the caller wants to set.
116 @return Status of setting IDLE Request through USB I/O
117 protocol's UsbControlTransfer().
123 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
132 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
133 @param Interface Which interface the caller wants to get.
134 @param ReportId Which report the caller wants to get.
135 @param Duration Idle rate the caller wants to get.
137 @return Status of getting IDLE Request through USB I/O
138 protocol's UsbControlTransfer().
144 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
151 Hid Set Report request.
153 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
154 @param Interface Which interface the caller wants to set.
155 @param ReportId Which report the caller wants to set.
156 @param ReportType Type of report.
157 @param ReportLen Length of report descriptor.
158 @param Report Report Descriptor buffer.
160 @return Status of setting Report Request through USB I/O
161 protocol's UsbControlTransfer().
166 UsbSetReportRequest (
167 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
176 Hid Set Report request.
178 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
179 @param Interface Which interface the caller wants to set.
180 @param ReportId Which report the caller wants to set.
181 @param ReportType Type of report.
182 @param ReportLen Length of report descriptor.
183 @param Report Caller allocated buffer to store Report Descriptor.
185 @return Status of getting Report Request through USB I/O
186 protocol's UsbControlTransfer().
191 UsbGetReportRequest (
192 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
203 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
204 @param Value Device Request Value.
205 @param Index Device Request Index.
206 @param DescriptorLength Descriptor Length.
207 @param Descriptor Descriptor buffer to contain result.
208 @param Status Transfer Status.
210 @retval EFI_INVALID_PARAMETER Parameter is error.
211 @retval EFI_SUCCESS Success.
212 @retval EFI_TIMEOUT Device has no response.
218 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
221 IN UINT16 DescriptorLength
,
222 OUT VOID
*Descriptor
,
229 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
230 @param Value Device Request Value.
231 @param Index Device Request Index.
232 @param DescriptorLength Descriptor Length.
233 @param Descriptor Descriptor buffer to set.
234 @param Status Transfer Status.
236 @retval EFI_INVALID_PARAMETER Parameter is error.
237 @retval EFI_SUCCESS Success.
238 @retval EFI_TIMEOUT Device has no response.
244 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
247 IN UINT16 DescriptorLength
,
253 Usb Get Device Interface.
255 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
256 @param Index Interface index value.
257 @param AltSetting Alternate setting.
258 @param Status Trasnsfer status.
260 @retval EFI_INVALID_PARAMETER Parameter is error.
261 @retval EFI_SUCCESS Success.
262 @retval EFI_TIMEOUT Device has no response.
268 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
270 OUT UINT8
*AltSetting
,
275 Usb Set Device Interface.
277 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
278 @param InterfaceNo Interface Number.
279 @param AltSetting Alternate setting.
280 @param Status Trasnsfer status.
282 @retval EFI_INVALID_PARAMETER Parameter is error.
283 @retval EFI_SUCCESS Success.
284 @retval EFI_TIMEOUT Device has no response.
290 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
291 IN UINT16 InterfaceNo
,
292 IN UINT16 AltSetting
,
297 Usb Get Device Configuration.
299 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
300 @param ConfigValue Config Value.
301 @param Status Transfer Status.
303 @retval EFI_INVALID_PARAMETER Parameter is error.
304 @retval EFI_SUCCESS Success.
305 @retval EFI_TIMEOUT Device has no response.
310 UsbGetConfiguration (
311 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
312 OUT UINT8
*ConfigValue
,
317 Usb Set Device Configuration.
319 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
320 @param Value Configuration Value to set.
321 @param Status Transfer status.
323 @retval EFI_INVALID_PARAMETER Parameter is error.
324 @retval EFI_SUCCESS Success.
325 @retval EFI_TIMEOUT Device has no response.
330 UsbSetConfiguration (
331 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
337 Usb Set Device Feature.
339 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
340 @param Recipient Interface/Device/Endpoint.
341 @param Value Request value.
342 @param Target Request Index.
343 @param Status Transfer status.
345 @retval EFI_INVALID_PARAMETER Parameter is error.
346 @retval EFI_SUCCESS Success.
347 @retval EFI_TIMEOUT Device has no response.
353 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
361 Usb Clear Device Feature.
363 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
364 @param Recipient Interface/Device/Endpoint.
365 @param Value Request value.
366 @param Target Request Index.
367 @param Status Transfer status.
369 @retval EFI_INVALID_PARAMETER Parameter is error.
370 @retval EFI_SUCCESS Success.
371 @retval EFI_TIMEOUT Device has no response.
377 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
385 Usb Get Device Status.
387 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
388 @param Recipient Interface/Device/Endpoint.
389 @param Target Request index.
390 @param DevStatus Device status.
391 @param Status Transfer status.
393 @retval EFI_INVALID_PARAMETER Parameter is error.
394 @retval EFI_SUCCESS Success.
395 @retval EFI_TIMEOUT Device has no response.
401 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
404 OUT UINT16
*DevStatus
,
409 Clear endpoint stall.
411 @param UsbIo A pointer to EFI_USB_IO_PROTOCOL.
412 @param EndpointNo Endpoint Number.
413 @param Status Transfer Status.
415 @retval EFI_NOT_FOUND Can't find the Endpoint.
416 @retval EFI_DEVICE_ERROR Hardware error.
417 @retval EFI_SUCCESS Success.
422 UsbClearEndpointHalt (
423 IN EFI_USB_IO_PROTOCOL
*UsbIo
,