mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-28 18:40:29 +00:00
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:
parent
e0d7d3c3d5
commit
22aea9f659
Notes:
sideshowbarker
2024-07-17 08:55:54 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/22aea9f659 Pull-request: https://github.com/SerenityOS/serenity/pull/14788 Reviewed-by: https://github.com/timschumi
2 changed files with 11 additions and 5 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue