From efecbee7c0c265b0b2fe956f308e1a73cc63eda6 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Mon, 3 Jun 2019 17:49:27 -0400 Subject: xx --- uart.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'uart.c') diff --git a/uart.c b/uart.c index 659c574..b6271c1 100644 --- a/uart.c +++ b/uart.c @@ -49,11 +49,15 @@ uartputc(int c) *R(0) = c; } -uint +int uartgetc(void) { - // XXX this isn't right, must check there's data in the FIFO. - return *R(0); + if(*(5) & 0x01){ + // input data is ready. + return *R(0); + } else { + return -1; + }; } void -- cgit v1.2.3