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

Go to the source code of this file.

Data Structures

struct  USB_DESC_HEAD
 
struct  USB_ENDPOINT_DESC
 
struct  USB_INTERFACE_SETTING
 
struct  USB_INTERFACE_DESC
 
struct  USB_CONFIG_DESC
 
struct  USB_DEVICE_DESC
 

Macros

#define USB_MAX_INTERFACE_SETTING   256
 
#define USB_REQUEST_TYPE(Dir, Type, Target)    ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))
 

Functions

EFI_STATUS UsbCtrlRequest (IN USB_DEVICE *UsbDev, IN EFI_USB_DATA_DIRECTION Direction, IN UINTN Type, IN UINTN Target, IN UINTN Request, IN UINT16 Value, IN UINT16 Index, IN OUT VOID *Buf, IN UINTN Length)
 
EFI_STATUS UsbGetMaxPacketSize0 (IN USB_DEVICE *UsbDev)
 
VOID UsbFreeDevDesc (IN USB_DEVICE_DESC *DevDesc)
 
EFI_USB_STRING_DESCRIPTORUsbGetOneString (IN USB_DEVICE *UsbDev, IN UINT8 StringIndex, IN UINT16 LangId)
 
EFI_STATUS UsbBuildDescTable (IN USB_DEVICE *UsbDev)
 
EFI_STATUS UsbSetAddress (IN USB_DEVICE *UsbDev, IN UINT8 Address)
 
EFI_STATUS UsbSetConfig (IN USB_DEVICE *UsbDev, IN UINT8 ConfigIndex)
 
EFI_STATUS UsbIoClearFeature (IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINTN Target, IN UINT16 Feature, IN UINT16 Index)
 

Detailed Description

Manage Usb Descriptor List

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

Definition in file UsbDesc.h.

Macro Definition Documentation

◆ USB_MAX_INTERFACE_SETTING

#define USB_MAX_INTERFACE_SETTING   256

Definition at line 13 of file UsbDesc.h.

◆ USB_REQUEST_TYPE

#define USB_REQUEST_TYPE (   Dir,
  Type,
  Target 
)     ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))

Definition at line 20 of file UsbDesc.h.

Function Documentation

◆ UsbBuildDescTable()

EFI_STATUS UsbBuildDescTable ( IN USB_DEVICE UsbDev)

Build the whole array of descriptors. This function must be called after UsbGetMaxPacketSize0 returns the max packet size correctly for endpoint 0.

Parameters
UsbDevThe Usb device.
Return values
EFI_SUCCESSThe descriptor table is build.
EFI_OUT_OF_RESOURCESFailed to allocate resource for the descriptor.

Definition at line 811 of file UsbDesc.c.

◆ UsbCtrlRequest()

EFI_STATUS UsbCtrlRequest ( IN USB_DEVICE UsbDev,
IN EFI_USB_DATA_DIRECTION  Direction,
IN UINTN  Type,
IN UINTN  Target,
IN UINTN  Request,
IN UINT16  Value,
IN UINT16  Index,
IN OUT VOID *  Buf,
IN UINTN  Length 
)

USB standard control transfer support routine. This function is used by USB device. It is possible that the device's interfaces are still waiting to be enumerated.

Parameters
UsbDevThe usb device.
DirectionThe direction of data transfer.
TypeStandard / class specific / vendor specific.
TargetThe receiving target.
RequestWhich request.
ValueThe wValue parameter of the request.
IndexThe wIndex parameter of the request.
BufThe buffer to receive data into / transmit from.
LengthThe length of the buffer.
Return values
EFI_SUCCESSThe control request is executed.
EFI_DEVICE_ERRORFailed to execute the control transfer.

Definition at line 451 of file UsbDesc.c.

◆ UsbFreeDevDesc()

VOID UsbFreeDevDesc ( IN USB_DEVICE_DESC DevDesc)

Free a device descriptor with its configurations.

Parameters
DevDescThe device descriptor.
Returns
None.

Free a device descriptor with its configurations.

Parameters
DevDescThe device descriptor.

Definition at line 101 of file UsbDesc.c.

◆ UsbGetMaxPacketSize0()

EFI_STATUS UsbGetMaxPacketSize0 ( IN USB_DEVICE UsbDev)

Return the max packet size for endpoint zero. This function is the first function called to get descriptors during bus enumeration.

Parameters
UsbDevThe usb device.
Return values
EFI_SUCCESSThe max packet size of endpoint zero is retrieved.
EFI_DEVICE_ERRORFailed to retrieve it.

Definition at line 548 of file UsbDesc.c.

◆ UsbGetOneString()

EFI_USB_STRING_DESCRIPTOR * UsbGetOneString ( IN USB_DEVICE UsbDev,
IN UINT8  Index,
IN UINT16  LangId 
)

Retrieve the indexed string for the language. It requires two steps to get a string, first to get the string's length. Then the string itself.

Parameters
UsbDevThe usb device.
StringIndexThe index of the string to retrieve.
LangIdLanguage ID.
Returns
The created string descriptor or NULL.

Retrieve the indexed string for the language. It requires two steps to get a string, first to get the string's length. Then the string itself.

Parameters
UsbDevThe usb device.
IndexThe index the string to retrieve.
LangIdLanguage ID.
Returns
The created string descriptor or NULL.

Definition at line 633 of file UsbDesc.c.

◆ UsbIoClearFeature()

EFI_STATUS UsbIoClearFeature ( IN EFI_USB_IO_PROTOCOL UsbIo,
IN UINTN  Target,
IN UINT16  Feature,
IN UINT16  Index 
)

Usb UsbIo interface to clear the feature. This is should only be used by HUB which is considered a device driver on top of the UsbIo interface.

Parameters
UsbIoThe UsbIo interface.
TargetThe target of the transfer: endpoint/device.
FeatureThe feature to clear.
IndexThe wIndex parameter.
Return values
EFI_SUCCESSThe device feature is cleared.
OthersFailed to clear the feature.

Definition at line 983 of file UsbDesc.c.

◆ UsbSetAddress()

EFI_STATUS UsbSetAddress ( IN USB_DEVICE UsbDev,
IN UINT8  Address 
)

Set the device's address.

Parameters
UsbDevThe device to set address to.
AddressThe address to set.
Return values
EFI_SUCCESSThe device is set to the address.
OthersFailed to set the device address.

Definition at line 911 of file UsbDesc.c.

◆ UsbSetConfig()

EFI_STATUS UsbSetConfig ( IN USB_DEVICE UsbDev,
IN UINT8  ConfigIndex 
)

Set the device's configuration. This function changes the device's internal state. UsbSelectConfig changes the Usb bus's internal state.

Parameters
UsbDevThe USB device to set configure to.
ConfigIndexThe configure index to set.
Return values
EFI_SUCCESSThe device is configured now.
OthersFailed to set the device configure.

Definition at line 946 of file UsbDesc.c.