diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-03-27 10:34:14 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-13 08:54:37 +0000 |
commit | 219412f9d65cff4457f9b9ce339a444ad903a1df (patch) | |
tree | f9f808706bda0a9f75cd526c4dde626e7285428f | |
parent | 7319eb3a25732c9d9bcaff804dac6abded99fc43 (diff) | |
download | riscv-openocd-219412f9d65cff4457f9b9ce339a444ad903a1df.zip riscv-openocd-219412f9d65cff4457f9b9ce339a444ad903a1df.tar.gz riscv-openocd-219412f9d65cff4457f9b9ce339a444ad903a1df.tar.bz2 |
target: rewrite command 'arp_poll' as COMMAND_HANDLER
While there, add the missing .usage field.
Change-Id: I16e0aeacdaaada09fa77ad29552fa4025eff0c45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7557
Tested-by: jenkins
-rw-r--r-- | src/target/target.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/target/target.c b/src/target/target.c index fb5ef72..e995f13 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5753,26 +5753,21 @@ COMMAND_HANDLER(handle_target_halt_gdb) return target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); } -static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +COMMAND_HANDLER(handle_target_poll) { - if (argc != 1) { - Jim_WrongNumArgs(interp, 1, argv, "[no parameters]"); - return JIM_ERR; + if (CMD_ARGC != 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + struct target *target = get_current_target(CMD_CTX); + if (!target->tap->enabled) { + command_print(CMD, "[TAP is disabled]"); + return ERROR_FAIL; } - struct command_context *cmd_ctx = current_command_context(interp); - assert(cmd_ctx); - struct target *target = get_current_target(cmd_ctx); - if (!target->tap->enabled) - return jim_target_tap_disabled(interp); - int e; if (!(target_was_examined(target))) - e = ERROR_TARGET_NOT_EXAMINED; - else - e = target->type->poll(target); - if (e != ERROR_OK) - return JIM_ERR; - return JIM_OK; + return ERROR_TARGET_NOT_EXAMINED; + + return target->type->poll(target); } static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) @@ -6100,8 +6095,9 @@ static const struct command_registration target_instance_command_handlers[] = { { .name = "arp_poll", .mode = COMMAND_EXEC, - .jim_handler = jim_target_poll, + .handler = handle_target_poll, .help = "used internally for reset processing", + .usage = "", }, { .name = "arp_reset", |