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