summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/shared/comm/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/i386/shared/comm/uart.c')
-rw-r--r--c/src/lib/libbsp/i386/shared/comm/uart.c16
1 files changed, 16 insertions, 0 deletions
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;
}