debug feature: jtagtcpip, improve performance

waiting for ZY1000 fifo to idle is now queued as
an asynchronous command. This radically improves
performance when waitIdle() is interspersed with
writes as no readback is required over TCP/IP.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
Øyvind Harboe 2010-07-16 10:57:28 +02:00
parent bb588bdaec
commit 01b2a3091a
2 changed files with 26 additions and 0 deletions

View File

@ -48,6 +48,7 @@ extern uint32_t zy1000_tcpin(uint32_t address);
#if BUILD_ECOSBOARD
// FIFO empty? // FIFO empty?
static __inline__ void waitIdle(void) static __inline__ void waitIdle(void)
{ {
@ -57,6 +58,9 @@ static __inline__ void waitIdle(void)
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty); ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty);
} while ((empty & 0x100) == 0); } while ((empty & 0x100) == 0);
} }
#else
extern void waitIdle(void);
#endif
static __inline__ void waitQueue(void) static __inline__ void waitQueue(void)
{ {

View File

@ -1107,6 +1107,7 @@ enum ZY1000_CMD
ZY1000_CMD_POKE = 0x0, ZY1000_CMD_POKE = 0x0,
ZY1000_CMD_PEEK = 0x8, ZY1000_CMD_PEEK = 0x8,
ZY1000_CMD_SLEEP = 0x1, ZY1000_CMD_SLEEP = 0x1,
ZY1000_CMD_WAITIDLE = 2
}; };
@ -1167,6 +1168,22 @@ void zy1000_tcpout(uint32_t address, uint32_t data)
} }
} }
/* By sending the wait to the server, we avoid a readback
* of status. Radically improves performance for this operation
* with long ping times.
*/
void waitIdle(void)
{
tcpip_open();
if (!writeLong((ZY1000_CMD_WAITIDLE << 24)))
{
fprintf(stderr, "Could not write to zy1000 server\n");
exit(-1);
}
}
uint32_t zy1000_tcpin(uint32_t address) uint32_t zy1000_tcpin(uint32_t address)
{ {
tcpip_open(); tcpip_open();
@ -1241,6 +1258,11 @@ static void tcpipserver(void)
jtag_sleep(data); jtag_sleep(data);
break; break;
} }
case ZY1000_CMD_WAITIDLE:
{
waitIdle();
break;
}
default: default:
return; return;
} }