You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
2255bc10b0
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>
53 lines
1.5 KiB
C
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));
|
|
}
|