aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:40:51 +0000
committerGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:40:51 +0000
commite54d55b9d935745c2aa3f07712b857af42506c0d (patch)
treeefe0e500105ceaa5aed882f52329fb6a5e675a75 /src/lib
parent5c51c3d9d945ae77c93073db5624728959cf4c74 (diff)
added rx support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1410 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/uart8250.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/uart8250.c b/src/lib/uart8250.c
index 67b0a95cfb..e3a1255dc6 100644
--- a/src/lib/uart8250.c
+++ b/src/lib/uart8250.c
@@ -20,7 +20,7 @@
#define UART_MSR 0x06
#define UART_SCR 0x07
-static inline int uart8250_can_tx_byte(unsigned base_port)
+static int uart8250_can_tx_byte(unsigned base_port)
{
return inb(base_port + UART_LSR) & 0x20;
}
@@ -45,6 +45,18 @@ void uart8250_tx_byte(unsigned base_port, unsigned char data)
uart8250_wait_until_sent(base_port);
}
+int uart8250_can_rx_byte(unsigned base_port)
+{
+ return inb(base_port + UART_LSR) & 0x01;
+}
+
+unsigned char uart8250_rx_byte(unsigned base_port)
+{
+ while(!uart8250_can_rx_byte(base_port))
+ ;
+ return inb(base_port + UART_RBR);
+}
+
void uart8250_init(unsigned base_port, unsigned divisor, unsigned lcs)
{
lcs &= 0x7f;