TianoCore EDK2 master
|
#include "UsbBus.h"
Go to the source code of this file.
Manage Usb Descriptor List
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbDesc.c.
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.
UsbDev | The Usb device. |
EFI_SUCCESS | The descriptor table is build. |
EFI_OUT_OF_RESOURCES | Failed to allocate resource for the descriptor. |
EFI_STATUS UsbBuildLangTable | ( | IN USB_DEVICE * | UsbDev | ) |
EFI_STATUS UsbCtrlGetDesc | ( | IN USB_DEVICE * | UsbDev, |
IN UINTN | DescType, | ||
IN UINTN | DescIndex, | ||
IN UINT16 | LangId, | ||
OUT VOID * | Buf, | ||
IN UINTN | Length | ||
) |
Get the standard descriptors.
UsbDev | The USB device to read descriptor from. |
DescType | The type of descriptor to read. |
DescIndex | The index of descriptor to read. |
LangId | Language ID, only used to get string, otherwise set it to 0. |
Buf | The buffer to hold the descriptor read. |
Length | The length of the buffer. |
EFI_SUCCESS | The descriptor is read OK. |
Others | Failed to retrieve the descriptor. |
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.
UsbDev | The usb device. |
Direction | The direction of data transfer. |
Type | Standard / class specific / vendor specific. |
Target | The receiving target. |
Request | Which request. |
Value | The wValue parameter of the request. |
Index | The wIndex parameter of the request. |
Buf | The buffer to receive data into / transmit from. |
Length | The length of the buffer. |
EFI_SUCCESS | The control request is executed. |
EFI_DEVICE_ERROR | Failed to execute the control transfer. |
VOID UsbFreeConfigDesc | ( | IN USB_CONFIG_DESC * | Config | ) |
VOID UsbFreeDevDesc | ( | IN USB_DEVICE_DESC * | DevDesc | ) |
VOID UsbFreeInterfaceDesc | ( | IN USB_INTERFACE_SETTING * | Setting | ) |
EFI_STATUS UsbGetDevDesc | ( | IN USB_DEVICE * | UsbDev | ) |
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.
UsbDev | The usb device. |
EFI_SUCCESS | The max packet size of endpoint zero is retrieved. |
EFI_DEVICE_ERROR | Failed to retrieve it. |
EFI_USB_CONFIG_DESCRIPTOR * UsbGetOneConfig | ( | IN USB_DEVICE * | UsbDev, |
IN UINT8 | Index | ||
) |
Retrieve the indexed configure for the device. USB device returns the configuration together with the interfaces for this configuration. Configuration descriptor is also of variable length.
UsbDev | The Usb interface. |
Index | The index of the configuration. |
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.
UsbDev | The usb device. |
Index | The index the string to retrieve. |
LangId | Language ID. |
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.
UsbIo | The UsbIo interface. |
Target | The target of the transfer: endpoint/device. |
Feature | The feature to clear. |
Index | The wIndex parameter. |
EFI_SUCCESS | The device feature is cleared. |
Others | Failed to clear the feature. |
USB_CONFIG_DESC * UsbParseConfigDesc | ( | IN UINT8 * | DescBuf, |
IN UINTN | Len | ||
) |
EFI_STATUS UsbSetAddress | ( | IN USB_DEVICE * | UsbDev, |
IN UINT8 | Address | ||
) |
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.
UsbDev | The USB device to set configure to. |
ConfigIndex | The configure index to set. |
EFI_SUCCESS | The device is configured now. |
Others | Failed to set the device configure. |