]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextInEx.h
1. Clean up MdePkg internal header files
[mirror_edk2.git] / MdePkg / Include / Protocol / SimpleTextInEx.h
1 /** @file
2 The file defines the protocol to obtain input from the
3 ConsoleIn device. The EFI specification requires that the
4 EFI_SIMPLE_TEXT_INPUT_PROTOCOL supports the same languages as
5 the corresponding
6
7 Copyright (c) 2006 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef __SIMPLE_TEXT_IN_EX_H__
19 #define __SIMPLE_TEXT_IN_EX_H__
20
21 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
22 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
23
24
25 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
26
27 /**
28 The Reset() function resets the input device hardware. As part
29 of initialization process, the firmware/device will make a quick
30 but reasonable attempt to verify that the device is functioning.
31 If the ExtendedVerification flag is TRUE the firmware may take
32 an extended amount of time to verify the device is operating on
33 reset. Otherwise the reset operation is to occur as quickly as
34 possible. The hardware verification process is not defined by
35 this specification and is left up to the platform firmware or
36 driver to implement.
37
38 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
39
40 @param ExtendedVerification Indicates that the driver may
41 perform a more exhaustive
42 verification operation of the
43 device during reset.
44
45
46 @retval EFI_SUCCESS The device was reset.
47
48 @retval EFI_DEVICE_ERROR The device is not functioning
49 correctly and could not be reset.
50
51 **/
52 typedef
53 EFI_STATUS
54 (EFIAPI *EFI_INPUT_RESET_EX)(
55 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
56 IN BOOLEAN ExtendedVerification
57 );
58
59
60 ///
61 /// EFI_KEY_TOGGLE_STATE. The toggle state are defined.
62 /// They are EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE
63 /// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE
64 ///
65 typedef UINT8 EFI_KEY_TOGGLE_STATE;
66
67 typedef struct _EFI_KEY_STATE {
68 ///
69 /// Reflects the currently pressed shift
70 /// modifiers for the input device. The
71 /// returned value is valid only if the high
72 /// order bit has been set.
73 ///
74 UINT32 KeyShiftState;
75 ///
76 /// Reflects the current internal state of
77 /// various toggled attributes. The returned
78 /// value is valid only if the high order
79 /// bit has been set.
80 ///
81 EFI_KEY_TOGGLE_STATE KeyToggleState;
82 } EFI_KEY_STATE;
83
84 typedef struct {
85 ///
86 /// The EFI scan code and Unicode value returned from the input device.
87 ///
88 EFI_INPUT_KEY Key;
89 ///
90 /// The current state of various toggled attributes as well as input modifier values.
91 ///
92 EFI_KEY_STATE KeyState;
93 } EFI_KEY_DATA;
94
95 //
96 // Any Shift or Toggle State that is valid should have
97 // high order bit set.
98 //
99 // Shift state
100 //
101 #define EFI_SHIFT_STATE_VALID 0x80000000
102 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
103 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
104 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
105 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
106 #define EFI_RIGHT_ALT_PRESSED 0x00000010
107 #define EFI_LEFT_ALT_PRESSED 0x00000020
108 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
109 #define EFI_LEFT_LOGO_PRESSED 0x00000080
110 #define EFI_MENU_KEY_PRESSED 0x00000100
111 #define EFI_SYS_REQ_PRESSED 0x00000200
112
113 //
114 // Toggle state
115 //
116 #define EFI_TOGGLE_STATE_VALID 0x80
117 #define EFI_SCROLL_LOCK_ACTIVE 0x01
118 #define EFI_NUM_LOCK_ACTIVE 0x02
119 #define EFI_CAPS_LOCK_ACTIVE 0x04
120
121 //
122 // EFI Scan codes
123 //
124 #define SCAN_F13 0x0068
125 #define SCAN_F14 0x0069
126 #define SCAN_F15 0x006A
127 #define SCAN_F16 0x006B
128 #define SCAN_F17 0x006C
129 #define SCAN_F18 0x006D
130 #define SCAN_F19 0x006E
131 #define SCAN_F20 0x006F
132 #define SCAN_F21 0x0070
133 #define SCAN_F22 0x0071
134 #define SCAN_F23 0x0072
135 #define SCAN_F24 0x0073
136 #define SCAN_MUTE 0x007F
137 #define SCAN_VOLUME_UP 0x0080
138 #define SCAN_VOLUME_DOWN 0x0081
139 #define SCAN_BRIGHTNESS_UP 0x0100
140 #define SCAN_BRIGHTNESS_DOWN 0x0101
141 #define SCAN_SUSPEND 0x0102
142 #define SCAN_HIBERNATE 0x0103
143 #define SCAN_TOGGLE_DISPLAY 0x0104
144 #define SCAN_RECOVERY 0x0105
145 #define SCAN_EJECT 0x0106
146
147 /**
148 The function reads the next keystroke from the input device. If
149 there is no pending keystroke the function returns
150 EFI_NOT_READY. If there is a pending keystroke, then
151 KeyData.Key.ScanCode is the EFI scan code defined in Error!
152 Reference source not found.. The KeyData.Key.UnicodeChar is the
153 actual printable character or is zero if the key does not
154 represent a printable character (control key, function key,
155 etc.). The KeyData.KeyState is shift state for the character
156 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
157 When interpreting the data from this function, it should be
158 noted that if a class of printable characters that are
159 normally adjusted by shift modifiers (e.g. Shift Key + "f"
160 key) would be presented solely as a KeyData.Key.UnicodeChar
161 without the associated shift state. So in the previous example
162 of a Shift Key + "f" key being pressed, the only pertinent
163 data returned would be KeyData.Key.UnicodeChar with the value
164 of "F". This of course would not typically be the case for
165 non-printable characters such as the pressing of the Right
166 Shift Key + F10 key since the corresponding returned data
167 would be reflected both in the KeyData.KeyState.KeyShiftState
168 and KeyData.Key.ScanCode values. UEFI drivers which implement
169 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
170 KeyData.Key and KeyData.KeyState values. These drivers must
171 always return the most current state of
172 KeyData.KeyState.KeyShiftState and
173 KeyData.KeyState.KeyToggleState. It should also be noted that
174 certain input devices may not be able to produce shift or toggle
175 state information, and in those cases the high order bit in the
176 respective Toggle and Shift state fields should not be active.
177
178
179 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
180
181 @param KeyData A pointer to a buffer that is filled in with
182 the keystroke state data for the key that was
183 pressed.
184
185
186 @retval EFI_SUCCESS The keystroke information was
187 returned.
188
189 @retval EFI_NOT_READY There was no keystroke data available.
190 EFI_DEVICE_ERROR The keystroke
191 information was not returned due to
192 hardware errors.
193
194
195 **/
196 typedef
197 EFI_STATUS
198 (EFIAPI *EFI_INPUT_READ_KEY_EX)(
199 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
200 OUT EFI_KEY_DATA *KeyData
201 );
202
203 /**
204 The SetState() function allows the input device hardware to
205 have state settings adjusted.
206
207 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
208
209 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
210 set the state for the input device.
211
212
213 @retval EFI_SUCCESS The device state was set appropriately.
214
215 @retval EFI_DEVICE_ERROR The device is not functioning
216 correctly and could not have the
217 setting adjusted.
218
219 @retval EFI_UNSUPPORTED The device does not support the
220 ability to have its state set.
221
222 **/
223 typedef
224 EFI_STATUS
225 (EFIAPI *EFI_SET_STATE)(
226 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
227 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
228 );
229
230 ///
231 /// The function will be called when the key sequence is typed specified by KeyData.
232 ///
233 typedef
234 EFI_STATUS
235 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
236 IN EFI_KEY_DATA *KeyData
237 );
238
239 /**
240 The RegisterKeystrokeNotify() function registers a function
241 which will be called when a specified keystroke will occur.
242
243 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
244
245 @param KeyData A pointer to a buffer that is filled in with
246 the keystroke information for the key that was
247 pressed.
248
249 @param KeyNotificationFunction Points to the function to be
250 called when the key sequence
251 is typed specified by KeyData.
252
253
254 @param NotifyHandle Points to the unique handle assigned to
255 the registered notification.
256
257 @retval EFI_SUCCESS The device state was set
258 appropriately.
259
260 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
261 data structures.
262
263 **/
264 typedef
265 EFI_STATUS
266 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
267 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
268 IN EFI_KEY_DATA *KeyData,
269 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
270 OUT EFI_HANDLE *NotifyHandle
271 );
272
273 /**
274 The UnregisterKeystrokeNotify() function removes the
275 notification which was previously registered.
276
277 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
278
279 @param NotificationHandle The handle of the notification
280 function being unregistered.
281
282 @retval EFI_SUCCESS The device state was set appropriately.
283
284 @retval EFI_INVALID_PARAMETER The NotificationHandle is
285 invalid.
286
287 **/
288 typedef
289 EFI_STATUS
290 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
291 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
292 IN EFI_HANDLE NotificationHandle
293 );
294
295
296 ///
297 /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
298 /// device. It is an extension to the Simple Text Input protocol
299 /// which allows a variety of extended shift state information to be
300 /// returned.
301 ///
302 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
303 EFI_INPUT_RESET_EX Reset;
304 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
305 ///
306 /// Event to use with WaitForEvent() to wait for a key to be available.
307 ///
308 EFI_EVENT WaitForKeyEx;
309 EFI_SET_STATE SetState;
310 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
311 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
312 };
313
314
315 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
316
317 #endif
318