]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SimpleTextOut.h
Make variable names for protocol GUIDs consistent
[mirror_edk2.git] / MdePkg / Include / Protocol / SimpleTextOut.h
1 /** @file
2 Simple Text Out protocol from the EFI 1.0 specification.
3
4 Abstraction of a very simple text based output device like VGA text mode or
5 a serial terminal. The Simple Text Out protocol instance can represent
6 a single hardware device or a virtual device that is an agregation
7 of multiple physical devices.
8
9 Copyright (c) 2006, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 Module Name: SimpleTextOut.h
19
20 **/
21
22 #ifndef __SIMPLE_TEXT_OUT_H__
23 #define __SIMPLE_TEXT_OUT_H__
24
25 #define EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID \
26 { \
27 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
28 }
29
30 #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID
31
32 typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUT_PROTOCOL;
33 typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
34
35 //
36 // Define's for required EFI Unicode Box Draw characters
37 //
38 #define BOXDRAW_HORIZONTAL 0x2500
39 #define BOXDRAW_VERTICAL 0x2502
40 #define BOXDRAW_DOWN_RIGHT 0x250c
41 #define BOXDRAW_DOWN_LEFT 0x2510
42 #define BOXDRAW_UP_RIGHT 0x2514
43 #define BOXDRAW_UP_LEFT 0x2518
44 #define BOXDRAW_VERTICAL_RIGHT 0x251c
45 #define BOXDRAW_VERTICAL_LEFT 0x2524
46 #define BOXDRAW_DOWN_HORIZONTAL 0x252c
47 #define BOXDRAW_UP_HORIZONTAL 0x2534
48 #define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
49 #define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
50 #define BOXDRAW_DOUBLE_VERTICAL 0x2551
51 #define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
52 #define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
53 #define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
54 #define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
55 #define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
56 #define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
57 #define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
58 #define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
59 #define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
60 #define BOXDRAW_UP_LEFT_DOUBLE 0x255b
61 #define BOXDRAW_UP_DOUBLE_LEFT 0x255c
62 #define BOXDRAW_DOUBLE_UP_LEFT 0x255d
63 #define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
64 #define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
65 #define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
66 #define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
67 #define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
68 #define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
69 #define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
70 #define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
71 #define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
72 #define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
73 #define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
74 #define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
75 #define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
76 #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
77 #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
78
79 //
80 // EFI Required Block Elements Code Chart
81 //
82 #define BLOCKELEMENT_FULL_BLOCK 0x2588
83 #define BLOCKELEMENT_LIGHT_SHADE 0x2591
84
85 //
86 // EFI Required Geometric Shapes Code Chart
87 //
88 #define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
89 #define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
90 #define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
91 #define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
92
93 //
94 // EFI Required Arrow shapes
95 //
96 #define ARROW_LEFT 0x2190
97 #define ARROW_UP 0x2191
98 #define ARROW_RIGHT 0x2192
99 #define ARROW_DOWN 0x2193
100
101 //
102 // EFI Console Colours
103 //
104 #define EFI_BLACK 0x00
105 #define EFI_BLUE 0x01
106 #define EFI_GREEN 0x02
107 #define EFI_CYAN (EFI_BLUE | EFI_GREEN)
108 #define EFI_RED 0x04
109 #define EFI_MAGENTA (EFI_BLUE | EFI_RED)
110 #define EFI_BROWN (EFI_GREEN | EFI_RED)
111 #define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
112 #define EFI_BRIGHT 0x08
113 #define EFI_DARKGRAY (EFI_BRIGHT)
114 #define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
115 #define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
116 #define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
117 #define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
118 #define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
119 #define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
120 #define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
121
122 #define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4))
123
124 #define EFI_BACKGROUND_BLACK 0x00
125 #define EFI_BACKGROUND_BLUE 0x10
126 #define EFI_BACKGROUND_GREEN 0x20
127 #define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
128 #define EFI_BACKGROUND_RED 0x40
129 #define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
130 #define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
131 #define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
132
133 //
134 // We currently define attributes from 0 - 7F for color manipulations
135 // To internally handle the local display characteristics for a particular character, we are defining
136 // Bit 7 to signify the local glyph representation for a character. If turned on, glyphs will be
137 // pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
138 // If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to
139 // non-local displays (e.g. serial or LAN consoles).
140 //
141 #define EFI_WIDE_ATTRIBUTE 0x80
142
143 /**
144 Reset the text output device hardware and optionaly run diagnostics
145
146 @param This Protocol instance pointer.
147 @param ExtendedVerification Driver may perform more exhaustive verfication
148 operation of the device during reset.
149
150 @retval EFI_SUCCESS The text output device was reset.
151 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
152 could not be reset.
153
154 **/
155 typedef
156 EFI_STATUS
157 (EFIAPI *EFI_TEXT_RESET) (
158 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
159 IN BOOLEAN ExtendedVerification
160 )
161 ;
162
163 /**
164 Write a Unicode string to the output device.
165
166 @param This Protocol instance pointer.
167 @param String The NULL-terminated Unicode string to be displayed on the output
168 device(s). All output devices must also support the Unicode
169 drawing defined in this file.
170
171 @retval EFI_SUCCESS The string was output to the device.
172 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output
173 the text.
174 @retval EFI_UNSUPPORTED The output device's mode is not currently in a
175 defined text mode.
176 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
177 characters in the Unicode string could not be
178 rendered and were skipped.
179
180 **/
181 typedef
182 EFI_STATUS
183 (EFIAPI *EFI_TEXT_STRING) (
184 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
185 IN CHAR16 *String
186 )
187 ;
188
189 /**
190 Verifies that all characters in a Unicode string can be output to the
191 target device.
192
193 @param This Protocol instance pointer.
194 @param String The NULL-terminated Unicode string to be examined for the output
195 device(s).
196
197 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.
198 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be
199 rendered by one or more of the output devices mapped
200 by the EFI handle.
201
202 **/
203 typedef
204 EFI_STATUS
205 (EFIAPI *EFI_TEXT_TEST_STRING) (
206 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
207 IN CHAR16 *String
208 )
209 ;
210
211 /**
212 Returns information for an available text mode that the output device(s)
213 supports.
214
215 @param This Protocol instance pointer.
216 @param ModeNumber The mode number to return information on.
217 @param Columns Returns the geometry of the text output device for the
218 requested ModeNumber.
219 @param Rows Returns the geometry of the text output device for the
220 requested ModeNumber.
221
222 @retval EFI_SUCCESS The requested mode information was returned.
223 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
224 @retval EFI_UNSUPPORTED The mode number was not valid.
225
226 **/
227 typedef
228 EFI_STATUS
229 (EFIAPI *EFI_TEXT_QUERY_MODE) (
230 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
231 IN UINTN ModeNumber,
232 OUT UINTN *Columns,
233 OUT UINTN *Rows
234 )
235 ;
236
237 /**
238 Sets the output device(s) to a specified mode.
239
240 @param This Protocol instance pointer.
241 @param ModeNumber The mode number to set.
242
243 @retval EFI_SUCCESS The requested text mode was set.
244 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
245 @retval EFI_UNSUPPORTED The mode number was not valid.
246
247 **/
248 typedef
249 EFI_STATUS
250 (EFIAPI *EFI_TEXT_SET_MODE) (
251 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
252 IN UINTN ModeNumber
253 )
254 ;
255
256 /**
257 Sets the background and foreground colors for the OutputString () and
258 ClearScreen () functions.
259
260 @param This Protocol instance pointer.
261 @param Attribute The attribute to set. Bits 0..3 are the foreground color, and
262 bits 4..6 are the background color. All other bits are undefined
263 and must be zero. The valid Attributes are defined in this file.
264
265 @retval EFI_SUCCESS The attribute was set.
266 @retval EFI_DEVICE_ ERROR The device had an error and could not complete the request.
267 @retval EFI_UNSUPPORTED The attribute requested is not defined.
268
269 **/
270 typedef
271 EFI_STATUS
272 (EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
273 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
274 IN UINTN Attribute
275 )
276 ;
277
278 /**
279 Clears the output device(s) display to the currently selected background
280 color.
281
282 @param This Protocol instance pointer.
283
284 @retval EFI_SUCCESS The operation completed successfully.
285 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
286 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
287
288 **/
289 typedef
290 EFI_STATUS
291 (EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
292 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
293 )
294 ;
295
296 /**
297 Sets the current coordinates of the cursor position
298
299 @param This Protocol instance pointer.
300 @param Column The position to set the cursor to. Must be greater than or
301 equal to zero and less than the number of columns and rows
302 by QueryMode ().
303 @param Row The position to set the cursor to. Must be greater than or
304 equal to zero and less than the number of columns and rows
305 by QueryMode ().
306
307 @retval EFI_SUCCESS The operation completed successfully.
308 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
309 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the
310 cursor position is invalid for the current mode.
311
312 **/
313 typedef
314 EFI_STATUS
315 (EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
316 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
317 IN UINTN Column,
318 IN UINTN Row
319 )
320 ;
321
322 /**
323 Makes the cursor visible or invisible
324
325 @param This Protocol instance pointer.
326 @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
327 set to be invisible.
328
329 @retval EFI_SUCCESS The operation completed successfully.
330 @retval EFI_DEVICE_ERROR The device had an error and could not complete the
331 request, or the device does not support changing
332 the cursor mode.
333 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
334
335 **/
336 typedef
337 EFI_STATUS
338 (EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
339 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
340 IN BOOLEAN Visible
341 )
342 ;
343
344 /**
345 Mode Structure pointed to by Simple Text Out protocol.
346
347 MaxMode - The number of modes supported by QueryMode () and SetMode ().
348 Mode - The text mode of the output device(s).
349 Attribute - The current character output attribute
350 CursorColumn - The cursor's column.
351 CursorRow - The cursor's row.
352 CursorVisible - The cursor is currently visbile or not.
353
354 **/
355 typedef struct {
356 INT32 MaxMode;
357
358 //
359 // current settings
360 //
361 INT32 Mode;
362 INT32 Attribute;
363 INT32 CursorColumn;
364 INT32 CursorRow;
365 BOOLEAN CursorVisible;
366 } EFI_SIMPLE_TEXT_OUTPUT_MODE;
367
368 struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL {
369 EFI_TEXT_RESET Reset;
370
371 EFI_TEXT_STRING OutputString;
372 EFI_TEXT_TEST_STRING TestString;
373
374 EFI_TEXT_QUERY_MODE QueryMode;
375 EFI_TEXT_SET_MODE SetMode;
376 EFI_TEXT_SET_ATTRIBUTE SetAttribute;
377
378 EFI_TEXT_CLEAR_SCREEN ClearScreen;
379 EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
380 EFI_TEXT_ENABLE_CURSOR EnableCursor;
381
382 //
383 // Current mode
384 //
385 EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
386 };
387
388 extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
389
390 #endif