[PATCH][2.4] serial.c xmit fifo overflow bug

From: William King (wrking@dadaboom.com)
Date: Wed Feb 19 2003 - 11:26:08 EST


Attached is a patch to correct a xmit fifo overflow bug in serial.c. I
limited the changes to a patch and not a feature addition which would add
support for programming the tx fifo interrupt threshold.

I've tested it on an embedded system which uses an Exar ST16C654 QUART.

--- serial.c 2003/02/17 18:03:39 1.1
+++ serial.c 2003/02/18 16:30:11
@@ -698,7 +698,24 @@
                 return;
         }
         
- count = info->xmit_fifo_size;
+ if (info->state->type == PORT_16654) {
+ /*
+ * The assumption in the following do loop is that the
+ * uart will interrupt when the number of bytes in the
+ * fifo drops to 0. The ST16654 will trigger the interrupt
+ * when the number of bytes drops below a programmed
+ * threshold. By default, the threshold is 8. There is no
+ * code in place in this driver to alter the transmit fifo
+ * threshold, so hard coding an 8 here is okay for now.
+ *
+ * This prevents overflowing the xmit fifo.
+ *
+ */
+ count = info->xmit_fifo_size - 8;
+ } else {
+ count = info->xmit_fifo_size;
+ }
+
         do {
                 serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]);
                 info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);

-- 

William King Integrated Consulting, Inc. William.King@dadaboom.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:26 EST