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.
This commit is contained in:
Martin Aberg
2017-03-14 17:46:12 +01:00
committed by Daniel Hellstrom
parent 6860ddb6e8
commit e5e44bdb10

View File

@@ -497,6 +497,12 @@ static void last_close(
while (uart->sending) { while (uart->sending) {
/* Wait until all data has been sent */ /* 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 */ /* Disable and unregister interrupt handler */
drvmgr_interrupt_unregister(uart->dev, 0, apbuart_cons_isr, tty); 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)) { if (uart->sending && (status & APBUART_STATUS_TE)) {
/* Tell close that we sent everything */ /* Tell close that we sent everything */
cnt = uart->sending; cnt = uart->sending;
uart->sending = 0;
/* /*
* Tell termios how much we have sent. dequeue() may call * Tell termios how much we have sent. dequeue() may call