3 Manage Usb Port/Hc/Etc.
5 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
6 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.
16 #ifndef _EFI_USB_UTILITY_H_
17 #define _EFI_USB_UTILITY_H_
20 Get the capability of the host controller.
22 @param UsbBus The usb driver.
23 @param MaxSpeed The maximum speed this host controller supports.
24 @param NumOfPort The number of the root hub port.
25 @param Is64BitCapable Whether this controller support 64 bit addressing.
27 @retval EFI_SUCCESS The host controller capability is returned.
28 @retval Others Failed to retrieve the host controller capability.
36 OUT UINT8
*Is64BitCapable
41 Get the root hub port state.
43 @param UsbBus The USB bus driver.
44 @param PortIndex The index of port.
45 @param PortStatus The variable to save port state.
47 @retval EFI_SUCCESS The root port state is returned in.
48 @retval Others Failed to get the root hub port state.
52 UsbHcGetRootHubPortStatus (
55 OUT EFI_USB_PORT_STATUS
*PortStatus
59 Set the root hub port feature.
61 @param UsbBus The USB bus driver.
62 @param PortIndex The port index.
63 @param Feature The port feature to set.
65 @retval EFI_SUCCESS The port feature is set.
66 @retval Others Failed to set port feature.
70 UsbHcSetRootHubPortFeature (
73 IN EFI_USB_PORT_FEATURE Feature
77 Clear the root hub port feature.
79 @param UsbBus The USB bus driver.
80 @param PortIndex The port index.
81 @param Feature The port feature to clear.
83 @retval EFI_SUCCESS The port feature is clear.
84 @retval Others Failed to clear port feature.
88 UsbHcClearRootHubPortFeature (
91 IN EFI_USB_PORT_FEATURE Feature
95 Execute a control transfer to the device.
97 @param UsbBus The USB bus driver.
98 @param DevAddr The device address.
99 @param DevSpeed The device speed.
100 @param MaxPacket Maximum packet size of endpoint 0.
101 @param Request The control transfer request.
102 @param Direction The direction of data stage.
103 @param Data The buffer holding data.
104 @param DataLength The length of the data.
105 @param TimeOut Timeout (in ms) to wait until timeout.
106 @param Translator The transaction translator for low/full speed device.
107 @param UsbResult The result of transfer.
109 @retval EFI_SUCCESS The control transfer finished without error.
110 @retval Others The control transfer failed, reason returned in UsbReslt.
114 UsbHcControlTransfer (
119 IN EFI_USB_DEVICE_REQUEST
*Request
,
120 IN EFI_USB_DATA_DIRECTION Direction
,
122 IN OUT UINTN
*DataLength
,
124 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
125 OUT UINT32
*UsbResult
129 Execute a bulk transfer to the device's endpoint.
131 @param UsbBus The USB bus driver.
132 @param DevAddr The target device address.
133 @param EpAddr The target endpoint address, with direction encoded in
135 @param DevSpeed The device's speed.
136 @param MaxPacket The endpoint's max packet size.
137 @param BufferNum The number of data buffer.
138 @param Data Array of pointers to data buffer.
139 @param DataLength The length of data buffer.
140 @param DataToggle On input, the initial data toggle to use, also return
141 the next toggle on output.
142 @param TimeOut The time to wait until timeout.
143 @param Translator The transaction translator for low/full speed device.
144 @param UsbResult The result of USB execution.
146 @retval EFI_SUCCESS The bulk transfer is finished without error.
147 @retval Others Failed to execute bulk transfer, result in UsbResult.
158 IN OUT VOID
*Data
[EFI_USB_MAX_BULK_BUFFER_NUM
],
159 IN OUT UINTN
*DataLength
,
160 IN OUT UINT8
*DataToggle
,
162 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
163 OUT UINT32
*UsbResult
167 Queue or cancel an asynchronous interrupt transfer.
169 @param UsbBus The USB bus driver.
170 @param DevAddr The target device address.
171 @param EpAddr The target endpoint address, with direction encoded in
173 @param DevSpeed The device's speed.
174 @param MaxPacket The endpoint's max packet size.
175 @param IsNewTransfer Whether this is a new request. If not, cancel the old
177 @param DataToggle Data toggle to use on input, next toggle on output.
178 @param PollingInterval The interval to poll the interrupt transfer (in ms).
179 @param DataLength The length of periodical data receive.
180 @param Translator The transaction translator for low/full speed device.
181 @param Callback Function to call when data is received.
182 @param Context The context to the callback.
184 @retval EFI_SUCCESS The asynchronous transfer is queued.
185 @retval Others Failed to queue the transfer.
189 UsbHcAsyncInterruptTransfer (
195 IN BOOLEAN IsNewTransfer
,
196 IN OUT UINT8
*DataToggle
,
197 IN UINTN PollingInterval
,
199 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
200 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
201 IN VOID
*Context OPTIONAL
205 Execute a synchronous interrupt transfer to the target endpoint.
207 @param UsbBus The USB bus driver.
208 @param DevAddr The target device address.
209 @param EpAddr The target endpoint address, with direction encoded in
211 @param DevSpeed The device's speed.
212 @param MaxPacket The endpoint's max packet size.
213 @param Data Pointer to data buffer.
214 @param DataLength The length of data buffer.
215 @param DataToggle On input, the initial data toggle to use, also return
216 the next toggle on output.
217 @param TimeOut The time to wait until timeout.
218 @param Translator The transaction translator for low/full speed device.
219 @param UsbResult The result of USB execution.
221 @retval EFI_SUCCESS The synchronous interrupt transfer is OK.
222 @retval Others Failed to execute the synchronous interrupt transfer.
226 UsbHcSyncInterruptTransfer (
233 IN OUT UINTN
*DataLength
,
234 IN OUT UINT8
*DataToggle
,
236 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
237 OUT UINT32
*UsbResult
242 Open the USB host controller protocol BY_CHILD.
244 @param Bus The USB bus driver.
245 @param Child The child handle.
247 @return The open protocol return.
251 UsbOpenHostProtoByChild (
257 Close the USB host controller protocol BY_CHILD.
259 @param Bus The USB bus driver.
260 @param Child The child handle.
266 UsbCloseHostProtoByChild (
272 return the current TPL, copied from the EDKII glue lib.