]>
Commit | Line | Data |
---|---|---|
4aa68cbc RN |
1 | /** @file\r |
2 | PS/2 keyboard driver header file\r | |
3 | \r | |
3652f990 | 4 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r |
4aa68cbc RN |
5 | 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 | |
14 | \r | |
15 | #ifndef _PS2KEYBOARD_H_\r | |
16 | #define _PS2KEYBOARD_H_\r | |
17 | \r | |
18 | #include <Uefi.h>\r | |
19 | \r | |
20 | #include <Protocol/SuperIo.h>\r | |
21 | #include <Protocol/SimpleTextIn.h>\r | |
22 | #include <Protocol/SimpleTextInEx.h>\r | |
23 | #include <Protocol/DevicePath.h>\r | |
24 | #include <Protocol/Ps2Policy.h>\r | |
25 | \r | |
26 | #include <Library/IoLib.h>\r | |
27 | #include <Library/DevicePathLib.h>\r | |
28 | #include <Library/UefiDriverEntryPoint.h>\r | |
29 | #include <Library/UefiLib.h>\r | |
30 | #include <Library/UefiBootServicesTableLib.h>\r | |
31 | #include <Library/ReportStatusCodeLib.h>\r | |
32 | #include <Library/DebugLib.h>\r | |
33 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
34 | #include <Library/MemoryAllocationLib.h>\r | |
35 | #include <Library/BaseLib.h>\r | |
36 | #include <Library/BaseMemoryLib.h>\r | |
37 | #include <Library/TimerLib.h>\r | |
38 | #include <Library/PcdLib.h>\r | |
39 | \r | |
40 | //\r | |
41 | // Global Variables\r | |
42 | //\r | |
43 | extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver;\r | |
44 | extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName;\r | |
45 | extern EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2;\r | |
46 | \r | |
47 | //\r | |
48 | // Driver Private Data\r | |
49 | //\r | |
50 | #define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE SIGNATURE_32 ('k', 'k', 'e', 'y')\r | |
51 | #define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('k', 'c', 'e', 'n')\r | |
52 | \r | |
53 | typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r | |
54 | UINTN Signature;\r | |
55 | EFI_KEY_DATA KeyData;\r | |
56 | EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r | |
57 | LIST_ENTRY NotifyEntry;\r | |
58 | } KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r | |
59 | \r | |
60 | #define KEYBOARD_SCAN_CODE_MAX_COUNT 32\r | |
61 | typedef struct {\r | |
62 | UINT8 Buffer[KEYBOARD_SCAN_CODE_MAX_COUNT];\r | |
63 | UINTN Head;\r | |
64 | UINTN Tail;\r | |
65 | } SCAN_CODE_QUEUE;\r | |
66 | \r | |
67 | #define KEYBOARD_EFI_KEY_MAX_COUNT 256\r | |
68 | typedef struct {\r | |
69 | EFI_KEY_DATA Buffer[KEYBOARD_EFI_KEY_MAX_COUNT];\r | |
70 | UINTN Head;\r | |
71 | UINTN Tail;\r | |
72 | } EFI_KEY_QUEUE;\r | |
73 | \r | |
74 | typedef struct {\r | |
75 | UINTN Signature;\r | |
76 | \r | |
77 | EFI_HANDLE Handle;\r | |
78 | EFI_SIMPLE_TEXT_INPUT_PROTOCOL ConIn;\r | |
79 | EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL ConInEx;\r | |
80 | \r | |
81 | EFI_EVENT TimerEvent;\r | |
82 | \r | |
83 | UINT32 DataRegisterAddress;\r | |
84 | UINT32 StatusRegisterAddress;\r | |
85 | UINT32 CommandRegisterAddress;\r | |
86 | \r | |
87 | BOOLEAN LeftCtrl;\r | |
88 | BOOLEAN RightCtrl;\r | |
89 | BOOLEAN LeftAlt;\r | |
90 | BOOLEAN RightAlt;\r | |
91 | BOOLEAN LeftShift;\r | |
92 | BOOLEAN RightShift;\r | |
93 | BOOLEAN LeftLogo;\r | |
94 | BOOLEAN RightLogo;\r | |
95 | BOOLEAN Menu;\r | |
96 | BOOLEAN SysReq;\r | |
97 | \r | |
98 | BOOLEAN CapsLock;\r | |
99 | BOOLEAN NumLock;\r | |
100 | BOOLEAN ScrollLock;\r | |
101 | \r | |
102 | BOOLEAN IsSupportPartialKey;\r | |
103 | //\r | |
104 | // Queue storing key scancodes\r | |
105 | //\r | |
106 | SCAN_CODE_QUEUE ScancodeQueue;\r | |
107 | EFI_KEY_QUEUE EfiKeyQueue;\r | |
35dadd7c | 108 | EFI_KEY_QUEUE EfiKeyQueueForNotify;\r |
4aa68cbc RN |
109 | \r |
110 | //\r | |
111 | // Error state\r | |
112 | //\r | |
113 | BOOLEAN KeyboardErr;\r | |
114 | \r | |
115 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r | |
116 | \r | |
117 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
118 | //\r | |
119 | // Notification Function List\r | |
120 | //\r | |
121 | LIST_ENTRY NotifyList;\r | |
35dadd7c | 122 | EFI_EVENT KeyNotifyProcessEvent;\r |
4aa68cbc RN |
123 | } KEYBOARD_CONSOLE_IN_DEV;\r |
124 | \r | |
125 | #define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)\r | |
126 | #define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) \\r | |
127 | CR (a, \\r | |
128 | KEYBOARD_CONSOLE_IN_DEV, \\r | |
129 | ConInEx, \\r | |
130 | KEYBOARD_CONSOLE_IN_DEV_SIGNATURE \\r | |
131 | )\r | |
132 | \r | |
133 | #define TABLE_END 0x0\r | |
134 | \r | |
135 | //\r | |
136 | // Driver entry point\r | |
137 | //\r | |
138 | /**\r | |
139 | The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r | |
140 | \r | |
141 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
142 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
143 | \r | |
144 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
145 | @retval other Some error occurs when executing this entry point.\r | |
146 | \r | |
147 | **/\r | |
148 | EFI_STATUS\r | |
149 | EFIAPI\r | |
150 | InstallPs2KeyboardDriver (\r | |
151 | IN EFI_HANDLE ImageHandle,\r | |
152 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
153 | );\r | |
154 | \r | |
155 | #define KEYBOARD_8042_DATA_REGISTER 0x60\r | |
156 | #define KEYBOARD_8042_STATUS_REGISTER 0x64\r | |
157 | #define KEYBOARD_8042_COMMAND_REGISTER 0x64\r | |
158 | \r | |
159 | #define KEYBOARD_KBEN 0xF4\r | |
160 | #define KEYBOARD_CMDECHO_ACK 0xFA\r | |
161 | \r | |
162 | #define KEYBOARD_MAX_TRY 256 // 256\r | |
163 | #define KEYBOARD_TIMEOUT 65536 // 0.07s\r | |
164 | #define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s\r | |
165 | #define KEYBOARD_BAT_TIMEOUT 4000000 // 4s\r | |
166 | #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r | |
167 | #define SCANCODE_EXTENDED0 0xE0\r | |
168 | #define SCANCODE_EXTENDED1 0xE1\r | |
169 | #define SCANCODE_CTRL_MAKE 0x1D\r | |
170 | #define SCANCODE_CTRL_BREAK 0x9D\r | |
171 | #define SCANCODE_ALT_MAKE 0x38\r | |
172 | #define SCANCODE_ALT_BREAK 0xB8\r | |
173 | #define SCANCODE_LEFT_SHIFT_MAKE 0x2A\r | |
174 | #define SCANCODE_LEFT_SHIFT_BREAK 0xAA\r | |
175 | #define SCANCODE_RIGHT_SHIFT_MAKE 0x36\r | |
176 | #define SCANCODE_RIGHT_SHIFT_BREAK 0xB6\r | |
177 | #define SCANCODE_CAPS_LOCK_MAKE 0x3A\r | |
178 | #define SCANCODE_NUM_LOCK_MAKE 0x45\r | |
179 | #define SCANCODE_SCROLL_LOCK_MAKE 0x46\r | |
180 | #define SCANCODE_DELETE_MAKE 0x53\r | |
181 | #define SCANCODE_LEFT_LOGO_MAKE 0x5B //GUI key defined in Keyboard scan code\r | |
182 | #define SCANCODE_LEFT_LOGO_BREAK 0xDB\r | |
183 | #define SCANCODE_RIGHT_LOGO_MAKE 0x5C\r | |
184 | #define SCANCODE_RIGHT_LOGO_BREAK 0xDC\r | |
185 | #define SCANCODE_MENU_MAKE 0x5D //APPS key defined in Keyboard scan code\r | |
186 | #define SCANCODE_MENU_BREAK 0xDD\r | |
187 | #define SCANCODE_SYS_REQ_MAKE 0x37\r | |
188 | #define SCANCODE_SYS_REQ_BREAK 0xB7\r | |
189 | #define SCANCODE_SYS_REQ_MAKE_WITH_ALT 0x54\r | |
190 | #define SCANCODE_SYS_REQ_BREAK_WITH_ALT 0xD4\r | |
191 | \r | |
192 | #define SCANCODE_MAX_MAKE 0x60\r | |
193 | \r | |
194 | \r | |
195 | #define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA BIT0 ///< 0 - Output register has no data; 1 - Output register has data\r | |
196 | #define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA BIT1 ///< 0 - Input register has no data; 1 - Input register has data\r | |
197 | #define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG BIT2 ///< Set to 0 after power on reset\r | |
198 | #define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE BIT3 ///< 0 - Data in input register is data; 1 - Data in input register is command\r | |
199 | #define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG BIT4 ///< 0 - Keyboard is disable; 1 - Keyboard is enable\r | |
200 | #define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT BIT5 ///< 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete\r | |
201 | #define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT BIT6 ///< 0 - Receive is complete without timeout; 1 - Receive is timeout without complete\r | |
202 | #define KEYBOARD_STATUS_REGISTER_PARITY BIT7 ///< 0 - Odd parity; 1 - Even parity\r | |
203 | \r | |
204 | #define KEYBOARD_8042_COMMAND_READ 0x20\r | |
205 | #define KEYBOARD_8042_COMMAND_WRITE 0x60\r | |
206 | #define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE 0xA7\r | |
207 | #define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE 0xA8\r | |
208 | #define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST 0xAA\r | |
209 | #define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST 0xAB\r | |
210 | #define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE 0xAD\r | |
211 | \r | |
212 | #define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA 0xF4\r | |
213 | #define KEYBOARD_8048_COMMAND_RESET 0xFF\r | |
214 | #define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET 0xF0\r | |
215 | \r | |
216 | #define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS 0xAA\r | |
217 | #define KEYBOARD_8048_RETURN_8042_BAT_ERROR 0xFC\r | |
218 | #define KEYBOARD_8048_RETURN_8042_ACK 0xFA\r | |
219 | \r | |
220 | \r | |
221 | //\r | |
222 | // Keyboard Controller Status\r | |
223 | //\r | |
224 | #define KBC_PARE 0x80 // Parity Error\r | |
225 | #define KBC_TIM 0x40 // General Time Out\r | |
226 | \r | |
227 | //\r | |
228 | // Other functions that are used among .c files\r | |
229 | //\r | |
230 | /**\r | |
231 | Show keyboard status lights according to\r | |
232 | indicators in ConsoleIn.\r | |
233 | \r | |
234 | @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r | |
235 | \r | |
236 | @return status\r | |
237 | \r | |
238 | **/\r | |
239 | EFI_STATUS\r | |
240 | UpdateStatusLights (\r | |
241 | IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r | |
242 | );\r | |
243 | \r | |
244 | /**\r | |
245 | write key to keyboard.\r | |
246 | \r | |
247 | @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r | |
248 | @param Data value wanted to be written\r | |
249 | \r | |
250 | @retval EFI_TIMEOUT - GC_TODO: Add description for return value\r | |
251 | @retval EFI_SUCCESS - GC_TODO: Add description for return value\r | |
252 | \r | |
253 | **/\r | |
254 | EFI_STATUS\r | |
255 | KeyboardRead (\r | |
256 | IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r | |
257 | OUT UINT8 *Data\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.\r | |
262 | \r | |
263 | The function is always called in TPL_NOTIFY.\r | |
264 | \r | |
265 | @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r | |
266 | \r | |
267 | **/\r | |
268 | VOID\r | |
269 | KeyGetchar (\r | |
270 | IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r | |
271 | );\r | |
272 | \r | |
35dadd7c SZ |
273 | /**\r |
274 | Process key notify.\r | |
275 | \r | |
276 | @param Event Indicates the event that invoke this function.\r | |
277 | @param Context Indicates the calling context.\r | |
278 | **/\r | |
279 | VOID\r | |
280 | EFIAPI\r | |
281 | KeyNotifyProcessHandler (\r | |
282 | IN EFI_EVENT Event,\r | |
283 | IN VOID *Context\r | |
284 | );\r | |
285 | \r | |
4aa68cbc RN |
286 | /**\r |
287 | Perform 8042 controller and keyboard Initialization.\r | |
288 | If ExtendedVerification is TRUE, do additional test for\r | |
289 | the keyboard interface\r | |
290 | \r | |
291 | @param ConsoleIn - KEYBOARD_CONSOLE_IN_DEV instance pointer\r | |
292 | @param ExtendedVerification - indicates a thorough initialization\r | |
293 | \r | |
294 | @retval EFI_DEVICE_ERROR Fail to init keyboard\r | |
295 | @retval EFI_SUCCESS Success to init keyboard\r | |
296 | **/\r | |
297 | EFI_STATUS\r | |
298 | InitKeyboard (\r | |
299 | IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r | |
300 | IN BOOLEAN ExtendedVerification\r | |
301 | );\r | |
302 | \r | |
303 | /**\r | |
304 | Disable the keyboard interface of the 8042 controller.\r | |
305 | \r | |
306 | @param ConsoleIn - the device instance\r | |
307 | \r | |
308 | @return status of issuing disable command\r | |
309 | \r | |
310 | **/\r | |
311 | EFI_STATUS\r | |
312 | DisableKeyboard (\r | |
313 | IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r | |
314 | );\r | |
315 | \r | |
316 | /**\r | |
317 | Timer event handler: read a series of scancodes from 8042\r | |
318 | and put them into memory scancode buffer.\r | |
319 | it read as much scancodes to either fill\r | |
320 | the memory buffer or empty the keyboard buffer.\r | |
321 | It is registered as running under TPL_NOTIFY\r | |
322 | \r | |
323 | @param Event - The timer event\r | |
324 | @param Context - A KEYBOARD_CONSOLE_IN_DEV pointer\r | |
325 | \r | |
326 | **/\r | |
327 | VOID\r | |
328 | EFIAPI\r | |
329 | KeyboardTimerHandler (\r | |
330 | IN EFI_EVENT Event,\r | |
331 | IN VOID *Context\r | |
332 | );\r | |
333 | \r | |
334 | /**\r | |
335 | logic reset keyboard\r | |
336 | Implement SIMPLE_TEXT_IN.Reset()\r | |
337 | Perform 8042 controller and keyboard initialization\r | |
338 | \r | |
339 | @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r | |
340 | @param ExtendedVerification Indicate that the driver may perform a more\r | |
341 | exhaustive verification operation of the device during\r | |
342 | reset, now this par is ignored in this driver\r | |
343 | \r | |
344 | **/\r | |
345 | EFI_STATUS\r | |
346 | EFIAPI\r | |
347 | KeyboardEfiReset (\r | |
348 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
349 | IN BOOLEAN ExtendedVerification\r | |
350 | );\r | |
351 | \r | |
352 | /**\r | |
353 | Implement SIMPLE_TEXT_IN.ReadKeyStroke().\r | |
354 | Retrieve key values for driver user.\r | |
355 | \r | |
356 | @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r | |
357 | @param Key The output buffer for key value\r | |
358 | \r | |
359 | @retval EFI_SUCCESS success to read key stroke\r | |
360 | **/\r | |
361 | EFI_STATUS\r | |
362 | EFIAPI\r | |
363 | KeyboardReadKeyStroke (\r | |
364 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
365 | OUT EFI_INPUT_KEY *Key\r | |
366 | );\r | |
367 | \r | |
368 | /**\r | |
369 | Event notification function for SIMPLE_TEXT_IN.WaitForKey event\r | |
370 | Signal the event if there is key available\r | |
371 | \r | |
372 | @param Event the event object\r | |
373 | @param Context waitting context\r | |
374 | \r | |
375 | **/\r | |
376 | VOID\r | |
377 | EFIAPI\r | |
378 | KeyboardWaitForKey (\r | |
379 | IN EFI_EVENT Event,\r | |
380 | IN VOID *Context\r | |
381 | );\r | |
382 | \r | |
383 | /**\r | |
384 | Read status register.\r | |
385 | \r | |
386 | @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r | |
387 | \r | |
388 | @return value in status register\r | |
389 | \r | |
390 | **/\r | |
391 | UINT8\r | |
392 | KeyReadStatusRegister (\r | |
393 | IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r | |
394 | );\r | |
395 | \r | |
396 | /**\r | |
397 | Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command\r | |
398 | If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r | |
399 | should not be in system.\r | |
400 | \r | |
401 | @param[in] ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r | |
402 | \r | |
403 | @retval TRUE Keyboard in System.\r | |
404 | @retval FALSE Keyboard not in System.\r | |
405 | **/\r | |
406 | BOOLEAN\r | |
407 | EFIAPI\r | |
408 | CheckKeyboardConnect (\r | |
409 | IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r | |
410 | );\r | |
411 | \r | |
412 | /**\r | |
413 | Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event\r | |
414 | Signal the event if there is key available\r | |
415 | \r | |
416 | @param Event event object\r | |
417 | @param Context waiting context\r | |
418 | \r | |
419 | **/\r | |
420 | VOID\r | |
421 | EFIAPI\r | |
422 | KeyboardWaitForKeyEx (\r | |
423 | IN EFI_EVENT Event,\r | |
424 | IN VOID *Context\r | |
425 | );\r | |
426 | \r | |
427 | //\r | |
428 | // Simple Text Input Ex protocol function prototypes\r | |
429 | //\r | |
430 | \r | |
431 | /**\r | |
432 | Reset the input device and optionaly run diagnostics\r | |
433 | \r | |
434 | @param This - Protocol instance pointer.\r | |
435 | @param ExtendedVerification - Driver may perform diagnostics on reset.\r | |
436 | \r | |
437 | @retval EFI_SUCCESS - The device was reset.\r | |
438 | @retval EFI_DEVICE_ERROR - The device is not functioning properly and could\r | |
439 | not be reset.\r | |
440 | \r | |
441 | **/\r | |
442 | EFI_STATUS\r | |
443 | EFIAPI\r | |
444 | KeyboardEfiResetEx (\r | |
445 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
446 | IN BOOLEAN ExtendedVerification\r | |
447 | );\r | |
448 | \r | |
449 | /**\r | |
450 | Reads the next keystroke from the input device. The WaitForKey Event can\r | |
451 | be used to test for existance of a keystroke via WaitForEvent () call.\r | |
452 | \r | |
453 | \r | |
454 | @param This - Protocol instance pointer.\r | |
455 | @param KeyData - A pointer to a buffer that is filled in with the keystroke\r | |
456 | state data for the key that was pressed.\r | |
457 | \r | |
458 | @retval EFI_SUCCESS - The keystroke information was returned.\r | |
459 | @retval EFI_NOT_READY - There was no keystroke data availiable.\r | |
460 | @retval EFI_DEVICE_ERROR - The keystroke information was not returned due to\r | |
461 | hardware errors.\r | |
462 | @retval EFI_INVALID_PARAMETER - KeyData is NULL.\r | |
463 | \r | |
464 | **/\r | |
465 | EFI_STATUS\r | |
466 | EFIAPI\r | |
467 | KeyboardReadKeyStrokeEx (\r | |
468 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
469 | OUT EFI_KEY_DATA *KeyData\r | |
470 | );\r | |
471 | \r | |
472 | /**\r | |
473 | Set certain state for the input device.\r | |
474 | \r | |
475 | @param This - Protocol instance pointer.\r | |
476 | @param KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the\r | |
477 | state for the input device.\r | |
478 | \r | |
479 | @retval EFI_SUCCESS - The device state was set successfully.\r | |
480 | @retval EFI_DEVICE_ERROR - The device is not functioning correctly and could\r | |
481 | not have the setting adjusted.\r | |
482 | @retval EFI_UNSUPPORTED - The device does not have the ability to set its state.\r | |
483 | @retval EFI_INVALID_PARAMETER - KeyToggleState is NULL.\r | |
484 | \r | |
485 | **/\r | |
486 | EFI_STATUS\r | |
487 | EFIAPI\r | |
488 | KeyboardSetState (\r | |
489 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
490 | IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r | |
491 | );\r | |
492 | \r | |
493 | /**\r | |
494 | Register a notification function for a particular keystroke for the input device.\r | |
495 | \r | |
496 | @param This - Protocol instance pointer.\r | |
497 | @param KeyData - A pointer to a buffer that is filled in with the keystroke\r | |
3652f990 DB |
498 | information data for the key that was pressed. If KeyData.Key,\r |
499 | KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState are 0,\r | |
500 | then any incomplete keystroke will trigger a notification of the KeyNotificationFunction.\r | |
4aa68cbc | 501 | @param KeyNotificationFunction - Points to the function to be called when the key\r |
3652f990 DB |
502 | sequence is typed specified by KeyData. This notification function\r |
503 | should be called at <=TPL_CALLBACK.\r | |
4aa68cbc RN |
504 | @param NotifyHandle - Points to the unique handle assigned to the registered notification.\r |
505 | \r | |
506 | @retval EFI_SUCCESS - The notification function was registered successfully.\r | |
507 | @retval EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r | |
508 | @retval EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.\r | |
509 | \r | |
510 | **/\r | |
511 | EFI_STATUS\r | |
512 | EFIAPI\r | |
513 | KeyboardRegisterKeyNotify (\r | |
514 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
515 | IN EFI_KEY_DATA *KeyData,\r | |
516 | IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r | |
517 | OUT VOID **NotifyHandle\r | |
518 | );\r | |
519 | \r | |
520 | /**\r | |
521 | Remove a registered notification function from a particular keystroke.\r | |
522 | \r | |
523 | @param This - Protocol instance pointer.\r | |
524 | @param NotificationHandle - The handle of the notification function being unregistered.\r | |
525 | \r | |
526 | \r | |
527 | @retval EFI_SUCCESS - The notification function was unregistered successfully.\r | |
528 | @retval EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r | |
529 | @retval EFI_NOT_FOUND - Can not find the matching entry in database.\r | |
530 | \r | |
531 | **/\r | |
532 | EFI_STATUS\r | |
533 | EFIAPI\r | |
534 | KeyboardUnregisterKeyNotify (\r | |
535 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
536 | IN VOID *NotificationHandle\r | |
537 | );\r | |
538 | \r | |
539 | /**\r | |
540 | Push one key data to the EFI key buffer.\r | |
541 | \r | |
542 | @param Queue Pointer to instance of EFI_KEY_QUEUE.\r | |
543 | @param KeyData The key data to push.\r | |
544 | **/\r | |
545 | VOID\r | |
546 | PushEfikeyBufTail (\r | |
547 | IN EFI_KEY_QUEUE *Queue,\r | |
548 | IN EFI_KEY_DATA *KeyData\r | |
549 | );\r | |
550 | \r | |
551 | /**\r | |
552 | Judge whether is a registed key\r | |
553 | \r | |
554 | @param RegsiteredData A pointer to a buffer that is filled in with the keystroke\r | |
555 | state data for the key that was registered.\r | |
556 | @param InputData A pointer to a buffer that is filled in with the keystroke\r | |
557 | state data for the key that was pressed.\r | |
558 | \r | |
559 | @retval TRUE Key be pressed matches a registered key.\r | |
560 | @retval FLASE Match failed.\r | |
561 | \r | |
562 | **/\r | |
563 | BOOLEAN\r | |
564 | IsKeyRegistered (\r | |
565 | IN EFI_KEY_DATA *RegsiteredData,\r | |
566 | IN EFI_KEY_DATA *InputData\r | |
567 | );\r | |
568 | \r | |
569 | #endif\r |