+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
-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
-\r
-Module Name:\r
-\r
- usb.h\r
-\r
-Abstract:\r
- Support for USB standard.\r
-\r
-\r
-\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#ifndef _USB_INDUSTRY_H_\r
-#define _USB_INDUSTRY_H_\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 0x2000\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 data recipient type\r
-//\r
-typedef enum {\r
- EfiUsbDevice,\r
- EfiUsbInterface,\r
- EfiUsbEndpoint\r
-} EFI_USB_RECIPIENT;\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
-// Following are definitions not specified by UEFI spec.\r
-// Add new definitions below this line\r
-//\r
-enum {\r
- //\r
- // USB request type\r
- //\r
- USB_REQ_TYPE_STANDARD = (0x00 << 5),\r
- USB_REQ_TYPE_CLASS = (0x01 << 5),\r
- USB_REQ_TYPE_VENDOR = (0x02 << 5),\r
-\r
- //\r
- // Standard control transfer request type, or the value \r
- // to fill in EFI_USB_DEVICE_REQUEST.Request\r
- //\r
- USB_REQ_GET_STATUS = 0x00,\r
- USB_REQ_CLEAR_FEATURE = 0x01,\r
- USB_REQ_SET_FEATURE = 0x03,\r
- USB_REQ_SET_ADDRESS = 0x05,\r
- USB_REQ_GET_DESCRIPTOR = 0x06,\r
- USB_REQ_SET_DESCRIPTOR = 0x07,\r
- USB_REQ_GET_CONFIG = 0x08,\r
- USB_REQ_SET_CONFIG = 0x09,\r
- USB_REQ_GET_INTERFACE = 0x0A,\r
- USB_REQ_SET_INTERFACE = 0x0B,\r
- USB_REQ_SYNCH_FRAME = 0x0C,\r
-\r
- //\r
- // Usb control transfer target \r
- //\r
- USB_TARGET_DEVICE = 0,\r
- USB_TARGET_INTERFACE = 0x01,\r
- USB_TARGET_ENDPOINT = 0x02,\r
- USB_TARGET_OTHER = 0x03,\r
-\r
- //\r
- // USB Descriptor types\r
- //\r
- USB_DESC_TYPE_DEVICE = 0x01,\r
- USB_DESC_TYPE_CONFIG = 0x02,\r
- USB_DESC_TYPE_STRING = 0x03,\r
- USB_DESC_TYPE_INTERFACE = 0x04,\r
- USB_DESC_TYPE_ENDPOINT = 0x05,\r
- USB_DESC_TYPE_HID = 0x21,\r
-\r
- //\r
- // Features to be cleared by CLEAR_FEATURE requests\r
- //\r
- USB_FEATURE_ENDPOINT_HALT = 0,\r
- \r
- //\r
- // USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt\r
- // \r
- USB_ENDPOINT_CONTROL = 0x00,\r
- USB_ENDPOINT_ISO = 0x01,\r
- USB_ENDPOINT_BULK = 0x02,\r
- USB_ENDPOINT_INTERRUPT = 0x03,\r
-\r
- USB_ENDPOINT_TYPE_MASK = 0x03,\r
- USB_ENDPOINT_DIR_IN = 0x80,\r
-\r
- MAXBYTES = 8,\r
- \r
- //\r
- //Use 200 ms to increase the error handling response time\r
- //\r
- EFI_USB_INTERRUPT_DELAY = 2000000\r
-};\r
-\r
-\r
-//\r
-// USB standard descriptors and reqeust \r
-//\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- UINT8 RequestType;\r
- UINT8 Request;\r
- UINT16 Value;\r
- UINT16 Index;\r
- UINT16 Length;\r
-} EFI_USB_DEVICE_REQUEST;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT16 BcdUSB;\r
- UINT8 DeviceClass;\r
- UINT8 DeviceSubClass;\r
- UINT8 DeviceProtocol;\r
- UINT8 MaxPacketSize0;\r
- UINT16 IdVendor;\r
- UINT16 IdProduct;\r
- UINT16 BcdDevice;\r
- UINT8 StrManufacturer;\r
- UINT8 StrProduct;\r
- UINT8 StrSerialNumber;\r
- UINT8 NumConfigurations;\r
-} EFI_USB_DEVICE_DESCRIPTOR;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT16 TotalLength;\r
- UINT8 NumInterfaces;\r
- UINT8 ConfigurationValue;\r
- UINT8 Configuration;\r
- UINT8 Attributes;\r
- UINT8 MaxPower;\r
-} EFI_USB_CONFIG_DESCRIPTOR;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT8 InterfaceNumber;\r
- UINT8 AlternateSetting;\r
- UINT8 NumEndpoints;\r
- UINT8 InterfaceClass;\r
- UINT8 InterfaceSubClass;\r
- UINT8 InterfaceProtocol;\r
- UINT8 Interface;\r
-} EFI_USB_INTERFACE_DESCRIPTOR;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT8 EndpointAddress;\r
- UINT8 Attributes;\r
- UINT16 MaxPacketSize;\r
- UINT8 Interval;\r
-} EFI_USB_ENDPOINT_DESCRIPTOR;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- CHAR16 String[1];\r
-} EFI_USB_STRING_DESCRIPTOR;\r
-\r
-typedef struct {\r
- UINT16 PortStatus;\r
- UINT16 PortChangeStatus;\r
-} EFI_USB_PORT_STATUS;\r
-\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT8 NbrPorts;\r
- UINT8 HubCharacteristics[2];\r
- UINT8 PwrOn2PwrGood;\r
- UINT8 HubContrCurrent;\r
- UINT8 Filler[MAXBYTES];\r
-} EFI_USB_HUB_DESCRIPTOR;\r
-\r
-#pragma pack()\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-/////////////////// Backward Compatibility ///////////////////\r
-///////////////////////////////////////////////////////////////////////////\r
-\r
-//\r
-// USB Descriptor types\r
-//\r
-#define USB_DT_DEVICE 0x01\r
-#define USB_DT_CONFIG 0x02\r
-#define USB_DT_STRING 0x03\r
-#define USB_DT_INTERFACE 0x04\r
-#define USB_DT_ENDPOINT 0x05\r
-#define USB_DT_HUB 0x29\r
-#define USB_DT_HID 0x21\r
-\r
-//\r
-// USB request type\r
-//\r
-#define USB_TYPE_STANDARD (0x00 << 5)\r
-#define USB_TYPE_CLASS (0x01 << 5)\r
-#define USB_TYPE_VENDOR (0x02 << 5)\r
-#define USB_TYPE_RESERVED (0x03 << 5)\r
-\r
-//\r
-// USB request targer device\r
-//\r
-#define USB_RECIP_DEVICE 0x00\r
-#define USB_RECIP_INTERFACE 0x01\r
-#define USB_RECIP_ENDPOINT 0x02\r
-#define USB_RECIP_OTHER 0x03\r
-\r
-//\r
-// Request target types.\r
-//\r
-#define USB_RT_DEVICE 0x00\r
-#define USB_RT_INTERFACE 0x01\r
-#define USB_RT_ENDPOINT 0x02\r
-#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)\r
-#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)\r
-\r
-typedef enum {\r
- EfiUsbEndpointHalt,\r
- EfiUsbDeviceRemoteWakeup\r
-} EFI_USB_STANDARD_FEATURE_SELECTOR;\r
-\r
-//\r
-// Standard USB request\r
-//\r
-#define USB_DEV_GET_STATUS 0x00\r
-#define USB_DEV_CLEAR_FEATURE 0x01\r
-#define USB_DEV_SET_FEATURE 0x03\r
-#define USB_DEV_SET_ADDRESS 0x05\r
-#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00\r
-#define USB_DEV_GET_DESCRIPTOR 0x06\r
-#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80\r
-#define USB_DEV_SET_DESCRIPTOR 0x07\r
-#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00\r
-#define USB_DEV_GET_CONFIGURATION 0x08\r
-#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80\r
-#define USB_DEV_SET_CONFIGURATION 0x09\r
-#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00\r
-#define USB_DEV_GET_INTERFACE 0x0A\r
-#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81\r
-#define USB_DEV_SET_INTERFACE 0x0B\r
-#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01\r
-#define USB_DEV_SYNCH_FRAME 0x0C\r
-#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82\r
-\r
-#pragma pack(1)\r
-//\r
-// Supported String Languages\r
-//\r
-typedef struct {\r
- UINT8 Length;\r
- UINT8 DescriptorType;\r
- UINT16 SupportedLanID[1];\r
-} EFI_USB_SUPPORTED_LANGUAGES;\r
-\r
-//\r
-// USB alternate setting\r
-//\r
-typedef struct {\r
- EFI_USB_INTERFACE_DESCRIPTOR *Interface;\r
-} USB_ALT_SETTING;\r
-\r
-#pragma pack()\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-///////////////////////////////////////////////////////////////////////////\r
-///////////////////////////////////////////////////////////////////////////\r
-\r
-#endif\r