Kernel: Add logic to RPi UART driver to emit CR when encountering LF

This makes sure that the debug message are properly aligned when running
the kernel bare-metal on a Raspberry Pi. While we are here, also move
the function out of line.
This commit is contained in:
Timon Kruiper 2022-06-07 16:57:07 +02:00 committed by Linus Groh
parent e0d7d3c3d5
commit 22aea9f659
Notes: sideshowbarker 2024-07-17 08:55:54 +09:00
2 changed files with 11 additions and 5 deletions

View file

@ -128,6 +128,16 @@ void UART::send(u32 c)
m_registers->data = c;
}
void UART::print_str(char const* s, size_t length)
{
for (size_t i = 0; i < length; ++i) {
char character = *s++;
if (character == '\n')
send('\r');
send(character);
}
}
u32 UART::receive()
{
wait_until_we_can_receive();

View file

@ -22,11 +22,7 @@ public:
void send(u32 c);
u32 receive();
void print_str(char const* s, size_t length)
{
for (size_t i = 0; i < length; ++i)
send(*s++);
}
void print_str(char const*, size_t);
private:
UART();