# HG changeset patch # User jlarmour # Date 1048560425 0 # Node ID c398056d144d765c90ef44176afe84f35b8a0db7 # Parent 0d6e15090dc86063c589a80178c85610756a94c1 * 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. diff --git a/packages/io/serial/current/ChangeLog b/packages/io/serial/current/ChangeLog --- a/packages/io/serial/current/ChangeLog +++ b/packages/io/serial/current/ChangeLog @@ -1,3 +1,10 @@ +2003-03-25 Jonathan Larmour + + * 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 * src/common/serial.c: Only return -EAGAIN if no data moved. diff --git a/packages/io/serial/current/src/common/serial.c b/packages/io/serial/current/src/common/serial.c --- 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);