]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
0f82bd55 | 2 | EFI Usb I/O Protocol as defined in UEFI specification.\r |
9095d37b LG |
3 | This protocol is used by code, typically drivers, running in the EFI\r |
4 | boot services environment to access USB devices like USB keyboards,\r | |
5 | mice and mass storage devices. In particular, functions for managing devices\r | |
0f82bd55 | 6 | on USB buses are defined here.\r |
9095d37b LG |
7 | \r |
8 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
9344f092 | 9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d1f95000 | 10 | \r |
d1f95000 | 11 | **/\r |
12 | \r | |
13 | #ifndef __USB_IO_H__\r | |
14 | #define __USB_IO_H__\r | |
15 | \r | |
16 | #include <IndustryStandard/Usb.h>\r | |
17 | \r | |
18 | //\r | |
19 | // Global ID for the USB I/O Protocol\r | |
20 | //\r | |
21 | #define EFI_USB_IO_PROTOCOL_GUID \\r | |
22 | { \\r | |
23 | 0x2B2F68D6, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \\r | |
24 | }\r | |
25 | \r | |
26 | typedef struct _EFI_USB_IO_PROTOCOL EFI_USB_IO_PROTOCOL;\r | |
27 | \r | |
e3c6b3d9 | 28 | //\r |
29 | // Related Definition for EFI USB I/O protocol\r | |
30 | //\r | |
31 | \r | |
32 | //\r | |
33 | // USB standard descriptors and reqeust\r | |
34 | //\r | |
35 | typedef USB_DEVICE_REQUEST EFI_USB_DEVICE_REQUEST;\r | |
36 | typedef USB_DEVICE_DESCRIPTOR EFI_USB_DEVICE_DESCRIPTOR;\r | |
37 | typedef USB_CONFIG_DESCRIPTOR EFI_USB_CONFIG_DESCRIPTOR;\r | |
38 | typedef USB_INTERFACE_DESCRIPTOR EFI_USB_INTERFACE_DESCRIPTOR;\r | |
39 | typedef USB_ENDPOINT_DESCRIPTOR EFI_USB_ENDPOINT_DESCRIPTOR;\r | |
40 | \r | |
992f22b9 LG |
41 | ///\r |
42 | /// USB data transfer direction\r | |
43 | ///\r | |
e3c6b3d9 | 44 | typedef enum {\r |
45 | EfiUsbDataIn,\r | |
46 | EfiUsbDataOut,\r | |
47 | EfiUsbNoData\r | |
48 | } EFI_USB_DATA_DIRECTION;\r | |
49 | \r | |
50 | //\r | |
51 | // USB Transfer Results\r | |
52 | //\r | |
53 | #define EFI_USB_NOERROR 0x00\r | |
54 | #define EFI_USB_ERR_NOTEXECUTE 0x01\r | |
55 | #define EFI_USB_ERR_STALL 0x02\r | |
56 | #define EFI_USB_ERR_BUFFER 0x04\r | |
57 | #define EFI_USB_ERR_BABBLE 0x08\r | |
58 | #define EFI_USB_ERR_NAK 0x10\r | |
59 | #define EFI_USB_ERR_CRC 0x20\r | |
60 | #define EFI_USB_ERR_TIMEOUT 0x40\r | |
61 | #define EFI_USB_ERR_BITSTUFF 0x80\r | |
62 | #define EFI_USB_ERR_SYSTEM 0x100\r | |
63 | \r | |
64 | /**\r | |
d1f95000 | 65 | Async USB transfer callback routine.\r |
e3c6b3d9 | 66 | \r |
d1f95000 | 67 | @param Data Data received or sent via the USB Asynchronous Transfer, if the\r |
e3c6b3d9 | 68 | transfer completed successfully.\r |
d1f95000 | 69 | @param DataLength The length of Data received or sent via the Asynchronous\r |
e3c6b3d9 | 70 | Transfer, if transfer successfully completes.\r |
d1f95000 | 71 | @param Context Data passed from UsbAsyncInterruptTransfer() request.\r |
72 | @param Status Indicates the result of the asynchronous transfer.\r | |
e3c6b3d9 | 73 | \r |
74 | @retval EFI_SUCCESS The asynchronous USB transfer request has been successfully executed.\r | |
d1f95000 | 75 | @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.\r |
e3c6b3d9 | 76 | \r |
d1f95000 | 77 | **/\r |
78 | typedef\r | |
79 | EFI_STATUS\r | |
8b13229b | 80 | (EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK)(\r |
d1f95000 | 81 | IN VOID *Data,\r |
82 | IN UINTN DataLength,\r | |
83 | IN VOID *Context,\r | |
84 | IN UINT32 Status\r | |
85 | );\r | |
86 | \r | |
87 | //\r | |
88 | // Prototype for EFI USB I/O protocol\r | |
89 | //\r | |
90 | \r | |
91 | \r | |
e3c6b3d9 | 92 | /**\r |
d1f95000 | 93 | This function is used to manage a USB device with a control transfer pipe. A control transfer is\r |
e3c6b3d9 | 94 | typically used to perform device initialization and configuration.\r |
95 | \r | |
96 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 97 | @param Request A pointer to the USB device request that will be sent to the USB\r |
e3c6b3d9 | 98 | device.\r |
d1f95000 | 99 | @param Direction Indicates the data direction.\r |
d1f95000 | 100 | @param Timeout Indicating the transfer should be completed within this time frame.\r |
e3c6b3d9 | 101 | The units are in milliseconds.\r |
8069d49e LG |
102 | @param Data A pointer to the buffer of data that will be transmitted to USB\r |
103 | device or received from USB device.\r | |
d1f95000 | 104 | @param DataLength The size, in bytes, of the data buffer specified by Data.\r |
105 | @param Status A pointer to the result of the USB transfer.\r | |
e3c6b3d9 | 106 | \r |
d1f95000 | 107 | @retval EFI_SUCCESS The control transfer has been successfully executed.\r |
108 | @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r | |
109 | @retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r | |
110 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
111 | @retval EFI_TIMEOUT The control transfer fails due to timeout.\r | |
e3c6b3d9 | 112 | \r |
d1f95000 | 113 | **/\r |
114 | typedef\r | |
115 | EFI_STATUS\r | |
8b13229b | 116 | (EFIAPI *EFI_USB_IO_CONTROL_TRANSFER)(\r |
d1f95000 | 117 | IN EFI_USB_IO_PROTOCOL *This,\r |
118 | IN EFI_USB_DEVICE_REQUEST *Request,\r | |
119 | IN EFI_USB_DATA_DIRECTION Direction,\r | |
120 | IN UINT32 Timeout,\r | |
121 | IN OUT VOID *Data OPTIONAL,\r | |
122 | IN UINTN DataLength OPTIONAL,\r | |
123 | OUT UINT32 *Status\r | |
124 | );\r | |
125 | \r | |
e3c6b3d9 | 126 | /**\r |
d1f95000 | 127 | This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are\r |
128 | typically used to transfer large amounts of data to/from USB devices.\r | |
e3c6b3d9 | 129 | \r |
130 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
9095d37b LG |
131 | @param DeviceEndpoint The destination USB device endpoint to which the\r |
132 | device request is being sent. DeviceEndpoint must\r | |
133 | be between 0x01 and 0x0F or between 0x81 and 0x8F,\r | |
134 | otherwise EFI_INVALID_PARAMETER is returned. If\r | |
135 | the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r | |
136 | is returned. The MSB of this parameter indicates\r | |
137 | the endpoint direction. The number "1" stands for\r | |
3bb398eb | 138 | an IN endpoint, and "0" stands for an OUT endpoint.\r |
d1f95000 | 139 | @param Data A pointer to the buffer of data that will be transmitted to USB\r |
e3c6b3d9 | 140 | device or received from USB device.\r |
d1f95000 | 141 | @param DataLength The size, in bytes, of the data buffer specified by Data.\r |
8377875b | 142 | On input, the size, in bytes, of the data buffer specified by Data.\r |
143 | On output, the number of bytes that were actually transferred.\r | |
d1f95000 | 144 | @param Timeout Indicating the transfer should be completed within this time frame.\r |
9095d37b LG |
145 | The units are in milliseconds. If Timeout is 0, then the\r |
146 | caller must wait for the function to be completed until\r | |
8377875b | 147 | EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r |
d1f95000 | 148 | @param Status This parameter indicates the USB transfer status.\r |
e3c6b3d9 | 149 | \r |
d1f95000 | 150 | @retval EFI_SUCCESS The bulk transfer has been successfully executed.\r |
151 | @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r | |
152 | @retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r | |
153 | @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r | |
154 | @retval EFI_TIMEOUT The control transfer fails due to timeout.\r | |
e3c6b3d9 | 155 | \r |
d1f95000 | 156 | **/\r |
157 | typedef\r | |
158 | EFI_STATUS\r | |
8b13229b | 159 | (EFIAPI *EFI_USB_IO_BULK_TRANSFER)(\r |
d1f95000 | 160 | IN EFI_USB_IO_PROTOCOL *This,\r |
161 | IN UINT8 DeviceEndpoint,\r | |
162 | IN OUT VOID *Data,\r | |
163 | IN OUT UINTN *DataLength,\r | |
164 | IN UINTN Timeout,\r | |
165 | OUT UINT32 *Status\r | |
166 | );\r | |
167 | \r | |
e3c6b3d9 | 168 | /**\r |
169 | This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous\r | |
170 | Interrupt Transfer is typically used to query a device's status at a fixed rate. For example,\r | |
d1f95000 | 171 | keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at\r |
e3c6b3d9 | 172 | a fixed rate.\r |
173 | \r | |
174 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
9095d37b LG |
175 | @param DeviceEndpoint The destination USB device endpoint to which the\r |
176 | device request is being sent. DeviceEndpoint must\r | |
177 | be between 0x01 and 0x0F or between 0x81 and 0x8F,\r | |
178 | otherwise EFI_INVALID_PARAMETER is returned. If\r | |
179 | the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r | |
180 | is returned. The MSB of this parameter indicates\r | |
181 | the endpoint direction. The number "1" stands for\r | |
3bb398eb | 182 | an IN endpoint, and "0" stands for an OUT endpoint.\r |
e3c6b3d9 | 183 | @param IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If\r |
d1f95000 | 184 | FALSE, the interrupt transfer is deleted from the device's interrupt\r |
e3c6b3d9 | 185 | transfer queue.\r |
186 | @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be\r | |
9095d37b LG |
187 | executed.This parameter is required when IsNewTransfer is TRUE. The\r |
188 | value must be between 1 to 255, otherwise EFI_INVALID_PARAMETER is returned.\r | |
8377875b | 189 | The units are in milliseconds.\r |
d1f95000 | 190 | @param DataLength Specifies the length, in bytes, of the data to be received from the\r |
8377875b | 191 | USB device. This parameter is only required when IsNewTransfer is TRUE.\r |
d1f95000 | 192 | @param InterruptCallback The Callback function. This function is called if the asynchronous\r |
9095d37b | 193 | interrupt transfer is completed. This parameter is required\r |
8377875b | 194 | when IsNewTransfer is TRUE.\r |
9095d37b | 195 | @param Context Data passed to the InterruptCallback function. This is an optional\r |
8377875b | 196 | parameter and may be NULL.\r |
e3c6b3d9 | 197 | \r |
d1f95000 | 198 | @retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed.\r |
e3c6b3d9 | 199 | @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.\r |
200 | \r | |
d1f95000 | 201 | **/\r |
202 | typedef\r | |
203 | EFI_STATUS\r | |
8b13229b | 204 | (EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER)(\r |
d1f95000 | 205 | IN EFI_USB_IO_PROTOCOL *This,\r |
206 | IN UINT8 DeviceEndpoint,\r | |
207 | IN BOOLEAN IsNewTransfer,\r | |
208 | IN UINTN PollingInterval OPTIONAL,\r | |
209 | IN UINTN DataLength OPTIONAL,\r | |
210 | IN EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack OPTIONAL,\r | |
211 | IN VOID *Context OPTIONAL\r | |
212 | );\r | |
213 | \r | |
e3c6b3d9 | 214 | /**\r |
d1f95000 | 215 | This function is used to manage a USB device with an interrupt transfer pipe.\r |
e3c6b3d9 | 216 | \r |
217 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
9095d37b LG |
218 | @param DeviceEndpoint The destination USB device endpoint to which the\r |
219 | device request is being sent. DeviceEndpoint must\r | |
220 | be between 0x01 and 0x0F or between 0x81 and 0x8F,\r | |
221 | otherwise EFI_INVALID_PARAMETER is returned. If\r | |
222 | the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r | |
223 | is returned. The MSB of this parameter indicates\r | |
224 | the endpoint direction. The number "1" stands for\r | |
3bb398eb | 225 | an IN endpoint, and "0" stands for an OUT endpoint.\r |
d1f95000 | 226 | @param Data A pointer to the buffer of data that will be transmitted to USB\r |
e3c6b3d9 | 227 | device or received from USB device.\r |
d1f95000 | 228 | @param DataLength On input, then size, in bytes, of the buffer Data. On output, the\r |
e3c6b3d9 | 229 | amount of data actually transferred.\r |
9095d37b LG |
230 | @param Timeout The time out, in seconds, for this transfer. If Timeout is 0,\r |
231 | then the caller must wait for the function to be completed\r | |
232 | until EFI_SUCCESS or EFI_DEVICE_ERROR is returned. If the\r | |
8377875b | 233 | transfer is not completed in this time frame, then EFI_TIMEOUT is returned.\r |
e3c6b3d9 | 234 | @param Status This parameter indicates the USB transfer status.\r |
235 | \r | |
d1f95000 | 236 | @retval EFI_SUCCESS The sync interrupt transfer has been successfully executed.\r |
237 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
e3c6b3d9 | 238 | @retval EFI_DEVICE_ERROR The sync interrupt transfer request failed.\r |
d1f95000 | 239 | @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r |
e3c6b3d9 | 240 | @retval EFI_TIMEOUT The transfer fails due to timeout.\r |
d1f95000 | 241 | **/\r |
242 | typedef\r | |
243 | EFI_STATUS\r | |
8b13229b | 244 | (EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER)(\r |
d1f95000 | 245 | IN EFI_USB_IO_PROTOCOL *This,\r |
246 | IN UINT8 DeviceEndpoint,\r | |
247 | IN OUT VOID *Data,\r | |
248 | IN OUT UINTN *DataLength,\r | |
249 | IN UINTN Timeout,\r | |
250 | OUT UINT32 *Status\r | |
251 | );\r | |
252 | \r | |
e3c6b3d9 | 253 | /**\r |
d1f95000 | 254 | This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r |
255 | transfer is typically used to transfer streaming data.\r | |
e3c6b3d9 | 256 | \r |
257 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
9095d37b LG |
258 | @param DeviceEndpoint The destination USB device endpoint to which the\r |
259 | device request is being sent. DeviceEndpoint must\r | |
260 | be between 0x01 and 0x0F or between 0x81 and 0x8F,\r | |
261 | otherwise EFI_INVALID_PARAMETER is returned. If\r | |
262 | the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r | |
263 | is returned. The MSB of this parameter indicates\r | |
264 | the endpoint direction. The number "1" stands for\r | |
3bb398eb | 265 | an IN endpoint, and "0" stands for an OUT endpoint.\r |
d1f95000 | 266 | @param Data A pointer to the buffer of data that will be transmitted to USB\r |
e3c6b3d9 | 267 | device or received from USB device.\r |
268 | @param DataLength The size, in bytes, of the data buffer specified by Data.\r | |
269 | @param Status This parameter indicates the USB transfer status.\r | |
270 | \r | |
d1f95000 | 271 | @retval EFI_SUCCESS The isochronous transfer has been successfully executed.\r |
272 | @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r | |
273 | @retval EFI_DEVICE_ERROR The transfer failed due to the reason other than timeout, The error status\r | |
e3c6b3d9 | 274 | is returned in Status.\r |
d1f95000 | 275 | @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r |
e3c6b3d9 | 276 | @retval EFI_TIMEOUT The transfer fails due to timeout.\r |
d1f95000 | 277 | **/\r |
278 | typedef\r | |
279 | EFI_STATUS\r | |
8b13229b | 280 | (EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER)(\r |
d1f95000 | 281 | IN EFI_USB_IO_PROTOCOL *This,\r |
282 | IN UINT8 DeviceEndpoint,\r | |
283 | IN OUT VOID *Data,\r | |
284 | IN UINTN DataLength,\r | |
285 | OUT UINT32 *Status\r | |
286 | );\r | |
287 | \r | |
e3c6b3d9 | 288 | /**\r |
d1f95000 | 289 | This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r |
e3c6b3d9 | 290 | transfer is typically used to transfer streaming data.\r |
291 | \r | |
292 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
9095d37b LG |
293 | @param DeviceEndpoint The destination USB device endpoint to which the\r |
294 | device request is being sent. DeviceEndpoint must\r | |
295 | be between 0x01 and 0x0F or between 0x81 and 0x8F,\r | |
296 | otherwise EFI_INVALID_PARAMETER is returned. If\r | |
297 | the endpoint is not a BULK endpoint, EFI_INVALID_PARAMETER\r | |
298 | is returned. The MSB of this parameter indicates\r | |
299 | the endpoint direction. The number "1" stands for\r | |
3bb398eb | 300 | an IN endpoint, and "0" stands for an OUT endpoint.\r |
d1f95000 | 301 | @param Data A pointer to the buffer of data that will be transmitted to USB\r |
e3c6b3d9 | 302 | device or received from USB device.\r |
303 | @param DataLength The size, in bytes, of the data buffer specified by Data.\r | |
8377875b | 304 | This is an optional parameter and may be NULL.\r |
9095d37b | 305 | @param IsochronousCallback The IsochronousCallback() function.This function is\r |
8377875b | 306 | called if the requested isochronous transfer is completed.\r |
0f82bd55 | 307 | @param Context Data passed to the IsochronousCallback() function.\r |
e3c6b3d9 | 308 | \r |
d1f95000 | 309 | @retval EFI_SUCCESS The asynchronous isochronous transfer has been successfully submitted\r |
310 | to the system.\r | |
311 | @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r | |
312 | @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r | |
e3c6b3d9 | 313 | \r |
d1f95000 | 314 | **/\r |
315 | typedef\r | |
316 | EFI_STATUS\r | |
8b13229b | 317 | (EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER)(\r |
d1f95000 | 318 | IN EFI_USB_IO_PROTOCOL *This,\r |
319 | IN UINT8 DeviceEndpoint,\r | |
320 | IN OUT VOID *Data,\r | |
321 | IN UINTN DataLength,\r | |
322 | IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r | |
323 | IN VOID *Context OPTIONAL\r | |
324 | );\r | |
325 | \r | |
e3c6b3d9 | 326 | /**\r |
d1f95000 | 327 | Resets and reconfigures the USB controller. This function will work for all USB devices except\r |
e3c6b3d9 | 328 | USB Hub Controllers.\r |
329 | \r | |
330 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
331 | \r | |
332 | @retval EFI_SUCCESS The USB controller was reset.\r | |
d1f95000 | 333 | @retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub.\r |
334 | @retval EFI_DEVICE_ERROR An error occurred during the reconfiguration process.\r | |
e3c6b3d9 | 335 | \r |
d1f95000 | 336 | **/\r |
337 | typedef\r | |
338 | EFI_STATUS\r | |
8b13229b | 339 | (EFIAPI *EFI_USB_IO_PORT_RESET)(\r |
d1f95000 | 340 | IN EFI_USB_IO_PROTOCOL *This\r |
341 | );\r | |
342 | \r | |
e3c6b3d9 | 343 | /**\r |
d1f95000 | 344 | Retrieves the USB Device Descriptor.\r |
e3c6b3d9 | 345 | \r |
346 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 347 | @param DeviceDescriptor A pointer to the caller allocated USB Device Descriptor.\r |
e3c6b3d9 | 348 | \r |
d1f95000 | 349 | @retval EFI_SUCCESS The device descriptor was retrieved successfully.\r |
350 | @retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL.\r | |
351 | @retval EFI_NOT_FOUND The device descriptor was not found. The device may not be configured.\r | |
e3c6b3d9 | 352 | \r |
d1f95000 | 353 | **/\r |
354 | typedef\r | |
355 | EFI_STATUS\r | |
8b13229b | 356 | (EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR)(\r |
d1f95000 | 357 | IN EFI_USB_IO_PROTOCOL *This,\r |
358 | OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor\r | |
359 | );\r | |
360 | \r | |
e3c6b3d9 | 361 | /**\r |
d1f95000 | 362 | Retrieves the USB Device Descriptor.\r |
e3c6b3d9 | 363 | \r |
364 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 365 | @param ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration\r |
e3c6b3d9 | 366 | Descriptor.\r |
d1f95000 | 367 | @retval EFI_SUCCESS The active configuration descriptor was retrieved successfully.\r |
368 | @retval EFI_INVALID_PARAMETER ConfigurationDescriptor is NULL.\r | |
369 | @retval EFI_NOT_FOUND An active configuration descriptor cannot be found. The device may not\r | |
e3c6b3d9 | 370 | be configured.\r |
371 | \r | |
d1f95000 | 372 | **/\r |
373 | typedef\r | |
374 | EFI_STATUS\r | |
8b13229b | 375 | (EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR)(\r |
d1f95000 | 376 | IN EFI_USB_IO_PROTOCOL *This,\r |
377 | OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor\r | |
378 | );\r | |
379 | \r | |
e3c6b3d9 | 380 | /**\r |
d1f95000 | 381 | Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface\r |
e3c6b3d9 | 382 | within a USB device is equivalently to a USB Controller within the current configuration.\r |
383 | \r | |
384 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 385 | @param InterfaceDescriptor A pointer to the caller allocated USB Interface Descriptor within\r |
e3c6b3d9 | 386 | the configuration setting.\r |
d1f95000 | 387 | @retval EFI_SUCCESS The interface descriptor retrieved successfully.\r |
388 | @retval EFI_INVALID_PARAMETER InterfaceDescriptor is NULL.\r | |
389 | @retval EFI_NOT_FOUND The interface descriptor cannot be found. The device may not be\r | |
e3c6b3d9 | 390 | correctly configured.\r |
391 | \r | |
d1f95000 | 392 | **/\r |
393 | typedef\r | |
394 | EFI_STATUS\r | |
8b13229b | 395 | (EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR)(\r |
d1f95000 | 396 | IN EFI_USB_IO_PROTOCOL *This,\r |
397 | OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor\r | |
398 | );\r | |
399 | \r | |
e3c6b3d9 | 400 | /**\r |
d1f95000 | 401 | Retrieves an Endpoint Descriptor within a USB Controller.\r |
e3c6b3d9 | 402 | \r |
403 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 404 | @param EndpointIndex Indicates which endpoint descriptor to retrieve.\r |
405 | @param EndpointDescriptor A pointer to the caller allocated USB Endpoint Descriptor of\r | |
e3c6b3d9 | 406 | a USB controller.\r |
407 | \r | |
d1f95000 | 408 | @retval EFI_SUCCESS The endpoint descriptor was retrieved successfully.\r |
409 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
410 | @retval EFI_NOT_FOUND The endpoint descriptor cannot be found. The device may not be\r | |
e3c6b3d9 | 411 | correctly configured.\r |
412 | \r | |
d1f95000 | 413 | **/\r |
414 | typedef\r | |
415 | EFI_STATUS\r | |
8b13229b | 416 | (EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR)(\r |
d1f95000 | 417 | IN EFI_USB_IO_PROTOCOL *This,\r |
418 | IN UINT8 EndpointIndex,\r | |
419 | OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor\r | |
420 | );\r | |
421 | \r | |
e3c6b3d9 | 422 | /**\r |
fbf926ad | 423 | Retrieves a string stored in a USB Device.\r |
e3c6b3d9 | 424 | \r |
425 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 426 | @param LangID The Language ID for the string being retrieved.\r |
e3c6b3d9 | 427 | @param StringID The ID of the string being retrieved.\r |
428 | @param String A pointer to a buffer allocated by this function with\r | |
9095d37b LG |
429 | AllocatePool() to store the string.If this function\r |
430 | returns EFI_SUCCESS, it stores the string the caller\r | |
431 | wants to get. The caller should release the string\r | |
8377875b | 432 | buffer with FreePool() after the string is not used any more.\r |
e3c6b3d9 | 433 | \r |
434 | @retval EFI_SUCCESS The string was retrieved successfully.\r | |
435 | @retval EFI_NOT_FOUND The string specified by LangID and StringID was not found.\r | |
d1f95000 | 436 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the return buffer String.\r |
e3c6b3d9 | 437 | \r |
d1f95000 | 438 | **/\r |
439 | typedef\r | |
440 | EFI_STATUS\r | |
8b13229b | 441 | (EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR)(\r |
d1f95000 | 442 | IN EFI_USB_IO_PROTOCOL *This,\r |
443 | IN UINT16 LangID,\r | |
444 | IN UINT8 StringID,\r | |
445 | OUT CHAR16 **String\r | |
446 | );\r | |
447 | \r | |
e3c6b3d9 | 448 | /**\r |
d1f95000 | 449 | Retrieves all the language ID codes that the USB device supports.\r |
e3c6b3d9 | 450 | \r |
451 | @param This A pointer to the EFI_USB_IO_PROTOCOL instance.\r | |
d1f95000 | 452 | @param LangIDTable Language ID for the string the caller wants to get.\r |
9095d37b LG |
453 | This is a 16-bit ID defined by Microsoft. This\r |
454 | buffer pointer is allocated and maintained by\r | |
455 | the USB Bus Driver, the caller should not modify\r | |
8377875b | 456 | its contents.\r |
d1f95000 | 457 | @param TableSize The size, in bytes, of the table LangIDTable.\r |
e3c6b3d9 | 458 | \r |
459 | @retval EFI_SUCCESS The support languages were retrieved successfully.\r | |
460 | \r | |
d1f95000 | 461 | **/\r |
462 | typedef\r | |
463 | EFI_STATUS\r | |
8b13229b | 464 | (EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE)(\r |
d1f95000 | 465 | IN EFI_USB_IO_PROTOCOL *This,\r |
466 | OUT UINT16 **LangIDTable,\r | |
467 | OUT UINT16 *TableSize\r | |
468 | );\r | |
469 | \r | |
44717a39 | 470 | ///\r |
9095d37b LG |
471 | /// The EFI_USB_IO_PROTOCOL provides four basic transfers types described\r |
472 | /// in the USB 1.1 Specification. These include control transfer, interrupt\r | |
473 | /// transfer, bulk transfer and isochronous transfer. The EFI_USB_IO_PROTOCOL\r | |
474 | /// also provides some basic USB device/controller management and configuration\r | |
475 | /// interfaces. A USB device driver uses the services of this protocol to manage USB devices.\r | |
44717a39 | 476 | ///\r |
d1f95000 | 477 | struct _EFI_USB_IO_PROTOCOL {\r |
478 | //\r | |
479 | // IO transfer\r | |
480 | //\r | |
481 | EFI_USB_IO_CONTROL_TRANSFER UsbControlTransfer;\r | |
482 | EFI_USB_IO_BULK_TRANSFER UsbBulkTransfer;\r | |
483 | EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER UsbAsyncInterruptTransfer;\r | |
484 | EFI_USB_IO_SYNC_INTERRUPT_TRANSFER UsbSyncInterruptTransfer;\r | |
485 | EFI_USB_IO_ISOCHRONOUS_TRANSFER UsbIsochronousTransfer;\r | |
486 | EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER UsbAsyncIsochronousTransfer;\r | |
487 | \r | |
488 | //\r | |
489 | // Common device request\r | |
490 | //\r | |
491 | EFI_USB_IO_GET_DEVICE_DESCRIPTOR UsbGetDeviceDescriptor;\r | |
492 | EFI_USB_IO_GET_CONFIG_DESCRIPTOR UsbGetConfigDescriptor;\r | |
493 | EFI_USB_IO_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;\r | |
494 | EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;\r | |
495 | EFI_USB_IO_GET_STRING_DESCRIPTOR UsbGetStringDescriptor;\r | |
496 | EFI_USB_IO_GET_SUPPORTED_LANGUAGE UsbGetSupportedLanguages;\r | |
497 | \r | |
498 | //\r | |
499 | // Reset controller's parent port\r | |
500 | //\r | |
501 | EFI_USB_IO_PORT_RESET UsbPortReset;\r | |
502 | };\r | |
503 | \r | |
504 | extern EFI_GUID gEfiUsbIoProtocolGuid;\r | |
505 | \r | |
506 | #endif\r |