TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiLibPrint.c File Reference
#include "UefiLibInternal.h"

Go to the source code of this file.

Functions

UINTN InternalPrint (IN CONST CHAR16 *Format, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, IN VA_LIST Marker)
 
UINTN EFIAPI Print (IN CONST CHAR16 *Format,...)
 
UINTN EFIAPI ErrorPrint (IN CONST CHAR16 *Format,...)
 
UINTN AsciiInternalPrint (IN CONST CHAR8 *Format, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, IN VA_LIST Marker)
 
UINTN EFIAPI AsciiPrint (IN CONST CHAR8 *Format,...)
 
UINTN EFIAPI AsciiErrorPrint (IN CONST CHAR8 *Format,...)
 
UINTN InternalPrintGraphic (IN UINTN PointX, IN UINTN PointY, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background, IN CHAR16 *Buffer, IN UINTN PrintNum)
 
UINTN EFIAPI PrintXY (IN UINTN PointX, IN UINTN PointY, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL, IN CONST CHAR16 *Format,...)
 
UINTN EFIAPI AsciiPrintXY (IN UINTN PointX, IN UINTN PointY, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL, IN CONST CHAR8 *Format,...)
 
CHAR16 *EFIAPI CatVSPrint (IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
 
CHAR16 *EFIAPI CatSPrint (IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString,...)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors [16]
 

Detailed Description

Mde UEFI library API implementation. Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UefiLibPrint.c.

Function Documentation

◆ AsciiErrorPrint()

UINTN EFIAPI AsciiErrorPrint ( IN CONST CHAR8 *  Format,
  ... 
)

Prints a formatted ASCII string to the console output device specified by StdErr defined in the EFI_SYSTEM_TABLE.

This function prints a formatted ASCII string to the console output device specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII characters that printed to StdErr. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. If Format is NULL, then ASSERT(). If gST->StdErr is NULL, then ASSERT().

Parameters
FormatA Null-terminated ASCII format string.
...Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of ASCII characters printed to ConErr.

Definition at line 290 of file UefiLibPrint.c.

◆ AsciiInternalPrint()

UINTN AsciiInternalPrint ( IN CONST CHAR8 *  Format,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL Console,
IN VA_LIST  Marker 
)

Internal function which prints a formatted ASCII string to the console output device specified by Console

This function prints a formatted ASCII string to the console output device specified by Console and returns the number of ASCII characters that printed to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.

If Format is NULL, then ASSERT().

Parameters
FormatA Null-terminated ASCII format string.
ConsoleThe output console.
MarkerVA_LIST marker for the variable argument list.
Returns
The number of Unicode characters in the produced output buffer not including the Null-terminator.

Definition at line 189 of file UefiLibPrint.c.

◆ AsciiPrint()

UINTN EFIAPI AsciiPrint ( IN CONST CHAR8 *  Format,
  ... 
)

Prints a formatted ASCII string to the console output device specified by ConOut defined in the EFI_SYSTEM_TABLE.

This function prints a formatted ASCII string to the console output device specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII characters that printed to ConOut. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. If Format is NULL, then ASSERT(). If gST->ConOut is NULL, then ASSERT().

Parameters
FormatA Null-terminated ASCII format string.
...Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of ASCII characters printed to ConOut.

Definition at line 250 of file UefiLibPrint.c.

◆ AsciiPrintXY()

UINTN EFIAPI AsciiPrintXY ( IN UINTN  PointX,
IN UINTN  PointY,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround  OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround  OPTIONAL,
IN CONST CHAR8 *  Format,
  ... 
)

Prints a formatted ASCII string to a graphics console device specified by ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.

This function prints a formatted ASCII string to the graphics console device specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of ASCII characters displayed, not including partial characters that may be clipped by the right edge of the display. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, then at most the first PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL StringToImage() service is used to convert the string to a bitmap using the glyphs registered with the HII database. No wrapping is performed, so any portions of the string the fall outside the active display region will not be displayed. Please see Section 27.2.6 of the UEFI Specification for a description of the supported string format including the set of control codes supported by the StringToImage() service.

If a graphics console device is not associated with the ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no string is printed, and 0 is returned. If Format is NULL, then ASSERT(). If gST->ConsoleOutputHandle is NULL, then ASSERT().

Parameters
PointXAn X coordinate to print the string.
PointYA Y coordinate to print the string.
ForeGroundThe foreground color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the foreground color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
BackGroundThe background color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the background color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
FormatA Null-terminated ASCII format string. See Print Library for the supported format string syntax.
...Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of ASCII characters printed.

Definition at line 700 of file UefiLibPrint.c.

◆ CatSPrint()

CHAR16 *EFIAPI CatSPrint ( IN CHAR16 *String  OPTIONAL,
IN CONST CHAR16 *  FormatString,
  ... 
)

Appends a formatted Unicode string to a Null-terminated Unicode string

This function appends a formatted Unicode string to the Null-terminated Unicode string specified by String. String is optional and may be NULL. Storage for the formatted Unicode string returned is allocated using AllocatePool(). The pointer to the appended string is returned. The caller is responsible for freeing the returned string.

If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). If FormatString is NULL, then ASSERT(). If FormatString is not aligned on a 16-bit boundary, then ASSERT().

Parameters
[in]StringA Null-terminated Unicode string.
[in]FormatStringA Null-terminated Unicode format string.
[in]...The variable argument list whose contents are accessed based on the format string specified by FormatString.
Return values
NULLThere was not enough available memory.
Returns
Null-terminated Unicode string is that is the formatted string appended to String.

Definition at line 827 of file UefiLibPrint.c.

◆ CatVSPrint()

CHAR16 *EFIAPI CatVSPrint ( IN CHAR16 *String  OPTIONAL,
IN CONST CHAR16 *  FormatString,
IN VA_LIST  Marker 
)

Appends a formatted Unicode string to a Null-terminated Unicode string

This function appends a formatted Unicode string to the Null-terminated Unicode string specified by String. String is optional and may be NULL. Storage for the formatted Unicode string returned is allocated using AllocatePool(). The pointer to the appended string is returned. The caller is responsible for freeing the returned string.

If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). If FormatString is NULL, then ASSERT(). If FormatString is not aligned on a 16-bit boundary, then ASSERT().

Parameters
[in]StringA Null-terminated Unicode string.
[in]FormatStringA Null-terminated Unicode format string.
[in]MarkerVA_LIST marker for the variable argument list.
Return values
NULLThere was not enough available memory.
Returns
Null-terminated Unicode string is that is the formatted string appended to String.

Definition at line 762 of file UefiLibPrint.c.

◆ ErrorPrint()

UINTN EFIAPI ErrorPrint ( IN CONST CHAR16 *  Format,
  ... 
)

Prints a formatted Unicode string to the console output device specified by StdErr defined in the EFI_SYSTEM_TABLE.

This function prints a formatted Unicode string to the console output device specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode characters that printed to StdErr. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT(). If gST->StdErr is NULL, then ASSERT().

Parameters
FormatA Null-terminated Unicode format string.
...Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of Unicode characters printed to StdErr.

Definition at line 152 of file UefiLibPrint.c.

◆ InternalPrint()

UINTN InternalPrint ( IN CONST CHAR16 *  Format,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL Console,
IN VA_LIST  Marker 
)

Internal function which prints a formatted Unicode string to the console output device specified by Console

This function prints a formatted Unicode string to the console output device specified by Console and returns the number of Unicode characters that printed to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT().

Parameters
FormatA Null-terminated Unicode format string.
ConsoleThe output console.
MarkerA VA_LIST marker for the variable argument list.
Returns
The number of Unicode characters in the produced output buffer, not including the Null-terminator.

Definition at line 50 of file UefiLibPrint.c.

◆ InternalPrintGraphic()

UINTN InternalPrintGraphic ( IN UINTN  PointX,
IN UINTN  PointY,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
IN CHAR16 *  Buffer,
IN UINTN  PrintNum 
)

Internal function to print a formatted Unicode string to a graphics console device specified by ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.

This function prints a formatted Unicode string to the graphics console device specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the string to a bitmap using the glyphs registered with the HII database. No wrapping is performed, so any portions of the string the fall outside the active display region will not be displayed.

If a graphics console device is not associated with the ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no string is printed, and 0 is returned.

Parameters
PointXAn X coordinate to print the string.
PointYA Y coordinate to print the string.
ForegroundThe foreground color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the foreground color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
BackgroundThe background color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the background color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
BufferA Null-terminated Unicode formatted string.
PrintNumThe number of Unicode formatted string to be printed.
Returns
The number of Unicode Characters printed. Zero means no any character displayed successfully.

Definition at line 343 of file UefiLibPrint.c.

◆ Print()

UINTN EFIAPI Print ( IN CONST CHAR16 *  Format,
  ... 
)

Prints a formatted Unicode string to the console output device specified by ConOut defined in the EFI_SYSTEM_TABLE.

This function prints a formatted Unicode string to the console output device specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode characters that printed to ConOut. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT(). If gST->ConOut is NULL, then ASSERT().

Parameters
FormatA Null-terminated Unicode format string.
...A Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of Unicode characters printed to ConOut.

Definition at line 113 of file UefiLibPrint.c.

◆ PrintXY()

UINTN EFIAPI PrintXY ( IN UINTN  PointX,
IN UINTN  PointY,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround  OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround  OPTIONAL,
IN CONST CHAR16 *  Format,
  ... 
)

Prints a formatted Unicode string to a graphics console device specified by ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.

This function prints a formatted Unicode string to the graphics console device specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of Unicode characters displayed, not including partial characters that may be clipped by the right edge of the display. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then at most the first PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL StringToImage() service is used to convert the string to a bitmap using the glyphs registered with the HII database. No wrapping is performed, so any portions of the string the fall outside the active display region will not be displayed. Please see Section 27.2.6 of the UEFI Specification for a description of the supported string format including the set of control codes supported by the StringToImage() service.

If a graphics console device is not associated with the ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no string is printed, and 0 is returned. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT(). If gST->ConsoleOutputHandle is NULL, then ASSERT().

Parameters
PointXAn X coordinate to print the string.
PointYA Y coordinate to print the string.
ForeGroundThe foreground color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the foreground color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
BackGroundThe background color of the string being printed. This is an optional parameter that may be NULL. If it is NULL, then the background color of the current ConOut device in the EFI_SYSTEM_TABLE is used.
FormatA Null-terminated Unicode format string. See Print Library for the supported format string syntax.
...A Variable argument list whose contents are accessed based on the format string specified by Format.
Returns
The number of Unicode characters printed.

Definition at line 617 of file UefiLibPrint.c.

Variable Documentation

◆ mEfiColors

Initial value:
= {
{ 0x00, 0x00, 0x00, 0x00 },
{ 0x98, 0x00, 0x00, 0x00 },
{ 0x00, 0x98, 0x00, 0x00 },
{ 0x98, 0x98, 0x00, 0x00 },
{ 0x00, 0x00, 0x98, 0x00 },
{ 0x98, 0x00, 0x98, 0x00 },
{ 0x00, 0x98, 0x98, 0x00 },
{ 0x98, 0x98, 0x98, 0x00 },
{ 0x10, 0x10, 0x10, 0x00 },
{ 0xff, 0x10, 0x10, 0x00 },
{ 0x10, 0xff, 0x10, 0x00 },
{ 0xff, 0xff, 0x10, 0x00 },
{ 0x10, 0x10, 0xff, 0x00 },
{ 0xf0, 0x10, 0xff, 0x00 },
{ 0x10, 0xff, 0xff, 0x00 },
{ 0xff, 0xff, 0xff, 0x00 }
}

Definition at line 12 of file UefiLibPrint.c.