xref: /DragonStub/inc/eficonex.h (revision f412fd2a1a248b546b7085648dece8d908077fab)
1 #ifndef _EFI_CONEX_H
2 #define _EFI_CONEX_H
3 
4 /*++
5 
6 Copyright (c) 2020 Kagurazaka Kotori <kagurazakakotori@gmail.com>
7 
8 Module Name:
9 
10     eficonex.h
11 
12 Abstract:
13 
14     EFI console extension protocols
15 
16 --*/
17 
18 //
19 // Simple Text Input Ex Protocol
20 //
21 
22 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
23     { 0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa} }
24 
25 INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
26 
27 typedef UINT8 EFI_KEY_TOGGLE_STATE;
28 
29 typedef struct EFI_KEY_STATE {
30     UINT32                                         KeyShiftState;
31     EFI_KEY_TOGGLE_STATE                           KeyToggleState;
32 } EFI_KEY_STATE;
33 
34 typedef struct {
35     EFI_INPUT_KEY                                  Key;
36     EFI_KEY_STATE                                  KeyState;
37 } EFI_KEY_DATA;
38 
39 // Shift states
40 #define EFI_SHIFT_STATE_VALID                      0x80000000
41 #define EFI_RIGHT_SHIFT_PRESSED                    0x00000001
42 #define EFI_LEFT_SHIFT_PRESSED                     0x00000002
43 #define EFI_RIGHT_CONTROL_PRESSED                  0x00000004
44 #define EFI_LEFT_CONTROL_PRESSED                   0x00000008
45 #define EFI_RIGHT_ALT_PRESSED                      0x00000010
46 #define EFI_LEFT_ALT_PRESSED                       0x00000020
47 #define EFI_RIGHT_LOGO_PRESSED                     0x00000040
48 #define EFI_LEFT_LOGO_PRESSED                      0x00000080
49 #define EFI_MENU_KEY_PRESSED                       0x00000100
50 #define EFI_SYS_REQ_PRESSED                        0x00000200
51 
52 // Toggle states
53 #define EFI_TOGGLE_STATE_VALID                     0x80
54 #define EFI_KEY_STATE_EXPOSED                      0x40
55 #define EFI_SCROLL_LOCK_ACTIVE                     0x01
56 #define EFI_NUM_LOCK_ACTIVE                        0x02
57 #define EFI_CAPS_LOCK_ACTIVE                       0x04
58 
59 typedef
60 EFI_STATUS
61 (EFIAPI *EFI_INPUT_RESET_EX) (
62     IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   *This,
63     IN BOOLEAN                                     ExtendedVerification
64     );
65 
66 typedef
67 EFI_STATUS
68 (EFIAPI *EFI_INPUT_READ_KEY_EX) (
69     IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   *This,
70     OUT EFI_KEY_DATA                               *KeyData
71     );
72 
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_SET_STATE) (
76     IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   *This,
77     IN EFI_KEY_TOGGLE_STATE                        *KeyToggleState
78     );
79 
80 typedef
81 EFI_STATUS
82 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
83     IN EFI_KEY_DATA                                *KeyData
84     );
85 
86 typedef
87 EFI_STATUS
88 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
89     IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   *This,
90     IN EFI_KEY_DATA                                *KeyData,
91     IN EFI_KEY_NOTIFY_FUNCTION                     KeyNotificationFunction,
92     OUT VOID                                       **NotifyHandle
93     );
94 
95 typedef
96 EFI_STATUS
97 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
98     IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   *This,
99     IN VOID                                        *NotificationHandle
100     );
101 
102 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
103     EFI_INPUT_RESET_EX                             Reset;
104     EFI_INPUT_READ_KEY_EX                          ReadKeyStrokeEx;
105     EFI_EVENT                                      WaitForKeyEx;
106     EFI_SET_STATE                                  SetState;
107     EFI_REGISTER_KEYSTROKE_NOTIFY                  RegisterKeyNotify;
108     EFI_UNREGISTER_KEYSTROKE_NOTIFY                UnregisterKeyNotify;
109 } EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
110 
111 #endif
112