<div dir="ltr">These look good and almost all cosmetic. Apply.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 20, 2016 at 2:20 AM, Chris Johns <span dir="ltr"><<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
c/src/libchip/serial/ns16550.c | 27 ++++++++++++++-------------<br>
1 file changed, 14 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/c/src/libchip/serial/ns16550.c b/c/src/libchip/serial/ns16550.c<br>
index 12d220c..6473028 100644<br>
--- a/c/src/libchip/serial/ns16550.c<br>
+++ b/c/src/libchip/serial/ns16550.c<br>
@@ -1,6 +1,6 @@<br>
/**<br>
* @file<br>
- *<br>
+ *<br>
* This file contains the TTY driver for the National Semiconductor NS16550.<br>
*<br>
* This part is widely cloned and second sourced. It is found in a number<br>
@@ -234,7 +234,7 @@ void ns16550_init(int minor)<br>
Console_Port_Data[minor].pDeviceContext=(void *)pns16550Context;<br>
pns16550Context->ucModemCtrl=SP_MODEM_IRQ;<br>
<br>
- pNS16550 = c->ulCtrlPort1;<br>
+ pNS16550 = c->ulCtrlPort1;<br>
setReg = c->setRegister;<br>
getReg = c->getRegister;<br>
<br>
@@ -389,7 +389,7 @@ void ns16550_outch_polled(console_tbl *c, char out)<br>
void ns16550_write_polled(int minor, char out)<br>
{<br>
console_tbl *c = Console_Port_Tbl [minor];<br>
-<br>
+<br>
ns16550_outch_polled( c, out );<br>
}<br>
<br>
@@ -616,27 +616,28 @@ NS16550_STATIC void ns16550_process( int minor)<br>
NS16550Context *ctx = d->pDeviceContext;<br>
uint32_t port = c->ulCtrlPort1;<br>
getRegister_f get = c->getRegister;<br>
- int i = 0;<br>
+ int i;<br>
char buf [SP_FIFO_SIZE];<br>
<br>
/* Iterate until no more interrupts are pending */<br>
do {<br>
/* Fetch received characters */<br>
- for (i = 0; i < SP_FIFO_SIZE; ++i) {<br>
- if ((get( port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {<br>
- buf [i] = (char) get(port, NS16550_RECEIVE_BUFFER);<br>
- } else {<br>
- break;<br>
+ i = 0;<br>
+ while ((get(port, NS16550_LINE_STATUS) & SP_LSR_RDY) != 0) {<br>
+ buf[i++] = (char) get(port, NS16550_RECEIVE_BUFFER);<br>
+ if (i == SP_FIFO_SIZE) {<br>
+ /* Enqueue fetched characters */<br>
+ rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);<br>
+ i = 0;<br>
}<br>
}<br>
<br>
- /* Enqueue fetched characters */<br>
- rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);<br>
+ if (i > 0)<br>
+ rtems_termios_enqueue_raw_characters( d->termios_data, buf, i);<br>
<br>
/* Check if we can dequeue transmitted characters */<br>
if (ctx->transmitFifoChars > 0<br>
&& (get( port, NS16550_LINE_STATUS) & SP_LSR_THOLD) != 0) {<br>
-<br>
/* Dequeue transmitted characters */<br>
rtems_termios_dequeue_characters(<br>
d->termios_data,<br>
@@ -869,6 +870,6 @@ int ns16550_inch_polled(<br>
int ns16550_inbyte_nonblocking_polled(int minor)<br>
{<br>
console_tbl *c = Console_Port_Tbl [minor];<br>
-<br>
+<br>
return ns16550_inch_polled( c );<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.4.6<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</font></span></blockquote></div><br></div>