helper/jim-nvp.h: Rework 'isconfigure' variable
Change the variable name to 'is_configure' to be compatible with the coding style and use 'bool' as data type. Change-Id: I8609f9807c8bd14eaf6c93acf63fd51b55c9bbbb Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8573 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
61fbcbeca8
commit
8c739a45a0
|
@ -19,6 +19,7 @@
|
|||
#ifndef OPENOCD_HELPER_JIM_NVP_H
|
||||
#define OPENOCD_HELPER_JIM_NVP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <jim.h>
|
||||
|
||||
/** Name Value Pairs, aka: NVP
|
||||
|
@ -136,7 +137,7 @@ struct jim_getopt_info {
|
|||
Jim_Interp *interp;
|
||||
int argc;
|
||||
Jim_Obj *const *argv;
|
||||
int isconfigure; /* non-zero if configure */
|
||||
bool is_configure;
|
||||
};
|
||||
|
||||
/** GetOpt - how to.
|
||||
|
|
|
@ -103,7 +103,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target *target)
|
|||
Jim_Obj *res;
|
||||
int e;
|
||||
|
||||
if (!goi->isconfigure && goi->argc != 0) {
|
||||
if (!goi->is_configure && goi->argc != 0) {
|
||||
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS");
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
|
|
@ -2940,7 +2940,7 @@ static int aarch64_jim_configure(struct target *target, struct jim_getopt_info *
|
|||
|
||||
switch (n->value) {
|
||||
case CFG_CTI: {
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
Jim_Obj *o_cti;
|
||||
struct arm_cti *cti;
|
||||
e = jim_getopt_obj(goi, &o_cti);
|
||||
|
|
|
@ -2359,7 +2359,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
|
|||
|
||||
switch (n->value) {
|
||||
case CFG_DAP:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
Jim_Obj *o_t;
|
||||
struct adiv5_dap *dap;
|
||||
e = jim_getopt_obj(goi, &o_t);
|
||||
|
@ -2388,7 +2388,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
|
|||
break;
|
||||
|
||||
case CFG_AP_NUM:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
/* jim_wide is a signed 64 bits int, ap_num is unsigned with max 52 bits */
|
||||
jim_wide ap_num;
|
||||
e = jim_getopt_wide(goi, &ap_num);
|
||||
|
@ -2415,7 +2415,7 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
|
|||
LOG_WARNING("DEPRECATED! use \'-baseaddr' not \'-ctibase\'");
|
||||
/* fall through */
|
||||
case CFG_BASEADDR:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
jim_wide base;
|
||||
e = jim_getopt_wide(goi, &base);
|
||||
if (e != JIM_OK)
|
||||
|
|
|
@ -468,7 +468,7 @@ static int cti_create(struct jim_getopt_info *goi)
|
|||
adiv5_mem_ap_spot_init(&cti->spot);
|
||||
|
||||
/* Do the rest as "configure" options */
|
||||
goi->isconfigure = 1;
|
||||
goi->is_configure = true;
|
||||
e = cti_configure(goi, cti);
|
||||
if (e != JIM_OK) {
|
||||
free(cti);
|
||||
|
|
|
@ -358,7 +358,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
{
|
||||
assert(obj);
|
||||
|
||||
if (goi->isconfigure && obj->enabled) {
|
||||
if (goi->is_configure && obj->enabled) {
|
||||
Jim_SetResultFormatted(goi->interp, "Cannot configure TPIU/SWO; %s is enabled!", obj->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
|
||||
switch (n->value) {
|
||||
case CFG_PORT_WIDTH:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
jim_wide port_width;
|
||||
e = jim_getopt_wide(goi, &port_width);
|
||||
if (e != JIM_OK)
|
||||
|
@ -399,7 +399,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_PROTOCOL:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
struct jim_nvp *p;
|
||||
e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_protocol_opts, &p);
|
||||
if (e != JIM_OK)
|
||||
|
@ -418,7 +418,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_FORMATTER:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
struct jim_nvp *p;
|
||||
e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_bool_opts, &p);
|
||||
if (e != JIM_OK)
|
||||
|
@ -437,7 +437,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_TRACECLKIN:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
jim_wide clk;
|
||||
e = jim_getopt_wide(goi, &clk);
|
||||
if (e != JIM_OK)
|
||||
|
@ -450,7 +450,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_BITRATE:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
jim_wide clk;
|
||||
e = jim_getopt_wide(goi, &clk);
|
||||
if (e != JIM_OK)
|
||||
|
@ -463,7 +463,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_OUTFILE:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
const char *s;
|
||||
e = jim_getopt_string(goi, &s, NULL);
|
||||
if (e != JIM_OK)
|
||||
|
@ -491,7 +491,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
}
|
||||
break;
|
||||
case CFG_EVENT:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
if (goi->argc < 2) {
|
||||
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
|
||||
return JIM_ERR;
|
||||
|
@ -521,7 +521,7 @@ static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_s
|
|||
ea = ea->next;
|
||||
}
|
||||
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
if (!ea) {
|
||||
ea = calloc(1, sizeof(*ea));
|
||||
if (!ea) {
|
||||
|
@ -560,7 +560,7 @@ static int jim_arm_tpiu_swo_configure(Jim_Interp *interp, int argc, Jim_Obj * co
|
|||
struct jim_getopt_info goi;
|
||||
|
||||
jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
|
||||
goi.isconfigure = !strcmp(c->name, "configure");
|
||||
goi.is_configure = !strcmp(c->name, "configure");
|
||||
if (goi.argc < 1) {
|
||||
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
|
||||
"missing: -option ...");
|
||||
|
@ -977,7 +977,7 @@ static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int argc, Jim_Obj *const
|
|||
}
|
||||
|
||||
/* Do the rest as "configure" options */
|
||||
goi.isconfigure = 1;
|
||||
goi.is_configure = true;
|
||||
int e = arm_tpiu_swo_configure(&goi, obj);
|
||||
if (e != JIM_OK)
|
||||
goto err_exit;
|
||||
|
|
|
@ -4937,7 +4937,7 @@ static int target_configure(struct jim_getopt_info *goi, struct target *target)
|
|||
switch (n->value) {
|
||||
case TCFG_TYPE:
|
||||
/* not settable */
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
Jim_SetResultFormatted(goi->interp,
|
||||
"not settable: %s", n->name);
|
||||
return JIM_ERR;
|
||||
|
@ -4966,7 +4966,7 @@ no_params:
|
|||
return e;
|
||||
}
|
||||
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
if (goi->argc != 1) {
|
||||
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
|
||||
return JIM_ERR;
|
||||
|
@ -4989,7 +4989,7 @@ no_params:
|
|||
teap = teap->next;
|
||||
}
|
||||
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
/* START_DEPRECATED_TPIU */
|
||||
if (n->value == TARGET_EVENT_TRACE_CONFIG)
|
||||
LOG_INFO("DEPRECATED target event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
|
||||
|
@ -5037,7 +5037,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_WORK_AREA_VIRT:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
target_free_all_working_areas(target);
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
|
@ -5053,7 +5053,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_WORK_AREA_PHYS:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
target_free_all_working_areas(target);
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
|
@ -5069,7 +5069,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_WORK_AREA_SIZE:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
target_free_all_working_areas(target);
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
|
@ -5084,7 +5084,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_WORK_AREA_BACKUP:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
target_free_all_working_areas(target);
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
|
@ -5101,7 +5101,7 @@ no_params:
|
|||
|
||||
|
||||
case TCFG_ENDIAN:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
e = jim_getopt_nvp(goi, nvp_target_endian, &n);
|
||||
if (e != JIM_OK) {
|
||||
jim_getopt_nvp_unknown(goi, nvp_target_endian, 1);
|
||||
|
@ -5122,7 +5122,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_COREID:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
return e;
|
||||
|
@ -5136,7 +5136,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_CHAIN_POSITION:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
Jim_Obj *o_t;
|
||||
struct jtag_tap *tap;
|
||||
|
||||
|
@ -5163,7 +5163,7 @@ no_params:
|
|||
/* loop for more e*/
|
||||
break;
|
||||
case TCFG_DBGBASE:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
return e;
|
||||
|
@ -5193,7 +5193,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_GDB_PORT:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
struct command_context *cmd_ctx = current_command_context(goi->interp);
|
||||
if (cmd_ctx->mode != COMMAND_CONFIG) {
|
||||
Jim_SetResultString(goi->interp, "-gdb-port must be configured before 'init'", -1);
|
||||
|
@ -5215,7 +5215,7 @@ no_params:
|
|||
break;
|
||||
|
||||
case TCFG_GDB_MAX_CONNECTIONS:
|
||||
if (goi->isconfigure) {
|
||||
if (goi->is_configure) {
|
||||
struct command_context *cmd_ctx = current_command_context(goi->interp);
|
||||
if (cmd_ctx->mode != COMMAND_CONFIG) {
|
||||
Jim_SetResultString(goi->interp, "-gdb-max-connections must be configured before 'init'", -1);
|
||||
|
@ -5246,7 +5246,7 @@ static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj * const *a
|
|||
struct jim_getopt_info goi;
|
||||
|
||||
jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
|
||||
goi.isconfigure = !strcmp(c->name, "configure");
|
||||
goi.is_configure = !strcmp(c->name, "configure");
|
||||
if (goi.argc < 1) {
|
||||
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
|
||||
"missing: -option ...");
|
||||
|
@ -5823,7 +5823,7 @@ static int target_create(struct jim_getopt_info *goi)
|
|||
target->gdb_max_connections = 1;
|
||||
|
||||
/* Do the rest as "configure" options */
|
||||
goi->isconfigure = 1;
|
||||
goi->is_configure = true;
|
||||
e = target_configure(goi, target);
|
||||
|
||||
if (e == JIM_OK) {
|
||||
|
|
Loading…
Reference in New Issue