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