2 Common Dxe Libarary for USB
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
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 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 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 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 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 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 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 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 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 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
216 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
219 IN UINT16 DescriptorLength
,
220 OUT VOID
*Descriptor
,
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
234 @retval EFI_INVALID_PARAMETER Parameter is error
235 @retval EFI_SUCCESS Success
236 @retval EFI_TIMEOUT Device has no response
242 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
245 IN UINT16 DescriptorLength
,
251 Usb Get Device Interface
253 @param UsbIo EFI_USB_IO_PROTOCOL
254 @param Index Interface index value
255 @param AltSetting Alternate setting
256 @param Status Trasnsfer status
258 @retval EFI_INVALID_PARAMETER Parameter is error
259 @retval EFI_SUCCESS Success
260 @retval EFI_TIMEOUT Device has no response
266 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
268 OUT UINT8
*AltSetting
,
273 Usb Set Device Interface
275 @param UsbIo EFI_USB_IO_PROTOCOL
276 @param InterfaceNo Interface Number
277 @param AltSetting Alternate setting
278 @param Status Trasnsfer status
280 @retval EFI_INVALID_PARAMETER Parameter is error
281 @retval EFI_SUCCESS Success
282 @retval EFI_TIMEOUT Device has no response
288 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
289 IN UINT16 InterfaceNo
,
290 IN UINT16 AltSetting
,
295 Usb Get Device Configuration
297 @param UsbIo EFI_USB_IO_PROTOCOL
298 @param ConfigValue Config Value
299 @param Status Transfer Status
301 @retval EFI_INVALID_PARAMETER Parameter is error
302 @retval EFI_SUCCESS Success
303 @retval EFI_TIMEOUT Device has no response
308 UsbGetConfiguration (
309 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
310 OUT UINT8
*ConfigValue
,
315 Usb Set Device Configuration
317 @param UsbIo EFI_USB_IO_PROTOCOL
318 @param Value Configuration Value to set
319 @param Status Transfer status
321 @retval EFI_INVALID_PARAMETER Parameter is error
322 @retval EFI_SUCCESS Success
323 @retval EFI_TIMEOUT Device has no response
328 UsbSetConfiguration (
329 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
335 Usb Set Device Feature
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
343 @retval EFI_INVALID_PARAMETER Parameter is error
344 @retval EFI_SUCCESS Success
345 @retval EFI_TIMEOUT Device has no response
351 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
359 Usb Clear Device Feature
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
367 @retval EFI_INVALID_PARAMETER Parameter is error
368 @retval EFI_SUCCESS Success
369 @retval EFI_TIMEOUT Device has no response
375 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
383 Usb Get Device Status
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
391 @retval EFI_INVALID_PARAMETER Parameter is error
392 @retval EFI_SUCCESS Success
393 @retval EFI_TIMEOUT Device has no response
399 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
402 OUT UINT16
*DevStatus
,
409 @param UsbIo EFI_USB_IO_PROTOCOL
410 @param EndpointNo Endpoint Number
411 @param Status Transfer Status
413 @retval EFI_NOT_FOUND Can't find the Endpoint
414 @retval EFI_DEVICE_ERROR Hardware error
415 @retval EFI_SUCCESS Success
420 UsbClearEndpointHalt (
421 IN EFI_USB_IO_PROTOCOL
*UsbIo
,