summaryrefslogtreecommitdiff
path: root/src/console
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/console
parent5c51c3d9d945ae77c93073db5624728959cf4c74 (diff)
downloadcoreboot-e54d55b9d935745c2aa3f07712b857af42506c0d.tar.xz
added rx support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1410 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/console')
-rw-r--r--src/console/console.c25
-rw-r--r--src/console/logbuf_console.c2
-rw-r--r--src/console/uart8250_console.c12
-rw-r--r--src/console/vga_console.c2
4 files changed, 41 insertions, 0 deletions
diff --git a/src/console/console.c b/src/console/console.c
index 5ec936d8ab..b97ee8e1d5 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -52,6 +52,31 @@ void console_tx_byte(unsigned char byte)
__console_tx_byte(byte);
}
+unsigned char console_rx_byte(void)
+{
+ struct console_driver *driver;
+ if (!initialized)
+ return 0;
+ for(driver = console_drivers; driver < econsole_drivers; driver++)
+ if (driver->tst_byte)
+ break;
+ if (driver == econsole_drivers)
+ return 0;
+ while (!driver->tst_byte());
+ return driver->rx_byte();
+}
+
+int console_tst_byte(void)
+{
+ struct console_driver *driver;
+ if (!initialized)
+ return 0;
+ for(driver = console_drivers; driver < econsole_drivers; driver++)
+ if (driver->tst_byte)
+ return driver->tst_byte();
+ return 0;
+}
+
/*
* Write POST information
*/
diff --git a/src/console/logbuf_console.c b/src/console/logbuf_console.c
index e605ae5c23..00185d383c 100644
--- a/src/console/logbuf_console.c
+++ b/src/console/logbuf_console.c
@@ -16,4 +16,6 @@ static void logbuf_tx_byte(unsigned char byte)
static struct console_driver __console = {
.init = 0,
.tx_byte = logbuf_tx_byte,
+ .rx_byte = 0,
+ .tst_byte = 0,
};}
diff --git a/src/console/uart8250_console.c b/src/console/uart8250_console.c
index bb51d0f363..333693befb 100644
--- a/src/console/uart8250_console.c
+++ b/src/console/uart8250_console.c
@@ -43,8 +43,20 @@ void ttyS0_tx_byte(unsigned char data)
uart8250_tx_byte(TTYS0_BASE, data);
}
+unsigned char ttyS0_rx_byte(void)
+{
+ return uart8250_rx_byte(TTYS0_BASE);
+}
+
+int ttyS0_tst_byte(unsigned char data)
+{
+ return uart8250_can_rx_byte(TTYS0_BASE);
+}
+
static struct console_driver uart8250_console __console = {
.init = ttyS0_init,
.tx_byte = ttyS0_tx_byte,
+ .rx_byte = ttyS0_rx_byte,
+ .tst_byte = ttyS0_tst_byte,
};
diff --git a/src/console/vga_console.c b/src/console/vga_console.c
index ffd6699529..8dcbe07db1 100644
--- a/src/console/vga_console.c
+++ b/src/console/vga_console.c
@@ -97,4 +97,6 @@ static void vga_tx_byte(unsigned char byte)
struct console_driver {
.init = vga_init,
.tx_byte = vga_tx_byte,
+ .rx_byte = 0,
+ .tst_byte = 0,
};