• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _EFI_CON_H
2 #define _EFI_CON_H
3 
4 /*++
5 
6 Copyright (c) 1998  Intel Corporation
7 
8 Module Name:
9 
10     eficon.h
11 
12 Abstract:
13 
14     EFI console protocols
15 
16 
17 
18 Revision History
19 
20 --*/
21 
22 //
23 // Text output protocol
24 //
25 
26 #define SIMPLE_TEXT_OUTPUT_PROTOCOL \
27     { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
28 
29 INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
30 
31 typedef
32 EFI_STATUS
33 (EFIAPI *EFI_TEXT_RESET) (
34     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
35     IN BOOLEAN                      ExtendedVerification
36     );
37 
38 typedef
39 EFI_STATUS
40 (EFIAPI *EFI_TEXT_OUTPUT_STRING) (
41     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
42     IN CHAR16                       *String
43     );
44 
45 typedef
46 EFI_STATUS
47 (EFIAPI *EFI_TEXT_TEST_STRING) (
48     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
49     IN CHAR16                       *String
50     );
51 
52 typedef
53 EFI_STATUS
54 (EFIAPI *EFI_TEXT_QUERY_MODE) (
55     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
56     IN UINTN                        ModeNumber,
57     OUT UINTN                       *Columns,
58     OUT UINTN                       *Rows
59     );
60 
61 typedef
62 EFI_STATUS
63 (EFIAPI *EFI_TEXT_SET_MODE) (
64     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
65     IN UINTN                        ModeNumber
66     );
67 
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
71     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
72     IN UINTN                        Attribute
73     );
74 
75 #define EFI_BLACK   0x00
76 #define EFI_BLUE    0x01
77 #define EFI_GREEN   0x02
78 #define EFI_CYAN            (EFI_BLUE | EFI_GREEN)
79 #define EFI_RED     0x04
80 #define EFI_MAGENTA         (EFI_BLUE | EFI_RED)
81 #define EFI_BROWN           (EFI_GREEN | EFI_RED)
82 #define EFI_LIGHTGRAY       (EFI_BLUE | EFI_GREEN | EFI_RED)
83 #define EFI_BRIGHT  0x08
84 #define EFI_DARKGRAY        (EFI_BRIGHT)
85 #define EFI_LIGHTBLUE       (EFI_BLUE | EFI_BRIGHT)
86 #define EFI_LIGHTGREEN      (EFI_GREEN | EFI_BRIGHT)
87 #define EFI_LIGHTCYAN       (EFI_CYAN | EFI_BRIGHT)
88 #define EFI_LIGHTRED        (EFI_RED | EFI_BRIGHT)
89 #define EFI_LIGHTMAGENTA    (EFI_MAGENTA | EFI_BRIGHT)
90 #define EFI_YELLOW          (EFI_BROWN | EFI_BRIGHT)
91 #define EFI_WHITE           (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
92 
93 #define EFI_TEXT_ATTR(f,b)  ((f) | ((b) << 4))
94 
95 #define EFI_BACKGROUND_BLACK        0x00
96 #define EFI_BACKGROUND_BLUE         0x10
97 #define EFI_BACKGROUND_GREEN        0x20
98 #define EFI_BACKGROUND_CYAN         (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
99 #define EFI_BACKGROUND_RED          0x40
100 #define EFI_BACKGROUND_MAGENTA      (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
101 #define EFI_BACKGROUND_BROWN        (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
102 #define EFI_BACKGROUND_LIGHTGRAY    (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
103 
104 
105 typedef
106 EFI_STATUS
107 (EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
108     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This
109     );
110 
111 typedef
112 EFI_STATUS
113 (EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
114     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
115     IN UINTN                        Column,
116     IN UINTN                        Row
117     );
118 
119 typedef
120 EFI_STATUS
121 (EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
122     IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE     *This,
123     IN BOOLEAN                      Enable
124     );
125 
126 typedef struct {
127     INT32                           MaxMode;
128     // current settings
129     INT32                           Mode;
130     INT32                           Attribute;
131     INT32                           CursorColumn;
132     INT32                           CursorRow;
133     BOOLEAN                         CursorVisible;
134 } SIMPLE_TEXT_OUTPUT_MODE;
135 
136 typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
137     EFI_TEXT_RESET                  Reset;
138 
139     EFI_TEXT_OUTPUT_STRING          OutputString;
140     EFI_TEXT_TEST_STRING            TestString;
141 
142     EFI_TEXT_QUERY_MODE             QueryMode;
143     EFI_TEXT_SET_MODE               SetMode;
144     EFI_TEXT_SET_ATTRIBUTE          SetAttribute;
145 
146     EFI_TEXT_CLEAR_SCREEN           ClearScreen;
147     EFI_TEXT_SET_CURSOR_POSITION    SetCursorPosition;
148     EFI_TEXT_ENABLE_CURSOR          EnableCursor;
149 
150     // Current mode
151     SIMPLE_TEXT_OUTPUT_MODE         *Mode;
152 } SIMPLE_TEXT_OUTPUT_INTERFACE;
153 
154 //
155 // Define's for required EFI Unicode Box Draw character
156 //
157 
158 #define BOXDRAW_HORIZONTAL                  0x2500
159 #define BOXDRAW_VERTICAL                    0x2502
160 #define BOXDRAW_DOWN_RIGHT                  0x250c
161 #define BOXDRAW_DOWN_LEFT                   0x2510
162 #define BOXDRAW_UP_RIGHT                    0x2514
163 #define BOXDRAW_UP_LEFT                     0x2518
164 #define BOXDRAW_VERTICAL_RIGHT              0x251c
165 #define BOXDRAW_VERTICAL_LEFT               0x2524
166 #define BOXDRAW_DOWN_HORIZONTAL             0x252c
167 #define BOXDRAW_UP_HORIZONTAL               0x2534
168 #define BOXDRAW_VERTICAL_HORIZONTAL         0x253c
169 
170 #define BOXDRAW_DOUBLE_HORIZONTAL           0x2550
171 #define BOXDRAW_DOUBLE_VERTICAL             0x2551
172 #define BOXDRAW_DOWN_RIGHT_DOUBLE           0x2552
173 #define BOXDRAW_DOWN_DOUBLE_RIGHT           0x2553
174 #define BOXDRAW_DOUBLE_DOWN_RIGHT           0x2554
175 
176 #define BOXDRAW_DOWN_LEFT_DOUBLE            0x2555
177 #define BOXDRAW_DOWN_DOUBLE_LEFT            0x2556
178 #define BOXDRAW_DOUBLE_DOWN_LEFT            0x2557
179 
180 #define BOXDRAW_UP_RIGHT_DOUBLE             0x2558
181 #define BOXDRAW_UP_DOUBLE_RIGHT             0x2559
182 #define BOXDRAW_DOUBLE_UP_RIGHT             0x255a
183 
184 #define BOXDRAW_UP_LEFT_DOUBLE              0x255b
185 #define BOXDRAW_UP_DOUBLE_LEFT              0x255c
186 #define BOXDRAW_DOUBLE_UP_LEFT              0x255d
187 
188 #define BOXDRAW_VERTICAL_RIGHT_DOUBLE       0x255e
189 #define BOXDRAW_VERTICAL_DOUBLE_RIGHT       0x255f
190 #define BOXDRAW_DOUBLE_VERTICAL_RIGHT       0x2560
191 
192 #define BOXDRAW_VERTICAL_LEFT_DOUBLE        0x2561
193 #define BOXDRAW_VERTICAL_DOUBLE_LEFT        0x2562
194 #define BOXDRAW_DOUBLE_VERTICAL_LEFT        0x2563
195 
196 #define BOXDRAW_DOWN_HORIZONTAL_DOUBLE      0x2564
197 #define BOXDRAW_DOWN_DOUBLE_HORIZONTAL      0x2565
198 #define BOXDRAW_DOUBLE_DOWN_HORIZONTAL      0x2566
199 
200 #define BOXDRAW_UP_HORIZONTAL_DOUBLE        0x2567
201 #define BOXDRAW_UP_DOUBLE_HORIZONTAL        0x2568
202 #define BOXDRAW_DOUBLE_UP_HORIZONTAL        0x2569
203 
204 #define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE  0x256a
205 #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL  0x256b
206 #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL  0x256c
207 
208 //
209 // EFI Required Block Elements Code Chart
210 //
211 
212 #define BLOCKELEMENT_FULL_BLOCK             0x2588
213 #define BLOCKELEMENT_LIGHT_SHADE            0x2591
214 //
215 // EFI Required Geometric Shapes Code Chart
216 //
217 
218 #define GEOMETRICSHAPE_UP_TRIANGLE           0x25b2
219 #define GEOMETRICSHAPE_RIGHT_TRIANGLE        0x25ba
220 #define GEOMETRICSHAPE_DOWN_TRIANGLE         0x25bc
221 #define GEOMETRICSHAPE_LEFT_TRIANGLE         0x25c4
222 
223 //
224 // EFI Required Arrow shapes
225 //
226 
227 #define ARROW_UP                            0x2191
228 #define ARROW_DOWN                          0x2193
229 
230 //
231 // Text input protocol
232 //
233 
234 #define SIMPLE_TEXT_INPUT_PROTOCOL  \
235     { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
236 
237 INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);
238 
239 typedef struct {
240     UINT16                              ScanCode;
241     CHAR16                              UnicodeChar;
242 } EFI_INPUT_KEY;
243 
244 //
245 // Baseline unicode control chars
246 //
247 
248 #define CHAR_NULL                       0x0000
249 #define CHAR_BACKSPACE                  0x0008
250 #define CHAR_TAB                        0x0009
251 #define CHAR_LINEFEED                   0x000A
252 #define CHAR_CARRIAGE_RETURN            0x000D
253 
254 //
255 // Scan codes for base line keys
256 //
257 
258 #define SCAN_NULL                       0x0000
259 #define SCAN_UP                         0x0001
260 #define SCAN_DOWN                       0x0002
261 #define SCAN_RIGHT                      0x0003
262 #define SCAN_LEFT                       0x0004
263 #define SCAN_HOME                       0x0005
264 #define SCAN_END                        0x0006
265 #define SCAN_INSERT                     0x0007
266 #define SCAN_DELETE                     0x0008
267 #define SCAN_PAGE_UP                    0x0009
268 #define SCAN_PAGE_DOWN                  0x000A
269 #define SCAN_F1                         0x000B
270 #define SCAN_F2                         0x000C
271 #define SCAN_F3                         0x000D
272 #define SCAN_F4                         0x000E
273 #define SCAN_F5                         0x000F
274 #define SCAN_F6                         0x0010
275 #define SCAN_F7                         0x0011
276 #define SCAN_F8                         0x0012
277 #define SCAN_F9                         0x0013
278 #define SCAN_F10                        0x0014
279 #define SCAN_ESC                        0x0017
280 
281 typedef
282 EFI_STATUS
283 (EFIAPI *EFI_INPUT_RESET) (
284     IN struct _SIMPLE_INPUT_INTERFACE   *This,
285     IN BOOLEAN                          ExtendedVerification
286     );
287 
288 typedef
289 EFI_STATUS
290 (EFIAPI *EFI_INPUT_READ_KEY) (
291     IN struct _SIMPLE_INPUT_INTERFACE   *This,
292     OUT EFI_INPUT_KEY                   *Key
293     );
294 
295 typedef struct _SIMPLE_INPUT_INTERFACE {
296     EFI_INPUT_RESET                     Reset;
297     EFI_INPUT_READ_KEY                  ReadKeyStroke;
298     EFI_EVENT                           WaitForKey;
299 } SIMPLE_INPUT_INTERFACE;
300 
301 #endif
302 
303