]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Efi/Protocol/SimpleTextInputEx/SimpleTextInputEx.h
1c0fe726079afc82231bd8416328a11171abdb8c
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / SimpleTextInputEx / SimpleTextInputEx.h
1 /*++
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 SimpleTextInputEx.h
15
16 Abstract:
17
18 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL from the UEFI 2.1 specification.
19
20 This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
21 which exposes much more state and modifier information from the input device,
22 also allows one to register a notification for a particular keystroke.
23
24 --*/
25
26 #ifndef __SIMPLE_TEXT_INPUT_EX_H__
27 #define __SIMPLE_TEXT_INPUT_EX_H__
28
29 #include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
30
31 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
32 { \
33 0xdd9e7534, 0x7762, 0x4698, 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa\
34 }
35
36 EFI_FORWARD_DECLARATION (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
37
38 //
39 // Data structures
40 //
41
42 typedef UINT8 EFI_KEY_TOGGLE_STATE;
43 //
44 // Any Shift or Toggle State that is valid should have
45 // high order bit set.
46 //
47 typedef struct EFI_KEY_STATE {
48 UINT32 KeyShiftState;
49 EFI_KEY_TOGGLE_STATE KeyToggleState;
50 } EFI_KEY_STATE;
51
52 typedef struct {
53 EFI_INPUT_KEY Key;
54 EFI_KEY_STATE KeyState;
55 } EFI_KEY_DATA;
56
57 //
58 // Shift state
59 //
60 #define EFI_SHIFT_STATE_VALID 0x80000000
61 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
62 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
63 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
64 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
65 #define EFI_RIGHT_ALT_PRESSED 0x00000010
66 #define EFI_LEFT_ALT_PRESSED 0x00000020
67 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
68 #define EFI_LEFT_LOGO_PRESSED 0x00000080
69 #define EFI_MENU_KEY_PRESSED 0x00000100
70 #define EFI_SYS_REQ_PRESSED 0x00000200
71
72 //
73 // Toggle state
74 //
75 #define EFI_TOGGLE_STATE_VALID 0x80
76 #define EFI_SCROLL_LOCK_ACTIVE 0x01
77 #define EFI_NUM_LOCK_ACTIVE 0x02
78 #define EFI_CAPS_LOCK_ACTIVE 0x04
79
80 //
81 // EFI Scan codes
82 //
83 #define SCAN_F13 0x0068
84 #define SCAN_F14 0x0069
85 #define SCAN_F15 0x006A
86 #define SCAN_F16 0x006B
87 #define SCAN_F17 0x006C
88 #define SCAN_F18 0x006D
89 #define SCAN_F19 0x006E
90 #define SCAN_F20 0x006F
91 #define SCAN_F21 0x0070
92 #define SCAN_F22 0x0071
93 #define SCAN_F23 0x0072
94 #define SCAN_F24 0x0073
95 #define SCAN_MUTE 0x007F
96 #define SCAN_VOLUME_UP 0x0080
97 #define SCAN_VOLUME_DOWN 0x0081
98 #define SCAN_BRIGHTNESS_UP 0x0100
99 #define SCAN_BRIGHTNESS_DOWN 0x0101
100 #define SCAN_SUSPEND 0x0102
101 #define SCAN_HIBERNATE 0x0103
102 #define SCAN_TOGGLE_DISPLAY 0x0104
103 #define SCAN_RECOVERY 0x0105
104 #define SCAN_EJECT 0x0106
105
106
107 //
108 // EFI Key Notfication Function
109 //
110 typedef
111 EFI_STATUS
112 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
113 IN EFI_KEY_DATA *KeyData
114 )
115 ;
116
117 typedef
118 EFI_STATUS
119 (EFIAPI *EFI_INPUT_RESET_EX) (
120 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
121 IN BOOLEAN ExtendedVerification
122 )
123 /*++
124
125 Routine Description:
126 Reset the input device and optionaly run diagnostics
127
128 Arguments:
129 This - Protocol instance pointer.
130 ExtendedVerification - Driver may perform diagnostics on reset.
131
132 Returns:
133 EFI_SUCCESS - The device was reset.
134 EFI_DEVICE_ERROR - The device is not functioning properly and could
135 not be reset.
136
137 --*/
138 ;
139
140 typedef
141 EFI_STATUS
142 (EFIAPI *EFI_INPUT_READ_KEY_EX) (
143 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
144 OUT EFI_KEY_DATA *KeyData
145 )
146 /*++
147
148 Routine Description:
149 Reads the next keystroke from the input device. The WaitForKey Event can
150 be used to test for existance of a keystroke via WaitForEvent () call.
151
152 Arguments:
153 This - Protocol instance pointer.
154 KeyData - A pointer to a buffer that is filled in with the keystroke
155 state data for the key that was pressed.
156
157 Returns:
158 EFI_SUCCESS - The keystroke information was returned.
159 EFI_NOT_READY - There was no keystroke data availiable.
160 EFI_DEVICE_ERROR - The keystroke information was not returned due to
161 hardware errors.
162 EFI_INVALID_PARAMETER - KeyData is NULL.
163 --*/
164 ;
165
166 typedef
167 EFI_STATUS
168 (EFIAPI *EFI_SET_STATE) (
169 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
170 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
171 )
172 /*++
173
174 Routine Description:
175 Set certain state for the input device.
176
177 Arguments:
178 This - Protocol instance pointer.
179 KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
180 state for the input device.
181
182 Returns:
183 EFI_SUCCESS - The device state was set successfully.
184 EFI_DEVICE_ERROR - The device is not functioning correctly and could
185 not have the setting adjusted.
186 EFI_UNSUPPORTED - The device does not have the ability to set its state.
187 EFI_INVALID_PARAMETER - KeyToggleState is NULL.
188
189 --*/
190 ;
191
192 typedef
193 EFI_STATUS
194 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
195 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
196 IN EFI_KEY_DATA *KeyData,
197 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
198 OUT EFI_HANDLE *NotifyHandle
199 )
200 /*++
201
202 Routine Description:
203 Register a notification function for a particular keystroke for the input device.
204
205 Arguments:
206 This - Protocol instance pointer.
207 KeyData - A pointer to a buffer that is filled in with the keystroke
208 information data for the key that was pressed.
209 KeyNotificationFunction - Points to the function to be called when the key
210 sequence is typed specified by KeyData.
211 NotifyHandle - Points to the unique handle assigned to the registered notification.
212
213 Returns:
214 EFI_SUCCESS - The notification function was registered successfully.
215 EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
216 EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
217
218 --*/
219 ;
220
221 typedef
222 EFI_STATUS
223 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
224 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
225 IN EFI_HANDLE NotificationHandle
226 )
227 /*++
228
229 Routine Description:
230 Remove a registered notification function from a particular keystroke.
231
232 Arguments:
233 This - Protocol instance pointer.
234 NotificationHandle - The handle of the notification function being unregistered.
235
236 Returns:
237 EFI_SUCCESS - The notification function was unregistered successfully.
238 EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
239 EFI_NOT_FOUND - Can not find the matching entry in database.
240
241 --*/
242 ;
243
244 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
245 EFI_INPUT_RESET_EX Reset;
246 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
247 EFI_EVENT WaitForKeyEx;
248 EFI_SET_STATE SetState;
249 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
250 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
251 } EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
252
253 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
254
255 #endif