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