arch/sim: Move '\n' process from tty_send to up_putc

to avoid this special process happen twice

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-12-17 03:33:15 +08:00 committed by Petro Karashchenko
parent 4b3ea5b052
commit 7e75c475d4
1 changed files with 5 additions and 7 deletions

View File

@ -428,13 +428,6 @@ static void tty_send(struct uart_dev_s *dev, int ch)
{
struct tty_priv_s *priv = dev->priv;
/* For console device */
if (dev->isconsole && ch == '\n')
{
host_uart_putc(1, '\r');
}
host_uart_putc(dev->isconsole ? 1 : priv->fd, ch);
}
@ -567,6 +560,11 @@ void sim_uartloop(void)
int up_putc(int ch)
{
#ifdef USE_DEVCONSOLE
if (ch == '\n')
{
tty_send(&g_console_dev, '\r');
}
tty_send(&g_console_dev, ch);
#endif
return 0;