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