diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-03-27 10:43:30 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-13 08:55:14 +0000 |
commit | b931286ab440f4677a9ac983a64b55055d20c438 (patch) | |
tree | 0109d9fe0bd57148d9d14a8c437e65e060606e48 /src/target/target.c | |
parent | 219412f9d65cff4457f9b9ce339a444ad903a1df (diff) | |
download | riscv-openocd-b931286ab440f4677a9ac983a64b55055d20c438.zip riscv-openocd-b931286ab440f4677a9ac983a64b55055d20c438.tar.gz riscv-openocd-b931286ab440f4677a9ac983a64b55055d20c438.tar.bz2 |
target: rewrite command 'arp_halt' as COMMAND_HANDLER
While there, add the missing .usage field.
Change-Id: I748382cafe08443c458ff1d4e47819610cfbf85c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7558
Tested-by: jenkins
Diffstat (limited to 'src/target/target.c')
-rw-r--r-- | src/target/target.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/target/target.c b/src/target/target.c index e995f13..f2e8d53 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5822,19 +5822,18 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return (e == ERROR_OK) ? JIM_OK : JIM_ERR; } -static int jim_target_halt(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +COMMAND_HANDLER(handle_target_halt) { - 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 = target->type->halt(target); - return (e == ERROR_OK) ? JIM_OK : JIM_ERR; + + return target->type->halt(target); } static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv) @@ -6108,8 +6107,9 @@ static const struct command_registration target_instance_command_handlers[] = { { .name = "arp_halt", .mode = COMMAND_EXEC, - .jim_handler = jim_target_halt, + .handler = handle_target_halt, .help = "used internally for reset processing", + .usage = "", }, { .name = "arp_waitstate", |