changeset 329:85c0eb753287

Add control for netio line flushing.
author msalter
date Wed, 11 Sep 2002 12:14:51 +0000
parents 21b2296aacb0
children 2525052c5d76
files packages/hal/common/current/ChangeLog packages/hal/common/current/include/hal_if.h packages/redboot/current/ChangeLog packages/redboot/current/src/main.c packages/redboot/current/src/net/net_io.c
diffstat 5 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-11  Mark Salter  <msalter@redhat.com>
+
+	* include/hal_if.h: Add __COMMCTL_ENABLE_LINE_FLUSH and
+	__COMMCTL_DISABLE_LINE_FLUSH.
+
 2002-08-29  Mark Salter  <msalter@redhat.com>
 
 	* include/generic-stub.h: Add defines for Z packet types.
--- a/packages/hal/common/current/include/hal_if.h
+++ b/packages/hal/common/current/include/hal_if.h
@@ -150,6 +150,15 @@ typedef enum {
      */
     __COMMCTL_FLUSH_OUTPUT,
 
+    /*
+     * Forces driver to enable or disable flushes when a newline is
+     * seen in the output stream. Flushing at line boundaries occurs
+     * in the driver, not necessarily any hardware FIFO, etc. Line
+     * buffering is optional and may only be available in some drivers.
+     */
+    __COMMCTL_ENABLE_LINE_FLUSH,
+    __COMMCTL_DISABLE_LINE_FLUSH,
+
 } __comm_control_cmd_t;
 
 
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-11  Mark Salter  <msalter@redhat.com>
+
+	* src/main.c (do_go): Turn on line flushes before jumping to function.
+	* src/net/net_io.c (net_io_control): Support flushes at end of lines.
+
 2002-09-03  Yoshinori Sato <qzb04471@nifty.ne.jp>
 2002-09-03  Mark Salter  <msalter@redhat.com>
 
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -385,6 +385,7 @@ do_go(int argc, char *argv[])
     int  wait_time, res;
     struct option_info opts[1];
     char line[8];
+    hal_virtual_comm_table_t *__chan = CYGACC_CALL_IF_CONSOLE_PROCS();
 
     entry = entry_address;  // Default from last 'load' operation
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
@@ -412,6 +413,8 @@ do_go(int argc, char *argv[])
             script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
         }
     }
+    CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_ENABLE_LINE_FLUSH);
+
     fun = (code_fun *)entry;
     HAL_DISABLE_INTERRUPTS(oldints);
     HAL_DCACHE_SYNC();
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -148,6 +148,7 @@ static unsigned char *in_bufp;
 static int out_buflen = 0;
 static unsigned char out_buf[1024];
 static unsigned char *out_bufp;
+static bool flush_output_lines = false;
 
 // Functions in this module
 static void net_io_flush(void);
@@ -303,6 +304,7 @@ net_io_putc(void* __ch_data, cyg_uint8 c
         hash_count = 0;
     }
     if ((++out_buflen == sizeof(out_buf)) ||
+        (flush_output_lines && c == '\n') ||
         (have_hash && (++hash_count == 3))) {
         net_io_flush();
         have_dollar = false;
@@ -410,6 +412,12 @@ net_io_control(void *__ch_data, __comm_c
     case __COMMCTL_FLUSH_OUTPUT:
         net_io_flush();
         break;
+    case __COMMCTL_ENABLE_LINE_FLUSH:
+	flush_output_lines = true;
+	break;
+    case __COMMCTL_DISABLE_LINE_FLUSH:
+	flush_output_lines = false;
+	break;
     default:
         break;
     }