3 Manage Usb Port/Hc/Etc.
5 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_USB_UTILITY_H_
11 #define _EFI_USB_UTILITY_H_
14 Get the capability of the host controller.
16 @param UsbBus The usb driver.
17 @param MaxSpeed The maximum speed this host controller supports.
18 @param NumOfPort The number of the root hub port.
19 @param Is64BitCapable Whether this controller support 64 bit addressing.
21 @retval EFI_SUCCESS The host controller capability is returned.
22 @retval Others Failed to retrieve the host controller capability.
30 OUT UINT8
*Is64BitCapable
34 Get the root hub port state.
36 @param UsbBus The USB bus driver.
37 @param PortIndex The index of port.
38 @param PortStatus The variable to save port state.
40 @retval EFI_SUCCESS The root port state is returned in.
41 @retval Others Failed to get the root hub port state.
45 UsbHcGetRootHubPortStatus (
48 OUT EFI_USB_PORT_STATUS
*PortStatus
52 Set the root hub port feature.
54 @param UsbBus The USB bus driver.
55 @param PortIndex The port index.
56 @param Feature The port feature to set.
58 @retval EFI_SUCCESS The port feature is set.
59 @retval Others Failed to set port feature.
63 UsbHcSetRootHubPortFeature (
66 IN EFI_USB_PORT_FEATURE Feature
70 Clear the root hub port feature.
72 @param UsbBus The USB bus driver.
73 @param PortIndex The port index.
74 @param Feature The port feature to clear.
76 @retval EFI_SUCCESS The port feature is clear.
77 @retval Others Failed to clear port feature.
81 UsbHcClearRootHubPortFeature (
84 IN EFI_USB_PORT_FEATURE Feature
88 Execute a control transfer to the device.
90 @param UsbBus The USB bus driver.
91 @param DevAddr The device address.
92 @param DevSpeed The device speed.
93 @param MaxPacket Maximum packet size of endpoint 0.
94 @param Request The control transfer request.
95 @param Direction The direction of data stage.
96 @param Data The buffer holding data.
97 @param DataLength The length of the data.
98 @param TimeOut Timeout (in ms) to wait until timeout.
99 @param Translator The transaction translator for low/full speed device.
100 @param UsbResult The result of transfer.
102 @retval EFI_SUCCESS The control transfer finished without error.
103 @retval Others The control transfer failed, reason returned in UsbResult.
107 UsbHcControlTransfer (
112 IN EFI_USB_DEVICE_REQUEST
*Request
,
113 IN EFI_USB_DATA_DIRECTION Direction
,
115 IN OUT UINTN
*DataLength
,
117 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
118 OUT UINT32
*UsbResult
122 Execute a bulk transfer to the device's endpoint.
124 @param UsbBus The USB bus driver.
125 @param DevAddr The target device address.
126 @param EpAddr The target endpoint address, with direction encoded in
128 @param DevSpeed The device's speed.
129 @param MaxPacket The endpoint's max packet size.
130 @param BufferNum The number of data buffer.
131 @param Data Array of pointers to data buffer.
132 @param DataLength The length of data buffer.
133 @param DataToggle On input, the initial data toggle to use, also return
134 the next toggle on output.
135 @param TimeOut The time to wait until timeout.
136 @param Translator The transaction translator for low/full speed device.
137 @param UsbResult The result of USB execution.
139 @retval EFI_SUCCESS The bulk transfer is finished without error.
140 @retval Others Failed to execute bulk transfer, result in UsbResult.
152 IN OUT UINTN
*DataLength
,
153 IN OUT UINT8
*DataToggle
,
155 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
156 OUT UINT32
*UsbResult
160 Queue or cancel an asynchronous interrupt transfer.
162 @param UsbBus The USB bus driver.
163 @param DevAddr The target device address.
164 @param EpAddr The target endpoint address, with direction encoded in
166 @param DevSpeed The device's speed.
167 @param MaxPacket The endpoint's max packet size.
168 @param IsNewTransfer Whether this is a new request. If not, cancel the old
170 @param DataToggle Data toggle to use on input, next toggle on output.
171 @param PollingInterval The interval to poll the interrupt transfer (in ms).
172 @param DataLength The length of periodical data receive.
173 @param Translator The transaction translator for low/full speed device.
174 @param Callback Function to call when data is received.
175 @param Context The context to the callback.
177 @retval EFI_SUCCESS The asynchronous transfer is queued.
178 @retval Others Failed to queue the transfer.
182 UsbHcAsyncInterruptTransfer (
188 IN BOOLEAN IsNewTransfer
,
189 IN OUT UINT8
*DataToggle
,
190 IN UINTN PollingInterval
,
192 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
193 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
194 IN VOID
*Context OPTIONAL
198 Execute a synchronous interrupt transfer to the target endpoint.
200 @param UsbBus The USB bus driver.
201 @param DevAddr The target device address.
202 @param EpAddr The target endpoint address, with direction encoded in
204 @param DevSpeed The device's speed.
205 @param MaxPacket The endpoint's max packet size.
206 @param Data Pointer to data buffer.
207 @param DataLength The length of data buffer.
208 @param DataToggle On input, the initial data toggle to use, also return
209 the next toggle on output.
210 @param TimeOut The time to wait until timeout.
211 @param Translator The transaction translator for low/full speed device.
212 @param UsbResult The result of USB execution.
214 @retval EFI_SUCCESS The synchronous interrupt transfer is OK.
215 @retval Others Failed to execute the synchronous interrupt transfer.
219 UsbHcSyncInterruptTransfer (
226 IN OUT UINTN
*DataLength
,
227 IN OUT UINT8
*DataToggle
,
229 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
230 OUT UINT32
*UsbResult
234 Open the USB host controller protocol BY_CHILD.
236 @param Bus The USB bus driver.
237 @param Child The child handle.
239 @return The open protocol return.
243 UsbOpenHostProtoByChild (
249 Close the USB host controller protocol BY_CHILD.
251 @param Bus The USB bus driver.
252 @param Child The child handle.
258 UsbCloseHostProtoByChild (
264 return the current TPL, copied from the EDKII glue lib.