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