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
This commit is contained in:
Antonio Borneo 2023-03-27 10:43:30 +02:00
parent 219412f9d6
commit b931286ab4
1 changed files with 12 additions and 12 deletions

View File

@ -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",