]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextInEx.h
Add the detailed descriptions for the structure data member in these protocol.
[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. The toggle state 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_F13 0x0068
128 #define SCAN_F14 0x0069
129 #define SCAN_F15 0x006A
130 #define SCAN_F16 0x006B
131 #define SCAN_F17 0x006C
132 #define SCAN_F18 0x006D
133 #define SCAN_F19 0x006E
134 #define SCAN_F20 0x006F
135 #define SCAN_F21 0x0070
136 #define SCAN_F22 0x0071
137 #define SCAN_F23 0x0072
138 #define SCAN_F24 0x0073
139 #define SCAN_MUTE 0x007F
140 #define SCAN_VOLUME_UP 0x0080
141 #define SCAN_VOLUME_DOWN 0x0081
142 #define SCAN_BRIGHTNESS_UP 0x0100
143 #define SCAN_BRIGHTNESS_DOWN 0x0101
144 #define SCAN_SUSPEND 0x0102
145 #define SCAN_HIBERNATE 0x0103
146 #define SCAN_TOGGLE_DISPLAY 0x0104
147 #define SCAN_RECOVERY 0x0105
148 #define SCAN_EJECT 0x0106
149
150 /**
151 The function reads the next keystroke from the input device. If
152 there is no pending keystroke the function returns
153 EFI_NOT_READY. If there is a pending keystroke, then
154 KeyData.Key.ScanCode is the EFI scan code defined in Error!
155 Reference source not found.. The KeyData.Key.UnicodeChar is the
156 actual printable character or is zero if the key does not
157 represent a printable character (control key, function key,
158 etc.). The KeyData.KeyState is shift state for the character
159 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
160 When interpreting the data from this function, it should be
161 noted that if a class of printable characters that are
162 normally adjusted by shift modifiers (e.g. Shift Key + "f"
163 key) would be presented solely as a KeyData.Key.UnicodeChar
164 without the associated shift state. So in the previous example
165 of a Shift Key + "f" key being pressed, the only pertinent
166 data returned would be KeyData.Key.UnicodeChar with the value
167 of "F". This of course would not typically be the case for
168 non-printable characters such as the pressing of the Right
169 Shift Key + F10 key since the corresponding returned data
170 would be reflected both in the KeyData.KeyState.KeyShiftState
171 and KeyData.Key.ScanCode values. UEFI drivers which implement
172 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
173 KeyData.Key and KeyData.KeyState values. These drivers must
174 always return the most current state of
175 KeyData.KeyState.KeyShiftState and
176 KeyData.KeyState.KeyToggleState. It should also be noted that
177 certain input devices may not be able to produce shift or toggle
178 state information, and in those cases the high order bit in the
179 respective Toggle and Shift state fields should not be active.
180
181
182 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
183
184 @param KeyData A pointer to a buffer that is filled in with
185 the keystroke state data for the key that was
186 pressed.
187
188
189 @retval EFI_SUCCESS The keystroke information was
190 returned.
191
192 @retval EFI_NOT_READY There was no keystroke data available.
193 EFI_DEVICE_ERROR The keystroke
194 information was not returned due to
195 hardware errors.
196
197
198 **/
199 typedef
200 EFI_STATUS
201 (EFIAPI *EFI_INPUT_READ_KEY_EX)(
202 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
203 OUT EFI_KEY_DATA *KeyData
204 );
205
206 /**
207 The SetState() function allows the input device hardware to
208 have state settings adjusted.
209
210 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
211
212 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
213 set the state for the input device.
214
215
216 @retval EFI_SUCCESS The device state was set appropriately.
217
218 @retval EFI_DEVICE_ERROR The device is not functioning
219 correctly and could not have the
220 setting adjusted.
221
222 @retval EFI_UNSUPPORTED The device does not support the
223 ability to have its state set.
224
225 **/
226 typedef
227 EFI_STATUS
228 (EFIAPI *EFI_SET_STATE)(
229 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
230 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
231 );
232
233 ///
234 /// The function will be called when the key sequence is typed specified by KeyData.
235 ///
236 typedef
237 EFI_STATUS
238 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
239 IN EFI_KEY_DATA *KeyData
240 );
241
242 /**
243 The RegisterKeystrokeNotify() function registers a function
244 which will be called when a specified keystroke will occur.
245
246 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
247
248 @param KeyData A pointer to a buffer that is filled in with
249 the keystroke information for the key that was
250 pressed.
251
252 @param KeyNotificationFunction Points to the function to be
253 called when the key sequence
254 is typed specified by KeyData.
255
256
257 @param NotifyHandle Points to the unique handle assigned to
258 the registered notification.
259
260 @retval EFI_SUCCESS The device state was set
261 appropriately.
262
263 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
264 data structures.
265
266 **/
267 typedef
268 EFI_STATUS
269 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
270 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
271 IN EFI_KEY_DATA *KeyData,
272 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
273 OUT EFI_HANDLE *NotifyHandle
274 );
275
276 /**
277 The UnregisterKeystrokeNotify() function removes the
278 notification which was previously registered.
279
280 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
281
282 @param NotificationHandle The handle of the notification
283 function being unregistered.
284
285 @retval EFI_SUCCESS The device state was set appropriately.
286
287 @retval EFI_INVALID_PARAMETER The NotificationHandle is
288 invalid.
289
290 **/
291 typedef
292 EFI_STATUS
293 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
294 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
295 IN EFI_HANDLE NotificationHandle
296 );
297
298
299 ///
300 /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
301 /// device. It is an extension to the Simple Text Input protocol
302 /// which allows a variety of extended shift state information to be
303 /// returned.
304 ///
305 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{
306 EFI_INPUT_RESET_EX Reset;
307 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
308 ///
309 /// Event to use with WaitForEvent() to wait for a key to be available.
310 ///
311 EFI_EVENT WaitForKeyEx;
312 EFI_SET_STATE SetState;
313 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
314 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
315 };
316
317
318 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
319
320 #endif
321