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