changeset 864:c398056d144d

* src/common/serial.c (serial_get_config): For both INPUT_FLUSH and OUTPUT_FLUSH keys, pass down to the hardware driver as well to allow it to flush FIFOs. Based on patch from Roland Cassebohm.
author jlarmour
date Tue, 25 Mar 2003 02:47:05 +0000
parents 0d6e15090dc8
children 6001f11af5db
files packages/io/serial/current/ChangeLog packages/io/serial/current/src/common/serial.c
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/serial/current/ChangeLog
+++ b/packages/io/serial/current/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-25  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/common/serial.c (serial_get_config): For both INPUT_FLUSH
+	and OUTPUT_FLUSH keys, pass down to the hardware driver as well
+	to allow it to flush FIFOs.
+	Based on patch from Roland Cassebohm.
+
 2003-03-20  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/common/serial.c: Only return -EAGAIN if no data moved.
--- a/packages/io/serial/current/src/common/serial.c
+++ b/packages/io/serial/current/src/common/serial.c
@@ -617,6 +617,11 @@ serial_get_config(cyg_io_handle_t handle
             in_cbuf->waiting = false;
         }
         in_cbuf->get = in_cbuf->put = in_cbuf->nb = 0;  // Flush buffered input
+
+        // Pass to the hardware driver in case it wants to flush FIFOs etc.
+        (funs->set_config)(chan,
+                           CYG_IO_SET_CONFIG_SERIAL_INPUT_FLUSH,
+                           NULL, NULL);
         cyg_drv_dsr_unlock();
         cyg_drv_mutex_unlock(&in_cbuf->lock);
         break;
@@ -643,6 +648,10 @@ serial_get_config(cyg_io_handle_t handle
             out_cbuf->get = out_cbuf->put = out_cbuf->nb = 0;  // Empties queue!
             (funs->stop_xmit)(chan);  // Done with transmit
         }
+        // Pass to the hardware driver in case it wants to flush FIFOs etc.
+        (funs->set_config)(chan,
+                           CYG_IO_SET_CONFIG_SERIAL_OUTPUT_FLUSH,
+                           NULL, NULL);
         if (out_cbuf->waiting) {
             out_cbuf->abort = true;
             cyg_drv_cond_signal(&out_cbuf->wait);