remove register_callbacks from jtag interface
Changes the jtag_interface->register_callbacks field to a list of commands to be registered. Changes callback to invocation of register_commands() with that command registration list. Removes all JTAG interface driver register_command callback functions, which the previous commits had converted into identical calls.__archive__
parent
fc2d9f8761
commit
8d46720cda
|
@ -558,14 +558,9 @@ static const struct command_registration amtjtagaccel_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int amt_jtagaccel_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, amtjtagaccel_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface amt_jtagaccel_interface = {
|
struct jtag_interface amt_jtagaccel_interface = {
|
||||||
.name = "amt_jtagaccel",
|
.name = "amt_jtagaccel",
|
||||||
.register_commands = &amt_jtagaccel_register_commands,
|
.commands = amtjtagaccel_command_handlers,
|
||||||
.init = &amt_jtagaccel_init,
|
.init = &amt_jtagaccel_init,
|
||||||
.quit = &amt_jtagaccel_quit,
|
.quit = &amt_jtagaccel_quit,
|
||||||
.speed = &amt_jtagaccel_speed,
|
.speed = &amt_jtagaccel_speed,
|
||||||
|
|
|
@ -512,17 +512,15 @@ static const struct command_registration armjtagew_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int armjtagew_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, armjtagew_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface armjtagew_interface = {
|
struct jtag_interface armjtagew_interface = {
|
||||||
.name = "arm-jtag-ew",
|
.name = "arm-jtag-ew",
|
||||||
|
|
||||||
|
.commands = armjtagew_command_handlers,
|
||||||
|
|
||||||
.execute_queue = &armjtagew_execute_queue,
|
.execute_queue = &armjtagew_execute_queue,
|
||||||
.speed = &armjtagew_speed,
|
.speed = &armjtagew_speed,
|
||||||
.khz = &armjtagew_khz,
|
.khz = &armjtagew_khz,
|
||||||
.register_commands = &armjtagew_register_commands,
|
|
||||||
.init = &armjtagew_init,
|
.init = &armjtagew_init,
|
||||||
.quit = &armjtagew_quit,
|
.quit = &armjtagew_quit,
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,11 +134,6 @@ static int dummy_speed(int speed)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dummy_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dummy_init(void)
|
static int dummy_init(void)
|
||||||
{
|
{
|
||||||
bitbang_interface = &dummy_bitbang;
|
bitbang_interface = &dummy_bitbang;
|
||||||
|
@ -160,7 +155,6 @@ struct jtag_interface dummy_interface = {
|
||||||
.execute_queue = &bitbang_execute_queue,
|
.execute_queue = &bitbang_execute_queue,
|
||||||
|
|
||||||
.speed = &dummy_speed,
|
.speed = &dummy_speed,
|
||||||
.register_commands = &dummy_register_commands,
|
|
||||||
.khz = &dummy_khz,
|
.khz = &dummy_khz,
|
||||||
.speed_div = &dummy_speed_div,
|
.speed_div = &dummy_speed_div,
|
||||||
|
|
||||||
|
|
|
@ -4009,15 +4009,9 @@ static const struct command_registration ft2232_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ft2232_register_commands(struct command_context* cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, ft2232_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct jtag_interface ft2232_interface = {
|
struct jtag_interface ft2232_interface = {
|
||||||
.name = "ft2232",
|
.name = "ft2232",
|
||||||
.register_commands = &ft2232_register_commands,
|
.commands = ft2232_command_handlers,
|
||||||
.init = &ft2232_init,
|
.init = &ft2232_init,
|
||||||
.quit = &ft2232_quit,
|
.quit = &ft2232_quit,
|
||||||
.speed = &ft2232_speed,
|
.speed = &ft2232_speed,
|
||||||
|
|
|
@ -573,14 +573,9 @@ static const struct command_registration gw16012_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int gw16012_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, gw16012_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface gw16012_interface = {
|
struct jtag_interface gw16012_interface = {
|
||||||
.name = "gw16012",
|
.name = "gw16012",
|
||||||
.register_commands = &gw16012_register_commands,
|
.commands = gw16012_command_handlers,
|
||||||
.init = &gw16012_init,
|
.init = &gw16012_init,
|
||||||
.quit = &gw16012_quit,
|
.quit = &gw16012_quit,
|
||||||
.speed = &gw16012_speed,
|
.speed = &gw16012_speed,
|
||||||
|
|
|
@ -204,10 +204,8 @@ struct jtag_interface {
|
||||||
/**
|
/**
|
||||||
* The interface driver may register additional commands to expose
|
* The interface driver may register additional commands to expose
|
||||||
* additional features not covered by the standard command set.
|
* additional features not covered by the standard command set.
|
||||||
* @param cmd_ctx The context in which commands should be registered.
|
|
||||||
* @returns ERROR_OK on success, or an error code on failure.
|
|
||||||
*/
|
*/
|
||||||
int (*register_commands)(struct command_context* cmd_ctx);
|
const struct command_registration *commands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface driver must initalize any resources and connect to a
|
* Interface driver must initalize any resources and connect to a
|
||||||
|
|
|
@ -644,18 +644,16 @@ static const struct command_registration jlink_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int jlink_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, jlink_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface jlink_interface = {
|
struct jtag_interface jlink_interface = {
|
||||||
.name = "jlink",
|
.name = "jlink",
|
||||||
|
|
||||||
|
.commands = jlink_command_handlers,
|
||||||
|
|
||||||
.execute_queue = &jlink_execute_queue,
|
.execute_queue = &jlink_execute_queue,
|
||||||
.speed = &jlink_speed,
|
.speed = &jlink_speed,
|
||||||
.speed_div = &jlink_speed_div,
|
.speed_div = &jlink_speed_div,
|
||||||
.khz = &jlink_khz,
|
.khz = &jlink_khz,
|
||||||
.register_commands = &jlink_register_commands,
|
|
||||||
.init = &jlink_init,
|
.init = &jlink_init,
|
||||||
.quit = &jlink_quit,
|
.quit = &jlink_quit,
|
||||||
};
|
};
|
||||||
|
|
|
@ -517,19 +517,17 @@ static const struct command_registration parport_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int parport_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, parport_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface parport_interface = {
|
struct jtag_interface parport_interface = {
|
||||||
.name = "parport",
|
.name = "parport",
|
||||||
.register_commands = parport_register_commands,
|
|
||||||
.init = parport_init,
|
.commands = parport_command_handlers,
|
||||||
.quit = parport_quit,
|
|
||||||
.khz = parport_khz,
|
.init = &parport_init,
|
||||||
.speed_div = parport_speed_div,
|
.quit = &parport_quit,
|
||||||
.speed = parport_speed,
|
|
||||||
.execute_queue = bitbang_execute_queue,
|
.khz = &parport_khz,
|
||||||
};
|
.speed_div = &parport_speed_div,
|
||||||
|
.speed = &parport_speed,
|
||||||
|
|
||||||
|
.execute_queue = &bitbang_execute_queue,
|
||||||
|
};
|
||||||
|
|
|
@ -750,11 +750,6 @@ static const struct command_registration presto_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int presto_jtag_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, presto_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int presto_jtag_init(void)
|
static int presto_jtag_init(void)
|
||||||
{
|
{
|
||||||
if (presto_open(presto_serial) != ERROR_OK)
|
if (presto_open(presto_serial) != ERROR_OK)
|
||||||
|
@ -792,11 +787,14 @@ static int presto_jtag_quit(void)
|
||||||
|
|
||||||
struct jtag_interface presto_interface = {
|
struct jtag_interface presto_interface = {
|
||||||
.name = "presto",
|
.name = "presto",
|
||||||
|
|
||||||
|
.commands = presto_command_handlers,
|
||||||
|
|
||||||
.execute_queue = &bitq_execute_queue,
|
.execute_queue = &bitq_execute_queue,
|
||||||
.speed = &presto_jtag_speed,
|
.speed = &presto_jtag_speed,
|
||||||
.khz = &presto_jtag_khz,
|
.khz = &presto_jtag_khz,
|
||||||
.speed_div = &presto_jtag_speed_div,
|
.speed_div = &presto_jtag_speed_div,
|
||||||
.register_commands = &presto_jtag_register_commands,
|
|
||||||
.init = &presto_jtag_init,
|
.init = &presto_jtag_init,
|
||||||
.quit = &presto_jtag_quit,
|
.quit = &presto_jtag_quit,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1568,49 +1568,6 @@ int rlink_khz(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static
|
|
||||||
int
|
|
||||||
handle_dtc_directory_command(
|
|
||||||
struct command_context *cmd_ctx,
|
|
||||||
char *cmd,
|
|
||||||
char **args,
|
|
||||||
int argc
|
|
||||||
) {
|
|
||||||
if (argc != 1) {
|
|
||||||
LOG_ERROR("expected exactly one argument to rlink_dtc_directory <directory-path>");
|
|
||||||
return(ERROR_INVALID_ARGUMENTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("handle_dtc_directory_command called with \"%s\"\n", args[0]);
|
|
||||||
|
|
||||||
return(ERROR_OK);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
int rlink_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef _DEBUG_JTAG_IO_
|
|
||||||
LOG_DEBUG("rlink_register_commands called with cmd_ctx=%p\n", cmd_ctx);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
register_command(
|
|
||||||
cmd_ctx, NULL,
|
|
||||||
"rlink_dtc_directory",
|
|
||||||
handle_dtc_directory_command,
|
|
||||||
COMMAND_CONFIG,
|
|
||||||
"The directory in which to search for DTC load images"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int rlink_init(void)
|
int rlink_init(void)
|
||||||
{
|
{
|
||||||
|
@ -1848,7 +1805,6 @@ struct jtag_interface rlink_interface =
|
||||||
.name = "rlink",
|
.name = "rlink",
|
||||||
.init = rlink_init,
|
.init = rlink_init,
|
||||||
.quit = rlink_quit,
|
.quit = rlink_quit,
|
||||||
.register_commands = rlink_register_commands,
|
|
||||||
.speed = rlink_speed,
|
.speed = rlink_speed,
|
||||||
.speed_div = rlink_speed_div,
|
.speed_div = rlink_speed_div,
|
||||||
.khz = rlink_khz,
|
.khz = rlink_khz,
|
||||||
|
|
|
@ -636,9 +636,10 @@ COMMAND_HANDLER(handle_interface_command)
|
||||||
if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0)
|
if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (NULL != jtag_interfaces[i]->register_commands)
|
if (NULL != jtag_interfaces[i]->commands)
|
||||||
{
|
{
|
||||||
int retval = jtag_interfaces[i]->register_commands(CMD_CTX);
|
int retval = register_commands(CMD_CTX, NULL,
|
||||||
|
jtag_interfaces[i]->commands);
|
||||||
if (ERROR_OK != retval)
|
if (ERROR_OK != retval)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1890,14 +1890,10 @@ static const struct command_registration vsllink_command_handlers[] = {
|
||||||
COMMAND_REGISTRATION_DONE
|
COMMAND_REGISTRATION_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vsllink_register_commands(struct command_context *cmd_ctx)
|
|
||||||
{
|
|
||||||
return register_commands(cmd_ctx, NULL, vsllink_command_handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct jtag_interface vsllink_interface = {
|
struct jtag_interface vsllink_interface = {
|
||||||
.name = "vsllink",
|
.name = "vsllink",
|
||||||
.register_commands = &vsllink_register_commands,
|
.commands = vsllink_command_handlers,
|
||||||
|
|
||||||
.init = &vsllink_init,
|
.init = &vsllink_init,
|
||||||
.quit = &vsllink_quit,
|
.quit = &vsllink_quit,
|
||||||
.khz = &vsllink_khz,
|
.khz = &vsllink_khz,
|
||||||
|
|
Loading…
Reference in New Issue