From 4e6fe83f8362c4292b6348b6f7bb599c375855f5 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 17 May 2021 12:19:57 -0700 Subject: remote bitbang, flush resets. Waiting until the next execute_queue() might mean the target doesn't see the reset signal asserted for a significant amount of time. Change-Id: Id8514ddb30e88040131a6dba2b90b65463f10b76 Signed-off-by: Tim Newsome --- src/jtag/drivers/remote_bitbang.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/jtag/drivers/remote_bitbang.c b/src/jtag/drivers/remote_bitbang.c index 214fa43..b9ea7e4 100644 --- a/src/jtag/drivers/remote_bitbang.c +++ b/src/jtag/drivers/remote_bitbang.c @@ -203,7 +203,9 @@ static int remote_bitbang_write(int tck, int tms, int tdi) static int remote_bitbang_reset(int trst, int srst) { char c = 'r' + ((trst ? 0x2 : 0x0) | (srst ? 0x1 : 0x0)); - return remote_bitbang_queue(c, false); + /* Always flush the send buffer on reset, because the reset call need not be + * followed by jtag_execute_queue(). */ + return remote_bitbang_queue(c, true); } static int remote_bitbang_blink(int on) @@ -354,6 +356,10 @@ static const struct command_registration remote_bitbang_command_handlers[] = { static int remote_bitbang_execute_queue(void) { + /* safety: the send buffer must be empty, no leftover characters from + * previous transactions */ + assert(remote_bitbang_send_buf_used == 0); + /* process the JTAG command queue */ int ret = bitbang_execute_queue(); if (ret != ERROR_OK) -- cgit v1.1