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>
This commit is contained in:
Øyvind Harboe 2011-03-03 09:22:25 +01:00
parent 4da640563b
commit 2321bb3c42
1 changed files with 11 additions and 8 deletions

View File

@ -1063,6 +1063,16 @@ static bool writeLong(uint32_t l)
static bool readLong(uint32_t *out_data) static bool readLong(uint32_t *out_data)
{ {
uint32_t data = 0;
int i;
for (i = 0; i < 4; i++)
{
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 (out_pos > 0)
{ {
if (!flush_writes()) if (!flush_writes())
@ -1071,13 +1081,6 @@ static bool readLong(uint32_t *out_data)
} }
} }
uint32_t data = 0;
int i;
for (i = 0; i < 4; i++)
{
uint8_t c;
if (in_pos == in_write)
{
/* read more */ /* read more */
int t; int t;
t = read(tcp_ip, in_buffer, sizeof(in_buffer)); t = read(tcp_ip, in_buffer, sizeof(in_buffer));