2022-08-30 10:01:12 -05:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2022-06-26 18:06:45 -05:00
|
|
|
|
2008-02-25 11:48:04 -06:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2005 by Dominic Rath *
|
|
|
|
* Dominic.Rath@gmx.de *
|
|
|
|
* *
|
2010-03-19 16:06:01 -05:00
|
|
|
* Copyright (C) 2007-2010 Øyvind Harboe *
|
2008-07-25 01:54:17 -05:00
|
|
|
* oyvind.harboe@zylin.com *
|
2009-03-17 05:22:26 -05:00
|
|
|
* *
|
|
|
|
* Copyright (C) 2009 SoftPLC Corporation *
|
2009-06-01 18:13:24 -05:00
|
|
|
* http://softplc.com *
|
2009-03-17 05:22:26 -05:00
|
|
|
* dick@softplc.com *
|
2008-07-25 01:54:17 -05:00
|
|
|
* *
|
2009-06-08 23:15:13 -05:00
|
|
|
* Copyright (C) 2009 Zachary T Welch *
|
|
|
|
* zw@superlucidity.net *
|
2008-02-25 11:48:04 -06:00
|
|
|
***************************************************************************/
|
2012-02-02 09:13:13 -06:00
|
|
|
|
2008-02-25 11:48:04 -06:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2021-10-07 07:30:43 -05:00
|
|
|
#include "adapter.h"
|
2008-02-25 11:48:04 -06:00
|
|
|
#include "jtag.h"
|
2012-03-17 02:21:59 -05:00
|
|
|
#include "swd.h"
|
2009-06-02 18:15:12 -05:00
|
|
|
#include "minidriver.h"
|
2009-06-02 20:26:01 -05:00
|
|
|
#include "interface.h"
|
2009-06-28 19:00:50 -05:00
|
|
|
#include "interfaces.h"
|
2011-12-15 04:36:33 -06:00
|
|
|
#include "tcl.h"
|
2008-02-25 11:48:04 -06:00
|
|
|
|
2009-04-28 19:33:35 -05:00
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
2009-05-11 23:52:15 -05:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
#include <helper/command.h>
|
|
|
|
#include <helper/nvp.h>
|
2011-02-24 08:19:27 -06:00
|
|
|
#include <helper/time_support.h>
|
2018-03-15 14:02:10 -05:00
|
|
|
#include "transport/transport.h"
|
2011-02-24 08:19:27 -06:00
|
|
|
|
2010-03-27 12:07:13 -05:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Holds support for accessing JTAG-specific mechanisms from TCl scripts.
|
|
|
|
*/
|
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
static const struct nvp nvp_jtag_tap_event[] = {
|
2012-02-02 09:13:13 -06:00
|
|
|
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
|
|
|
|
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
|
2009-06-09 03:41:14 -05:00
|
|
|
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
|
|
|
|
{ .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
|
|
|
|
|
|
|
|
{ .name = NULL, .value = -1 }
|
|
|
|
};
|
2009-06-09 03:39:44 -05:00
|
|
|
|
2009-12-03 18:25:51 -06:00
|
|
|
struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
|
|
|
|
{
|
|
|
|
const char *cp = Jim_GetString(o, NULL);
|
|
|
|
struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL;
|
2021-07-03 11:51:20 -05:00
|
|
|
if (!cp)
|
2009-12-03 18:25:51 -06:00
|
|
|
cp = "(unknown)";
|
2021-07-03 11:51:20 -05:00
|
|
|
if (!t)
|
2010-10-10 12:17:03 -05:00
|
|
|
Jim_SetResultFormatted(interp, "Tap '%s' could not be found", cp);
|
2009-12-03 18:25:51 -06:00
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2025-01-10 10:05:29 -06:00
|
|
|
static bool scan_is_safe(enum tap_state state)
|
2009-11-26 10:19:40 -06:00
|
|
|
{
|
2012-02-02 09:13:13 -06:00
|
|
|
switch (state) {
|
|
|
|
case TAP_RESET:
|
|
|
|
case TAP_IDLE:
|
|
|
|
case TAP_DRPAUSE:
|
|
|
|
case TAP_IRPAUSE:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
static COMMAND_HELPER(handle_jtag_command_drscan_fields, struct scan_field *fields)
|
2009-11-26 10:19:40 -06:00
|
|
|
{
|
2023-01-02 15:16:46 -06:00
|
|
|
unsigned int field_count = 0;
|
|
|
|
for (unsigned int i = 1; i < CMD_ARGC; i += 2) {
|
|
|
|
unsigned int bits;
|
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[i], bits);
|
|
|
|
fields[field_count].num_bits = bits;
|
|
|
|
|
|
|
|
void *t = malloc(DIV_ROUND_UP(bits, 8));
|
|
|
|
if (!t) {
|
|
|
|
LOG_ERROR("Out of memory");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2024-06-03 03:23:02 -05:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
fields[field_count].out_value = t;
|
2024-07-14 04:28:49 -05:00
|
|
|
int ret = CALL_COMMAND_HANDLER(command_parse_str_to_buf, CMD_ARGV[i + 1], t, bits);
|
2024-06-03 03:23:02 -05:00
|
|
|
if (ret != ERROR_OK)
|
|
|
|
return ret;
|
2023-01-02 15:16:46 -06:00
|
|
|
fields[field_count].in_value = t;
|
|
|
|
field_count++;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_command_drscan)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* CMD_ARGV[0] = device
|
|
|
|
* CMD_ARGV[1] = num_bits
|
|
|
|
* CMD_ARGV[2] = hex string
|
|
|
|
* ... repeat num bits and hex string ...
|
|
|
|
*
|
|
|
|
* ... optionally:
|
|
|
|
* CMD_ARGV[CMD_ARGC-2] = "-endstate"
|
|
|
|
* CMD_ARGV[CMD_ARGC-1] = statename
|
|
|
|
*/
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
if (CMD_ARGC < 3 || (CMD_ARGC % 2) != 1)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
struct jtag_tap *tap = jtag_tap_by_string(CMD_ARGV[0]);
|
|
|
|
if (!tap) {
|
|
|
|
command_print(CMD, "Tap '%s' could not be found", CMD_ARGV[0]);
|
|
|
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
|
|
|
}
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-05-02 07:15:21 -05:00
|
|
|
if (tap->bypass) {
|
|
|
|
command_print(CMD, "Can't execute as the selected tap is in BYPASS");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2025-01-10 10:05:29 -06:00
|
|
|
enum tap_state endstate = TAP_IDLE;
|
2023-01-02 15:16:46 -06:00
|
|
|
if (CMD_ARGC > 3 && !strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2])) {
|
|
|
|
const char *state_name = CMD_ARGV[CMD_ARGC - 1];
|
|
|
|
endstate = tap_state_by_name(state_name);
|
|
|
|
if (endstate < 0) {
|
|
|
|
command_print(CMD, "endstate: %s invalid", state_name);
|
|
|
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
if (!scan_is_safe(endstate))
|
|
|
|
LOG_WARNING("drscan with unsafe endstate \"%s\"", state_name);
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
CMD_ARGC -= 2;
|
2014-02-04 06:07:57 -06:00
|
|
|
}
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
unsigned int num_fields = (CMD_ARGC - 1) / 2;
|
|
|
|
struct scan_field *fields = calloc(num_fields, sizeof(struct scan_field));
|
|
|
|
if (!fields) {
|
|
|
|
LOG_ERROR("Out of memory");
|
|
|
|
return ERROR_FAIL;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
int retval = CALL_COMMAND_HANDLER(handle_jtag_command_drscan_fields, fields);
|
|
|
|
if (retval != ERROR_OK)
|
|
|
|
goto fail;
|
|
|
|
|
2010-03-01 13:00:59 -06:00
|
|
|
jtag_add_dr_scan(tap, num_fields, fields, endstate);
|
2009-11-26 10:19:40 -06:00
|
|
|
|
|
|
|
retval = jtag_execute_queue();
|
2012-02-02 09:13:13 -06:00
|
|
|
if (retval != ERROR_OK) {
|
2023-01-02 15:16:46 -06:00
|
|
|
command_print(CMD, "drscan: jtag execute failed");
|
|
|
|
goto fail;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
for (unsigned int i = 0; i < num_fields; i++) {
|
|
|
|
char *str = buf_to_hex_str(fields[i].in_value, fields[i].num_bits);
|
|
|
|
command_print(CMD, "%s", str);
|
2009-11-26 10:19:40 -06:00
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
fail:
|
|
|
|
for (unsigned int i = 0; i < num_fields; i++)
|
|
|
|
free(fields[i].in_value);
|
2009-11-26 10:19:40 -06:00
|
|
|
free(fields);
|
|
|
|
|
2023-01-02 15:16:46 -06:00
|
|
|
return retval;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_command_pathmove)
|
2009-11-26 10:19:40 -06:00
|
|
|
{
|
2025-01-10 10:05:29 -06:00
|
|
|
enum tap_state states[8];
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
if (CMD_ARGC < 1 || CMD_ARGC > ARRAY_SIZE(states))
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
for (unsigned int i = 0; i < CMD_ARGC; i++) {
|
|
|
|
states[i] = tap_state_by_name(CMD_ARGV[i]);
|
2012-02-02 09:13:13 -06:00
|
|
|
if (states[i] < 0) {
|
2023-01-02 15:32:53 -06:00
|
|
|
command_print(CMD, "endstate: %s invalid", CMD_ARGV[i]);
|
|
|
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
int retval = jtag_add_statemove(states[0]);
|
|
|
|
if (retval == ERROR_OK)
|
|
|
|
retval = jtag_execute_queue();
|
|
|
|
if (retval != ERROR_OK) {
|
|
|
|
command_print(CMD, "pathmove: jtag execute failed");
|
|
|
|
return retval;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
jtag_add_pathmove(CMD_ARGC - 1, states + 1);
|
|
|
|
retval = jtag_execute_queue();
|
|
|
|
if (retval != ERROR_OK) {
|
|
|
|
command_print(CMD, "pathmove: failed");
|
|
|
|
return retval;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2023-01-02 15:32:53 -06:00
|
|
|
return ERROR_OK;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2022-12-19 11:29:08 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_flush_count)
|
2009-11-26 10:19:40 -06:00
|
|
|
{
|
2022-12-19 11:29:08 -06:00
|
|
|
if (CMD_ARGC != 0)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-11-26 10:19:40 -06:00
|
|
|
|
2024-07-22 02:30:42 -05:00
|
|
|
const unsigned int count = jtag_get_flush_queue_count();
|
|
|
|
command_print_sameline(CMD, "%u", count);
|
2022-12-19 11:29:08 -06:00
|
|
|
|
|
|
|
return ERROR_OK;
|
2009-11-26 10:19:40 -06:00
|
|
|
}
|
|
|
|
|
2010-01-10 00:15:57 -06:00
|
|
|
/* REVISIT Just what about these should "move" ... ?
|
|
|
|
* These registrations, into the main JTAG table?
|
|
|
|
*
|
|
|
|
* There's a minor compatibility issue, these all show up twice;
|
|
|
|
* that's not desirable:
|
|
|
|
* - jtag drscan ... NOT DOCUMENTED!
|
|
|
|
* - drscan ...
|
|
|
|
*
|
|
|
|
* The "irscan" command (for example) doesn't show twice.
|
|
|
|
*/
|
2009-11-26 10:19:40 -06:00
|
|
|
static const struct command_registration jtag_command_handlers_to_move[] = {
|
|
|
|
{
|
|
|
|
.name = "drscan",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-01-02 15:16:46 -06:00
|
|
|
.handler = handle_jtag_command_drscan,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Execute Data Register (DR) scan for one TAP. "
|
|
|
|
"Other TAPs must be in BYPASS mode.",
|
2023-05-02 07:10:11 -05:00
|
|
|
.usage = "tap_name (num_bits value)+ ['-endstate' state_name]",
|
2009-11-26 10:19:40 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "flush_count",
|
|
|
|
.mode = COMMAND_EXEC,
|
2022-12-19 11:29:08 -06:00
|
|
|
.handler = handle_jtag_flush_count,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Returns the number of times the JTAG queue "
|
|
|
|
"has been flushed.",
|
2022-12-19 11:29:08 -06:00
|
|
|
.usage = "",
|
2009-11-26 10:19:40 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "pathmove",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-01-02 15:32:53 -06:00
|
|
|
.handler = handle_jtag_command_pathmove,
|
2010-01-10 00:15:57 -06:00
|
|
|
.usage = "start_state state1 [state2 [state3 ...]]",
|
|
|
|
.help = "Move JTAG state machine from current state "
|
|
|
|
"(start_state) to state1, then state2, state3, etc.",
|
2009-11-26 10:19:40 -06:00
|
|
|
},
|
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-12-13 01:05:38 -06:00
|
|
|
enum jtag_tap_cfg_param {
|
2018-08-10 09:09:41 -05:00
|
|
|
JCFG_EVENT,
|
|
|
|
JCFG_IDCODE,
|
2008-12-13 01:05:38 -06:00
|
|
|
};
|
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
static struct nvp nvp_config_opts[] = {
|
2008-12-13 01:05:38 -06:00
|
|
|
{ .name = "-event", .value = JCFG_EVENT },
|
2018-08-10 09:09:41 -05:00
|
|
|
{ .name = "-idcode", .value = JCFG_IDCODE },
|
2008-12-13 01:05:38 -06:00
|
|
|
|
|
|
|
{ .name = NULL, .value = -1 }
|
|
|
|
};
|
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
static int jtag_tap_set_event(struct command_context *cmd_ctx, struct jtag_tap *tap,
|
|
|
|
const struct nvp *event, Jim_Obj *body)
|
2008-12-13 01:05:38 -06:00
|
|
|
{
|
2023-08-06 16:14:15 -05:00
|
|
|
struct jtag_tap_event_action *jteap = tap->event_action;
|
2009-11-26 15:52:04 -06:00
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
while (jteap) {
|
2023-08-06 16:14:15 -05:00
|
|
|
if (jteap->event == (enum jtag_event)event->value)
|
2009-11-26 15:52:04 -06:00
|
|
|
break;
|
|
|
|
jteap = jteap->next;
|
|
|
|
}
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
if (!jteap) {
|
|
|
|
jteap = calloc(1, sizeof(*jteap));
|
|
|
|
if (!jteap) {
|
|
|
|
LOG_ERROR("Out of memory");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2009-11-26 15:52:04 -06:00
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
/* add to head of event list */
|
|
|
|
jteap->next = tap->event_action;
|
|
|
|
tap->event_action = jteap;
|
|
|
|
} else {
|
|
|
|
Jim_DecrRefCount(cmd_ctx->interp, jteap->body);
|
|
|
|
}
|
2009-11-26 15:52:04 -06:00
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
jteap->interp = cmd_ctx->interp;
|
|
|
|
jteap->event = (enum jtag_event)event->value;
|
|
|
|
jteap->body = Jim_DuplicateObj(cmd_ctx->interp, body);
|
|
|
|
Jim_IncrRefCount(jteap->body);
|
2009-11-26 15:52:04 -06:00
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
return ERROR_OK;
|
2009-11-26 15:52:04 -06:00
|
|
|
}
|
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
__COMMAND_HANDLER(handle_jtag_configure)
|
2009-11-26 15:52:04 -06:00
|
|
|
{
|
2023-08-06 16:14:15 -05:00
|
|
|
bool is_configure = !strcmp(CMD_NAME, "configure");
|
|
|
|
|
|
|
|
if (CMD_ARGC < (is_configure ? 3 : 2))
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
/* 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]);
|
2012-02-02 09:13:13 -06:00
|
|
|
switch (n->value) {
|
2023-08-06 16:14:15 -05:00
|
|
|
case JCFG_EVENT:
|
2024-02-01 03:55:51 -06:00
|
|
|
if (i + (is_configure ? 2 : 1) >= CMD_ARGC) {
|
2023-08-06 16:14:15 -05:00
|
|
|
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;
|
2018-08-10 09:09:41 -05:00
|
|
|
}
|
2023-08-06 16:14:15 -05:00
|
|
|
jteap = jteap->next;
|
2018-08-10 09:09:41 -05:00
|
|
|
}
|
2023-08-06 16:14:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2008-12-13 01:05:38 -06:00
|
|
|
}
|
2009-11-26 15:52:04 -06:00
|
|
|
}
|
2023-08-06 16:14:15 -05:00
|
|
|
return ERROR_OK;
|
2008-12-13 01:05:38 -06:00
|
|
|
}
|
2008-09-12 01:56:00 -05:00
|
|
|
|
2009-11-26 16:04:02 -06:00
|
|
|
#define NTAP_OPT_IRLEN 0
|
|
|
|
#define NTAP_OPT_IRMASK 1
|
|
|
|
#define NTAP_OPT_IRCAPTURE 2
|
|
|
|
#define NTAP_OPT_ENABLED 3
|
|
|
|
#define NTAP_OPT_DISABLED 4
|
|
|
|
#define NTAP_OPT_EXPECTED_ID 5
|
2009-12-14 17:55:51 -06:00
|
|
|
#define NTAP_OPT_VERSION 6
|
2022-01-06 12:06:47 -06:00
|
|
|
#define NTAP_OPT_BYPASS 7
|
2023-12-17 16:14:37 -06:00
|
|
|
#define NTAP_OPT_IRBYPASS 8
|
2009-11-26 16:04:02 -06:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
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 },
|
2023-12-17 16:14:37 -06:00
|
|
|
{ .name = "-ir-bypass", .value = NTAP_OPT_IRBYPASS },
|
2023-01-01 18:11:44 -06:00
|
|
|
{ .name = NULL, .value = -1 },
|
|
|
|
};
|
2009-11-26 16:04:02 -06:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap)
|
2008-11-30 16:25:43 -06:00
|
|
|
{
|
2023-01-01 18:11:44 -06:00
|
|
|
/* we expect CHIP + TAP + OPTIONS */
|
|
|
|
if (CMD_ARGC < 2)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-06-15 19:22:40 -05:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
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;
|
2008-11-30 16:25:43 -06:00
|
|
|
}
|
2023-01-01 18:11:44 -06:00
|
|
|
CMD_ARGC -= 2;
|
|
|
|
CMD_ARGV += 2;
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2008-12-01 08:21:24 -06:00
|
|
|
LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
|
2023-01-01 18:11:44 -06:00
|
|
|
tap->chip, tap->tapname, tap->dotted_name, CMD_ARGC);
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
/*
|
|
|
|
* IEEE specifies that the two LSBs of an IR scan are 01, so make
|
2014-07-23 17:14:04 -05:00
|
|
|
* that the default. The "-ircapture" and "-irmask" options are only
|
2009-09-26 14:08:34 -05:00
|
|
|
* needed to cope with nonstandard TAPs, or to specify more bits.
|
|
|
|
*/
|
2021-04-25 16:41:15 -05:00
|
|
|
tap->ir_capture_mask = 0x03;
|
|
|
|
tap->ir_capture_value = 0x01;
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
while (CMD_ARGC) {
|
|
|
|
const struct nvp *n = nvp_name2value(jtag_newtap_opts, CMD_ARGV[0]);
|
|
|
|
CMD_ARGC--;
|
|
|
|
CMD_ARGV++;
|
2009-06-23 17:49:06 -05:00
|
|
|
switch (n->value) {
|
2023-01-01 18:11:44 -06:00
|
|
|
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;
|
|
|
|
|
2024-07-17 09:59:51 -05:00
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], tap->ir_length);
|
2023-01-01 18:11:44 -06:00
|
|
|
CMD_ARGC--;
|
|
|
|
CMD_ARGV++;
|
2024-07-17 09:59:51 -05:00
|
|
|
if (tap->ir_length > (8 * sizeof(tap->ir_capture_value)))
|
|
|
|
LOG_WARNING("%s: huge IR length %u", tap->dotted_name, tap->ir_length);
|
2023-01-01 18:11:44 -06:00
|
|
|
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;
|
|
|
|
|
2023-12-17 16:14:37 -06:00
|
|
|
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;
|
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
default:
|
|
|
|
nvp_unknown_command_print(CMD, jtag_newtap_opts, NULL, CMD_ARGV[-1]);
|
|
|
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
|
|
|
}
|
|
|
|
}
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2009-06-15 19:23:00 -05:00
|
|
|
/* default is enabled-after-reset */
|
2021-04-25 16:41:15 -05:00
|
|
|
tap->enabled = !tap->disabled_after_reset;
|
2009-06-15 19:23:00 -05:00
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
if (transport_is_jtag() && tap->ir_length == 0) {
|
|
|
|
command_print(CMD, "newtap: %s missing IR length", tap->dotted_name);
|
|
|
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2008-11-30 16:25:43 -06:00
|
|
|
}
|
|
|
|
|
2023-01-01 18:11:44 -06:00
|
|
|
jtag_tap_init(tap);
|
|
|
|
return ERROR_OK;
|
2009-06-07 13:38:13 -05:00
|
|
|
}
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2009-11-13 05:19:35 -06:00
|
|
|
static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
|
2009-06-09 03:41:14 -05:00
|
|
|
{
|
2012-02-02 09:13:13 -06:00
|
|
|
struct jtag_tap_event_action *jteap;
|
2019-06-03 08:30:41 -05:00
|
|
|
int retval;
|
2009-06-09 03:41:14 -05:00
|
|
|
|
2021-07-03 14:29:32 -05:00
|
|
|
for (jteap = tap->event_action; jteap; jteap = jteap->next) {
|
2009-11-26 13:00:03 -06:00
|
|
|
if (jteap->event != e)
|
|
|
|
continue;
|
|
|
|
|
2023-08-06 16:14:15 -05:00
|
|
|
const struct nvp *nvp = nvp_value2name(nvp_jtag_tap_event, e);
|
2009-11-26 13:00:03 -06:00
|
|
|
LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
|
2012-02-02 09:13:13 -06:00
|
|
|
tap->dotted_name, e, nvp->name,
|
|
|
|
Jim_GetString(jteap->body, NULL));
|
2009-11-26 13:00:03 -06:00
|
|
|
|
2019-06-03 08:30:41 -05:00
|
|
|
retval = Jim_EvalObj(jteap->interp, jteap->body);
|
|
|
|
if (retval == JIM_RETURN)
|
|
|
|
retval = jteap->interp->returnCode;
|
|
|
|
|
|
|
|
if (retval != JIM_OK) {
|
2010-10-10 12:17:03 -05:00
|
|
|
Jim_MakeErrorMessage(jteap->interp);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s", Jim_GetString(Jim_GetResult(jteap->interp), NULL));
|
2009-11-26 13:00:03 -06:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
switch (e) {
|
|
|
|
case JTAG_TAP_EVENT_ENABLE:
|
|
|
|
case JTAG_TAP_EVENT_DISABLE:
|
|
|
|
/* NOTE: we currently assume the handlers
|
|
|
|
* can't fail. Right here is where we should
|
|
|
|
* really be verifying the scan chains ...
|
|
|
|
*/
|
|
|
|
tap->enabled = (e == JTAG_TAP_EVENT_ENABLE);
|
|
|
|
LOG_INFO("JTAG tap: %s %s", tap->dotted_name,
|
2009-11-26 13:00:03 -06:00
|
|
|
tap->enabled ? "enabled" : "disabled");
|
2012-02-02 09:13:13 -06:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2009-06-09 03:41:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-19 11:18:48 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_arp_init)
|
2009-11-25 23:35:24 -06:00
|
|
|
{
|
2022-12-19 11:18:48 -06:00
|
|
|
if (CMD_ARGC != 0)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
|
|
|
return jtag_init_inner(CMD_CTX);
|
2009-11-25 23:35:24 -06:00
|
|
|
}
|
2009-06-16 07:17:12 -05:00
|
|
|
|
2022-12-19 11:23:11 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_arp_init_reset)
|
2009-11-25 23:35:24 -06:00
|
|
|
{
|
2022-12-19 11:23:11 -06:00
|
|
|
if (CMD_ARGC != 0)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2012-03-17 02:21:59 -05:00
|
|
|
if (transport_is_jtag())
|
2022-12-19 11:23:11 -06:00
|
|
|
return jtag_init_reset(CMD_CTX);
|
2012-03-17 02:21:59 -05:00
|
|
|
|
2022-12-19 11:23:11 -06:00
|
|
|
if (transport_is_swd())
|
|
|
|
return swd_init_reset(CMD_CTX);
|
|
|
|
|
|
|
|
return ERROR_OK;
|
2009-11-25 23:35:24 -06:00
|
|
|
}
|
2009-06-16 07:17:18 -05:00
|
|
|
|
2009-11-25 23:35:24 -06:00
|
|
|
static bool jtag_tap_enable(struct jtag_tap *t)
|
|
|
|
{
|
|
|
|
if (t->enabled)
|
2023-01-02 10:12:04 -06:00
|
|
|
return true;
|
2009-11-25 23:35:24 -06:00
|
|
|
jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE);
|
|
|
|
if (!t->enabled)
|
|
|
|
return false;
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2009-11-25 23:35:24 -06:00
|
|
|
/* FIXME add JTAG sanity checks, w/o TLR
|
|
|
|
* - scan chain length grew by one (this)
|
|
|
|
* - IDs and IR lengths are as expected
|
|
|
|
*/
|
|
|
|
jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
static bool jtag_tap_disable(struct jtag_tap *t)
|
|
|
|
{
|
|
|
|
if (!t->enabled)
|
2023-01-02 10:12:04 -06:00
|
|
|
return true;
|
2009-11-25 23:35:24 -06:00
|
|
|
jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE);
|
|
|
|
if (t->enabled)
|
|
|
|
return false;
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2009-11-25 23:35:24 -06:00
|
|
|
/* FIXME add JTAG sanity checks, w/o TLR
|
|
|
|
* - scan chain length shrank by one (this)
|
|
|
|
* - IDs and IR lengths are as expected
|
|
|
|
*/
|
|
|
|
jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE);
|
|
|
|
return true;
|
|
|
|
}
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2023-01-02 10:12:04 -06:00
|
|
|
__COMMAND_HANDLER(handle_jtag_tap_enabler)
|
2009-11-25 23:35:24 -06:00
|
|
|
{
|
2023-01-02 10:12:04 -06:00
|
|
|
if (CMD_ARGC != 1)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2023-01-02 10:12:04 -06:00
|
|
|
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;
|
|
|
|
}
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2023-01-02 10:12:04 -06:00
|
|
|
if (strcmp(CMD_NAME, "tapisenabled") == 0) {
|
2012-02-02 09:13:13 -06:00
|
|
|
/* do nothing, just return the value */
|
2023-01-02 10:12:04 -06:00
|
|
|
} else if (strcmp(CMD_NAME, "tapenable") == 0) {
|
2012-02-02 09:13:13 -06:00
|
|
|
if (!jtag_tap_enable(t)) {
|
2023-01-02 10:12:04 -06:00
|
|
|
command_print(CMD, "failed to enable tap %s", t->dotted_name);
|
|
|
|
return ERROR_FAIL;
|
2012-02-02 09:13:13 -06:00
|
|
|
}
|
2023-01-02 10:12:04 -06:00
|
|
|
} else if (strcmp(CMD_NAME, "tapdisable") == 0) {
|
2012-02-02 09:13:13 -06:00
|
|
|
if (!jtag_tap_disable(t)) {
|
2023-01-02 10:12:04 -06:00
|
|
|
command_print(CMD, "failed to disable tap %s", t->dotted_name);
|
|
|
|
return ERROR_FAIL;
|
2012-02-02 09:13:13 -06:00
|
|
|
}
|
2009-11-25 23:35:24 -06:00
|
|
|
} else {
|
2023-01-02 10:12:04 -06:00
|
|
|
command_print(CMD, "command '%s' unknown", CMD_NAME);
|
|
|
|
return ERROR_FAIL;
|
2009-11-25 23:35:24 -06:00
|
|
|
}
|
2023-01-02 10:12:04 -06:00
|
|
|
|
|
|
|
command_print(CMD, "%d", t->enabled ? 1 : 0);
|
|
|
|
return ERROR_OK;
|
2009-11-25 23:35:24 -06:00
|
|
|
}
|
2008-12-13 01:05:38 -06:00
|
|
|
|
2022-12-19 11:08:03 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_names)
|
2009-11-25 23:35:24 -06:00
|
|
|
{
|
2022-12-19 11:08:03 -06:00
|
|
|
if (CMD_ARGC != 0)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2022-12-19 11:08:03 -06:00
|
|
|
for (struct jtag_tap *tap = jtag_all_taps(); tap; tap = tap->next_tap)
|
|
|
|
command_print(CMD, "%s", tap->dotted_name);
|
|
|
|
|
|
|
|
return ERROR_OK;
|
2008-09-12 01:56:00 -05:00
|
|
|
}
|
|
|
|
|
2009-11-30 20:30:38 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_init_command)
|
|
|
|
{
|
|
|
|
if (CMD_ARGC != 0)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
static bool jtag_initialized;
|
|
|
|
if (jtag_initialized) {
|
2009-11-30 20:30:38 -06:00
|
|
|
LOG_INFO("'jtag init' has already been called");
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
jtag_initialized = true;
|
|
|
|
|
|
|
|
LOG_DEBUG("Initializing jtag devices...");
|
|
|
|
return jtag_init(CMD_CTX);
|
|
|
|
}
|
|
|
|
|
2009-11-25 23:35:24 -06:00
|
|
|
static const struct command_registration jtag_subcommand_handlers[] = {
|
2009-11-30 20:30:38 -06:00
|
|
|
{
|
|
|
|
.name = "init",
|
2009-12-03 19:41:39 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_jtag_init_command,
|
2009-11-30 20:30:38 -06:00
|
|
|
.help = "initialize jtag scan chain",
|
2012-01-16 07:35:23 -06:00
|
|
|
.usage = ""
|
2009-11-30 20:30:38 -06:00
|
|
|
},
|
2009-11-25 23:35:24 -06:00
|
|
|
{
|
|
|
|
.name = "arp_init",
|
|
|
|
.mode = COMMAND_ANY,
|
2022-12-19 11:18:48 -06:00
|
|
|
.handler = handle_jtag_arp_init,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Validates JTAG scan chain against the list of "
|
|
|
|
"declared TAPs using just the four standard JTAG "
|
|
|
|
"signals.",
|
2022-12-19 11:18:48 -06:00
|
|
|
.usage = "",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "arp_init-reset",
|
|
|
|
.mode = COMMAND_ANY,
|
2022-12-19 11:23:11 -06:00
|
|
|
.handler = handle_jtag_arp_init_reset,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Uses TRST and SRST to try resetting everything on "
|
2022-12-19 11:23:11 -06:00
|
|
|
"the JTAG scan chain, then performs 'jtag arp_init'.",
|
|
|
|
.usage = "",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "newtap",
|
|
|
|
.mode = COMMAND_CONFIG,
|
2023-01-01 18:11:44 -06:00
|
|
|
.handler = handle_jtag_newtap,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Create a new TAP instance named basename.tap_type, "
|
|
|
|
"and appends it to the scan chain.",
|
|
|
|
.usage = "basename tap_type '-irlen' count "
|
|
|
|
"['-enable'|'-disable'] "
|
|
|
|
"['-expected_id' number] "
|
|
|
|
"['-ignore-version'] "
|
2022-01-06 12:06:47 -06:00
|
|
|
"['-ignore-bypass'] "
|
2010-01-10 00:15:57 -06:00
|
|
|
"['-ircapture' number] "
|
2023-12-17 16:14:37 -06:00
|
|
|
"['-ir-bypass' number] "
|
2021-03-27 15:41:30 -05:00
|
|
|
"['-mask' number]",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tapisenabled",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-01-02 10:12:04 -06:00
|
|
|
.handler = handle_jtag_tap_enabler,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Returns a Tcl boolean (0/1) indicating whether "
|
|
|
|
"the TAP is enabled (1) or not (0).",
|
|
|
|
.usage = "tap_name",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tapenable",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-01-02 10:12:04 -06:00
|
|
|
.handler = handle_jtag_tap_enabler,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Try to enable the specified TAP using the "
|
|
|
|
"'tap-enable' TAP event.",
|
|
|
|
.usage = "tap_name",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tapdisable",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-01-02 10:12:04 -06:00
|
|
|
.handler = handle_jtag_tap_enabler,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Try to disable the specified TAP using the "
|
|
|
|
"'tap-disable' TAP event.",
|
|
|
|
.usage = "tap_name",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "configure",
|
2019-02-07 02:56:10 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2023-08-06 16:14:15 -05:00
|
|
|
.handler = handle_jtag_configure,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Provide a Tcl handler for the specified "
|
|
|
|
"TAP event.",
|
|
|
|
.usage = "tap_name '-event' event_name handler",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "cget",
|
|
|
|
.mode = COMMAND_EXEC,
|
2023-08-06 16:14:15 -05:00
|
|
|
.handler = handle_jtag_configure,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Return any Tcl handler for the specified "
|
2024-02-19 16:22:19 -06:00
|
|
|
"TAP event or the value of the IDCODE found in hardware.",
|
|
|
|
.usage = "tap_name '-event' event_name | "
|
|
|
|
"tap_name '-idcode'",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "names",
|
|
|
|
.mode = COMMAND_ANY,
|
2022-12-19 11:08:03 -06:00
|
|
|
.handler = handle_jtag_names,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Returns list of all JTAG tap names.",
|
2022-12-19 11:08:03 -06:00
|
|
|
.usage = "",
|
2009-11-25 23:35:24 -06:00
|
|
|
},
|
2009-11-26 10:19:40 -06:00
|
|
|
{
|
|
|
|
.chain = jtag_command_handlers_to_move,
|
|
|
|
},
|
2009-11-25 23:35:24 -06:00
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
2009-09-11 13:34:15 -05:00
|
|
|
|
2009-10-05 03:20:28 -05:00
|
|
|
void jtag_notify_event(enum jtag_event event)
|
2009-09-11 13:34:15 -05:00
|
|
|
{
|
2009-11-13 05:19:35 -06:00
|
|
|
struct jtag_tap *tap;
|
2009-10-05 03:20:28 -05:00
|
|
|
|
2009-09-11 13:34:15 -05:00
|
|
|
for (tap = jtag_all_taps(); tap; tap = tap->next_tap)
|
2009-10-05 03:20:28 -05:00
|
|
|
jtag_tap_handle_event(tap, event);
|
2009-09-11 13:34:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_scan_chain_command)
|
2008-02-25 11:48:04 -06:00
|
|
|
{
|
2009-11-13 05:19:35 -06:00
|
|
|
struct jtag_tap *tap;
|
2009-12-14 17:55:51 -06:00
|
|
|
char expected_id[12];
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2009-06-04 19:42:25 -05:00
|
|
|
tap = jtag_all_taps();
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD,
|
2012-02-02 09:13:13 -06:00
|
|
|
" TapName Enabled IdCode Expected IrLen IrCap IrMask");
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD,
|
2012-02-02 09:13:13 -06:00
|
|
|
"-- ------------------- -------- ---------- ---------- ----- ----- ------");
|
2008-11-30 16:25:43 -06:00
|
|
|
|
2009-06-23 17:49:06 -05:00
|
|
|
while (tap) {
|
2009-12-16 16:19:44 -06:00
|
|
|
uint32_t expected, expected_mask, ii;
|
2009-12-14 17:55:51 -06:00
|
|
|
|
2024-09-08 16:11:45 -05:00
|
|
|
snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32,
|
|
|
|
(tap->expected_ids_cnt > 0) ? tap->expected_ids[0] : 0);
|
2009-12-14 17:55:51 -06:00
|
|
|
if (tap->ignore_version)
|
|
|
|
expected_id[2] = '*';
|
|
|
|
|
2008-11-30 16:25:43 -06:00
|
|
|
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
|
|
|
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
2008-12-11 18:21:07 -06:00
|
|
|
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD,
|
2024-07-17 09:59:51 -05:00
|
|
|
"%2u %-18s %c 0x%08x %s %5u 0x%02x 0x%02x",
|
2012-02-02 09:13:13 -06:00
|
|
|
tap->abs_chain_position,
|
|
|
|
tap->dotted_name,
|
|
|
|
tap->enabled ? 'Y' : 'n',
|
|
|
|
(unsigned int)(tap->idcode),
|
|
|
|
expected_id,
|
2024-07-17 09:59:51 -05:00
|
|
|
tap->ir_length,
|
2012-02-02 09:13:13 -06:00
|
|
|
(unsigned int)(expected),
|
|
|
|
(unsigned int)(expected_mask));
|
2008-12-11 18:21:07 -06:00
|
|
|
|
|
|
|
for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
|
2024-09-08 16:11:45 -05:00
|
|
|
snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32, tap->expected_ids[ii]);
|
2009-12-14 17:55:51 -06:00
|
|
|
if (tap->ignore_version)
|
|
|
|
expected_id[2] = '*';
|
|
|
|
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD,
|
2012-02-02 09:13:13 -06:00
|
|
|
" %s",
|
|
|
|
expected_id);
|
2008-12-11 18:21:07 -06:00
|
|
|
}
|
|
|
|
|
2008-11-30 16:25:43 -06:00
|
|
|
tap = tap->next_tap;
|
2008-02-25 11:48:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
|
2008-02-25 11:48:04 -06:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-06-08 05:54:52 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2024-09-08 14:21:35 -05:00
|
|
|
unsigned int delay;
|
2009-11-15 10:15:59 -06:00
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
|
2009-10-22 23:05:50 -05:00
|
|
|
|
2009-06-11 20:40:35 -05:00
|
|
|
jtag_set_ntrst_delay(delay);
|
|
|
|
}
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
|
2008-02-25 11:48:04 -06:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
|
2009-09-29 01:07:50 -05:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-09-29 01:07:50 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2024-09-08 14:21:35 -05:00
|
|
|
unsigned int delay;
|
2009-11-15 10:15:59 -06:00
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
|
2009-10-22 23:05:50 -05:00
|
|
|
|
2009-09-29 01:07:50 -05:00
|
|
|
jtag_set_ntrst_assert_width(delay);
|
|
|
|
}
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
|
2009-09-29 01:07:50 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_jtag_rclk_command)
|
2009-08-18 07:14:01 -05:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-08-18 07:14:01 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
|
|
|
int retval = ERROR_OK;
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2024-09-08 14:21:35 -05:00
|
|
|
unsigned int khz = 0;
|
2009-11-15 10:15:59 -06:00
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
|
2009-10-22 23:05:50 -05:00
|
|
|
|
2021-10-07 07:59:29 -05:00
|
|
|
retval = adapter_config_rclk(khz);
|
2021-07-03 09:47:35 -05:00
|
|
|
if (retval != ERROR_OK)
|
2009-08-18 07:14:01 -05:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2021-10-07 07:59:29 -05:00
|
|
|
int cur_khz = adapter_get_speed_khz();
|
|
|
|
retval = adapter_get_speed_readable(&cur_khz);
|
2021-07-03 09:47:35 -05:00
|
|
|
if (retval != ERROR_OK)
|
2009-08-18 07:14:01 -05:00
|
|
|
return retval;
|
|
|
|
|
|
|
|
if (cur_khz)
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "RCLK not supported - fallback to %d kHz", cur_khz);
|
2009-08-18 07:14:01 -05:00
|
|
|
else
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "RCLK - adaptive");
|
2009-08-18 07:14:01 -05:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_runtest_command)
|
2008-02-25 11:48:04 -06:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC != 1)
|
2008-02-25 11:48:04 -06:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2024-09-08 14:21:35 -05:00
|
|
|
unsigned int num_clocks;
|
2009-11-15 10:15:59 -06:00
|
|
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
|
2009-06-11 20:40:54 -05:00
|
|
|
|
2009-06-16 07:17:26 -05:00
|
|
|
jtag_add_runtest(num_clocks, TAP_IDLE);
|
2009-07-07 05:47:23 -05:00
|
|
|
return jtag_execute_queue();
|
2008-02-25 11:48:04 -06:00
|
|
|
}
|
|
|
|
|
2009-06-01 18:30:58 -05:00
|
|
|
/*
|
|
|
|
* For "irscan" or "drscan" commands, the "end" (really, "next") state
|
|
|
|
* should be stable ... and *NOT* a shift state, otherwise free-running
|
|
|
|
* jtag clocks could change the values latched by the update state.
|
2009-10-23 03:02:22 -05:00
|
|
|
* Not surprisingly, this is the same constraint as SVF; the "irscan"
|
|
|
|
* and "drscan" commands are a write-only subset of what SVF provides.
|
2009-06-01 18:30:58 -05:00
|
|
|
*/
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_irscan_command)
|
2008-02-25 11:48:04 -06:00
|
|
|
{
|
|
|
|
int i;
|
2009-11-13 05:28:03 -06:00
|
|
|
struct scan_field *fields;
|
2010-03-01 13:00:59 -06:00
|
|
|
struct jtag_tap *tap = NULL;
|
2025-01-10 10:05:29 -06:00
|
|
|
enum tap_state endstate;
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2009-11-15 06:57:12 -06:00
|
|
|
if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
|
2008-02-25 11:48:04 -06:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2009-06-01 18:30:58 -05:00
|
|
|
/* optional "-endstate" "statename" at the end of the arguments,
|
|
|
|
* so that e.g. IRPAUSE can let us load the data register before
|
|
|
|
* entering RUN/IDLE to execute the instruction we load here.
|
|
|
|
*/
|
|
|
|
endstate = TAP_IDLE;
|
|
|
|
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC >= 4) {
|
2012-02-02 09:13:13 -06:00
|
|
|
/* have at least one pair of numbers.
|
|
|
|
* is last pair the magic text? */
|
2009-11-15 10:15:59 -06:00
|
|
|
if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
|
|
|
|
endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
|
2009-10-23 03:02:22 -05:00
|
|
|
if (endstate == TAP_INVALID)
|
2009-03-10 20:42:05 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-10-23 03:02:22 -05:00
|
|
|
if (!scan_is_safe(endstate))
|
|
|
|
LOG_WARNING("unstable irscan endstate \"%s\"",
|
2012-02-02 09:13:13 -06:00
|
|
|
CMD_ARGV[CMD_ARGC - 1]);
|
2009-11-15 06:57:12 -06:00
|
|
|
CMD_ARGC -= 2;
|
2009-03-10 20:42:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-15 06:57:12 -06:00
|
|
|
int num_fields = CMD_ARGC / 2;
|
2012-02-02 09:13:13 -06:00
|
|
|
if (num_fields > 1) {
|
2010-03-04 07:38:19 -06:00
|
|
|
/* we really should be looking at plain_ir_scan if we want
|
|
|
|
* anything more fancy.
|
|
|
|
*/
|
|
|
|
LOG_ERROR("Specify a single value for tap");
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
}
|
|
|
|
|
2013-09-28 09:29:50 -05:00
|
|
|
fields = calloc(num_fields, sizeof(*fields));
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2009-06-11 20:40:42 -05:00
|
|
|
int retval;
|
2012-02-02 09:13:13 -06:00
|
|
|
for (i = 0; i < num_fields; i++) {
|
2009-11-15 10:15:59 -06:00
|
|
|
tap = jtag_tap_by_string(CMD_ARGV[i*2]);
|
2021-07-03 11:51:20 -05:00
|
|
|
if (!tap) {
|
2012-02-02 09:13:13 -06:00
|
|
|
free(fields);
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Tap: %s unknown", CMD_ARGV[i*2]);
|
2009-08-24 02:53:46 -05:00
|
|
|
|
2008-11-19 02:22:47 -06:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2012-10-23 15:53:55 -05:00
|
|
|
uint64_t value;
|
|
|
|
retval = parse_u64(CMD_ARGV[i * 2 + 1], &value);
|
2021-07-03 09:47:35 -05:00
|
|
|
if (retval != ERROR_OK)
|
2009-06-11 20:40:42 -05:00
|
|
|
goto error_return;
|
2020-05-21 09:03:17 -05:00
|
|
|
|
2024-07-17 09:59:51 -05:00
|
|
|
unsigned int field_size = tap->ir_length;
|
2020-05-21 09:03:17 -05:00
|
|
|
fields[i].num_bits = field_size;
|
|
|
|
uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
|
|
|
|
if (!v) {
|
|
|
|
LOG_ERROR("Out of memory");
|
|
|
|
goto error_return;
|
|
|
|
}
|
|
|
|
|
2012-10-23 15:53:55 -05:00
|
|
|
buf_set_u64(v, 0, field_size, value);
|
2013-09-30 16:16:20 -05:00
|
|
|
fields[i].out_value = v;
|
2008-02-25 11:48:04 -06:00
|
|
|
fields[i].in_value = NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-17 05:22:26 -05:00
|
|
|
/* did we have an endstate? */
|
2010-03-04 07:38:19 -06:00
|
|
|
jtag_add_ir_scan(tap, fields, endstate);
|
2009-04-18 05:08:13 -05:00
|
|
|
|
2009-06-11 20:40:42 -05:00
|
|
|
retval = jtag_execute_queue();
|
2008-02-25 11:48:04 -06:00
|
|
|
|
2009-06-11 20:40:42 -05:00
|
|
|
error_return:
|
2020-08-17 03:05:11 -05:00
|
|
|
for (i = 0; i < num_fields; i++)
|
|
|
|
free((void *)fields[i].out_value);
|
2008-02-25 11:48:04 -06:00
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
free(fields);
|
2008-02-25 11:48:04 -06:00
|
|
|
|
2009-05-14 13:45:19 -05:00
|
|
|
return retval;
|
2008-02-25 11:48:04 -06:00
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_verify_ircapture_command)
|
2008-02-25 11:48:04 -06:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-06-09 03:41:00 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2009-11-18 07:36:18 -06:00
|
|
|
bool enable;
|
|
|
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
|
|
|
|
jtag_set_verify_capture_ir(enable);
|
2008-02-25 11:48:04 -06:00
|
|
|
}
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "verify Capture-IR is %s", status);
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2008-02-25 11:48:04 -06:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
2008-11-05 01:45:31 -06:00
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_verify_jtag_command)
|
2009-05-13 05:21:50 -05:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-06-04 19:06:34 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2009-11-18 07:36:18 -06:00
|
|
|
bool enable;
|
|
|
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
|
|
|
|
jtag_set_verify(enable);
|
2009-06-07 13:38:13 -05:00
|
|
|
}
|
2009-05-13 05:21:50 -05:00
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
const char *status = jtag_will_verify() ? "enabled" : "disabled";
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "verify jtag capture is %s", status);
|
2009-05-13 05:21:50 -05:00
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_tms_sequence_command)
|
2009-05-19 01:59:20 -05:00
|
|
|
{
|
2009-11-15 06:57:12 -06:00
|
|
|
if (CMD_ARGC > 1)
|
2009-06-02 19:24:21 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
2012-02-02 09:13:13 -06:00
|
|
|
if (CMD_ARGC == 1) {
|
2009-06-02 19:24:21 -05:00
|
|
|
bool use_new_table;
|
2009-11-15 10:15:59 -06:00
|
|
|
if (strcmp(CMD_ARGV[0], "short") == 0)
|
2009-06-02 19:24:21 -05:00
|
|
|
use_new_table = true;
|
2009-11-15 10:15:59 -06:00
|
|
|
else if (strcmp(CMD_ARGV[0], "long") == 0)
|
2009-06-02 19:24:21 -05:00
|
|
|
use_new_table = false;
|
|
|
|
else
|
2009-05-19 01:59:20 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-06-02 19:24:21 -05:00
|
|
|
|
|
|
|
tap_use_new_tms_table(use_new_table);
|
2009-05-19 01:59:20 -05:00
|
|
|
}
|
|
|
|
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "tms sequence is %s",
|
2012-02-02 09:13:13 -06:00
|
|
|
tap_uses_new_tms_table() ? "short" : "long");
|
2009-05-19 01:59:20 -05:00
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
2009-11-09 23:21:06 -06:00
|
|
|
|
2010-07-31 14:45:56 -05:00
|
|
|
COMMAND_HANDLER(handle_jtag_flush_queue_sleep)
|
|
|
|
{
|
|
|
|
if (CMD_ARGC != 1)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
|
|
|
int sleep_ms;
|
|
|
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], sleep_ms);
|
|
|
|
|
|
|
|
jtag_set_flush_queue_sleep(sleep_ms);
|
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2011-02-24 08:19:27 -06:00
|
|
|
COMMAND_HANDLER(handle_wait_srst_deassert)
|
|
|
|
{
|
|
|
|
if (CMD_ARGC != 1)
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
|
|
|
|
int timeout_ms;
|
|
|
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], timeout_ms);
|
2012-02-02 09:13:13 -06:00
|
|
|
if ((timeout_ms <= 0) || (timeout_ms > 100000)) {
|
2011-02-24 08:19:27 -06:00
|
|
|
LOG_ERROR("Timeout must be an integer between 0 and 100000");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG_USER("Waiting for srst assert + deassert for at most %dms", timeout_ms);
|
|
|
|
int asserted_yet;
|
2016-05-21 21:34:04 -05:00
|
|
|
int64_t then = timeval_ms();
|
2012-02-02 09:13:13 -06:00
|
|
|
while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
|
|
|
|
if ((timeval_ms() - then) > timeout_ms) {
|
2011-02-24 08:19:27 -06:00
|
|
|
LOG_ERROR("Timed out");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
if (asserted_yet)
|
|
|
|
break;
|
|
|
|
}
|
2012-02-02 09:13:13 -06:00
|
|
|
while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
|
|
|
|
if ((timeval_ms() - then) > timeout_ms) {
|
2011-02-24 08:19:27 -06:00
|
|
|
LOG_ERROR("Timed out");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
if (!asserted_yet)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2010-03-11 11:47:47 -06:00
|
|
|
static const struct command_registration jtag_command_handlers[] = {
|
2010-07-31 14:45:56 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
.name = "jtag_flush_queue_sleep",
|
|
|
|
.handler = handle_jtag_flush_queue_sleep,
|
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "For debug purposes(simulate long delays of interface) "
|
2012-02-02 09:13:13 -06:00
|
|
|
"to test performance or change in behavior. Default 0ms.",
|
2010-07-31 14:45:56 -05:00
|
|
|
.usage = "[sleep in ms]",
|
|
|
|
},
|
2009-11-20 23:02:28 -06:00
|
|
|
{
|
|
|
|
.name = "jtag_rclk",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_jtag_rclk_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "With an argument, change to to use adaptive clocking "
|
|
|
|
"if possible; else to use the fallback speed. "
|
|
|
|
"With or without argument, display current setting.",
|
|
|
|
.usage = "[fallback_speed_khz]",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "jtag_ntrst_delay",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_jtag_ntrst_delay_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "delay after deasserting trst in ms",
|
2010-01-10 00:15:57 -06:00
|
|
|
.usage = "[milliseconds]",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "jtag_ntrst_assert_width",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_jtag_ntrst_assert_width_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "delay after asserting trst in ms",
|
2010-01-10 00:15:57 -06:00
|
|
|
.usage = "[milliseconds]",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "scan_chain",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_scan_chain_command,
|
2010-01-18 07:45:08 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2009-11-20 23:02:28 -06:00
|
|
|
.help = "print current scan chain configuration",
|
2012-01-16 07:35:23 -06:00
|
|
|
.usage = ""
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "runtest",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_runtest_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_EXEC,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Move to Run-Test/Idle, and issue TCK for num_cycles.",
|
|
|
|
.usage = "num_cycles"
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "irscan",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_irscan_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_EXEC,
|
2020-02-08 01:58:53 -06:00
|
|
|
.help = "Execute Instruction Register (IR) scan. The "
|
2010-01-10 00:15:57 -06:00
|
|
|
"specified opcodes are put into each TAP's IR, "
|
|
|
|
"and other TAPs are put in BYPASS.",
|
|
|
|
.usage = "[tap_name instruction]* ['-endstate' state_name]",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "verify_ircapture",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_verify_ircapture_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Display or assign flag controlling whether to "
|
|
|
|
"verify values captured during Capture-IR.",
|
|
|
|
.usage = "['enable'|'disable']",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "verify_jtag",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_verify_jtag_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Display or assign flag controlling whether to "
|
|
|
|
"verify values captured during IR and DR scans.",
|
|
|
|
.usage = "['enable'|'disable']",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tms_sequence",
|
2010-01-10 00:15:57 -06:00
|
|
|
.handler = handle_tms_sequence_command,
|
2009-11-20 23:02:28 -06:00
|
|
|
.mode = COMMAND_ANY,
|
2010-01-10 00:15:57 -06:00
|
|
|
.help = "Display or change what style TMS sequences to use "
|
|
|
|
"for JTAG state transitions: short (default) or "
|
|
|
|
"long. Only for working around JTAG bugs.",
|
2012-02-02 09:13:13 -06:00
|
|
|
/* Specifically for working around DRIVER bugs... */
|
2010-01-10 00:15:57 -06:00
|
|
|
.usage = "['short'|'long']",
|
2009-11-20 23:02:28 -06:00
|
|
|
},
|
2011-02-24 08:19:27 -06:00
|
|
|
{
|
|
|
|
.name = "wait_srst_deassert",
|
|
|
|
.handler = handle_wait_srst_deassert,
|
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "Wait for an SRST deassert. "
|
|
|
|
"Useful for cases where you need something to happen within ms "
|
2021-03-27 15:41:30 -05:00
|
|
|
"of an srst deassert. Timeout in ms",
|
2011-02-24 08:19:27 -06:00
|
|
|
.usage = "ms",
|
|
|
|
},
|
2009-11-23 17:03:04 -06:00
|
|
|
{
|
|
|
|
.name = "jtag",
|
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "perform jtag tap actions",
|
2012-01-16 07:35:23 -06:00
|
|
|
.usage = "",
|
2009-11-25 23:35:24 -06:00
|
|
|
|
|
|
|
.chain = jtag_subcommand_handlers,
|
2009-11-23 17:03:04 -06:00
|
|
|
},
|
|
|
|
{
|
2009-11-26 10:19:40 -06:00
|
|
|
.chain = jtag_command_handlers_to_move,
|
2009-11-23 17:03:04 -06:00
|
|
|
},
|
2009-11-20 23:02:28 -06:00
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
2010-03-11 11:47:47 -06:00
|
|
|
|
2009-11-13 15:25:47 -06:00
|
|
|
int jtag_register_commands(struct command_context *cmd_ctx)
|
2009-11-09 23:21:06 -06:00
|
|
|
{
|
2009-11-20 23:02:28 -06:00
|
|
|
return register_commands(cmd_ctx, NULL, jtag_command_handlers);
|
2009-11-09 23:21:06 -06:00
|
|
|
}
|