]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UsbLib.h
Add in .S file for GCC tool-chain.
[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
9199040c 215EFIAPI\r
fb3df220 216UsbGetDescriptor (\r
217 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
218 IN UINT16 Value,\r
219 IN UINT16 Index,\r
220 IN UINT16 DescriptorLength,\r
221 OUT VOID *Descriptor,\r
222 OUT UINT32 *Status\r
223 );\r
224\r
373b5cf9 225/**\r
226 Usb Set Descriptor\r
227\r
228 @param UsbIo EFI_USB_IO_PROTOCOL\r
229 @param Value Device Request Value\r
230 @param Index Device Request Index\r
231 @param DescriptorLength Descriptor Length\r
232 @param Descriptor Descriptor buffer to set\r
233 @param Status Transfer Status\r
234\r
235 @retval EFI_INVALID_PARAMETER Parameter is error\r
236 @retval EFI_SUCCESS Success\r
237 @retval EFI_TIMEOUT Device has no response\r
238\r
239**/\r
fb3df220 240EFI_STATUS\r
f1787349 241EFIAPI\r
fb3df220 242UsbSetDescriptor (\r
243 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
244 IN UINT16 Value,\r
245 IN UINT16 Index,\r
246 IN UINT16 DescriptorLength,\r
247 IN VOID *Descriptor,\r
248 OUT UINT32 *Status\r
249 );\r
250\r
373b5cf9 251/**\r
252 Usb Get Device Interface\r
253\r
254 @param UsbIo EFI_USB_IO_PROTOCOL\r
255 @param Index Interface index value\r
256 @param AltSetting Alternate setting\r
257 @param Status Trasnsfer status\r
258\r
259 @retval EFI_INVALID_PARAMETER Parameter is error\r
260 @retval EFI_SUCCESS Success\r
261 @retval EFI_TIMEOUT Device has no response\r
262\r
263**/\r
fb3df220 264EFI_STATUS\r
f1787349 265EFIAPI\r
ed838d0c 266UsbGetInterface (\r
fb3df220 267 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
268 IN UINT16 Index,\r
269 OUT UINT8 *AltSetting,\r
270 OUT UINT32 *Status\r
271 );\r
272\r
373b5cf9 273/**\r
274 Usb Set Device Interface\r
275\r
276 @param UsbIo EFI_USB_IO_PROTOCOL\r
277 @param InterfaceNo Interface Number\r
278 @param AltSetting Alternate setting\r
279 @param Status Trasnsfer status\r
280\r
281 @retval EFI_INVALID_PARAMETER Parameter is error\r
282 @retval EFI_SUCCESS Success\r
283 @retval EFI_TIMEOUT Device has no response\r
284\r
285**/\r
fb3df220 286EFI_STATUS\r
f1787349 287EFIAPI\r
ed838d0c 288UsbSetInterface (\r
fb3df220 289 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
290 IN UINT16 InterfaceNo,\r
291 IN UINT16 AltSetting,\r
292 OUT UINT32 *Status\r
293 );\r
294\r
373b5cf9 295/**\r
296 Usb Get Device Configuration\r
297\r
298 @param UsbIo EFI_USB_IO_PROTOCOL\r
299 @param ConfigValue Config Value\r
300 @param Status Transfer Status\r
301\r
302 @retval EFI_INVALID_PARAMETER Parameter is error\r
303 @retval EFI_SUCCESS Success\r
304 @retval EFI_TIMEOUT Device has no response\r
305\r
306**/\r
fb3df220 307EFI_STATUS\r
f1787349 308EFIAPI\r
ed838d0c 309UsbGetConfiguration (\r
fb3df220 310 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
311 OUT UINT8 *ConfigValue,\r
312 OUT UINT32 *Status\r
313 );\r
314\r
373b5cf9 315/**\r
316 Usb Set Device Configuration\r
317\r
318 @param UsbIo EFI_USB_IO_PROTOCOL\r
319 @param Value Configuration Value to set\r
320 @param Status Transfer status\r
321\r
322 @retval EFI_INVALID_PARAMETER Parameter is error\r
323 @retval EFI_SUCCESS Success\r
324 @retval EFI_TIMEOUT Device has no response\r
325\r
326**/\r
fb3df220 327EFI_STATUS\r
f1787349 328EFIAPI\r
ed838d0c 329UsbSetConfiguration (\r
fb3df220 330 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
331 IN UINT16 Value,\r
332 OUT UINT32 *Status\r
333 );\r
334\r
373b5cf9 335/**\r
336 Usb Set Device Feature\r
337\r
338 @param UsbIo EFI_USB_IO_PROTOCOL\r
339 @param Recipient Interface/Device/Endpoint\r
340 @param Value Request value\r
341 @param Target Request Index\r
342 @param Status Transfer status\r
343\r
344 @retval EFI_INVALID_PARAMETER Parameter is error\r
345 @retval EFI_SUCCESS Success\r
346 @retval EFI_TIMEOUT Device has no response\r
347\r
348**/\r
fb3df220 349EFI_STATUS\r
f1787349 350EFIAPI\r
ed838d0c 351UsbSetFeature (\r
fb3df220 352 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 353 IN UINTN Recipient,\r
fb3df220 354 IN UINT16 Value,\r
355 IN UINT16 Target,\r
356 OUT UINT32 *Status\r
357 );\r
358\r
373b5cf9 359/**\r
360 Usb Clear Device Feature\r
361\r
362 @param UsbIo EFI_USB_IO_PROTOCOL\r
363 @param Recipient Interface/Device/Endpoint\r
364 @param Value Request value\r
365 @param Target Request Index\r
366 @param Status Transfer status\r
367\r
368 @retval EFI_INVALID_PARAMETER Parameter is error\r
369 @retval EFI_SUCCESS Success\r
370 @retval EFI_TIMEOUT Device has no response\r
371\r
372**/\r
fb3df220 373EFI_STATUS\r
f1787349 374EFIAPI\r
ed838d0c 375UsbClearFeature (\r
fb3df220 376 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 377 IN UINTN Recipient,\r
fb3df220 378 IN UINT16 Value,\r
379 IN UINT16 Target,\r
380 OUT UINT32 *Status\r
381 );\r
382\r
373b5cf9 383/**\r
384 Usb Get Device Status\r
385\r
386 @param UsbIo EFI_USB_IO_PROTOCOL\r
387 @param Recipient Interface/Device/Endpoint\r
388 @param Target Request index\r
389 @param DevStatus Device status\r
390 @param Status Transfer status\r
391\r
392 @retval EFI_INVALID_PARAMETER Parameter is error\r
393 @retval EFI_SUCCESS Success\r
394 @retval EFI_TIMEOUT Device has no response\r
395\r
396**/\r
fb3df220 397EFI_STATUS\r
f1787349 398EFIAPI\r
ed838d0c 399UsbGetStatus (\r
fb3df220 400 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 401 IN UINTN Recipient,\r
fb3df220 402 IN UINT16 Target,\r
403 OUT UINT16 *DevStatus,\r
404 OUT UINT32 *Status\r
405 );\r
406\r
373b5cf9 407/**\r
408 Clear endpoint stall\r
409\r
410 @param UsbIo EFI_USB_IO_PROTOCOL\r
411 @param EndpointNo Endpoint Number\r
412 @param Status Transfer Status\r
413\r
414 @retval EFI_NOT_FOUND Can't find the Endpoint\r
415 @retval EFI_DEVICE_ERROR Hardware error\r
416 @retval EFI_SUCCESS Success\r
417\r
418**/\r
fb3df220 419EFI_STATUS\r
f1787349 420EFIAPI\r
fb3df220 421UsbClearEndpointHalt (\r
422 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
423 IN UINT8 EndpointNo,\r
424 OUT UINT32 *Status\r
425 );\r
426\r
427#endif\r