--- /dev/null
+/** @file\r
+ Simple Text Out protocol from the EFI 1.0 specification.\r
+\r
+ Abstraction of a very simple text based output device like VGA text mode or\r
+ a serial terminal. The Simple Text Out protocol instance can represent\r
+ a single hardware device or a virtual device that is an agregation\r
+ of multiple physical devices.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+ Module Name: SimpleTextOut.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_TEXT_OUT_H__\r
+#define __SIMPLE_TEXT_OUT_H__\r
+\r
+#define EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID \\r
+ { \\r
+ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+ }\r
+\r
+#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID\r
+\r
+typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUT_PROTOCOL;\r
+typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;\r
+\r
+//\r
+// Define's for required EFI Unicode Box Draw characters\r
+//\r
+#define BOXDRAW_HORIZONTAL 0x2500\r
+#define BOXDRAW_VERTICAL 0x2502\r
+#define BOXDRAW_DOWN_RIGHT 0x250c\r
+#define BOXDRAW_DOWN_LEFT 0x2510\r
+#define BOXDRAW_UP_RIGHT 0x2514\r
+#define BOXDRAW_UP_LEFT 0x2518\r
+#define BOXDRAW_VERTICAL_RIGHT 0x251c\r
+#define BOXDRAW_VERTICAL_LEFT 0x2524\r
+#define BOXDRAW_DOWN_HORIZONTAL 0x252c\r
+#define BOXDRAW_UP_HORIZONTAL 0x2534\r
+#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c\r
+#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550\r
+#define BOXDRAW_DOUBLE_VERTICAL 0x2551\r
+#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552\r
+#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553\r
+#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554\r
+#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555\r
+#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556\r
+#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557\r
+#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558\r
+#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559\r
+#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a\r
+#define BOXDRAW_UP_LEFT_DOUBLE 0x255b\r
+#define BOXDRAW_UP_DOUBLE_LEFT 0x255c\r
+#define BOXDRAW_DOUBLE_UP_LEFT 0x255d\r
+#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e\r
+#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f\r
+#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560\r
+#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561\r
+#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562\r
+#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563\r
+#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564\r
+#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565\r
+#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566\r
+#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567\r
+#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568\r
+#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569\r
+#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a\r
+#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b\r
+#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c\r
+\r
+//\r
+// EFI Required Block Elements Code Chart\r
+//\r
+#define BLOCKELEMENT_FULL_BLOCK 0x2588\r
+#define BLOCKELEMENT_LIGHT_SHADE 0x2591\r
+\r
+//\r
+// EFI Required Geometric Shapes Code Chart\r
+//\r
+#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2\r
+#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba\r
+#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc\r
+#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4\r
+\r
+//\r
+// EFI Required Arrow shapes\r
+//\r
+#define ARROW_LEFT 0x2190\r
+#define ARROW_UP 0x2191\r
+#define ARROW_RIGHT 0x2192\r
+#define ARROW_DOWN 0x2193\r
+\r
+//\r
+// EFI Console Colours\r
+//\r
+#define EFI_BLACK 0x00\r
+#define EFI_BLUE 0x01\r
+#define EFI_GREEN 0x02\r
+#define EFI_CYAN (EFI_BLUE | EFI_GREEN)\r
+#define EFI_RED 0x04\r
+#define EFI_MAGENTA (EFI_BLUE | EFI_RED)\r
+#define EFI_BROWN (EFI_GREEN | EFI_RED)\r
+#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)\r
+#define EFI_BRIGHT 0x08\r
+#define EFI_DARKGRAY (EFI_BRIGHT)\r
+#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)\r
+#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)\r
+#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)\r
+#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)\r
+#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)\r
+#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)\r
+#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)\r
+\r
+#define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4))\r
+\r
+#define EFI_BACKGROUND_BLACK 0x00\r
+#define EFI_BACKGROUND_BLUE 0x10\r
+#define EFI_BACKGROUND_GREEN 0x20\r
+#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)\r
+#define EFI_BACKGROUND_RED 0x40\r
+#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)\r
+#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
+#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
+\r
+//\r
+// We currently define attributes from 0 - 7F for color manipulations\r
+// To internally handle the local display characteristics for a particular character, we are defining\r
+// Bit 7 to signify the local glyph representation for a character. If turned on, glyphs will be\r
+// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)\r
+// If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to\r
+// non-local displays (e.g. serial or LAN consoles).\r
+//\r
+#define EFI_WIDE_ATTRIBUTE 0x80\r
+\r
+/**\r
+ Reset the text output device hardware and optionaly run diagnostics\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ExtendedVerification Driver may perform more exhaustive verfication\r
+ operation of the device during reset.\r
+\r
+ @retval EFI_SUCCESS The text output device was reset.\r
+ @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and\r
+ could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_RESET) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ )\r
+;\r
+\r
+/**\r
+ Write a Unicode string to the output device.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param String The NULL-terminated Unicode string to be displayed on the output\r
+ device(s). All output devices must also support the Unicode\r
+ drawing defined in this file.\r
+\r
+ @retval EFI_SUCCESS The string was output to the device.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
+ the text.\r
+ @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
+ defined text mode.\r
+ @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
+ characters in the Unicode string could not be\r
+ rendered and were skipped.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_STRING) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN CHAR16 *String\r
+ )\r
+;\r
+\r
+/**\r
+ Verifies that all characters in a Unicode string can be output to the \r
+ target device.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param String The NULL-terminated Unicode string to be examined for the output\r
+ device(s).\r
+\r
+ @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
+ @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be\r
+ rendered by one or more of the output devices mapped\r
+ by the EFI handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_TEST_STRING) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN CHAR16 *String\r
+ )\r
+;\r
+\r
+/**\r
+ Returns information for an available text mode that the output device(s)\r
+ supports.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ModeNumber The mode number to return information on.\r
+ @param Columns Returns the geometry of the text output device for the\r
+ requested ModeNumber.\r
+ @param Rows Returns the geometry of the text output device for the\r
+ requested ModeNumber.\r
+ \r
+ @retval EFI_SUCCESS The requested mode information was returned.\r
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+ @retval EFI_UNSUPPORTED The mode number was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_QUERY_MODE) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN UINTN ModeNumber,\r
+ OUT UINTN *Columns,\r
+ OUT UINTN *Rows\r
+ )\r
+;\r
+\r
+/**\r
+ Sets the output device(s) to a specified mode.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ModeNumber The mode number to set.\r
+\r
+ @retval EFI_SUCCESS The requested text mode was set.\r
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+ @retval EFI_UNSUPPORTED The mode number was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_MODE) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN UINTN ModeNumber\r
+ )\r
+;\r
+\r
+/**\r
+ Sets the background and foreground colors for the OutputString () and\r
+ ClearScreen () functions.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Attribute The attribute to set. Bits 0..3 are the foreground color, and\r
+ bits 4..6 are the background color. All other bits are undefined\r
+ and must be zero. The valid Attributes are defined in this file.\r
+\r
+ @retval EFI_SUCCESS The attribute was set.\r
+ @retval EFI_DEVICE_ ERROR The device had an error and could not complete the request.\r
+ @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN UINTN Attribute\r
+ )\r
+;\r
+\r
+/**\r
+ Clears the output device(s) display to the currently selected background \r
+ color.\r
+\r
+ @param This Protocol instance pointer.\r
+ \r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+ @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This\r
+ )\r
+;\r
+\r
+/**\r
+ Sets the current coordinates of the cursor position\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Column The position to set the cursor to. Must be greater than or\r
+ equal to zero and less than the number of columns and rows\r
+ by QueryMode ().\r
+ @param Row The position to set the cursor to. Must be greater than or\r
+ equal to zero and less than the number of columns and rows\r
+ by QueryMode ().\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+ @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the\r
+ cursor position is invalid for the current mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN UINTN Column,\r
+ IN UINTN Row\r
+ )\r
+;\r
+\r
+/**\r
+ Makes the cursor visible or invisible\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r
+ set to be invisible.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r
+ request, or the device does not support changing\r
+ the cursor mode.\r
+ @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (\r
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,\r
+ IN BOOLEAN Visible\r
+ )\r
+;\r
+\r
+/**\r
+ Mode Structure pointed to by Simple Text Out protocol.\r
+\r
+ MaxMode - The number of modes supported by QueryMode () and SetMode ().\r
+ Mode - The text mode of the output device(s).\r
+ Attribute - The current character output attribute\r
+ CursorColumn - The cursor's column.\r
+ CursorRow - The cursor's row.\r
+ CursorVisible - The cursor is currently visbile or not.\r
+\r
+**/\r
+typedef struct {\r
+ INT32 MaxMode;\r
+\r
+ //\r
+ // current settings\r
+ //\r
+ INT32 Mode;\r
+ INT32 Attribute;\r
+ INT32 CursorColumn;\r
+ INT32 CursorRow;\r
+ BOOLEAN CursorVisible;\r
+} EFI_SIMPLE_TEXT_OUTPUT_MODE;\r
+\r
+struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL {\r
+ EFI_TEXT_RESET Reset;\r
+\r
+ EFI_TEXT_STRING OutputString;\r
+ EFI_TEXT_TEST_STRING TestString;\r
+\r
+ EFI_TEXT_QUERY_MODE QueryMode;\r
+ EFI_TEXT_SET_MODE SetMode;\r
+ EFI_TEXT_SET_ATTRIBUTE SetAttribute;\r
+\r
+ EFI_TEXT_CLEAR_SCREEN ClearScreen;\r
+ EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;\r
+ EFI_TEXT_ENABLE_CURSOR EnableCursor;\r
+\r
+ //\r
+ // Current mode\r
+ //\r
+ EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiSimpleTextOutProtocolGuid;\r
+\r
+#endif\r