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