OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcTypingLib.h
Go to the documentation of this file.
1
6#ifndef OC_TYPING_LIB_H
7#define OC_TYPING_LIB_H
8
9#include <Uefi.h>
10#include <Protocol/AppleEvent.h>
11#include <Library/DebugLib.h>
12
13#if !defined (OC_TRACE_TYPING)
14#define OC_TRACE_TYPING DEBUG_VERBOSE
15#endif
16
17//
18// Define OC_TRACE_KEY_TIMES to allocate additional memory and enable
19// additional code to print time in millis at which key events were recieved.
20// Key received times in TSC units are quickly stored in buffer, then more
21// slowly converted to millis and printed later, as dequeued.
22// Has effect on NOOPT and DEBUG builds only.
23//
24
25// #define OC_TRACE_KEY_TIMES
26
27//
28// Max. num. keystrokes buffered is one less than buffer size.
29// 20 would be 1s of keystrokes at 50ms repeat, and it also
30// gives a fair size to handle any user key mashing.
31//
32#define OC_TYPING_BUFFER_SIZE 21
33
34#pragma pack(1)
35
36typedef PACKED struct {
40
41typedef PACKED struct {
44 UINT16 Pad1;
46 UINTN Head;
47 UINTN Tail;
48 UINT64 *KeyTimes; // only used in DEBUG builds with OC_TRACE_KEY_TIMES defined
50
51#pragma pack()
52
62EFI_STATUS
64 OUT OC_TYPING_CONTEXT **Context
65 );
66
76EFI_STATUS
78 IN OC_TYPING_CONTEXT **Context
79 );
80
89VOID
91 IN OC_TYPING_CONTEXT *Context,
92 OUT APPLE_MODIFIER_MAP *Modifiers,
94 OUT CHAR16 *UnicodeChar
95 );
96
103VOID
105 IN OC_TYPING_CONTEXT *Context
106 );
107
108#endif // OC_TYPING_LIB_H
VOID * APPLE_EVENT_HANDLE
Definition AppleEvent.h:95
APPLE_HID_USAGE APPLE_KEY_CODE
Definition AppleHid.h:317
UINT16 APPLE_MODIFIER_MAP
Definition AppleHid.h:102
CHAR16 UnicodeChar
Definition OcTypingLib.h:38
APPLE_MODIFIER_MAP CurrentModifiers
Definition OcTypingLib.h:43
UINTN Head
Definition OcTypingLib.h:46
EFI_STATUS OcUnregisterTypingHandler(IN OC_TYPING_CONTEXT **Context)
UINTN Tail
Definition OcTypingLib.h:47
#define OC_TYPING_BUFFER_SIZE
Definition OcTypingLib.h:32
OC_TYPING_BUFFER_ENTRY Buffer[OC_TYPING_BUFFER_SIZE]
Definition OcTypingLib.h:42
APPLE_KEY_CODE AppleKeyCode
Definition OcTypingLib.h:37
EFI_STATUS OcRegisterTypingHandler(OUT OC_TYPING_CONTEXT **Context)
Definition OcTypingLib.c:91
VOID OcGetNextKeystroke(IN OC_TYPING_CONTEXT *Context, OUT APPLE_MODIFIER_MAP *Modifiers, OUT APPLE_KEY_CODE *AppleKeyCode, OUT CHAR16 *UnicodeChar)
UINT16 Pad1
Definition OcTypingLib.h:44
PACKED struct @7 OC_TYPING_CONTEXT
APPLE_EVENT_HANDLE Handle
Definition OcTypingLib.h:45
PACKED struct @6 OC_TYPING_BUFFER_ENTRY
VOID OcFlushTypingBuffer(IN OC_TYPING_CONTEXT *Context)
UINT64 * KeyTimes
Definition OcTypingLib.h:48