Skip to content

Commit

Permalink
star64: Fix auto-CR in serial driver
Browse files Browse the repository at this point in the history
Output '\r\n' instead of '\n\r'.

Signed-off-by: Jimmy Brush <[email protected]>
  • Loading branch information
canarysnort01 committed Aug 22, 2023
1 parent ed77adf commit bfeda95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libplatsupport/src/plat/star64/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ int uart_getchar(ps_chardevice_t *d)

int uart_putchar(ps_chardevice_t *d, int c)
{
if (c == '\n' && (d->flags & SERIAL_AUTO_CR)) {
uart_putchar(d, '\r');
}

while ((*REG_PTR(d->vaddr, UART_LSR) & UART_LSR_THRE) == 0);

/* Add character to the buffer. */
*REG_PTR(d->vaddr, UART_THR) = c & 0x7f;
if (c == '\n' && (d->flags & SERIAL_AUTO_CR)) {
uart_putchar(d, '\r');
}

return c;
}
Expand Down

0 comments on commit bfeda95

Please sign in to comment.