libchip: Use Termios API change for NS16550

This avoids a race condition on SMP configurations.
This commit is contained in:
Sebastian Huber
2013-06-10 14:11:07 +02:00
parent 6896ca22bb
commit 15f3a91858

View File

@@ -550,19 +550,12 @@ NS16550_STATIC void ns16550_process( int minor)
/* Check if we can dequeue transmitted characters */
if (ctx->transmitFifoChars > 0
&& (get( port, NS16550_LINE_STATUS) & SP_LSR_THOLD) != 0) {
unsigned chars = ctx->transmitFifoChars;
/*
* We finished the transmission, so clear the number of characters in the
* transmit FIFO.
*/
ctx->transmitFifoChars = 0;
/* Dequeue transmitted characters */
if (rtems_termios_dequeue_characters( d->termios_data, chars) == 0) {
/* Nothing to do */
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);
}
rtems_termios_dequeue_characters(
d->termios_data,
ctx->transmitFifoChars
);
}
} while ((get( port, NS16550_INTERRUPT_ID) & SP_IID_0) == 0);
}
@@ -595,9 +588,12 @@ ssize_t ns16550_write_support_int(
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}
if (len > 0) {
ctx->transmitFifoChars = out;
ctx->transmitFifoChars = out;
if (out > 0) {
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR);
} else {
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);
}
return 0;