summaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2011-03-03 09:22:25 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-03-15 10:36:16 +0100
commit2321bb3c42b1d47374e51d9e5aa548a37a70b53a (patch)
treece4dab3a7743bdad9bf7e16dc351847f05cc8aba /src/jtag
parent4da640563b95939cd3fe9275053ba3181de723c4 (diff)
downloadopenocd+libswd-2321bb3c42b1d47374e51d9e5aa548a37a70b53a.tar.gz
openocd+libswd-2321bb3c42b1d47374e51d9e5aa548a37a70b53a.tar.bz2
openocd+libswd-2321bb3c42b1d47374e51d9e5aa548a37a70b53a.tar.xz
openocd+libswd-2321bb3c42b1d47374e51d9e5aa548a37a70b53a.zip
zy1000: fix JTAG over TCP/IP performance problem
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>
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/zy1000/zy1000.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index a8f7ffc7..f9721917 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -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));