]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UsbLib.h
Code Scrub the common includes in MdePkg.
[mirror_edk2.git] / MdePkg / Include / Library / UsbLib.h
CommitLineData
842f5579 1/** @file\r
ed838d0c 2 Common Dxe Libarary for USB\r
fb3df220 3\r
842f5579
A
4 Copyright (c) 2006, Intel Corporation<BR>\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**/\r
fb3df220 14\r
fb3df220 15\r
842f5579
A
16#ifndef __USB_DXE_LIB_H__\r
17#define __USB_DXE_LIB_H__\r
fb3df220 18\r
c7d265a9 19#include <Protocol/UsbIo.h>\r
ed838d0c 20\r
fb3df220 21//\r
22// define the timeout time as 3ms\r
23//\r
24#define TIMEOUT_VALUE 3 * 1000\r
25\r
373b5cf9 26/**\r
27 Get Hid Descriptor\r
28\r
29 @param UsbIo EFI_USB_IO_PROTOCOL\r
30 @param InterfaceNum Hid interface number\r
31 @param HidDescriptor Caller allocated buffer to store Usb hid descriptor if\r
32 successfully returned.\r
33\r
34 @return Status of getting HID descriptor through USB I/O\r
35 protocol's UsbControlTransfer().\r
36\r
37**/\r
fb3df220 38EFI_STATUS\r
f1787349 39EFIAPI\r
fb3df220 40UsbGetHidDescriptor (\r
41 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
42 IN UINT8 InterfaceNum,\r
43 OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor\r
44 );\r
45\r
373b5cf9 46\r
47/**\r
48 get Report Class descriptor\r
49\r
50 @param UsbIo EFI_USB_IO_PROTOCOL.\r
51 @param InterfaceNum Report interface number.\r
52 @param DescriptorSize Length of DescriptorBuffer.\r
53 @param DescriptorBuffer Caller allocated buffer to store Usb report descriptor\r
54 if successfully returned.\r
55\r
56 @return Status of getting Report Class descriptor through USB\r
57 I/O protocol's UsbControlTransfer().\r
58\r
59**/\r
fb3df220 60EFI_STATUS\r
f1787349 61EFIAPI\r
fb3df220 62UsbGetReportDescriptor (\r
63 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
64 IN UINT8 InterfaceNum,\r
65 IN UINT16 DescriptorSize,\r
66 OUT UINT8 *DescriptorBuffer\r
67 );\r
68\r
373b5cf9 69/**\r
70 Get Hid Protocol Request\r
71\r
72 @param UsbIo EFI_USB_IO_PROTOCOL\r
73 @param Interface Which interface the caller wants to get protocol\r
74 @param Protocol Protocol value returned.\r
75\r
76 @return Status of getting Protocol Request through USB I/O\r
77 protocol's UsbControlTransfer().\r
78\r
79**/\r
fb3df220 80EFI_STATUS\r
f1787349 81EFIAPI\r
fb3df220 82UsbGetProtocolRequest (\r
83 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
84 IN UINT8 Interface,\r
85 IN UINT8 *Protocol\r
86 );\r
87\r
373b5cf9 88/**\r
89 Set Hid Protocol Request\r
90\r
91 @param UsbIo EFI_USB_IO_PROTOCOL\r
92 @param Interface Which interface the caller wants to set protocol\r
93 @param Protocol Protocol value the caller wants to set.\r
94\r
95 @return Status of setting Protocol Request through USB I/O\r
96 protocol's UsbControlTransfer().\r
97\r
98**/\r
fb3df220 99EFI_STATUS\r
f1787349 100EFIAPI\r
fb3df220 101UsbSetProtocolRequest (\r
102 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
103 IN UINT8 Interface,\r
104 IN UINT8 Protocol\r
105 );\r
106\r
373b5cf9 107/**\r
108 Set Idel request.\r
109\r
110 @param UsbIo EFI_USB_IO_PROTOCOL\r
111 @param Interface Which interface the caller wants to set.\r
112 @param ReportId Which report the caller wants to set.\r
113 @param Duration Idle rate the caller wants to set.\r
114\r
115 @return Status of setting IDLE Request through USB I/O\r
116 protocol's UsbControlTransfer().\r
117\r
118**/\r
fb3df220 119EFI_STATUS\r
f1787349 120EFIAPI\r
fb3df220 121UsbSetIdleRequest (\r
122 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
123 IN UINT8 Interface,\r
124 IN UINT8 ReportId,\r
125 IN UINT8 Duration\r
126 );\r
127\r
373b5cf9 128/**\r
129 Get Idel request.\r
130\r
131 @param UsbIo EFI_USB_IO_PROTOCOL\r
132 @param Interface Which interface the caller wants to get.\r
133 @param ReportId Which report the caller wants to get.\r
134 @param Duration Idle rate the caller wants to get.\r
135\r
136 @return Status of getting IDLE Request through USB I/O\r
137 protocol's UsbControlTransfer().\r
138\r
139**/\r
fb3df220 140EFI_STATUS\r
f1787349 141EFIAPI\r
fb3df220 142UsbGetIdleRequest (\r
143 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
144 IN UINT8 Interface,\r
145 IN UINT8 ReportId,\r
146 OUT UINT8 *Duration\r
147 );\r
148\r
373b5cf9 149/**\r
150 Hid Set Report request.\r
151\r
152 @param UsbIo EFI_USB_IO_PROTOCOL\r
153 @param Interface Which interface the caller wants to set.\r
154 @param ReportId Which report the caller wants to set.\r
155 @param ReportType Type of report.\r
156 @param ReportLen Length of report descriptor.\r
157 @param Report Report Descriptor buffer.\r
158\r
159 @return Status of setting Report Request through USB I/O\r
160 protocol's UsbControlTransfer().\r
161\r
162**/\r
fb3df220 163EFI_STATUS\r
f1787349 164EFIAPI\r
fb3df220 165UsbSetReportRequest (\r
166 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
167 IN UINT8 Interface,\r
168 IN UINT8 ReportId,\r
169 IN UINT8 ReportType,\r
170 IN UINT16 ReportLen,\r
171 IN UINT8 *Report\r
172 );\r
173\r
373b5cf9 174/**\r
175 Hid Set Report request.\r
176\r
177 @param UsbIo EFI_USB_IO_PROTOCOL\r
178 @param Interface Which interface the caller wants to set.\r
179 @param ReportId Which report the caller wants to set.\r
180 @param ReportType Type of report.\r
181 @param ReportLen Length of report descriptor.\r
182 @param Report Caller allocated buffer to store Report Descriptor.\r
183\r
184 @return Status of getting Report Request through USB I/O\r
185 protocol's UsbControlTransfer().\r
186\r
187**/\r
fb3df220 188EFI_STATUS\r
f1787349 189EFIAPI\r
fb3df220 190UsbGetReportRequest (\r
191 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
192 IN UINT8 Interface,\r
193 IN UINT8 ReportId,\r
194 IN UINT8 ReportType,\r
195 IN UINT16 ReportLen,\r
196 IN UINT8 *Report\r
197 );\r
198\r
373b5cf9 199/**\r
200 Usb Get Descriptor\r
201\r
202 @param UsbIo EFI_USB_IO_PROTOCOL\r
203 @param Value Device Request Value\r
204 @param Index Device Request Index\r
205 @param DescriptorLength Descriptor Length\r
206 @param Descriptor Descriptor buffer to contain result\r
207 @param Status Transfer Status\r
208\r
209 @retval EFI_INVALID_PARAMETER Parameter is error\r
210 @retval EFI_SUCCESS Success\r
211 @retval EFI_TIMEOUT Device has no response\r
212\r
213**/\r
fb3df220 214EFI_STATUS\r
215UsbGetDescriptor (\r
216 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
217 IN UINT16 Value,\r
218 IN UINT16 Index,\r
219 IN UINT16 DescriptorLength,\r
220 OUT VOID *Descriptor,\r
221 OUT UINT32 *Status\r
222 );\r
223\r
373b5cf9 224/**\r
225 Usb Set Descriptor\r
226\r
227 @param UsbIo EFI_USB_IO_PROTOCOL\r
228 @param Value Device Request Value\r
229 @param Index Device Request Index\r
230 @param DescriptorLength Descriptor Length\r
231 @param Descriptor Descriptor buffer to set\r
232 @param Status Transfer Status\r
233\r
234 @retval EFI_INVALID_PARAMETER Parameter is error\r
235 @retval EFI_SUCCESS Success\r
236 @retval EFI_TIMEOUT Device has no response\r
237\r
238**/\r
fb3df220 239EFI_STATUS\r
f1787349 240EFIAPI\r
fb3df220 241UsbSetDescriptor (\r
242 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
243 IN UINT16 Value,\r
244 IN UINT16 Index,\r
245 IN UINT16 DescriptorLength,\r
246 IN VOID *Descriptor,\r
247 OUT UINT32 *Status\r
248 );\r
249\r
373b5cf9 250/**\r
251 Usb Get Device Interface\r
252\r
253 @param UsbIo EFI_USB_IO_PROTOCOL\r
254 @param Index Interface index value\r
255 @param AltSetting Alternate setting\r
256 @param Status Trasnsfer status\r
257\r
258 @retval EFI_INVALID_PARAMETER Parameter is error\r
259 @retval EFI_SUCCESS Success\r
260 @retval EFI_TIMEOUT Device has no response\r
261\r
262**/\r
fb3df220 263EFI_STATUS\r
f1787349 264EFIAPI\r
ed838d0c 265UsbGetInterface (\r
fb3df220 266 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
267 IN UINT16 Index,\r
268 OUT UINT8 *AltSetting,\r
269 OUT UINT32 *Status\r
270 );\r
271\r
373b5cf9 272/**\r
273 Usb Set Device Interface\r
274\r
275 @param UsbIo EFI_USB_IO_PROTOCOL\r
276 @param InterfaceNo Interface Number\r
277 @param AltSetting Alternate setting\r
278 @param Status Trasnsfer status\r
279\r
280 @retval EFI_INVALID_PARAMETER Parameter is error\r
281 @retval EFI_SUCCESS Success\r
282 @retval EFI_TIMEOUT Device has no response\r
283\r
284**/\r
fb3df220 285EFI_STATUS\r
f1787349 286EFIAPI\r
ed838d0c 287UsbSetInterface (\r
fb3df220 288 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
289 IN UINT16 InterfaceNo,\r
290 IN UINT16 AltSetting,\r
291 OUT UINT32 *Status\r
292 );\r
293\r
373b5cf9 294/**\r
295 Usb Get Device Configuration\r
296\r
297 @param UsbIo EFI_USB_IO_PROTOCOL\r
298 @param ConfigValue Config Value\r
299 @param Status Transfer Status\r
300\r
301 @retval EFI_INVALID_PARAMETER Parameter is error\r
302 @retval EFI_SUCCESS Success\r
303 @retval EFI_TIMEOUT Device has no response\r
304\r
305**/\r
fb3df220 306EFI_STATUS\r
f1787349 307EFIAPI\r
ed838d0c 308UsbGetConfiguration (\r
fb3df220 309 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
310 OUT UINT8 *ConfigValue,\r
311 OUT UINT32 *Status\r
312 );\r
313\r
373b5cf9 314/**\r
315 Usb Set Device Configuration\r
316\r
317 @param UsbIo EFI_USB_IO_PROTOCOL\r
318 @param Value Configuration Value to set\r
319 @param Status Transfer status\r
320\r
321 @retval EFI_INVALID_PARAMETER Parameter is error\r
322 @retval EFI_SUCCESS Success\r
323 @retval EFI_TIMEOUT Device has no response\r
324\r
325**/\r
fb3df220 326EFI_STATUS\r
f1787349 327EFIAPI\r
ed838d0c 328UsbSetConfiguration (\r
fb3df220 329 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
330 IN UINT16 Value,\r
331 OUT UINT32 *Status\r
332 );\r
333\r
373b5cf9 334/**\r
335 Usb Set Device Feature\r
336\r
337 @param UsbIo EFI_USB_IO_PROTOCOL\r
338 @param Recipient Interface/Device/Endpoint\r
339 @param Value Request value\r
340 @param Target Request Index\r
341 @param Status Transfer status\r
342\r
343 @retval EFI_INVALID_PARAMETER Parameter is error\r
344 @retval EFI_SUCCESS Success\r
345 @retval EFI_TIMEOUT Device has no response\r
346\r
347**/\r
fb3df220 348EFI_STATUS\r
f1787349 349EFIAPI\r
ed838d0c 350UsbSetFeature (\r
fb3df220 351 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 352 IN UINTN Recipient,\r
fb3df220 353 IN UINT16 Value,\r
354 IN UINT16 Target,\r
355 OUT UINT32 *Status\r
356 );\r
357\r
373b5cf9 358/**\r
359 Usb Clear Device Feature\r
360\r
361 @param UsbIo EFI_USB_IO_PROTOCOL\r
362 @param Recipient Interface/Device/Endpoint\r
363 @param Value Request value\r
364 @param Target Request Index\r
365 @param Status Transfer status\r
366\r
367 @retval EFI_INVALID_PARAMETER Parameter is error\r
368 @retval EFI_SUCCESS Success\r
369 @retval EFI_TIMEOUT Device has no response\r
370\r
371**/\r
fb3df220 372EFI_STATUS\r
f1787349 373EFIAPI\r
ed838d0c 374UsbClearFeature (\r
fb3df220 375 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 376 IN UINTN Recipient,\r
fb3df220 377 IN UINT16 Value,\r
378 IN UINT16 Target,\r
379 OUT UINT32 *Status\r
380 );\r
381\r
373b5cf9 382/**\r
383 Usb Get Device Status\r
384\r
385 @param UsbIo EFI_USB_IO_PROTOCOL\r
386 @param Recipient Interface/Device/Endpoint\r
387 @param Target Request index\r
388 @param DevStatus Device status\r
389 @param Status Transfer status\r
390\r
391 @retval EFI_INVALID_PARAMETER Parameter is error\r
392 @retval EFI_SUCCESS Success\r
393 @retval EFI_TIMEOUT Device has no response\r
394\r
395**/\r
fb3df220 396EFI_STATUS\r
f1787349 397EFIAPI\r
ed838d0c 398UsbGetStatus (\r
fb3df220 399 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 400 IN UINTN Recipient,\r
fb3df220 401 IN UINT16 Target,\r
402 OUT UINT16 *DevStatus,\r
403 OUT UINT32 *Status\r
404 );\r
405\r
373b5cf9 406/**\r
407 Clear endpoint stall\r
408\r
409 @param UsbIo EFI_USB_IO_PROTOCOL\r
410 @param EndpointNo Endpoint Number\r
411 @param Status Transfer Status\r
412\r
413 @retval EFI_NOT_FOUND Can't find the Endpoint\r
414 @retval EFI_DEVICE_ERROR Hardware error\r
415 @retval EFI_SUCCESS Success\r
416\r
417**/\r
fb3df220 418EFI_STATUS\r
f1787349 419EFIAPI\r
fb3df220 420UsbClearEndpointHalt (\r
421 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
422 IN UINT8 EndpointNo,\r
423 OUT UINT32 *Status\r
424 );\r
425\r
426#endif\r