summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-08 21:28:22 +0800
committerLeif Lindholm <leif.lindholm@linaro.org>2018-04-30 17:58:14 +0100
commit1df5fb2d83d9eca2d3b4b87fab7a0ec9f288cb6f (patch)
tree3560045ac9519f002e13f17a55ba461589b8307f /EmbeddedPkg/Include
parent8fe18cba7694a1d95699a08ff2491ffa04b0661d (diff)
downloadedk2-1df5fb2d83d9eca2d3b4b87fab7a0ec9f288cb6f.tar.gz
edk2-1df5fb2d83d9eca2d3b4b87fab7a0ec9f288cb6f.tar.bz2
edk2-1df5fb2d83d9eca2d3b4b87fab7a0ec9f288cb6f.zip
EmbeddedPkg/Drivers: add virtual keyboard driver
This driver is used to simulate a keyboard. For example, user could read GPIO setting or data from RAM address. If the value matches the expected pattern, it could trigger a key pressed event. User needs to implement hooks of PLATFORM_VIRTUAL_KBD_PROTOCOL. There're 4 hooks in this protocol. Register(): Quote the interface that user needs. For example, user needs to locate GPIO protocol if he wants to simulate a GPIO value as a key. Reset(): Do the initialization before reading value. Query(): Read value. If the value matches the expected pattern, trigger a key pressed event. Clear(): Clean the value if necessary. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'EmbeddedPkg/Include')
-rw-r--r--EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h b/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h
new file mode 100644
index 0000000000..c64d21e45c
--- /dev/null
+++ b/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h
@@ -0,0 +1,65 @@
+/** @file
+
+ Copyright (c) 2018, Linaro. All rights reserved.
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __PLATFORM_VIRTUAL_KEYBOARD_H__
+#define __PLATFORM_VIRTUAL_KEYBOARD_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _PLATFORM_VIRTUAL_KBD_PROTOCOL PLATFORM_VIRTUAL_KBD_PROTOCOL;
+
+typedef struct _VIRTUAL_KBD_KEY VIRTUAL_KBD_KEY;
+
+#define VIRTUAL_KEYBOARD_KEY_SIGNATURE SIGNATURE_32 ('v', 'k', 'b', 'd')
+
+struct _VIRTUAL_KBD_KEY {
+ UINTN Signature;
+ EFI_INPUT_KEY Key;
+};
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_REGISTER) (
+ IN VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_RESET) (
+ IN VOID
+ );
+
+typedef
+BOOLEAN
+(EFIAPI *PLATFORM_VIRTUAL_KBD_QUERY) (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_CLEAR) (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ );
+
+struct _PLATFORM_VIRTUAL_KBD_PROTOCOL {
+ PLATFORM_VIRTUAL_KBD_REGISTER Register;
+ PLATFORM_VIRTUAL_KBD_RESET Reset;
+ PLATFORM_VIRTUAL_KBD_QUERY Query;
+ PLATFORM_VIRTUAL_KBD_CLEAR Clear;
+};
+
+extern EFI_GUID gPlatformVirtualKeyboardProtocolGuid;
+
+#endif /* __PLATFORM_VIRTUAL_KEYBOARD_H__ */