]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
Fix the USB keyboard driver to call hotkey callback even no one is calling ReadKeyStroke
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbKbDxe / EfiKey.h
CommitLineData
ed838d0c 1/** @file\r
5899f27e 2 Header file for USB Keyboard Driver's Data Structures.\r
a7022cec 3\r
c1fd2767 4Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 5This program and the accompanying materials\r
ed838d0c 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
ed838d0c 13**/\r
a7022cec 14#ifndef _EFI_USB_KB_H_\r
15#define _EFI_USB_KB_H_\r
ed838d0c 16\r
ed7748fe 17\r
60c93673 18#include <Uefi.h>\r
ed7748fe 19\r
ed838d0c 20#include <Protocol/SimpleTextIn.h>\r
66aa04e4 21#include <Protocol/SimpleTextInEx.h>\r
813acf3a 22#include <Protocol/HiiDatabase.h>\r
ed838d0c 23#include <Protocol/UsbIo.h>\r
24#include <Protocol/DevicePath.h>\r
8d4cd915 25\r
813acf3a 26#include <Guid/HiiKeyBoardLayout.h>\r
ed7748fe 27\r
ed838d0c 28#include <Library/DebugLib.h>\r
29#include <Library/ReportStatusCodeLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/UefiRuntimeServicesTableLib.h>\r
32#include <Library/UefiDriverEntryPoint.h>\r
33#include <Library/UefiBootServicesTableLib.h>\r
34#include <Library/UefiLib.h>\r
35#include <Library/MemoryAllocationLib.h>\r
36#include <Library/PcdLib.h>\r
dfb74df5 37#include <Library/UefiUsbLib.h>\r
c41c3e55 38#include <Library/HiiLib.h>\r
ed838d0c 39\r
40#include <IndustryStandard/Usb.h>\r
41\r
c1fd2767
RN
42#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r
43\r
ed838d0c 44#define MAX_KEY_ALLOWED 32\r
45\r
46#define HZ 1000 * 1000 * 10\r
47#define USBKBD_REPEAT_DELAY ((HZ) / 2)\r
48#define USBKBD_REPEAT_RATE ((HZ) / 50)\r
49\r
50#define CLASS_HID 3\r
51#define SUBCLASS_BOOT 1\r
52#define PROTOCOL_KEYBOARD 1\r
53\r
54#define BOOT_PROTOCOL 0\r
55#define REPORT_PROTOCOL 1\r
56\r
57typedef struct {\r
b4e73a63 58 BOOLEAN Down;\r
59 UINT8 KeyCode;\r
ed838d0c 60} USB_KEY;\r
61\r
62typedef struct {\r
c1fd2767
RN
63 VOID *Buffer[MAX_KEY_ALLOWED + 1];\r
64 UINTN Head;\r
65 UINTN Tail;\r
66 UINTN ItemSize;\r
67} USB_SIMPLE_QUEUE;\r
ed838d0c 68\r
f3f2e05d 69#define USB_KB_DEV_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'd')\r
70#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'x')\r
66aa04e4 71\r
72typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
73 UINTN Signature;\r
74 EFI_HANDLE NotifyHandle;\r
75 EFI_KEY_DATA KeyData;\r
76 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
77 LIST_ENTRY NotifyEntry;\r
78} KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
813acf3a 79\r
f3f2e05d 80#define USB_NS_KEY_SIGNATURE SIGNATURE_32 ('u', 'n', 's', 'k')\r
813acf3a 81\r
82typedef struct {\r
83 UINTN Signature;\r
84 LIST_ENTRY Link;\r
85\r
86 //\r
87 // The number of EFI_NS_KEY_MODIFIER children definitions\r
88 //\r
89 UINTN KeyCount;\r
90\r
91 //\r
92 // NsKey[0] : Non-spacing key\r
93 // NsKey[1] ~ NsKey[KeyCount] : Physical keys\r
94 //\r
95 EFI_KEY_DESCRIPTOR *NsKey;\r
96} USB_NS_KEY;\r
97\r
98#define USB_NS_KEY_FORM_FROM_LINK(a) CR (a, USB_NS_KEY, Link, USB_NS_KEY_SIGNATURE)\r
99\r
5899f27e 100///\r
101/// Structure to describe USB keyboard device\r
102///\r
ed838d0c 103typedef struct {\r
5899f27e 104 UINTN Signature;\r
c41c3e55 105 EFI_HANDLE ControllerHandle;\r
5899f27e 106 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
107 EFI_EVENT DelayedRecoveryEvent;\r
108 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;\r
66aa04e4 109 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;\r
5899f27e 110 EFI_USB_IO_PROTOCOL *UsbIo;\r
ed838d0c 111\r
5899f27e 112 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r
113 EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;\r
ed838d0c 114\r
c1fd2767
RN
115 USB_SIMPLE_QUEUE UsbKeyQueue;\r
116 USB_SIMPLE_QUEUE EfiKeyQueue;\r
b4e73a63 117 BOOLEAN CtrlOn;\r
118 BOOLEAN AltOn;\r
119 BOOLEAN ShiftOn;\r
120 BOOLEAN NumLockOn;\r
121 BOOLEAN CapsOn;\r
122 BOOLEAN ScrollOn;\r
5899f27e 123 UINT8 LastKeyCodeArray[8];\r
b4e73a63 124 UINT8 CurKeyCode;\r
ed838d0c 125\r
c1fd2767
RN
126 EFI_EVENT TimerEvent;\r
127\r
5899f27e 128 UINT8 RepeatKey;\r
129 EFI_EVENT RepeatTimer;\r
ed838d0c 130\r
5899f27e 131 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
66aa04e4 132 \r
b4e73a63 133 BOOLEAN LeftCtrlOn;\r
134 BOOLEAN LeftAltOn;\r
135 BOOLEAN LeftShiftOn;\r
136 BOOLEAN LeftLogoOn;\r
137 BOOLEAN RightCtrlOn;\r
138 BOOLEAN RightAltOn;\r
139 BOOLEAN RightShiftOn;\r
140 BOOLEAN RightLogoOn; \r
141 BOOLEAN MenuKeyOn;\r
142 BOOLEAN SysReqOn;\r
143 BOOLEAN AltGrOn;\r
66aa04e4 144 //\r
145 // Notification function list\r
146 //\r
5899f27e 147 LIST_ENTRY NotifyList;\r
813acf3a 148\r
149 //\r
150 // Non-spacing key list\r
151 //\r
5899f27e 152 LIST_ENTRY NsKeyList;\r
153 USB_NS_KEY *CurrentNsKey;\r
154 EFI_KEY_DESCRIPTOR *KeyConvertionTable;\r
155 EFI_EVENT KeyboardLayoutEvent;\r
ed838d0c 156} USB_KB_DEV;\r
157\r
158//\r
159// Global Variables\r
160//\r
62b9bb55 161extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding;\r
162extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;\r
163extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;\r
ed838d0c 164\r
ed838d0c 165#define USB_KB_DEV_FROM_THIS(a) \\r
166 CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r
66aa04e4 167#define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r
168 CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r
169\r
b4e73a63 170//\r
171// According to Universal Serial Bus HID Usage Tables document ver 1.12,\r
172// a Boot Keyboard should support the keycode range from 0x0 to 0x65 and 0xE0 to 0xE7.\r
173// 0xE0 to 0xE7 are for modifier keys, and 0x0 to 0x3 are reserved for typical\r
174// keyboard status or keyboard errors.\r
175// So the number of valid non-modifier USB keycodes is 0x62, and the number of\r
176// valid keycodes is 0x6A.\r
177//\r
178#define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE 0x62\r
179#define NUMBER_OF_VALID_USB_KEYCODE 0x6A\r
180//\r
181// 0x0 to 0x3 are reserved for typical keyboard status or keyboard errors.\r
182//\r
183#define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)\r
ed838d0c 184\r
185typedef struct {\r
186 UINT8 NumLock : 1;\r
187 UINT8 CapsLock : 1;\r
188 UINT8 ScrollLock : 1;\r
189 UINT8 Resrvd : 5;\r
190} LED_MAP;\r
66aa04e4 191\r
5899f27e 192//\r
193// Functions of Driver Binding Protocol\r
194//\r
195/**\r
196 Check whether USB keyboard driver supports this device.\r
197\r
198 @param This The USB keyboard driver binding protocol.\r
199 @param Controller The controller handle to check.\r
200 @param RemainingDevicePath The remaining device path.\r
201\r
202 @retval EFI_SUCCESS The driver supports this controller.\r
203 @retval other This device isn't supported.\r
204\r
205**/\r
206EFI_STATUS\r
207EFIAPI\r
208USBKeyboardDriverBindingSupported (\r
209 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
210 IN EFI_HANDLE Controller,\r
211 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
212 );\r
213\r
214/**\r
c92e277d 215 Starts the keyboard device with this driver.\r
b4e73a63 216\r
217 This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
218 initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
219 this keyboard device.\r
5899f27e 220\r
221 @param This The USB keyboard driver binding instance.\r
222 @param Controller Handle of device to bind driver to.\r
223 @param RemainingDevicePath Optional parameter use to pick a specific child\r
224 device to start.\r
225\r
226 @retval EFI_SUCCESS The controller is controlled by the usb keyboard driver.\r
227 @retval EFI_UNSUPPORTED No interrupt endpoint can be found.\r
b4e73a63 228 @retval Other This controller cannot be started.\r
5899f27e 229\r
230**/\r
231EFI_STATUS\r
232EFIAPI\r
233USBKeyboardDriverBindingStart (\r
234 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
235 IN EFI_HANDLE Controller,\r
236 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
237 );\r
238\r
239/**\r
b4e73a63 240 Stop the USB keyboard device handled by this driver.\r
5899f27e 241\r
242 @param This The USB keyboard driver binding protocol.\r
243 @param Controller The controller to release.\r
244 @param NumberOfChildren The number of handles in ChildHandleBuffer.\r
245 @param ChildHandleBuffer The array of child handle.\r
246\r
b4e73a63 247 @retval EFI_SUCCESS The device was stopped.\r
5899f27e 248 @retval EFI_UNSUPPORTED Simple Text In Protocol or Simple Text In Ex Protocol\r
249 is not installed on Controller.\r
b4e73a63 250 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
251 @retval Others Fail to uninstall protocols attached on the device.\r
5899f27e 252\r
253**/\r
254EFI_STATUS\r
255EFIAPI\r
256USBKeyboardDriverBindingStop (\r
257 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
258 IN EFI_HANDLE Controller,\r
259 IN UINTN NumberOfChildren,\r
260 IN EFI_HANDLE *ChildHandleBuffer\r
261 );\r
262\r
b4e73a63 263//\r
264// EFI Component Name Functions\r
265//\r
266/**\r
267 Retrieves a Unicode string that is the user readable name of the driver.\r
268\r
269 This function retrieves the user readable name of a driver in the form of a\r
270 Unicode string. If the driver specified by This has a user readable name in\r
271 the language specified by Language, then a pointer to the driver name is\r
272 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
273 by This does not support the language specified by Language,\r
274 then EFI_UNSUPPORTED is returned.\r
275\r
276 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
277 EFI_COMPONENT_NAME_PROTOCOL instance.\r
278 @param Language A pointer to a Null-terminated ASCII string\r
279 array indicating the language. This is the\r
280 language of the driver name that the caller is\r
281 requesting, and it must match one of the\r
282 languages specified in SupportedLanguages. The\r
283 number of languages supported by a driver is up\r
284 to the driver writer. Language is specified\r
0254efc0 285 in RFC 4646 or ISO 639-2 language code format.\r
b4e73a63 286 @param DriverName A pointer to the Unicode string to return.\r
287 This Unicode string is the name of the\r
288 driver specified by This in the language\r
289 specified by Language.\r
290\r
291 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
292 This and the language specified by Language was\r
293 returned in DriverName.\r
294 @retval EFI_INVALID_PARAMETER Language is NULL.\r
295 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
296 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
297 the language specified by Language.\r
298\r
299**/\r
300EFI_STATUS\r
301EFIAPI\r
302UsbKeyboardComponentNameGetDriverName (\r
303 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
304 IN CHAR8 *Language,\r
305 OUT CHAR16 **DriverName\r
306 );\r
307\r
308/**\r
309 Retrieves a Unicode string that is the user readable name of the controller\r
310 that is being managed by a driver.\r
311\r
312 This function retrieves the user readable name of the controller specified by\r
313 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
314 driver specified by This has a user readable name in the language specified by\r
315 Language, then a pointer to the controller name is returned in ControllerName,\r
316 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
317 managing the controller specified by ControllerHandle and ChildHandle,\r
318 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
319 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
320\r
321 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
322 EFI_COMPONENT_NAME_PROTOCOL instance.\r
323 @param ControllerHandle The handle of a controller that the driver\r
324 specified by This is managing. This handle\r
325 specifies the controller whose name is to be\r
326 returned.\r
327 @param ChildHandle The handle of the child controller to retrieve\r
328 the name of. This is an optional parameter that\r
329 may be NULL. It will be NULL for device\r
330 drivers. It will also be NULL for a bus drivers\r
331 that wish to retrieve the name of the bus\r
332 controller. It will not be NULL for a bus\r
333 driver that wishes to retrieve the name of a\r
334 child controller.\r
335 @param Language A pointer to a Null-terminated ASCII string\r
336 array indicating the language. This is the\r
337 language of the driver name that the caller is\r
338 requesting, and it must match one of the\r
339 languages specified in SupportedLanguages. The\r
340 number of languages supported by a driver is up\r
341 to the driver writer. Language is specified in\r
0254efc0 342 RFC 4646 or ISO 639-2 language code format.\r
b4e73a63 343 @param ControllerName A pointer to the Unicode string to return.\r
344 This Unicode string is the name of the\r
345 controller specified by ControllerHandle and\r
346 ChildHandle in the language specified by\r
347 Language from the point of view of the driver\r
348 specified by This.\r
349\r
350 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
351 the language specified by Language for the\r
352 driver specified by This was returned in\r
353 DriverName.\r
354 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
355 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
356 EFI_HANDLE.\r
357 @retval EFI_INVALID_PARAMETER Language is NULL.\r
358 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
359 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
360 managing the controller specified by\r
361 ControllerHandle and ChildHandle.\r
362 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
363 the language specified by Language.\r
364\r
365**/\r
366EFI_STATUS\r
367EFIAPI\r
368UsbKeyboardComponentNameGetControllerName (\r
369 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
370 IN EFI_HANDLE ControllerHandle,\r
371 IN EFI_HANDLE ChildHandle OPTIONAL,\r
372 IN CHAR8 *Language,\r
373 OUT CHAR16 **ControllerName\r
374 );\r
375\r
5899f27e 376//\r
377// Functions of Simple Text Input Protocol\r
378//\r
379/**\r
b4e73a63 380 Reset the input device and optionaly run diagnostics\r
5899f27e 381\r
382 There are 2 types of reset for USB keyboard.\r
383 For non-exhaustive reset, only keyboard buffer is cleared.\r
384 For exhaustive reset, in addition to clearance of keyboard buffer, the hardware status\r
385 is also re-initialized.\r
386\r
b4e73a63 387 @param This Protocol instance pointer.\r
388 @param ExtendedVerification Driver may perform diagnostics on reset.\r
5899f27e 389\r
b4e73a63 390 @retval EFI_SUCCESS The device was reset.\r
391 @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset.\r
5899f27e 392\r
393**/\r
394EFI_STATUS\r
395EFIAPI\r
396USBKeyboardReset (\r
397 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
398 IN BOOLEAN ExtendedVerification\r
399 );\r
400\r
401/**\r
b4e73a63 402 Reads the next keystroke from the input device.\r
5899f27e 403\r
404 @param This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.\r
405 @param Key A pointer to a buffer that is filled in with the keystroke\r
406 information for the key that was pressed.\r
407\r
b4e73a63 408 @retval EFI_SUCCESS The keystroke information was returned.\r
409 @retval EFI_NOT_READY There was no keystroke data availiable.\r
410 @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to\r
411 hardware errors.\r
5899f27e 412\r
413**/\r
414EFI_STATUS\r
415EFIAPI\r
416USBKeyboardReadKeyStroke (\r
417 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
418 OUT EFI_INPUT_KEY *Key\r
419 );\r
420\r
66aa04e4 421//\r
422// Simple Text Input Ex protocol functions\r
423//\r
a7022cec 424/**\r
b4e73a63 425 Resets the input device hardware.\r
a7022cec 426\r
b4e73a63 427 The Reset() function resets the input device hardware. As part\r
428 of initialization process, the firmware/device will make a quick\r
429 but reasonable attempt to verify that the device is functioning.\r
430 If the ExtendedVerification flag is TRUE the firmware may take\r
431 an extended amount of time to verify the device is operating on\r
432 reset. Otherwise the reset operation is to occur as quickly as\r
433 possible. The hardware verification process is not defined by\r
434 this specification and is left up to the platform firmware or\r
435 driver to implement.\r
a7022cec 436\r
b4e73a63 437 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r
438\r
439 @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
440 verification operation of the device during reset.\r
441\r
442 @retval EFI_SUCCESS The device was reset.\r
443 @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r
a7022cec 444\r
445**/\r
66aa04e4 446EFI_STATUS\r
447EFIAPI\r
448USBKeyboardResetEx (\r
449 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
450 IN BOOLEAN ExtendedVerification\r
ed66e1bc 451 );\r
66aa04e4 452\r
a7022cec 453/**\r
b4e73a63 454 Reads the next keystroke from the input device.\r
66aa04e4 455\r
b4e73a63 456 @param This Protocol instance pointer.\r
457 @param KeyData A pointer to a buffer that is filled in with the keystroke\r
458 state data for the key that was pressed.\r
66aa04e4 459\r
b4e73a63 460 @retval EFI_SUCCESS The keystroke information was returned.\r
461 @retval EFI_NOT_READY There was no keystroke data available.\r
462 @retval EFI_DEVICE_ERROR The keystroke information was not returned due to\r
463 hardware errors.\r
464 @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
66aa04e4 465\r
a7022cec 466**/\r
66aa04e4 467EFI_STATUS\r
468EFIAPI\r
469USBKeyboardReadKeyStrokeEx (\r
470 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
471 OUT EFI_KEY_DATA *KeyData\r
ed66e1bc 472 );\r
66aa04e4 473\r
a7022cec 474/**\r
475 Set certain state for the input device.\r
66aa04e4 476\r
a7022cec 477 @param This Protocol instance pointer.\r
478 @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
479 state for the input device.\r
66aa04e4 480\r
b4e73a63 481 @retval EFI_SUCCESS The device state was set appropriately.\r
482 @retval EFI_DEVICE_ERROR The device is not functioning correctly and could\r
483 not have the setting adjusted.\r
484 @retval EFI_UNSUPPORTED The device does not support the ability to have its state set.\r
a7022cec 485 @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r
66aa04e4 486\r
a7022cec 487**/\r
66aa04e4 488EFI_STATUS\r
489EFIAPI\r
490USBKeyboardSetState (\r
491 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
492 IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
ed66e1bc 493 );\r
66aa04e4 494\r
a7022cec 495/**\r
496 Register a notification function for a particular keystroke for the input device.\r
497\r
498 @param This Protocol instance pointer.\r
499 @param KeyData A pointer to a buffer that is filled in with the keystroke\r
500 information data for the key that was pressed.\r
501 @param KeyNotificationFunction Points to the function to be called when the key\r
502 sequence is typed specified by KeyData.\r
503 @param NotifyHandle Points to the unique handle assigned to the registered notification.\r
504\r
505 @retval EFI_SUCCESS The notification function was registered successfully.\r
506 @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.\r
b4e73a63 507 @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle or KeyNotificationFunction is NULL.\r
a7022cec 508\r
509**/\r
66aa04e4 510EFI_STATUS\r
511EFIAPI\r
512USBKeyboardRegisterKeyNotify (\r
513 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
514 IN EFI_KEY_DATA *KeyData,\r
515 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
516 OUT EFI_HANDLE *NotifyHandle\r
ed66e1bc 517 );\r
66aa04e4 518\r
a7022cec 519/**\r
520 Remove a registered notification function from a particular keystroke.\r
521\r
522 @param This Protocol instance pointer.\r
523 @param NotificationHandle The handle of the notification function being unregistered.\r
524\r
525 @retval EFI_SUCCESS The notification function was unregistered successfully.\r
b4e73a63 526 @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid\r
527 @retval EFI_NOT_FOUND Cannot find the matching entry in database.\r
a7022cec 528\r
529**/\r
66aa04e4 530EFI_STATUS\r
531EFIAPI\r
532USBKeyboardUnregisterKeyNotify (\r
533 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
534 IN EFI_HANDLE NotificationHandle\r
ed66e1bc 535 );\r
66aa04e4 536\r
5899f27e 537/**\r
b4e73a63 538 Event notification function registered for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx\r
539 and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey.\r
5899f27e 540\r
541 @param Event Event to be signaled when a key is pressed.\r
542 @param Context Points to USB_KB_DEV instance.\r
543\r
544**/\r
545VOID\r
546EFIAPI\r
547USBKeyboardWaitForKey (\r
548 IN EFI_EVENT Event,\r
549 IN VOID *Context\r
550 );\r
551\r
552/**\r
553 Free keyboard notify list.\r
554\r
b4e73a63 555 @param NotifyList The keyboard notify list to free.\r
5899f27e 556\r
557 @retval EFI_SUCCESS Free the notify list successfully.\r
b4e73a63 558 @retval EFI_INVALID_PARAMETER NotifyList is NULL.\r
5899f27e 559\r
560**/\r
561EFI_STATUS\r
5899f27e 562KbdFreeNotifyList (\r
b4e73a63 563 IN OUT LIST_ENTRY *NotifyList\r
5899f27e 564 );\r
565\r
5899f27e 566/**\r
b4e73a63 567 Check whether the pressed key matches a registered key or not.\r
5899f27e 568\r
b4e73a63 569 @param RegsiteredData A pointer to keystroke data for the key that was registered.\r
570 @param InputData A pointer to keystroke data for the key that was pressed.\r
5899f27e 571\r
572 @retval TRUE Key pressed matches a registered key.\r
b4e73a63 573 @retval FLASE Key pressed does not matche a registered key.\r
5899f27e 574\r
575**/\r
576BOOLEAN\r
5899f27e 577IsKeyRegistered (\r
578 IN EFI_KEY_DATA *RegsiteredData,\r
579 IN EFI_KEY_DATA *InputData\r
580 );\r
581\r
c1fd2767
RN
582/**\r
583 Timer handler to convert the key from USB.\r
584\r
585 @param Event Indicates the event that invoke this function.\r
586 @param Context Indicates the calling context.\r
587**/\r
588VOID\r
589EFIAPI\r
590USBKeyboardTimerHandler (\r
591 IN EFI_EVENT Event,\r
592 IN VOID *Context\r
593 );\r
594\r
ed838d0c 595#endif\r
66aa04e4 596\r