3 Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 Support for USB standard.
26 #ifndef _USB_INDUSTRY_H_
27 #define _USB_INDUSTRY_H_
30 // USB Transfer Results
32 #define EFI_USB_NOERROR 0x00
33 #define EFI_USB_ERR_NOTEXECUTE 0x01
34 #define EFI_USB_ERR_STALL 0x02
35 #define EFI_USB_ERR_BUFFER 0x04
36 #define EFI_USB_ERR_BABBLE 0x08
37 #define EFI_USB_ERR_NAK 0x10
38 #define EFI_USB_ERR_CRC 0x20
39 #define EFI_USB_ERR_TIMEOUT 0x40
40 #define EFI_USB_ERR_BITSTUFF 0x80
41 #define EFI_USB_ERR_SYSTEM 0x100
44 // Constant value for Port Status & Port Change Status
46 #define USB_PORT_STAT_CONNECTION 0x0001
47 #define USB_PORT_STAT_ENABLE 0x0002
48 #define USB_PORT_STAT_SUSPEND 0x0004
49 #define USB_PORT_STAT_OVERCURRENT 0x0008
50 #define USB_PORT_STAT_RESET 0x0010
51 #define USB_PORT_STAT_POWER 0x0100
52 #define USB_PORT_STAT_LOW_SPEED 0x0200
53 #define USB_PORT_STAT_HIGH_SPEED 0x0400
54 #define USB_PORT_STAT_OWNER 0x0800
56 #define USB_PORT_STAT_C_CONNECTION 0x0001
57 #define USB_PORT_STAT_C_ENABLE 0x0002
58 #define USB_PORT_STAT_C_SUSPEND 0x0004
59 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
60 #define USB_PORT_STAT_C_RESET 0x0010
63 // Usb data transfer direction
69 } EFI_USB_DATA_DIRECTION
;
72 // Usb data recipient type
85 EfiUsbPortSuspend
= 2,
89 EfiUsbPortConnectChange
= 16,
90 EfiUsbPortEnableChange
= 17,
91 EfiUsbPortSuspendChange
= 18,
92 EfiUsbPortOverCurrentChange
= 19,
93 EfiUsbPortResetChange
= 20
94 } EFI_USB_PORT_FEATURE
;
97 // Following are definitions not specified by UEFI spec.
98 // Add new definitions below this line
104 USB_REQ_TYPE_STANDARD
= (0x00 << 5),
105 USB_REQ_TYPE_CLASS
= (0x01 << 5),
106 USB_REQ_TYPE_VENDOR
= (0x02 << 5),
109 // Standard control transfer request type, or the value
110 // to fill in EFI_USB_DEVICE_REQUEST.Request
112 USB_REQ_GET_STATUS
= 0x00,
113 USB_REQ_CLEAR_FEATURE
= 0x01,
114 USB_REQ_SET_FEATURE
= 0x03,
115 USB_REQ_SET_ADDRESS
= 0x05,
116 USB_REQ_GET_DESCRIPTOR
= 0x06,
117 USB_REQ_SET_DESCRIPTOR
= 0x07,
118 USB_REQ_GET_CONFIG
= 0x08,
119 USB_REQ_SET_CONFIG
= 0x09,
120 USB_REQ_GET_INTERFACE
= 0x0A,
121 USB_REQ_SET_INTERFACE
= 0x0B,
122 USB_REQ_SYNCH_FRAME
= 0x0C,
125 // Usb control transfer target
127 USB_TARGET_DEVICE
= 0,
128 USB_TARGET_INTERFACE
= 0x01,
129 USB_TARGET_ENDPOINT
= 0x02,
130 USB_TARGET_OTHER
= 0x03,
133 // USB Descriptor types
135 USB_DESC_TYPE_DEVICE
= 0x01,
136 USB_DESC_TYPE_CONFIG
= 0x02,
137 USB_DESC_TYPE_STRING
= 0x03,
138 USB_DESC_TYPE_INTERFACE
= 0x04,
139 USB_DESC_TYPE_ENDPOINT
= 0x05,
140 USB_DESC_TYPE_HID
= 0x21,
143 // Features to be cleared by CLEAR_FEATURE requests
145 USB_FEATURE_ENDPOINT_HALT
= 0,
148 // USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt
150 USB_ENDPOINT_CONTROL
= 0x00,
151 USB_ENDPOINT_ISO
= 0x01,
152 USB_ENDPOINT_BULK
= 0x02,
153 USB_ENDPOINT_INTERRUPT
= 0x03,
155 USB_ENDPOINT_TYPE_MASK
= 0x03,
156 USB_ENDPOINT_DIR_IN
= 0x80,
161 //Use 200 ms to increase the error handling response time
163 EFI_USB_INTERRUPT_DELAY
= 2000000
168 // USB standard descriptors and reqeust
178 } EFI_USB_DEVICE_REQUEST
;
182 UINT8 DescriptorType
;
185 UINT8 DeviceSubClass
;
186 UINT8 DeviceProtocol
;
187 UINT8 MaxPacketSize0
;
191 UINT8 StrManufacturer
;
193 UINT8 StrSerialNumber
;
194 UINT8 NumConfigurations
;
195 } EFI_USB_DEVICE_DESCRIPTOR
;
199 UINT8 DescriptorType
;
202 UINT8 ConfigurationValue
;
206 } EFI_USB_CONFIG_DESCRIPTOR
;
210 UINT8 DescriptorType
;
211 UINT8 InterfaceNumber
;
212 UINT8 AlternateSetting
;
214 UINT8 InterfaceClass
;
215 UINT8 InterfaceSubClass
;
216 UINT8 InterfaceProtocol
;
218 } EFI_USB_INTERFACE_DESCRIPTOR
;
222 UINT8 DescriptorType
;
223 UINT8 EndpointAddress
;
225 UINT16 MaxPacketSize
;
227 } EFI_USB_ENDPOINT_DESCRIPTOR
;
231 UINT8 DescriptorType
;
233 } EFI_USB_STRING_DESCRIPTOR
;
237 UINT16 PortChangeStatus
;
238 } EFI_USB_PORT_STATUS
;
242 UINT8 DescriptorType
;
244 UINT8 HubCharacteristics
[2];
246 UINT8 HubContrCurrent
;
247 UINT8 Filler
[MAXBYTES
];
248 } EFI_USB_HUB_DESCRIPTOR
;
253 ///////////////////////////////////////////////////////////////////////////
254 /////////////////// Backward Compatibility ///////////////////
255 ///////////////////////////////////////////////////////////////////////////
258 // USB Descriptor types
260 #define USB_DT_DEVICE 0x01
261 #define USB_DT_CONFIG 0x02
262 #define USB_DT_STRING 0x03
263 #define USB_DT_INTERFACE 0x04
264 #define USB_DT_ENDPOINT 0x05
265 #define USB_DT_HUB 0x29
266 #define USB_DT_HID 0x21
271 #define USB_TYPE_STANDARD (0x00 << 5)
272 #define USB_TYPE_CLASS (0x01 << 5)
273 #define USB_TYPE_VENDOR (0x02 << 5)
274 #define USB_TYPE_RESERVED (0x03 << 5)
277 // USB request targer device
279 #define USB_RECIP_DEVICE 0x00
280 #define USB_RECIP_INTERFACE 0x01
281 #define USB_RECIP_ENDPOINT 0x02
282 #define USB_RECIP_OTHER 0x03
285 // Request target types.
287 #define USB_RT_DEVICE 0x00
288 #define USB_RT_INTERFACE 0x01
289 #define USB_RT_ENDPOINT 0x02
290 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
291 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
295 EfiUsbDeviceRemoteWakeup
296 } EFI_USB_STANDARD_FEATURE_SELECTOR
;
299 // Standard USB request
301 #define USB_DEV_GET_STATUS 0x00
302 #define USB_DEV_CLEAR_FEATURE 0x01
303 #define USB_DEV_SET_FEATURE 0x03
304 #define USB_DEV_SET_ADDRESS 0x05
305 #define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
306 #define USB_DEV_GET_DESCRIPTOR 0x06
307 #define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
308 #define USB_DEV_SET_DESCRIPTOR 0x07
309 #define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
310 #define USB_DEV_GET_CONFIGURATION 0x08
311 #define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
312 #define USB_DEV_SET_CONFIGURATION 0x09
313 #define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
314 #define USB_DEV_GET_INTERFACE 0x0A
315 #define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
316 #define USB_DEV_SET_INTERFACE 0x0B
317 #define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
318 #define USB_DEV_SYNCH_FRAME 0x0C
319 #define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
323 // Supported String Languages
327 UINT8 DescriptorType
;
328 UINT16 SupportedLanID
[1];
329 } EFI_USB_SUPPORTED_LANGUAGES
;
332 // USB alternate setting
335 EFI_USB_INTERFACE_DESCRIPTOR
*Interface
;
340 ///////////////////////////////////////////////////////////////////////////
341 ///////////////////////////////////////////////////////////////////////////
342 ///////////////////////////////////////////////////////////////////////////