]> git.sur5r.net Git - openocd/commitdiff
jtag/drivers/buspirate: add JTAG_STABLECLOCKS cmd
authorMateusz Manowiecki <segmentation@fault.pl>
Fri, 23 Jan 2015 20:58:19 +0000 (21:58 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Mon, 9 Mar 2015 06:25:21 +0000 (06:25 +0000)
Solution found on the internet

Change-Id: Ied6f7d9b28131a7ac83b203e4c64d4e9ffec0595
Signed-off-by: Mateusz Manowiecki <segmentation@fault.pl>
Reviewed-on: http://openocd.zylin.com/2496
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
src/jtag/drivers/buspirate.c

index 12d34b9d784a7c56137c89046420c82dc851d72c..554d3e0ef1073aae06e3a7a6c1e43d69454a99eb 100644 (file)
@@ -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 **********/