<div dir="ltr">From: Alan Cudmore <<a href="mailto:alan.cudmore@gmail.com">alan.cudmore@gmail.com</a>><br><br>This fixes the riscv fe310 console driver fe310_uart_read function. The function<br>reads the RX status/data register to check if data is available, but discards<br>the data and reads it a second time.<br>Also cleared the interrupt enable bit in the first_open function.<br><br>Close #4719<br>---<br> bsps/riscv/riscv/console/fe310-uart.c | 7 +++++--<br> 1 file changed, 5 insertions(+), 2 deletions(-)<br><br>diff --git a/bsps/riscv/riscv/console/fe310-uart.c b/bsps/riscv/riscv/console/fe310-uart.c<br>index 4ae62d7176..506521add0 100644<br>--- a/bsps/riscv/riscv/console/fe310-uart.c<br>+++ b/bsps/riscv/riscv/console/fe310-uart.c<br>@@ -34,11 +34,13 @@<br> int fe310_uart_read(rtems_termios_device_context *base)<br> {<br>   fe310_uart_context * ctx = (fe310_uart_context*) base;<br>+  int32_t              rxdata;<br> <br>-  if ((ctx->regs->rxdata & TXRXREADY) != 0) {<br>+  rxdata = ctx->regs->rxdata;<br>+  if ((rxdata & TXRXREADY) != 0) {<br>     return -1;<br>   } else {<br>-    return ctx->regs->rxdata;<br>+    return rxdata & 0xFF;<br>   }<br> }<br> <br>@@ -91,6 +93,7 @@ static bool fe310_uart_first_open (<br>   (ctx->regs)->div = riscv_get_core_frequency() / 115200 - 1;<br>   (ctx->regs)->txctrl |= 1;<br>   (ctx->regs)->rxctrl |= 1;<br>+  (ctx->regs)->ie = 0;<br>   return true;<br> };<br> <br>-- <br>2.34.1<br><br></div>