aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jtag/drivers/ftdi.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 9e47d3c..8c83d45 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -482,7 +482,11 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
uint8_t last_bit = 0;
if (field->out_value)
bit_copy(&last_bit, 0, field->out_value, field->num_bits - 1, 1);
- uint8_t tms_bits = 0x01;
+
+ /* If endstate is TAP_IDLE, clock out 1-1-0 (->EXIT1 ->UPDATE ->IDLE)
+ * Otherwise, clock out 1-0 (->EXIT1 ->PAUSE)
+ */
+ uint8_t tms_bits = 0x03;
mpsse_clock_tms_cs(mpsse_ctx,
&tms_bits,
0,
@@ -492,13 +496,24 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
last_bit,
ftdi_jtag_mode);
tap_set_state(tap_state_transition(tap_get_state(), 1));
- mpsse_clock_tms_cs_out(mpsse_ctx,
- &tms_bits,
- 1,
- 1,
- last_bit,
- ftdi_jtag_mode);
- tap_set_state(tap_state_transition(tap_get_state(), 0));
+ if (tap_get_end_state() == TAP_IDLE) {
+ mpsse_clock_tms_cs_out(mpsse_ctx,
+ &tms_bits,
+ 1,
+ 2,
+ last_bit,
+ ftdi_jtag_mode);
+ tap_set_state(tap_state_transition(tap_get_state(), 1));
+ tap_set_state(tap_state_transition(tap_get_state(), 0));
+ } else {
+ mpsse_clock_tms_cs_out(mpsse_ctx,
+ &tms_bits,
+ 2,
+ 1,
+ last_bit,
+ ftdi_jtag_mode);
+ tap_set_state(tap_state_transition(tap_get_state(), 0));
+ }
} else
mpsse_clock_data(mpsse_ctx,
field->out_value,