TianoCore EDK2 master
|
#include <PiPei.h>
#include <Ppi/UsbHostController.h>
#include <Ppi/Usb2HostController.h>
#include <Ppi/UsbIo.h>
#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/TimerLib.h>
#include <Library/PcdLib.h>
#include <IndustryStandard/Usb.h>
Go to the source code of this file.
Data Structures | |
struct | USB_DESC_HEAD |
struct | PEI_USB_DEVICE |
Macros | |
#define | MAX_INTERFACE 8 |
#define | MAX_ENDPOINT 16 |
#define | PEI_USB_DEVICE_SIGNATURE SIGNATURE_32 ('U', 's', 'b', 'D') |
#define | PEI_USB_DEVICE_FROM_THIS(a) CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE) |
#define | USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit))) |
#define | USB_BUS_1_MILLISECOND 1000 |
#define | USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND) |
#define | USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND) |
#define | USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND) |
#define | USB_WAIT_PORT_STS_CHANGE_STALL (100) |
#define | USB_WAIT_PORT_STS_CHANGE_LOOP 5000 |
#define | USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND) |
#define | USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND) |
#define | USB_GET_CONFIG_DESCRIPTOR_STALL (1 * USB_BUS_1_MILLISECOND) |
Usb Peim definition.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbPeim.h.
#define PEI_USB_DEVICE_FROM_THIS | ( | a | ) | CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE) |
#define PEI_USB_DEVICE_SIGNATURE SIGNATURE_32 ('U', 's', 'b', 'D') |
#define USB_BIT_IS_SET | ( | Data, | |
Bit | |||
) | ((BOOLEAN)(((Data) & (Bit)) == (Bit))) |
#define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND) |
#define USB_GET_CONFIG_DESCRIPTOR_STALL (1 * USB_BUS_1_MILLISECOND) |
#define USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND) |
#define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND) |
#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND) |
#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND) |
EFI_STATUS EFIAPI PeiUsbBulkTransfer | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_IO_PPI * | This, | ||
IN UINT8 | DeviceEndpoint, | ||
IN OUT VOID * | Data, | ||
IN OUT UINTN * | DataLength, | ||
IN UINTN | Timeout | ||
) |
Submits bulk transfer to a bulk endpoint of a USB device.
PeiServices | The pointer of EFI_PEI_SERVICES. |
This | The pointer of PEI_USB_IO_PPI. |
DeviceEndpoint | Endpoint number and its direction in bit 7. |
Data | A pointer to the buffer of data to transmit from or receive into. |
DataLength | The length of the data buffer. |
Timeout | Indicates the maximum time, in millisecond, which the transfer is allowed to complete. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned. |
EFI_SUCCESS | The transfer was completed successfully. |
EFI_OUT_OF_RESOURCES | The transfer failed due to lack of resource. |
EFI_INVALID_PARAMETER | Parameters are invalid. |
EFI_TIMEOUT | The transfer failed due to timeout. |
EFI_DEVICE_ERROR | The transfer failed due to host controller error. |
Definition at line 151 of file UsbIoPeim.c.
EFI_STATUS EFIAPI PeiUsbControlTransfer | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_IO_PPI * | This, | ||
IN EFI_USB_DEVICE_REQUEST * | Request, | ||
IN EFI_USB_DATA_DIRECTION | Direction, | ||
IN UINT32 | Timeout, | ||
IN OUT VOID *Data | OPTIONAL, | ||
IN UINTN DataLength | OPTIONAL | ||
) |
Submits control transfer to a target USB device.
PeiServices | The pointer of EFI_PEI_SERVICES. |
This | The pointer of PEI_USB_IO_PPI. |
Request | USB device request to send. |
Direction | Specifies the data direction for the data stage. |
Timeout | Indicates the maximum timeout, in millisecond. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned. |
Data | Data buffer to be transmitted or received from USB device. |
DataLength | The size (in bytes) of the data buffer. |
EFI_SUCCESS | Transfer was completed successfully. |
EFI_OUT_OF_RESOURCES | The transfer failed due to lack of resources. |
EFI_INVALID_PARAMETER | Some parameters are invalid. |
EFI_TIMEOUT | Transfer failed due to timeout. |
EFI_DEVICE_ERROR | Transfer failed due to host controller or device error. |
Definition at line 35 of file UsbIoPeim.c.
EFI_STATUS EFIAPI PeiUsbGetEndpointDescriptor | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_IO_PPI * | This, | ||
IN UINT8 | EndpointIndex, | ||
OUT EFI_USB_ENDPOINT_DESCRIPTOR ** | EndpointDescriptor | ||
) |
Get the usb endpoint descriptor.
PeiServices | General-purpose services that are available to every PEIM. |
This | Indicates the PEI_USB_IO_PPI instance. |
EndpointIndex | The valid index of the specified endpoint. |
EndpointDescriptor | Request endpoint descriptor. |
EFI_SUCCESS | Usb endpoint descriptor is obtained successfully. |
EFI_NOT_FOUND | Usb endpoint descriptor is NOT found. |
Definition at line 281 of file UsbIoPeim.c.
EFI_STATUS EFIAPI PeiUsbGetInterfaceDescriptor | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_IO_PPI * | This, | ||
OUT EFI_USB_INTERFACE_DESCRIPTOR ** | InterfaceDescriptor | ||
) |
Get the usb interface descriptor.
PeiServices | General-purpose services that are available to every PEIM. |
This | Indicates the PEI_USB_IO_PPI instance. |
InterfaceDescriptor | Request interface descriptor. |
EFI_SUCCESS | Usb interface descriptor is obtained successfully. |
Definition at line 254 of file UsbIoPeim.c.
EFI_STATUS EFIAPI PeiUsbPortReset | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_IO_PPI * | This | ||
) |
Reset the port and re-configure the usb device.
PeiServices | General-purpose services that are available to every PEIM. |
This | Indicates the PEI_USB_IO_PPI instance. |
EFI_SUCCESS | Usb device is reset and configured successfully. |
Others | Other failure occurs. |
Definition at line 322 of file UsbIoPeim.c.
VOID ResetRootPort | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN PEI_USB_HOST_CONTROLLER_PPI * | UsbHcPpi, | ||
IN PEI_USB2_HOST_CONTROLLER_PPI * | Usb2HcPpi, | ||
IN UINT8 | PortNum, | ||
IN UINT8 | RetryIndex | ||
) |
Send reset signal over the given root hub port.
PeiServices | Describes the list of possible PEI Services. |
UsbHcPpi | The pointer of PEI_USB_HOST_CONTROLLER_PPI instance. |
Usb2HcPpi | The pointer of PEI_USB2_HOST_CONTROLLER_PPI instance. |
PortNum | The port to be reset. |
RetryIndex | The retry times. |