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