Simplified bscan_shift routine (never need to stay in shift state at conclusion).

This commit is contained in:
Greg Savin 2019-03-28 09:52:43 -07:00
parent 2b73796a5c
commit fc35fd25fe
1 changed files with 32 additions and 42 deletions

View File

@ -504,49 +504,39 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
} }
#if BUILD_FTDI_BSCAN == 1 #if BUILD_FTDI_BSCAN == 1
static void bscan_shift(bool traverse_to_end_state, const uint8_t *out, unsigned out_offset, uint8_t *in, static void bscan_shift_and_traverse_to_end_state(const uint8_t *out, unsigned out_offset, uint8_t *in,
unsigned in_offset, unsigned length) unsigned in_offset, unsigned length)
{ {
if (traverse_to_end_state) { DO_CLOCK_DATA(mpsse_ctx,
DO_CLOCK_DATA(mpsse_ctx, out,
out, out_offset,
out_offset, in,
in, in_offset,
in_offset, length - 1,
length - 1, ftdi_jtag_mode);
ftdi_jtag_mode); uint8_t last_bit = 0;
uint8_t last_bit = 0; if (out)
if (out) bit_copy(&last_bit, 0, out, length - 1, 1);
bit_copy(&last_bit, 0, out, length - 1, 1); uint8_t tms_bits = 0x01;
uint8_t tms_bits = 0x01; DO_CLOCK_TMS_CS(mpsse_ctx,
DO_CLOCK_TMS_CS(mpsse_ctx, &tms_bits,
&tms_bits, 0,
0, in,
in, in_offset + length - 1,
in_offset + length - 1, 1,
1, last_bit,
last_bit, ftdi_jtag_mode);
ftdi_jtag_mode); tap_set_state(tap_state_transition(tap_get_state(), 1));
tap_set_state(tap_state_transition(tap_get_state(), 1)); DO_CLOCK_TMS_CS_OUT(mpsse_ctx,
DO_CLOCK_TMS_CS_OUT(mpsse_ctx, &tms_bits,
&tms_bits, 1,
1, 1,
1, 0,
0, ftdi_jtag_mode);
ftdi_jtag_mode); tap_set_state(tap_state_transition(tap_get_state(), 0));
tap_set_state(tap_state_transition(tap_get_state(), 0));
if (tap_get_state() != tap_get_end_state()) if (tap_get_state() != tap_get_end_state())
move_to_state(tap_get_end_state()); move_to_state(tap_get_end_state());
} else {
DO_CLOCK_DATA(mpsse_ctx,
out,
out_offset,
in,
in_offset,
length,
ftdi_jtag_mode);
}
} }
@ -576,7 +566,7 @@ static void ftdi_execute_scan_via_bscan(struct jtag_command *cmd)
// Do the 6-bit IR scan of 0x23 (USER4) // Do the 6-bit IR scan of 0x23 (USER4)
bscan_shift(true, &bscan_ir_user, 0, NULL, 0, bscan_ir_user_width); bscan_shift_and_traverse_to_end_state(&bscan_ir_user, 0, NULL, 0, bscan_ir_user_width);
if (tap_get_state() != tap_get_end_state()) if (tap_get_state() != tap_get_end_state())
move_to_state(tap_get_end_state()); move_to_state(tap_get_end_state());
@ -650,7 +640,7 @@ static void ftdi_execute_scan_via_bscan(struct jtag_command *cmd)
// shift in epilogue (3 bits of value zero), exiting shift state and traversing to idle state // shift in epilogue (3 bits of value zero), exiting shift state and traversing to idle state
bscan_shift(true, &epilogue, 0, NULL, 0, 3); bscan_shift_and_traverse_to_end_state(&epilogue, 0, NULL, 0, 3);
if (tap_get_state() != tap_get_end_state()) if (tap_get_state() != tap_get_end_state())
move_to_state(tap_get_end_state()); move_to_state(tap_get_end_state());