]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/IndustryStandard/Usb.h
MdePkg: add missing #defines for decoding PCIe 2.1 extended capability structures
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Usb.h
index 333bb67e2ee36a696d83ba7ccf004a3d51d4e43c..c4367b58bb8861a6f7f79676961df2f317c59b75 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  Support for USB 1.1 standard.\r
+  Support for USB 2.0 standard.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2008, 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
@@ -17,7 +17,7 @@
 \r
 //\r
 // Standard device request and request type\r
-// By [Spec-USB20/Chapter-9.4]\r
+// USB 2.0 spec, Section 9.4\r
 //\r
 #define USB_DEV_GET_STATUS                  0x00\r
 #define USB_DEV_GET_STATUS_REQ_TYPE_D       0x80 // Receiver : Device\r
 #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
 //\r
 #pragma pack(1)\r
+\r
+///\r
+/// Format of Setup Data for USB Device Requests\r
+/// USB 2.0 spec, Section 9.3\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
+} USB_DEVICE_REQUEST;\r
 \r
+///\r
+/// Standard Device Descriptor\r
+/// USB 2.0 spec, Section 9.6.1\r
+///\r
 typedef struct {\r
   UINT8           Length;\r
   UINT8           DescriptorType;\r
@@ -148,8 +95,12 @@ typedef struct {
   UINT8           StrProduct;\r
   UINT8           StrSerialNumber;\r
   UINT8           NumConfigurations;\r
-} EFI_USB_DEVICE_DESCRIPTOR;\r
+} USB_DEVICE_DESCRIPTOR;\r
 \r
+///\r
+/// Standard Configuration Descriptor\r
+/// USB 2.0 spec, Section 9.6.3\r
+///\r
 typedef struct {\r
   UINT8           Length;\r
   UINT8           DescriptorType;\r
@@ -159,8 +110,12 @@ typedef struct {
   UINT8           Configuration;\r
   UINT8           Attributes;\r
   UINT8           MaxPower;\r
-} EFI_USB_CONFIG_DESCRIPTOR;\r
+} USB_CONFIG_DESCRIPTOR;\r
 \r
+///\r
+/// Standard Interface Descriptor\r
+/// USB 2.0 spec, Section 9.6.5\r
+///\r
 typedef struct {\r
   UINT8           Length;\r
   UINT8           DescriptorType;\r
@@ -171,8 +126,12 @@ typedef struct {
   UINT8           InterfaceSubClass;\r
   UINT8           InterfaceProtocol;\r
   UINT8           Interface;\r
-} EFI_USB_INTERFACE_DESCRIPTOR;\r
+} USB_INTERFACE_DESCRIPTOR;\r
 \r
+///\r
+/// Standard Endpoint Descriptor\r
+/// USB 2.0 spec, Section 9.6.6\r
+///\r
 typedef struct {\r
   UINT8           Length;\r
   UINT8           DescriptorType;\r
@@ -180,8 +139,12 @@ typedef struct {
   UINT8           Attributes;\r
   UINT16          MaxPacketSize;\r
   UINT8           Interval;\r
-} EFI_USB_ENDPOINT_DESCRIPTOR;\r
+} USB_ENDPOINT_DESCRIPTOR;\r
 \r
+///\r
+/// UNICODE String Descriptor\r
+/// USB 2.0 spec, Section 9.6.7\r
+///\r
 typedef struct {\r
   UINT8           Length;\r
   UINT8           DescriptorType;\r
@@ -190,17 +153,8 @@ typedef struct {
 \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
+typedef enum {\r
   //\r
   // USB request type\r
   //\r
@@ -241,6 +195,7 @@ enum {
   USB_DESC_TYPE_INTERFACE = 0x04,\r
   USB_DESC_TYPE_ENDPOINT  = 0x05,\r
   USB_DESC_TYPE_HID       = 0x21,\r
+  USB_DESC_TYPE_REPORT    = 0x22,\r
 \r
   //\r
   // Features to be cleared by CLEAR_FEATURE requests\r
@@ -261,14 +216,26 @@ enum {
   //\r
   //Use 200 ms to increase the error handling response time\r
   //\r
-  EFI_USB_INTERRUPT_DELAY = 2000000,\r
-};\r
+  EFI_USB_INTERRUPT_DELAY = 2000000\r
+} USB_TYPES_DEFINITION;\r
 \r
 \r
 //\r
-// HID constants definition, see HID rev1.0\r
+// HID constants definition, see Device Class Definition\r
+// for Human Interface Devices (HID) rev1.11\r
 //\r
 \r
+//\r
+// HID standard GET_DESCRIPTOR request.\r
+//\r
+#define USB_HID_GET_DESCRIPTOR_REQ_TYPE  0x81\r
+\r
+//\r
+// HID specific requests.\r
+//\r
+#define USB_HID_CLASS_GET_REQ_TYPE       0xa1\r
+#define USB_HID_CLASS_SET_REQ_TYPE       0x21\r
+\r
 //\r
 // HID report item format\r
 //\r
@@ -365,14 +332,20 @@ enum {
 #define EFI_USB_SET_PROTOCOL_REQUEST  0x0b\r
 \r
 #pragma pack(1)\r
-//\r
-// Descriptor header for Report/Physical Descriptors\r
-//\r
+///\r
+/// Descriptor header for Report/Physical Descriptors\r
+/// HID 1.1, section 6.2.1\r
+///\r
 typedef struct hid_class_descriptor {\r
   UINT8   DescriptorType;\r
   UINT16  DescriptorLength;\r
 } EFI_USB_HID_CLASS_DESCRIPTOR;\r
 \r
+///\r
+/// The HID descriptor identifies the length and type\r
+/// of subordinate descriptors for a device.\r
+/// HID 1.1, section 6.2.1\r
+///\r
 typedef struct hid_descriptor {\r
   UINT8                         Length;\r
   UINT8                         DescriptorType;\r