22.3 Simple Text Output Protocol Implementation

The implementation of the Simple Text Output Protocol is typically found in the file `SimpleTextOutput.c'. Appendix A contains a template for a SimpleTextOutput.c file for a UEFI Driver. The list of tasks to implement the Simple Text Output Protocol is as follows:

  • Add global variable for the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance to SimpleTextOutput.c.
  • Add global variable for the EFI_SIMPLE_TEXT_OUTPUT_MODE structure to SimpleTextOutput.c.
  • Implement the Simple Text Output Protocol services in SimpleTextInput.c.

The example below shows the protocol interface structure for the Simple Text Output Protocol for reference. This protocol is composed of nine services and a pointer to a Mode structure.

Example 225-Simple Text Output Protocol
typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;

///
/// The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
/// It is the minimum required protocol for any handle supplied as the ConsoleOut
/// or StandardError device. In addition, the minimum supported text mode of such
/// devices is at least 80 x 25 characters.
///
struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
  EFI_TEXT_RESET Reset;

  EFI_TEXT_STRING OutputString;
  EFI_TEXT_TEST_STRING TestString;

  EFI_TEXT_QUERY_MODE QueryMode;
  EFI_TEXT_SET_MODE SetMode;
  EFI_TEXT_SET_ATTRIBUTE SetAttribute;

  EFI_TEXT_CLEAR_SCREEN ClearScreen;
  EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
  EFI_TEXT_ENABLE_CURSOR EnableCursor;

  ///
  /// Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
  ///
  EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
};