2 Support for USB 1.1 standard.
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 // Definitions defined in UEFI spec
24 // USB Transfer Results
26 #define EFI_USB_NOERROR 0x00
27 #define EFI_USB_ERR_NOTEXECUTE 0x01
28 #define EFI_USB_ERR_STALL 0x02
29 #define EFI_USB_ERR_BUFFER 0x04
30 #define EFI_USB_ERR_BABBLE 0x08
31 #define EFI_USB_ERR_NAK 0x10
32 #define EFI_USB_ERR_CRC 0x20
33 #define EFI_USB_ERR_TIMEOUT 0x40
34 #define EFI_USB_ERR_BITSTUFF 0x80
35 #define EFI_USB_ERR_SYSTEM 0x100
38 // Constant value for Port Status & Port Change Status
40 #define USB_PORT_STAT_CONNECTION 0x0001
41 #define USB_PORT_STAT_ENABLE 0x0002
42 #define USB_PORT_STAT_SUSPEND 0x0004
43 #define USB_PORT_STAT_OVERCURRENT 0x0008
44 #define USB_PORT_STAT_RESET 0x0010
45 #define USB_PORT_STAT_POWER 0x0100
46 #define USB_PORT_STAT_LOW_SPEED 0x0200
47 #define USB_PORT_STAT_HIGH_SPEED 0x0400
48 #define USB_PORT_STAT_OWNER 0x0800
50 #define USB_PORT_STAT_C_CONNECTION 0x0001
51 #define USB_PORT_STAT_C_ENABLE 0x0002
52 #define USB_PORT_STAT_C_SUSPEND 0x0004
53 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
54 #define USB_PORT_STAT_C_RESET 0x0010
57 // USB data transfer direction
63 } EFI_USB_DATA_DIRECTION
;
70 EfiUsbPortSuspend
= 2,
74 EfiUsbPortConnectChange
= 16,
75 EfiUsbPortEnableChange
= 17,
76 EfiUsbPortSuspendChange
= 18,
77 EfiUsbPortOverCurrentChange
= 19,
78 EfiUsbPortResetChange
= 20
79 } EFI_USB_PORT_FEATURE
;
83 // USB standard descriptors and reqeust
92 } EFI_USB_DEVICE_REQUEST
;
100 UINT8 DeviceProtocol
;
101 UINT8 MaxPacketSize0
;
105 UINT8 StrManufacturer
;
107 UINT8 StrSerialNumber
;
108 UINT8 NumConfigurations
;
109 } EFI_USB_DEVICE_DESCRIPTOR
;
113 UINT8 DescriptorType
;
116 UINT8 ConfigurationValue
;
120 } EFI_USB_CONFIG_DESCRIPTOR
;
124 UINT8 DescriptorType
;
125 UINT8 InterfaceNumber
;
126 UINT8 AlternateSetting
;
128 UINT8 InterfaceClass
;
129 UINT8 InterfaceSubClass
;
130 UINT8 InterfaceProtocol
;
132 } EFI_USB_INTERFACE_DESCRIPTOR
;
136 UINT8 DescriptorType
;
137 UINT8 EndpointAddress
;
139 UINT16 MaxPacketSize
;
141 } EFI_USB_ENDPOINT_DESCRIPTOR
;
145 UINT8 DescriptorType
;
147 } EFI_USB_STRING_DESCRIPTOR
;
153 UINT16 PortChangeStatus
;
154 } EFI_USB_PORT_STATUS
;
158 // Following are definitions not specified by UEFI spec.
159 // Add new definitions below this line
165 USB_REQ_TYPE_STANDARD
= (0x00 << 5),
166 USB_REQ_TYPE_CLASS
= (0x01 << 5),
167 USB_REQ_TYPE_VENDOR
= (0x02 << 5),
170 // Standard control transfer request type, or the value
171 // to fill in EFI_USB_DEVICE_REQUEST.Request
173 USB_REQ_GET_STATUS
= 0x00,
174 USB_REQ_CLEAR_FEATURE
= 0x01,
175 USB_REQ_SET_FEATURE
= 0x03,
176 USB_REQ_SET_ADDRESS
= 0x05,
177 USB_REQ_GET_DESCRIPTOR
= 0x06,
178 USB_REQ_SET_DESCRIPTOR
= 0x07,
179 USB_REQ_GET_CONFIG
= 0x08,
180 USB_REQ_SET_CONFIG
= 0x09,
181 USB_REQ_GET_INTERFACE
= 0x0A,
182 USB_REQ_SET_INTERFACE
= 0x0B,
183 USB_REQ_SYNCH_FRAME
= 0x0C,
186 // Usb control transfer target
188 USB_TARGET_DEVICE
= 0,
189 USB_TARGET_INTERFACE
= 0x01,
190 USB_TARGET_ENDPOINT
= 0x02,
191 USB_TARGET_OTHER
= 0x03,
194 // USB Descriptor types
196 USB_DESC_TYPE_DEVICE
= 0x01,
197 USB_DESC_TYPE_CONFIG
= 0x02,
198 USB_DESC_TYPE_STRING
= 0x03,
199 USB_DESC_TYPE_INTERFACE
= 0x04,
200 USB_DESC_TYPE_ENDPOINT
= 0x05,
201 USB_DESC_TYPE_HID
= 0x21,
204 // Features to be cleared by CLEAR_FEATURE requests
206 USB_FEATURE_ENDPOINT_HALT
= 0,
209 // USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt
211 USB_ENDPOINT_CONTROL
= 0x00,
212 USB_ENDPOINT_ISO
= 0x01,
213 USB_ENDPOINT_BULK
= 0x02,
214 USB_ENDPOINT_INTERRUPT
= 0x03,
216 USB_ENDPOINT_TYPE_MASK
= 0x03,
217 USB_ENDPOINT_DIR_IN
= 0x80,
220 //Use 200 ms to increase the error handling response time
222 EFI_USB_INTERRUPT_DELAY
= 2000000,