]>
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 | |
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 | Module Name: SimpleTextInEx.h\r | |
17 | \r | |
18 | **/\r | |
19 | \r | |
20 | #ifndef __SIMPLE_TEXT_IN_EX_H__\r | |
21 | #define __SIMPLE_TEXT_IN_EX_H__\r | |
22 | \r | |
23 | #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \\r | |
24 | {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }\r | |
25 | \r | |
26 | \r | |
27 | typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;\r | |
28 | \r | |
29 | /**\r | |
30 | The Reset() function resets the input device hardware. As part\r | |
31 | of initialization process, the firmware/device will make a quick\r | |
32 | but reasonable attempt to verify that the device is functioning.\r | |
33 | If the ExtendedVerification flag is TRUE the firmware may take\r | |
34 | an extended amount of time to verify the device is operating on\r | |
35 | reset. Otherwise the reset operation is to occur as quickly as\r | |
36 | possible. The hardware verification process is not defined by\r | |
37 | this specification and is left up to the platform firmware or\r | |
38 | driver to implement.\r | |
39 | \r | |
40 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
41 | instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
42 | is defined in this section.\r | |
43 | \r | |
44 | @param ExtendedVerification Indicates that the driver may\r | |
45 | perform a more exhaustive\r | |
46 | verification operation of the\r | |
47 | device during reset.\r | |
48 | \r | |
49 | \r | |
50 | @retval EFI_SUCCESS The device was reset.\r | |
51 | \r | |
52 | @retval EFI_DEVICE_ERROR The device is not functioning\r | |
53 | correctly and could not be reset.\r | |
54 | \r | |
55 | **/\r | |
56 | typedef\r | |
57 | EFI_STATUS\r | |
58 | (EFIAPI *EFI_INPUT_RESET_EX) (\r | |
59 | IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
60 | IN CONST BOOLEAN ExtendedVerification\r | |
61 | );\r | |
62 | \r | |
63 | \r | |
64 | //\r | |
65 | // EFI_KEY_TOGGLE_STATE\r | |
66 | //\r | |
67 | typedef UINT8 EFI_KEY_TOGGLE_STATE;\r | |
68 | #define TOGGLE_STATE_VALID 0x80\r | |
69 | #define SCROLL_LOCK_ACTIVE 0x01\r | |
70 | #define NUM_LOCK_ACTIVE 0x02\r | |
71 | #define CAPS_LOCK_ACTIVE 0x04\r | |
72 | \r | |
73 | /**\r | |
74 | Definition of EFI_KEY_STATE\r | |
75 | \r | |
76 | @param KeyShiftState Reflects the currently pressed shift\r | |
77 | modifiers for the input device. The\r | |
78 | returned value is valid only if the high\r | |
79 | order bit has been set.\r | |
80 | \r | |
81 | @param KeyToggleState Reflects the current internal state of\r | |
82 | various toggled attributes. The returned\r | |
83 | value is valid only if the high order\r | |
84 | bit has been set.\r | |
85 | \r | |
86 | **/\r | |
87 | typedef struct _EFI_KEY_STATE {\r | |
88 | UINT32 KeyShiftState;\r | |
89 | EFI_KEY_TOGGLE_STATE KeyToggleState;\r | |
90 | } EFI_KEY_STATE;\r | |
91 | \r | |
92 | /**\r | |
93 | Definition of EFI_KEY_DATA.\r | |
94 | \r | |
95 | @param Key The EFI scan code and Unicode value returned from\r | |
96 | the input device.\r | |
97 | \r | |
98 | @param KeyState The current state of various toggled\r | |
99 | attributes as well as input modifier values.\r | |
100 | \r | |
101 | **/\r | |
102 | typedef struct {\r | |
103 | EFI_INPUT_KEY Key;\r | |
104 | EFI_KEY_STATE KeyState;\r | |
105 | } EFI_KEY_DATA;\r | |
106 | \r | |
107 | //\r | |
108 | // Shift State.\r | |
109 | //\r | |
110 | // Any Shift or Toggle State that is valid should have\r | |
111 | // high order bit set.\r | |
112 | //\r | |
113 | #define SHIFT_STATE_VALID 0x80000000\r | |
114 | #define RIGHT_SHIFT_PRESSED 0x00000001\r | |
115 | #define LEFT_SHIFT_PRESSED 0x00000002\r | |
116 | #define RIGHT_CONTROL_PRESSED 0x00000004\r | |
117 | #define LEFT_CONTROL_PRESSED 0x00000008\r | |
118 | #define RIGHT_ALT_PRESSED 0x00000010\r | |
119 | #define LEFT_ALT_PRESSED 0x00000020\r | |
120 | #define RIGHT_LOGO_PRESSED 0x00000040\r | |
121 | #define LEFT_LOGO_PRESSED 0x00000080\r | |
122 | #define MENU_KEY_PRESSED 0x00000100\r | |
123 | #define SYS_REQ_PRESSED 0x00000200\r | |
124 | \r | |
125 | /**\r | |
126 | The function reads the next keystroke from the input device. If\r | |
127 | there is no pending keystroke the function returns\r | |
128 | EFI_NOT_READY. If there is a pending keystroke, then\r | |
129 | KeyData.Key.ScanCode is the EFI scan code defined in Error!\r | |
130 | Reference source not found.. The KeyData.Key.UnicodeChar is the\r | |
131 | actual printable character or is zero if the key does not\r | |
132 | represent a printable character (control key, function key,\r | |
133 | etc.). The KeyData.KeyState is shift state for the character\r | |
134 | reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .\r | |
135 | When interpreting the data from this function, it should be\r | |
136 | noted that if a class of printable characters that are\r | |
137 | normally adjusted by shift modifiers (e.g. Shift Key + "f"\r | |
138 | key) would be presented solely as a KeyData.Key.UnicodeChar\r | |
139 | without the associated shift state. So in the previous example\r | |
140 | of a Shift Key + "f" key being pressed, the only pertinent\r | |
141 | data returned would be KeyData.Key.UnicodeChar with the value\r | |
142 | of "F". This of course would not typically be the case for\r | |
143 | non-printable characters such as the pressing of the Right\r | |
144 | Shift Key + F10 key since the corresponding returned data\r | |
145 | would be reflected both in the KeyData.KeyState.KeyShiftState\r | |
146 | and KeyData.Key.ScanCode values. UEFI drivers which implement\r | |
147 | the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return\r | |
148 | KeyData.Key and KeyData.KeyState values. These drivers must\r | |
149 | always return the most current state of\r | |
150 | KeyData.KeyState.KeyShiftState and\r | |
151 | KeyData.KeyState.KeyToggleState. It should also be noted that\r | |
152 | certain input devices may not be able to produce shift or toggle\r | |
153 | state information, and in those cases the high order bit in the\r | |
154 | respective Toggle and Shift state fields should not be active.\r | |
155 | \r | |
156 | \r | |
157 | @param This A pointer to the\r | |
158 | EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.\r | |
159 | \r | |
160 | @param KeyData A pointer to a buffer that is filled in with\r | |
161 | the keystroke state data for the key that was\r | |
162 | pressed.\r | |
163 | \r | |
164 | \r | |
165 | @retval EFI_SUCCESS The keystroke information was\r | |
166 | returned.\r | |
167 | \r | |
168 | @retval EFI_NOT_READY There was no keystroke data available.\r | |
169 | EFI_DEVICE_ERROR The keystroke\r | |
170 | information was not returned due to\r | |
171 | hardware errors.\r | |
172 | \r | |
173 | \r | |
174 | **/\r | |
175 | typedef\r | |
176 | EFI_STATUS\r | |
177 | (EFIAPI *EFI_INPUT_READ_KEY_EX) (\r | |
178 | IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
179 | OUT EFI_KEY_DATA *KeyData\r | |
180 | );\r | |
181 | \r | |
182 | /**\r | |
183 | The SetState() function allows the input device hardware to\r | |
184 | have state settings adjusted.\r | |
185 | \r | |
186 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
187 | instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
188 | is defined in this section.\r | |
189 | \r | |
190 | @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to\r | |
191 | set the state for the input device.\r | |
192 | \r | |
193 | \r | |
194 | @retval EFI_SUCCESS The device state was set appropriately.\r | |
195 | \r | |
196 | @retval EFI_DEVICE_ERROR The device is not functioning\r | |
197 | correctly and could not have the\r | |
198 | setting adjusted.\r | |
199 | \r | |
200 | @retval EFI_UNSUPPORTED The device does not support the\r | |
201 | ability to have its state set.\r | |
202 | \r | |
203 | **/\r | |
204 | typedef\r | |
205 | EFI_STATUS\r | |
206 | (EFIAPI *EFI_SET_STATE) (\r | |
207 | IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
208 | IN CONST EFI_KEY_TOGGLE_STATE *KeyToggleState\r | |
209 | );\r | |
210 | \r | |
211 | //\r | |
212 | // EFI_KEY_NOTIFY\r | |
213 | //\r | |
214 | typedef\r | |
215 | EFI_STATUS\r | |
216 | (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (\r | |
217 | IN CONST EFI_KEY_DATA *KeyData\r | |
218 | );\r | |
219 | \r | |
220 | /**\r | |
221 | The RegisterKeystrokeNotify() function registers a function\r | |
222 | which will be called when a specified keystroke will occur.\r | |
223 | \r | |
224 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
225 | instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
226 | is defined in this section.\r | |
227 | \r | |
228 | @param KeyData A pointer to a buffer that is filled in with\r | |
229 | the keystroke information for the key that was\r | |
230 | pressed.\r | |
231 | \r | |
232 | @param KeyNotificationFunction Points to the function to be\r | |
233 | called when the key sequence\r | |
234 | is typed specified by KeyData.\r | |
235 | \r | |
236 | \r | |
237 | @param NotifyHandle Points to the unique handle assigned to\r | |
238 | the registered notification.\r | |
239 | \r | |
240 | @retval EFI_SUCCESS The device state was set\r | |
241 | appropriately.\r | |
242 | \r | |
243 | @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r | |
244 | data structures.\r | |
245 | \r | |
246 | **/\r | |
247 | typedef\r | |
248 | EFI_STATUS\r | |
249 | (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (\r | |
250 | IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
251 | IN CONST EFI_KEY_DATA *KeyData,\r | |
252 | IN CONST EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r | |
253 | OUT EFI_HANDLE *NotifyHandle\r | |
254 | );\r | |
255 | \r | |
256 | /**\r | |
257 | The UnregisterKeystrokeNotify() function removes the\r | |
258 | notification which was previously registered.\r | |
259 | \r | |
260 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r | |
261 | instance.\r | |
262 | \r | |
263 | @param NotificationHandle The handle of the notification\r | |
264 | function being unregistered.\r | |
265 | \r | |
266 | @retval EFI_SUCCESS The device state was set appropriately.\r | |
267 | \r | |
268 | @retval EFI_INVALID_PARAMETER The NotificationHandle is\r | |
269 | invalid.\r | |
270 | \r | |
271 | **/\r | |
272 | typedef\r | |
273 | EFI_STATUS\r | |
274 | (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (\r | |
275 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
276 | IN EFI_HANDLE NotificationHandle\r | |
277 | );\r | |
278 | \r | |
279 | \r | |
280 | /**\r | |
281 | The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn\r | |
282 | device. It is an extension to the Simple Text Input protocol\r | |
283 | which allows a variety of extended shift state information to be\r | |
284 | returned.\r | |
285 | \r | |
286 | @param Reset Reset the ConsoleIn device. See Reset().\r | |
287 | \r | |
288 | @param ReadKeyStrokeEx Returns the next input character. See\r | |
289 | ReadKeyStrokeEx().\r | |
290 | \r | |
291 | @param WaitForKeyEx Event to use with WaitForEvent() to wait\r | |
292 | for a key to be available.\r | |
293 | \r | |
294 | @param SetState Set the EFI_KEY_TOGGLE_STATE state settings\r | |
295 | for the input device.\r | |
296 | \r | |
297 | @param RegisterKeyNotify Register a notification function to\r | |
298 | be called when a given key sequence\r | |
299 | is hit.\r | |
300 | \r | |
301 | @param UnregisterKeyNotifyRemoves A specific notification\r | |
302 | function.\r | |
303 | \r | |
304 | **/\r | |
305 | struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{\r | |
306 | EFI_INPUT_RESET_EX Reset;\r | |
307 | EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;\r | |
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 |