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