forked from Imagelibrary/rtems
ibchip/ns16550: Minor optimisation.
This commit is contained in:
@@ -616,27 +616,28 @@ NS16550_STATIC void ns16550_process( int minor)
|
||||
NS16550Context *ctx = d->pDeviceContext;
|
||||
uint32_t port = c->ulCtrlPort1;
|
||||
getRegister_f get = c->getRegister;
|
||||
int i = 0;
|
||||
int i;
|
||||
char buf [SP_FIFO_SIZE];
|
||||
|
||||
/* Iterate until no more interrupts are pending */
|
||||
do {
|
||||
/* Fetch received characters */
|
||||
for (i = 0; i < SP_FIFO_SIZE; ++i) {
|
||||
if ((get( port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {
|
||||
buf [i] = (char) get(port, NS16550_RECEIVE_BUFFER);
|
||||
} else {
|
||||
break;
|
||||
i = 0;
|
||||
while ((get(port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {
|
||||
buf[i++] = (char) get(port, NS16550_RECEIVE_BUFFER);
|
||||
if (i == SP_FIFO_SIZE) {
|
||||
/* Enqueue fetched characters */
|
||||
rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enqueue fetched characters */
|
||||
if (i > 0)
|
||||
rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);
|
||||
|
||||
/* Check if we can dequeue transmitted characters */
|
||||
if (ctx->transmitFifoChars > 0
|
||||
&& (get( port, NS16550_LINE_STATUS) & SP_LSR_THOLD) != 0) {
|
||||
|
||||
/* Dequeue transmitted characters */
|
||||
rtems_termios_dequeue_characters(
|
||||
d->termios_data,
|
||||
|
||||
Reference in New Issue
Block a user