Move some definitions defined in USB spec and HID Spec from Library/Usblib.h to Indus...
[mirror_edk2.git] / MdePkg / Include / Library / UsbLib.h
1 /** @file
2 Common Dxe Libarary for USB
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #ifndef __USB_DXE_LIB_H__
17 #define __USB_DXE_LIB_H__
18
19 #include <Protocol/UsbIo.h>
20
21 //
22 // define the timeout time as 3ms
23 //
24 #define TIMEOUT_VALUE 3 * 1000
25
26 EFI_STATUS
27 UsbGetHidDescriptor (
28 IN EFI_USB_IO_PROTOCOL *UsbIo,
29 IN UINT8 InterfaceNum,
30 OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
31 );
32
33 EFI_STATUS
34 UsbGetReportDescriptor (
35 IN EFI_USB_IO_PROTOCOL *UsbIo,
36 IN UINT8 InterfaceNum,
37 IN UINT16 DescriptorSize,
38 OUT UINT8 *DescriptorBuffer
39 );
40
41 EFI_STATUS
42 UsbGetProtocolRequest (
43 IN EFI_USB_IO_PROTOCOL *UsbIo,
44 IN UINT8 Interface,
45 IN UINT8 *Protocol
46 );
47
48 EFI_STATUS
49 UsbSetProtocolRequest (
50 IN EFI_USB_IO_PROTOCOL *UsbIo,
51 IN UINT8 Interface,
52 IN UINT8 Protocol
53 );
54
55 EFI_STATUS
56 UsbSetIdleRequest (
57 IN EFI_USB_IO_PROTOCOL *UsbIo,
58 IN UINT8 Interface,
59 IN UINT8 ReportId,
60 IN UINT8 Duration
61 );
62
63 EFI_STATUS
64 UsbGetIdleRequest (
65 IN EFI_USB_IO_PROTOCOL *UsbIo,
66 IN UINT8 Interface,
67 IN UINT8 ReportId,
68 OUT UINT8 *Duration
69 );
70
71 EFI_STATUS
72 UsbSetReportRequest (
73 IN EFI_USB_IO_PROTOCOL *UsbIo,
74 IN UINT8 Interface,
75 IN UINT8 ReportId,
76 IN UINT8 ReportType,
77 IN UINT16 ReportLen,
78 IN UINT8 *Report
79 );
80
81 EFI_STATUS
82 UsbGetReportRequest (
83 IN EFI_USB_IO_PROTOCOL *UsbIo,
84 IN UINT8 Interface,
85 IN UINT8 ReportId,
86 IN UINT8 ReportType,
87 IN UINT16 ReportLen,
88 IN UINT8 *Report
89 );
90
91 typedef enum {
92 EfiUsbEndpointHalt,
93 EfiUsbDeviceRemoteWakeup
94 } EFI_USB_STANDARD_FEATURE_SELECTOR;
95
96 EFI_STATUS
97 UsbGetDescriptor (
98 IN EFI_USB_IO_PROTOCOL *UsbIo,
99 IN UINT16 Value,
100 IN UINT16 Index,
101 IN UINT16 DescriptorLength,
102 OUT VOID *Descriptor,
103 OUT UINT32 *Status
104 );
105
106 EFI_STATUS
107 UsbSetDescriptor (
108 IN EFI_USB_IO_PROTOCOL *UsbIo,
109 IN UINT16 Value,
110 IN UINT16 Index,
111 IN UINT16 DescriptorLength,
112 IN VOID *Descriptor,
113 OUT UINT32 *Status
114 );
115
116 EFI_STATUS
117 UsbGetInterface (
118 IN EFI_USB_IO_PROTOCOL *UsbIo,
119 IN UINT16 Index,
120 OUT UINT8 *AltSetting,
121 OUT UINT32 *Status
122 );
123
124 EFI_STATUS
125 UsbSetInterface (
126 IN EFI_USB_IO_PROTOCOL *UsbIo,
127 IN UINT16 InterfaceNo,
128 IN UINT16 AltSetting,
129 OUT UINT32 *Status
130 );
131
132 EFI_STATUS
133 UsbGetConfiguration (
134 IN EFI_USB_IO_PROTOCOL *UsbIo,
135 OUT UINT8 *ConfigValue,
136 OUT UINT32 *Status
137 );
138
139 EFI_STATUS
140 UsbSetConfiguration (
141 IN EFI_USB_IO_PROTOCOL *UsbIo,
142 IN UINT16 Value,
143 OUT UINT32 *Status
144 );
145
146 EFI_STATUS
147 UsbSetFeature (
148 IN EFI_USB_IO_PROTOCOL *UsbIo,
149 IN UINTN Recipient,
150 IN UINT16 Value,
151 IN UINT16 Target,
152 OUT UINT32 *Status
153 );
154
155 EFI_STATUS
156 UsbClearFeature (
157 IN EFI_USB_IO_PROTOCOL *UsbIo,
158 IN UINTN Recipient,
159 IN UINT16 Value,
160 IN UINT16 Target,
161 OUT UINT32 *Status
162 );
163
164 EFI_STATUS
165 UsbGetStatus (
166 IN EFI_USB_IO_PROTOCOL *UsbIo,
167 IN UINTN Recipient,
168 IN UINT16 Target,
169 OUT UINT16 *DevStatus,
170 OUT UINT32 *Status
171 );
172
173 EFI_STATUS
174 UsbGetHubDescriptor (
175 IN EFI_USB_IO_PROTOCOL *UsbIo,
176 IN UINT16 Value,
177 IN UINT16 Index,
178 IN UINT16 DescriptorLength,
179 OUT VOID *Descriptor,
180 OUT UINT32 *Status
181 );
182
183 //
184 // Clear endpoint stall
185 //
186 EFI_STATUS
187 UsbClearEndpointHalt (
188 IN EFI_USB_IO_PROTOCOL *UsbIo,
189 IN UINT8 EndpointNo,
190 OUT UINT32 *Status
191 );
192
193 #endif