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