mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 15:51:41 +01:00
kendryte/k210: Fix console
Clear console input when intializing it. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
This commit is contained in:

committed by
Anup Patel

parent
9c4aca4f1b
commit
58d9f2983a
@@ -35,6 +35,10 @@ void uarths_init(u32 baud_rate, enum uarths_stopbit stopbit)
|
|||||||
uarths->ip.rxwm = 0;
|
uarths->ip.rxwm = 0;
|
||||||
uarths->ie.txwm = 1;
|
uarths->ie.txwm = 1;
|
||||||
uarths->ie.rxwm = 0;
|
uarths->ie.rxwm = 0;
|
||||||
|
|
||||||
|
/* Clear input */
|
||||||
|
if (!uarths->rxdata.empty)
|
||||||
|
(void)uarths_getc();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uarths_putc(char c)
|
void uarths_putc(char c)
|
||||||
@@ -46,11 +50,11 @@ void uarths_putc(char c)
|
|||||||
|
|
||||||
char uarths_getc(void)
|
char uarths_getc(void)
|
||||||
{
|
{
|
||||||
struct uarths_rxdata recv = uarths->rxdata;
|
struct uarths_rxdata rx = uarths->rxdata;
|
||||||
|
|
||||||
if (recv.empty)
|
if (rx.empty)
|
||||||
return '\0';
|
return '\0';
|
||||||
|
|
||||||
return recv.data;
|
return rx.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user