This is an automated email from Gerrit. Alex Shargalin ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4284
-- gerrit commit 00ea4fb467c72a158d73a1148fda0f538d0db48e Author: Aleksey Shargalin <[email protected]> Date: Tue Oct 31 17:23:40 2017 +0300 bitbang: Add flush before sleep Some bitbang interfaces have no speed regulation and work as fast as they can. Only sequence of execuded commands is guaranteed but not the timing. It works most of time with one exception: when JTAG_SLEEP command is executed, we expect that all previous commands already finished so that the sleep interval is guaranteed. For now there may be situations when the sleep time have passed but previous commands are not actually executed. This patch adds flush command to the bitbang interface and its implementation for remote_bitbang. Change-Id: If40894a63d29a260a4ded134b008df6dd1e89c46 Signed-off-by: Aleksey Shargalin <[email protected]> diff --git a/src/jtag/drivers/bitbang.c b/src/jtag/drivers/bitbang.c index c9ec9c9..627e945 100644 --- a/src/jtag/drivers/bitbang.c +++ b/src/jtag/drivers/bitbang.c @@ -327,6 +327,8 @@ int bitbang_execute_queue(void) #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("sleep %" PRIi32, cmd->cmd.sleep->us); #endif + if (bitbang_interface->flush) + bitbang_interface->flush(); jtag_sleep(cmd->cmd.sleep->us); break; case JTAG_TMS: diff --git a/src/jtag/drivers/bitbang.h b/src/jtag/drivers/bitbang.h index c5b44bf..fa4e7cc 100644 --- a/src/jtag/drivers/bitbang.h +++ b/src/jtag/drivers/bitbang.h @@ -33,6 +33,7 @@ struct bitbang_interface { void (*blink)(int on); int (*swdio_read)(void); void (*swdio_drive)(bool on); + void (*flush)(void); }; const struct swd_driver bitbang_swd; diff --git a/src/jtag/drivers/remote_bitbang.c b/src/jtag/drivers/remote_bitbang.c index c8d0136..63a83af 100644 --- a/src/jtag/drivers/remote_bitbang.c +++ b/src/jtag/drivers/remote_bitbang.c @@ -49,6 +49,13 @@ static void remote_bitbang_putc(int c) REMOTE_BITBANG_RAISE_ERROR("remote_bitbang_putc: %s", strerror(errno)); } +static void remote_bitbang_flush(void) +{ + if (EOF == fflush(remote_bitbang_out)) { + LOG_ERROR("fflush: %s", strerror(errno)); + } +} + static int remote_bitbang_quit(void) { if (EOF == fputc('Q', remote_bitbang_out)) { @@ -125,6 +132,7 @@ static struct bitbang_interface remote_bitbang_bitbang = { .write = &remote_bitbang_write, .reset = &remote_bitbang_reset, .blink = &remote_bitbang_blink, + .flush = &remote_bitbang_flush, }; static int remote_bitbang_init_tcp(void) -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
