2 Simple Text Out protocol from the UEFI 2.0 specification.
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.
9 Copyright (c) 2006 - 2008, 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
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.
20 #ifndef __SIMPLE_TEXT_OUT_H__
21 #define __SIMPLE_TEXT_OUT_H__
25 #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
27 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
31 /// Protocol GUID defined in EFI1.1.
33 #define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID
35 typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
;
38 /// Backward-compatible with EFI1.1.
40 typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SIMPLE_TEXT_OUTPUT_INTERFACE
;
43 // Define's for required EFI Unicode Box Draw characters
45 #define BOXDRAW_HORIZONTAL 0x2500
46 #define BOXDRAW_VERTICAL 0x2502
47 #define BOXDRAW_DOWN_RIGHT 0x250c
48 #define BOXDRAW_DOWN_LEFT 0x2510
49 #define BOXDRAW_UP_RIGHT 0x2514
50 #define BOXDRAW_UP_LEFT 0x2518
51 #define BOXDRAW_VERTICAL_RIGHT 0x251c
52 #define BOXDRAW_VERTICAL_LEFT 0x2524
53 #define BOXDRAW_DOWN_HORIZONTAL 0x252c
54 #define BOXDRAW_UP_HORIZONTAL 0x2534
55 #define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
56 #define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
57 #define BOXDRAW_DOUBLE_VERTICAL 0x2551
58 #define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
59 #define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
60 #define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
61 #define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
62 #define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
63 #define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
64 #define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
65 #define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
66 #define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
67 #define BOXDRAW_UP_LEFT_DOUBLE 0x255b
68 #define BOXDRAW_UP_DOUBLE_LEFT 0x255c
69 #define BOXDRAW_DOUBLE_UP_LEFT 0x255d
70 #define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
71 #define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
72 #define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
73 #define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
74 #define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
75 #define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
76 #define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
77 #define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
78 #define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
79 #define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
80 #define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
81 #define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
82 #define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
83 #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
84 #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
87 // EFI Required Block Elements Code Chart
89 #define BLOCKELEMENT_FULL_BLOCK 0x2588
90 #define BLOCKELEMENT_LIGHT_SHADE 0x2591
93 // EFI Required Geometric Shapes Code Chart
95 #define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
96 #define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
97 #define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
98 #define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
101 // EFI Required Arrow shapes
103 #define ARROW_LEFT 0x2190
104 #define ARROW_UP 0x2191
105 #define ARROW_RIGHT 0x2192
106 #define ARROW_DOWN 0x2193
109 // EFI Console Colours
111 #define EFI_BLACK 0x00
112 #define EFI_BLUE 0x01
113 #define EFI_GREEN 0x02
114 #define EFI_CYAN (EFI_BLUE | EFI_GREEN)
116 #define EFI_MAGENTA (EFI_BLUE | EFI_RED)
117 #define EFI_BROWN (EFI_GREEN | EFI_RED)
118 #define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
119 #define EFI_BRIGHT 0x08
120 #define EFI_DARKGRAY (EFI_BRIGHT)
121 #define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
122 #define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
123 #define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
124 #define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
125 #define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
126 #define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
127 #define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
129 #define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4))
131 #define EFI_BACKGROUND_BLACK 0x00
132 #define EFI_BACKGROUND_BLUE 0x10
133 #define EFI_BACKGROUND_GREEN 0x20
134 #define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
135 #define EFI_BACKGROUND_RED 0x40
136 #define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
137 #define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
138 #define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
141 // We currently define attributes from 0 - 7F for color manipulations
142 // To internally handle the local display characteristics for a particular character, we are defining
143 // Bit 7 to signify the local glyph representation for a character. If turned on, glyphs will be
144 // pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
145 // If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to
146 // non-local displays (e.g. serial or LAN consoles).
148 #define EFI_WIDE_ATTRIBUTE 0x80
151 Reset the text output device hardware and optionaly run diagnostics
153 @param This Protocol instance pointer.
154 @param ExtendedVerification Driver may perform more exhaustive verfication
155 operation of the device during reset.
157 @retval EFI_SUCCESS The text output device was reset.
158 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
164 (EFIAPI
*EFI_TEXT_RESET
)(
165 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
166 IN BOOLEAN ExtendedVerification
170 Write a Unicode string to the output device.
172 @param This Protocol instance pointer.
173 @param String The NULL-terminated Unicode string to be displayed on the output
174 device(s). All output devices must also support the Unicode
175 drawing defined in this file.
177 @retval EFI_SUCCESS The string was output to the device.
178 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output
180 @retval EFI_UNSUPPORTED The output device's mode is not currently in a
182 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
183 characters in the Unicode string could not be
184 rendered and were skipped.
189 (EFIAPI
*EFI_TEXT_STRING
)(
190 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
195 Verifies that all characters in a Unicode string can be output to the
198 @param This Protocol instance pointer.
199 @param String The NULL-terminated Unicode string to be examined for the output
202 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.
203 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be
204 rendered by one or more of the output devices mapped
210 (EFIAPI
*EFI_TEXT_TEST_STRING
)(
211 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
216 Returns information for an available text mode that the output device(s)
219 @param This Protocol instance pointer.
220 @param ModeNumber The mode number to return information on.
221 @param Columns Returns the geometry of the text output device for the
222 requested ModeNumber.
223 @param Rows Returns the geometry of the text output device for the
224 requested ModeNumber.
226 @retval EFI_SUCCESS The requested mode information was returned.
227 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
228 @retval EFI_UNSUPPORTED The mode number was not valid.
233 (EFIAPI
*EFI_TEXT_QUERY_MODE
)(
234 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
241 Sets the output device(s) to a specified mode.
243 @param This Protocol instance pointer.
244 @param ModeNumber The mode number to set.
246 @retval EFI_SUCCESS The requested text mode was set.
247 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
248 @retval EFI_UNSUPPORTED The mode number was not valid.
253 (EFIAPI
*EFI_TEXT_SET_MODE
)(
254 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
259 Sets the background and foreground colors for the OutputString () and
260 ClearScreen () functions.
262 @param This Protocol instance pointer.
263 @param Attribute The attribute to set. Bits 0..3 are the foreground color, and
264 bits 4..6 are the background color. All other bits are undefined
265 and must be zero. The valid Attributes are defined in this file.
267 @retval EFI_SUCCESS The attribute was set.
268 @retval EFI_DEVICE_ ERROR The device had an error and could not complete the request.
269 @retval EFI_UNSUPPORTED The attribute requested is not defined.
274 (EFIAPI
*EFI_TEXT_SET_ATTRIBUTE
)(
275 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
280 Clears the output device(s) display to the currently selected background
283 @param This Protocol instance pointer.
285 @retval EFI_SUCCESS The operation completed successfully.
286 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
287 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
292 (EFIAPI
*EFI_TEXT_CLEAR_SCREEN
)(
293 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
297 Sets the current coordinates of the cursor position
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
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
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.
315 (EFIAPI
*EFI_TEXT_SET_CURSOR_POSITION
)(
316 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
322 Makes the cursor visible or invisible
324 @param This Protocol instance pointer.
325 @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
328 @retval EFI_SUCCESS The operation completed successfully.
329 @retval EFI_DEVICE_ERROR The device had an error and could not complete the
330 request, or the device does not support changing
332 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
337 (EFIAPI
*EFI_TEXT_ENABLE_CURSOR
)(
338 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
343 @par Data Structure Description:
344 Mode Structure pointed to by Simple Text Out protocol.
347 The number of modes supported by QueryMode () and SetMode ().
350 The text mode of the output device(s).
353 The current character output attribute
362 The cursor is currently visbile or not.
375 BOOLEAN CursorVisible
;
376 } EFI_SIMPLE_TEXT_OUTPUT_MODE
;
379 @par Protocol Description:
380 The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
381 It is the minimum required protocol for any handle supplied as the ConsoleOut
382 or StandardError device. In addition, the minimum supported text mode of such
383 devices is at least 80 x 25 characters.
386 Reset the ConsoleOut device.
389 Displays the Unicode string on the device at the current cursor location.
392 Tests to see if the ConsoleOut device supports this Unicode string.
395 Queries information concerning the output device's supported text mode.
398 Sets the current mode of the output device.
401 Sets the foreground and background color of the text that is output.
404 Clears the screen with the currently set background color.
406 @param SetCursorPosition
407 Sets the current cursor position.
410 Turns the visibility of the cursor on/off.
413 Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
415 struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
{
416 EFI_TEXT_RESET Reset
;
418 EFI_TEXT_STRING OutputString
;
419 EFI_TEXT_TEST_STRING TestString
;
421 EFI_TEXT_QUERY_MODE QueryMode
;
422 EFI_TEXT_SET_MODE SetMode
;
423 EFI_TEXT_SET_ATTRIBUTE SetAttribute
;
425 EFI_TEXT_CLEAR_SCREEN ClearScreen
;
426 EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition
;
427 EFI_TEXT_ENABLE_CURSOR EnableCursor
;
432 EFI_SIMPLE_TEXT_OUTPUT_MODE
*Mode
;
435 extern EFI_GUID gEfiSimpleTextOutProtocolGuid
;