summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorMartin Aberg <maberg@gaisler.com>2017-03-14 17:46:12 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2017-05-02 12:34:47 +0200
commite5e44bdb10d515fb287bf2d19412c21876361e46 (patch)
tree853dd91662edc44dc29db1774b7b7a321648cf1f /c
parentleon, apbuart: Optimized RX processing in ISR (diff)
downloadrtems-e5e44bdb10d515fb287bf2d19412c21876361e46.tar.bz2
leon, apbuart: Wait for shift register on close
Do not disable transmitter until shift register is empty when closing device. It is correct to look at the sending software state when closing the device. However, the sending state must be cleared only when everything is sent.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
index a52c360f21..c79d4084eb 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
@@ -497,6 +497,12 @@ static void last_close(
while (uart->sending) {
/* Wait until all data has been sent */
}
+ while (
+ (uart->regs->ctrl & APBUART_CTRL_TE) &&
+ !(uart->regs->status & APBUART_STATUS_TS)
+ ) {
+ /* Wait until all data has left shift register */
+ }
/* Disable and unregister interrupt handler */
drvmgr_interrupt_unregister(uart->dev, 0, apbuart_cons_isr, tty);
@@ -846,7 +852,6 @@ static void apbuart_cons_isr(void *arg)
if (uart->sending && (status & APBUART_STATUS_TE)) {
/* Tell close that we sent everything */
cnt = uart->sending;
- uart->sending = 0;
/*
* Tell termios how much we have sent. dequeue() may call