From 4747ee6ea8fa6bb5d526f518f1e0ee96c0eb4c79 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 16 May 2012 06:01:51 -0500 Subject: [PATCH] pl011 uart: Complete function to get a character --- src/system/kernel/arch/arm/uart_pl011.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/arch/arm/uart_pl011.cpp b/src/system/kernel/arch/arm/uart_pl011.cpp index 7ba7bd36a0..9c05d41ba3 100644 --- a/src/system/kernel/arch/arm/uart_pl011.cpp +++ b/src/system/kernel/arch/arm/uart_pl011.cpp @@ -152,7 +152,15 @@ UartPL011::PutChar(char c) int UartPL011::GetChar(bool wait) { - #warning ARM Amba PL011 UART incomplete + if (fUARTEnabled == true) { + // Wait until a character is received? + if (wait) { + while ((ReadUart(PL01x_FR) & PL01x_FR_RXFE) != 0) + barrier(); + } + return ReadUart(PL01x_DR); + } + return -1; }