Write serial output to memory

This commit is contained in:
Zhuowei Zhang 2019-02-21 22:36:47 -08:00
parent b72ca8c17a
commit c4dc7bd403
2 changed files with 19 additions and 2 deletions

View File

@ -33,9 +33,23 @@ SerialPortInitialize (
VOID
)
{
UINT8* base = (UINT8*)0xa1a10000ull;
for (UINTN i = 0; i < 0x200000; i++) {
base[i] = 0;
}
return RETURN_SUCCESS;
}
static void mem_putchar(UINT8 c) {
static const UINTN size = 0x200000;
static UINTN offset = 0;
UINT8* base = (UINT8*)0xa1a10000ull;
base[offset++] = c;
if (offset >= size) {
offset = 0;
}
}
/**
Write data from buffer to serial device.
@ -60,7 +74,10 @@ SerialPortWrite (
IN UINTN NumberOfBytes
)
{
return 0;
for (UINTN i = 0; i < NumberOfBytes; i++) {
mem_putchar(Buffer[i]);
}
return NumberOfBytes;
}

View File

@ -43,7 +43,7 @@
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
SerialPortLib|Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.inf
RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf