diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2024-02-16 17:17:05 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2024-03-24 13:42:24 +0000 |
commit | a35e254c5383008cdacf7838a777f7f17af5eeb1 (patch) | |
tree | 9388f853ff9dc26600efa6accf6654f1c5ea44d5 | |
parent | c02cf9404dc9dba2a6bc60c4db65c0287168a338 (diff) | |
download | riscv-openocd-a35e254c5383008cdacf7838a777f7f17af5eeb1.zip riscv-openocd-a35e254c5383008cdacf7838a777f7f17af5eeb1.tar.gz riscv-openocd-a35e254c5383008cdacf7838a777f7f17af5eeb1.tar.bz2 |
target/adi_v5_swd: move setting of do_reconnect one level up
Move setting of do_reconnect flag from swd_run_inner()
to swd_run(). Reconnect is not used at the inner level
and the flag had to be cleared after swd_run_inner()
to prevent recursion.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib1de80bbdf10d1cbfb1dd351c6a5658e50d12af2
Reviewed-on: https://review.openocd.org/c/openocd/+/8155
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
-rw-r--r-- | src/target/adi_v5_swd.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c index 67706f3..1231005 100644 --- a/src/target/adi_v5_swd.c +++ b/src/target/adi_v5_swd.c @@ -84,16 +84,8 @@ static void swd_clear_sticky_errors(struct adiv5_dap *dap) static int swd_run_inner(struct adiv5_dap *dap) { const struct swd_driver *swd = adiv5_dap_swd_driver(dap); - int retval; - - retval = swd->run(); - - if (retval != ERROR_OK) { - /* fault response */ - dap->do_reconnect = true; - } - return retval; + return swd->run(); } static inline int check_sync(struct adiv5_dap *dap) @@ -288,15 +280,15 @@ static int swd_multidrop_select(struct adiv5_dap *dap) swd_multidrop_selected_dap = NULL; if (retry > 3) { LOG_ERROR("Failed to select multidrop %s", adiv5_dap_name(dap)); + dap->do_reconnect = true; return retval; } LOG_DEBUG("Failed to select multidrop %s, retrying...", adiv5_dap_name(dap)); - /* we going to retry localy, do not ask for full reconnect */ - dap->do_reconnect = false; } + dap->do_reconnect = false; return retval; } @@ -635,7 +627,13 @@ static int swd_run(struct adiv5_dap *dap) swd_finish_read(dap); - return swd_run_inner(dap); + retval = swd_run_inner(dap); + if (retval != ERROR_OK) { + /* fault response */ + dap->do_reconnect = true; + } + + return retval; } /** Put the SWJ-DP back to JTAG mode */ |