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