]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/IndustryStandard/Usb.h
Update Usb.h definitions.
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Usb.h
... / ...
CommitLineData
1/** @file\r
2 Support for USB 1.1 standard.\r
3\r
4 Copyright (c) 2006 - 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __USB_H__\r
16#define __USB_H__\r
17\r
18\r
19//\r
20// Definitions defined in UEFI spec\r
21//\r
22\r
23//\r
24// USB Transfer Results\r
25//\r
26#define EFI_USB_NOERROR 0x00\r
27#define EFI_USB_ERR_NOTEXECUTE 0x01\r
28#define EFI_USB_ERR_STALL 0x02\r
29#define EFI_USB_ERR_BUFFER 0x04\r
30#define EFI_USB_ERR_BABBLE 0x08\r
31#define EFI_USB_ERR_NAK 0x10\r
32#define EFI_USB_ERR_CRC 0x20\r
33#define EFI_USB_ERR_TIMEOUT 0x40\r
34#define EFI_USB_ERR_BITSTUFF 0x80\r
35#define EFI_USB_ERR_SYSTEM 0x100\r
36\r
37//\r
38// Constant value for Port Status & Port Change Status\r
39//\r
40#define USB_PORT_STAT_CONNECTION 0x0001\r
41#define USB_PORT_STAT_ENABLE 0x0002\r
42#define USB_PORT_STAT_SUSPEND 0x0004\r
43#define USB_PORT_STAT_OVERCURRENT 0x0008\r
44#define USB_PORT_STAT_RESET 0x0010\r
45#define USB_PORT_STAT_POWER 0x0100\r
46#define USB_PORT_STAT_LOW_SPEED 0x0200\r
47#define USB_PORT_STAT_HIGH_SPEED 0x0400\r
48#define USB_PORT_STAT_OWNER 0x0800\r
49\r
50#define USB_PORT_STAT_C_CONNECTION 0x0001\r
51#define USB_PORT_STAT_C_ENABLE 0x0002\r
52#define USB_PORT_STAT_C_SUSPEND 0x0004\r
53#define USB_PORT_STAT_C_OVERCURRENT 0x0008\r
54#define USB_PORT_STAT_C_RESET 0x0010\r
55\r
56//\r
57// USB data transfer direction\r
58//\r
59typedef enum {\r
60 EfiUsbDataIn,\r
61 EfiUsbDataOut,\r
62 EfiUsbNoData\r
63} EFI_USB_DATA_DIRECTION;\r
64\r
65//\r
66// Usb port features\r
67//\r
68typedef enum {\r
69 EfiUsbPortEnable = 1,\r
70 EfiUsbPortSuspend = 2,\r
71 EfiUsbPortReset = 4,\r
72 EfiUsbPortPower = 8,\r
73 EfiUsbPortOwner = 13,\r
74 EfiUsbPortConnectChange = 16,\r
75 EfiUsbPortEnableChange = 17,\r
76 EfiUsbPortSuspendChange = 18,\r
77 EfiUsbPortOverCurrentChange = 19,\r
78 EfiUsbPortResetChange = 20\r
79} EFI_USB_PORT_FEATURE;\r
80\r
81\r
82//\r
83// USB standard descriptors and reqeust\r
84//\r
85#pragma pack(1)\r
86typedef struct {\r
87 UINT8 RequestType;\r
88 UINT8 Request;\r
89 UINT16 Value;\r
90 UINT16 Index;\r
91 UINT16 Length;\r
92} EFI_USB_DEVICE_REQUEST;\r
93\r
94typedef struct {\r
95 UINT8 Length;\r
96 UINT8 DescriptorType;\r
97 UINT16 BcdUSB;\r
98 UINT8 DeviceClass;\r
99 UINT8 DeviceSubClass;\r
100 UINT8 DeviceProtocol;\r
101 UINT8 MaxPacketSize0;\r
102 UINT16 IdVendor;\r
103 UINT16 IdProduct;\r
104 UINT16 BcdDevice;\r
105 UINT8 StrManufacturer;\r
106 UINT8 StrProduct;\r
107 UINT8 StrSerialNumber;\r
108 UINT8 NumConfigurations;\r
109} EFI_USB_DEVICE_DESCRIPTOR;\r
110\r
111typedef struct {\r
112 UINT8 Length;\r
113 UINT8 DescriptorType;\r
114 UINT16 TotalLength;\r
115 UINT8 NumInterfaces;\r
116 UINT8 ConfigurationValue;\r
117 UINT8 Configuration;\r
118 UINT8 Attributes;\r
119 UINT8 MaxPower;\r
120} EFI_USB_CONFIG_DESCRIPTOR;\r
121\r
122typedef struct {\r
123 UINT8 Length;\r
124 UINT8 DescriptorType;\r
125 UINT8 InterfaceNumber;\r
126 UINT8 AlternateSetting;\r
127 UINT8 NumEndpoints;\r
128 UINT8 InterfaceClass;\r
129 UINT8 InterfaceSubClass;\r
130 UINT8 InterfaceProtocol;\r
131 UINT8 Interface;\r
132} EFI_USB_INTERFACE_DESCRIPTOR;\r
133\r
134typedef struct {\r
135 UINT8 Length;\r
136 UINT8 DescriptorType;\r
137 UINT8 EndpointAddress;\r
138 UINT8 Attributes;\r
139 UINT16 MaxPacketSize;\r
140 UINT8 Interval;\r
141} EFI_USB_ENDPOINT_DESCRIPTOR;\r
142\r
143typedef struct {\r
144 UINT8 Length;\r
145 UINT8 DescriptorType;\r
146 CHAR16 String[1];\r
147} EFI_USB_STRING_DESCRIPTOR;\r
148\r
149#pragma pack()\r
150\r
151typedef struct {\r
152 UINT16 PortStatus;\r
153 UINT16 PortChangeStatus;\r
154} EFI_USB_PORT_STATUS;\r
155\r
156\r
157//\r
158// Following are definitions not specified by UEFI spec.\r
159// Add new definitions below this line\r
160//\r
161enum {\r
162 //\r
163 // USB request type\r
164 //\r
165 USB_REQ_TYPE_STANDARD = (0x00 << 5),\r
166 USB_REQ_TYPE_CLASS = (0x01 << 5),\r
167 USB_REQ_TYPE_VENDOR = (0x02 << 5),\r
168\r
169 //\r
170 // Standard control transfer request type, or the value\r
171 // to fill in EFI_USB_DEVICE_REQUEST.Request\r
172 //\r
173 USB_REQ_GET_STATUS = 0x00,\r
174 USB_REQ_CLEAR_FEATURE = 0x01,\r
175 USB_REQ_SET_FEATURE = 0x03,\r
176 USB_REQ_SET_ADDRESS = 0x05,\r
177 USB_REQ_GET_DESCRIPTOR = 0x06,\r
178 USB_REQ_SET_DESCRIPTOR = 0x07,\r
179 USB_REQ_GET_CONFIG = 0x08,\r
180 USB_REQ_SET_CONFIG = 0x09,\r
181 USB_REQ_GET_INTERFACE = 0x0A,\r
182 USB_REQ_SET_INTERFACE = 0x0B,\r
183 USB_REQ_SYNCH_FRAME = 0x0C,\r
184\r
185 //\r
186 // Usb control transfer target\r
187 //\r
188 USB_TARGET_DEVICE = 0,\r
189 USB_TARGET_INTERFACE = 0x01,\r
190 USB_TARGET_ENDPOINT = 0x02,\r
191 USB_TARGET_OTHER = 0x03,\r
192\r
193 //\r
194 // USB Descriptor types\r
195 //\r
196 USB_DESC_TYPE_DEVICE = 0x01,\r
197 USB_DESC_TYPE_CONFIG = 0x02,\r
198 USB_DESC_TYPE_STRING = 0x03,\r
199 USB_DESC_TYPE_INTERFACE = 0x04,\r
200 USB_DESC_TYPE_ENDPOINT = 0x05,\r
201 USB_DESC_TYPE_HID = 0x21,\r
202\r
203 //\r
204 // Features to be cleared by CLEAR_FEATURE requests\r
205 //\r
206 USB_FEATURE_ENDPOINT_HALT = 0,\r
207\r
208 //\r
209 // USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt\r
210 //\r
211 USB_ENDPOINT_CONTROL = 0x00,\r
212 USB_ENDPOINT_ISO = 0x01,\r
213 USB_ENDPOINT_BULK = 0x02,\r
214 USB_ENDPOINT_INTERRUPT = 0x03,\r
215\r
216 USB_ENDPOINT_TYPE_MASK = 0x03,\r
217 USB_ENDPOINT_DIR_IN = 0x80,\r
218\r
219 //\r
220 //Use 200 ms to increase the error handling response time\r
221 //\r
222 EFI_USB_INTERRUPT_DELAY = 2000000,\r
223};\r
224#endif\r