TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbUtility.h File Reference

Go to the source code of this file.

Functions

EFI_STATUS UsbHcGetCapability (IN USB_BUS *UsbBus, OUT UINT8 *MaxSpeed, OUT UINT8 *NumOfPort, OUT UINT8 *Is64BitCapable)
 
EFI_STATUS UsbHcGetRootHubPortStatus (IN USB_BUS *UsbBus, IN UINT8 PortIndex, OUT EFI_USB_PORT_STATUS *PortStatus)
 
EFI_STATUS UsbHcSetRootHubPortFeature (IN USB_BUS *UsbBus, IN UINT8 PortIndex, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbHcClearRootHubPortFeature (IN USB_BUS *UsbBus, IN UINT8 PortIndex, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbHcControlTransfer (IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION Direction, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
 
EFI_STATUS UsbHcBulkTransfer (IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN UINT8 BufferNum, IN OUT VOID *Data[], IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
 
EFI_STATUS UsbHcAsyncInterruptTransfer (IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN BOOLEAN IsNewTransfer, IN OUT UINT8 *DataToggle, IN UINTN PollingInterval, IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context OPTIONAL)
 
EFI_STATUS UsbHcSyncInterruptTransfer (IN USB_BUS *UsbBus, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *UsbResult)
 
EFI_STATUS UsbOpenHostProtoByChild (IN USB_BUS *Bus, IN EFI_HANDLE Child)
 
VOID UsbCloseHostProtoByChild (IN USB_BUS *Bus, IN EFI_HANDLE Child)
 
EFI_TPL UsbGetCurrentTpl (VOID)
 

Detailed Description

Manage Usb Port/Hc/Etc.

Copyright (c) 2007, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbUtility.h.

Function Documentation

◆ UsbCloseHostProtoByChild()

VOID UsbCloseHostProtoByChild ( IN USB_BUS Bus,
IN EFI_HANDLE  Child 
)

Close the USB host controller protocol BY_CHILD.

Parameters
BusThe USB bus driver.
ChildThe child handle.
Returns
None.

Close the USB host controller protocol BY_CHILD.

Parameters
BusThe USB bus driver.
ChildThe child handle.

Definition at line 511 of file UsbUtility.c.

◆ UsbGetCurrentTpl()

EFI_TPL UsbGetCurrentTpl ( VOID  )

return the current TPL, copied from the EDKII glue lib.

Parameters
VOID.
Returns
Current TPL.

Definition at line 542 of file UsbUtility.c.

◆ UsbHcAsyncInterruptTransfer()

EFI_STATUS UsbHcAsyncInterruptTransfer ( IN USB_BUS UsbBus,
IN UINT8  DevAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN BOOLEAN  IsNewTransfer,
IN OUT UINT8 *  DataToggle,
IN UINTN  PollingInterval,
IN UINTN  DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *Context  OPTIONAL 
)

Queue or cancel an asynchronous interrupt transfer.

Parameters
UsbBusThe USB bus driver.
DevAddrThe target device address.
EpAddrThe target endpoint address, with direction encoded in bit 7.
DevSpeedThe device's speed.
MaxPacketThe endpoint's max packet size.
IsNewTransferWhether this is a new request. If not, cancel the old request.
DataToggleData toggle to use on input, next toggle on output.
PollingIntervalThe interval to poll the interrupt transfer (in ms).
DataLengthThe length of periodical data receive.
TranslatorThe transaction translator for low/full speed device.
CallbackFunction to call when data is received.
ContextThe context to the callback.
Return values
EFI_SUCCESSThe asynchronous transfer is queued.
OthersFailed to queue the transfer.

Definition at line 335 of file UsbUtility.c.

◆ UsbHcBulkTransfer()

EFI_STATUS UsbHcBulkTransfer ( IN USB_BUS UsbBus,
IN UINT8  DevAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN UINT8  BufferNum,
IN OUT VOID *  Data[],
IN OUT UINTN DataLength,
IN OUT UINT8 *  DataToggle,
IN UINTN  TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  UsbResult 
)

Execute a bulk transfer to the device's endpoint.

Parameters
UsbBusThe USB bus driver.
DevAddrThe target device address.
EpAddrThe target endpoint address, with direction encoded in bit 7.
DevSpeedThe device's speed.
MaxPacketThe endpoint's max packet size.
BufferNumThe number of data buffer.
DataArray of pointers to data buffer.
DataLengthThe length of data buffer.
DataToggleOn input, the initial data toggle to use, also return the next toggle on output.
TimeOutThe time to wait until timeout.
TranslatorThe transaction translator for low/full speed device.
UsbResultThe result of USB execution.
Return values
EFI_SUCCESSThe bulk transfer is finished without error.
OthersFailed to execute bulk transfer, result in UsbResult.

Definition at line 263 of file UsbUtility.c.

◆ UsbHcClearRootHubPortFeature()

EFI_STATUS UsbHcClearRootHubPortFeature ( IN USB_BUS UsbBus,
IN UINT8  PortIndex,
IN EFI_USB_PORT_FEATURE  Feature 
)

Clear the root hub port feature.

Parameters
UsbBusThe USB bus driver.
PortIndexThe port index.
FeatureThe port feature to clear.
Return values
EFI_SUCCESSThe port feature is clear.
OthersFailed to clear port feature.

Definition at line 153 of file UsbUtility.c.

◆ UsbHcControlTransfer()

EFI_STATUS UsbHcControlTransfer ( IN USB_BUS UsbBus,
IN UINT8  DevAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN EFI_USB_DEVICE_REQUEST Request,
IN EFI_USB_DATA_DIRECTION  Direction,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN UINTN  TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  UsbResult 
)

Execute a control transfer to the device.

Parameters
UsbBusThe USB bus driver.
DevAddrThe device address.
DevSpeedThe device speed.
MaxPacketMaximum packet size of endpoint 0.
RequestThe control transfer request.
DirectionThe direction of data stage.
DataThe buffer holding data.
DataLengthThe length of the data.
TimeOutTimeout (in ms) to wait until timeout.
TranslatorThe transaction translator for low/full speed device.
UsbResultThe result of transfer.
Return values
EFI_SUCCESSThe control transfer finished without error.
OthersThe control transfer failed, reason returned in UsbResult.

Execute a control transfer to the device.

Parameters
UsbBusThe USB bus driver.
DevAddrThe device address.
DevSpeedThe device speed.
MaxPacketMaximum packet size of endpoint 0.
RequestThe control transfer request.
DirectionThe direction of data stage.
DataThe buffer holding data.
DataLengthThe length of the data.
TimeOutTimeout (in ms) to wait until timeout.
TranslatorThe transaction translator for low/full speed device.
UsbResultThe result of transfer.
Return values
EFI_SUCCESSThe control transfer finished without error.
OthersThe control transfer failed, reason returned in UsbReslt.

Definition at line 190 of file UsbUtility.c.

◆ UsbHcGetCapability()

EFI_STATUS UsbHcGetCapability ( IN USB_BUS UsbBus,
OUT UINT8 *  MaxSpeed,
OUT UINT8 *  NumOfPort,
OUT UINT8 *  Is64BitCapable 
)

Get the capability of the host controller.

Parameters
UsbBusThe usb driver.
MaxSpeedThe maximum speed this host controller supports.
NumOfPortThe number of the root hub port.
Is64BitCapableWhether this controller support 64 bit addressing.
Return values
EFI_SUCCESSThe host controller capability is returned.
OthersFailed to retrieve the host controller capability.

Definition at line 57 of file UsbUtility.c.

◆ UsbHcGetRootHubPortStatus()

EFI_STATUS UsbHcGetRootHubPortStatus ( IN USB_BUS UsbBus,
IN UINT8  PortIndex,
OUT EFI_USB_PORT_STATUS PortStatus 
)

Get the root hub port state.

Parameters
UsbBusThe USB bus driver.
PortIndexThe index of port.
PortStatusThe variable to save port state.
Return values
EFI_SUCCESSThe root port state is returned in.
OthersFailed to get the root hub port state.

Definition at line 95 of file UsbUtility.c.

◆ UsbHcSetRootHubPortFeature()

EFI_STATUS UsbHcSetRootHubPortFeature ( IN USB_BUS UsbBus,
IN UINT8  PortIndex,
IN EFI_USB_PORT_FEATURE  Feature 
)

Set the root hub port feature.

Parameters
UsbBusThe USB bus driver.
PortIndexThe port index.
FeatureThe port feature to set.
Return values
EFI_SUCCESSThe port feature is set.
OthersFailed to set port feature.

Definition at line 124 of file UsbUtility.c.

◆ UsbHcSyncInterruptTransfer()

EFI_STATUS UsbHcSyncInterruptTransfer ( IN USB_BUS UsbBus,
IN UINT8  DevAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN OUT UINT8 *  DataToggle,
IN UINTN  TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  UsbResult 
)

Execute a synchronous interrupt transfer to the target endpoint.

Parameters
UsbBusThe USB bus driver.
DevAddrThe target device address.
EpAddrThe target endpoint address, with direction encoded in bit 7.
DevSpeedThe device's speed.
MaxPacketThe endpoint's max packet size.
DataPointer to data buffer.
DataLengthThe length of data buffer.
DataToggleOn input, the initial data toggle to use, also return the next toggle on output.
TimeOutThe time to wait until timeout.
TranslatorThe transaction translator for low/full speed device.
UsbResultThe result of USB execution.
Return values
EFI_SUCCESSThe synchronous interrupt transfer is OK.
OthersFailed to execute the synchronous interrupt transfer.

Definition at line 411 of file UsbUtility.c.

◆ UsbOpenHostProtoByChild()

EFI_STATUS UsbOpenHostProtoByChild ( IN USB_BUS Bus,
IN EFI_HANDLE  Child 
)

Open the USB host controller protocol BY_CHILD.

Parameters
BusThe USB bus driver.
ChildThe child handle.
Returns
The open protocol return.

Definition at line 471 of file UsbUtility.c.