Move some definitions defined in USB spec and HID Spec from Library/Usblib.h to Indus...
[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
fb3df220 26EFI_STATUS\r
27UsbGetHidDescriptor (\r
28 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
29 IN UINT8 InterfaceNum,\r
30 OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor\r
31 );\r
32\r
33EFI_STATUS\r
34UsbGetReportDescriptor (\r
35 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
36 IN UINT8 InterfaceNum,\r
37 IN UINT16 DescriptorSize,\r
38 OUT UINT8 *DescriptorBuffer\r
39 );\r
40\r
41EFI_STATUS\r
42UsbGetProtocolRequest (\r
43 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
44 IN UINT8 Interface,\r
45 IN UINT8 *Protocol\r
46 );\r
47\r
48EFI_STATUS\r
49UsbSetProtocolRequest (\r
50 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
51 IN UINT8 Interface,\r
52 IN UINT8 Protocol\r
53 );\r
54\r
55EFI_STATUS\r
56UsbSetIdleRequest (\r
57 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
58 IN UINT8 Interface,\r
59 IN UINT8 ReportId,\r
60 IN UINT8 Duration\r
61 );\r
62\r
63EFI_STATUS\r
64UsbGetIdleRequest (\r
65 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
66 IN UINT8 Interface,\r
67 IN UINT8 ReportId,\r
68 OUT UINT8 *Duration\r
69 );\r
70\r
71EFI_STATUS\r
72UsbSetReportRequest (\r
73 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
74 IN UINT8 Interface,\r
75 IN UINT8 ReportId,\r
76 IN UINT8 ReportType,\r
77 IN UINT16 ReportLen,\r
78 IN UINT8 *Report\r
79 );\r
80\r
81EFI_STATUS\r
82UsbGetReportRequest (\r
83 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
84 IN UINT8 Interface,\r
85 IN UINT8 ReportId,\r
86 IN UINT8 ReportType,\r
87 IN UINT16 ReportLen,\r
88 IN UINT8 *Report\r
89 );\r
90\r
ed838d0c 91typedef enum {\r
92 EfiUsbEndpointHalt,\r
93 EfiUsbDeviceRemoteWakeup\r
94} EFI_USB_STANDARD_FEATURE_SELECTOR;\r
95\r
fb3df220 96EFI_STATUS\r
97UsbGetDescriptor (\r
98 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
99 IN UINT16 Value,\r
100 IN UINT16 Index,\r
101 IN UINT16 DescriptorLength,\r
102 OUT VOID *Descriptor,\r
103 OUT UINT32 *Status\r
104 );\r
105\r
fb3df220 106EFI_STATUS\r
107UsbSetDescriptor (\r
108 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
109 IN UINT16 Value,\r
110 IN UINT16 Index,\r
111 IN UINT16 DescriptorLength,\r
112 IN VOID *Descriptor,\r
113 OUT UINT32 *Status\r
114 );\r
115\r
fb3df220 116EFI_STATUS\r
ed838d0c 117UsbGetInterface (\r
fb3df220 118 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
119 IN UINT16 Index,\r
120 OUT UINT8 *AltSetting,\r
121 OUT UINT32 *Status\r
122 );\r
123\r
fb3df220 124EFI_STATUS\r
ed838d0c 125UsbSetInterface (\r
fb3df220 126 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
127 IN UINT16 InterfaceNo,\r
128 IN UINT16 AltSetting,\r
129 OUT UINT32 *Status\r
130 );\r
131\r
fb3df220 132EFI_STATUS\r
ed838d0c 133UsbGetConfiguration (\r
fb3df220 134 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
135 OUT UINT8 *ConfigValue,\r
136 OUT UINT32 *Status\r
137 );\r
138\r
fb3df220 139EFI_STATUS\r
ed838d0c 140UsbSetConfiguration (\r
fb3df220 141 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
142 IN UINT16 Value,\r
143 OUT UINT32 *Status\r
144 );\r
145\r
fb3df220 146EFI_STATUS\r
ed838d0c 147UsbSetFeature (\r
fb3df220 148 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 149 IN UINTN Recipient,\r
fb3df220 150 IN UINT16 Value,\r
151 IN UINT16 Target,\r
152 OUT UINT32 *Status\r
153 );\r
154\r
fb3df220 155EFI_STATUS\r
ed838d0c 156UsbClearFeature (\r
fb3df220 157 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 158 IN UINTN Recipient,\r
fb3df220 159 IN UINT16 Value,\r
160 IN UINT16 Target,\r
161 OUT UINT32 *Status\r
162 );\r
163\r
fb3df220 164EFI_STATUS\r
ed838d0c 165UsbGetStatus (\r
fb3df220 166 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 167 IN UINTN Recipient,\r
fb3df220 168 IN UINT16 Target,\r
169 OUT UINT16 *DevStatus,\r
170 OUT UINT32 *Status\r
171 );\r
172\r
fb3df220 173EFI_STATUS\r
ed838d0c 174UsbGetHubDescriptor (\r
fb3df220 175 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
ed838d0c 176 IN UINT16 Value,\r
177 IN UINT16 Index,\r
178 IN UINT16 DescriptorLength,\r
179 OUT VOID *Descriptor,\r
fb3df220 180 OUT UINT32 *Status\r
181 );\r
182\r
183//\r
184// Clear endpoint stall\r
185//\r
186EFI_STATUS\r
187UsbClearEndpointHalt (\r
188 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
189 IN UINT8 EndpointNo,\r
190 OUT UINT32 *Status\r
191 );\r
192\r
193#endif\r