forked from Imagelibrary/rtems
libchip: Use Termios API change for NS16550
This avoids a race condition on SMP configurations.
This commit is contained in:
@@ -550,19 +550,12 @@ NS16550_STATIC void ns16550_process( int minor)
|
|||||||
/* Check if we can dequeue transmitted characters */
|
/* Check if we can dequeue transmitted characters */
|
||||||
if (ctx->transmitFifoChars > 0
|
if (ctx->transmitFifoChars > 0
|
||||||
&& (get( port, NS16550_LINE_STATUS) & SP_LSR_THOLD) != 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 */
|
/* Dequeue transmitted characters */
|
||||||
if (rtems_termios_dequeue_characters( d->termios_data, chars) == 0) {
|
rtems_termios_dequeue_characters(
|
||||||
/* Nothing to do */
|
d->termios_data,
|
||||||
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);
|
ctx->transmitFifoChars
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
} while ((get( port, NS16550_INTERRUPT_ID) & SP_IID_0) == 0);
|
} 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]);
|
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);
|
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR);
|
||||||
|
} else {
|
||||||
|
ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user