int e;
Jim_Nvp *n;
Jim_Obj *o;
- struct command_context_s *context;
+ struct command_context *context;
enum {
JTAG_CMD_INTERFACE,
COMMAND_HANDLER(handle_interface_list_command)
{
- if (strcmp(CMD_NAME, "interface_list") == 0 && argc > 0)
+ if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0)
return ERROR_COMMAND_SYNTAX_ERROR;
- command_print(cmd_ctx, "The following JTAG interfaces are available:");
+ command_print(CMD_CTX, "The following JTAG interfaces are available:");
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
{
const char *name = jtag_interfaces[i]->name;
- command_print(cmd_ctx, "%u: %s", i + 1, name);
+ command_print(CMD_CTX, "%u: %s", i + 1, name);
}
return ERROR_OK;
}
/* interface name is a mandatory argument */
- if (argc != 1 || args[0][0] == '\0')
+ if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
return ERROR_COMMAND_SYNTAX_ERROR;
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
{
- if (strcmp(args[0], jtag_interfaces[i]->name) != 0)
+ if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0)
continue;
- int retval = jtag_interfaces[i]->register_commands(cmd_ctx);
- if (ERROR_OK != retval)
+ if (NULL != jtag_interfaces[i]->commands)
+ {
+ int retval = register_commands(CMD_CTX, NULL,
+ jtag_interfaces[i]->commands);
+ if (ERROR_OK != retval)
return retval;
+ }
jtag_interface = jtag_interfaces[i];
/* no valid interface was found (i.e. the configuration option,
* didn't match one of the compiled-in interfaces
*/
- LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]);
+ LOG_ERROR("The specified JTAG interface was not found (%s)", CMD_ARGV[0]);
CALL_COMMAND_HANDLER(handle_interface_list_command);
return ERROR_JTAG_INVALID_INTERFACE;
}
struct jtag_tap *tap;
tap = jtag_all_taps();
- command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
- command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------");
+ command_print(CMD_CTX, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
+ command_print(CMD_CTX, "---|--------------------|---------|------------|------------|------|------|------|---------");
while (tap) {
uint32_t expected, expected_mask, cur_instr, ii;
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
cur_instr = buf_get_u32(tap->cur_instr, 0, tap->ir_length);
- command_print(cmd_ctx,
+ command_print(CMD_CTX,
"%2d | %-18s | %c | 0x%08x | 0x%08x | 0x%02x | 0x%02x | 0x%02x | 0x%02x",
tap->abs_chain_position,
tap->dotted_name,
(unsigned int)(cur_instr));
for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
- command_print(cmd_ctx, " | | | | 0x%08x | | | | ",
+ command_print(CMD_CTX, " | | | | 0x%08x | | | | ",
(unsigned int)(tap->expected_ids[ii]));
}
* Here we don't care about the order, and only change values
* which have been explicitly specified.
*/
- for (; argc; argc--, args++) {
+ for (; CMD_ARGC; CMD_ARGC--, CMD_ARGV++) {
int tmp = 0;
int m;
/* gating */
m = RESET_SRST_NO_GATING;
- if (strcmp(*args, "srst_gates_jtag") == 0)
+ if (strcmp(*CMD_ARGV, "srst_gates_jtag") == 0)
/* default: don't use JTAG while SRST asserted */;
- else if (strcmp(*args, "srst_nogate") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_nogate") == 0)
tmp = RESET_SRST_NO_GATING;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
- "gating", *args);
+ "gating", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* signals */
m = RESET_HAS_TRST | RESET_HAS_SRST;
- if (strcmp(*args, "none") == 0)
+ if (strcmp(*CMD_ARGV, "none") == 0)
tmp = RESET_NONE;
- else if (strcmp(*args, "trst_only") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_only") == 0)
tmp = RESET_HAS_TRST;
- else if (strcmp(*args, "srst_only") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_only") == 0)
tmp = RESET_HAS_SRST;
- else if (strcmp(*args, "trst_and_srst") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_and_srst") == 0)
tmp = RESET_HAS_TRST | RESET_HAS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
- "signal", *args);
+ "signal", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* combination (options for broken wiring) */
m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
- if (strcmp(*args, "separate") == 0)
+ if (strcmp(*CMD_ARGV, "separate") == 0)
/* separate reset lines - default */;
- else if (strcmp(*args, "srst_pulls_trst") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_pulls_trst") == 0)
tmp |= RESET_SRST_PULLS_TRST;
- else if (strcmp(*args, "trst_pulls_srst") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_pulls_srst") == 0)
tmp |= RESET_TRST_PULLS_SRST;
- else if (strcmp(*args, "combined") == 0)
+ else if (strcmp(*CMD_ARGV, "combined") == 0)
tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
- "combination", *args);
+ "combination", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* trst_type (NOP without HAS_TRST) */
m = RESET_TRST_OPEN_DRAIN;
- if (strcmp(*args, "trst_open_drain") == 0)
+ if (strcmp(*CMD_ARGV, "trst_open_drain") == 0)
tmp |= RESET_TRST_OPEN_DRAIN;
- else if (strcmp(*args, "trst_push_pull") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_push_pull") == 0)
/* push/pull from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
- "trst_type", *args);
+ "trst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* srst_type (NOP without HAS_SRST) */
m |= RESET_SRST_PUSH_PULL;
- if (strcmp(*args, "srst_push_pull") == 0)
+ if (strcmp(*CMD_ARGV, "srst_push_pull") == 0)
tmp |= RESET_SRST_PUSH_PULL;
- else if (strcmp(*args, "srst_open_drain") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_open_drain") == 0)
/* open drain from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
- "srst_type", *args);
+ "srst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
goto next;
/* caller provided nonsense; fail */
- LOG_ERROR("unknown reset_config flag (%s)", *args);
+ LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
next:
modes[4] = "";
}
- command_print(cmd_ctx, "%s %s%s%s%s",
+ command_print(CMD_CTX, "%s %s%s%s%s",
modes[0], modes[1],
modes[2], modes[3], modes[4]);
COMMAND_HANDLER(handle_jtag_nsrst_delay_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_nsrst_delay(delay);
}
- command_print(cmd_ctx, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay());
+ command_print(CMD_CTX, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay());
return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_delay(delay);
}
- command_print(cmd_ctx, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
+ command_print(CMD_CTX, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_nsrst_assert_width_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_nsrst_assert_width(delay);
}
- command_print(cmd_ctx, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
+ command_print(CMD_CTX, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_assert_width(delay);
}
- command_print(cmd_ctx, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
+ command_print(CMD_CTX, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_khz_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
int retval = ERROR_OK;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned khz = 0;
- COMMAND_PARSE_NUMBER(uint, args[0], khz);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = jtag_config_khz(khz);
if (ERROR_OK != retval)
return retval;
if (cur_speed)
- command_print(cmd_ctx, "%d kHz", cur_speed);
+ command_print(CMD_CTX, "%d kHz", cur_speed);
else
- command_print(cmd_ctx, "RCLK - adaptive");
+ command_print(CMD_CTX, "RCLK - adaptive");
return retval;
}
COMMAND_HANDLER(handle_jtag_rclk_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
int retval = ERROR_OK;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned khz = 0;
- COMMAND_PARSE_NUMBER(uint, args[0], khz);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = jtag_config_rclk(khz);
if (ERROR_OK != retval)
return retval;
if (cur_khz)
- command_print(cmd_ctx, "RCLK not supported - fallback to %d kHz", cur_khz);
+ command_print(CMD_CTX, "RCLK not supported - fallback to %d kHz", cur_khz);
else
- command_print(cmd_ctx, "RCLK - adaptive");
+ command_print(CMD_CTX, "RCLK - adaptive");
return retval;
}
COMMAND_HANDLER(handle_jtag_reset_command)
{
- if (argc != 2)
+ if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR;
int trst = -1;
- if (args[0][0] == '1')
+ if (CMD_ARGV[0][0] == '1')
trst = 1;
- else if (args[0][0] == '0')
+ else if (CMD_ARGV[0][0] == '0')
trst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
int srst = -1;
- if (args[1][0] == '1')
+ if (CMD_ARGV[1][0] == '1')
srst = 1;
- else if (args[1][0] == '0')
+ else if (CMD_ARGV[1][0] == '0')
srst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
- if (jtag_interface_init(cmd_ctx) != ERROR_OK)
+ if (jtag_interface_init(CMD_CTX) != ERROR_OK)
return ERROR_JTAG_INIT_FAILED;
jtag_add_reset(trst, srst);
COMMAND_HANDLER(handle_runtest_command)
{
- if (argc != 1)
+ if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num_clocks;
- COMMAND_PARSE_NUMBER(uint, args[0], num_clocks);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
jtag_add_runtest(num_clocks, TAP_IDLE);
return jtag_execute_queue();
struct jtag_tap *tap;
tap_state_t endstate;
- if ((argc < 2) || (argc % 2))
+ if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
*/
endstate = TAP_IDLE;
- if (argc >= 4) {
+ if (CMD_ARGC >= 4) {
/* have at least one pair of numbers. */
/* is last pair the magic text? */
- if (strcmp("-endstate", args[argc - 2]) == 0) {
- endstate = tap_state_by_name(args[argc - 1]);
+ if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
+ endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
if (endstate == TAP_INVALID)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!scan_is_safe(endstate))
LOG_WARNING("unstable irscan endstate \"%s\"",
- args[argc - 1]);
- argc -= 2;
+ CMD_ARGV[CMD_ARGC - 1]);
+ CMD_ARGC -= 2;
}
}
- int num_fields = argc / 2;
+ int num_fields = CMD_ARGC / 2;
size_t fields_len = sizeof(struct scan_field) * num_fields;
fields = malloc(fields_len);
memset(fields, 0, fields_len);
int retval;
for (i = 0; i < num_fields; i++)
{
- tap = jtag_tap_by_string(args[i*2]);
+ tap = jtag_tap_by_string(CMD_ARGV[i*2]);
if (tap == NULL)
{
int j;
for (j = 0; j < i; j++)
free(fields[j].out_value);
free(fields);
- command_print(cmd_ctx, "Tap: %s unknown", args[i*2]);
+ command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
return ERROR_FAIL;
}
int field_size = tap->ir_length;
fields[i].tap = tap;
fields[i].num_bits = field_size;
- fields[i].out_value = malloc(CEIL(field_size, 8));
+ fields[i].out_value = malloc(DIV_ROUND_UP(field_size, 8));
uint32_t value;
- retval = parse_u32(args[i * 2 + 1], &value);
+ retval = parse_u32(CMD_ARGV[i * 2 + 1], &value);
if (ERROR_OK != retval)
goto error_return;
buf_set_u32(fields[i].out_value, 0, field_size, value);
fields[field_count].tap = tap;
fields[field_count].num_bits = bits;
- fields[field_count].out_value = malloc(CEIL(bits, 8));
+ fields[field_count].out_value = malloc(DIV_ROUND_UP(bits, 8));
str_to_buf(str, len, fields[field_count].out_value, bits, 0);
fields[field_count].in_value = fields[field_count].out_value;
field_count++;
{
tap_state_t states[8];
- if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states) + 1)))
+ if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1)))
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
COMMAND_HANDLER(handle_verify_ircapture_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
- if (strcmp(args[0], "enable") == 0)
- jtag_set_verify_capture_ir(true);
- else if (strcmp(args[0], "disable") == 0)
- jtag_set_verify_capture_ir(false);
- else
- return ERROR_COMMAND_SYNTAX_ERROR;
+ bool enable;
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
+ jtag_set_verify_capture_ir(enable);
}
const char *status = jtag_will_verify_capture_ir() ? "enabled": "disabled";
- command_print(cmd_ctx, "verify Capture-IR is %s", status);
+ command_print(CMD_CTX, "verify Capture-IR is %s", status);
return ERROR_OK;
}
COMMAND_HANDLER(handle_verify_jtag_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
- if (strcmp(args[0], "enable") == 0)
- jtag_set_verify(true);
- else if (strcmp(args[0], "disable") == 0)
- jtag_set_verify(false);
- else
- return ERROR_COMMAND_SYNTAX_ERROR;
+ bool enable;
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
+ jtag_set_verify(enable);
}
const char *status = jtag_will_verify() ? "enabled": "disabled";
- command_print(cmd_ctx, "verify jtag capture is %s", status);
+ command_print(CMD_CTX, "verify jtag capture is %s", status);
return ERROR_OK;
}
COMMAND_HANDLER(handle_tms_sequence_command)
{
- if (argc > 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
bool use_new_table;
- if (strcmp(args[0], "short") == 0)
+ if (strcmp(CMD_ARGV[0], "short") == 0)
use_new_table = true;
- else if (strcmp(args[0], "long") == 0)
+ else if (strcmp(CMD_ARGV[0], "long") == 0)
use_new_table = false;
else
return ERROR_COMMAND_SYNTAX_ERROR;
tap_use_new_tms_table(use_new_table);
}
- command_print(cmd_ctx, "tms sequence is %s",
+ command_print(CMD_CTX, "tms sequence is %s",
tap_uses_new_tms_table() ? "short": "long");
return ERROR_OK;
}
-int jtag_register_commands(struct command_context_s *cmd_ctx)
-{
- register_jim(cmd_ctx, "jtag", jim_jtag_command,
- "perform jtag tap actions");
-
- register_command(cmd_ctx, NULL, "interface",
- handle_interface_command, COMMAND_CONFIG,
- "try to configure interface");
- register_command(cmd_ctx, NULL, "interface_list",
- &handle_interface_list_command, COMMAND_ANY,
- "list all built-in interfaces");
-
- register_command(cmd_ctx, NULL, "jtag_khz",
- handle_jtag_khz_command, COMMAND_ANY,
- "set maximum jtag speed (if supported); "
- "parameter is maximum khz, or 0 for adaptive clocking (RTCK).");
- register_command(cmd_ctx, NULL, "jtag_rclk",
- handle_jtag_rclk_command, COMMAND_ANY,
- "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed");
- register_command(cmd_ctx, NULL, "reset_config",
- handle_reset_config_command, COMMAND_ANY,
- "reset_config "
- "[none|trst_only|srst_only|trst_and_srst] "
+static const struct command_registration jtag_command_handlers[] = {
+ {
+ .name = "interface",
+ .handler = &handle_interface_command,
+ .mode = COMMAND_CONFIG,
+ .help = "select a JTAG interface",
+ .usage = "<driver_name>",
+ },
+ {
+ .name = "interface_list",
+ .handler = &handle_interface_list_command,
+ .mode = COMMAND_ANY,
+ .help = "list all built-in interfaces",
+ },
+ {
+ .name = "jtag_khz",
+ .handler = &handle_jtag_khz_command,
+ .mode = COMMAND_ANY,
+ .help = "set maximum jtag speed (if supported)",
+ .usage = "<khz:0=rtck>",
+ },
+ {
+ .name = "jtag_rclk",
+ .handler = &handle_jtag_rclk_command,
+ .mode = COMMAND_ANY,
+ .help = "set JTAG speed to RCLK or use fallback speed",
+ .usage = "<fallback_speed_khz>",
+ },
+ {
+ .name = "reset_config",
+ .handler = &handle_reset_config_command,
+ .mode = COMMAND_ANY,
+ .help = "configure JTAG reset behavior",
+ .usage = "[none|trst_only|srst_only|trst_and_srst] "
"[srst_pulls_trst|trst_pulls_srst|combined|separate] "
"[srst_gates_jtag|srst_nogate] "
"[trst_push_pull|trst_open_drain] "
- "[srst_push_pull|srst_open_drain]");
-
- register_command(cmd_ctx, NULL, "jtag_nsrst_delay",
- handle_jtag_nsrst_delay_command, COMMAND_ANY,
- "jtag_nsrst_delay <ms> "
- "- delay after deasserting srst in ms");
- register_command(cmd_ctx, NULL, "jtag_ntrst_delay",
- handle_jtag_ntrst_delay_command, COMMAND_ANY,
- "jtag_ntrst_delay <ms> "
- "- delay after deasserting trst in ms");
-
- register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width",
- handle_jtag_nsrst_assert_width_command, COMMAND_ANY,
- "jtag_nsrst_assert_width <ms> "
- "- delay after asserting srst in ms");
- register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width",
- handle_jtag_ntrst_assert_width_command, COMMAND_ANY,
- "jtag_ntrst_assert_width <ms> "
- "- delay after asserting trst in ms");
-
- register_command(cmd_ctx, NULL, "scan_chain",
- handle_scan_chain_command, COMMAND_EXEC,
- "print current scan chain configuration");
-
- register_command(cmd_ctx, NULL, "jtag_reset",
- handle_jtag_reset_command, COMMAND_EXEC,
- "toggle reset lines <trst> <srst>");
- register_command(cmd_ctx, NULL, "runtest",
- handle_runtest_command, COMMAND_EXEC,
- "move to Run-Test/Idle, and execute <num_cycles>");
- register_command(cmd_ctx, NULL, "irscan",
- handle_irscan_command, COMMAND_EXEC,
- "execute IR scan <device> <instr> [dev2] [instr2] ...");
-
- register_jim(cmd_ctx, "drscan", Jim_Command_drscan,
- "execute DR scan <device> "
- "<num_bits> <value> <num_bits1> <value2> ...");
-
- register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count,
- "returns number of times the JTAG queue has been flushed");
-
- register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove,
- "<state1>,<state2>,<state3>... "
- "- move JTAG to state1 then to state2, state3, etc.");
-
- register_command(cmd_ctx, NULL, "verify_ircapture",
- handle_verify_ircapture_command, COMMAND_ANY,
- "verify value captured during Capture-IR <enable | disable>");
- register_command(cmd_ctx, NULL, "verify_jtag",
- handle_verify_jtag_command, COMMAND_ANY,
- "verify value capture <enable | disable>");
-
- register_command(cmd_ctx, NULL, "tms_sequence",
- handle_tms_sequence_command, COMMAND_ANY,
- "choose short(default) or long tms_sequence <short | long>");
+ "[srst_push_pull|srst_open_drain]",
+ },
+ {
+ .name = "jtag_nsrst_delay",
+ .handler = &handle_jtag_nsrst_delay_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after deasserting srst in ms",
+ .usage = "<ms>",
+ },
+ {
+ .name = "jtag_ntrst_delay",
+ .handler = &handle_jtag_ntrst_delay_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after deasserting trst in ms",
+ .usage = "<ms>"
+ },
+ {
+ .name = "jtag_nsrst_assert_width",
+ .handler = &handle_jtag_nsrst_assert_width_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after asserting srst in ms",
+ .usage = "<ms>"
+ },
+ {
+ .name = "jtag_ntrst_assert_width",
+ .handler = &handle_jtag_ntrst_assert_width_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after asserting trst in ms",
+ .usage = "<ms>"
+ },
+ {
+ .name = "scan_chain",
+ .handler = &handle_scan_chain_command,
+ .mode = COMMAND_EXEC,
+ .help = "print current scan chain configuration",
+ },
+ {
+ .name = "jtag_reset",
+ .handler = &handle_jtag_reset_command,
+ .mode = COMMAND_EXEC,
+ .help = "toggle reset lines",
+ .usage = "<trst> <srst>",
+ },
+ {
+ .name = "runtest",
+ .handler = &handle_runtest_command,
+ .mode = COMMAND_EXEC,
+ .help = "move to Run-Test/Idle, and execute <num_cycles>",
+ .usage = "<num_cycles>"
+ },
+ {
+ .name = "irscan",
+ .handler = &handle_irscan_command,
+ .mode = COMMAND_EXEC,
+ .help = "execute IR scan",
+ .usage = "<device> <instr> [dev2] [instr2] ...",
+ },
+ {
+ .name = "verify_ircapture",
+ .handler = &handle_verify_ircapture_command,
+ .mode = COMMAND_ANY,
+ .help = "verify value captured during Capture-IR",
+ .usage = "<enable | disable>",
+ },
+ {
+ .name = "verify_jtag",
+ .handler = &handle_verify_jtag_command,
+ .mode = COMMAND_ANY,
+ .help = "verify value capture",
+ .usage = "<enable | disable>",
+ },
+ {
+ .name = "tms_sequence",
+ .handler = &handle_tms_sequence_command,
+ .mode = COMMAND_ANY,
+ .help = "choose short(default) or long tms_sequence",
+ .usage = "<short | long>",
+ },
+ // jim commands
+ {
+ .name = "jtag",
+ .mode = COMMAND_ANY,
+ .jim_handler = &jim_jtag_command,
+ .help = "perform jtag tap actions",
+ },
+ {
+ .name = "drscan",
+ .mode = COMMAND_EXEC,
+ .jim_handler = &Jim_Command_drscan,
+ .help = "execute DR scan <device> "
+ "<num_bits> <value> <num_bits1> <value2> ...",
+ },
+ {
+ .name = "flush_count",
+ .mode = COMMAND_EXEC,
+ .jim_handler = &Jim_Command_flush_count,
+ .help = "returns number of times the JTAG queue has been flushed",
+ },
+ {
+ .name = "pathmove",
+ .mode = COMMAND_EXEC,
+ .jim_handler = &Jim_Command_pathmove,
+ .usage = "<state1>,<state2>,<state3>... ",
+ .help = "move JTAG to state1 then to state2, state3, etc.",
+ },
+ COMMAND_REGISTRATION_DONE
+};
- return ERROR_OK;
+int jtag_register_commands(struct command_context *cmd_ctx)
+{
+ return register_commands(cmd_ctx, NULL, jtag_command_handlers);
}
-
-