+
+static const struct command_registration interface_command_handlers[] = {
+ {
+ .name = "adapter_khz",
+ .handler = handle_adapter_khz_command,
+ .mode = COMMAND_ANY,
+ .help = "With an argument, change to the specified maximum "
+ "jtag speed. For JTAG, 0 KHz signifies adaptive "
+ " clocking. "
+ "With or without argument, display current setting.",
+ .usage = "[khz]",
+ },
+ {
+ .name = "adapter_nsrst_assert_width",
+ .handler = handle_adapter_nsrst_assert_width_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after asserting SRST in ms",
+ .usage = "[milliseconds]",
+ },
+ {
+ .name = "adapter_nsrst_delay",
+ .handler = handle_adapter_nsrst_delay_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after deasserting SRST in ms",
+ .usage = "[milliseconds]",
+ },
+ {
+ .name = "interface",
+ .handler = handle_interface_command,
+ .mode = COMMAND_CONFIG,
+ .help = "Select a debug adapter interface (driver)",
+ .usage = "driver_name",
+ },
+ {
+ .name = "interface_list",
+ .handler = handle_interface_list_command,
+ .mode = COMMAND_ANY,
+ .help = "List all built-in debug adapter interfaces (drivers)",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
+/**
+ * Register the commands which deal with arbitrary debug adapter drivers.
+ *
+ * @todo Remove internal assumptions that all debug adapters use JTAG for
+ * transport. Various types and data structures are not named generically.
+ */
+int interface_register_commands(struct command_context *ctx)
+{
+ return register_commands(ctx, NULL, interface_command_handlers);
+}
+
+static const struct command_registration jtag_command_handlers[] = {
+ {
+ .name = "jtag_rclk",
+ .handler = handle_jtag_rclk_command,
+ .mode = COMMAND_ANY,
+ .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]",
+ },
+ {
+ .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]",
+ },
+ {
+ .name = "jtag_ntrst_delay",
+ .handler = handle_jtag_ntrst_delay_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after deasserting trst in ms",
+ .usage = "[milliseconds]",
+ },
+ {
+ .name = "jtag_ntrst_assert_width",
+ .handler = handle_jtag_ntrst_assert_width_command,
+ .mode = COMMAND_ANY,
+ .help = "delay after asserting trst in ms",
+ .usage = "[milliseconds]",
+ },
+ {
+ .name = "scan_chain",
+ .handler = handle_scan_chain_command,
+ .mode = COMMAND_ANY,
+ .help = "print current scan chain configuration",
+ },
+ {
+ .name = "jtag_reset",
+ .handler = handle_jtag_reset_command,
+ .mode = COMMAND_EXEC,
+ .help = "Set reset line values. Value '1' is active, "
+ "value '0' is inactive.",
+ .usage = "trst_active srst_active",
+ },
+ {
+ .name = "runtest",
+ .handler = handle_runtest_command,
+ .mode = COMMAND_EXEC,
+ .help = "Move to Run-Test/Idle, and issue TCK for num_cycles.",
+ .usage = "num_cycles"
+ },
+ {
+ .name = "irscan",
+ .handler = handle_irscan_command,
+ .mode = COMMAND_EXEC,
+ .help = "Execute Instruction Register (DR) scan. The "
+ "specified opcodes are put into each TAP's IR, "
+ "and other TAPs are put in BYPASS.",
+ .usage = "[tap_name instruction]* ['-endstate' state_name]",
+ },
+ {
+ .name = "verify_ircapture",
+ .handler = handle_verify_ircapture_command,
+ .mode = COMMAND_ANY,
+ .help = "Display or assign flag controlling whether to "
+ "verify values captured during Capture-IR.",
+ .usage = "['enable'|'disable']",
+ },
+ {
+ .name = "verify_jtag",
+ .handler = handle_verify_jtag_command,
+ .mode = COMMAND_ANY,
+ .help = "Display or assign flag controlling whether to "
+ "verify values captured during IR and DR scans.",
+ .usage = "['enable'|'disable']",
+ },
+ {
+ .name = "tms_sequence",
+ .handler = handle_tms_sequence_command,
+ .mode = COMMAND_ANY,
+ .help = "Display or change what style TMS sequences to use "
+ "for JTAG state transitions: short (default) or "
+ "long. Only for working around JTAG bugs.",
+ /* Specifically for working around DRIVER bugs... */
+ .usage = "['short'|'long']",
+ },
+ {
+ .name = "jtag",
+ .mode = COMMAND_ANY,
+ .help = "perform jtag tap actions",
+
+ .chain = jtag_subcommand_handlers,
+ },
+ {
+ .chain = jtag_command_handlers_to_move,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
+int jtag_register_commands(struct command_context *cmd_ctx)
+{
+ return register_commands(cmd_ctx, NULL, jtag_command_handlers);
+}