]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextInEx.h
Update EFI_SIMPLE_TEXT_INPUT_EX protocol definitions according to UEFI spec 2.1b
[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 - 2007, 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_PROTOCOL_EX
39 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
40 is defined in this section.
41
42 @param ExtendedVerification Indicates that the driver may
43 perform a more exhaustive
44 verification operation of the
45 device during reset.
46
47
48 @retval EFI_SUCCESS The device was reset.
49
50 @retval EFI_DEVICE_ERROR The device is not functioning
51 correctly and could not be reset.
52
53 **/
54 typedef
55 EFI_STATUS
56 (EFIAPI *EFI_INPUT_RESET_EX) (
57 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
58 IN BOOLEAN ExtendedVerification
59 );
60
61
62 //
63 // EFI_KEY_TOGGLE_STATE
64 //
65 typedef UINT8 EFI_KEY_TOGGLE_STATE;
66
67 /**
68 Definition of EFI_KEY_STATE
69
70 @param KeyShiftState Reflects the currently pressed shift
71 modifiers for the input device. The
72 returned value is valid only if the high
73 order bit has been set.
74
75 @param KeyToggleState Reflects the current internal state of
76 various toggled attributes. The returned
77 value is valid only if the high order
78 bit has been set.
79
80 **/
81 typedef struct _EFI_KEY_STATE {
82 UINT32 KeyShiftState;
83 EFI_KEY_TOGGLE_STATE KeyToggleState;
84 } EFI_KEY_STATE;
85
86 /**
87 Definition of EFI_KEY_DATA.
88
89 @param Key The EFI scan code and Unicode value returned from
90 the input device.
91
92 @param KeyState The current state of various toggled
93 attributes as well as input modifier values.
94
95 **/
96 typedef struct {
97 EFI_INPUT_KEY Key;
98 EFI_KEY_STATE KeyState;
99 } EFI_KEY_DATA;
100
101 //
102 // Any Shift or Toggle State that is valid should have
103 // high order bit set.
104 //
105 // Shift state
106 //
107 #define EFI_SHIFT_STATE_VALID 0x80000000
108 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
109 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
110 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
111 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
112 #define EFI_RIGHT_ALT_PRESSED 0x00000010
113 #define EFI_LEFT_ALT_PRESSED 0x00000020
114 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
115 #define EFI_LEFT_LOGO_PRESSED 0x00000080
116 #define EFI_MENU_KEY_PRESSED 0x00000100
117 #define EFI_SYS_REQ_PRESSED 0x00000200
118
119 //
120 // Toggle state
121 //
122 #define EFI_TOGGLE_STATE_VALID 0x80
123 #define EFI_SCROLL_LOCK_ACTIVE 0x01
124 #define EFI_NUM_LOCK_ACTIVE 0x02
125 #define EFI_CAPS_LOCK_ACTIVE 0x04
126
127 //
128 // EFI Scan codes
129 //
130 #define SCAN_F13 0x0068
131 #define SCAN_F14 0x0069
132 #define SCAN_F15 0x006A
133 #define SCAN_F16 0x006B
134 #define SCAN_F17 0x006C
135 #define SCAN_F18 0x006D
136 #define SCAN_F19 0x006E
137 #define SCAN_F20 0x006F
138 #define SCAN_F21 0x0070
139 #define SCAN_F22 0x0071
140 #define SCAN_F23 0x0072
141 #define SCAN_F24 0x0073
142 #define SCAN_MUTE 0x007F
143 #define SCAN_VOLUME_UP 0x0080
144 #define SCAN_VOLUME_DOWN 0x0081
145 #define SCAN_BRIGHTNESS_UP 0x0100
146 #define SCAN_BRIGHTNESS_DOWN 0x0101
147 #define SCAN_SUSPEND 0x0102
148 #define SCAN_HIBERNATE 0x0103
149 #define SCAN_TOGGLE_DISPLAY 0x0104
150 #define SCAN_RECOVERY 0x0105
151 #define SCAN_EJECT 0x0106
152
153 /**
154 The function reads the next keystroke from the input device. If
155 there is no pending keystroke the function returns
156 EFI_NOT_READY. If there is a pending keystroke, then
157 KeyData.Key.ScanCode is the EFI scan code defined in Error!
158 Reference source not found.. The KeyData.Key.UnicodeChar is the
159 actual printable character or is zero if the key does not
160 represent a printable character (control key, function key,
161 etc.). The KeyData.KeyState is shift state for the character
162 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
163 When interpreting the data from this function, it should be
164 noted that if a class of printable characters that are
165 normally adjusted by shift modifiers (e.g. Shift Key + "f"
166 key) would be presented solely as a KeyData.Key.UnicodeChar
167 without the associated shift state. So in the previous example
168 of a Shift Key + "f" key being pressed, the only pertinent
169 data returned would be KeyData.Key.UnicodeChar with the value
170 of "F". This of course would not typically be the case for
171 non-printable characters such as the pressing of the Right
172 Shift Key + F10 key since the corresponding returned data
173 would be reflected both in the KeyData.KeyState.KeyShiftState
174 and KeyData.Key.ScanCode values. UEFI drivers which implement
175 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
176 KeyData.Key and KeyData.KeyState values. These drivers must
177 always return the most current state of
178 KeyData.KeyState.KeyShiftState and
179 KeyData.KeyState.KeyToggleState. It should also be noted that
180 certain input devices may not be able to produce shift or toggle
181 state information, and in those cases the high order bit in the
182 respective Toggle and Shift state fields should not be active.
183
184
185 @param This A pointer to the
186 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.
187
188 @param KeyData A pointer to a buffer that is filled in with
189 the keystroke state data for the key that was
190 pressed.
191
192
193 @retval EFI_SUCCESS The keystroke information was
194 returned.
195
196 @retval EFI_NOT_READY There was no keystroke data available.
197 EFI_DEVICE_ERROR The keystroke
198 information was not returned due to
199 hardware errors.
200
201
202 **/
203 typedef
204 EFI_STATUS
205 (EFIAPI *EFI_INPUT_READ_KEY_EX) (
206 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
207 OUT EFI_KEY_DATA *KeyData
208 );
209
210 /**
211 The SetState() function allows the input device hardware to
212 have state settings adjusted.
213
214 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
215 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
216 is defined in this section.
217
218 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
219 set the state for the input device.
220
221
222 @retval EFI_SUCCESS The device state was set appropriately.
223
224 @retval EFI_DEVICE_ERROR The device is not functioning
225 correctly and could not have the
226 setting adjusted.
227
228 @retval EFI_UNSUPPORTED The device does not support the
229 ability to have its state set.
230
231 **/
232 typedef
233 EFI_STATUS
234 (EFIAPI *EFI_SET_STATE) (
235 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
236 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
237 );
238
239 //
240 // EFI_KEY_NOTIFY
241 //
242 typedef
243 EFI_STATUS
244 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
245 IN EFI_KEY_DATA *KeyData
246 );
247
248 /**
249 The RegisterKeystrokeNotify() function registers a function
250 which will be called when a specified keystroke will occur.
251
252 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
253 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
254 is defined in this section.
255
256 @param KeyData A pointer to a buffer that is filled in with
257 the keystroke information for the key that was
258 pressed.
259
260 @param KeyNotificationFunction Points to the function to be
261 called when the key sequence
262 is typed specified by KeyData.
263
264
265 @param NotifyHandle Points to the unique handle assigned to
266 the registered notification.
267
268 @retval EFI_SUCCESS The device state was set
269 appropriately.
270
271 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
272 data structures.
273
274 **/
275 typedef
276 EFI_STATUS
277 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
278 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
279 IN EFI_KEY_DATA *KeyData,
280 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
281 OUT EFI_HANDLE *NotifyHandle
282 );
283
284 /**
285 The UnregisterKeystrokeNotify() function removes the
286 notification which was previously registered.
287
288 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
289 instance.
290
291 @param NotificationHandle The handle of the notification
292 function being unregistered.
293
294 @retval EFI_SUCCESS The device state was set appropriately.
295
296 @retval EFI_INVALID_PARAMETER The NotificationHandle is
297 invalid.
298
299 **/
300 typedef
301 EFI_STATUS
302 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
303 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
304 IN EFI_HANDLE NotificationHandle
305 );
306
307
308 /**
309 The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
310 device. It is an extension to the Simple Text Input protocol
311 which allows a variety of extended shift state information to be
312 returned.
313
314 @param Reset Reset the ConsoleIn device. See Reset().
315
316 @param ReadKeyStrokeEx Returns the next input character. See
317 ReadKeyStrokeEx().
318
319 @param WaitForKeyEx Event to use with WaitForEvent() to wait
320 for a key to be available.
321
322 @param SetState Set the EFI_KEY_TOGGLE_STATE state settings
323 for the input device.
324
325 @param RegisterKeyNotify Register a notification function to
326 be called when a given key sequence
327 is hit.
328
329 @param UnregisterKeyNotifyRemoves A specific notification
330 function.
331
332 **/
333 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
334 EFI_INPUT_RESET_EX Reset;
335 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
336 EFI_EVENT WaitForKeyEx;
337 EFI_SET_STATE SetState;
338 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
339 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
340 };
341
342
343 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
344
345 #endif
346