]> git.sur5r.net Git - openocd/commitdiff
zy1000: fix JTAG over TCP/IP performance problem
authorØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 3 Mar 2011 08:22:25 +0000 (09:22 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 15 Mar 2011 09:36:16 +0000 (10:36 +0100)
only flush write queue just before waiting for more data,
rather than when fetching more data from the buffer.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/jtag/zy1000/zy1000.c

index a8f7ffc7a7285414b28bfe7bfcba70dbf1f8e527..f972191731c751f33b6f4b01509d1a606207af83 100644 (file)
@@ -1063,14 +1063,6 @@ static bool writeLong(uint32_t l)
 
 static bool readLong(uint32_t *out_data)
 {
-       if (out_pos > 0)
-       {
-               if (!flush_writes())
-               {
-                       return false;
-               }
-       }
-
        uint32_t data = 0;
        int i;
        for (i = 0; i < 4; i++)
@@ -1078,6 +1070,17 @@ static bool readLong(uint32_t *out_data)
                uint8_t c;
                if (in_pos == in_write)
                {
+                       /* If we have some data that we can send, send them before
+                        * we wait for more data
+                        */
+                       if (out_pos > 0)
+                       {
+                               if (!flush_writes())
+                               {
+                                       return false;
+                               }
+                       }
+
                        /* read more */
                        int t;
                        t = read(tcp_ip, in_buffer, sizeof(in_buffer));