XTLDR console/debug print refactor
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 43s
Builds / ExectOS (i686) (push) Successful in 39s

This commit is contained in:
Rafal Kupiec 2024-02-16 15:09:18 +01:00
parent 5de4d7a7f5
commit 8ddd6137da
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 30 additions and 30 deletions

View File

@ -102,7 +102,7 @@ BlConsolePrint(IN PUSHORT Format,
VA_LIST Arguments; VA_LIST Arguments;
/* Initialise the print contexts */ /* Initialise the print contexts */
ConsolePrintContext.WriteWideCharacter = BlpConsolePrintChar; ConsolePrintContext.WriteWideCharacter = BlpConsolePutChar;
SerialPrintContext.WriteWideCharacter = BlpDebugPutChar; SerialPrintContext.WriteWideCharacter = BlpDebugPutChar;
/* Initialise the va_list */ /* Initialise the va_list */
@ -292,7 +292,7 @@ BlSetCursorPosition(IN ULONGLONG PosX,
*/ */
XTCDECL XTCDECL
XTSTATUS XTSTATUS
BlpConsolePrintChar(IN USHORT Character) BlpConsolePutChar(IN USHORT Character)
{ {
USHORT Buffer[2]; USHORT Buffer[2];
@ -300,7 +300,7 @@ BlpConsolePrintChar(IN USHORT Character)
if(Character == L'\n') if(Character == L'\n')
{ {
/* Print carriage return ('\r') as well */ /* Print carriage return ('\r') as well */
BlpConsolePrintChar(L'\r'); BlpConsolePutChar(L'\r');
} }
/* Write character to the screen console */ /* Write character to the screen console */

View File

@ -34,7 +34,7 @@ BlDebugPrint(IN PUSHORT Format,
if(DEBUG) if(DEBUG)
{ {
/* Initialize the print contexts */ /* Initialize the print contexts */
ConsolePrintContext.WriteWideCharacter = BlpConsolePrintChar; ConsolePrintContext.WriteWideCharacter = BlpConsolePutChar;
SerialPrintContext.WriteWideCharacter = BlpDebugPutChar; SerialPrintContext.WriteWideCharacter = BlpDebugPutChar;
/* Initialise the va_list */ /* Initialise the va_list */
@ -59,6 +59,31 @@ BlDebugPrint(IN PUSHORT Format,
} }
} }
/**
* Writes a character to the serial console.
*
* @param Character
* The integer promotion of the character to be written.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
XTSTATUS
BlpDebugPutChar(IN USHORT Character)
{
USHORT Buffer[2];
/* Write character to the serial console */
Buffer[0] = Character;
Buffer[1] = 0;
HlComPortPutByte(&BlpStatus.SerialPort, Buffer[0]);
/* Return success */
return STATUS_EFI_SUCCESS;
}
/** /**
* This routine initializes the XTLDR debug console. * This routine initializes the XTLDR debug console.
* *
@ -243,28 +268,3 @@ BlpInitializeSerialPort(IN ULONG PortNumber,
/* Return success */ /* Return success */
return STATUS_EFI_SUCCESS; return STATUS_EFI_SUCCESS;
} }
/**
* Writes a character to the serial console.
*
* @param Character
* The integer promotion of the character to be written.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
XTSTATUS
BlpDebugPutChar(IN USHORT Character)
{
USHORT Buffer[2];
/* Write character to the serial console */
Buffer[0] = Character;
Buffer[1] = 0;
HlComPortPutByte(&BlpStatus.SerialPort, Buffer[0]);
/* Return success */
return STATUS_EFI_SUCCESS;
}

View File

@ -357,7 +357,7 @@ BlpActivateSerialIOController();
XTCDECL XTCDECL
XTSTATUS XTSTATUS
BlpConsolePrintChar(IN USHORT Character); BlpConsolePutChar(IN USHORT Character);
XTCDECL XTCDECL
XTSTATUS XTSTATUS