VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleTextInEx.h

最後變更 在這個檔案是 105670,由 vboxsync 提交於 7 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 10.9 KB
 
1/** @file
2 Simple Text Input Ex protocol from the UEFI 2.0 specification.
3
4 This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
5 which exposes much more state and modifier information from the input device,
6 also allows one to register a notification for a particular keystroke.
7
8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11**/
12
13#ifndef __SIMPLE_TEXT_IN_EX_H__
14#define __SIMPLE_TEXT_IN_EX_H__
15
16#include <Protocol/SimpleTextIn.h>
17
18#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
19 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
20
21typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
22
23/**
24 The Reset() function resets the input device hardware. As part
25 of initialization process, the firmware/device will make a quick
26 but reasonable attempt to verify that the device is functioning.
27 If the ExtendedVerification flag is TRUE the firmware may take
28 an extended amount of time to verify the device is operating on
29 reset. Otherwise the reset operation is to occur as quickly as
30 possible. The hardware verification process is not defined by
31 this specification and is left up to the platform firmware or
32 driver to implement.
33
34 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
35
36 @param ExtendedVerification Indicates that the driver may
37 perform a more exhaustive
38 verification operation of the
39 device during reset.
40
41
42 @retval EFI_SUCCESS The device was reset.
43
44 @retval EFI_DEVICE_ERROR The device is not functioning
45 correctly and could not be reset.
46
47**/
48typedef
49EFI_STATUS
50(EFIAPI *EFI_INPUT_RESET_EX)(
51 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
52 IN BOOLEAN ExtendedVerification
53 );
54
55///
56/// EFI_KEY_TOGGLE_STATE. The toggle states are defined.
57/// They are: EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE
58/// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE
59///
60typedef UINT8 EFI_KEY_TOGGLE_STATE;
61
62typedef struct _EFI_KEY_STATE {
63 ///
64 /// Reflects the currently pressed shift
65 /// modifiers for the input device. The
66 /// returned value is valid only if the high
67 /// order bit has been set.
68 ///
69 UINT32 KeyShiftState;
70 ///
71 /// Reflects the current internal state of
72 /// various toggled attributes. The returned
73 /// value is valid only if the high order
74 /// bit has been set.
75 ///
76 EFI_KEY_TOGGLE_STATE KeyToggleState;
77} EFI_KEY_STATE;
78
79typedef struct {
80 ///
81 /// The EFI scan code and Unicode value returned from the input device.
82 ///
83 EFI_INPUT_KEY Key;
84 ///
85 /// The current state of various toggled attributes as well as input modifier values.
86 ///
87 EFI_KEY_STATE KeyState;
88} EFI_KEY_DATA;
89
90//
91// Any Shift or Toggle State that is valid should have
92// high order bit set.
93//
94// Shift state
95//
96#define EFI_SHIFT_STATE_VALID 0x80000000
97#define EFI_RIGHT_SHIFT_PRESSED 0x00000001
98#define EFI_LEFT_SHIFT_PRESSED 0x00000002
99#define EFI_RIGHT_CONTROL_PRESSED 0x00000004
100#define EFI_LEFT_CONTROL_PRESSED 0x00000008
101#define EFI_RIGHT_ALT_PRESSED 0x00000010
102#define EFI_LEFT_ALT_PRESSED 0x00000020
103#define EFI_RIGHT_LOGO_PRESSED 0x00000040
104#define EFI_LEFT_LOGO_PRESSED 0x00000080
105#define EFI_MENU_KEY_PRESSED 0x00000100
106#define EFI_SYS_REQ_PRESSED 0x00000200
107
108//
109// Toggle state
110//
111#define EFI_TOGGLE_STATE_VALID 0x80
112#define EFI_KEY_STATE_EXPOSED 0x40
113#define EFI_SCROLL_LOCK_ACTIVE 0x01
114#define EFI_NUM_LOCK_ACTIVE 0x02
115#define EFI_CAPS_LOCK_ACTIVE 0x04
116
117//
118// EFI Scan codes
119//
120#define SCAN_F11 0x0015
121#define SCAN_F12 0x0016
122#define SCAN_PAUSE 0x0048
123#define SCAN_F13 0x0068
124#define SCAN_F14 0x0069
125#define SCAN_F15 0x006A
126#define SCAN_F16 0x006B
127#define SCAN_F17 0x006C
128#define SCAN_F18 0x006D
129#define SCAN_F19 0x006E
130#define SCAN_F20 0x006F
131#define SCAN_F21 0x0070
132#define SCAN_F22 0x0071
133#define SCAN_F23 0x0072
134#define SCAN_F24 0x0073
135#define SCAN_MUTE 0x007F
136#define SCAN_VOLUME_UP 0x0080
137#define SCAN_VOLUME_DOWN 0x0081
138#define SCAN_BRIGHTNESS_UP 0x0100
139#define SCAN_BRIGHTNESS_DOWN 0x0101
140#define SCAN_SUSPEND 0x0102
141#define SCAN_HIBERNATE 0x0103
142#define SCAN_TOGGLE_DISPLAY 0x0104
143#define SCAN_RECOVERY 0x0105
144#define SCAN_EJECT 0x0106
145
146/**
147 The function reads the next keystroke from the input device. If
148 there is no pending keystroke the function returns
149 EFI_NOT_READY. If there is a pending keystroke, then
150 KeyData.Key.ScanCode is the EFI scan code defined in Error!
151 Reference source not found. The KeyData.Key.UnicodeChar is the
152 actual printable character or is zero if the key does not
153 represent a printable character (control key, function key,
154 etc.). The KeyData.KeyState is shift state for the character
155 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
156 When interpreting the data from this function, it should be
157 noted that if a class of printable characters that are
158 normally adjusted by shift modifiers (e.g. Shift Key + "f"
159 key) would be presented solely as a KeyData.Key.UnicodeChar
160 without the associated shift state. So in the previous example
161 of a Shift Key + "f" key being pressed, the only pertinent
162 data returned would be KeyData.Key.UnicodeChar with the value
163 of "F". This of course would not typically be the case for
164 non-printable characters such as the pressing of the Right
165 Shift Key + F10 key since the corresponding returned data
166 would be reflected both in the KeyData.KeyState.KeyShiftState
167 and KeyData.Key.ScanCode values. UEFI drivers which implement
168 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
169 KeyData.Key and KeyData.KeyState values. These drivers must
170 always return the most current state of
171 KeyData.KeyState.KeyShiftState and
172 KeyData.KeyState.KeyToggleState. It should also be noted that
173 certain input devices may not be able to produce shift or toggle
174 state information, and in those cases the high order bit in the
175 respective Toggle and Shift state fields should not be active.
176
177
178 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
179
180 @param KeyData A pointer to a buffer that is filled in with
181 the keystroke state data for the key that was
182 pressed.
183
184
185 @retval EFI_SUCCESS The keystroke information was returned.
186 @retval EFI_NOT_READY There was no keystroke data available.
187 @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
188 hardware errors.
189 @retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
190
191
192**/
193typedef
194EFI_STATUS
195(EFIAPI *EFI_INPUT_READ_KEY_EX)(
196 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
197 OUT EFI_KEY_DATA *KeyData
198 );
199
200/**
201 The SetState() function allows the input device hardware to
202 have state settings adjusted.
203
204 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
205
206 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
207 set the state for the input device.
208
209
210 @retval EFI_SUCCESS The device state was set appropriately.
211
212 @retval EFI_DEVICE_ERROR The device is not functioning
213 correctly and could not have the
214 setting adjusted.
215
216 @retval EFI_UNSUPPORTED The device does not support the
217 ability to have its state set.
218
219**/
220typedef
221EFI_STATUS
222(EFIAPI *EFI_SET_STATE)(
223 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
224 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
225 );
226
227///
228/// The function will be called when the key sequence is typed specified by KeyData.
229///
230typedef
231EFI_STATUS
232(EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
233 IN EFI_KEY_DATA *KeyData
234 );
235
236/**
237 The RegisterKeystrokeNotify() function registers a function
238 which will be called when a specified keystroke will occur.
239
240 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
241
242 @param KeyData A pointer to a buffer that is filled in with
243 the keystroke information for the key that was
244 pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState
245 and KeyData.KeyState.KeyShiftState are 0, then any incomplete
246 keystroke will trigger a notification of the KeyNotificationFunction.
247
248 @param KeyNotificationFunction Points to the function to be called when the key sequence
249 is typed specified by KeyData. This notification function
250 should be called at <=TPL_CALLBACK.
251
252
253 @param NotifyHandle Points to the unique handle assigned to
254 the registered notification.
255
256 @retval EFI_SUCCESS Key notify was registered successfully.
257
258 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
259 data structures.
260
261**/
262typedef
263EFI_STATUS
264(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
265 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
266 IN EFI_KEY_DATA *KeyData,
267 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
268 OUT VOID **NotifyHandle
269 );
270
271/**
272 The UnregisterKeystrokeNotify() function removes the
273 notification which was previously registered.
274
275 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
276
277 @param NotificationHandle The handle of the notification
278 function being unregistered.
279
280 @retval EFI_SUCCESS Key notify was unregistered successfully.
281
282 @retval EFI_INVALID_PARAMETER The NotificationHandle is
283 invalid.
284
285**/
286typedef
287EFI_STATUS
288(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
289 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
290 IN VOID *NotificationHandle
291 );
292
293///
294/// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
295/// device. It is an extension to the Simple Text Input protocol
296/// which allows a variety of extended shift state information to be
297/// returned.
298///
299struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
300 EFI_INPUT_RESET_EX Reset;
301 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
302 ///
303 /// Event to use with WaitForEvent() to wait for a key to be available.
304 ///
305 EFI_EVENT WaitForKeyEx;
306 EFI_SET_STATE SetState;
307 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
308 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
309};
310
311extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
312
313#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette