]>
Commit | Line | Data |
---|---|---|
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 | |
d7dfd027 | 7 | Copyright (c) 2006 - 2009, Intel Corporation \r |
d1f95000 | 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 | |
25 | typedef 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 | |
4ca9b6c4 | 38 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
d1f95000 | 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 | |
4ca9b6c4 | 46 | @retval EFI_SUCCESS The device was reset.\r |
d1f95000 | 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 | |
52 | typedef\r | |
53 | EFI_STATUS\r | |
8b13229b | 54 | (EFIAPI *EFI_INPUT_RESET_EX)(\r |
85f74a01 | 55 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r |
56 | IN BOOLEAN ExtendedVerification\r | |
d1f95000 | 57 | );\r |
58 | \r | |
59 | \r | |
992f22b9 LG |
60 | ///\r |
61 | /// EFI_KEY_TOGGLE_STATE. The toggle state 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 | |
85f74a01 | 65 | typedef UINT8 EFI_KEY_TOGGLE_STATE;\r |
d1f95000 | 66 | \r |
d1f95000 | 67 | typedef struct _EFI_KEY_STATE {\r |
992f22b9 LG |
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 | |
d1f95000 | 74 | UINT32 KeyShiftState;\r |
992f22b9 LG |
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 | |
d1f95000 | 81 | EFI_KEY_TOGGLE_STATE KeyToggleState;\r |
82 | } EFI_KEY_STATE;\r | |
83 | \r | |
d1f95000 | 84 | typedef struct {\r |
992f22b9 LG |
85 | ///\r |
86 | /// The EFI scan code and Unicode value returned from the input device.\r | |
87 | ///\r | |
d1f95000 | 88 | EFI_INPUT_KEY Key;\r |
992f22b9 LG |
89 | ///\r |
90 | /// The current state of various toggled attributes as well as input modifier values.\r | |
91 | ///\r | |
d1f95000 | 92 | EFI_KEY_STATE KeyState;\r |
93 | } EFI_KEY_DATA;\r | |
94 | \r | |
d1f95000 | 95 | //\r |
96 | // Any Shift or Toggle State that is valid should have\r | |
97 | // high order bit set.\r | |
98 | //\r | |
85f74a01 | 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 | |
d1f95000 | 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, it should be\r | |
158 | noted that if a class of printable characters that are\r | |
159 | normally adjusted by shift modifiers (e.g. Shift Key + "f"\r | |
160 | key) would be presented solely as a KeyData.Key.UnicodeChar\r | |
161 | without the associated shift state. So in the previous example\r | |
162 | of a Shift Key + "f" key being pressed, the only pertinent\r | |
163 | data returned would be KeyData.Key.UnicodeChar with the value\r | |
164 | of "F". This of course would not typically be the case for\r | |
165 | non-printable characters such as the pressing of the Right\r | |
166 | Shift Key + F10 key since the corresponding returned data\r | |
167 | would be reflected both in the KeyData.KeyState.KeyShiftState\r | |
168 | and KeyData.Key.ScanCode values. UEFI drivers which implement\r | |
169 | the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return\r | |
170 | KeyData.Key and KeyData.KeyState values. These drivers must\r | |
171 | always return the most current state of\r | |
172 | KeyData.KeyState.KeyShiftState and\r | |
173 | KeyData.KeyState.KeyToggleState. It should also be noted that\r | |
174 | certain input devices may not be able to produce shift or toggle\r | |
175 | state information, and in those cases the high order bit in the\r | |
176 | respective Toggle and Shift state fields should not be active.\r | |
177 | \r | |
178 | \r | |
4ca9b6c4 | 179 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
d1f95000 | 180 | \r |
181 | @param KeyData A pointer to a buffer that is filled in with\r | |
182 | the keystroke state data for the key that was\r | |
183 | pressed.\r | |
184 | \r | |
185 | \r | |
186 | @retval EFI_SUCCESS The keystroke information was\r | |
187 | returned.\r | |
188 | \r | |
189 | @retval EFI_NOT_READY There was no keystroke data available.\r | |
190 | EFI_DEVICE_ERROR The keystroke\r | |
191 | information was not returned due to\r | |
192 | hardware errors.\r | |
193 | \r | |
194 | \r | |
195 | **/\r | |
196 | typedef\r | |
197 | EFI_STATUS\r | |
8b13229b | 198 | (EFIAPI *EFI_INPUT_READ_KEY_EX)(\r |
85f74a01 | 199 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r |
200 | OUT EFI_KEY_DATA *KeyData\r | |
d1f95000 | 201 | );\r |
202 | \r | |
203 | /**\r | |
204 | The SetState() function allows the input device hardware to\r | |
205 | have state settings adjusted.\r | |
206 | \r | |
4ca9b6c4 | 207 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
d1f95000 | 208 | \r |
209 | @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to\r | |
210 | set the state for the input device.\r | |
211 | \r | |
212 | \r | |
4ca9b6c4 | 213 | @retval EFI_SUCCESS The device state was set appropriately.\r |
d1f95000 | 214 | \r |
215 | @retval EFI_DEVICE_ERROR The device is not functioning\r | |
216 | correctly and could not have the\r | |
217 | setting adjusted.\r | |
218 | \r | |
219 | @retval EFI_UNSUPPORTED The device does not support the\r | |
220 | ability to have its state set.\r | |
221 | \r | |
222 | **/\r | |
223 | typedef\r | |
224 | EFI_STATUS\r | |
8b13229b | 225 | (EFIAPI *EFI_SET_STATE)(\r |
85f74a01 | 226 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r |
227 | IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r | |
d1f95000 | 228 | );\r |
229 | \r | |
992f22b9 LG |
230 | ///\r |
231 | /// The function will be called when the key sequence is typed specified by KeyData.\r | |
232 | ///\r | |
d1f95000 | 233 | typedef\r |
234 | EFI_STATUS\r | |
8b13229b | 235 | (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(\r |
85f74a01 | 236 | IN EFI_KEY_DATA *KeyData\r |
d1f95000 | 237 | );\r |
238 | \r | |
239 | /**\r | |
240 | The RegisterKeystrokeNotify() function registers a function\r | |
241 | which will be called when a specified keystroke will occur.\r | |
242 | \r | |
4ca9b6c4 | 243 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
d1f95000 | 244 | \r |
4ca9b6c4 LG |
245 | @param KeyData A pointer to a buffer that is filled in with\r |
246 | the keystroke information for the key that was\r | |
247 | pressed.\r | |
d1f95000 | 248 | \r |
249 | @param KeyNotificationFunction Points to the function to be\r | |
250 | called when the key sequence\r | |
251 | is typed specified by KeyData.\r | |
252 | \r | |
253 | \r | |
4ca9b6c4 LG |
254 | @param NotifyHandle Points to the unique handle assigned to\r |
255 | the registered notification.\r | |
d1f95000 | 256 | \r |
257 | @retval EFI_SUCCESS The device state was set\r | |
258 | appropriately.\r | |
259 | \r | |
260 | @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r | |
261 | data structures.\r | |
262 | \r | |
263 | **/\r | |
264 | typedef\r | |
265 | EFI_STATUS\r | |
8b13229b | 266 | (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(\r |
85f74a01 | 267 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r |
268 | IN EFI_KEY_DATA *KeyData,\r | |
269 | IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r | |
270 | OUT EFI_HANDLE *NotifyHandle\r | |
d1f95000 | 271 | );\r |
272 | \r | |
273 | /**\r | |
274 | The UnregisterKeystrokeNotify() function removes the\r | |
275 | notification which was previously registered.\r | |
276 | \r | |
4ca9b6c4 | 277 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
d1f95000 | 278 | \r |
279 | @param NotificationHandle The handle of the notification\r | |
280 | function being unregistered.\r | |
281 | \r | |
282 | @retval EFI_SUCCESS The device state was set appropriately.\r | |
283 | \r | |
284 | @retval EFI_INVALID_PARAMETER The NotificationHandle is\r | |
285 | invalid.\r | |
286 | \r | |
287 | **/\r | |
288 | typedef\r | |
289 | EFI_STATUS\r | |
8b13229b | 290 | (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(\r |
85f74a01 | 291 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r |
292 | IN EFI_HANDLE NotificationHandle\r | |
d1f95000 | 293 | );\r |
294 | \r | |
295 | \r | |
44717a39 | 296 | ///\r |
297 | /// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn\r | |
298 | /// device. It is an extension to the Simple Text Input protocol\r | |
299 | /// which allows a variety of extended shift state information to be\r | |
300 | /// returned.\r | |
301 | ///\r | |
d1f95000 | 302 | struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{\r |
303 | EFI_INPUT_RESET_EX Reset;\r | |
304 | EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;\r | |
1f08a159 | 305 | ///\r |
306 | /// Event to use with WaitForEvent() to wait for a key to be available.\r | |
307 | ///\r | |
d1f95000 | 308 | EFI_EVENT WaitForKeyEx;\r |
309 | EFI_SET_STATE SetState;\r | |
310 | EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;\r | |
311 | EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;\r | |
312 | };\r | |
313 | \r | |
314 | \r | |
315 | extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;\r | |
316 | \r | |
317 | #endif\r | |
318 | \r |