#include <strings.h>
#endif
+#include <helper/command.h>
+#include <helper/nvp.h>
#include <helper/time_support.h>
#include "transport/transport.h"
* Holds support for accessing JTAG-specific mechanisms from TCl scripts.
*/
-static const struct jim_nvp nvp_jtag_tap_event[] = {
+static const struct nvp nvp_jtag_tap_event[] = {
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
JCFG_IDCODE,
};
-static struct jim_nvp nvp_config_opts[] = {
+static struct nvp nvp_config_opts[] = {
{ .name = "-event", .value = JCFG_EVENT },
{ .name = "-idcode", .value = JCFG_IDCODE },
{ .name = NULL, .value = -1 }
};
-static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap *tap)
+static int jtag_tap_set_event(struct command_context *cmd_ctx, struct jtag_tap *tap,
+ const struct nvp *event, Jim_Obj *body)
{
- if (goi->argc == 0) {
- Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
- return JIM_ERR;
- }
-
- struct jim_nvp *n;
- int e = jim_getopt_nvp(goi, nvp_jtag_tap_event, &n);
- if (e != JIM_OK) {
- jim_getopt_nvp_unknown(goi, nvp_jtag_tap_event, 1);
- return e;
- }
+ struct jtag_tap_event_action *jteap = tap->event_action;
- if (goi->isconfigure) {
- if (goi->argc != 1) {
- Jim_WrongNumArgs(goi->interp,
- goi->argc,
- goi->argv,
- "-event <event-name> <event-body>");
- return JIM_ERR;
- }
- } else {
- if (goi->argc != 0) {
- Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name>");
- return JIM_ERR;
- }
- }
-
- struct jtag_tap_event_action *jteap = tap->event_action;
- /* replace existing event body */
- bool found = false;
while (jteap) {
- if (jteap->event == (enum jtag_event)n->value) {
- found = true;
+ if (jteap->event == (enum jtag_event)event->value)
break;
- }
jteap = jteap->next;
}
- Jim_SetEmptyResult(goi->interp);
-
- if (goi->isconfigure) {
- if (!found)
- jteap = calloc(1, sizeof(*jteap));
- else if (jteap->body)
- Jim_DecrRefCount(goi->interp, jteap->body);
+ if (!jteap) {
+ jteap = calloc(1, sizeof(*jteap));
+ if (!jteap) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
- jteap->interp = goi->interp;
- jteap->event = n->value;
+ /* add to head of event list */
+ jteap->next = tap->event_action;
+ tap->event_action = jteap;
+ } else {
+ Jim_DecrRefCount(cmd_ctx->interp, jteap->body);
+ }
- Jim_Obj *o;
- jim_getopt_obj(goi, &o);
- jteap->body = Jim_DuplicateObj(goi->interp, o);
- Jim_IncrRefCount(jteap->body);
+ jteap->interp = cmd_ctx->interp;
+ jteap->event = (enum jtag_event)event->value;
+ jteap->body = Jim_DuplicateObj(cmd_ctx->interp, body);
+ Jim_IncrRefCount(jteap->body);
- if (!found) {
- /* add to head of event list */
- jteap->next = tap->event_action;
- tap->event_action = jteap;
- }
- } else if (found) {
- jteap->interp = goi->interp;
- Jim_SetResult(goi->interp,
- Jim_DuplicateObj(goi->interp, jteap->body));
- }
- return JIM_OK;
+ return ERROR_OK;
}
-static int jtag_tap_configure_cmd(struct jim_getopt_info *goi, struct jtag_tap *tap)
+__COMMAND_HANDLER(handle_jtag_configure)
{
- /* parse config or cget options */
- while (goi->argc > 0) {
- Jim_SetEmptyResult(goi->interp);
-
- struct jim_nvp *n;
- int e = jim_getopt_nvp(goi, nvp_config_opts, &n);
- if (e != JIM_OK) {
- jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
- return e;
- }
+ bool is_configure = !strcmp(CMD_NAME, "configure");
+
+ if (CMD_ARGC < (is_configure ? 3 : 2))
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ /* FIXME: rework jtag_tap_by_jim_obj */
+ struct jtag_tap *tap = jtag_tap_by_jim_obj(CMD_CTX->interp, CMD_JIMTCL_ARGV[0]);
+ if (!tap)
+ return ERROR_FAIL;
+ for (unsigned int i = 1; i < CMD_ARGC; i++) {
+ const struct nvp *n = nvp_name2value(nvp_config_opts, CMD_ARGV[i]);
switch (n->value) {
- case JCFG_EVENT:
- e = jtag_tap_configure_event(goi, tap);
- if (e != JIM_OK)
- return e;
- break;
- case JCFG_IDCODE:
- if (goi->isconfigure) {
- Jim_SetResultFormatted(goi->interp,
- "not settable: %s", n->name);
- return JIM_ERR;
- } else {
- if (goi->argc != 0) {
- Jim_WrongNumArgs(goi->interp,
- goi->argc, goi->argv,
- "NO PARAMS");
- return JIM_ERR;
+ case JCFG_EVENT:
+ if (i + (is_configure ? 2 : 1) >= CMD_ARGC) {
+ command_print(CMD, "wrong # args: should be \"-event <event-name>%s\"",
+ is_configure ? " <event-body>" : "");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+
+ const struct nvp *event = nvp_name2value(nvp_jtag_tap_event, CMD_ARGV[i + 1]);
+ if (!event->name) {
+ nvp_unknown_command_print(CMD, nvp_jtag_tap_event, CMD_ARGV[i], CMD_ARGV[i + 1]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+
+ if (is_configure) {
+ int retval = jtag_tap_set_event(CMD_CTX, tap, event, CMD_JIMTCL_ARGV[i + 2]);
+ if (retval != ERROR_OK)
+ return retval;
+ } else {
+ struct jtag_tap_event_action *jteap = tap->event_action;
+ while (jteap) {
+ if (jteap->event == (enum jtag_event)event->value) {
+ command_print(CMD, "%s", Jim_GetString(jteap->body, NULL));
+ break;
}
+ jteap = jteap->next;
}
- Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, tap->idcode));
- break;
- default:
- Jim_SetResultFormatted(goi->interp, "unknown value: %s", n->name);
- return JIM_ERR;
- }
- }
-
- return JIM_OK;
-}
+ }
-static int is_bad_irval(int ir_length, jim_wide w)
-{
- jim_wide v = 1;
-
- v <<= ir_length;
- v -= 1;
- v = ~v;
- return (w & v) != 0;
-}
-
-static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
- struct jtag_tap *tap)
-{
- jim_wide w;
- int e = jim_getopt_wide(goi, &w);
- if (e != JIM_OK) {
- Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
- return e;
- }
-
- uint32_t *p = realloc(tap->expected_ids,
- (tap->expected_ids_cnt + 1) * sizeof(uint32_t));
- if (!p) {
- Jim_SetResultFormatted(goi->interp, "no memory");
- return JIM_ERR;
+ i += is_configure ? 2 : 1;
+ break;
+ case JCFG_IDCODE:
+ if (is_configure) {
+ command_print(CMD, "not settable: %s", n->name);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+ command_print(CMD, "0x%08x", tap->idcode);
+ break;
+ default:
+ nvp_unknown_command_print(CMD, nvp_config_opts, NULL, CMD_ARGV[i]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
}
-
- tap->expected_ids = p;
- tap->expected_ids[tap->expected_ids_cnt++] = w;
-
- return JIM_OK;
+ return ERROR_OK;
}
#define NTAP_OPT_IRLEN 0
#define NTAP_OPT_EXPECTED_ID 5
#define NTAP_OPT_VERSION 6
#define NTAP_OPT_BYPASS 7
+#define NTAP_OPT_IRBYPASS 8
+
+static const struct nvp jtag_newtap_opts[] = {
+ { .name = "-irlen", .value = NTAP_OPT_IRLEN },
+ { .name = "-irmask", .value = NTAP_OPT_IRMASK },
+ { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
+ { .name = "-enable", .value = NTAP_OPT_ENABLED },
+ { .name = "-disable", .value = NTAP_OPT_DISABLED },
+ { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
+ { .name = "-ignore-version", .value = NTAP_OPT_VERSION },
+ { .name = "-ignore-bypass", .value = NTAP_OPT_BYPASS },
+ { .name = "-ir-bypass", .value = NTAP_OPT_IRBYPASS },
+ { .name = NULL, .value = -1 },
+};
-static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
- struct jtag_tap *tap)
-{
- jim_wide w;
- int e = jim_getopt_wide(goi, &w);
- if (e != JIM_OK) {
- Jim_SetResultFormatted(goi->interp,
- "option: %s bad parameter", n->name);
- return e;
- }
- switch (n->value) {
- case NTAP_OPT_IRLEN:
- if (w > (jim_wide) (8 * sizeof(tap->ir_capture_value))) {
- LOG_WARNING("%s: huge IR length %d",
- tap->dotted_name, (int) w);
- }
- tap->ir_length = w;
- break;
- case NTAP_OPT_IRMASK:
- if (is_bad_irval(tap->ir_length, w)) {
- LOG_ERROR("%s: IR mask %x too big",
- tap->dotted_name,
- (int) w);
- return JIM_ERR;
- }
- if ((w & 3) != 3)
- LOG_WARNING("%s: nonstandard IR mask", tap->dotted_name);
- tap->ir_capture_mask = w;
- break;
- case NTAP_OPT_IRCAPTURE:
- if (is_bad_irval(tap->ir_length, w)) {
- LOG_ERROR("%s: IR capture %x too big",
- tap->dotted_name, (int) w);
- return JIM_ERR;
- }
- if ((w & 3) != 1)
- LOG_WARNING("%s: nonstandard IR value",
- tap->dotted_name);
- tap->ir_capture_value = w;
- break;
- default:
- return JIM_ERR;
- }
- return JIM_OK;
-}
-
-static int jim_newtap_cmd(struct jim_getopt_info *goi)
+static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap)
{
- struct jtag_tap *tap;
- int x;
- int e;
- struct jim_nvp *n;
- char *cp;
- const struct jim_nvp opts[] = {
- { .name = "-irlen", .value = NTAP_OPT_IRLEN },
- { .name = "-irmask", .value = NTAP_OPT_IRMASK },
- { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
- { .name = "-enable", .value = NTAP_OPT_ENABLED },
- { .name = "-disable", .value = NTAP_OPT_DISABLED },
- { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
- { .name = "-ignore-version", .value = NTAP_OPT_VERSION },
- { .name = "-ignore-bypass", .value = NTAP_OPT_BYPASS },
- { .name = NULL, .value = -1 },
- };
-
- tap = calloc(1, sizeof(struct jtag_tap));
- if (!tap) {
- Jim_SetResultFormatted(goi->interp, "no memory");
- return JIM_ERR;
- }
+ /* we expect CHIP + TAP + OPTIONS */
+ if (CMD_ARGC < 2)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- /*
- * we expect CHIP + TAP + OPTIONS
- * */
- if (goi->argc < 3) {
- Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ....");
- free(tap);
- return JIM_ERR;
+ tap->chip = strdup(CMD_ARGV[0]);
+ tap->tapname = strdup(CMD_ARGV[1]);
+ tap->dotted_name = alloc_printf("%s.%s", CMD_ARGV[0], CMD_ARGV[1]);
+ if (!tap->chip || !tap->tapname || !tap->dotted_name) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
}
-
- const char *tmp;
- jim_getopt_string(goi, &tmp, NULL);
- tap->chip = strdup(tmp);
-
- jim_getopt_string(goi, &tmp, NULL);
- tap->tapname = strdup(tmp);
-
- /* name + dot + name + null */
- x = strlen(tap->chip) + 1 + strlen(tap->tapname) + 1;
- cp = malloc(x);
- sprintf(cp, "%s.%s", tap->chip, tap->tapname);
- tap->dotted_name = cp;
+ CMD_ARGC -= 2;
+ CMD_ARGV += 2;
LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
- tap->chip, tap->tapname, tap->dotted_name, goi->argc);
+ tap->chip, tap->tapname, tap->dotted_name, CMD_ARGC);
- /* IEEE specifies that the two LSBs of an IR scan are 01, so make
+ /*
+ * IEEE specifies that the two LSBs of an IR scan are 01, so make
* that the default. The "-ircapture" and "-irmask" options are only
* needed to cope with nonstandard TAPs, or to specify more bits.
*/
tap->ir_capture_mask = 0x03;
tap->ir_capture_value = 0x01;
- while (goi->argc) {
- e = jim_getopt_nvp(goi, opts, &n);
- if (e != JIM_OK) {
- jim_getopt_nvp_unknown(goi, opts, 0);
- free(cp);
- free(tap);
- return e;
- }
- LOG_DEBUG("Processing option: %s", n->name);
+ while (CMD_ARGC) {
+ const struct nvp *n = nvp_name2value(jtag_newtap_opts, CMD_ARGV[0]);
+ CMD_ARGC--;
+ CMD_ARGV++;
switch (n->value) {
- case NTAP_OPT_ENABLED:
- tap->disabled_after_reset = false;
- break;
- case NTAP_OPT_DISABLED:
- tap->disabled_after_reset = true;
- break;
- case NTAP_OPT_EXPECTED_ID:
- e = jim_newtap_expected_id(n, goi, tap);
- if (e != JIM_OK) {
- free(cp);
- free(tap);
- return e;
- }
- break;
- case NTAP_OPT_IRLEN:
- case NTAP_OPT_IRMASK:
- case NTAP_OPT_IRCAPTURE:
- e = jim_newtap_ir_param(n, goi, tap);
- if (e != JIM_OK) {
- free(cp);
- free(tap);
- return e;
- }
- break;
- case NTAP_OPT_VERSION:
- tap->ignore_version = true;
- break;
- case NTAP_OPT_BYPASS:
- tap->ignore_bypass = true;
- break;
- } /* switch (n->value) */
- } /* while (goi->argc) */
+ case NTAP_OPT_ENABLED:
+ tap->disabled_after_reset = false;
+ break;
+
+ case NTAP_OPT_DISABLED:
+ tap->disabled_after_reset = true;
+ break;
+
+ case NTAP_OPT_EXPECTED_ID:
+ if (!CMD_ARGC)
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ tap->expected_ids = realloc(tap->expected_ids,
+ (tap->expected_ids_cnt + 1) * sizeof(uint32_t));
+ if (!tap->expected_ids) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
+
+ uint32_t id;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], id);
+ CMD_ARGC--;
+ CMD_ARGV++;
+ tap->expected_ids[tap->expected_ids_cnt++] = id;
+
+ break;
+
+ case NTAP_OPT_IRLEN:
+ if (!CMD_ARGC)
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tap->ir_length);
+ CMD_ARGC--;
+ CMD_ARGV++;
+ if (tap->ir_length > (int)(8 * sizeof(tap->ir_capture_value)))
+ LOG_WARNING("%s: huge IR length %d", tap->dotted_name, tap->ir_length);
+ break;
+
+ case NTAP_OPT_IRMASK:
+ if (!CMD_ARGC)
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], tap->ir_capture_mask);
+ CMD_ARGC--;
+ CMD_ARGV++;
+ if ((tap->ir_capture_mask & 3) != 3)
+ LOG_WARNING("%s: nonstandard IR mask", tap->dotted_name);
+ break;
+
+ case NTAP_OPT_IRCAPTURE:
+ if (!CMD_ARGC)
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], tap->ir_capture_value);
+ CMD_ARGC--;
+ CMD_ARGV++;
+ if ((tap->ir_capture_value & 3) != 1)
+ LOG_WARNING("%s: nonstandard IR value", tap->dotted_name);
+ break;
+
+ case NTAP_OPT_VERSION:
+ tap->ignore_version = true;
+ break;
+
+ case NTAP_OPT_BYPASS:
+ tap->ignore_bypass = true;
+ break;
+
+ case NTAP_OPT_IRBYPASS:
+ if (!CMD_ARGC)
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], tap->ir_bypass_value);
+ CMD_ARGC--;
+ CMD_ARGV++;
+ break;
+
+ default:
+ nvp_unknown_command_print(CMD, jtag_newtap_opts, NULL, CMD_ARGV[-1]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+ }
/* default is enabled-after-reset */
tap->enabled = !tap->disabled_after_reset;
- /* Did all the required option bits get cleared? */
- if (!transport_is_jtag() || tap->ir_length != 0) {
- jtag_tap_init(tap);
- return JIM_OK;
+ if (transport_is_jtag() && tap->ir_length == 0) {
+ command_print(CMD, "newtap: %s missing IR length", tap->dotted_name);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- Jim_SetResultFormatted(goi->interp,
- "newtap: %s missing IR length",
- tap->dotted_name);
- jtag_tap_free(tap);
- return JIM_ERR;
+ return ERROR_OK;
+}
+
+__COMMAND_HANDLER(handle_jtag_newtap)
+{
+ struct jtag_tap *tap = calloc(1, sizeof(struct jtag_tap));
+ if (!tap) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
+
+ int retval = CALL_COMMAND_HANDLER(handle_jtag_newtap_args, tap);
+ if (retval != ERROR_OK) {
+ free(tap->chip);
+ free(tap->tapname);
+ free(tap->dotted_name);
+ free(tap->expected_ids);
+ free(tap);
+ return retval;
+ }
+
+ jtag_tap_init(tap);
+ return ERROR_OK;
}
static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
if (jteap->event != e)
continue;
- struct jim_nvp *nvp = jim_nvp_value2name_simple(nvp_jtag_tap_event, e);
+ const struct nvp *nvp = nvp_value2name(nvp_jtag_tap_event, e);
LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
tap->dotted_name, e, nvp->name,
Jim_GetString(jteap->body, NULL));
return ERROR_OK;
}
-int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- return jim_newtap_cmd(&goi);
-}
-
static bool jtag_tap_enable(struct jtag_tap *t)
{
if (t->enabled)
- return false;
+ return true;
jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE);
if (!t->enabled)
return false;
static bool jtag_tap_disable(struct jtag_tap *t)
{
if (!t->enabled)
- return false;
+ return true;
jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE);
if (t->enabled)
return false;
return true;
}
-int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+__COMMAND_HANDLER(handle_jtag_tap_enabler)
{
- struct command *c = jim_to_command(interp);
- const char *cmd_name = c->name;
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- if (goi.argc != 1) {
- Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
- return JIM_ERR;
- }
-
- struct jtag_tap *t;
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]);
- if (!t)
- return JIM_ERR;
+ struct jtag_tap *t = jtag_tap_by_string(CMD_ARGV[0]);
+ if (!t) {
+ command_print(CMD, "Tap '%s' could not be found", CMD_ARGV[0]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
- if (strcasecmp(cmd_name, "tapisenabled") == 0) {
+ if (strcmp(CMD_NAME, "tapisenabled") == 0) {
/* do nothing, just return the value */
- } else if (strcasecmp(cmd_name, "tapenable") == 0) {
+ } else if (strcmp(CMD_NAME, "tapenable") == 0) {
if (!jtag_tap_enable(t)) {
- LOG_WARNING("failed to enable tap %s", t->dotted_name);
- return JIM_ERR;
+ command_print(CMD, "failed to enable tap %s", t->dotted_name);
+ return ERROR_FAIL;
}
- } else if (strcasecmp(cmd_name, "tapdisable") == 0) {
+ } else if (strcmp(CMD_NAME, "tapdisable") == 0) {
if (!jtag_tap_disable(t)) {
- LOG_WARNING("failed to disable tap %s", t->dotted_name);
- return JIM_ERR;
+ command_print(CMD, "failed to disable tap %s", t->dotted_name);
+ return ERROR_FAIL;
}
} else {
- LOG_ERROR("command '%s' unknown", cmd_name);
- return JIM_ERR;
- }
- bool e = t->enabled;
- Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, e));
- return JIM_OK;
-}
-
-int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- struct command *c = jim_to_command(interp);
- const char *cmd_name = c->name;
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- goi.isconfigure = !strcmp(cmd_name, "configure");
- if (goi.argc < 2 + goi.isconfigure) {
- Jim_WrongNumArgs(goi.interp, 0, NULL,
- "<tap_name> <attribute> ...");
- return JIM_ERR;
+ command_print(CMD, "command '%s' unknown", CMD_NAME);
+ return ERROR_FAIL;
}
- struct jtag_tap *t;
-
- Jim_Obj *o;
- jim_getopt_obj(&goi, &o);
- t = jtag_tap_by_jim_obj(goi.interp, o);
- if (!t)
- return JIM_ERR;
-
- return jtag_tap_configure_cmd(&goi, t);
+ command_print(CMD, "%d", t->enabled ? 1 : 0);
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_names)
{
.name = "newtap",
.mode = COMMAND_CONFIG,
- .jim_handler = jim_jtag_newtap,
+ .handler = handle_jtag_newtap,
.help = "Create a new TAP instance named basename.tap_type, "
"and appends it to the scan chain.",
.usage = "basename tap_type '-irlen' count "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
+ "['-ir-bypass' number] "
"['-mask' number]",
},
{
.name = "tapisenabled",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_tap_enabler,
+ .handler = handle_jtag_tap_enabler,
.help = "Returns a Tcl boolean (0/1) indicating whether "
"the TAP is enabled (1) or not (0).",
.usage = "tap_name",
{
.name = "tapenable",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_tap_enabler,
+ .handler = handle_jtag_tap_enabler,
.help = "Try to enable the specified TAP using the "
"'tap-enable' TAP event.",
.usage = "tap_name",
{
.name = "tapdisable",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_tap_enabler,
+ .handler = handle_jtag_tap_enabler,
.help = "Try to disable the specified TAP using the "
"'tap-disable' TAP event.",
.usage = "tap_name",
{
.name = "configure",
.mode = COMMAND_ANY,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
.help = "Provide a Tcl handler for the specified "
"TAP event.",
.usage = "tap_name '-event' event_name handler",
{
.name = "cget",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
.help = "Return any Tcl handler for the specified "
"TAP event.",
.usage = "tap_name '-event' event_name",