summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2019-01-18 07:46:31 +0300
committerAnup Patel <anup@brainfault.org>2019-01-21 07:28:33 +0300
commit58d9f2983a4a1ebdbe62f7d40e10ea3bc7d6bbaf (patch)
tree94c3fc0d87a3c41e95e3fc4e5aa8c62b0fd74b0c /platform
parent9c4aca4f1b7bfc52660589705846fc52ff7c015b (diff)
downloadopensbi-58d9f2983a4a1ebdbe62f7d40e10ea3bc7d6bbaf.tar.xz
kendryte/k210: Fix console
Clear console input when intializing it. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/kendryte/k210/uarths.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/platform/kendryte/k210/uarths.c b/platform/kendryte/k210/uarths.c
index 2a189aa..f8f4974 100644
--- a/platform/kendryte/k210/uarths.c
+++ b/platform/kendryte/k210/uarths.c
@@ -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;
}