From ef0fa97a717e7f1d7af276f7d67897803c505d35 Mon Sep 17 00:00:00 2001 From: Mateusz Manowiecki Date: Fri, 23 Jan 2015 21:58:19 +0100 Subject: [PATCH] jtag/drivers/buspirate: add JTAG_STABLECLOCKS cmd Solution found on the internet Change-Id: Ied6f7d9b28131a7ac83b203e4c64d4e9ffec0595 Signed-off-by: Mateusz Manowiecki Reviewed-on: http://openocd.zylin.com/2496 Tested-by: jenkins Reviewed-by: Paul Fertser --- src/jtag/drivers/buspirate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c index 12d34b9d..554d3e0e 100644 --- a/src/jtag/drivers/buspirate.c +++ b/src/jtag/drivers/buspirate.c @@ -42,6 +42,7 @@ static void buspirate_path_move(int num_states, tap_state_t *path); static void buspirate_runtest(int num_cycles); static void buspirate_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, struct scan_command *command); +static void buspirate_stableclocks(int num_cycles); #define CMD_UNKNOWN 0x00 #define CMD_PORT_MODE 0x01 @@ -192,6 +193,10 @@ static int buspirate_execute_queue(void) buspirate_tap_execute(); jtag_sleep(cmd->cmd.sleep->us); break; + case JTAG_STABLECLOCKS: + DEBUG_JTAG_IO("stable clock %i cycles", cmd->cmd.stableclocks->num_cycles); + buspirate_stableclocks(cmd->cmd.stableclocks->num_cycles); + break; default: LOG_ERROR("BUG: unknown JTAG command type encountered"); exit(-1); @@ -602,6 +607,16 @@ static void buspirate_scan(bool ir_scan, enum scan_type type, buspirate_state_move(); } +static void buspirate_stableclocks(int num_cycles) +{ + int i; + int tms = (tap_get_state() == TAP_RESET ? 1 : 0); + + buspirate_tap_make_space(0, num_cycles); + + for (i = 0; i < num_cycles; i++) + buspirate_tap_append(tms, 0); +} /************************* TAP related stuff **********/ -- 2.39.5