]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/UsbHostController.h
Import Pal.h and Sal.h.
[mirror_edk2.git] / MdePkg / Include / Protocol / UsbHostController.h
CommitLineData
d1f95000 1/** @file\r
2 EFI_USB_HC_PROTOCOL as defined in EFI 1.10.\r
3\r
4 Copyright (c) 2006, 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 Module Name: UsbHostController.h\r
14\r
15**/\r
16\r
17#ifndef _USB_HOSTCONTROLLER_H_\r
18#define _USB_HOSTCONTROLLER_H_\r
19\r
20#include <Protocol/Usb2HostController.h>\r
21\r
22#define EFI_USB_HC_PROTOCOL_GUID \\r
23 { \\r
24 0xf5089266, 0x1aa0, 0x4953, {0x97, 0xd8, 0x56, 0x2f, 0x8a, 0x73, 0xb5, 0x19 } \\r
25 }\r
26\r
27//\r
28// Forward reference for pure ANSI compatability\r
29//\r
30typedef struct _EFI_USB_HC_PROTOCOL EFI_USB_HC_PROTOCOL;\r
31\r
32//\r
33// Protocol definitions\r
34//\r
35\r
36/** \r
37 Provides software reset for the USB host controller.\r
38 \r
39 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
40 @param Attributes A bit mask of the reset operation to perform.\r
41 \r
42 @retval EFI_SUCCESS The reset operation succeeded.\r
43 @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently supported\r
44 by the host controller hardware. \r
45 @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
46 @retval EFI_DEVICE_ERROR An error was encountered while attempting to perform the reset operation.\r
47 \r
48**/\r
49typedef\r
50EFI_STATUS\r
51(EFIAPI *EFI_USB_HC_PROTOCOL_RESET) (\r
52 IN EFI_USB_HC_PROTOCOL *This,\r
53 IN UINT16 Attributes\r
54 );\r
55\r
56/** \r
57 Retrieves current state of the USB host controller.\r
58 \r
59 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
60 @param State A pointer to the EFI_USB_HC_STATE data structure that\r
61 indicates current state of the USB host controller. \r
62 \r
63 @retval EFI_SUCCESS The state information of the host controller was returned in State.\r
64 @retval EFI_INVALID_PARAMETER State is NULL.\r
65 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the host controller's\r
66 current state. \r
67 \r
68**/\r
69typedef\r
70EFI_STATUS\r
71(EFIAPI *EFI_USB_HC_PROTOCOL_GET_STATE) (\r
72 IN EFI_USB_HC_PROTOCOL *This,\r
73 OUT EFI_USB_HC_STATE *State\r
74 );\r
75\r
76/** \r
77 Sets the USB host controller to a specific state.\r
78 \r
79 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
80 @param State Indicates the state of the host controller that will be set. \r
81 \r
82 @retval EFI_SUCCESS The USB host controller was successfully placed in the state specified by\r
83 State. \r
84 @retval EFI_INVALID_PARAMETER State is NULL.\r
85 @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error. \r
86 \r
87**/\r
88typedef\r
89EFI_STATUS\r
90(EFIAPI *EFI_USB_HC_PROTOCOL_SET_STATE) (\r
91 IN EFI_USB_HC_PROTOCOL *This,\r
92 IN EFI_USB_HC_STATE State\r
93 );\r
94\r
95/** \r
96 Submits control transfer to a target USB device.\r
97 \r
98 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
99 @param DeviceAddress Represents the address of the target device on the USB, which is\r
100 assigned during USB enumeration. \r
101 @param IsSlowDevice Indicates whether the target device is slow device or full-speed\r
102 device. \r
103 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
104 transfer endpoint is capable of sending or receiving. \r
105 @param Request A pointer to the USB device request that will be sent to the USB\r
106 device.\r
107 @param TransferDirection Specifies the data direction for the transfer. \r
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
110 @param DataLength On input, indicates the size, in bytes, of the data buffer specified\r
111 by Data. On output, indicates the amount of data actually \r
112 transferred. \r
113 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer\r
114 is allowed to complete. \r
115 @param TransferResult A pointer to the detailed result information generated by this \r
116 control transfer.\r
117 \r
118 @retval EFI_SUCCESS The control transfer was completed successfully.\r
119 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources. \r
120 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
121 @retval EFI_TIMEOUT The control transfer failed due to timeout.\r
122 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error.\r
123 \r
124**/\r
125typedef\r
126EFI_STATUS\r
127(EFIAPI *EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER) (\r
128 IN EFI_USB_HC_PROTOCOL *This,\r
129 IN UINT8 DeviceAddress,\r
130 IN BOOLEAN IsSlowDevice,\r
131 IN UINT8 MaximumPacketLength,\r
132 IN EFI_USB_DEVICE_REQUEST *Request,\r
133 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
134 IN OUT VOID *Data OPTIONAL,\r
135 IN OUT UINTN *DataLength OPTIONAL,\r
136 IN UINTN TimeOut,\r
137 OUT UINT32 *TransferResult\r
138 );\r
139\r
140/** \r
141 Submits bulk transfer to a bulk endpoint of a USB device.\r
142 \r
143 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
144 @param DeviceAddress Represents the address of the target device on the USB, which is\r
145 assigned during USB enumeration. \r
146 @param EndPointAddress The combination of an endpoint number and an endpoint\r
147 direction of the target USB device. \r
148 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
149 transfer endpoint is capable of sending or receiving. \r
150 @param Data A pointer to the buffer of data that will be transmitted to USB \r
151 device or received from USB device. \r
152 @param DataLength On input, indicates the size, in bytes, of the data buffer specified\r
153 by Data. On output, indicates the amount of data actually \r
154 transferred. \r
155 @param DataToggle A pointer to the data toggle value. \r
156 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer\r
157 is allowed to complete. \r
158 @param TransferResult A pointer to the detailed result information of the bulk transfer.\r
159 \r
160 @retval EFI_SUCCESS The bulk transfer was completed successfully.\r
161 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to a lack of resources. \r
162 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
163 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
164 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.\r
165 \r
166**/\r
167typedef\r
168EFI_STATUS\r
169(EFIAPI *EFI_USB_HC_PROTOCOL_BULK_TRANSFER) (\r
170 IN EFI_USB_HC_PROTOCOL *This,\r
171 IN UINT8 DeviceAddress,\r
172 IN UINT8 EndPointAddress,\r
173 IN UINT8 MaximumPacketLength,\r
174 IN OUT VOID *Data,\r
175 IN OUT UINTN *DataLength,\r
176 IN OUT UINT8 *DataToggle,\r
177 IN UINTN TimeOut,\r
178 OUT UINT32 *TransferResult\r
179 );\r
180\r
181/** \r
182 Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
183 \r
184 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
185 @param DeviceAddress Represents the address of the target device on the USB, which is\r
186 assigned during USB enumeration. \r
187 @param EndPointAddress The combination of an endpoint number and an endpoint\r
188 direction of the target USB device. \r
189 @param IsSlowDevice Indicates whether the target device is slow device or full-speed\r
190 device. \r
191 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
192 transfer endpoint is capable of sending or receiving. \r
193 @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host \r
194 and the target interrupt endpoint. If FALSE, the specified \r
195 @param DataToggle A pointer to the data toggle value. \r
196 @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous\r
197 interrupt transfer is polled. asynchronous interrupt pipe is canceled. \r
198 @param DataLength Indicates the length of data to be received at the rate specified by\r
199 PollingInterval from the target asynchronous interrupt \r
200 endpoint. \r
201 @param CallBackFunction The Callback function. \r
202 @param Context The context that is passed to the CallBackFunction.\r
203 \r
204 @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully\r
205 submitted or canceled. \r
206 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. \r
207 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
208 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
209 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.\r
210 \r
211**/\r
212typedef\r
213EFI_STATUS\r
214(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) (\r
215 IN EFI_USB_HC_PROTOCOL *This,\r
216 IN UINT8 DeviceAddress,\r
217 IN UINT8 EndPointAddress,\r
218 IN BOOLEAN IsSlowDevice,\r
219 IN UINT8 MaxiumPacketLength,\r
220 IN BOOLEAN IsNewTransfer,\r
221 IN OUT UINT8 *DataToggle,\r
222 IN UINTN PollingInterval OPTIONAL,\r
223 IN UINTN DataLength OPTIONAL,\r
224 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL,\r
225 IN VOID *Context OPTIONAL\r
226 );\r
227\r
228/** \r
229 Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.\r
230 \r
231 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
232 @param DeviceAddress Represents the address of the target device on the USB, which is\r
233 assigned during USB enumeration. \r
234 @param EndPointAddress The combination of an endpoint number and an endpoint\r
235 direction of the target USB device. \r
236 @param IsSlowDevice Indicates whether the target device is slow device or full-speed\r
237 device. \r
238 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
239 transfer endpoint is capable of sending or receiving. \r
240 @param Data A pointer to the buffer of data that will be transmitted to USB\r
241 device or received from USB device. asynchronous interrupt pipe is canceled. \r
242 @param DataLength On input, the size, in bytes, of the data buffer specified by Data.\r
243 On output, the number of bytes transferred. \r
244 @param DataToggle A pointer to the data toggle value. \r
245 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer \r
246 is allowed to complete. \r
247 @param TransferResult A pointer to the detailed result information from the synchronous\r
248 interrupt transfer.\r
249 \r
250 @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully.\r
251 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. \r
252 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
253 @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout.\r
254 @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error.\r
255 \r
256**/\r
257typedef\r
258EFI_STATUS\r
259(EFIAPI *EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (\r
260 IN EFI_USB_HC_PROTOCOL *This,\r
261 IN UINT8 DeviceAddress,\r
262 IN UINT8 EndPointAddress,\r
263 IN BOOLEAN IsSlowDevice,\r
264 IN UINT8 MaximumPacketLength,\r
265 IN OUT VOID *Data,\r
266 IN OUT UINTN *DataLength,\r
267 IN OUT UINT8 *DataToggle,\r
268 IN UINTN TimeOut,\r
269 OUT UINT32 *TransferResult\r
270 );\r
271\r
272/** \r
273 Submits isochronous transfer to an isochronous endpoint of a USB device.\r
274 \r
275 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
276 @param DeviceAddress Represents the address of the target device on the USB, which is\r
277 assigned during USB enumeration. \r
278 @param EndPointAddress The combination of an endpoint number and an endpoint\r
279 direction of the target USB device. \r
280 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
281 transfer endpoint is capable of sending or receiving. \r
282 @param Data A pointer to the buffer of data that will be transmitted to USB\r
283 device or received from USB device. asynchronous interrupt pipe is canceled. \r
284 @param DataLength Specifies the length, in bytes, of the data to be sent to or received\r
285 from the USB device. \r
286 @param TransferResult A pointer to the detailed result information from the isochronous\r
287 transfer.\r
288 \r
289 @retval EFI_SUCCESS The isochronous transfer was completed successfully.\r
290 @retval EFI_OUT_OF_RESOURCES The isochronous could not be completed due to a lack of resources. \r
291 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
292 @retval EFI_TIMEOUT The isochronous transfer failed due to timeout.\r
293 @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error.\r
294 \r
295**/\r
296typedef\r
297EFI_STATUS\r
298(EFIAPI *EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) (\r
299 IN EFI_USB_HC_PROTOCOL *This,\r
300 IN UINT8 DeviceAddress,\r
301 IN UINT8 EndPointAddress,\r
302 IN UINT8 MaximumPacketLength,\r
303 IN OUT VOID *Data,\r
304 IN UINTN DataLength,\r
305 OUT UINT32 *TransferResult\r
306 );\r
307\r
308/** \r
309 Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.\r
310 \r
311 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
312 @param DeviceAddress Represents the address of the target device on the USB, which is\r
313 assigned during USB enumeration. \r
314 @param EndPointAddress The combination of an endpoint number and an endpoint\r
315 direction of the target USB device. \r
316 @param MaximumPacketLength Indicates the maximum packet size that the default control \r
317 transfer endpoint is capable of sending or receiving. \r
318 @param Data A pointer to the buffer of data that will be transmitted to USB\r
319 device or received from USB device. asynchronous interrupt pipe is canceled. \r
320 @param DataLength Specifies the length, in bytes, of the data to be sent to or received\r
321 from the USB device. \r
322 @param IsochronousCallback The Callback function.\r
323 @param Context Data passed to the IsochronousCallback function. This is\r
324 an optional parameter and may be NULL.\r
325 \r
326 @retval EFI_SUCCESS The asynchronous isochronous transfer was completed successfully.\r
327 @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous could not be completed due to a lack of resources. \r
328 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
329 \r
330**/\r
331typedef\r
332EFI_STATUS\r
333(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) (\r
334 IN EFI_USB_HC_PROTOCOL *This,\r
335 IN UINT8 DeviceAddress,\r
336 IN UINT8 EndPointAddress,\r
337 IN UINT8 MaximumPacketLength,\r
338 IN OUT VOID *Data,\r
339 IN UINTN DataLength,\r
340 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
341 IN VOID *Context OPTIONAL\r
342 );\r
343\r
344/** \r
345 Retrieves the number of root hub ports.\r
346 \r
347 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
348 @param PortNumber A pointer to the number of the root hub ports. \r
349 \r
350 @retval EFI_SUCCESS The port number was retrieved successfully.\r
351 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the port number.\r
352 @retval EFI_INVALID_PARAMETER PortNumber is NULL.\r
353 \r
354**/\r
355typedef\r
356EFI_STATUS\r
357(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER) (\r
358 IN EFI_USB_HC_PROTOCOL *This,\r
359 OUT UINT8 *PortNumber\r
360 );\r
361\r
362/** \r
363 Retrieves the current status of a USB root hub port.\r
364 \r
365 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
366 @param PortNumber Specifies the root hub port from which the status is to be retrieved.\r
367 This value is zero based.\r
368 @param PortStatus A pointer to the current port status bits and port status change bits. \r
369 \r
370 @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber\r
371 was returned in PortStatus. \r
372 @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
373 \r
374**/\r
375typedef\r
376EFI_STATUS\r
377(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) (\r
378 IN EFI_USB_HC_PROTOCOL *This,\r
379 IN UINT8 PortNumber,\r
380 OUT EFI_USB_PORT_STATUS *PortStatus\r
381 );\r
382\r
383/** \r
384 Sets a feature for the specified root hub port.\r
385 \r
386 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
387 @param PortNumber Specifies the root hub port from which the status is to be retrieved.\r
388 This value is zero based.\r
389 @param PortFeature Indicates the feature selector associated with the feature set\r
390 request.\r
391 \r
392 @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB\r
393 root hub port specified by PortNumber. \r
394 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
395 \r
396**/\r
397typedef\r
398EFI_STATUS\r
399(EFIAPI *EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) (\r
400 IN EFI_USB_HC_PROTOCOL *This,\r
401 IN UINT8 PortNumber,\r
402 IN EFI_USB_PORT_FEATURE PortFeature\r
403 );\r
404\r
405/** \r
406 Clears a feature for the specified root hub port.\r
407 \r
408 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.\r
409 @param PortNumber Specifies the root hub port from which the status is to be cleared.\r
410 This value is zero based.\r
411 @param PortFeature Indicates the feature selector associated with the feature clear\r
412 request.\r
413 \r
414 @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB\r
415 root hub port specified by PortNumber. \r
416 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
417 \r
418**/\r
419typedef\r
420EFI_STATUS\r
421(EFIAPI *EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) (\r
422 IN EFI_USB_HC_PROTOCOL *This,\r
423 IN UINT8 PortNumber,\r
424 IN EFI_USB_PORT_FEATURE PortFeature\r
425 );\r
426\r
427struct _EFI_USB_HC_PROTOCOL {\r
428 EFI_USB_HC_PROTOCOL_RESET Reset;\r
429 EFI_USB_HC_PROTOCOL_GET_STATE GetState;\r
430 EFI_USB_HC_PROTOCOL_SET_STATE SetState;\r
431 EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer;\r
432 EFI_USB_HC_PROTOCOL_BULK_TRANSFER BulkTransfer;\r
433 EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer;\r
434 EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer;\r
435 EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer;\r
436 EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer;\r
437 EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;\r
438 EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;\r
439 EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;\r
440 EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;\r
441 UINT16 MajorRevision;\r
442 UINT16 MinorRevision;\r
443};\r
444\r
445extern EFI_GUID gEfiUsbHcProtocolGuid;\r
446\r
447#endif\r