• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   SimpleTextInputEx.h
15 
16 Abstract:
17 
18   EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL from the UEFI 2.1 specification.
19 
20   This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
21   which exposes much more state and modifier information from the input device,
22   also allows one to register a notification for a particular keystroke.
23 
24 --*/
25 
26 #ifndef __SIMPLE_TEXT_INPUT_EX_H__
27 #define __SIMPLE_TEXT_INPUT_EX_H__
28 
29 #include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
30 
31 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
32   { \
33     0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa}\
34   }
35 
36 EFI_FORWARD_DECLARATION (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
37 
38 //
39 // Data structures
40 //
41 
42 typedef UINT8          EFI_KEY_TOGGLE_STATE;
43 //
44 // Any Shift or Toggle State that is valid should have
45 // high order bit set.
46 //
47 typedef struct EFI_KEY_STATE {
48   UINT32               KeyShiftState;
49   EFI_KEY_TOGGLE_STATE KeyToggleState;
50 } EFI_KEY_STATE;
51 
52 typedef struct {
53   EFI_INPUT_KEY        Key;
54   EFI_KEY_STATE        KeyState;
55 } EFI_KEY_DATA;
56 
57 //
58 // Shift state
59 //
60 #define EFI_SHIFT_STATE_VALID     0x80000000
61 #define EFI_RIGHT_SHIFT_PRESSED   0x00000001
62 #define EFI_LEFT_SHIFT_PRESSED    0x00000002
63 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
64 #define EFI_LEFT_CONTROL_PRESSED  0x00000008
65 #define EFI_RIGHT_ALT_PRESSED     0x00000010
66 #define EFI_LEFT_ALT_PRESSED      0x00000020
67 #define EFI_RIGHT_LOGO_PRESSED    0x00000040
68 #define EFI_LEFT_LOGO_PRESSED     0x00000080
69 #define EFI_MENU_KEY_PRESSED      0x00000100
70 #define EFI_SYS_REQ_PRESSED       0x00000200
71 
72 //
73 // Toggle state
74 //
75 #define EFI_TOGGLE_STATE_VALID    0x80
76 #define EFI_SCROLL_LOCK_ACTIVE    0x01
77 #define EFI_NUM_LOCK_ACTIVE       0x02
78 #define EFI_CAPS_LOCK_ACTIVE      0x04
79 
80 //
81 // EFI Scan codes
82 //
83 #define SCAN_F13                  0x0068
84 #define SCAN_F14                  0x0069
85 #define SCAN_F15                  0x006A
86 #define SCAN_F16                  0x006B
87 #define SCAN_F17                  0x006C
88 #define SCAN_F18                  0x006D
89 #define SCAN_F19                  0x006E
90 #define SCAN_F20                  0x006F
91 #define SCAN_F21                  0x0070
92 #define SCAN_F22                  0x0071
93 #define SCAN_F23                  0x0072
94 #define SCAN_F24                  0x0073
95 #define SCAN_MUTE                 0x007F
96 #define SCAN_VOLUME_UP            0x0080
97 #define SCAN_VOLUME_DOWN          0x0081
98 #define SCAN_BRIGHTNESS_UP        0x0100
99 #define SCAN_BRIGHTNESS_DOWN      0x0101
100 #define SCAN_SUSPEND              0x0102
101 #define SCAN_HIBERNATE            0x0103
102 #define SCAN_TOGGLE_DISPLAY       0x0104
103 #define SCAN_RECOVERY             0x0105
104 #define SCAN_EJECT                0x0106
105 
106 
107 //
108 // EFI Key Notfication Function
109 //
110 typedef
111 EFI_STATUS
112 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
113   IN  EFI_KEY_DATA                      *KeyData
114   );
115 
116 typedef
117 EFI_STATUS
118 (EFIAPI *EFI_INPUT_RESET_EX) (
119   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
120   IN BOOLEAN                            ExtendedVerification
121   )
122 /*++
123 
124   Routine Description:
125     Reset the input device and optionaly run diagnostics
126 
127   Arguments:
128     This                  - Protocol instance pointer.
129     ExtendedVerification  - Driver may perform diagnostics on reset.
130 
131   Returns:
132     EFI_SUCCESS           - The device was reset.
133     EFI_DEVICE_ERROR      - The device is not functioning properly and could
134                             not be reset.
135 
136 --*/
137 ;
138 
139 typedef
140 EFI_STATUS
141 (EFIAPI *EFI_INPUT_READ_KEY_EX) (
142   IN  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
143   OUT EFI_KEY_DATA                      *KeyData
144   )
145 /*++
146 
147   Routine Description:
148     Reads the next keystroke from the input device. The WaitForKey Event can
149     be used to test for existance of a keystroke via WaitForEvent () call.
150 
151   Arguments:
152     This       - Protocol instance pointer.
153     KeyData    - A pointer to a buffer that is filled in with the keystroke
154                  state data for the key that was pressed.
155 
156   Returns:
157     EFI_SUCCESS           - The keystroke information was returned.
158     EFI_NOT_READY         - There was no keystroke data availiable.
159     EFI_DEVICE_ERROR      - The keystroke information was not returned due to
160                             hardware errors.
161     EFI_INVALID_PARAMETER - KeyData is NULL.
162 --*/
163 ;
164 
165 typedef
166 EFI_STATUS
167 (EFIAPI *EFI_SET_STATE) (
168   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
169   IN EFI_KEY_TOGGLE_STATE               *KeyToggleState
170   )
171 /*++
172 
173   Routine Description:
174     Set certain state for the input device.
175 
176   Arguments:
177     This              - Protocol instance pointer.
178     KeyToggleState    - A pointer to the EFI_KEY_TOGGLE_STATE to set the
179                         state for the input device.
180 
181   Returns:
182     EFI_SUCCESS           - The device state was set successfully.
183     EFI_DEVICE_ERROR      - The device is not functioning correctly and could
184                             not have the setting adjusted.
185     EFI_UNSUPPORTED       - The device does not have the ability to set its state.
186     EFI_INVALID_PARAMETER - KeyToggleState is NULL.
187 
188 --*/
189 ;
190 
191 typedef
192 EFI_STATUS
193 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
194   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
195   IN EFI_KEY_DATA                       *KeyData,
196   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,
197   OUT EFI_HANDLE                        *NotifyHandle
198   )
199 /*++
200 
201   Routine Description:
202     Register a notification function for a particular keystroke for the input device.
203 
204   Arguments:
205     This                    - Protocol instance pointer.
206     KeyData                 - A pointer to a buffer that is filled in with the keystroke
207                               information data for the key that was pressed.
208     KeyNotificationFunction - Points to the function to be called when the key
209                               sequence is typed specified by KeyData.
210     NotifyHandle            - Points to the unique handle assigned to the registered notification.
211 
212   Returns:
213     EFI_SUCCESS             - The notification function was registered successfully.
214     EFI_OUT_OF_RESOURCES    - Unable to allocate resources for necesssary data structures.
215     EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.
216 
217 --*/
218 ;
219 
220 typedef
221 EFI_STATUS
222 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
223   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
224   IN EFI_HANDLE                         NotificationHandle
225   )
226 /*++
227 
228   Routine Description:
229     Remove a registered notification function from a particular keystroke.
230 
231   Arguments:
232     This                    - Protocol instance pointer.
233     NotificationHandle      - The handle of the notification function being unregistered.
234 
235   Returns:
236     EFI_SUCCESS             - The notification function was unregistered successfully.
237     EFI_INVALID_PARAMETER   - The NotificationHandle is invalid.
238     EFI_NOT_FOUND           - Can not find the matching entry in database.
239 
240 --*/
241 ;
242 
243 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
244   EFI_INPUT_RESET_EX                    Reset;
245   EFI_INPUT_READ_KEY_EX                 ReadKeyStrokeEx;
246   EFI_EVENT                             WaitForKeyEx;
247   EFI_SET_STATE                         SetState;
248   EFI_REGISTER_KEYSTROKE_NOTIFY         RegisterKeyNotify;
249   EFI_UNREGISTER_KEYSTROKE_NOTIFY       UnregisterKeyNotify;
250 };
251 
252 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;
253 
254 #endif
255