TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtualKeyboard.h
Go to the documentation of this file.
1
10#ifndef _VIRTUAL_KEYBOARD_H_
11#define _VIRTUAL_KEYBOARD_H_
12
14#include <Protocol/DevicePath.h>
18
19#include <Library/BaseLib.h>
21#include <Library/DebugLib.h>
23#include <Library/IoLib.h>
24#include <Library/PcdLib.h>
28#include <Library/UefiLib.h>
29
30//
31// Driver Binding Externs
32//
33extern EFI_DRIVER_BINDING_PROTOCOL gVirtualKeyboardDriverBinding;
34extern EFI_COMPONENT_NAME_PROTOCOL gVirtualKeyboardComponentName;
35extern EFI_COMPONENT_NAME2_PROTOCOL gVirtualKeyboardComponentName2;
36
37//
38// VIRTUAL Keyboard Defines
39//
40#define CHAR_SCANCODE 0xe0
41#define CHAR_ESC 0x1b
42
43#define KEYBOARD_TIMEOUT 65536 // 0.07s
44#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
45#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
46#define KEYBOARD_TIMER_INTERVAL 500000 // 0.5s
47
48#define QUEUE_MAX_COUNT 32
49
50#define KEYBOARD_SCAN_CODE_MAX_COUNT 32
51
52//
53// VIRTUAL Keyboard Device Structure
54//
55#define VIRTUAL_KEYBOARD_DEV_SIGNATURE SIGNATURE_32 ('V', 'K', 'B', 'D')
56#define VIRTUAL_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('v', 'k', 'c', 'n')
57
59 UINTN Signature;
60 EFI_KEY_DATA KeyData;
61 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
62 LIST_ENTRY NotifyEntry;
64
65typedef struct {
66 UINTN Front;
67 UINTN Rear;
68 EFI_KEY_DATA Buffer[QUEUE_MAX_COUNT];
70
71typedef struct {
72 UINT8 Buffer[KEYBOARD_SCAN_CODE_MAX_COUNT];
73 UINTN Head;
74 UINTN Tail;
76
77typedef struct {
78 UINTN Signature;
79 EFI_HANDLE Handle;
80 PLATFORM_VIRTUAL_KBD_PROTOCOL *PlatformVirtual;
82 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInputEx;
83
84 //
85 // Buffer storing EFI_KEY_DATA
86 //
87 SIMPLE_QUEUE Queue;
88 SIMPLE_QUEUE QueueForNotify;
89
90 //
91 // Notification Function List
92 //
93 LIST_ENTRY NotifyList;
94 EFI_EVENT KeyNotifyProcessEvent;
95 EFI_EVENT TimerEvent;
97
98#define VIRTUAL_KEYBOARD_DEV_FROM_THIS(a) CR (a, VIRTUAL_KEYBOARD_DEV, SimpleTextIn, VIRTUAL_KEYBOARD_DEV_SIGNATURE)
99#define TEXT_INPUT_EX_VIRTUAL_KEYBOARD_DEV_FROM_THIS(a) \
100 CR (a, \
101 VIRTUAL_KEYBOARD_DEV, \
102 SimpleTextInputEx, \
103 VIRTUAL_KEYBOARD_DEV_SIGNATURE \
104 )
105
106//
107// Global Variables
108//
109extern EFI_DRIVER_BINDING_PROTOCOL gVirtualKeyboardDriverBinding;
110
111//
112// Driver Binding Protocol functions
113//
114
127EFIAPI
130 IN EFI_HANDLE Controller,
131 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
132 );
133
147EFIAPI
150 IN EFI_HANDLE Controller,
151 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
152 );
153
168EFIAPI
171 IN EFI_HANDLE Controller,
172 IN UINTN NumberOfChildren,
173 IN EFI_HANDLE *ChildHandleBuffer
174 );
175
216EFIAPI
219 IN CHAR8 *Language,
220 OUT CHAR16 **DriverName
221 );
222
292EFIAPI
295 IN EFI_HANDLE ControllerHandle,
296 IN EFI_HANDLE ChildHandle OPTIONAL,
297 IN CHAR8 *Language,
298 OUT CHAR16 **ControllerName
299 );
300
301//
302// Simple Text Input Protocol functions
303//
304
316EFIAPI
319 IN BOOLEAN ExtendedVerification
320 );
321
334EFIAPI
337 IN BOOLEAN ExtendedVerification
338 );
339
355EFIAPI
358 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
359 );
360
378EFIAPI
381 IN EFI_KEY_DATA *KeyData,
382 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
383 OUT VOID **NotifyHandle
384 );
385
397EFIAPI
400 IN VOID *NotificationHandle
401 );
402
403//
404// Private worker functions
405//
406
418 IN OUT LIST_ENTRY *ListHead
419 );
420
433BOOLEAN
435 IN EFI_KEY_DATA *RegsiteredData,
436 IN EFI_KEY_DATA *InputData
437 );
438
446VOID
447EFIAPI
449 IN EFI_EVENT Event,
450 IN VOID *Context
451 );
452
460VOID
461EFIAPI
463 IN EFI_EVENT Event,
464 IN VOID *Context
465 );
466
476VOID
477EFIAPI
479 IN EFI_EVENT Event,
480 IN VOID *Context
481 );
482
489VOID
490EFIAPI
492 IN EFI_EVENT Event,
493 IN VOID *Context
494 );
495
508EFIAPI
511 OUT EFI_INPUT_KEY *Key
512 );
513
531EFIAPI
534 OUT EFI_KEY_DATA *KeyData
535 );
536
537#endif /* _VIRTUAL_KEYBOARD_H_ */
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT8 EFI_KEY_TOGGLE_STATE
EFI_STATUS(EFIAPI * EFI_KEY_NOTIFY_FUNCTION)(IN EFI_KEY_DATA *KeyData)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
VOID EFIAPI VirtualKeyboardWaitForKeyEx(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI KeyNotifyProcessHandler(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI VirtualKeyboardTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI VirtualKeyboardReadKeyStroke(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, OUT EFI_INPUT_KEY *Key)
EFI_STATUS EFIAPI VirtualKeyboardReset(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI VirtualKeyboardComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
Definition: ComponentName.c:86
EFI_STATUS EFIAPI VirtualKeyboardComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS VirtualKeyboardFreeNotifyList(IN OUT LIST_ENTRY *ListHead)
EFI_STATUS EFIAPI VirtualKeyboardRegisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT VOID **NotifyHandle)
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI VirtualKeyboardUnregisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle)
VOID EFIAPI VirtualKeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI VirtualKeyboardReadKeyStrokeEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
EFI_STATUS EFIAPI VirtualKeyboardResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI VirtualKeyboardSetState(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState)
BOOLEAN IsKeyRegistered(IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)