From f161b37fafeb25efd9fdb9cfbc6f24c3d94b2849 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sun, 3 Dec 2023 00:43:13 +0100 Subject: [PATCH] Implement BmPrint() routine --- xtldr2/console.c | 30 ++++++++++++++++++++++++++++++ xtldr2/globals.c | 3 +++ xtldr2/includes/bootman.h | 5 +++++ xtldr2/includes/globals.h | 3 +++ 4 files changed, 41 insertions(+) diff --git a/xtldr2/console.c b/xtldr2/console.c index 7bfd862..e9f0d16 100644 --- a/xtldr2/console.c +++ b/xtldr2/console.c @@ -73,6 +73,36 @@ BmInitializeConsole() BmEnableCursor(); } +/** + * This routine formats the input string and prints it out to the stdout and serial console. + * + * @param Format + * The formatted string that is to be written to the output. + * + * @param ... + * Depending on the format string, this routine might expect a sequence of additional arguments. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +BmPrint(IN PUINT16 Format, + IN ...) +{ + VA_LIST Arguments; + + /* Initialise the va_list */ + VA_START(Arguments, Format); + + /* Format and print the string to the stdout */ + BmPrintString(BmPrintChar, Format, Arguments); + + /* Clean up the va_list */ + VA_END(Arguments); +} + /** * Writes a character to the default EFI console. * diff --git a/xtldr2/globals.c b/xtldr2/globals.c index 10ba127..ef1cbbc 100644 --- a/xtldr2/globals.c +++ b/xtldr2/globals.c @@ -12,6 +12,9 @@ /* XT Boot Loader hex table */ STATIC PUINT16 BmpHexTable = L"0123456789ABCDEF"; +/* Serial port configuration */ +CPPORT BmpSerialPort; + /* EFI Image Handle */ EFI_HANDLE EfiImageHandle; diff --git a/xtldr2/includes/bootman.h b/xtldr2/includes/bootman.h index 20c7cdf..6a449ce 100644 --- a/xtldr2/includes/bootman.h +++ b/xtldr2/includes/bootman.h @@ -32,6 +32,11 @@ XTCDECL VOID BmInitializeConsole(); +XTCDECL +VOID +BmPrint(IN PUINT16 Format, + IN ...); + XTCDECL VOID BmPrintChar(IN USHORT Character); diff --git a/xtldr2/includes/globals.h b/xtldr2/includes/globals.h index ca7dcda..a9b2fab 100644 --- a/xtldr2/includes/globals.h +++ b/xtldr2/includes/globals.h @@ -15,6 +15,9 @@ /* XT Boot Loader hex table */ EXTERN PUINT16 BmpHexTable; +/* Serial port configuration */ +EXTERN CPPORT BmpSerialPort; + /* EFI Image Handle */ EXTERN EFI_HANDLE EfiImageHandle;