]>
Commit | Line | Data |
---|---|---|
f8cd287b | 1 | /**@file\r |
2 | PS/2 Mouse driver header file\r | |
3 | \r | |
92a428e1 | 4 | Copyright (c) 2006 - 2007, 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 | |
05fbd06d | 9 | \r |
92a428e1 | 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 | |
05fbd06d | 12 | \r |
f8cd287b | 13 | **/\r |
05fbd06d | 14 | \r |
15 | #ifndef _PS2MOUSE_H\r | |
16 | #define _PS2MOUSE_H\r | |
17 | \r | |
2fdd0eaf | 18 | #include <PiDxe.h>\r |
19 | #include <Framework/StatusCode.h>\r | |
20 | \r | |
21 | #include <Protocol/SimplePointer.h>\r | |
22 | #include <Protocol/IsaIo.h>\r | |
23 | #include <Protocol/DevicePath.h>\r | |
24 | \r | |
25 | #include <Library/DebugLib.h>\r | |
26 | #include <Library/UefiDriverEntryPoint.h>\r | |
27 | #include <Library/UefiLib.h>\r | |
28 | #include <Library/BaseMemoryLib.h>\r | |
29 | #include <Library/MemoryAllocationLib.h>\r | |
30 | #include <Library/UefiBootServicesTableLib.h>\r | |
31 | #include <Library/ReportStatusCodeLib.h>\r | |
05fbd06d | 32 | \r |
33 | //\r | |
34 | // PS/2 mouse sample rate\r | |
35 | //\r | |
36 | typedef enum {\r | |
37 | SSR_10,\r | |
38 | SSR_20,\r | |
39 | SSR_40,\r | |
40 | SSR_60,\r | |
41 | SSR_80,\r | |
42 | SSR_100,\r | |
43 | SSR_200,\r | |
44 | MAX_SR\r | |
45 | } MOUSE_SR;\r | |
46 | \r | |
47 | //\r | |
48 | // PS/2 mouse resolution\r | |
49 | //\r | |
50 | typedef enum {\r | |
51 | CMR1,\r | |
52 | CMR2,\r | |
53 | CMR4,\r | |
54 | CMR8,\r | |
55 | MAX_CMR\r | |
56 | } MOUSE_RE;\r | |
57 | \r | |
58 | //\r | |
59 | // PS/2 mouse scaling\r | |
60 | //\r | |
61 | typedef enum {\r | |
62 | SF1,\r | |
63 | SF2\r | |
64 | } MOUSE_SF;\r | |
65 | \r | |
66 | //\r | |
67 | // Driver Private Data\r | |
68 | //\r | |
69 | #define PS2_MOUSE_DEV_SIGNATURE EFI_SIGNATURE_32 ('p', 's', '2', 'm')\r | |
70 | \r | |
71 | typedef struct {\r | |
72 | UINTN Signature;\r | |
73 | \r | |
74 | EFI_HANDLE Handle;\r | |
75 | EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;\r | |
76 | EFI_SIMPLE_POINTER_STATE State;\r | |
77 | EFI_SIMPLE_POINTER_MODE Mode;\r | |
78 | BOOLEAN StateChanged;\r | |
79 | \r | |
80 | //\r | |
81 | // PS2 Mouse device specific information\r | |
82 | //\r | |
83 | MOUSE_SR SampleRate;\r | |
84 | MOUSE_RE Resolution;\r | |
85 | MOUSE_SF Scaling;\r | |
86 | UINT8 DataPackageSize;\r | |
87 | \r | |
88 | EFI_ISA_IO_PROTOCOL *IsaIo;\r | |
89 | \r | |
90 | EFI_EVENT TimerEvent;\r | |
91 | \r | |
92 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r | |
93 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
94 | } PS2_MOUSE_DEV;\r | |
95 | \r | |
96 | #define PS2_MOUSE_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_DEV, SimplePointerProtocol, PS2_MOUSE_DEV_SIGNATURE)\r | |
97 | \r | |
98 | //\r | |
99 | // Global Variables\r | |
100 | //\r | |
f3d08ccf | 101 | extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver;\r |
102 | extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName;\r | |
103 | extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2;\r | |
05fbd06d | 104 | \r |
105 | //\r | |
106 | // Function prototypes\r | |
107 | //\r | |
108 | EFI_STATUS\r | |
109 | EFIAPI\r | |
110 | PS2MouseDriverSupported (\r | |
111 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
112 | IN EFI_HANDLE Controller,\r | |
113 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
114 | );\r | |
115 | \r | |
116 | EFI_STATUS\r | |
117 | EFIAPI\r | |
118 | PS2MouseDriverStart (\r | |
119 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
120 | IN EFI_HANDLE Controller,\r | |
121 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
122 | );\r | |
123 | \r | |
124 | EFI_STATUS\r | |
125 | EFIAPI\r | |
126 | PS2MouseDriverStop (\r | |
127 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
128 | IN EFI_HANDLE Controller,\r | |
129 | IN UINTN NumberOfChildren,\r | |
130 | IN EFI_HANDLE *ChildHandleBuffer\r | |
131 | );\r | |
132 | \r | |
133 | //\r | |
134 | // EFI Component Name Functions\r | |
135 | //\r | |
f3d08ccf | 136 | /**\r |
137 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
138 | \r | |
139 | This function retrieves the user readable name of a driver in the form of a\r | |
140 | Unicode string. If the driver specified by This has a user readable name in\r | |
141 | the language specified by Language, then a pointer to the driver name is\r | |
142 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
143 | by This does not support the language specified by Language,\r | |
144 | then EFI_UNSUPPORTED is returned.\r | |
145 | \r | |
146 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
147 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
148 | \r | |
149 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
150 | array indicating the language. This is the\r | |
151 | language of the driver name that the caller is\r | |
152 | requesting, and it must match one of the\r | |
153 | languages specified in SupportedLanguages. The\r | |
154 | number of languages supported by a driver is up\r | |
155 | to the driver writer. Language is specified\r | |
156 | in RFC 3066 or ISO 639-2 language code format.\r | |
157 | \r | |
158 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
159 | This Unicode string is the name of the\r | |
160 | driver specified by This in the language\r | |
161 | specified by Language.\r | |
162 | \r | |
163 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
164 | This and the language specified by Language was\r | |
165 | returned in DriverName.\r | |
166 | \r | |
167 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
168 | \r | |
169 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
170 | \r | |
171 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
172 | the language specified by Language.\r | |
173 | \r | |
174 | **/\r | |
05fbd06d | 175 | EFI_STATUS\r |
176 | EFIAPI\r | |
177 | Ps2MouseComponentNameGetDriverName (\r | |
178 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
179 | IN CHAR8 *Language,\r | |
180 | OUT CHAR16 **DriverName\r | |
181 | );\r | |
182 | \r | |
f3d08ccf | 183 | \r |
184 | /**\r | |
185 | Retrieves a Unicode string that is the user readable name of the controller\r | |
186 | that is being managed by a driver.\r | |
187 | \r | |
188 | This function retrieves the user readable name of the controller specified by\r | |
189 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
190 | driver specified by This has a user readable name in the language specified by\r | |
191 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
192 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
193 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
194 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
195 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
196 | \r | |
197 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
198 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
199 | \r | |
200 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
201 | specified by This is managing. This handle\r | |
202 | specifies the controller whose name is to be\r | |
203 | returned.\r | |
204 | \r | |
205 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
206 | the name of. This is an optional parameter that\r | |
207 | may be NULL. It will be NULL for device\r | |
208 | drivers. It will also be NULL for a bus drivers\r | |
209 | that wish to retrieve the name of the bus\r | |
210 | controller. It will not be NULL for a bus\r | |
211 | driver that wishes to retrieve the name of a\r | |
212 | child controller.\r | |
213 | \r | |
214 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
215 | array indicating the language. This is the\r | |
216 | language of the driver name that the caller is\r | |
217 | requesting, and it must match one of the\r | |
218 | languages specified in SupportedLanguages. The\r | |
219 | number of languages supported by a driver is up\r | |
220 | to the driver writer. Language is specified in\r | |
221 | RFC 3066 or ISO 639-2 language code format.\r | |
222 | \r | |
223 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
224 | This Unicode string is the name of the\r | |
225 | controller specified by ControllerHandle and\r | |
226 | ChildHandle in the language specified by\r | |
227 | Language from the point of view of the driver\r | |
228 | specified by This.\r | |
229 | \r | |
230 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
231 | the language specified by Language for the\r | |
232 | driver specified by This was returned in\r | |
233 | DriverName.\r | |
234 | \r | |
235 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
236 | \r | |
237 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
238 | EFI_HANDLE.\r | |
239 | \r | |
240 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
241 | \r | |
242 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
243 | \r | |
244 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
245 | managing the controller specified by\r | |
246 | ControllerHandle and ChildHandle.\r | |
247 | \r | |
248 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
249 | the language specified by Language.\r | |
250 | \r | |
251 | **/\r | |
05fbd06d | 252 | EFI_STATUS\r |
253 | EFIAPI\r | |
254 | Ps2MouseComponentNameGetControllerName (\r | |
255 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
256 | IN EFI_HANDLE ControllerHandle,\r | |
257 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
258 | IN CHAR8 *Language,\r | |
259 | OUT CHAR16 **ControllerName\r | |
260 | );\r | |
261 | \r | |
f3d08ccf | 262 | \r |
05fbd06d | 263 | EFI_STATUS\r |
264 | EFIAPI\r | |
265 | MouseReset (\r | |
266 | IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r | |
267 | IN BOOLEAN ExtendedVerification\r | |
268 | );\r | |
269 | \r | |
270 | EFI_STATUS\r | |
271 | EFIAPI\r | |
272 | MouseGetState (\r | |
273 | IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r | |
274 | IN OUT EFI_SIMPLE_POINTER_STATE *State\r | |
275 | );\r | |
276 | \r | |
277 | VOID\r | |
278 | EFIAPI\r | |
279 | MouseWaitForInput (\r | |
280 | IN EFI_EVENT Event,\r | |
281 | IN VOID *Context\r | |
282 | );\r | |
283 | \r | |
284 | VOID\r | |
285 | EFIAPI\r | |
286 | PollMouse (\r | |
287 | IN EFI_EVENT Event,\r | |
288 | IN VOID *Context\r | |
289 | );\r | |
290 | \r | |
291 | EFI_STATUS\r | |
292 | In8042Data (\r | |
293 | IN EFI_ISA_IO_PROTOCOL *IsaIo,\r | |
294 | IN OUT UINT8 *Data\r | |
295 | );\r | |
296 | BOOLEAN\r | |
297 | CheckMouseConnect (\r | |
298 | IN PS2_MOUSE_DEV *MouseDev\r | |
299 | );\r | |
300 | \r | |
301 | #endif\r |