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