jtag_vpi: fix path move function

Change-Id: I82bf6f733e0d9cb5c86553d0827c558fa98aa247
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1672
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
Franck Jullien 2013-10-03 23:22:32 +02:00 committed by Spencer Oliver
parent a58f294ac4
commit 7ef6a54da2
1 changed files with 7 additions and 13 deletions

View File

@ -123,23 +123,17 @@ static int jtag_vpi_tms_seq(const uint8_t *bits, int nb_bits)
static int jtag_vpi_path_move(struct pathmove_command *cmd) static int jtag_vpi_path_move(struct pathmove_command *cmd)
{ {
uint16_t trans = 0; uint8_t trans[DIV_ROUND_UP(cmd->num_states, 8)];
int retval;
int i;
for (i = 0; i < cmd->num_states; i++) { memset(trans, 0, DIV_ROUND_UP(cmd->num_states, 8));
for (int i = 0; i < cmd->num_states; i++) {
if (tap_state_transition(tap_get_state(), true) == cmd->path[i]) if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
trans = trans | 1; buf_set_u32(trans, i, 1, 1);
trans = trans << 1; tap_set_state(cmd->path[i]);
} }
retval = jtag_vpi_tms_seq((uint8_t *)&trans, 1); return jtag_vpi_tms_seq(trans, cmd->num_states);
if (retval != ERROR_OK)
return retval;
tap_set_state(cmd->path[i]);
return ERROR_OK;
} }
/** /**