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