adapter: drop command 'adapter transports'
The commit 93f2afa45f ("initial "transport" framework") that
added the transport framework in 2010 was overly optimistic on the
possibility to dynamically add, at runtime, a new adapter and to
specify with the command 'adapter transports' the list of the
transports supported by the new adapter.
Such feature has never become part of OpenOCD, and the command
above has never become useful nor ever been used.
Drop the command 'adapter transports' and its documentation.
Drop the helper 'transport_list_parse', now unused.
Change-Id: Ie3d71c74d068fba802839b116bb9bc9af77cc83d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8671
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
@@ -392,25 +392,6 @@ COMMAND_HANDLER(handle_adapter_name)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(adapter_transports_command)
|
||||
{
|
||||
char **transports;
|
||||
int retval;
|
||||
|
||||
retval = CALL_COMMAND_HANDLER(transport_list_parse, &transports);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
retval = allow_transports(CMD_CTX, (const char **)transports);
|
||||
|
||||
if (retval != ERROR_OK) {
|
||||
for (unsigned int i = 0; transports[i]; i++)
|
||||
free(transports[i]);
|
||||
free(transports);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_adapter_list_command)
|
||||
{
|
||||
if (strcmp(CMD_NAME, "list") == 0 && CMD_ARGC > 0)
|
||||
@@ -1137,13 +1118,6 @@ static const struct command_registration adapter_command_handlers[] = {
|
||||
.usage = "",
|
||||
.chain = adapter_srst_command_handlers,
|
||||
},
|
||||
{
|
||||
.name = "transports",
|
||||
.handler = adapter_transports_command,
|
||||
.mode = COMMAND_CONFIG,
|
||||
.help = "Declare transports the adapter supports.",
|
||||
.usage = "transport ...",
|
||||
},
|
||||
{
|
||||
.name = "usb",
|
||||
.mode = COMMAND_ANY,
|
||||
|
||||
@@ -166,54 +166,6 @@ struct transport *get_current_transport(void)
|
||||
* Infrastructure for Tcl interface to transports.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makes and stores a copy of a set of transports passed as
|
||||
* parameters to a command.
|
||||
*
|
||||
* @param vector where the resulting copy is stored, as an argv-style
|
||||
* NULL-terminated vector.
|
||||
*/
|
||||
COMMAND_HELPER(transport_list_parse, char ***vector)
|
||||
{
|
||||
char **argv;
|
||||
unsigned int n = CMD_ARGC;
|
||||
unsigned int j = 0;
|
||||
|
||||
*vector = NULL;
|
||||
|
||||
if (n < 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
/* our return vector must be NULL terminated */
|
||||
argv = calloc(n + 1, sizeof(char *));
|
||||
if (!argv)
|
||||
return ERROR_FAIL;
|
||||
|
||||
for (unsigned int i = 0; i < n; i++) {
|
||||
struct transport *t;
|
||||
|
||||
for (t = transport_list; t; t = t->next) {
|
||||
if (strcmp(t->name, CMD_ARGV[i]) != 0)
|
||||
continue;
|
||||
argv[j++] = strdup(CMD_ARGV[i]);
|
||||
break;
|
||||
}
|
||||
if (!t) {
|
||||
LOG_ERROR("no such transport '%s'", CMD_ARGV[i]);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
*vector = argv;
|
||||
return ERROR_OK;
|
||||
|
||||
fail:
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
free(argv[i]);
|
||||
free(argv);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_transport_init)
|
||||
{
|
||||
LOG_DEBUG("%s", __func__);
|
||||
|
||||
@@ -77,8 +77,6 @@ struct transport *get_current_transport(void);
|
||||
|
||||
int transport_register_commands(struct command_context *ctx);
|
||||
|
||||
COMMAND_HELPER(transport_list_parse, char ***vector);
|
||||
|
||||
int allow_transports(struct command_context *ctx, const char * const *vector);
|
||||
|
||||
bool transport_is_jtag(void);
|
||||
|
||||
Reference in New Issue
Block a user