diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2022-05-30 22:49:12 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-08-15 13:22:06 +0000 |
commit | 0d56f379b55b24959c88e705a83e1fbb826b75e7 (patch) | |
tree | f17207d38580093526c5635198d6f26d01242772 /src/target/target.c | |
parent | c3138e2d805b94b81ba10bc7fcec47689704f60e (diff) | |
download | riscv-openocd-0d56f379b55b24959c88e705a83e1fbb826b75e7.zip riscv-openocd-0d56f379b55b24959c88e705a83e1fbb826b75e7.tar.gz riscv-openocd-0d56f379b55b24959c88e705a83e1fbb826b75e7.tar.bz2 |
target: add API to temporarily mask target polling
The same flag 'jtag_poll' is currently used as local data for the
command 'poll' and to temporarily mask the target polling.
This can cause unexpected behavior if the command 'poll' is
executed while polling is temporarily masked.
Add a new flag 'jtag_poll_en' to hold the temporarily mask
condition and keep 'jtag_poll' for the 'poll' command only.
While there, change the initial assignment of 'jtag_poll' using
the proper boolean value.
Change-Id: I18dcf7c65b07aefadf046caaa2fcd2d74fa6fbae
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7009
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Diffstat (limited to 'src/target/target.c')
-rw-r--r-- | src/target/target.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/target/target.c b/src/target/target.c index 553400d..10a25ef 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -654,10 +654,10 @@ int target_resume(struct target *target, int current, target_addr_t address, * Disable polling during resume() to guarantee the execution of handlers * in the correct order. */ - bool save_poll = jtag_poll_get_enabled(); - jtag_poll_set_enabled(false); + bool save_poll_mask = jtag_poll_mask(); retval = target->type->resume(target, current, address, handle_breakpoints, debug_execution); - jtag_poll_set_enabled(save_poll); + jtag_poll_unmask(save_poll_mask); + if (retval != ERROR_OK) return retval; @@ -685,14 +685,12 @@ static int target_process_reset(struct command_invocation *cmd, enum target_rese * more predictable, i.e. dr/irscan & pathmove in events will * not have JTAG operations injected into the middle of a sequence. */ - bool save_poll = jtag_poll_get_enabled(); - - jtag_poll_set_enabled(false); + bool save_poll_mask = jtag_poll_mask(); sprintf(buf, "ocd_process_reset %s", n->name); retval = Jim_Eval(cmd->ctx->interp, buf); - jtag_poll_set_enabled(save_poll); + jtag_poll_unmask(save_poll_mask); if (retval != JIM_OK) { Jim_MakeErrorMessage(cmd->ctx->interp); |