Files
slimbootloader/BootloaderCommonPkg/Library/ShellLib/Printing.c
T
Borgerson, Matthew A 2255bc10b0 Enable basic framebuffer text console output
This patch simplifies the GraphicsLib code and adds an abstraction layer
for printing to a virtual "console," through the familier
ConsoleWrite(buffer, len) style function call.

ConsoleWrite can be configured to output to either the serial port, or
the display framebuffer, or both. This primarily enables the command
shell to be used with a display and keyboard.

Signed-off-by: Borgerson, Matthew A <matthew.a.borgerson@intel.com>
2018-10-25 19:25:44 -07:00

53 lines
1.5 KiB
C

/** @file
Helper function for printing from the shell.
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Base.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/ConsoleOutLib.h>
//
// Define the maximum message length that this library supports
//
#define MAX_MESSAGE_LENGTH 0x100
/**
Prints a message to the serial port.
If Format is NULL, then ASSERT().
@param Format Format string for the message to print.
@param ... Variable argument list whose contents are accessed
based on the format string specified by Format.
**/
UINTN
EFIAPI
ShellPrint (
IN CONST CHAR16 *Format,
...
)
{
CHAR8 Buffer[MAX_MESSAGE_LENGTH];
VA_LIST Marker;
VA_START (Marker, Format);
AsciiVSPrintUnicodeFormat (Buffer, sizeof (Buffer), Format, Marker);
VA_END (Marker);
return ConsoleWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
}