]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextInEx.h
Add definition of SCAN_PAUSE for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
[mirror_edk2.git] / MdePkg / Include / Protocol / SimpleTextInEx.h
1 /** @file
2 Simple Text Input Ex protocol from the UEFI 2.0 specification.
3
4 This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
5 which exposes much more state and modifier information from the input device,
6 also allows one to register a notification for a particular keystroke.
7
8 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #ifndef __SIMPLE_TEXT_IN_EX_H__
20 #define __SIMPLE_TEXT_IN_EX_H__
21
22 #include <Protocol/SimpleTextIn.h>
23
24 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
25 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
26
27
28 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
29
30 /**
31 The Reset() function resets the input device hardware. As part
32 of initialization process, the firmware/device will make a quick
33 but reasonable attempt to verify that the device is functioning.
34 If the ExtendedVerification flag is TRUE the firmware may take
35 an extended amount of time to verify the device is operating on
36 reset. Otherwise the reset operation is to occur as quickly as
37 possible. The hardware verification process is not defined by
38 this specification and is left up to the platform firmware or
39 driver to implement.
40
41 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
42
43 @param ExtendedVerification Indicates that the driver may
44 perform a more exhaustive
45 verification operation of the
46 device during reset.
47
48
49 @retval EFI_SUCCESS The device was reset.
50
51 @retval EFI_DEVICE_ERROR The device is not functioning
52 correctly and could not be reset.
53
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_INPUT_RESET_EX)(
58 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
59 IN BOOLEAN ExtendedVerification
60 );
61
62
63 ///
64 /// EFI_KEY_TOGGLE_STATE. The toggle states are defined.
65 /// They are: EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE
66 /// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE
67 ///
68 typedef UINT8 EFI_KEY_TOGGLE_STATE;
69
70 typedef struct _EFI_KEY_STATE {
71 ///
72 /// Reflects the currently pressed shift
73 /// modifiers for the input device. The
74 /// returned value is valid only if the high
75 /// order bit has been set.
76 ///
77 UINT32 KeyShiftState;
78 ///
79 /// Reflects the current internal state of
80 /// various toggled attributes. The returned
81 /// value is valid only if the high order
82 /// bit has been set.
83 ///
84 EFI_KEY_TOGGLE_STATE KeyToggleState;
85 } EFI_KEY_STATE;
86
87 typedef struct {
88 ///
89 /// The EFI scan code and Unicode value returned from the input device.
90 ///
91 EFI_INPUT_KEY Key;
92 ///
93 /// The current state of various toggled attributes as well as input modifier values.
94 ///
95 EFI_KEY_STATE KeyState;
96 } EFI_KEY_DATA;
97
98 //
99 // Any Shift or Toggle State that is valid should have
100 // high order bit set.
101 //
102 // Shift state
103 //
104 #define EFI_SHIFT_STATE_VALID 0x80000000
105 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
106 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
107 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
108 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
109 #define EFI_RIGHT_ALT_PRESSED 0x00000010
110 #define EFI_LEFT_ALT_PRESSED 0x00000020
111 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
112 #define EFI_LEFT_LOGO_PRESSED 0x00000080
113 #define EFI_MENU_KEY_PRESSED 0x00000100
114 #define EFI_SYS_REQ_PRESSED 0x00000200
115
116 //
117 // Toggle state
118 //
119 #define EFI_TOGGLE_STATE_VALID 0x80
120 #define EFI_SCROLL_LOCK_ACTIVE 0x01
121 #define EFI_NUM_LOCK_ACTIVE 0x02
122 #define EFI_CAPS_LOCK_ACTIVE 0x04
123
124 //
125 // EFI Scan codes
126 //
127 #define SCAN_F11 0x0015
128 #define SCAN_F12 0x0016
129 #define SCAN_PAUSE 0x0048
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 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
186
187 @param KeyData A pointer to a buffer that is filled in with
188 the keystroke state data for the key that was
189 pressed.
190
191
192 @retval EFI_SUCCESS The keystroke information was
193 returned.
194
195 @retval EFI_NOT_READY There was no keystroke data available.
196 EFI_DEVICE_ERROR The keystroke
197 information was not returned due to
198 hardware errors.
199
200
201 **/
202 typedef
203 EFI_STATUS
204 (EFIAPI *EFI_INPUT_READ_KEY_EX)(
205 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
206 OUT EFI_KEY_DATA *KeyData
207 );
208
209 /**
210 The SetState() function allows the input device hardware to
211 have state settings adjusted.
212
213 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
214
215 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
216 set the state for the input device.
217
218
219 @retval EFI_SUCCESS The device state was set appropriately.
220
221 @retval EFI_DEVICE_ERROR The device is not functioning
222 correctly and could not have the
223 setting adjusted.
224
225 @retval EFI_UNSUPPORTED The device does not support the
226 ability to have its state set.
227
228 **/
229 typedef
230 EFI_STATUS
231 (EFIAPI *EFI_SET_STATE)(
232 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
233 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
234 );
235
236 ///
237 /// The function will be called when the key sequence is typed specified by KeyData.
238 ///
239 typedef
240 EFI_STATUS
241 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
242 IN EFI_KEY_DATA *KeyData
243 );
244
245 /**
246 The RegisterKeystrokeNotify() function registers a function
247 which will be called when a specified keystroke will occur.
248
249 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
250
251 @param KeyData A pointer to a buffer that is filled in with
252 the keystroke information for the key that was
253 pressed.
254
255 @param KeyNotificationFunction Points to the function to be
256 called when the key sequence
257 is typed specified by KeyData.
258
259
260 @param NotifyHandle Points to the unique handle assigned to
261 the registered notification.
262
263 @retval EFI_SUCCESS The device state was set
264 appropriately.
265
266 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
267 data structures.
268
269 **/
270 typedef
271 EFI_STATUS
272 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
273 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
274 IN EFI_KEY_DATA *KeyData,
275 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
276 OUT EFI_HANDLE *NotifyHandle
277 );
278
279 /**
280 The UnregisterKeystrokeNotify() function removes the
281 notification which was previously registered.
282
283 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
284
285 @param NotificationHandle The handle of the notification
286 function being unregistered.
287
288 @retval EFI_SUCCESS The device state was set appropriately.
289
290 @retval EFI_INVALID_PARAMETER The NotificationHandle is
291 invalid.
292
293 **/
294 typedef
295 EFI_STATUS
296 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
297 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
298 IN EFI_HANDLE NotificationHandle
299 );
300
301
302 ///
303 /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
304 /// device. It is an extension to the Simple Text Input protocol
305 /// which allows a variety of extended shift state information to be
306 /// returned.
307 ///
308 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
309 EFI_INPUT_RESET_EX Reset;
310 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
311 ///
312 /// Event to use with WaitForEvent() to wait for a key to be available.
313 ///
314 EFI_EVENT WaitForKeyEx;
315 EFI_SET_STATE SetState;
316 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
317 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
318 };
319
320
321 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
322
323 #endif
324