1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de>
4 * Copyright (C) 2007-2010 Øyvind Harboe <oyvind.harboe@zylin.com>
5 * Copyright (C) 2009 SoftPLC Corporation, http://softplc.com, Dick Hollenbeck <dick@softplc.com>
6 * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>
7 * Copyright (C) 2018 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
16 #include "minidriver.h"
17 #include "interface.h"
18 #include "interfaces.h"
19 #include <transport/transport.h>
27 * Holds support for configuring debug adapters from TCl scripts.
30 struct adapter_driver *adapter_driver;
31 const char * const jtag_only[] = { "jtag", NULL };
33 enum adapter_clk_mode {
34 CLOCK_MODE_UNSELECTED = 0,
39 #define DEFAULT_CLOCK_SPEED_KHZ 100U
42 * Adapter configuration
45 bool adapter_initialized;
48 enum adapter_clk_mode clock_mode;
50 int rclk_fallback_speed_khz;
53 bool is_adapter_initialized(void)
55 return adapter_config.adapter_initialized;
59 * Do low-level setup like initializing registers, output signals,
62 int adapter_init(struct command_context *cmd_ctx)
64 if (is_adapter_initialized())
67 if (!adapter_driver) {
68 /* nothing was previously specified by "adapter driver" command */
69 LOG_ERROR("Debug Adapter has to be specified, "
70 "see \"adapter driver\" command");
71 return ERROR_JTAG_INVALID_INTERFACE;
76 if (adapter_config.clock_mode == CLOCK_MODE_UNSELECTED) {
77 LOG_WARNING("An adapter speed is not selected in the init scripts."
78 " OpenOCD will try to run the adapter at the low speed (%d kHz)",
79 DEFAULT_CLOCK_SPEED_KHZ);
80 LOG_WARNING("To remove this warnings and achieve reasonable communication speed with the target,"
81 " set \"adapter speed\" or \"jtag_rclk\" in the init scripts.");
82 retval = adapter_config_khz(DEFAULT_CLOCK_SPEED_KHZ);
83 if (retval != ERROR_OK)
84 return ERROR_JTAG_INIT_FAILED;
87 retval = adapter_driver->init();
88 if (retval != ERROR_OK)
90 adapter_config.adapter_initialized = true;
92 if (!adapter_driver->speed) {
93 LOG_INFO("This adapter doesn't support configurable speed");
97 int requested_khz = adapter_get_speed_khz();
98 int actual_khz = requested_khz;
100 retval = adapter_get_speed(&speed_var);
101 if (retval != ERROR_OK)
103 retval = adapter_driver->speed(speed_var);
104 if (retval != ERROR_OK)
106 retval = adapter_get_speed_readable(&actual_khz);
107 if (retval != ERROR_OK)
108 LOG_INFO("adapter-specific clock speed value %d", speed_var);
109 else if (actual_khz) {
110 /* Adaptive clocking -- JTAG-specific */
111 if ((adapter_config.clock_mode == CLOCK_MODE_RCLK)
112 || ((adapter_config.clock_mode == CLOCK_MODE_KHZ) && !requested_khz)) {
113 LOG_INFO("RCLK (adaptive clock speed) not supported - fallback to %d kHz"
116 LOG_INFO("clock speed %d kHz", actual_khz);
118 LOG_INFO("RCLK (adaptive clock speed)");
123 int adapter_quit(void)
125 if (is_adapter_initialized() && adapter_driver->quit) {
126 /* close the JTAG interface */
127 int result = adapter_driver->quit();
128 if (result != ERROR_OK)
129 LOG_ERROR("failed: %d", result);
132 free(adapter_config.serial);
133 free(adapter_config.usb_location);
135 struct jtag_tap *t = jtag_all_taps();
137 struct jtag_tap *n = t->next_tap;
145 unsigned int adapter_get_speed_khz(void)
147 return adapter_config.speed_khz;
150 static int adapter_khz_to_speed(unsigned int khz, int *speed)
152 LOG_DEBUG("convert khz to adapter specific speed value");
153 adapter_config.speed_khz = khz;
154 if (!is_adapter_initialized())
156 LOG_DEBUG("have adapter set up");
157 if (!adapter_driver->khz) {
158 LOG_ERROR("Translation from khz to adapter speed not implemented");
162 int retval = adapter_driver->khz(adapter_get_speed_khz(), &speed_div1);
163 if (retval != ERROR_OK)
169 static int adapter_rclk_to_speed(unsigned int fallback_speed_khz, int *speed)
171 int retval = adapter_khz_to_speed(0, speed);
172 if ((retval != ERROR_OK) && fallback_speed_khz) {
173 LOG_DEBUG("trying fallback speed...");
174 retval = adapter_khz_to_speed(fallback_speed_khz, speed);
179 static int adapter_set_speed(int speed)
181 /* this command can be called during CONFIG,
182 * in which case adapter isn't initialized */
183 return is_adapter_initialized() ? adapter_driver->speed(speed) : ERROR_OK;
186 int adapter_config_khz(unsigned int khz)
188 LOG_DEBUG("handle adapter khz");
189 adapter_config.clock_mode = CLOCK_MODE_KHZ;
191 int retval = adapter_khz_to_speed(khz, &speed);
192 return (retval != ERROR_OK) ? retval : adapter_set_speed(speed);
195 int adapter_config_rclk(unsigned int fallback_speed_khz)
197 LOG_DEBUG("handle adapter rclk");
198 adapter_config.clock_mode = CLOCK_MODE_RCLK;
199 adapter_config.rclk_fallback_speed_khz = fallback_speed_khz;
201 int retval = adapter_rclk_to_speed(fallback_speed_khz, &speed);
202 return (retval != ERROR_OK) ? retval : adapter_set_speed(speed);
205 int adapter_get_speed(int *speed)
207 switch (adapter_config.clock_mode) {
209 adapter_khz_to_speed(adapter_get_speed_khz(), speed);
211 case CLOCK_MODE_RCLK:
212 adapter_rclk_to_speed(adapter_config.rclk_fallback_speed_khz, speed);
215 LOG_ERROR("BUG: unknown adapter clock mode");
221 int adapter_get_speed_readable(int *khz)
224 int retval = adapter_get_speed(&speed_var);
225 if (retval != ERROR_OK)
227 if (!is_adapter_initialized())
229 if (!adapter_driver->speed_div) {
230 LOG_ERROR("Translation from adapter speed to khz not implemented");
233 return adapter_driver->speed_div(speed_var, khz);
236 const char *adapter_get_required_serial(void)
238 return adapter_config.serial;
243 * 2 * 7 chars: max 7 ports
244 * 1 char: test for overflow
248 #define USB_MAX_LOCATION_LENGTH 16
250 #ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
251 static void adapter_usb_set_location(const char *location)
253 if (strnlen(location, USB_MAX_LOCATION_LENGTH) == USB_MAX_LOCATION_LENGTH)
254 LOG_WARNING("usb location string is too long!!");
256 free(adapter_config.usb_location);
258 adapter_config.usb_location = strndup(location, USB_MAX_LOCATION_LENGTH);
260 #endif /* HAVE_LIBUSB_GET_PORT_NUMBERS */
262 const char *adapter_usb_get_location(void)
264 return adapter_config.usb_location;
267 bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len)
269 size_t path_step, string_length;
273 if (!adapter_usb_get_location())
276 /* strtok need non const char */
277 loc = strndup(adapter_usb_get_location(), USB_MAX_LOCATION_LENGTH);
278 string_length = strnlen(loc, USB_MAX_LOCATION_LENGTH);
280 ptr = strtok(loc, "-");
282 LOG_WARNING("no '-' in usb path\n");
286 string_length -= strnlen(ptr, string_length);
287 /* check bus mismatch */
288 if (atoi(ptr) != dev_bus)
292 while (path_step < path_len) {
293 ptr = strtok(NULL, ".");
295 /* no more tokens in path */
299 /* path mismatch at some step */
300 if (path_step < path_len && atoi(ptr) != port_path[path_step])
304 string_length -= strnlen(ptr, string_length) + 1;
307 /* walked the full path, all elements match */
308 if (path_step == path_len && !string_length)
316 static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
318 struct jim_getopt_info goi;
319 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
321 /* return the name of the interface */
322 /* TCL code might need to know the exact type... */
323 /* FUTURE: we allow this as a means to "set" the interface. */
325 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
328 const char *name = adapter_driver ? adapter_driver->name : NULL;
329 Jim_SetResultString(goi.interp, name ? name : "undefined", -1);
333 COMMAND_HANDLER(adapter_transports_command)
338 retval = CALL_COMMAND_HANDLER(transport_list_parse, &transports);
339 if (retval != ERROR_OK)
342 retval = allow_transports(CMD_CTX, (const char **)transports);
344 if (retval != ERROR_OK) {
345 for (unsigned i = 0; transports[i]; i++)
352 COMMAND_HANDLER(handle_adapter_list_command)
354 if (strcmp(CMD_NAME, "list") == 0 && CMD_ARGC > 0)
355 return ERROR_COMMAND_SYNTAX_ERROR;
357 command_print(CMD, "The following debug adapters are available:");
358 for (unsigned i = 0; adapter_drivers[i]; i++) {
359 const char *name = adapter_drivers[i]->name;
360 command_print(CMD, "%u: %s", i + 1, name);
366 COMMAND_HANDLER(handle_adapter_driver_command)
370 /* check whether the interface is already configured */
371 if (adapter_driver) {
372 LOG_WARNING("Interface already configured, ignoring");
376 /* interface name is a mandatory argument */
377 if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
378 return ERROR_COMMAND_SYNTAX_ERROR;
380 for (unsigned i = 0; adapter_drivers[i]; i++) {
381 if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0)
384 if (adapter_drivers[i]->commands) {
385 retval = register_commands(CMD_CTX, NULL, adapter_drivers[i]->commands);
386 if (retval != ERROR_OK)
390 adapter_driver = adapter_drivers[i];
392 return allow_transports(CMD_CTX, adapter_driver->transports);
395 /* no valid interface was found (i.e. the configuration option,
396 * didn't match one of the compiled-in interfaces
398 LOG_ERROR("The specified debug interface was not found (%s)",
400 CALL_COMMAND_HANDLER(handle_adapter_list_command);
401 return ERROR_JTAG_INVALID_INTERFACE;
404 COMMAND_HANDLER(handle_reset_config_command)
409 /* Original versions cared about the order of these tokens:
410 * reset_config signals [combination [trst_type [srst_type]]]
411 * They also clobbered the previous configuration even on error.
413 * Here we don't care about the order, and only change values
414 * which have been explicitly specified.
416 for (; CMD_ARGC; CMD_ARGC--, CMD_ARGV++) {
421 m = RESET_SRST_NO_GATING;
422 if (strcmp(*CMD_ARGV, "srst_gates_jtag") == 0)
423 /* default: don't use JTAG while SRST asserted */;
424 else if (strcmp(*CMD_ARGV, "srst_nogate") == 0)
425 tmp = RESET_SRST_NO_GATING;
429 LOG_ERROR("extra reset_config %s spec (%s)",
430 "gating", *CMD_ARGV);
431 return ERROR_COMMAND_SYNTAX_ERROR;
437 m = RESET_HAS_TRST | RESET_HAS_SRST;
438 if (strcmp(*CMD_ARGV, "none") == 0)
440 else if (strcmp(*CMD_ARGV, "trst_only") == 0)
441 tmp = RESET_HAS_TRST;
442 else if (strcmp(*CMD_ARGV, "srst_only") == 0)
443 tmp = RESET_HAS_SRST;
444 else if (strcmp(*CMD_ARGV, "trst_and_srst") == 0)
445 tmp = RESET_HAS_TRST | RESET_HAS_SRST;
449 LOG_ERROR("extra reset_config %s spec (%s)",
450 "signal", *CMD_ARGV);
451 return ERROR_COMMAND_SYNTAX_ERROR;
456 /* combination (options for broken wiring) */
457 m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
458 if (strcmp(*CMD_ARGV, "separate") == 0)
459 /* separate reset lines - default */;
460 else if (strcmp(*CMD_ARGV, "srst_pulls_trst") == 0)
461 tmp |= RESET_SRST_PULLS_TRST;
462 else if (strcmp(*CMD_ARGV, "trst_pulls_srst") == 0)
463 tmp |= RESET_TRST_PULLS_SRST;
464 else if (strcmp(*CMD_ARGV, "combined") == 0)
465 tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
469 LOG_ERROR("extra reset_config %s spec (%s)",
470 "combination", *CMD_ARGV);
471 return ERROR_COMMAND_SYNTAX_ERROR;
476 /* trst_type (NOP without HAS_TRST) */
477 m = RESET_TRST_OPEN_DRAIN;
478 if (strcmp(*CMD_ARGV, "trst_open_drain") == 0)
479 tmp |= RESET_TRST_OPEN_DRAIN;
480 else if (strcmp(*CMD_ARGV, "trst_push_pull") == 0)
481 /* push/pull from adapter - default */;
485 LOG_ERROR("extra reset_config %s spec (%s)",
486 "trst_type", *CMD_ARGV);
487 return ERROR_COMMAND_SYNTAX_ERROR;
492 /* srst_type (NOP without HAS_SRST) */
493 m = RESET_SRST_PUSH_PULL;
494 if (strcmp(*CMD_ARGV, "srst_push_pull") == 0)
495 tmp |= RESET_SRST_PUSH_PULL;
496 else if (strcmp(*CMD_ARGV, "srst_open_drain") == 0)
497 /* open drain from adapter - default */;
501 LOG_ERROR("extra reset_config %s spec (%s)",
502 "srst_type", *CMD_ARGV);
503 return ERROR_COMMAND_SYNTAX_ERROR;
508 /* connect_type - only valid when srst_nogate */
509 m = RESET_CNCT_UNDER_SRST;
510 if (strcmp(*CMD_ARGV, "connect_assert_srst") == 0)
511 tmp |= RESET_CNCT_UNDER_SRST;
512 else if (strcmp(*CMD_ARGV, "connect_deassert_srst") == 0)
513 /* connect normally - default */;
517 LOG_ERROR("extra reset_config %s spec (%s)",
518 "connect_type", *CMD_ARGV);
519 return ERROR_COMMAND_SYNTAX_ERROR;
524 /* caller provided nonsense; fail */
525 LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
526 return ERROR_COMMAND_SYNTAX_ERROR;
529 /* Remember the bits which were specified (mask)
530 * and their new values (new_cfg).
536 /* clear previous values of those bits, save new values */
538 int old_cfg = jtag_get_reset_config();
542 jtag_set_reset_config(new_cfg);
544 new_cfg = jtag_get_reset_config();
547 * Display the (now-)current reset mode
551 /* minimal JTAG has neither SRST nor TRST (so that's the default) */
552 switch (new_cfg & (RESET_HAS_TRST | RESET_HAS_SRST)) {
554 modes[0] = "srst_only";
557 modes[0] = "trst_only";
559 case RESET_TRST_AND_SRST:
560 modes[0] = "trst_and_srst";
567 /* normally SRST and TRST are decoupled; but bugs happen ... */
568 switch (new_cfg & (RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST)) {
569 case RESET_SRST_PULLS_TRST:
570 modes[1] = "srst_pulls_trst";
572 case RESET_TRST_PULLS_SRST:
573 modes[1] = "trst_pulls_srst";
575 case RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST:
576 modes[1] = "combined";
579 modes[1] = "separate";
583 /* TRST-less connectors include Altera, Xilinx, and minimal JTAG */
584 if (new_cfg & RESET_HAS_TRST) {
585 if (new_cfg & RESET_TRST_OPEN_DRAIN)
586 modes[3] = " trst_open_drain";
588 modes[3] = " trst_push_pull";
592 /* SRST-less connectors include TI-14, Xilinx, and minimal JTAG */
593 if (new_cfg & RESET_HAS_SRST) {
594 if (new_cfg & RESET_SRST_NO_GATING)
595 modes[2] = " srst_nogate";
597 modes[2] = " srst_gates_jtag";
599 if (new_cfg & RESET_SRST_PUSH_PULL)
600 modes[4] = " srst_push_pull";
602 modes[4] = " srst_open_drain";
604 if (new_cfg & RESET_CNCT_UNDER_SRST)
605 modes[5] = " connect_assert_srst";
607 modes[5] = " connect_deassert_srst";
614 command_print(CMD, "%s %s%s%s%s%s",
616 modes[2], modes[3], modes[4], modes[5]);
621 COMMAND_HANDLER(handle_adapter_srst_delay_command)
624 return ERROR_COMMAND_SYNTAX_ERROR;
627 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
629 jtag_set_nsrst_delay(delay);
631 command_print(CMD, "adapter srst delay: %u", jtag_get_nsrst_delay());
635 COMMAND_HANDLER(handle_adapter_srst_pulse_width_command)
638 return ERROR_COMMAND_SYNTAX_ERROR;
641 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], width);
643 jtag_set_nsrst_assert_width(width);
645 command_print(CMD, "adapter srst pulse_width: %u", jtag_get_nsrst_assert_width());
649 COMMAND_HANDLER(handle_adapter_speed_command)
652 return ERROR_COMMAND_SYNTAX_ERROR;
654 int retval = ERROR_OK;
657 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
659 retval = adapter_config_khz(khz);
660 if (retval != ERROR_OK)
664 int cur_speed = adapter_get_speed_khz();
665 retval = adapter_get_speed_readable(&cur_speed);
666 if (retval != ERROR_OK)
670 command_print(CMD, "adapter speed: %d kHz", cur_speed);
672 command_print(CMD, "adapter speed: RCLK - adaptive");
677 COMMAND_HANDLER(handle_adapter_serial_command)
680 return ERROR_COMMAND_SYNTAX_ERROR;
682 free(adapter_config.serial);
683 adapter_config.serial = strdup(CMD_ARGV[0]);
687 COMMAND_HANDLER(handle_adapter_reset_de_assert)
690 VALUE_UNDEFINED = -1,
695 enum values srst = VALUE_UNDEFINED;
696 enum values trst = VALUE_UNDEFINED;
697 enum reset_types jtag_reset_config = jtag_get_reset_config();
701 if (transport_is_jtag()) {
702 if (jtag_reset_config & RESET_HAS_TRST)
703 signal = jtag_get_trst() ? "asserted" : "deasserted";
705 signal = "not present";
706 command_print(CMD, "trst %s", signal);
709 if (jtag_reset_config & RESET_HAS_SRST)
710 signal = jtag_get_srst() ? "asserted" : "deasserted";
712 signal = "not present";
713 command_print(CMD, "srst %s", signal);
718 if (CMD_ARGC != 1 && CMD_ARGC != 3)
719 return ERROR_COMMAND_SYNTAX_ERROR;
721 value = (strcmp(CMD_NAME, "assert") == 0) ? VALUE_ASSERT : VALUE_DEASSERT;
722 if (strcmp(CMD_ARGV[0], "srst") == 0)
724 else if (strcmp(CMD_ARGV[0], "trst") == 0)
727 return ERROR_COMMAND_SYNTAX_ERROR;
730 if (strcmp(CMD_ARGV[1], "assert") == 0)
731 value = VALUE_ASSERT;
732 else if (strcmp(CMD_ARGV[1], "deassert") == 0)
733 value = VALUE_DEASSERT;
735 return ERROR_COMMAND_SYNTAX_ERROR;
737 if (strcmp(CMD_ARGV[2], "srst") == 0 && srst == VALUE_UNDEFINED)
739 else if (strcmp(CMD_ARGV[2], "trst") == 0 && trst == VALUE_UNDEFINED)
742 return ERROR_COMMAND_SYNTAX_ERROR;
745 if (trst == VALUE_UNDEFINED) {
746 if (transport_is_jtag())
747 trst = jtag_get_trst() ? VALUE_ASSERT : VALUE_DEASSERT;
749 trst = VALUE_DEASSERT; /* unused, safe value */
752 if (srst == VALUE_UNDEFINED) {
753 if (jtag_reset_config & RESET_HAS_SRST)
754 srst = jtag_get_srst() ? VALUE_ASSERT : VALUE_DEASSERT;
756 srst = VALUE_DEASSERT; /* unused, safe value */
759 if (trst == VALUE_ASSERT && !transport_is_jtag()) {
760 LOG_ERROR("transport has no trst signal");
764 if (srst == VALUE_ASSERT && !(jtag_reset_config & RESET_HAS_SRST)) {
765 LOG_ERROR("adapter has no srst signal");
769 return adapter_resets((trst == VALUE_DEASSERT) ? TRST_DEASSERT : TRST_ASSERT,
770 (srst == VALUE_DEASSERT) ? SRST_DEASSERT : SRST_ASSERT);
773 #ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
774 COMMAND_HANDLER(handle_usb_location_command)
777 adapter_usb_set_location(CMD_ARGV[0]);
779 command_print(CMD, "adapter usb location: %s", adapter_usb_get_location());
783 #endif /* HAVE_LIBUSB_GET_PORT_NUMBERS */
785 static const struct command_registration adapter_usb_command_handlers[] = {
786 #ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
789 .handler = &handle_usb_location_command,
790 .mode = COMMAND_CONFIG,
791 .help = "display or set the USB bus location of the USB device",
792 .usage = "[<bus>-port[.port]...]",
794 #endif /* HAVE_LIBUSB_GET_PORT_NUMBERS */
795 COMMAND_REGISTRATION_DONE
798 static const struct command_registration adapter_srst_command_handlers[] = {
801 .handler = handle_adapter_srst_delay_command,
803 .help = "delay after deasserting SRST in ms",
804 .usage = "[milliseconds]",
807 .name = "pulse_width",
808 .handler = handle_adapter_srst_pulse_width_command,
810 .help = "SRST assertion pulse width in ms",
811 .usage = "[milliseconds]",
813 COMMAND_REGISTRATION_DONE
816 static const struct command_registration adapter_command_handlers[] = {
819 .handler = handle_adapter_driver_command,
820 .mode = COMMAND_CONFIG,
821 .help = "Select a debug adapter driver",
822 .usage = "driver_name",
826 .handler = handle_adapter_speed_command,
828 .help = "With an argument, change to the specified maximum "
829 "jtag speed. For JTAG, 0 KHz signifies adaptive "
831 "With or without argument, display current setting.",
836 .handler = handle_adapter_serial_command,
837 .mode = COMMAND_CONFIG,
838 .help = "Set the serial number of the adapter",
839 .usage = "serial_string",
843 .handler = handle_adapter_list_command,
845 .help = "List all built-in debug adapter drivers",
851 .jim_handler = jim_adapter_name,
852 .help = "Returns the name of the currently "
853 "selected adapter (driver)",
858 .help = "srst adapter command group",
860 .chain = adapter_srst_command_handlers,
863 .name = "transports",
864 .handler = adapter_transports_command,
865 .mode = COMMAND_CONFIG,
866 .help = "Declare transports the adapter supports.",
867 .usage = "transport ...",
872 .help = "usb adapter command group",
874 .chain = adapter_usb_command_handlers,
878 .handler = handle_adapter_reset_de_assert,
879 .mode = COMMAND_EXEC,
880 .help = "Controls SRST and TRST lines.",
881 .usage = "|deassert [srst|trst [assert|deassert srst|trst]]",
885 .handler = handle_adapter_reset_de_assert,
886 .mode = COMMAND_EXEC,
887 .help = "Controls SRST and TRST lines.",
888 .usage = "|assert [srst|trst [deassert|assert srst|trst]]",
890 COMMAND_REGISTRATION_DONE
893 static const struct command_registration interface_command_handlers[] = {
897 .help = "adapter command group",
899 .chain = adapter_command_handlers,
902 .name = "reset_config",
903 .handler = handle_reset_config_command,
905 .help = "configure adapter reset behavior",
906 .usage = "[none|trst_only|srst_only|trst_and_srst] "
907 "[srst_pulls_trst|trst_pulls_srst|combined|separate] "
908 "[srst_gates_jtag|srst_nogate] "
909 "[trst_push_pull|trst_open_drain] "
910 "[srst_push_pull|srst_open_drain] "
911 "[connect_deassert_srst|connect_assert_srst]",
913 COMMAND_REGISTRATION_DONE
917 * Register the commands which deal with arbitrary debug adapter drivers.
919 * @todo Remove internal assumptions that all debug adapters use JTAG for
920 * transport. Various types and data structures are not named generically.
922 int adapter_register_commands(struct command_context *ctx)
924 return register_commands(ctx, NULL, interface_command_handlers);