mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-07-09 06:28:18 +00: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:
parent
9c4aca4f1b
commit
58d9f2983a
1 changed files with 7 additions and 3 deletions
|
@ -35,6 +35,10 @@ void uarths_init(u32 baud_rate, enum uarths_stopbit stopbit)
|
|||
uarths->ip.rxwm = 0;
|
||||
uarths->ie.txwm = 1;
|
||||
uarths->ie.rxwm = 0;
|
||||
|
||||
/* Clear input */
|
||||
if (!uarths->rxdata.empty)
|
||||
(void)uarths_getc();
|
||||
}
|
||||
|
||||
void uarths_putc(char c)
|
||||
|
@ -46,11 +50,11 @@ void uarths_putc(char c)
|
|||
|
||||
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 recv.data;
|
||||
return rx.data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue