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:
Damien Le Moal 2019-01-18 13:46:31 +09:00 committed by Anup Patel
parent 9c4aca4f1b
commit 58d9f2983a

View file

@ -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;
}