TianoCore EDK2 master
Loading...
Searching...
No Matches
TerminalConOut.c File Reference
#include "Terminal.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI TerminalConOutReset (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI TerminalConOutOutputString (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CHAR16 *WString)
 
EFI_STATUS EFIAPI TerminalConOutTestString (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CHAR16 *WString)
 
EFI_STATUS EFIAPI TerminalConOutQueryMode (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows)
 
EFI_STATUS EFIAPI TerminalConOutSetMode (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber)
 
EFI_STATUS EFIAPI TerminalConOutSetAttribute (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN Attribute)
 
EFI_STATUS EFIAPI TerminalConOutClearScreen (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This)
 
EFI_STATUS EFIAPI TerminalConOutSetCursorPosition (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN Column, IN UINTN Row)
 
EFI_STATUS EFIAPI TerminalConOutEnableCursor (IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN Visible)
 
BOOLEAN TerminalIsValidTextGraphics (IN CHAR16 Graphic, OUT CHAR8 *PcAnsi OPTIONAL, OUT CHAR8 *Ascii OPTIONAL)
 
BOOLEAN TerminalIsValidAscii (IN CHAR16 Ascii)
 
BOOLEAN TerminalIsValidEfiCntlChar (IN CHAR16 CharC)
 

Variables

UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii []
 
CHAR16 mSetModeString [] = { ESC, '[', '=', '3', 'h', 0 }
 
CHAR16 mSetAttributeString [] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 }
 
CHAR16 mClearScreenString [] = { ESC, '[', '2', 'J', 0 }
 
CHAR16 mSetCursorPositionString [] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 }
 
CHAR16 mCursorForwardString [] = { ESC, '[', '0', '0', 'C', 0 }
 
CHAR16 mCursorBackwardString [] = { ESC, '[', '0', '0', 'D', 0 }
 

Detailed Description

Implementation for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL protocol.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TerminalConOut.c.

Function Documentation

◆ TerminalConOutClearScreen()

EFI_STATUS EFIAPI TerminalConOutClearScreen ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen(). It clears the ANSI terminal's display to the currently selected background color.

Parameters
ThisIndicates the calling context.
Return values
EFI_SUCCESSThe operation completed successfully.
EFI_DEVICE_ERRORThe terminal screen cannot be cleared due to serial port error.
EFI_UNSUPPORTEDThe terminal is not in a valid display mode.

Definition at line 696 of file TerminalConOut.c.

◆ TerminalConOutEnableCursor()

EFI_STATUS EFIAPI TerminalConOutEnableCursor ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN BOOLEAN  Visible 
)

Implements SIMPLE_TEXT_OUTPUT.EnableCursor().

In this driver, the cursor cannot be hidden.

Parameters
ThisIndicates the calling context.
VisibleIf TRUE, the cursor is set to be visible, If FALSE, the cursor is set to be invisible.
Return values
EFI_SUCCESSThe request is valid.
EFI_UNSUPPORTEDThe terminal does not support cursor hidden.

Definition at line 835 of file TerminalConOut.c.

◆ TerminalConOutOutputString()

EFI_STATUS EFIAPI TerminalConOutOutputString ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN CHAR16 *  WString 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().

The Unicode string will be converted to terminal expressible data stream and send to terminal via serial port.

Parameters
ThisIndicates the calling context.
WStringThe Null-terminated Unicode string to be displayed on the terminal screen.
Return values
EFI_SUCCESSThe string is output successfully.
EFI_DEVICE_ERRORThe serial port fails to send the string out.
EFI_WARN_UNKNOWN_GLYPHIndicates that some of the characters in the Unicode string could not be rendered and are skipped.
EFI_UNSUPPORTEDIf current display mode is out of range.

Definition at line 169 of file TerminalConOut.c.

◆ TerminalConOutQueryMode()

EFI_STATUS EFIAPI TerminalConOutQueryMode ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN UINTN  ModeNumber,
OUT UINTN Columns,
OUT UINTN Rows 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().

It returns information for an available text mode that the terminal supports.

Parameters
ThisIndicates the calling context.
ModeNumberThe mode number to return information on.
ColumnsThe returned columns of the requested mode.
RowsThe returned rows of the requested mode.
Return values
EFI_SUCCESSThe requested mode information is returned.
EFI_UNSUPPORTEDThe mode number is not valid.

Definition at line 429 of file TerminalConOut.c.

◆ TerminalConOutReset()

EFI_STATUS EFIAPI TerminalConOutReset ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().

If ExtendeVerification is TRUE, then perform dependent serial device reset, and set display mode to mode 0. If ExtendedVerification is FALSE, only set display mode to mode 0.

Parameters
ThisIndicates the calling context.
ExtendedVerificationIndicates that the driver may perform a more exhaustive verification operation of the device during reset.
Return values
EFI_SUCCESSThe reset operation succeeds.
EFI_DEVICE_ERRORThe terminal is not functioning correctly or the serial port reset fails.

Definition at line 105 of file TerminalConOut.c.

◆ TerminalConOutSetAttribute()

EFI_STATUS EFIAPI TerminalConOutSetAttribute ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN UINTN  Attribute 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().

Parameters
ThisIndicates the calling context.
AttributeThe attribute to set. Only bit0..6 are valid, all other bits are undefined and must be zero.
Return values
EFI_SUCCESSThe requested attribute is set.
EFI_DEVICE_ERRORThe requested attribute cannot be set due to serial port error.
EFI_UNSUPPORTEDThe attribute requested is not defined by EFI spec.

Definition at line 525 of file TerminalConOut.c.

◆ TerminalConOutSetCursorPosition()

EFI_STATUS EFIAPI TerminalConOutSetCursorPosition ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN UINTN  Column,
IN UINTN  Row 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().

Parameters
ThisIndicates the calling context.
ColumnThe row to set cursor to.
RowThe column to set cursor to.
Return values
EFI_SUCCESSThe operation completed successfully.
EFI_DEVICE_ERRORThe request fails due to serial port error.
EFI_UNSUPPORTEDThe terminal is not in a valid text mode, or the cursor position is invalid for current mode.

Definition at line 736 of file TerminalConOut.c.

◆ TerminalConOutSetMode()

EFI_STATUS EFIAPI TerminalConOutSetMode ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN UINTN  ModeNumber 
)

Implements EFI_SIMPLE_TEXT_OUT.SetMode().

Set the terminal to a specified display mode. In this driver, we only support mode 0.

Parameters
ThisIndicates the calling context.
ModeNumberThe text mode to set.
Return values
EFI_SUCCESSThe requested text mode is set.
EFI_DEVICE_ERRORThe requested text mode cannot be set because of serial device error.
EFI_UNSUPPORTEDThe text mode number is not valid.

Definition at line 469 of file TerminalConOut.c.

◆ TerminalConOutTestString()

EFI_STATUS EFIAPI TerminalConOutTestString ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL This,
IN CHAR16 *  WString 
)

Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().

If one of the characters in the *Wstring is neither valid Unicode drawing characters, not ASCII code, then this function will return EFI_UNSUPPORTED.

Parameters
ThisIndicates the calling context.
WStringThe Null-terminated Unicode string to be tested.
Return values
EFI_SUCCESSThe terminal is capable of rendering the output string.
EFI_UNSUPPORTEDSome of the characters in the Unicode string cannot be rendered.

Definition at line 379 of file TerminalConOut.c.

◆ TerminalIsValidAscii()

BOOLEAN TerminalIsValidAscii ( IN CHAR16  Ascii)

Detects if a valid ASCII char.

Parameters
AsciiAn ASCII character.
Return values
TRUEIf it is a valid ASCII character.
FALSEIf it is not a valid ASCII character.

Definition at line 903 of file TerminalConOut.c.

◆ TerminalIsValidEfiCntlChar()

BOOLEAN TerminalIsValidEfiCntlChar ( IN CHAR16  CharC)

Detects if a valid EFI control character.

Parameters
CharCAn input EFI Control character.
Return values
TRUEIf it is a valid EFI control character.
FALSEIf it is not a valid EFI control character.

Definition at line 927 of file TerminalConOut.c.

◆ TerminalIsValidTextGraphics()

BOOLEAN TerminalIsValidTextGraphics ( IN CHAR16  Graphic,
OUT CHAR8 *PcAnsi  OPTIONAL,
OUT CHAR8 *Ascii  OPTIONAL 
)

Detects if a Unicode char is for Box Drawing text graphics.

Parameters
GraphicUnicode char to test.
PcAnsiOptional pointer to return PCANSI equivalent of Graphic.
AsciiOptional pointer to return ASCII equivalent of Graphic.
Return values
TRUEIf Graphic is a supported Unicode Box Drawing character.

Definition at line 860 of file TerminalConOut.c.

Variable Documentation

◆ mClearScreenString

CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 }

Definition at line 78 of file TerminalConOut.c.

◆ mCursorBackwardString

CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 }

Definition at line 81 of file TerminalConOut.c.

◆ mCursorForwardString

CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 }

Definition at line 80 of file TerminalConOut.c.

◆ mSetAttributeString

CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 }

Definition at line 77 of file TerminalConOut.c.

◆ mSetCursorPositionString

CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 }

Definition at line 79 of file TerminalConOut.c.

◆ mSetModeString

CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 }

Definition at line 76 of file TerminalConOut.c.

◆ UnicodeToPcAnsiOrAscii

UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[]

Definition at line 18 of file TerminalConOut.c.