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