This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Allow serial hardware to flush FIFOs
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: eCos Patches List <ecos-patches at sources dot redhat dot com>
- Date: Tue, 25 Mar 2003 02:46:38 +0000
- Subject: Allow serial hardware to flush FIFOs
As per ecos-discuss thread.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
Index: common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/common/current/ChangeLog,v
retrieving revision 1.17
diff -u -5 -p -r1.17 ChangeLog
--- common/current/ChangeLog 24 Feb 2003 14:23:57 -0000 1.17
+++ common/current/ChangeLog 25 Mar 2003 02:45:35 -0000
@@ -1,5 +1,11 @@
+2003-03-25 Jonathan Larmour <jifl at eCosCentric dot com>
+
+ * include/config_keys.h: Define CYG_IO_SET_CONFIG_SERIAL_OUTPUT_FLUSH
+ to be same as CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH.
+ Ditto for ..._INPUT_FLUSH.
+
2003-02-24 Jonathan Larmour <jifl at eCosCentric dot com>
* cdl/io.cdl: Fix doc link.
2002-03-12 Nick Garnett <nickg at redhat dot com>
Index: common/current/include/config_keys.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/common/current/include/config_keys.h,v
retrieving revision 1.7
diff -u -5 -p -r1.7 config_keys.h
--- common/current/include/config_keys.h 23 May 2002 23:05:57 -0000 1.7
+++ common/current/include/config_keys.h 25 Mar 2003 02:45:35 -0000
@@ -59,11 +59,13 @@
// Get/Set configuration 'key' values for low-level serial I/O
#define CYG_IO_GET_CONFIG_SERIAL_INFO 0x0101
#define CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN 0x0102
#define CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH 0x0103
+#define CYG_IO_SET_CONFIG_SERIAL_OUTPUT_FLUSH CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH
#define CYG_IO_GET_CONFIG_SERIAL_INPUT_FLUSH 0x0104
+#define CYG_IO_SET_CONFIG_SERIAL_INPUT_FLUSH CYG_IO_GET_CONFIG_SERIAL_INPUT_FLUSH
#define CYG_IO_GET_CONFIG_SERIAL_ABORT 0x0105
#define CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO 0x0111
#define CYG_IO_GET_CONFIG_SERIAL_FLOW_CONTROL_METHOD 0x0112
#define CYG_IO_SET_CONFIG_SERIAL_INFO 0x0181
Index: serial/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/serial/current/ChangeLog,v
retrieving revision 1.50
diff -u -5 -p -r1.50 ChangeLog
--- serial/current/ChangeLog 20 Mar 2003 19:03:03 -0000 1.50
+++ serial/current/ChangeLog 25 Mar 2003 02:45:36 -0000
@@ -1,5 +1,12 @@
+2003-03-25 Jonathan Larmour <jifl at eCosCentric dot 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 at mlbassoc dot com>
* src/common/serial.c: Only return -EAGAIN if no data moved.
2003-03-11 Gary Thomas <gary at mlbassoc dot com>
Index: serial/current/src/common/serial.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/serial/current/src/common/serial.c,v
retrieving revision 1.18
diff -u -5 -p -r1.18 serial.c
--- serial/current/src/common/serial.c 20 Mar 2003 19:03:03 -0000 1.18
+++ serial/current/src/common/serial.c 25 Mar 2003 02:45:36 -0000
@@ -615,10 +615,15 @@ serial_get_config(cyg_io_handle_t handle
in_cbuf->abort = true;
cyg_drv_cond_signal(&in_cbuf->wait);
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;
case CYG_IO_GET_CONFIG_SERIAL_ABORT:
@@ -641,10 +646,14 @@ serial_get_config(cyg_io_handle_t handle
cyg_drv_dsr_lock();
if (out_cbuf->nb > 0) {
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);
out_cbuf->waiting = false;
}