Skip to content

Commit

Permalink
drivers/console/xtensa_sim_console: force \r\n byte sequence
Browse files Browse the repository at this point in the history
Force `\r\n` byte sequence for newline for the Xtensa simulator console
driver. This effectively mirrors the behavior of the UART console driver.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
  • Loading branch information
fkokosinski authored and aescolar committed May 15, 2024
1 parent 00b2ef8 commit 99aa65c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/console/xtensa_sim_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ int arch_printk_char_out(int c)
register int ret_err __asm__ ("a3");

buf[0] = (char)c;

if (buf[0] == '\n') {
buf[1] = buf[0];
buf[0] = '\r';
a3++;
a5++;
}

__asm__ volatile ("simcall"
: "=a" (ret_val), "=a" (ret_err)
: "a" (a2), "a" (a3), "a" (a4), "a" (a5)
Expand Down

0 comments on commit 99aa65c

Please sign in to comment.