]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextInEx.h
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[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 states 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, printable characters that are
158 normally adjusted by shift modifiers (e.g. Shift Key + "f"
159 key) are presented solely as a KeyData.Key.UnicodeChar
160 without the associated shift state. For example,
161 if Shift Key + "f" key are pressed, the only pertinent
162 data returned would be KeyData.Key.UnicodeChar with the value
163 of "F". This would not typically be the case for
164 non-printable characters such as pressing the Right
165 Shift Key + F10 key, since the corresponding returned data
166 would be reflected both in the KeyData.KeyState.KeyShiftState
167 and KeyData.Key.ScanCode values. UEFI drivers which implement
168 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
169 KeyData.Key and KeyData.KeyState values. These drivers must
170 always return the most current state of
171 KeyData.KeyState.KeyShiftState and
172 KeyData.KeyState.KeyToggleState.
173 Certain input devices may not be able to produce shift or toggle
174 state information, and in those cases the high order bit in the
175 respective Toggle and Shift state fields should not be active.
176
177
178 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
179
180 @param KeyData A pointer to a buffer that is filled in with
181 the keystroke state data for the key that was
182 pressed.
183
184
185 @retval EFI_SUCCESS The keystroke information was
186 returned.
187
188 @retval EFI_NOT_READY There was no keystroke data available.
189 EFI_DEVICE_ERROR The keystroke
190 information was not returned due to
191 hardware errors.
192
193
194 **/
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_INPUT_READ_KEY_EX)(
198 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
199 OUT EFI_KEY_DATA *KeyData
200 );
201
202 /**
203 The SetState() function allows the input device hardware to
204 have state settings adjusted.
205
206 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
207
208 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
209 set the state for the input device.
210
211
212 @retval EFI_SUCCESS The device state was set appropriately.
213
214 @retval EFI_DEVICE_ERROR The device is not functioning
215 correctly and could not have the
216 setting adjusted.
217
218 @retval EFI_UNSUPPORTED The device does not support the
219 ability to have its state set.
220
221 **/
222 typedef
223 EFI_STATUS
224 (EFIAPI *EFI_SET_STATE)(
225 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
226 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
227 );
228
229 ///
230 /// The function will be called when the key sequence is typed specified by KeyData.
231 ///
232 typedef
233 EFI_STATUS
234 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
235 IN EFI_KEY_DATA *KeyData
236 );
237
238 /**
239 The RegisterKeystrokeNotify() function registers a function
240 to be called when a specified keystroke will occur.
241
242 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
243
244 @param KeyData A pointer to a buffer that is filled in with
245 the keystroke information for the key that was
246 pressed.
247
248 @param KeyNotificationFunction Points to the function to be
249 called when the key sequence
250 is typed specified by KeyData.
251
252
253 @param NotifyHandle Points to the unique handle assigned to
254 the registered notification.
255
256 @retval EFI_SUCCESS The device state was set
257 appropriately.
258
259 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
260 data structures.
261
262 **/
263 typedef
264 EFI_STATUS
265 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
266 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
267 IN EFI_KEY_DATA *KeyData,
268 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
269 OUT EFI_HANDLE *NotifyHandle
270 );
271
272 /**
273 The UnregisterKeystrokeNotify() function removes a
274 notification that was previously registered.
275
276 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
277
278 @param NotificationHandle The handle of the notification
279 function being unregistered.
280
281 @retval EFI_SUCCESS The device state was set appropriately.
282
283 @retval EFI_INVALID_PARAMETER The NotificationHandle is
284 invalid.
285
286 **/
287 typedef
288 EFI_STATUS
289 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
290 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
291 IN EFI_HANDLE NotificationHandle
292 );
293
294
295 ///
296 /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
297 /// device. It is an extension to the Simple Text Input protocol
298 /// which allows a variety of extended shift state information to be
299 /// returned.
300 ///
301 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
302 EFI_INPUT_RESET_EX Reset;
303 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
304 ///
305 /// Event to use with WaitForEvent() to wait for a key to be available.
306 ///
307 EFI_EVENT WaitForKeyEx;
308 EFI_SET_STATE SetState;
309 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
310 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
311 };
312
313
314 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
315
316 #endif
317