summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-16 22:30:11 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-16 22:30:11 +0000
commit27ce64252dcb8bb6bdb315e24c6f0dd70b22f013 (patch)
tree300455b61d9b3359aca3d5fc336bf9e66bf31627
parent2002-07-16 Greg Menke <gregory.menke@gsfc.nasa.gov> (diff)
downloadrtems-27ce64252dcb8bb6bdb315e24c6f0dd70b22f013.tar.bz2
2002-07-16 Eric Norum <eric.norum@usask.ca>
* comm/uart.c: I am using a PC-104 card with no video output. I found that things would lock up if a printk was followed closely by a printf when BSPConsolePort = BSP_UART_COM2 and BSPPrintkPort = BSP_UART_COM1. With this change in place, printf/printk calls can be intermingled with no apparent problems.
-rw-r--r--c/src/lib/libbsp/i386/shared/ChangeLog8
-rw-r--r--c/src/lib/libbsp/i386/shared/comm/uart.c16
2 files changed, 24 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/i386/shared/ChangeLog b/c/src/lib/libbsp/i386/shared/ChangeLog
index 08ec421f62..ac365b9609 100644
--- a/c/src/lib/libbsp/i386/shared/ChangeLog
+++ b/c/src/lib/libbsp/i386/shared/ChangeLog
@@ -1,3 +1,11 @@
+2002-07-16 Eric Norum <eric.norum@usask.ca>
+
+ * comm/uart.c: I am using a PC-104 card with no video output. I
+ found that things would lock up if a printk was followed closely by
+ a printf when BSPConsolePort = BSP_UART_COM2 and
+ BSPPrintkPort = BSP_UART_COM1. With this change in place,
+ printf/printk calls can be intermingled with no apparent problems.
+
2002-05-01 Eric Norum <eric.norum@usask.ca>
* console/console.c, fatal/bspfatal.c, startup/bspclean.c,
diff --git a/c/src/lib/libbsp/i386/shared/comm/uart.c b/c/src/lib/libbsp/i386/shared/comm/uart.c
index 3d0718cbe7..c85f033c0d 100644
--- a/c/src/lib/libbsp/i386/shared/comm/uart.c
+++ b/c/src/lib/libbsp/i386/shared/comm/uart.c
@@ -387,6 +387,22 @@ BSP_uart_polled_write(int uart, int val)
uwrite(uart, THR, val & 0xff);
+ /*
+ * Wait for character to be transmitted.
+ * This ensures that printk and printf play nicely together
+ * when using the same serial port.
+ * Yes, there's a performance hit here, but if we're doing
+ * polled writes to a serial port we're probably not that
+ * interested in efficiency anyway.....
+ */
+ for(;;)
+ {
+ if((val1=uread(uart, LSR)) & THRE)
+ {
+ break;
+ }
+ }
+
return;
}