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;
|
NS16550Context *ctx = d->pDeviceContext;
|
||||||
uint32_t port = c->ulCtrlPort1;
|
uint32_t port = c->ulCtrlPort1;
|
||||||
getRegister_f get = c->getRegister;
|
getRegister_f get = c->getRegister;
|
||||||
int i = 0;
|
int i;
|
||||||
char buf [SP_FIFO_SIZE];
|
char buf [SP_FIFO_SIZE];
|
||||||
|
|
||||||
/* Iterate until no more interrupts are pending */
|
/* Iterate until no more interrupts are pending */
|
||||||
do {
|
do {
|
||||||
/* Fetch received characters */
|
/* Fetch received characters */
|
||||||
for (i = 0; i < SP_FIFO_SIZE; ++i) {
|
i = 0;
|
||||||
if ((get( port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {
|
while ((get(port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {
|
||||||
buf [i] = (char) get(port, NS16550_RECEIVE_BUFFER);
|
buf[i++] = (char) get(port, NS16550_RECEIVE_BUFFER);
|
||||||
} else {
|
if (i == SP_FIFO_SIZE) {
|
||||||
break;
|
/* 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);
|
rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);
|
||||||
|
|
||||||
/* 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) {
|
||||||
|
|
||||||
/* Dequeue transmitted characters */
|
/* Dequeue transmitted characters */
|
||||||
rtems_termios_dequeue_characters(
|
rtems_termios_dequeue_characters(
|
||||||
d->termios_data,
|
d->termios_data,
|
||||||
|
|||||||
Reference in New Issue
Block a user