diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jtag/driver.h | 4 | ||||
-rw-r--r-- | src/jtag/tcl.c | 26 | ||||
-rw-r--r-- | src/openocd.c | 2 |
3 files changed, 27 insertions, 5 deletions
diff --git a/src/jtag/driver.h b/src/jtag/driver.h new file mode 100644 index 00000000..62cda414 --- /dev/null +++ b/src/jtag/driver.h @@ -0,0 +1,4 @@ +struct command_context; + +int interface_register_commands(struct command_context *ctx); + diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 1073abc0..3ffa930d 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -985,7 +985,7 @@ COMMAND_HANDLER(handle_interface_list_command) 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 debug interfaces are available:"); for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) { const char *name = jtag_interfaces[i]->name; @@ -1038,7 +1038,7 @@ COMMAND_HANDLER(handle_interface_command) /* 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)", CMD_ARGV[0]); + LOG_ERROR("The specified debug interface was not found (%s)", CMD_ARGV[0]); CALL_COMMAND_HANDLER(handle_interface_list_command); return ERROR_JTAG_INVALID_INTERFACE; } @@ -1607,20 +1607,35 @@ COMMAND_HANDLER(handle_tms_sequence_command) return ERROR_OK; } -static const struct command_registration jtag_command_handlers[] = { +static const struct command_registration interface_command_handlers[] = { { .name = "interface", .handler = handle_interface_command, .mode = COMMAND_CONFIG, - .help = "Select a JTAG interface", + .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 interfaces", + .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_khz", .handler = handle_jtag_khz_command, @@ -1746,6 +1761,7 @@ static const struct command_registration jtag_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; + int jtag_register_commands(struct command_context *cmd_ctx) { return register_commands(cmd_ctx, NULL, jtag_command_handlers); diff --git a/src/openocd.c b/src/openocd.c index 78336068..42504343 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -29,6 +29,7 @@ #endif #include "openocd.h" +#include <jtag/driver.h> #include <jtag/jtag.h> #include <helper/ioutil.h> #include <helper/configuration.h> @@ -207,6 +208,7 @@ struct command_context *setup_command_handler(Jim_Interp *interp) &server_register_commands, &gdb_register_commands, &log_register_commands, + &interface_register_commands, &jtag_register_commands, &xsvf_register_commands, &svf_register_commands, |