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