helper/jim-nvp: comply with coding style [2/2]

With the API fixed to comply with OpenOCD coding style, fix all
the references in the code.

Patch generated automatically with the script below.
The list is in reverse order to replace a common prefix after the
replacement of the symbols with the same prefix.

%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---
(cat << EOF
Jim_SetResult_NvpUnknown         jim_set_result_nvp_unknown
Jim_Nvp_value2name_simple        jim_nvp_value2name_simple
Jim_Nvp_value2name_obj           jim_nvp_value2name_obj
Jim_Nvp_value2name               jim_nvp_value2name
Jim_Nvp_name2value_simple        jim_nvp_name2value_simple
Jim_Nvp_name2value_obj_nocase    jim_nvp_name2value_obj_nocase
Jim_Nvp_name2value_obj           jim_nvp_name2value_obj
Jim_Nvp_name2value_nocase_simple jim_nvp_name2value_nocase_simple
Jim_Nvp_name2value_nocase        jim_nvp_name2value_nocase
Jim_Nvp_name2value               jim_nvp_name2value
Jim_Nvp                        struct jim_nvp
Jim_GetOpt_Wide                  jim_getopt_wide
Jim_GetOpt_String                jim_getopt_string
Jim_GetOpt_Setup                 jim_getopt_setup
Jim_GetOpt_Obj                   jim_getopt_obj
Jim_GetOpt_NvpUnknown            jim_getopt_nvp_unknown
Jim_GetOpt_Nvp                   jim_getopt_nvp
Jim_GetOpt_Enum                  jim_getopt_enum
Jim_GetOpt_Double                jim_getopt_double
Jim_GetOpt_Debug                 jim_getopt_debug
Jim_GetOptInfo                 struct jim_getopt_info
Jim_GetNvp                       jim_get_nvp
Jim_Debug_ArgvString             jim_debug_argv_string
EOF
) | while read a b; do
    sed -i "s/$a/$b/g" $(find src -type f ! -name jim-nvp.\? )
done
%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---

Change-Id: I10a12bd64bb8b17575fd9150482c989c92b298a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6184
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2021-04-25 00:48:14 +02:00
parent b8e18d292e
commit 9e7b31479b
21 changed files with 316 additions and 316 deletions

View File

@ -51,8 +51,8 @@ const char * const jtag_only[] = { "jtag", NULL };
static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
/* return the name of the interface */ /* return the name of the interface */
/* TCL code might need to know the exact type... */ /* TCL code might need to know the exact type... */

View File

@ -30,11 +30,11 @@
#include <string.h> #include <string.h>
/* */ /* */
static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap) struct jtag_tap *pTap)
{ {
jim_wide w; jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w); int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", Jim_SetResultFormatted(goi->interp, "option: %s bad parameter",
n->name); n->name);
@ -63,14 +63,14 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
#define NTAP_OPT_EXPECTED_ID 0 #define NTAP_OPT_EXPECTED_ID 0
/* */ /* */
static int jim_aice_newtap_cmd(Jim_GetOptInfo *goi) static int jim_aice_newtap_cmd(struct jim_getopt_info *goi)
{ {
struct jtag_tap *pTap; struct jtag_tap *pTap;
int x; int x;
int e; int e;
Jim_Nvp *n; struct jim_nvp *n;
char *cp; char *cp;
const Jim_Nvp opts[] = { const struct jim_nvp opts[] = {
{.name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID}, {.name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID},
{.name = NULL, .value = -1}, {.name = NULL, .value = -1},
}; };
@ -92,10 +92,10 @@ static int jim_aice_newtap_cmd(Jim_GetOptInfo *goi)
} }
const char *tmp; const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->chip = strdup(tmp); pTap->chip = strdup(tmp);
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->tapname = strdup(tmp); pTap->tapname = strdup(tmp);
/* name + dot + name + null */ /* name + dot + name + null */
@ -108,9 +108,9 @@ static int jim_aice_newtap_cmd(Jim_GetOptInfo *goi)
pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
while (goi->argc) { while (goi->argc) {
e = Jim_GetOpt_Nvp(goi, opts, &n); e = jim_getopt_nvp(goi, opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, opts, 0); jim_getopt_nvp_unknown(goi, opts, 0);
free(cp); free(cp);
free(pTap); free(pTap);
return e; return e;
@ -138,8 +138,8 @@ static int jim_aice_newtap_cmd(Jim_GetOptInfo *goi)
/* */ /* */
static int jim_aice_newtap(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_aice_newtap(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
return jim_aice_newtap_cmd(&goi); return jim_aice_newtap_cmd(&goi);
} }
@ -246,8 +246,8 @@ static int aice_init_reset(struct command_context *cmd_ctx)
static int jim_aice_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_aice_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
int e = ERROR_OK; int e = ERROR_OK;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc != 0) { if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv - 1, "(no params)"); Jim_WrongNumArgs(goi.interp, 1, goi.argv - 1, "(no params)");
return JIM_ERR; return JIM_ERR;
@ -265,8 +265,8 @@ static int jim_aice_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj * const
static int jim_aice_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_aice_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc != 0) { if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
return JIM_ERR; return JIM_ERR;

View File

@ -926,22 +926,22 @@ COMMAND_HANDLER(ftdi_handle_vid_pid_command)
COMMAND_HANDLER(ftdi_handle_tdo_sample_edge_command) COMMAND_HANDLER(ftdi_handle_tdo_sample_edge_command)
{ {
Jim_Nvp *n; struct jim_nvp *n;
static const Jim_Nvp nvp_ftdi_jtag_modes[] = { static const struct jim_nvp nvp_ftdi_jtag_modes[] = {
{ .name = "rising", .value = JTAG_MODE }, { .name = "rising", .value = JTAG_MODE },
{ .name = "falling", .value = JTAG_MODE_ALT }, { .name = "falling", .value = JTAG_MODE_ALT },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
if (CMD_ARGC > 0) { if (CMD_ARGC > 0) {
n = Jim_Nvp_name2value_simple(nvp_ftdi_jtag_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_ftdi_jtag_modes, CMD_ARGV[0]);
if (n->name == NULL) if (n->name == NULL)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
ftdi_jtag_mode = n->value; ftdi_jtag_mode = n->value;
} }
n = Jim_Nvp_value2name_simple(nvp_ftdi_jtag_modes, ftdi_jtag_mode); n = jim_nvp_value2name_simple(nvp_ftdi_jtag_modes, ftdi_jtag_mode);
command_print(CMD, "ftdi samples TDO on %s edge of TCK", n->name); command_print(CMD, "ftdi samples TDO on %s edge of TCK", n->name);
return ERROR_OK; return ERROR_OK;

View File

@ -28,11 +28,11 @@
#include <transport/transport.h> #include <transport/transport.h>
#include <helper/time_support.h> #include <helper/time_support.h>
static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap) struct jtag_tap *pTap)
{ {
jim_wide w; jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w); int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", Jim_SetResultFormatted(goi->interp, "option: %s bad parameter",
n->name); n->name);
@ -60,14 +60,14 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
#define NTAP_OPT_EXPECTED_ID 5 #define NTAP_OPT_EXPECTED_ID 5
#define NTAP_OPT_VERSION 6 #define NTAP_OPT_VERSION 6
static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi) static int jim_hl_newtap_cmd(struct jim_getopt_info *goi)
{ {
struct jtag_tap *pTap; struct jtag_tap *pTap;
int x; int x;
int e; int e;
Jim_Nvp *n; struct jim_nvp *n;
char *cp; char *cp;
const Jim_Nvp opts[] = { const struct jim_nvp opts[] = {
{ .name = "-irlen", .value = NTAP_OPT_IRLEN }, { .name = "-irlen", .value = NTAP_OPT_IRLEN },
{ .name = "-irmask", .value = NTAP_OPT_IRMASK }, { .name = "-irmask", .value = NTAP_OPT_IRMASK },
{ .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE }, { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
@ -95,10 +95,10 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi)
} }
const char *tmp; const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->chip = strdup(tmp); pTap->chip = strdup(tmp);
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->tapname = strdup(tmp); pTap->tapname = strdup(tmp);
/* name + dot + name + null */ /* name + dot + name + null */
@ -111,9 +111,9 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi)
pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
while (goi->argc) { while (goi->argc) {
e = Jim_GetOpt_Nvp(goi, opts, &n); e = jim_getopt_nvp(goi, opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, opts, 0); jim_getopt_nvp_unknown(goi, opts, 0);
free(cp); free(cp);
free(pTap); free(pTap);
return e; return e;
@ -132,7 +132,7 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi)
case NTAP_OPT_IRMASK: case NTAP_OPT_IRMASK:
case NTAP_OPT_IRCAPTURE: case NTAP_OPT_IRCAPTURE:
/* dummy read to ignore the next argument */ /* dummy read to ignore the next argument */
Jim_GetOpt_Wide(goi, NULL); jim_getopt_wide(goi, NULL);
break; break;
} /* switch (n->value) */ } /* switch (n->value) */
} /* while (goi->argc) */ } /* while (goi->argc) */
@ -146,7 +146,7 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi)
int jim_hl_newtap(Jim_Interp *interp, int argc, Jim_Obj * const *argv) int jim_hl_newtap(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
return jim_hl_newtap_cmd(&goi); return jim_hl_newtap_cmd(&goi);
} }

View File

@ -49,7 +49,7 @@
* Holds support for accessing JTAG-specific mechanisms from TCl scripts. * Holds support for accessing JTAG-specific mechanisms from TCl scripts.
*/ */
static const Jim_Nvp nvp_jtag_tap_event[] = { static const struct jim_nvp nvp_jtag_tap_event[] = {
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" }, { .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" }, { .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" }, { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
@ -310,24 +310,24 @@ enum jtag_tap_cfg_param {
JCFG_IDCODE, JCFG_IDCODE,
}; };
static Jim_Nvp nvp_config_opts[] = { static struct jim_nvp nvp_config_opts[] = {
{ .name = "-event", .value = JCFG_EVENT }, { .name = "-event", .value = JCFG_EVENT },
{ .name = "-idcode", .value = JCFG_IDCODE }, { .name = "-idcode", .value = JCFG_IDCODE },
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap) static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap *tap)
{ {
if (goi->argc == 0) { if (goi->argc == 0) {
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ..."); Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
return JIM_ERR; return JIM_ERR;
} }
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_GetOpt_Nvp(goi, nvp_jtag_tap_event, &n); int e = jim_getopt_nvp(goi, nvp_jtag_tap_event, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1); jim_getopt_nvp_unknown(goi, nvp_jtag_tap_event, 1);
return e; return e;
} }
@ -369,7 +369,7 @@ static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
jteap->event = n->value; jteap->event = n->value;
Jim_Obj *o; Jim_Obj *o;
Jim_GetOpt_Obj(goi, &o); jim_getopt_obj(goi, &o);
jteap->body = Jim_DuplicateObj(goi->interp, o); jteap->body = Jim_DuplicateObj(goi->interp, o);
Jim_IncrRefCount(jteap->body); Jim_IncrRefCount(jteap->body);
@ -386,16 +386,16 @@ static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
return JIM_OK; return JIM_OK;
} }
static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap *tap) static int jtag_tap_configure_cmd(struct jim_getopt_info *goi, struct jtag_tap *tap)
{ {
/* parse config or cget options */ /* parse config or cget options */
while (goi->argc > 0) { while (goi->argc > 0) {
Jim_SetEmptyResult(goi->interp); Jim_SetEmptyResult(goi->interp);
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); int e = jim_getopt_nvp(goi, nvp_config_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
return e; return e;
} }
@ -439,11 +439,11 @@ static int is_bad_irval(int ir_length, jim_wide w)
return (w & v) != 0; return (w & v) != 0;
} }
static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap) struct jtag_tap *pTap)
{ {
jim_wide w; jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w); int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name); Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
return e; return e;
@ -470,11 +470,11 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
#define NTAP_OPT_EXPECTED_ID 5 #define NTAP_OPT_EXPECTED_ID 5
#define NTAP_OPT_VERSION 6 #define NTAP_OPT_VERSION 6
static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi, static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap) struct jtag_tap *pTap)
{ {
jim_wide w; jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w); int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, Jim_SetResultFormatted(goi->interp,
"option: %s bad parameter", n->name); "option: %s bad parameter", n->name);
@ -516,14 +516,14 @@ static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
return JIM_OK; return JIM_OK;
} }
static int jim_newtap_cmd(Jim_GetOptInfo *goi) static int jim_newtap_cmd(struct jim_getopt_info *goi)
{ {
struct jtag_tap *pTap; struct jtag_tap *pTap;
int x; int x;
int e; int e;
Jim_Nvp *n; struct jim_nvp *n;
char *cp; char *cp;
const Jim_Nvp opts[] = { const struct jim_nvp opts[] = {
{ .name = "-irlen", .value = NTAP_OPT_IRLEN }, { .name = "-irlen", .value = NTAP_OPT_IRLEN },
{ .name = "-irmask", .value = NTAP_OPT_IRMASK }, { .name = "-irmask", .value = NTAP_OPT_IRMASK },
{ .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE }, { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
@ -550,10 +550,10 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
} }
const char *tmp; const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->chip = strdup(tmp); pTap->chip = strdup(tmp);
Jim_GetOpt_String(goi, &tmp, NULL); jim_getopt_string(goi, &tmp, NULL);
pTap->tapname = strdup(tmp); pTap->tapname = strdup(tmp);
/* name + dot + name + null */ /* name + dot + name + null */
@ -580,9 +580,9 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
pTap->ir_capture_value = 0x01; pTap->ir_capture_value = 0x01;
while (goi->argc) { while (goi->argc) {
e = Jim_GetOpt_Nvp(goi, opts, &n); e = jim_getopt_nvp(goi, opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, opts, 0); jim_getopt_nvp_unknown(goi, opts, 0);
free(cp); free(cp);
free(pTap); free(pTap);
return e; return e;
@ -644,7 +644,7 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
if (jteap->event != e) if (jteap->event != e)
continue; continue;
Jim_Nvp *nvp = Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e); struct jim_nvp *nvp = jim_nvp_value2name_simple(nvp_jtag_tap_event, e);
LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s", LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
tap->dotted_name, e, nvp->name, tap->dotted_name, e, nvp->name,
Jim_GetString(jteap->body, NULL)); Jim_GetString(jteap->body, NULL));
@ -678,8 +678,8 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) { if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR; return JIM_ERR;
@ -697,8 +697,8 @@ static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
int e = ERROR_OK; int e = ERROR_OK;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) { if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR; return JIM_ERR;
@ -719,8 +719,8 @@ static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const
int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv) int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
return jim_newtap_cmd(&goi); return jim_newtap_cmd(&goi);
} }
@ -759,8 +759,8 @@ int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
struct command *c = jim_to_command(interp); struct command *c = jim_to_command(interp);
const char *cmd_name = c->name; const char *cmd_name = c->name;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 1) { if (goi.argc != 1) {
Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name); Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
return JIM_ERR; return JIM_ERR;
@ -797,8 +797,8 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
struct command *c = jim_to_command(interp); struct command *c = jim_to_command(interp);
const char *cmd_name = c->name; const char *cmd_name = c->name;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
goi.isconfigure = !strcmp(cmd_name, "configure"); goi.isconfigure = !strcmp(cmd_name, "configure");
if (goi.argc < 2 + goi.isconfigure) { if (goi.argc < 2 + goi.isconfigure) {
Jim_WrongNumArgs(goi.interp, 0, NULL, Jim_WrongNumArgs(goi.interp, 0, NULL,
@ -809,7 +809,7 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
struct jtag_tap *t; struct jtag_tap *t;
Jim_Obj *o; Jim_Obj *o;
Jim_GetOpt_Obj(&goi, &o); jim_getopt_obj(&goi, &o);
t = jtag_tap_by_jim_obj(goi.interp, o); t = jtag_tap_by_jim_obj(goi.interp, o);
if (t == NULL) if (t == NULL)
return JIM_ERR; return JIM_ERR;
@ -819,8 +819,8 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) { if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
return JIM_ERR; return JIM_ERR;

View File

@ -122,7 +122,7 @@ static int os_alloc_create(struct target *target, struct rtos_type *ostype)
return ret; return ret;
} }
int rtos_create(Jim_GetOptInfo *goi, struct target *target) int rtos_create(struct jim_getopt_info *goi, struct target *target)
{ {
int x; int x;
const char *cp; const char *cp;
@ -136,7 +136,7 @@ int rtos_create(Jim_GetOptInfo *goi, struct target *target)
os_free(target); os_free(target);
e = Jim_GetOpt_String(goi, &cp, NULL); e = jim_getopt_string(goi, &cp, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;

View File

@ -110,7 +110,7 @@ struct rtos_register_stacking {
#define GDB_THREAD_PACKET_NOT_CONSUMED (-40) #define GDB_THREAD_PACKET_NOT_CONSUMED (-40)
int rtos_create(Jim_GetOptInfo *goi, struct target *target); int rtos_create(struct jim_getopt_info *goi, struct target *target);
void rtos_destroy(struct target *target); void rtos_destroy(struct target *target);
int rtos_set_reg(struct connection *connection, int reg_num, int rtos_set_reg(struct connection *connection, int reg_num,
uint8_t *reg_value); uint8_t *reg_value);

View File

@ -2785,15 +2785,15 @@ enum aarch64_cfg_param {
CFG_CTI, CFG_CTI,
}; };
static const Jim_Nvp nvp_config_opts[] = { static const struct jim_nvp nvp_config_opts[] = {
{ .name = "-cti", .value = CFG_CTI }, { .name = "-cti", .value = CFG_CTI },
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static int aarch64_jim_configure(struct target *target, Jim_GetOptInfo *goi) static int aarch64_jim_configure(struct target *target, struct jim_getopt_info *goi)
{ {
struct aarch64_private_config *pc; struct aarch64_private_config *pc;
Jim_Nvp *n; struct jim_nvp *n;
int e; int e;
pc = (struct aarch64_private_config *)target->private_config; pc = (struct aarch64_private_config *)target->private_config;
@ -2824,12 +2824,12 @@ static int aarch64_jim_configure(struct target *target, Jim_GetOptInfo *goi)
Jim_SetEmptyResult(goi->interp); Jim_SetEmptyResult(goi->interp);
/* check first if topmost item is for us */ /* check first if topmost item is for us */
e = Jim_Nvp_name2value_obj(goi->interp, nvp_config_opts, e = jim_nvp_name2value_obj(goi->interp, nvp_config_opts,
goi->argv[0], &n); goi->argv[0], &n);
if (e != JIM_OK) if (e != JIM_OK)
return JIM_CONTINUE; return JIM_CONTINUE;
e = Jim_GetOpt_Obj(goi, NULL); e = jim_getopt_obj(goi, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2838,7 +2838,7 @@ static int aarch64_jim_configure(struct target *target, Jim_GetOptInfo *goi)
if (goi->isconfigure) { if (goi->isconfigure) {
Jim_Obj *o_cti; Jim_Obj *o_cti;
struct arm_cti *cti; struct arm_cti *cti;
e = Jim_GetOpt_Obj(goi, &o_cti); e = jim_getopt_obj(goi, &o_cti);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
cti = cti_instance_by_jim_obj(goi->interp, o_cti); cti = cti_instance_by_jim_obj(goi->interp, o_cti);
@ -2930,15 +2930,15 @@ COMMAND_HANDLER(aarch64_mask_interrupts_command)
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
struct aarch64_common *aarch64 = target_to_aarch64(target); struct aarch64_common *aarch64 = target_to_aarch64(target);
static const Jim_Nvp nvp_maskisr_modes[] = { static const struct jim_nvp nvp_maskisr_modes[] = {
{ .name = "off", .value = AARCH64_ISRMASK_OFF }, { .name = "off", .value = AARCH64_ISRMASK_OFF },
{ .name = "on", .value = AARCH64_ISRMASK_ON }, { .name = "on", .value = AARCH64_ISRMASK_ON },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
const Jim_Nvp *n; const struct jim_nvp *n;
if (CMD_ARGC > 0) { if (CMD_ARGC > 0) {
n = Jim_Nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]);
if (n->name == NULL) { if (n->name == NULL) {
LOG_ERROR("Unknown parameter: %s - should be off or on", CMD_ARGV[0]); LOG_ERROR("Unknown parameter: %s - should be off or on", CMD_ARGV[0]);
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -2947,7 +2947,7 @@ COMMAND_HANDLER(aarch64_mask_interrupts_command)
aarch64->isrmasking_mode = n->value; aarch64->isrmasking_mode = n->value;
} }
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, aarch64->isrmasking_mode); n = jim_nvp_value2name_simple(nvp_maskisr_modes, aarch64->isrmasking_mode);
command_print(CMD, "aarch64 interrupt mask %s", n->name); command_print(CMD, "aarch64 interrupt mask %s", n->name);
return ERROR_OK; return ERROR_OK;

View File

@ -22,10 +22,10 @@
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
static int arc_cmd_jim_get_uint32(Jim_GetOptInfo *goi, uint32_t *value) static int arc_cmd_jim_get_uint32(struct jim_getopt_info *goi, uint32_t *value)
{ {
jim_wide value_wide; jim_wide value_wide;
JIM_CHECK_RETVAL(Jim_GetOpt_Wide(goi, &value_wide)); JIM_CHECK_RETVAL(jim_getopt_wide(goi, &value_wide));
*value = (uint32_t)value_wide; *value = (uint32_t)value_wide;
return JIM_OK; return JIM_OK;
} }
@ -40,7 +40,7 @@ enum add_reg_type_flags {
CFG_ADD_REG_TYPE_FLAGS_FLAG, CFG_ADD_REG_TYPE_FLAGS_FLAG,
}; };
static Jim_Nvp nvp_add_reg_type_flags_opts[] = { static struct jim_nvp nvp_add_reg_type_flags_opts[] = {
{ .name = "-name", .value = CFG_ADD_REG_TYPE_FLAGS_NAME }, { .name = "-name", .value = CFG_ADD_REG_TYPE_FLAGS_NAME },
{ .name = "-flag", .value = CFG_ADD_REG_TYPE_FLAGS_FLAG }, { .name = "-flag", .value = CFG_ADD_REG_TYPE_FLAGS_FLAG },
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
@ -64,7 +64,7 @@ static const char *validate_register(const struct arc_reg_desc * const reg, bool
/* Helper function to read the name of register type or register from /* Helper function to read the name of register type or register from
* configure files */ * configure files */
static int jim_arc_read_reg_name_field(Jim_GetOptInfo *goi, static int jim_arc_read_reg_name_field(struct jim_getopt_info *goi,
const char **name, int *name_len) const char **name, int *name_len)
{ {
int e = JIM_OK; int e = JIM_OK;
@ -73,12 +73,12 @@ static int jim_arc_read_reg_name_field(Jim_GetOptInfo *goi,
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-name <name> ..."); Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-name <name> ...");
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_String(goi, name, name_len); e = jim_getopt_string(goi, name, name_len);
return e; return e;
} }
/* Helper function to read bitfields/flags of register type. */ /* Helper function to read bitfields/flags of register type. */
static int jim_arc_read_reg_type_field(Jim_GetOptInfo *goi, const char **field_name, int *field_name_len, static int jim_arc_read_reg_type_field(struct jim_getopt_info *goi, const char **field_name, int *field_name_len,
struct arc_reg_bitfield *bitfields, int cur_field, int type) struct arc_reg_bitfield *bitfields, int cur_field, int type)
{ {
jim_wide start_pos, end_pos; jim_wide start_pos, end_pos;
@ -90,12 +90,12 @@ static int jim_arc_read_reg_type_field(Jim_GetOptInfo *goi, const char **field_n
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_String(goi, field_name, field_name_len); e = jim_getopt_string(goi, field_name, field_name_len);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
/* read start position of bitfield/flag */ /* read start position of bitfield/flag */
e = Jim_GetOpt_Wide(goi, &start_pos); e = jim_getopt_wide(goi, &start_pos);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -108,7 +108,7 @@ static int jim_arc_read_reg_type_field(Jim_GetOptInfo *goi, const char **field_n
* than bitfields[cur_field].end remains start */ * than bitfields[cur_field].end remains start */
if ((strcmp(Jim_String(goi->argv[0]), "-flag") && type == CFG_ADD_REG_TYPE_FLAG) if ((strcmp(Jim_String(goi->argv[0]), "-flag") && type == CFG_ADD_REG_TYPE_FLAG)
|| (type == CFG_ADD_REG_TYPE_STRUCT)) { || (type == CFG_ADD_REG_TYPE_STRUCT)) {
e = Jim_GetOpt_Wide(goi, &end_pos); e = jim_getopt_wide(goi, &end_pos);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, "Error reading end position"); Jim_SetResultFormatted(goi->interp, "Error reading end position");
return e; return e;
@ -125,8 +125,8 @@ static int jim_arc_read_reg_type_field(Jim_GetOptInfo *goi, const char **field_n
static int jim_arc_add_reg_type_flags(Jim_Interp *interp, int argc, static int jim_arc_add_reg_type_flags(Jim_Interp *interp, int argc,
Jim_Obj * const *argv) Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
LOG_DEBUG("-"); LOG_DEBUG("-");
@ -179,10 +179,10 @@ static int jim_arc_add_reg_type_flags(Jim_Interp *interp, int argc,
flags->size = 4; /* For now ARC has only 32-bit registers */ flags->size = 4; /* For now ARC has only 32-bit registers */
while (goi.argc > 0 && e == JIM_OK) { while (goi.argc > 0 && e == JIM_OK) {
Jim_Nvp *n; struct jim_nvp *n;
e = Jim_GetOpt_Nvp(&goi, nvp_add_reg_type_flags_opts, &n); e = jim_getopt_nvp(&goi, nvp_add_reg_type_flags_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, nvp_add_reg_type_flags_opts, 0); jim_getopt_nvp_unknown(&goi, nvp_add_reg_type_flags_opts, 0);
continue; continue;
} }
@ -272,7 +272,7 @@ enum add_reg_type_struct {
CFG_ADD_REG_TYPE_STRUCT_BITFIELD, CFG_ADD_REG_TYPE_STRUCT_BITFIELD,
}; };
static Jim_Nvp nvp_add_reg_type_struct_opts[] = { static struct jim_nvp nvp_add_reg_type_struct_opts[] = {
{ .name = "-name", .value = CFG_ADD_REG_TYPE_STRUCT_NAME }, { .name = "-name", .value = CFG_ADD_REG_TYPE_STRUCT_NAME },
{ .name = "-bitfield", .value = CFG_ADD_REG_TYPE_STRUCT_BITFIELD }, { .name = "-bitfield", .value = CFG_ADD_REG_TYPE_STRUCT_BITFIELD },
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
@ -286,8 +286,8 @@ static int jim_arc_set_aux_reg(Jim_Interp *interp, int argc, Jim_Obj * const *ar
uint32_t regnum; uint32_t regnum;
uint32_t value; uint32_t value;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
if (goi.argc != 2) { if (goi.argc != 2) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -325,8 +325,8 @@ static int jim_arc_get_aux_reg(Jim_Interp *interp, int argc, Jim_Obj * const *ar
uint32_t regnum; uint32_t regnum;
uint32_t value; uint32_t value;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
if (goi.argc != 1) { if (goi.argc != 1) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -362,8 +362,8 @@ static int jim_arc_get_core_reg(Jim_Interp *interp, int argc, Jim_Obj * const *a
uint32_t regnum; uint32_t regnum;
uint32_t value; uint32_t value;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
if (goi.argc != 1) { if (goi.argc != 1) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -405,8 +405,8 @@ static int jim_arc_set_core_reg(Jim_Interp *interp, int argc, Jim_Obj * const *a
uint32_t regnum; uint32_t regnum;
uint32_t value; uint32_t value;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
if (goi.argc != 2) { if (goi.argc != 2) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -491,8 +491,8 @@ static const struct command_registration arc_jtag_command_group[] = {
static int jim_arc_add_reg_type_struct(Jim_Interp *interp, int argc, static int jim_arc_add_reg_type_struct(Jim_Interp *interp, int argc,
Jim_Obj * const *argv) Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
LOG_DEBUG("-"); LOG_DEBUG("-");
@ -545,10 +545,10 @@ static int jim_arc_add_reg_type_struct(Jim_Interp *interp, int argc,
struct_type->size = 4; /* For now ARC has only 32-bit registers */ struct_type->size = 4; /* For now ARC has only 32-bit registers */
while (goi.argc > 0 && e == JIM_OK) { while (goi.argc > 0 && e == JIM_OK) {
Jim_Nvp *n; struct jim_nvp *n;
e = Jim_GetOpt_Nvp(&goi, nvp_add_reg_type_struct_opts, &n); e = jim_getopt_nvp(&goi, nvp_add_reg_type_struct_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, nvp_add_reg_type_struct_opts, 0); jim_getopt_nvp_unknown(&goi, nvp_add_reg_type_struct_opts, 0);
continue; continue;
} }
@ -642,7 +642,7 @@ enum opts_add_reg {
CFG_ADD_REG_GENERAL, CFG_ADD_REG_GENERAL,
}; };
static Jim_Nvp opts_nvp_add_reg[] = { static struct jim_nvp opts_nvp_add_reg[] = {
{ .name = "-name", .value = CFG_ADD_REG_NAME }, { .name = "-name", .value = CFG_ADD_REG_NAME },
{ .name = "-num", .value = CFG_ADD_REG_ARCH_NUM }, { .name = "-num", .value = CFG_ADD_REG_ARCH_NUM },
{ .name = "-core", .value = CFG_ADD_REG_IS_CORE }, { .name = "-core", .value = CFG_ADD_REG_IS_CORE },
@ -662,8 +662,8 @@ void free_reg_desc(struct arc_reg_desc *r)
static int jim_arc_add_reg(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_arc_add_reg(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
struct arc_reg_desc *reg = calloc(1, sizeof(*reg)); struct arc_reg_desc *reg = calloc(1, sizeof(*reg));
if (!reg) { if (!reg) {
@ -692,10 +692,10 @@ static int jim_arc_add_reg(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
/* Parse options. */ /* Parse options. */
while (goi.argc > 0) { while (goi.argc > 0) {
Jim_Nvp *n; struct jim_nvp *n;
e = Jim_GetOpt_Nvp(&goi, opts_nvp_add_reg, &n); e = jim_getopt_nvp(&goi, opts_nvp_add_reg, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, opts_nvp_add_reg, 0); jim_getopt_nvp_unknown(&goi, opts_nvp_add_reg, 0);
free_reg_desc(reg); free_reg_desc(reg);
return e; return e;
} }
@ -732,7 +732,7 @@ static int jim_arc_add_reg(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(&goi, &archnum); e = jim_getopt_wide(&goi, &archnum);
if (e != JIM_OK) { if (e != JIM_OK) {
free_reg_desc(reg); free_reg_desc(reg);
return e; return e;
@ -845,12 +845,12 @@ COMMAND_HANDLER(arc_set_reg_exists)
* Reads struct type register field */ * Reads struct type register field */
static int jim_arc_get_reg_field(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_arc_get_reg_field(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
const char *reg_name, *field_name; const char *reg_name, *field_name;
uint32_t value; uint32_t value;
int retval; int retval;
JIM_CHECK_RETVAL(Jim_GetOpt_Setup(&goi, interp, argc-1, argv+1)); JIM_CHECK_RETVAL(jim_getopt_setup(&goi, interp, argc-1, argv+1));
LOG_DEBUG("Reading register field"); LOG_DEBUG("Reading register field");
if (goi.argc != 2) { if (goi.argc != 2) {
@ -863,8 +863,8 @@ static int jim_arc_get_reg_field(Jim_Interp *interp, int argc, Jim_Obj * const *
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
JIM_CHECK_RETVAL(Jim_GetOpt_String(&goi, &reg_name, NULL)); JIM_CHECK_RETVAL(jim_getopt_string(&goi, &reg_name, NULL));
JIM_CHECK_RETVAL(Jim_GetOpt_String(&goi, &field_name, NULL)); JIM_CHECK_RETVAL(jim_getopt_string(&goi, &field_name, NULL));
assert(reg_name); assert(reg_name);
assert(field_name); assert(field_name);
@ -932,8 +932,8 @@ COMMAND_HANDLER(arc_l2_cache_disable_auto_cmd)
static int jim_handle_actionpoints_num(Jim_Interp *interp, int argc, static int jim_handle_actionpoints_num(Jim_Interp *interp, int argc,
Jim_Obj * const *argv) Jim_Obj * const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
LOG_DEBUG("-"); LOG_DEBUG("-");

View File

@ -1500,7 +1500,7 @@ enum adiv5_cfg_param {
CFG_CTIBASE, /* DEPRECATED */ CFG_CTIBASE, /* DEPRECATED */
}; };
static const Jim_Nvp nvp_config_opts[] = { static const struct jim_nvp nvp_config_opts[] = {
{ .name = "-dap", .value = CFG_DAP }, { .name = "-dap", .value = CFG_DAP },
{ .name = "-ap-num", .value = CFG_AP_NUM }, { .name = "-ap-num", .value = CFG_AP_NUM },
{ .name = "-baseaddr", .value = CFG_BASEADDR }, { .name = "-baseaddr", .value = CFG_BASEADDR },
@ -1508,7 +1508,7 @@ static const Jim_Nvp nvp_config_opts[] = {
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi, static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
struct adiv5_dap **dap_p, int *ap_num_p, uint32_t *base_p) struct adiv5_dap **dap_p, int *ap_num_p, uint32_t *base_p)
{ {
if (!goi->argc) if (!goi->argc)
@ -1516,8 +1516,8 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
Jim_SetEmptyResult(goi->interp); Jim_SetEmptyResult(goi->interp);
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_Nvp_name2value_obj(goi->interp, nvp_config_opts, int e = jim_nvp_name2value_obj(goi->interp, nvp_config_opts,
goi->argv[0], &n); goi->argv[0], &n);
if (e != JIM_OK) if (e != JIM_OK)
return JIM_CONTINUE; return JIM_CONTINUE;
@ -1526,7 +1526,7 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
if (!base_p && (n->value == CFG_BASEADDR || n->value == CFG_CTIBASE)) if (!base_p && (n->value == CFG_BASEADDR || n->value == CFG_CTIBASE))
return JIM_CONTINUE; return JIM_CONTINUE;
e = Jim_GetOpt_Obj(goi, NULL); e = jim_getopt_obj(goi, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -1535,7 +1535,7 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
if (goi->isconfigure) { if (goi->isconfigure) {
Jim_Obj *o_t; Jim_Obj *o_t;
struct adiv5_dap *dap; struct adiv5_dap *dap;
e = Jim_GetOpt_Obj(goi, &o_t); e = jim_getopt_obj(goi, &o_t);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
dap = dap_instance_by_jim_obj(goi->interp, o_t); dap = dap_instance_by_jim_obj(goi->interp, o_t);
@ -1563,7 +1563,7 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
case CFG_AP_NUM: case CFG_AP_NUM:
if (goi->isconfigure) { if (goi->isconfigure) {
jim_wide ap_num; jim_wide ap_num;
e = Jim_GetOpt_Wide(goi, &ap_num); e = jim_getopt_wide(goi, &ap_num);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
if (ap_num < 0 || ap_num > DP_APSEL_MAX) { if (ap_num < 0 || ap_num > DP_APSEL_MAX) {
@ -1588,7 +1588,7 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
case CFG_BASEADDR: case CFG_BASEADDR:
if (goi->isconfigure) { if (goi->isconfigure) {
jim_wide base; jim_wide base;
e = Jim_GetOpt_Wide(goi, &base); e = jim_getopt_wide(goi, &base);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
*base_p = (uint32_t)base; *base_p = (uint32_t)base;
@ -1607,7 +1607,7 @@ err_no_param:
return JIM_ERR; return JIM_ERR;
} }
int adiv5_jim_configure(struct target *target, Jim_GetOptInfo *goi) int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi)
{ {
struct adiv5_private_config *pc; struct adiv5_private_config *pc;
int e; int e;
@ -1651,7 +1651,7 @@ int adiv5_verify_config(struct adiv5_private_config *pc)
} }
int adiv5_jim_mem_ap_spot_configure(struct adiv5_mem_ap_spot *cfg, int adiv5_jim_mem_ap_spot_configure(struct adiv5_mem_ap_spot *cfg,
Jim_GetOptInfo *goi) struct jim_getopt_info *goi)
{ {
return adiv5_jim_spot_configure(goi, &cfg->dap, &cfg->ap_num, &cfg->base); return adiv5_jim_spot_configure(goi, &cfg->dap, &cfg->ap_num, &cfg->base);
} }

View File

@ -602,7 +602,7 @@ struct adiv5_private_config {
}; };
extern int adiv5_verify_config(struct adiv5_private_config *pc); extern int adiv5_verify_config(struct adiv5_private_config *pc);
extern int adiv5_jim_configure(struct target *target, Jim_GetOptInfo *goi); extern int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi);
struct adiv5_mem_ap_spot { struct adiv5_mem_ap_spot {
struct adiv5_dap *dap; struct adiv5_dap *dap;
@ -612,6 +612,6 @@ struct adiv5_mem_ap_spot {
extern int adiv5_mem_ap_spot_init(struct adiv5_mem_ap_spot *p); extern int adiv5_mem_ap_spot_init(struct adiv5_mem_ap_spot *p);
extern int adiv5_jim_mem_ap_spot_configure(struct adiv5_mem_ap_spot *cfg, extern int adiv5_jim_mem_ap_spot_configure(struct adiv5_mem_ap_spot *cfg,
Jim_GetOptInfo *goi); struct jim_getopt_info *goi);
#endif /* OPENOCD_TARGET_ARM_ADI_V5_H */ #endif /* OPENOCD_TARGET_ARM_ADI_V5_H */

View File

@ -430,7 +430,7 @@ static const struct command_registration cti_instance_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
static int cti_configure(Jim_GetOptInfo *goi, struct arm_cti *cti) static int cti_configure(struct jim_getopt_info *goi, struct arm_cti *cti)
{ {
/* parse config or cget options ... */ /* parse config or cget options ... */
while (goi->argc > 0) { while (goi->argc > 0) {
@ -446,7 +446,7 @@ static int cti_configure(Jim_GetOptInfo *goi, struct arm_cti *cti)
return JIM_OK; return JIM_OK;
} }
static int cti_create(Jim_GetOptInfo *goi) static int cti_create(struct jim_getopt_info *goi)
{ {
struct command_context *cmd_ctx; struct command_context *cmd_ctx;
static struct arm_cti *cti; static struct arm_cti *cti;
@ -463,7 +463,7 @@ static int cti_create(Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
/* COMMAND */ /* COMMAND */
Jim_GetOpt_Obj(goi, &new_cmd); jim_getopt_obj(goi, &new_cmd);
/* does this command exist? */ /* does this command exist? */
cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG); cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
if (cmd) { if (cmd) {
@ -518,8 +518,8 @@ static int cti_create(Jim_GetOptInfo *goi)
static int jim_cti_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_cti_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 2) { if (goi.argc < 2) {
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
"<name> [<cti_options> ...]"); "<name> [<cti_options> ...]");

View File

@ -156,31 +156,31 @@ enum dap_cfg_param {
CFG_IGNORE_SYSPWRUPACK, CFG_IGNORE_SYSPWRUPACK,
}; };
static const Jim_Nvp nvp_config_opts[] = { static const struct jim_nvp nvp_config_opts[] = {
{ .name = "-chain-position", .value = CFG_CHAIN_POSITION }, { .name = "-chain-position", .value = CFG_CHAIN_POSITION },
{ .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK }, { .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static int dap_configure(Jim_GetOptInfo *goi, struct arm_dap_object *dap) static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap)
{ {
struct jtag_tap *tap = NULL; struct jtag_tap *tap = NULL;
Jim_Nvp *n; struct jim_nvp *n;
int e; int e;
/* parse config or cget options ... */ /* parse config or cget options ... */
while (goi->argc > 0) { while (goi->argc > 0) {
Jim_SetEmptyResult(goi->interp); Jim_SetEmptyResult(goi->interp);
e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); e = jim_getopt_nvp(goi, nvp_config_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
return e; return e;
} }
switch (n->value) { switch (n->value) {
case CFG_CHAIN_POSITION: { case CFG_CHAIN_POSITION: {
Jim_Obj *o_t; Jim_Obj *o_t;
e = Jim_GetOpt_Obj(goi, &o_t); e = jim_getopt_obj(goi, &o_t);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
tap = jtag_tap_by_jim_obj(goi->interp, o_t); tap = jtag_tap_by_jim_obj(goi->interp, o_t);
@ -210,7 +210,7 @@ static int dap_configure(Jim_GetOptInfo *goi, struct arm_dap_object *dap)
return JIM_OK; return JIM_OK;
} }
static int dap_create(Jim_GetOptInfo *goi) static int dap_create(struct jim_getopt_info *goi)
{ {
struct command_context *cmd_ctx; struct command_context *cmd_ctx;
static struct arm_dap_object *dap; static struct arm_dap_object *dap;
@ -227,7 +227,7 @@ static int dap_create(Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
/* COMMAND */ /* COMMAND */
Jim_GetOpt_Obj(goi, &new_cmd); jim_getopt_obj(goi, &new_cmd);
/* does this command exist? */ /* does this command exist? */
cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG); cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
if (cmd) { if (cmd) {
@ -276,8 +276,8 @@ static int dap_create(Jim_GetOptInfo *goi)
static int jim_dap_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_dap_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 2) { if (goi.argc < 2) {
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
"<name> [<dap_options> ...]"); "<name> [<dap_options> ...]");

View File

@ -73,7 +73,7 @@ enum arm_tpiu_swo_event {
TPIU_SWO_EVENT_POST_DISABLE, TPIU_SWO_EVENT_POST_DISABLE,
}; };
static const Jim_Nvp nvp_arm_tpiu_swo_event[] = { static const struct jim_nvp nvp_arm_tpiu_swo_event[] = {
{ .value = TPIU_SWO_EVENT_PRE_ENABLE, .name = "pre-enable" }, { .value = TPIU_SWO_EVENT_PRE_ENABLE, .name = "pre-enable" },
{ .value = TPIU_SWO_EVENT_POST_ENABLE, .name = "post-enable" }, { .value = TPIU_SWO_EVENT_POST_ENABLE, .name = "post-enable" },
{ .value = TPIU_SWO_EVENT_PRE_DISABLE, .name = "pre-disable" }, { .value = TPIU_SWO_EVENT_PRE_DISABLE, .name = "pre-disable" },
@ -168,7 +168,7 @@ static void arm_tpiu_swo_handle_event(struct arm_tpiu_swo_object *obj, enum arm_
LOG_DEBUG("TPIU/SWO: %s event: %s (%d) action : %s", LOG_DEBUG("TPIU/SWO: %s event: %s (%d) action : %s",
obj->name, obj->name,
Jim_Nvp_value2name_simple(nvp_arm_tpiu_swo_event, event)->name, jim_nvp_value2name_simple(nvp_arm_tpiu_swo_event, event)->name,
event, event,
Jim_GetString(ea->body, NULL)); Jim_GetString(ea->body, NULL));
@ -185,7 +185,7 @@ static void arm_tpiu_swo_handle_event(struct arm_tpiu_swo_object *obj, enum arm_
Jim_MakeErrorMessage(ea->interp); Jim_MakeErrorMessage(ea->interp);
LOG_USER("Error executing event %s on TPIU/SWO %s:\n%s", LOG_USER("Error executing event %s on TPIU/SWO %s:\n%s",
Jim_Nvp_value2name_simple(nvp_arm_tpiu_swo_event, event)->name, jim_nvp_value2name_simple(nvp_arm_tpiu_swo_event, event)->name,
obj->name, obj->name,
Jim_GetString(Jim_GetResult(ea->interp), NULL)); Jim_GetString(Jim_GetResult(ea->interp), NULL));
/* clean both error code and stacktrace before return */ /* clean both error code and stacktrace before return */
@ -297,7 +297,7 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_event_list)
"----------------------------------------"); "----------------------------------------");
for (struct arm_tpiu_swo_event_action *ea = obj->event_action; ea; ea = ea->next) { for (struct arm_tpiu_swo_event_action *ea = obj->event_action; ea; ea = ea->next) {
Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_arm_tpiu_swo_event, ea->event); struct jim_nvp *opt = jim_nvp_value2name_simple(nvp_arm_tpiu_swo_event, ea->event);
command_print(CMD, "%-25s | %s", command_print(CMD, "%-25s | %s",
opt->name, Jim_GetString(ea->body, NULL)); opt->name, Jim_GetString(ea->body, NULL));
} }
@ -315,7 +315,7 @@ enum arm_tpiu_swo_cfg_param {
CFG_EVENT, CFG_EVENT,
}; };
static const Jim_Nvp nvp_arm_tpiu_swo_config_opts[] = { static const struct jim_nvp nvp_arm_tpiu_swo_config_opts[] = {
{ .name = "-port-width", .value = CFG_PORT_WIDTH }, { .name = "-port-width", .value = CFG_PORT_WIDTH },
{ .name = "-protocol", .value = CFG_PROTOCOL }, { .name = "-protocol", .value = CFG_PROTOCOL },
{ .name = "-formatter", .value = CFG_FORMATTER }, { .name = "-formatter", .value = CFG_FORMATTER },
@ -323,21 +323,21 @@ static const Jim_Nvp nvp_arm_tpiu_swo_config_opts[] = {
{ .name = "-pin-freq", .value = CFG_BITRATE }, { .name = "-pin-freq", .value = CFG_BITRATE },
{ .name = "-output", .value = CFG_OUTFILE }, { .name = "-output", .value = CFG_OUTFILE },
{ .name = "-event", .value = CFG_EVENT }, { .name = "-event", .value = CFG_EVENT },
/* handled by mem_ap_spot, added for Jim_GetOpt_NvpUnknown() */ /* handled by mem_ap_spot, added for jim_getopt_nvp_unknown() */
{ .name = "-dap", .value = -1 }, { .name = "-dap", .value = -1 },
{ .name = "-ap-num", .value = -1 }, { .name = "-ap-num", .value = -1 },
{ .name = "-baseaddr", .value = -1 }, { .name = "-baseaddr", .value = -1 },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static const Jim_Nvp nvp_arm_tpiu_swo_protocol_opts[] = { static const struct jim_nvp nvp_arm_tpiu_swo_protocol_opts[] = {
{ .name = "sync", .value = TPIU_SPPR_PROTOCOL_SYNC }, { .name = "sync", .value = TPIU_SPPR_PROTOCOL_SYNC },
{ .name = "uart", .value = TPIU_SPPR_PROTOCOL_UART }, { .name = "uart", .value = TPIU_SPPR_PROTOCOL_UART },
{ .name = "manchester", .value = TPIU_SPPR_PROTOCOL_MANCHESTER }, { .name = "manchester", .value = TPIU_SPPR_PROTOCOL_MANCHESTER },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static const Jim_Nvp nvp_arm_tpiu_swo_bool_opts[] = { static const struct jim_nvp nvp_arm_tpiu_swo_bool_opts[] = {
{ .name = "on", .value = 1 }, { .name = "on", .value = 1 },
{ .name = "yes", .value = 1 }, { .name = "yes", .value = 1 },
{ .name = "1", .value = 1 }, { .name = "1", .value = 1 },
@ -349,7 +349,7 @@ static const Jim_Nvp nvp_arm_tpiu_swo_bool_opts[] = {
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_object *obj) static int arm_tpiu_swo_configure(struct jim_getopt_info *goi, struct arm_tpiu_swo_object *obj)
{ {
assert(obj != NULL); assert(obj != NULL);
@ -368,10 +368,10 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
if (e == JIM_ERR) if (e == JIM_ERR)
return e; return e;
Jim_Nvp *n; struct jim_nvp *n;
e = Jim_GetOpt_Nvp(goi, nvp_arm_tpiu_swo_config_opts, &n); e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_config_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_arm_tpiu_swo_config_opts, 0); jim_getopt_nvp_unknown(goi, nvp_arm_tpiu_swo_config_opts, 0);
return e; return e;
} }
@ -379,7 +379,7 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
case CFG_PORT_WIDTH: case CFG_PORT_WIDTH:
if (goi->isconfigure) { if (goi->isconfigure) {
jim_wide port_width; jim_wide port_width;
e = Jim_GetOpt_Wide(goi, &port_width); e = jim_getopt_wide(goi, &port_width);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
if (port_width < 1 || port_width > 32) { if (port_width < 1 || port_width > 32) {
@ -395,16 +395,16 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
break; break;
case CFG_PROTOCOL: case CFG_PROTOCOL:
if (goi->isconfigure) { if (goi->isconfigure) {
Jim_Nvp *p; struct jim_nvp *p;
e = Jim_GetOpt_Nvp(goi, nvp_arm_tpiu_swo_protocol_opts, &p); e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_protocol_opts, &p);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
obj->pin_protocol = p->value; obj->pin_protocol = p->value;
} else { } else {
if (goi->argc) if (goi->argc)
goto err_no_params; goto err_no_params;
Jim_Nvp *p; struct jim_nvp *p;
e = Jim_Nvp_value2name(goi->interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p); e = jim_nvp_value2name(goi->interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultString(goi->interp, "protocol error", -1); Jim_SetResultString(goi->interp, "protocol error", -1);
return JIM_ERR; return JIM_ERR;
@ -414,16 +414,16 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
break; break;
case CFG_FORMATTER: case CFG_FORMATTER:
if (goi->isconfigure) { if (goi->isconfigure) {
Jim_Nvp *p; struct jim_nvp *p;
e = Jim_GetOpt_Nvp(goi, nvp_arm_tpiu_swo_bool_opts, &p); e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_bool_opts, &p);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
obj->en_formatter = p->value; obj->en_formatter = p->value;
} else { } else {
if (goi->argc) if (goi->argc)
goto err_no_params; goto err_no_params;
Jim_Nvp *p; struct jim_nvp *p;
e = Jim_Nvp_value2name(goi->interp, nvp_arm_tpiu_swo_bool_opts, obj->en_formatter, &p); e = jim_nvp_value2name(goi->interp, nvp_arm_tpiu_swo_bool_opts, obj->en_formatter, &p);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_SetResultString(goi->interp, "formatter error", -1); Jim_SetResultString(goi->interp, "formatter error", -1);
return JIM_ERR; return JIM_ERR;
@ -434,7 +434,7 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
case CFG_TRACECLKIN: case CFG_TRACECLKIN:
if (goi->isconfigure) { if (goi->isconfigure) {
jim_wide clk; jim_wide clk;
e = Jim_GetOpt_Wide(goi, &clk); e = jim_getopt_wide(goi, &clk);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
obj->traceclkin_freq = clk; obj->traceclkin_freq = clk;
@ -447,7 +447,7 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
case CFG_BITRATE: case CFG_BITRATE:
if (goi->isconfigure) { if (goi->isconfigure) {
jim_wide clk; jim_wide clk;
e = Jim_GetOpt_Wide(goi, &clk); e = jim_getopt_wide(goi, &clk);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
obj->swo_pin_freq = clk; obj->swo_pin_freq = clk;
@ -460,7 +460,7 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
case CFG_OUTFILE: case CFG_OUTFILE:
if (goi->isconfigure) { if (goi->isconfigure) {
const char *s; const char *s;
e = Jim_GetOpt_String(goi, &s, NULL); e = jim_getopt_string(goi, &s, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
if (s[0] == ':') { if (s[0] == ':') {
@ -498,13 +498,13 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
} }
{ {
Jim_Nvp *p; struct jim_nvp *p;
Jim_Obj *o; Jim_Obj *o;
struct arm_tpiu_swo_event_action *ea = obj->event_action; struct arm_tpiu_swo_event_action *ea = obj->event_action;
e = Jim_GetOpt_Nvp(goi, nvp_arm_tpiu_swo_event, &p); e = jim_getopt_nvp(goi, nvp_arm_tpiu_swo_event, &p);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_arm_tpiu_swo_event, 1); jim_getopt_nvp_unknown(goi, nvp_arm_tpiu_swo_event, 1);
return e; return e;
} }
@ -529,7 +529,7 @@ static int arm_tpiu_swo_configure(Jim_GetOptInfo *goi, struct arm_tpiu_swo_objec
Jim_DecrRefCount(ea->interp, ea->body); Jim_DecrRefCount(ea->interp, ea->body);
ea->event = p->value; ea->event = p->value;
ea->interp = goi->interp; ea->interp = goi->interp;
Jim_GetOpt_Obj(goi, &o); jim_getopt_obj(goi, &o);
ea->body = Jim_DuplicateObj(goi->interp, o); ea->body = Jim_DuplicateObj(goi->interp, o);
Jim_IncrRefCount(ea->body); Jim_IncrRefCount(ea->body);
} else { } else {
@ -551,9 +551,9 @@ err_no_params:
static int jim_arm_tpiu_swo_configure(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_arm_tpiu_swo_configure(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
struct command *c = jim_to_command(interp); struct command *c = jim_to_command(interp);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
goi.isconfigure = !strcmp(c->name, "configure"); goi.isconfigure = !strcmp(c->name, "configure");
if (goi.argc < 1) { if (goi.argc < 1) {
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
@ -670,8 +670,8 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
value = 0; value = 0;
} }
if (!value) { if (!value) {
Jim_Nvp *p; struct jim_nvp *p;
Jim_Nvp_value2name(interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p); jim_nvp_value2name(interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p);
LOG_ERROR("%s does not support protocol %s", obj->name, p->name); LOG_ERROR("%s does not support protocol %s", obj->name, p->name);
return JIM_ERR; return JIM_ERR;
} }
@ -897,8 +897,8 @@ static int arm_tpiu_swo_create(Jim_Interp *interp, struct arm_tpiu_swo_object *o
static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 1) { if (goi.argc < 1) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv, "?name? ..options..."); Jim_WrongNumArgs(goi.interp, 1, goi.argv, "?name? ..options...");
return JIM_ERR; return JIM_ERR;
@ -915,7 +915,7 @@ static int jim_arm_tpiu_swo_create(Jim_Interp *interp, int argc, Jim_Obj *const
obj->port_width = 1; obj->port_width = 1;
Jim_Obj *n; Jim_Obj *n;
Jim_GetOpt_Obj(&goi, &n); jim_getopt_obj(&goi, &n);
obj->name = strdup(Jim_GetString(n, NULL)); obj->name = strdup(Jim_GetString(n, NULL));
if (!obj->name) { if (!obj->name) {
LOG_ERROR("Out of memory"); LOG_ERROR("Out of memory");

View File

@ -1025,7 +1025,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
unsigned int argp = 0; unsigned int argp = 0;
int retval; int retval;
static const Jim_Nvp nvp_ecatch_modes[] = { static const struct jim_nvp nvp_ecatch_modes[] = {
{ .name = "off", .value = 0 }, { .name = "off", .value = 0 },
{ .name = "nsec_el1", .value = (1 << 5) }, { .name = "nsec_el1", .value = (1 << 5) },
{ .name = "nsec_el2", .value = (2 << 5) }, { .name = "nsec_el2", .value = (2 << 5) },
@ -1035,7 +1035,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
{ .name = "sec_el13", .value = (5 << 1) }, { .name = "sec_el13", .value = (5 << 1) },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
const Jim_Nvp *n; const struct jim_nvp *n;
if (CMD_ARGC == 0) { if (CMD_ARGC == 0) {
const char *sec = NULL, *nsec = NULL; const char *sec = NULL, *nsec = NULL;
@ -1045,11 +1045,11 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
n = Jim_Nvp_value2name_simple(nvp_ecatch_modes, edeccr & 0x0f); n = jim_nvp_value2name_simple(nvp_ecatch_modes, edeccr & 0x0f);
if (n->name != NULL) if (n->name != NULL)
sec = n->name; sec = n->name;
n = Jim_Nvp_value2name_simple(nvp_ecatch_modes, edeccr & 0xf0); n = jim_nvp_value2name_simple(nvp_ecatch_modes, edeccr & 0xf0);
if (n->name != NULL) if (n->name != NULL)
nsec = n->name; nsec = n->name;
@ -1063,7 +1063,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
} }
while (CMD_ARGC > argp) { while (CMD_ARGC > argp) {
n = Jim_Nvp_name2value_simple(nvp_ecatch_modes, CMD_ARGV[argp]); n = jim_nvp_name2value_simple(nvp_ecatch_modes, CMD_ARGV[argp]);
if (n->name == NULL) { if (n->name == NULL) {
LOG_ERROR("Unknown option: %s", CMD_ARGV[argp]); LOG_ERROR("Unknown option: %s", CMD_ARGV[argp]);
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -3259,15 +3259,15 @@ COMMAND_HANDLER(handle_cortex_a_mask_interrupts_command)
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
struct cortex_a_common *cortex_a = target_to_cortex_a(target); struct cortex_a_common *cortex_a = target_to_cortex_a(target);
static const Jim_Nvp nvp_maskisr_modes[] = { static const struct jim_nvp nvp_maskisr_modes[] = {
{ .name = "off", .value = CORTEX_A_ISRMASK_OFF }, { .name = "off", .value = CORTEX_A_ISRMASK_OFF },
{ .name = "on", .value = CORTEX_A_ISRMASK_ON }, { .name = "on", .value = CORTEX_A_ISRMASK_ON },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
const Jim_Nvp *n; const struct jim_nvp *n;
if (CMD_ARGC > 0) { if (CMD_ARGC > 0) {
n = Jim_Nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]);
if (n->name == NULL) { if (n->name == NULL) {
LOG_ERROR("Unknown parameter: %s - should be off or on", CMD_ARGV[0]); LOG_ERROR("Unknown parameter: %s - should be off or on", CMD_ARGV[0]);
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -3276,7 +3276,7 @@ COMMAND_HANDLER(handle_cortex_a_mask_interrupts_command)
cortex_a->isrmasking_mode = n->value; cortex_a->isrmasking_mode = n->value;
} }
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_a->isrmasking_mode); n = jim_nvp_value2name_simple(nvp_maskisr_modes, cortex_a->isrmasking_mode);
command_print(CMD, "cortex_a interrupt mask %s", n->name); command_print(CMD, "cortex_a interrupt mask %s", n->name);
return ERROR_OK; return ERROR_OK;
@ -3287,22 +3287,22 @@ COMMAND_HANDLER(handle_cortex_a_dacrfixup_command)
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
struct cortex_a_common *cortex_a = target_to_cortex_a(target); struct cortex_a_common *cortex_a = target_to_cortex_a(target);
static const Jim_Nvp nvp_dacrfixup_modes[] = { static const struct jim_nvp nvp_dacrfixup_modes[] = {
{ .name = "off", .value = CORTEX_A_DACRFIXUP_OFF }, { .name = "off", .value = CORTEX_A_DACRFIXUP_OFF },
{ .name = "on", .value = CORTEX_A_DACRFIXUP_ON }, { .name = "on", .value = CORTEX_A_DACRFIXUP_ON },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
const Jim_Nvp *n; const struct jim_nvp *n;
if (CMD_ARGC > 0) { if (CMD_ARGC > 0) {
n = Jim_Nvp_name2value_simple(nvp_dacrfixup_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_dacrfixup_modes, CMD_ARGV[0]);
if (n->name == NULL) if (n->name == NULL)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
cortex_a->dacrfixup_mode = n->value; cortex_a->dacrfixup_mode = n->value;
} }
n = Jim_Nvp_value2name_simple(nvp_dacrfixup_modes, cortex_a->dacrfixup_mode); n = jim_nvp_value2name_simple(nvp_dacrfixup_modes, cortex_a->dacrfixup_mode);
command_print(CMD, "cortex_a domain access control fixup %s", n->name); command_print(CMD, "cortex_a domain access control fixup %s", n->name);
return ERROR_OK; return ERROR_OK;

View File

@ -2398,14 +2398,14 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
struct cortex_m_common *cortex_m = target_to_cm(target); struct cortex_m_common *cortex_m = target_to_cm(target);
int retval; int retval;
static const Jim_Nvp nvp_maskisr_modes[] = { static const struct jim_nvp nvp_maskisr_modes[] = {
{ .name = "auto", .value = CORTEX_M_ISRMASK_AUTO }, { .name = "auto", .value = CORTEX_M_ISRMASK_AUTO },
{ .name = "off", .value = CORTEX_M_ISRMASK_OFF }, { .name = "off", .value = CORTEX_M_ISRMASK_OFF },
{ .name = "on", .value = CORTEX_M_ISRMASK_ON }, { .name = "on", .value = CORTEX_M_ISRMASK_ON },
{ .name = "steponly", .value = CORTEX_M_ISRMASK_STEPONLY }, { .name = "steponly", .value = CORTEX_M_ISRMASK_STEPONLY },
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
const Jim_Nvp *n; const struct jim_nvp *n;
retval = cortex_m_verify_pointer(CMD, cortex_m); retval = cortex_m_verify_pointer(CMD, cortex_m);
@ -2418,14 +2418,14 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
} }
if (CMD_ARGC > 0) { if (CMD_ARGC > 0) {
n = Jim_Nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_maskisr_modes, CMD_ARGV[0]);
if (n->name == NULL) if (n->name == NULL)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
cortex_m->isrmasking_mode = n->value; cortex_m->isrmasking_mode = n->value;
cortex_m_set_maskints_for_halt(target); cortex_m_set_maskints_for_halt(target);
} }
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_m->isrmasking_mode); n = jim_nvp_value2name_simple(nvp_maskisr_modes, cortex_m->isrmasking_mode);
command_print(CMD, "cortex_m interrupt mask %s", n->name); command_print(CMD, "cortex_m interrupt mask %s", n->name);
return ERROR_OK; return ERROR_OK;

View File

@ -681,8 +681,8 @@ static int jim_nds32_bulk_write(Jim_Interp *interp, int argc, Jim_Obj * const *a
{ {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 3) { if (goi.argc < 3) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -692,12 +692,12 @@ static int jim_nds32_bulk_write(Jim_Interp *interp, int argc, Jim_Obj * const *a
int e; int e;
jim_wide address; jim_wide address;
e = Jim_GetOpt_Wide(&goi, &address); e = jim_getopt_wide(&goi, &address);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
jim_wide count; jim_wide count;
e = Jim_GetOpt_Wide(&goi, &count); e = jim_getopt_wide(&goi, &count);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -708,7 +708,7 @@ static int jim_nds32_bulk_write(Jim_Interp *interp, int argc, Jim_Obj * const *a
jim_wide i; jim_wide i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
jim_wide tmp; jim_wide tmp;
e = Jim_GetOpt_Wide(&goi, &tmp); e = jim_getopt_wide(&goi, &tmp);
if (e != JIM_OK) { if (e != JIM_OK) {
free(data); free(data);
return e; return e;
@ -738,8 +738,8 @@ static int jim_nds32_multi_write(Jim_Interp *interp, int argc, Jim_Obj * const *
{ {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 3) { if (goi.argc < 3) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -749,7 +749,7 @@ static int jim_nds32_multi_write(Jim_Interp *interp, int argc, Jim_Obj * const *
int e; int e;
jim_wide num_of_pairs; jim_wide num_of_pairs;
e = Jim_GetOpt_Wide(&goi, &num_of_pairs); e = jim_getopt_wide(&goi, &num_of_pairs);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -765,12 +765,12 @@ static int jim_nds32_multi_write(Jim_Interp *interp, int argc, Jim_Obj * const *
aice_set_command_mode(aice, AICE_COMMAND_MODE_PACK); aice_set_command_mode(aice, AICE_COMMAND_MODE_PACK);
for (i = 0; i < num_of_pairs; i++) { for (i = 0; i < num_of_pairs; i++) {
jim_wide tmp; jim_wide tmp;
e = Jim_GetOpt_Wide(&goi, &tmp); e = jim_getopt_wide(&goi, &tmp);
if (e != JIM_OK) if (e != JIM_OK)
break; break;
address = (uint32_t)tmp; address = (uint32_t)tmp;
e = Jim_GetOpt_Wide(&goi, &tmp); e = jim_getopt_wide(&goi, &tmp);
if (e != JIM_OK) if (e != JIM_OK)
break; break;
data = (uint32_t)tmp; data = (uint32_t)tmp;
@ -792,8 +792,8 @@ static int jim_nds32_bulk_read(Jim_Interp *interp, int argc, Jim_Obj * const *ar
{ {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 2) { if (goi.argc < 2) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -803,12 +803,12 @@ static int jim_nds32_bulk_read(Jim_Interp *interp, int argc, Jim_Obj * const *ar
int e; int e;
jim_wide address; jim_wide address;
e = Jim_GetOpt_Wide(&goi, &address); e = jim_getopt_wide(&goi, &address);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
jim_wide count; jim_wide count;
e = Jim_GetOpt_Wide(&goi, &count); e = jim_getopt_wide(&goi, &count);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -840,8 +840,8 @@ static int jim_nds32_read_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const *
{ {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 1) { if (goi.argc < 1) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -852,7 +852,7 @@ static int jim_nds32_read_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const *
int e; int e;
const char *edm_sr_name; const char *edm_sr_name;
int edm_sr_name_len; int edm_sr_name_len;
e = Jim_GetOpt_String(&goi, &edm_sr_name, &edm_sr_name_len); e = jim_getopt_string(&goi, &edm_sr_name, &edm_sr_name_len);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -888,8 +888,8 @@ static int jim_nds32_write_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const
{ {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 2) { if (goi.argc < 2) {
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -900,12 +900,12 @@ static int jim_nds32_write_edm_sr(Jim_Interp *interp, int argc, Jim_Obj * const
int e; int e;
const char *edm_sr_name; const char *edm_sr_name;
int edm_sr_name_len; int edm_sr_name_len;
e = Jim_GetOpt_String(&goi, &edm_sr_name, &edm_sr_name_len); e = jim_getopt_string(&goi, &edm_sr_name, &edm_sr_name_len);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
jim_wide value; jim_wide value;
e = Jim_GetOpt_Wide(&goi, &value); e = jim_getopt_wide(&goi, &value);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;

View File

@ -1945,7 +1945,7 @@ static int stm8_run_algorithm(struct target *target, int num_mem_params,
return ERROR_OK; return ERROR_OK;
} }
static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi) static int stm8_jim_configure(struct target *target, struct jim_getopt_info *goi)
{ {
struct stm8_common *stm8 = target_to_stm8(target); struct stm8_common *stm8 = target_to_stm8(target);
jim_wide w; jim_wide w;
@ -1954,7 +1954,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
arg = Jim_GetString(goi->argv[0], NULL); arg = Jim_GetString(goi->argv[0], NULL);
if (!strcmp(arg, "-blocksize")) { if (!strcmp(arg, "-blocksize")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -1964,7 +1964,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -1973,7 +1973,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-flashstart")) { if (!strcmp(arg, "-flashstart")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -1983,7 +1983,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -1992,7 +1992,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-flashend")) { if (!strcmp(arg, "-flashend")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2002,7 +2002,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2011,7 +2011,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-eepromstart")) { if (!strcmp(arg, "-eepromstart")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2021,7 +2021,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2030,7 +2030,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-eepromend")) { if (!strcmp(arg, "-eepromend")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2040,7 +2040,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2049,7 +2049,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-optionstart")) { if (!strcmp(arg, "-optionstart")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2059,7 +2059,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2068,7 +2068,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-optionend")) { if (!strcmp(arg, "-optionend")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2078,7 +2078,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2087,7 +2087,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-enable_step_irq")) { if (!strcmp(arg, "-enable_step_irq")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -2096,7 +2096,7 @@ static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
return JIM_OK; return JIM_OK;
} }
if (!strcmp(arg, "-enable_stm8l")) { if (!strcmp(arg, "-enable_stm8l")) {
e = Jim_GetOpt_String(goi, &arg, NULL); e = jim_getopt_string(goi, &arg, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;

View File

@ -158,7 +158,7 @@ static LIST_HEAD(target_reset_callback_list);
static LIST_HEAD(target_trace_callback_list); static LIST_HEAD(target_trace_callback_list);
static const int polling_interval = 100; static const int polling_interval = 100;
static const Jim_Nvp nvp_assert[] = { static const struct jim_nvp nvp_assert[] = {
{ .name = "assert", NVP_ASSERT }, { .name = "assert", NVP_ASSERT },
{ .name = "deassert", NVP_DEASSERT }, { .name = "deassert", NVP_DEASSERT },
{ .name = "T", NVP_ASSERT }, { .name = "T", NVP_ASSERT },
@ -168,7 +168,7 @@ static const Jim_Nvp nvp_assert[] = {
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static const Jim_Nvp nvp_error_target[] = { static const struct jim_nvp nvp_error_target[] = {
{ .value = ERROR_TARGET_INVALID, .name = "err-invalid" }, { .value = ERROR_TARGET_INVALID, .name = "err-invalid" },
{ .value = ERROR_TARGET_INIT_FAILED, .name = "err-init-failed" }, { .value = ERROR_TARGET_INIT_FAILED, .name = "err-init-failed" },
{ .value = ERROR_TARGET_TIMEOUT, .name = "err-timeout" }, { .value = ERROR_TARGET_TIMEOUT, .name = "err-timeout" },
@ -185,16 +185,16 @@ static const Jim_Nvp nvp_error_target[] = {
static const char *target_strerror_safe(int err) static const char *target_strerror_safe(int err)
{ {
const Jim_Nvp *n; const struct jim_nvp *n;
n = Jim_Nvp_value2name_simple(nvp_error_target, err); n = jim_nvp_value2name_simple(nvp_error_target, err);
if (n->name == NULL) if (n->name == NULL)
return "unknown"; return "unknown";
else else
return n->name; return n->name;
} }
static const Jim_Nvp nvp_target_event[] = { static const struct jim_nvp nvp_target_event[] = {
{ .value = TARGET_EVENT_GDB_HALT, .name = "gdb-halt" }, { .value = TARGET_EVENT_GDB_HALT, .name = "gdb-halt" },
{ .value = TARGET_EVENT_HALTED, .name = "halted" }, { .value = TARGET_EVENT_HALTED, .name = "halted" },
@ -237,7 +237,7 @@ static const Jim_Nvp nvp_target_event[] = {
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static const Jim_Nvp nvp_target_state[] = { static const struct jim_nvp nvp_target_state[] = {
{ .name = "unknown", .value = TARGET_UNKNOWN }, { .name = "unknown", .value = TARGET_UNKNOWN },
{ .name = "running", .value = TARGET_RUNNING }, { .name = "running", .value = TARGET_RUNNING },
{ .name = "halted", .value = TARGET_HALTED }, { .name = "halted", .value = TARGET_HALTED },
@ -246,7 +246,7 @@ static const Jim_Nvp nvp_target_state[] = {
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static const Jim_Nvp nvp_target_debug_reason[] = { static const struct jim_nvp nvp_target_debug_reason[] = {
{ .name = "debug-request", .value = DBG_REASON_DBGRQ }, { .name = "debug-request", .value = DBG_REASON_DBGRQ },
{ .name = "breakpoint", .value = DBG_REASON_BREAKPOINT }, { .name = "breakpoint", .value = DBG_REASON_BREAKPOINT },
{ .name = "watchpoint", .value = DBG_REASON_WATCHPOINT }, { .name = "watchpoint", .value = DBG_REASON_WATCHPOINT },
@ -259,7 +259,7 @@ static const Jim_Nvp nvp_target_debug_reason[] = {
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static const Jim_Nvp nvp_target_endian[] = { static const struct jim_nvp nvp_target_endian[] = {
{ .name = "big", .value = TARGET_BIG_ENDIAN }, { .name = "big", .value = TARGET_BIG_ENDIAN },
{ .name = "little", .value = TARGET_LITTLE_ENDIAN }, { .name = "little", .value = TARGET_LITTLE_ENDIAN },
{ .name = "be", .value = TARGET_BIG_ENDIAN }, { .name = "be", .value = TARGET_BIG_ENDIAN },
@ -267,7 +267,7 @@ static const Jim_Nvp nvp_target_endian[] = {
{ .name = NULL, .value = -1 }, { .name = NULL, .value = -1 },
}; };
static const Jim_Nvp nvp_reset_modes[] = { static const struct jim_nvp nvp_reset_modes[] = {
{ .name = "unknown", .value = RESET_UNKNOWN }, { .name = "unknown", .value = RESET_UNKNOWN },
{ .name = "run", .value = RESET_RUN }, { .name = "run", .value = RESET_RUN },
{ .name = "halt", .value = RESET_HALT }, { .name = "halt", .value = RESET_HALT },
@ -279,7 +279,7 @@ const char *debug_reason_name(struct target *t)
{ {
const char *cp; const char *cp;
cp = Jim_Nvp_value2name_simple(nvp_target_debug_reason, cp = jim_nvp_value2name_simple(nvp_target_debug_reason,
t->debug_reason)->name; t->debug_reason)->name;
if (!cp) { if (!cp) {
LOG_ERROR("Invalid debug reason: %d", (int)(t->debug_reason)); LOG_ERROR("Invalid debug reason: %d", (int)(t->debug_reason));
@ -291,7 +291,7 @@ const char *debug_reason_name(struct target *t)
const char *target_state_name(struct target *t) const char *target_state_name(struct target *t)
{ {
const char *cp; const char *cp;
cp = Jim_Nvp_value2name_simple(nvp_target_state, t->state)->name; cp = jim_nvp_value2name_simple(nvp_target_state, t->state)->name;
if (!cp) { if (!cp) {
LOG_ERROR("Invalid target state: %d", (int)(t->state)); LOG_ERROR("Invalid target state: %d", (int)(t->state));
cp = "(*BUG*unknown*BUG*)"; cp = "(*BUG*unknown*BUG*)";
@ -306,7 +306,7 @@ const char *target_state_name(struct target *t)
const char *target_event_name(enum target_event event) const char *target_event_name(enum target_event event)
{ {
const char *cp; const char *cp;
cp = Jim_Nvp_value2name_simple(nvp_target_event, event)->name; cp = jim_nvp_value2name_simple(nvp_target_event, event)->name;
if (!cp) { if (!cp) {
LOG_ERROR("Invalid target event: %d", (int)(event)); LOG_ERROR("Invalid target event: %d", (int)(event));
cp = "(*BUG*unknown*BUG*)"; cp = "(*BUG*unknown*BUG*)";
@ -317,7 +317,7 @@ const char *target_event_name(enum target_event event)
const char *target_reset_mode_name(enum target_reset_mode reset_mode) const char *target_reset_mode_name(enum target_reset_mode reset_mode)
{ {
const char *cp; const char *cp;
cp = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode)->name; cp = jim_nvp_value2name_simple(nvp_reset_modes, reset_mode)->name;
if (!cp) { if (!cp) {
LOG_ERROR("Invalid target reset mode: %d", (int)(reset_mode)); LOG_ERROR("Invalid target reset mode: %d", (int)(reset_mode));
cp = "(*BUG*unknown*BUG*)"; cp = "(*BUG*unknown*BUG*)";
@ -661,8 +661,8 @@ static int target_process_reset(struct command_invocation *cmd, enum target_rese
{ {
char buf[100]; char buf[100];
int retval; int retval;
Jim_Nvp *n; struct jim_nvp *n;
n = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode); n = jim_nvp_value2name_simple(nvp_reset_modes, reset_mode);
if (n->name == NULL) { if (n->name == NULL) {
LOG_ERROR("invalid reset mode"); LOG_ERROR("invalid reset mode");
return ERROR_FAIL; return ERROR_FAIL;
@ -1823,7 +1823,7 @@ int target_call_event_callbacks(struct target *target, enum target_event event)
} }
LOG_DEBUG("target event %i (%s) for core %s", event, LOG_DEBUG("target event %i (%s) for core %s", event,
Jim_Nvp_value2name_simple(nvp_target_event, event)->name, jim_nvp_value2name_simple(nvp_target_event, event)->name,
target_name(target)); target_name(target));
target_handle_event(target, event); target_handle_event(target, event);
@ -1842,7 +1842,7 @@ int target_call_reset_callbacks(struct target *target, enum target_reset_mode re
struct target_reset_callback *callback; struct target_reset_callback *callback;
LOG_DEBUG("target reset %i (%s)", reset_mode, LOG_DEBUG("target reset %i (%s)", reset_mode,
Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode)->name); jim_nvp_value2name_simple(nvp_reset_modes, reset_mode)->name);
list_for_each_entry(callback, &target_reset_callback_list, list) list_for_each_entry(callback, &target_reset_callback_list, list)
callback->callback(target, reset_mode, callback->priv); callback->callback(target, reset_mode, callback->priv);
@ -2859,7 +2859,7 @@ COMMAND_HANDLER(handle_targets_command)
marker, marker,
target_name(target), target_name(target),
target_type_name(target), target_type_name(target),
Jim_Nvp_value2name_simple(nvp_target_endian, jim_nvp_value2name_simple(nvp_target_endian,
target->endianness)->name, target->endianness)->name,
target->tap->dotted_name, target->tap->dotted_name,
state); state);
@ -3239,7 +3239,7 @@ int target_wait_state(struct target *target, enum target_state state, int ms)
once = false; once = false;
then = timeval_ms(); then = timeval_ms();
LOG_DEBUG("waiting for target %s...", LOG_DEBUG("waiting for target %s...",
Jim_Nvp_value2name_simple(nvp_target_state, state)->name); jim_nvp_value2name_simple(nvp_target_state, state)->name);
} }
if (cur-then > 500) if (cur-then > 500)
@ -3247,7 +3247,7 @@ int target_wait_state(struct target *target, enum target_state state, int ms)
if ((cur-then) > ms) { if ((cur-then) > ms) {
LOG_ERROR("timed out while waiting for target %s", LOG_ERROR("timed out while waiting for target %s",
Jim_Nvp_value2name_simple(nvp_target_state, state)->name); jim_nvp_value2name_simple(nvp_target_state, state)->name);
return ERROR_FAIL; return ERROR_FAIL;
} }
} }
@ -3297,8 +3297,8 @@ COMMAND_HANDLER(handle_reset_command)
enum target_reset_mode reset_mode = RESET_RUN; enum target_reset_mode reset_mode = RESET_RUN;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
const Jim_Nvp *n; const struct jim_nvp *n;
n = Jim_Nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]); n = jim_nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]);
if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) if ((n->name == NULL) || (n->value == RESET_UNKNOWN))
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
reset_mode = n->value; reset_mode = n->value;
@ -4775,7 +4775,7 @@ void target_handle_event(struct target *target, enum target_event e)
target_name(target), target_name(target),
target_type_name(target), target_type_name(target),
e, e,
Jim_Nvp_value2name_simple(nvp_target_event, e)->name, jim_nvp_value2name_simple(nvp_target_event, e)->name,
Jim_GetString(teap->body, NULL)); Jim_GetString(teap->body, NULL));
/* Override current target by the target an event /* Override current target by the target an event
@ -4799,7 +4799,7 @@ void target_handle_event(struct target *target, enum target_event e)
if (retval != JIM_OK) { if (retval != JIM_OK) {
Jim_MakeErrorMessage(teap->interp); Jim_MakeErrorMessage(teap->interp);
LOG_USER("Error executing event %s on target %s:\n%s", LOG_USER("Error executing event %s on target %s:\n%s",
Jim_Nvp_value2name_simple(nvp_target_event, e)->name, jim_nvp_value2name_simple(nvp_target_event, e)->name,
target_name(target), target_name(target),
Jim_GetString(Jim_GetResult(teap->interp), NULL)); Jim_GetString(Jim_GetResult(teap->interp), NULL));
/* clean both error code and stacktrace before return */ /* clean both error code and stacktrace before return */
@ -4840,7 +4840,7 @@ enum target_cfg_param {
TCFG_GDB_MAX_CONNECTIONS, TCFG_GDB_MAX_CONNECTIONS,
}; };
static Jim_Nvp nvp_config_opts[] = { static struct jim_nvp nvp_config_opts[] = {
{ .name = "-type", .value = TCFG_TYPE }, { .name = "-type", .value = TCFG_TYPE },
{ .name = "-event", .value = TCFG_EVENT }, { .name = "-event", .value = TCFG_EVENT },
{ .name = "-work-area-virt", .value = TCFG_WORK_AREA_VIRT }, { .name = "-work-area-virt", .value = TCFG_WORK_AREA_VIRT },
@ -4858,9 +4858,9 @@ static Jim_Nvp nvp_config_opts[] = {
{ .name = NULL, .value = -1 } { .name = NULL, .value = -1 }
}; };
static int target_configure(Jim_GetOptInfo *goi, struct target *target) static int target_configure(struct jim_getopt_info *goi, struct target *target)
{ {
Jim_Nvp *n; struct jim_nvp *n;
Jim_Obj *o; Jim_Obj *o;
jim_wide w; jim_wide w;
int e; int e;
@ -4868,7 +4868,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
/* parse config or cget options ... */ /* parse config or cget options ... */
while (goi->argc > 0) { while (goi->argc > 0) {
Jim_SetEmptyResult(goi->interp); Jim_SetEmptyResult(goi->interp);
/* Jim_GetOpt_Debug(goi); */ /* jim_getopt_debug(goi); */
if (target->type->target_jim_configure) { if (target->type->target_jim_configure) {
/* target defines a configure function */ /* target defines a configure function */
@ -4884,9 +4884,9 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
} }
/* otherwise we 'continue' below */ /* otherwise we 'continue' below */
} }
e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); e = jim_getopt_nvp(goi, nvp_config_opts, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
return e; return e;
} }
switch (n->value) { switch (n->value) {
@ -4915,9 +4915,9 @@ no_params:
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Nvp(goi, nvp_target_event, &n); e = jim_getopt_nvp(goi, nvp_target_event, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_target_event, 1); jim_getopt_nvp_unknown(goi, nvp_target_event, 1);
return e; return e;
} }
@ -4958,7 +4958,7 @@ no_params:
} }
teap->event = n->value; teap->event = n->value;
teap->interp = goi->interp; teap->interp = goi->interp;
Jim_GetOpt_Obj(goi, &o); jim_getopt_obj(goi, &o);
if (teap->body) if (teap->body)
Jim_DecrRefCount(teap->interp, teap->body); Jim_DecrRefCount(teap->interp, teap->body);
teap->body = Jim_DuplicateObj(goi->interp, o); teap->body = Jim_DuplicateObj(goi->interp, o);
@ -4994,7 +4994,7 @@ no_params:
case TCFG_WORK_AREA_VIRT: case TCFG_WORK_AREA_VIRT:
if (goi->isconfigure) { if (goi->isconfigure) {
target_free_all_working_areas(target); target_free_all_working_areas(target);
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->working_area_virt = w; target->working_area_virt = w;
@ -5010,7 +5010,7 @@ no_params:
case TCFG_WORK_AREA_PHYS: case TCFG_WORK_AREA_PHYS:
if (goi->isconfigure) { if (goi->isconfigure) {
target_free_all_working_areas(target); target_free_all_working_areas(target);
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->working_area_phys = w; target->working_area_phys = w;
@ -5026,7 +5026,7 @@ no_params:
case TCFG_WORK_AREA_SIZE: case TCFG_WORK_AREA_SIZE:
if (goi->isconfigure) { if (goi->isconfigure) {
target_free_all_working_areas(target); target_free_all_working_areas(target);
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->working_area_size = w; target->working_area_size = w;
@ -5041,7 +5041,7 @@ no_params:
case TCFG_WORK_AREA_BACKUP: case TCFG_WORK_AREA_BACKUP:
if (goi->isconfigure) { if (goi->isconfigure) {
target_free_all_working_areas(target); target_free_all_working_areas(target);
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
/* make this exactly 1 or 0 */ /* make this exactly 1 or 0 */
@ -5057,9 +5057,9 @@ no_params:
case TCFG_ENDIAN: case TCFG_ENDIAN:
if (goi->isconfigure) { if (goi->isconfigure) {
e = Jim_GetOpt_Nvp(goi, nvp_target_endian, &n); e = jim_getopt_nvp(goi, nvp_target_endian, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_target_endian, 1); jim_getopt_nvp_unknown(goi, nvp_target_endian, 1);
return e; return e;
} }
target->endianness = n->value; target->endianness = n->value;
@ -5067,10 +5067,10 @@ no_params:
if (goi->argc != 0) if (goi->argc != 0)
goto no_params; goto no_params;
} }
n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness); n = jim_nvp_value2name_simple(nvp_target_endian, target->endianness);
if (n->name == NULL) { if (n->name == NULL) {
target->endianness = TARGET_LITTLE_ENDIAN; target->endianness = TARGET_LITTLE_ENDIAN;
n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness); n = jim_nvp_value2name_simple(nvp_target_endian, target->endianness);
} }
Jim_SetResultString(goi->interp, n->name, -1); Jim_SetResultString(goi->interp, n->name, -1);
/* loop for more */ /* loop for more */
@ -5078,7 +5078,7 @@ no_params:
case TCFG_COREID: case TCFG_COREID:
if (goi->isconfigure) { if (goi->isconfigure) {
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->coreid = (int32_t)w; target->coreid = (int32_t)w;
@ -5102,7 +5102,7 @@ no_params:
} }
target_free_all_working_areas(target); target_free_all_working_areas(target);
e = Jim_GetOpt_Obj(goi, &o_t); e = jim_getopt_obj(goi, &o_t);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
tap = jtag_tap_by_jim_obj(goi->interp, o_t); tap = jtag_tap_by_jim_obj(goi->interp, o_t);
@ -5119,7 +5119,7 @@ no_params:
break; break;
case TCFG_DBGBASE: case TCFG_DBGBASE:
if (goi->isconfigure) { if (goi->isconfigure) {
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->dbgbase = (uint32_t)w; target->dbgbase = (uint32_t)w;
@ -5156,7 +5156,7 @@ no_params:
} }
const char *s; const char *s;
e = Jim_GetOpt_String(goi, &s, NULL); e = jim_getopt_string(goi, &s, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
free(target->gdb_port_override); free(target->gdb_port_override);
@ -5177,7 +5177,7 @@ no_params:
return JIM_ERR; return JIM_ERR;
} }
e = Jim_GetOpt_Wide(goi, &w); e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
target->gdb_max_connections = (w < 0) ? CONNECTION_LIMIT_UNLIMITED : (int)w; target->gdb_max_connections = (w < 0) ? CONNECTION_LIMIT_UNLIMITED : (int)w;
@ -5198,9 +5198,9 @@ no_params:
static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj * const *argv) static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{ {
struct command *c = jim_to_command(interp); struct command *c = jim_to_command(interp);
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
goi.isconfigure = !strcmp(c->name, "configure"); goi.isconfigure = !strcmp(c->name, "configure");
if (goi.argc < 1) { if (goi.argc < 1) {
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
@ -5241,8 +5241,8 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
{ {
bool allow_defer = false; bool allow_defer = false;
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc > 1) { if (goi.argc > 1) {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_SetResultFormatted(goi.interp, Jim_SetResultFormatted(goi.interp,
@ -5253,7 +5253,7 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
strcmp(Jim_GetString(argv[1], NULL), "allow-defer") == 0) { strcmp(Jim_GetString(argv[1], NULL), "allow-defer") == 0) {
/* consume it */ /* consume it */
Jim_Obj *obj; Jim_Obj *obj;
int e = Jim_GetOpt_Obj(&goi, &obj); int e = jim_getopt_obj(&goi, &obj);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
allow_defer = true; allow_defer = true;
@ -5337,8 +5337,8 @@ static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc != 2) { if (goi.argc != 2) {
Jim_WrongNumArgs(interp, 0, argv, Jim_WrongNumArgs(interp, 0, argv,
@ -5346,15 +5346,15 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR; return JIM_ERR;
} }
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n); int e = jim_getopt_nvp(&goi, nvp_assert, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1); jim_getopt_nvp_unknown(&goi, nvp_assert, 1);
return e; return e;
} }
/* the halt or not param */ /* the halt or not param */
jim_wide a; jim_wide a;
e = Jim_GetOpt_Wide(&goi, &a); e = jim_getopt_wide(&goi, &a);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
@ -5404,8 +5404,8 @@ static int jim_target_halt(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
/* params: <name> statename timeoutmsecs */ /* params: <name> statename timeoutmsecs */
if (goi.argc != 2) { if (goi.argc != 2) {
@ -5415,14 +5415,14 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a
return JIM_ERR; return JIM_ERR;
} }
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n); int e = jim_getopt_nvp(&goi, nvp_target_state, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, nvp_target_state, 1); jim_getopt_nvp_unknown(&goi, nvp_target_state, 1);
return e; return e;
} }
jim_wide a; jim_wide a;
e = Jim_GetOpt_Wide(&goi, &a); e = jim_getopt_wide(&goi, &a);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
struct command_context *cmd_ctx = current_command_context(interp); struct command_context *cmd_ctx = current_command_context(interp);
@ -5457,7 +5457,7 @@ COMMAND_HANDLER(handle_target_event_list)
command_print(CMD, "------------------------- | " command_print(CMD, "------------------------- | "
"----------------------------------------"); "----------------------------------------");
while (teap) { while (teap) {
Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_target_event, teap->event); struct jim_nvp *opt = jim_nvp_value2name_simple(nvp_target_event, teap->event);
command_print(CMD, "%-25s | %s", command_print(CMD, "%-25s | %s",
opt->name, Jim_GetString(teap->body, NULL)); opt->name, Jim_GetString(teap->body, NULL));
teap = teap->next; teap = teap->next;
@ -5479,17 +5479,17 @@ static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const
} }
static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc != 1) { if (goi.argc != 1) {
const char *cmd_name = Jim_GetString(argv[0], NULL); const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_SetResultFormatted(goi.interp, "%s <eventname>", cmd_name); Jim_SetResultFormatted(goi.interp, "%s <eventname>", cmd_name);
return JIM_ERR; return JIM_ERR;
} }
Jim_Nvp *n; struct jim_nvp *n;
int e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n); int e = jim_getopt_nvp(&goi, nvp_target_event, &n);
if (e != JIM_OK) { if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1); jim_getopt_nvp_unknown(&goi, nvp_target_event, 1);
return e; return e;
} }
struct command_context *cmd_ctx = current_command_context(interp); struct command_context *cmd_ctx = current_command_context(interp);
@ -5658,7 +5658,7 @@ static const struct command_registration target_instance_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
static int target_create(Jim_GetOptInfo *goi) static int target_create(struct jim_getopt_info *goi)
{ {
Jim_Obj *new_cmd; Jim_Obj *new_cmd;
Jim_Cmd *cmd; Jim_Cmd *cmd;
@ -5677,7 +5677,7 @@ static int target_create(Jim_GetOptInfo *goi)
} }
/* COMMAND */ /* COMMAND */
Jim_GetOpt_Obj(goi, &new_cmd); jim_getopt_obj(goi, &new_cmd);
/* does this command exist? */ /* does this command exist? */
cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG); cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
if (cmd) { if (cmd) {
@ -5687,7 +5687,7 @@ static int target_create(Jim_GetOptInfo *goi)
} }
/* TYPE */ /* TYPE */
e = Jim_GetOpt_String(goi, &cp, NULL); e = jim_getopt_string(goi, &cp, NULL);
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
struct transport *tr = get_current_transport(); struct transport *tr = get_current_transport();
@ -5991,8 +5991,8 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_target_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_target_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
Jim_GetOptInfo goi; struct jim_getopt_info goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
if (goi.argc < 3) { if (goi.argc < 3) {
Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
"<name> <target_type> [<target_options> ...]"); "<name> <target_type> [<target_options> ...]");

View File

@ -210,11 +210,11 @@ struct target_type {
/* called for various config parameters */ /* called for various config parameters */
/* returns JIM_CONTINUE - if option not understood */ /* returns JIM_CONTINUE - if option not understood */
/* otherwise: JIM_OK, or JIM_ERR, */ /* otherwise: JIM_OK, or JIM_ERR, */
int (*target_jim_configure)(struct target *target, Jim_GetOptInfo *goi); int (*target_jim_configure)(struct target *target, struct jim_getopt_info *goi);
/* target commands specifically handled by the target */ /* target commands specifically handled by the target */
/* returns JIM_OK, or JIM_ERR, or JIM_CONTINUE - if option not understood */ /* returns JIM_OK, or JIM_ERR, or JIM_CONTINUE - if option not understood */
int (*target_jim_commands)(struct target *target, Jim_GetOptInfo *goi); int (*target_jim_commands)(struct target *target, struct jim_getopt_info *goi);
/** /**
* This method is used to perform target setup that requires * This method is used to perform target setup that requires