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