diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-10-19 23:33:08 -0700 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-10-19 23:33:08 -0700 |
commit | 6907ef9d5038d74ff38bc30a6085762c471468ed (patch) | |
tree | d55efc12baede0989ad078ca86bb08eac4504e43 /src/svf | |
parent | c70073ef67e5148f4869f62e765863617ea1f4e4 (diff) | |
download | openocd+libswd-6907ef9d5038d74ff38bc30a6085762c471468ed.tar.gz openocd+libswd-6907ef9d5038d74ff38bc30a6085762c471468ed.tar.bz2 openocd+libswd-6907ef9d5038d74ff38bc30a6085762c471468ed.tar.xz openocd+libswd-6907ef9d5038d74ff38bc30a6085762c471468ed.zip |
SVF: better spec conformance for STATE switch
Don't add extra TCK in current state; exit from RESET had four extras.
Only IDLE --> IDLE needs such an extra clock. (At least one TCK must
be issued.)
Allow entry to RESET; SVF allows it, so must we (despite those entries
being commented out of the statemove table).
When entering RESET, always use TLR ... we might end up with extra clocks
in reset that way, which is harmless, but we'll never end up in any other
state than RESET, which is useful paranoia.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/svf')
-rw-r--r-- | src/svf/svf.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/svf/svf.c b/src/svf/svf.c index 5b96971c..ecb0ffa4 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -316,30 +316,28 @@ static int svf_add_statemove(tap_state_t state_to) tap_state_t state_from = cmd_queue_cur_state; uint8_t index; + /* when resetting, be paranoid and ignore current state */ + if (state_to == TAP_RESET) { + jtag_add_tlr(); + return ERROR_OK; + } + for (index = 0; index < dimof(svf_statemoves); index++) { if ((svf_statemoves[index].from == state_from) && (svf_statemoves[index].to == state_to)) { - if (TAP_RESET == state_from) - { - jtag_add_tlr(); - if (svf_statemoves[index].num_of_moves > 1) - { - jtag_add_pathmove(svf_statemoves[index].num_of_moves - 1, svf_statemoves[index].paths + 1); - } - } + /* recorded path includes current state ... avoid extra TCKs! */ + if (svf_statemoves[index].num_of_moves > 1) + jtag_add_pathmove(svf_statemoves[index].num_of_moves - 1, + svf_statemoves[index].paths + 1); else - { - if (svf_statemoves[index].num_of_moves > 0) - { - jtag_add_pathmove(svf_statemoves[index].num_of_moves, svf_statemoves[index].paths); - } - } + jtag_add_pathmove(svf_statemoves[index].num_of_moves, + svf_statemoves[index].paths); return ERROR_OK; } } - LOG_ERROR("can not move to %s", tap_state_svf_name(state_to)); + LOG_ERROR("SVF: can not move to %s", tap_state_svf_name(state_to)); return ERROR_FAIL; } |