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