#define USB_DEV_SYNCH_FRAME 0x0C\r
#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82\r
\r
-//\r
-// Definitions defined in UEFI spec\r
-//\r
-\r
-//\r
-// USB Transfer Results\r
-//\r
-#define EFI_USB_NOERROR 0x00\r
-#define EFI_USB_ERR_NOTEXECUTE 0x01\r
-#define EFI_USB_ERR_STALL 0x02\r
-#define EFI_USB_ERR_BUFFER 0x04\r
-#define EFI_USB_ERR_BABBLE 0x08\r
-#define EFI_USB_ERR_NAK 0x10\r
-#define EFI_USB_ERR_CRC 0x20\r
-#define EFI_USB_ERR_TIMEOUT 0x40\r
-#define EFI_USB_ERR_BITSTUFF 0x80\r
-#define EFI_USB_ERR_SYSTEM 0x100\r
-\r
-//\r
-// Constant value for Port Status & Port Change Status\r
-//\r
-#define USB_PORT_STAT_CONNECTION 0x0001\r
-#define USB_PORT_STAT_ENABLE 0x0002\r
-#define USB_PORT_STAT_SUSPEND 0x0004\r
-#define USB_PORT_STAT_OVERCURRENT 0x0008\r
-#define USB_PORT_STAT_RESET 0x0010\r
-#define USB_PORT_STAT_POWER 0x0100\r
-#define USB_PORT_STAT_LOW_SPEED 0x0200\r
-#define USB_PORT_STAT_HIGH_SPEED 0x0400\r
-#define USB_PORT_STAT_OWNER 0x0800\r
-\r
-#define USB_PORT_STAT_C_CONNECTION 0x0001\r
-#define USB_PORT_STAT_C_ENABLE 0x0002\r
-#define USB_PORT_STAT_C_SUSPEND 0x0004\r
-#define USB_PORT_STAT_C_OVERCURRENT 0x0008\r
-#define USB_PORT_STAT_C_RESET 0x0010\r
-\r
-//\r
-// USB data transfer direction\r
-//\r
-typedef enum {\r
- EfiUsbDataIn,\r
- EfiUsbDataOut,\r
- EfiUsbNoData\r
-} EFI_USB_DATA_DIRECTION;\r
-\r
-//\r
-// Usb port features\r
-//\r
-typedef enum {\r
- EfiUsbPortEnable = 1,\r
- EfiUsbPortSuspend = 2,\r
- EfiUsbPortReset = 4,\r
- EfiUsbPortPower = 8,\r
- EfiUsbPortOwner = 13,\r
- EfiUsbPortConnectChange = 16,\r
- EfiUsbPortEnableChange = 17,\r
- EfiUsbPortSuspendChange = 18,\r
- EfiUsbPortOverCurrentChange = 19,\r
- EfiUsbPortResetChange = 20\r
-} EFI_USB_PORT_FEATURE;\r
-\r
\r
//\r
// USB standard descriptors and reqeust\r
UINT16 Value;\r
UINT16 Index;\r
UINT16 Length;\r
-} EFI_USB_DEVICE_REQUEST;\r
+} USB_DEVICE_REQUEST;\r
\r
typedef struct {\r
UINT8 Length;\r
UINT8 StrProduct;\r
UINT8 StrSerialNumber;\r
UINT8 NumConfigurations;\r
-} EFI_USB_DEVICE_DESCRIPTOR;\r
+} USB_DEVICE_DESCRIPTOR;\r
\r
typedef struct {\r
UINT8 Length;\r
UINT8 Configuration;\r
UINT8 Attributes;\r
UINT8 MaxPower;\r
-} EFI_USB_CONFIG_DESCRIPTOR;\r
+} USB_CONFIG_DESCRIPTOR;\r
\r
typedef struct {\r
UINT8 Length;\r
UINT8 InterfaceSubClass;\r
UINT8 InterfaceProtocol;\r
UINT8 Interface;\r
-} EFI_USB_INTERFACE_DESCRIPTOR;\r
+} USB_INTERFACE_DESCRIPTOR;\r
\r
typedef struct {\r
UINT8 Length;\r
UINT8 Attributes;\r
UINT16 MaxPacketSize;\r
UINT8 Interval;\r
-} EFI_USB_ENDPOINT_DESCRIPTOR;\r
+} USB_ENDPOINT_DESCRIPTOR;\r
\r
typedef struct {\r
UINT8 Length;\r
\r
#pragma pack()\r
\r
-typedef struct {\r
- UINT16 PortStatus;\r
- UINT16 PortChangeStatus;\r
-} EFI_USB_PORT_STATUS;\r
-\r
\r
-//\r
-// Following are definitions not specified by UEFI spec.\r
-// Add new definitions below this line\r
-//\r
enum {\r
//\r
// USB request type\r
/** @file\r
EFI Usb I/O Protocol\r
\r
- Copyright (c) 2006, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
\r
typedef struct _EFI_USB_IO_PROTOCOL EFI_USB_IO_PROTOCOL;\r
\r
-/** \r
+//\r
+// Related Definition for EFI USB I/O protocol\r
+//\r
+\r
+//\r
+// USB standard descriptors and reqeust\r
+//\r
+typedef USB_DEVICE_REQUEST EFI_USB_DEVICE_REQUEST;\r
+typedef USB_DEVICE_DESCRIPTOR EFI_USB_DEVICE_DESCRIPTOR;\r
+typedef USB_CONFIG_DESCRIPTOR EFI_USB_CONFIG_DESCRIPTOR;\r
+typedef USB_INTERFACE_DESCRIPTOR EFI_USB_INTERFACE_DESCRIPTOR;\r
+typedef USB_ENDPOINT_DESCRIPTOR EFI_USB_ENDPOINT_DESCRIPTOR;\r
+\r
+//\r
+// USB data transfer direction\r
+//\r
+typedef enum {\r
+ EfiUsbDataIn,\r
+ EfiUsbDataOut,\r
+ EfiUsbNoData\r
+} EFI_USB_DATA_DIRECTION;\r
+\r
+//\r
+// USB Transfer Results\r
+//\r
+#define EFI_USB_NOERROR 0x00\r
+#define EFI_USB_ERR_NOTEXECUTE 0x01\r
+#define EFI_USB_ERR_STALL 0x02\r
+#define EFI_USB_ERR_BUFFER 0x04\r
+#define EFI_USB_ERR_BABBLE 0x08\r
+#define EFI_USB_ERR_NAK 0x10\r
+#define EFI_USB_ERR_CRC 0x20\r
+#define EFI_USB_ERR_TIMEOUT 0x40\r
+#define EFI_USB_ERR_BITSTUFF 0x80\r
+#define EFI_USB_ERR_SYSTEM 0x100\r
+\r
+/**\r
Async USB transfer callback routine.\r
- \r
+\r
@param Data Data received or sent via the USB Asynchronous Transfer, if the\r
- transfer completed successfully. \r
+ transfer completed successfully.\r
@param DataLength The length of Data received or sent via the Asynchronous\r
- Transfer, if transfer successfully completes. \r
+ Transfer, if transfer successfully completes.\r
@param Context Data passed from UsbAsyncInterruptTransfer() request.\r
@param Status Indicates the result of the asynchronous transfer.\r
- \r
- @retval EFI_SUCCESS The asynchronous USB transfer request has been successfully executed. \r
+\r
+ @retval EFI_SUCCESS The asynchronous USB transfer request has been successfully executed.\r
@retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
//\r
\r
\r
-/** \r
+/**\r
This function is used to manage a USB device with a control transfer pipe. A control transfer is\r
- typically used to perform device initialization and configuration. \r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ typically used to perform device initialization and configuration.\r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param Request A pointer to the USB device request that will be sent to the USB\r
- device. \r
+ device.\r
@param Direction Indicates the data direction.\r
@param Data A pointer to the buffer of data that will be transmitted to USB\r
- device or received from USB device. \r
+ device or received from USB device.\r
@param Timeout Indicating the transfer should be completed within this time frame.\r
- The units are in milliseconds. \r
+ The units are in milliseconds.\r
@param DataLength The size, in bytes, of the data buffer specified by Data.\r
@param Status A pointer to the result of the USB transfer.\r
- \r
+\r
@retval EFI_SUCCESS The control transfer has been successfully executed.\r
@retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r
@retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
@retval EFI_TIMEOUT The control transfer fails due to timeout.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT UINT32 *Status\r
);\r
\r
-/** \r
+/**\r
This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are\r
typically used to transfer large amounts of data to/from USB devices.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
- device. \r
+ device.\r
@param Data A pointer to the buffer of data that will be transmitted to USB\r
- device or received from USB device. \r
+ device or received from USB device.\r
@param DataLength The size, in bytes, of the data buffer specified by Data.\r
@param Timeout Indicating the transfer should be completed within this time frame.\r
- The units are in milliseconds. \r
+ The units are in milliseconds.\r
@param Status This parameter indicates the USB transfer status.\r
- \r
+\r
@retval EFI_SUCCESS The bulk transfer has been successfully executed.\r
@retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r
@retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r
@retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
@retval EFI_TIMEOUT The control transfer fails due to timeout.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT UINT32 *Status\r
);\r
\r
-/** \r
- This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous \r
- Interrupt Transfer is typically used to query a device's status at a fixed rate. For example, \r
+/**\r
+ This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous\r
+ Interrupt Transfer is typically used to query a device's status at a fixed rate. For example,\r
keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at\r
- a fixed rate. \r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ a fixed rate.\r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
- device. \r
- @param IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If \r
+ device.\r
+ @param IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If\r
FALSE, the interrupt transfer is deleted from the device's interrupt\r
- transfer queue. \r
- @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be \r
- executed. \r
+ transfer queue.\r
+ @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be\r
+ executed.\r
@param DataLength Specifies the length, in bytes, of the data to be received from the\r
- USB device. \r
+ USB device.\r
@param Context Data passed to the InterruptCallback function.\r
@param InterruptCallback The Callback function. This function is called if the asynchronous\r
interrupt transfer is completed.\r
- \r
+\r
@retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed.\r
- @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed. \r
- \r
+ @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.\r
+\r
**/\r
typedef\r
EFI_STATUS\r
IN VOID *Context OPTIONAL\r
);\r
\r
-/** \r
+/**\r
This function is used to manage a USB device with an interrupt transfer pipe.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
- device. \r
+ device.\r
@param Data A pointer to the buffer of data that will be transmitted to USB\r
- device or received from USB device. \r
+ device or received from USB device.\r
@param DataLength On input, then size, in bytes, of the buffer Data. On output, the\r
- amount of data actually transferred. \r
+ amount of data actually transferred.\r
@param Timeout The time out, in seconds, for this transfer.\r
- @param Status This parameter indicates the USB transfer status. \r
- \r
+ @param Status This parameter indicates the USB transfer status.\r
+\r
@retval EFI_SUCCESS The sync interrupt transfer has been successfully executed.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
- @retval EFI_DEVICE_ERROR The sync interrupt transfer request failed. \r
+ @retval EFI_DEVICE_ERROR The sync interrupt transfer request failed.\r
@retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
- @retval EFI_TIMEOUT The transfer fails due to timeout. \r
+ @retval EFI_TIMEOUT The transfer fails due to timeout.\r
**/\r
typedef\r
EFI_STATUS\r
OUT UINT32 *Status\r
);\r
\r
-/** \r
+/**\r
This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
transfer is typically used to transfer streaming data.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
- device. \r
+ device.\r
@param Data A pointer to the buffer of data that will be transmitted to USB\r
- device or received from USB device. \r
- @param DataLength The size, in bytes, of the data buffer specified by Data. \r
- @param Status This parameter indicates the USB transfer status. \r
- \r
+ device or received from USB device.\r
+ @param DataLength The size, in bytes, of the data buffer specified by Data.\r
+ @param Status This parameter indicates the USB transfer status.\r
+\r
@retval EFI_SUCCESS The isochronous transfer has been successfully executed.\r
@retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
@retval EFI_DEVICE_ERROR The transfer failed due to the reason other than timeout, The error status\r
- is returned in Status. \r
+ is returned in Status.\r
@retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
- @retval EFI_TIMEOUT The transfer fails due to timeout. \r
+ @retval EFI_TIMEOUT The transfer fails due to timeout.\r
**/\r
typedef\r
EFI_STATUS\r
OUT UINT32 *Status\r
);\r
\r
-/** \r
+/**\r
This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
- transfer is typically used to transfer streaming data. \r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ transfer is typically used to transfer streaming data.\r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
- device. \r
+ device.\r
@param Data A pointer to the buffer of data that will be transmitted to USB\r
- device or received from USB device. \r
- @param DataLength The size, in bytes, of the data buffer specified by Data. \r
+ device or received from USB device.\r
+ @param DataLength The size, in bytes, of the data buffer specified by Data.\r
@param Context Data passed to the IsochronousCallback() function.\r
@param IsochronousCallback The IsochronousCallback() function.\r
- \r
+\r
@retval EFI_SUCCESS The asynchronous isochronous transfer has been successfully submitted\r
to the system.\r
@retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
@retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
IN VOID *Context OPTIONAL\r
);\r
\r
-/** \r
+/**\r
Resets and reconfigures the USB controller. This function will work for all USB devices except\r
- USB Hub Controllers. \r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
- \r
- @retval EFI_SUCCESS The USB controller was reset. \r
+ USB Hub Controllers.\r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The USB controller was reset.\r
@retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub.\r
@retval EFI_DEVICE_ERROR An error occurred during the reconfiguration process.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
IN EFI_USB_IO_PROTOCOL *This\r
);\r
\r
-/** \r
+/**\r
Retrieves the USB Device Descriptor.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param DeviceDescriptor A pointer to the caller allocated USB Device Descriptor.\r
- \r
+\r
@retval EFI_SUCCESS The device descriptor was retrieved successfully.\r
@retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL.\r
@retval EFI_NOT_FOUND The device descriptor was not found. The device may not be configured.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor\r
);\r
\r
-/** \r
+/**\r
Retrieves the USB Device Descriptor.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration\r
- Descriptor. \r
+ Descriptor.\r
@retval EFI_SUCCESS The active configuration descriptor was retrieved successfully.\r
@retval EFI_INVALID_PARAMETER ConfigurationDescriptor is NULL.\r
@retval EFI_NOT_FOUND An active configuration descriptor cannot be found. The device may not\r
- be configured. \r
- \r
+ be configured.\r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor\r
);\r
\r
-/** \r
+/**\r
Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface\r
- within a USB device is equivalently to a USB Controller within the current configuration. \r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ within a USB device is equivalently to a USB Controller within the current configuration.\r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param InterfaceDescriptor A pointer to the caller allocated USB Interface Descriptor within\r
- the configuration setting. \r
+ the configuration setting.\r
@retval EFI_SUCCESS The interface descriptor retrieved successfully.\r
@retval EFI_INVALID_PARAMETER InterfaceDescriptor is NULL.\r
@retval EFI_NOT_FOUND The interface descriptor cannot be found. The device may not be\r
- correctly configured. \r
- \r
+ correctly configured.\r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor\r
);\r
\r
-/** \r
+/**\r
Retrieves an Endpoint Descriptor within a USB Controller.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param EndpointIndex Indicates which endpoint descriptor to retrieve.\r
@param EndpointDescriptor A pointer to the caller allocated USB Endpoint Descriptor of\r
- a USB controller. \r
- \r
+ a USB controller.\r
+\r
@retval EFI_SUCCESS The endpoint descriptor was retrieved successfully.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
@retval EFI_NOT_FOUND The endpoint descriptor cannot be found. The device may not be\r
- correctly configured. \r
- \r
+ correctly configured.\r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor\r
);\r
\r
-/** \r
+/**\r
Retrieves a Unicode string stored in a USB Device.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param LangID The Language ID for the string being retrieved.\r
- @param StringID The ID of the string being retrieved. \r
- @param String A pointer to a buffer allocated by this function with \r
+ @param StringID The ID of the string being retrieved.\r
+ @param String A pointer to a buffer allocated by this function with\r
AllocatePool() to store the string.\r
- \r
- @retval EFI_SUCCESS The string was retrieved successfully. \r
- @retval EFI_NOT_FOUND The string specified by LangID and StringID was not found. \r
+\r
+ @retval EFI_SUCCESS The string was retrieved successfully.\r
+ @retval EFI_NOT_FOUND The string specified by LangID and StringID was not found.\r
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the return buffer String.\r
- \r
+\r
**/\r
typedef\r
EFI_STATUS\r
OUT CHAR16 **String\r
);\r
\r
-/** \r
+/**\r
Retrieves all the language ID codes that the USB device supports.\r
- \r
- @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+\r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r
@param LangIDTable Language ID for the string the caller wants to get.\r
@param TableSize The size, in bytes, of the table LangIDTable.\r
- \r
- @retval EFI_SUCCESS The support languages were retrieved successfully. \r
- \r
+\r
+ @retval EFI_SUCCESS The support languages were retrieved successfully.\r
+\r
**/\r
typedef\r
EFI_STATUS\r