From 27ce64252dcb8bb6bdb315e24c6f0dd70b22f013 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 16 Jul 2002 22:30:11 +0000 Subject: 2002-07-16 Eric Norum * 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. --- c/src/lib/libbsp/i386/shared/ChangeLog | 8 ++++++++ c/src/lib/libbsp/i386/shared/comm/uart.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) 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 + + * 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 * 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; } -- cgit v1.2.3