Commit 833e7f52 authored by Zachary T Welch's avatar Zachary T Welch
Browse files

use COMMAND_REGISTER macro

Replaces direct calls to register_command() with a macro, to allow
its parameters to be changed and callers updated in phases.
parent f7e1f2df
......@@ -908,7 +908,7 @@ struct command_context* command_init(const char *startup_tcl)
interp->cb_fflush = openocd_jim_fflush;
interp->cb_fgets = openocd_jim_fgets;
register_command(context, NULL, "add_help_text",
COMMAND_REGISTER(context, NULL, "add_help_text",
handle_help_add_command, COMMAND_ANY,
"<command> [...] <help_text>] - "
"add new command help text");
......@@ -925,12 +925,12 @@ struct command_context* command_init(const char *startup_tcl)
}
Jim_DeleteAssocData(interp, "context");
register_command(context, NULL, "sleep",
COMMAND_REGISTER(context, NULL, "sleep",
handle_sleep_command, COMMAND_ANY,
"<n> [busy] - sleep for n milliseconds. "
"\"busy\" means busy wait");
register_command(context, NULL, "help",
COMMAND_REGISTER(context, NULL, "help",
&handle_help_command, COMMAND_ANY,
"[<command_name> ...] - show built-in command help");
......
......@@ -647,22 +647,22 @@ static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc,
int ioutil_init(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
COMMAND_REGISTER(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
"remove file");
register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
COMMAND_REGISTER(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
"display file content");
register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
COMMAND_REGISTER(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
"truncate a file to 0 size");
register_command(cmd_ctx, NULL, "cp", handle_cp_command,
COMMAND_REGISTER(cmd_ctx, NULL, "cp", handle_cp_command,
COMMAND_ANY, "copy a file <from> <to>");
register_command(cmd_ctx, NULL, "append_file", handle_append_command,
COMMAND_REGISTER(cmd_ctx, NULL, "append_file", handle_append_command,
COMMAND_ANY, "append a variable number of strings to a file");
register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
COMMAND_REGISTER(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
COMMAND_ANY, "display available ram memory");
Jim_CreateCommand(interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL);
......
......@@ -319,9 +319,9 @@ COMMAND_HANDLER(handle_log_output_command)
int log_register_commands(struct command_context *cmd_ctx)
{
start = timeval_ms();
register_command(cmd_ctx, NULL, "log_output", handle_log_output_command,
COMMAND_REGISTER(cmd_ctx, NULL, "log_output", handle_log_output_command,
COMMAND_ANY, "redirect logging to <file> (default: stderr)");
register_command(cmd_ctx, NULL, "debug_level", handle_debug_level_command,
COMMAND_REGISTER(cmd_ctx, NULL, "debug_level", handle_debug_level_command,
COMMAND_ANY, "adjust debug level <0-3>");
return ERROR_OK;
......
......@@ -542,10 +542,10 @@ COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command)
static int amt_jtagaccel_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_port",
amt_jtagaccel_handle_parport_port_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "rtck",
COMMAND_REGISTER(cmd_ctx, NULL, "rtck",
amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG,
NULL);
......
......@@ -504,7 +504,7 @@ COMMAND_HANDLER(armjtagew_handle_armjtagew_info_command)
static int armjtagew_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "armjtagew_info",
COMMAND_REGISTER(cmd_ctx, NULL, "armjtagew_info",
&armjtagew_handle_armjtagew_info_command, COMMAND_EXEC,
"query armjtagew info");
return ERROR_OK;
......
......@@ -202,7 +202,7 @@ static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, cha
static int at91rm9200_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command,
COMMAND_REGISTER(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
......
......@@ -3971,20 +3971,20 @@ static void ktlink_blink(void)
static int ft2232_register_commands(struct command_context* cmd_ctx)
{
register_command(cmd_ctx, NULL, "ft2232_device_desc",
COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_device_desc",
ft2232_handle_device_desc_command, COMMAND_CONFIG,
"the USB device description of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_serial",
COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_serial",
ft2232_handle_serial_command, COMMAND_CONFIG,
"the serial number of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_layout",
COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_layout",
ft2232_handle_layout_command, COMMAND_CONFIG,
"the layout of the FT2232 GPIO signals used "
"to control output-enables and reset signals");
register_command(cmd_ctx, NULL, "ft2232_vid_pid",
COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_vid_pid",
ft2232_handle_vid_pid_command, COMMAND_CONFIG,
"the vendor ID and product ID of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_latency",
COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_latency",
ft2232_handle_latency_command, COMMAND_CONFIG,
"set the FT2232 latency timer to a new value");
......
......@@ -564,7 +564,7 @@ COMMAND_HANDLER(gw16012_handle_parport_port_command)
static int gw16012_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_port",
gw16012_handle_parport_port_command, COMMAND_CONFIG,
NULL);
......
......@@ -630,10 +630,10 @@ COMMAND_HANDLER(jlink_handle_jlink_hw_jtag_command)
static int jlink_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "jlink_info",
COMMAND_REGISTER(cmd_ctx, NULL, "jlink_info",
&jlink_handle_jlink_info_command, COMMAND_EXEC,
"query jlink info");
register_command(cmd_ctx, NULL, "jlink_hw_jtag",
COMMAND_REGISTER(cmd_ctx, NULL, "jlink_hw_jtag",
&jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC,
"set/get jlink hw jtag command version [2 | 3]");
return ERROR_OK;
......
......@@ -484,22 +484,22 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
static int parport_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "parport_port",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_port",
parport_handle_parport_port_command, COMMAND_CONFIG,
"either the address of the I/O port "
"or the number of the '/dev/parport' device");
register_command(cmd_ctx, NULL, "parport_cable",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_cable",
parport_handle_parport_cable_command, COMMAND_CONFIG,
"the layout of the parallel port cable "
"used to connect to the target");
register_command(cmd_ctx, NULL, "parport_write_on_exit",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_write_on_exit",
parport_handle_write_on_exit_command, COMMAND_CONFIG,
"configure the parallel driver to write "
"a known value to the parallel interface");
register_command(cmd_ctx, NULL, "parport_toggling_time",
COMMAND_REGISTER(cmd_ctx, NULL, "parport_toggling_time",
parport_handle_parport_toggling_time_command, COMMAND_ANY,
"time <ns> it takes for the hardware to toggle TCK");
......
......@@ -741,7 +741,7 @@ COMMAND_HANDLER(presto_handle_serial_command)
static int presto_jtag_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command,
COMMAND_REGISTER(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command,
COMMAND_CONFIG, NULL);
return ERROR_OK;
}
......
......@@ -1418,21 +1418,21 @@ int jtag_register_commands(struct command_context *cmd_ctx)
register_jim(cmd_ctx, "jtag", jim_jtag_command,
"perform jtag tap actions");
register_command(cmd_ctx, NULL, "interface",
COMMAND_REGISTER(cmd_ctx, NULL, "interface",
handle_interface_command, COMMAND_CONFIG,
"try to configure interface");
register_command(cmd_ctx, NULL, "interface_list",
COMMAND_REGISTER(cmd_ctx, NULL, "interface_list",
&handle_interface_list_command, COMMAND_ANY,
"list all built-in interfaces");
register_command(cmd_ctx, NULL, "jtag_khz",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_khz",
handle_jtag_khz_command, COMMAND_ANY,
"set maximum jtag speed (if supported); "
"parameter is maximum khz, or 0 for adaptive clocking (RTCK).");
register_command(cmd_ctx, NULL, "jtag_rclk",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_rclk",
handle_jtag_rclk_command, COMMAND_ANY,
"fallback_speed_khz - set JTAG speed to RCLK or use fallback speed");
register_command(cmd_ctx, NULL, "reset_config",
COMMAND_REGISTER(cmd_ctx, NULL, "reset_config",
handle_reset_config_command, COMMAND_ANY,
"reset_config "
"[none|trst_only|srst_only|trst_and_srst] "
......@@ -1441,35 +1441,35 @@ int jtag_register_commands(struct command_context *cmd_ctx)
"[trst_push_pull|trst_open_drain] "
"[srst_push_pull|srst_open_drain]");
register_command(cmd_ctx, NULL, "jtag_nsrst_delay",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_nsrst_delay",
handle_jtag_nsrst_delay_command, COMMAND_ANY,
"jtag_nsrst_delay <ms> "
"- delay after deasserting srst in ms");
register_command(cmd_ctx, NULL, "jtag_ntrst_delay",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_ntrst_delay",
handle_jtag_ntrst_delay_command, COMMAND_ANY,
"jtag_ntrst_delay <ms> "
"- delay after deasserting trst in ms");
register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_nsrst_assert_width",
handle_jtag_nsrst_assert_width_command, COMMAND_ANY,
"jtag_nsrst_assert_width <ms> "
"- delay after asserting srst in ms");
register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_ntrst_assert_width",
handle_jtag_ntrst_assert_width_command, COMMAND_ANY,
"jtag_ntrst_assert_width <ms> "
"- delay after asserting trst in ms");
register_command(cmd_ctx, NULL, "scan_chain",
COMMAND_REGISTER(cmd_ctx, NULL, "scan_chain",
handle_scan_chain_command, COMMAND_EXEC,
"print current scan chain configuration");
register_command(cmd_ctx, NULL, "jtag_reset",
COMMAND_REGISTER(cmd_ctx, NULL, "jtag_reset",
handle_jtag_reset_command, COMMAND_EXEC,
"toggle reset lines <trst> <srst>");
register_command(cmd_ctx, NULL, "runtest",
COMMAND_REGISTER(cmd_ctx, NULL, "runtest",
handle_runtest_command, COMMAND_EXEC,
"move to Run-Test/Idle, and execute <num_cycles>");
register_command(cmd_ctx, NULL, "irscan",
COMMAND_REGISTER(cmd_ctx, NULL, "irscan",
handle_irscan_command, COMMAND_EXEC,
"execute IR scan <device> <instr> [dev2] [instr2] ...");
......@@ -1484,14 +1484,14 @@ int jtag_register_commands(struct command_context *cmd_ctx)
"<state1>,<state2>,<state3>... "
"- move JTAG to state1 then to state2, state3, etc.");
register_command(cmd_ctx, NULL, "verify_ircapture",
COMMAND_REGISTER(cmd_ctx, NULL, "verify_ircapture",
handle_verify_ircapture_command, COMMAND_ANY,
"verify value captured during Capture-IR <enable | disable>");
register_command(cmd_ctx, NULL, "verify_jtag",
COMMAND_REGISTER(cmd_ctx, NULL, "verify_jtag",
handle_verify_jtag_command, COMMAND_ANY,
"verify value capture <enable | disable>");
register_command(cmd_ctx, NULL, "tms_sequence",
COMMAND_REGISTER(cmd_ctx, NULL, "tms_sequence",
handle_tms_sequence_command, COMMAND_ANY,
"choose short(default) or long tms_sequence <short | long>");
......
......@@ -1858,22 +1858,22 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length)
static int vsllink_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "vsllink_usb_vid",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_vid",
vsllink_handle_usb_vid_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "vsllink_usb_pid",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_pid",
vsllink_handle_usb_pid_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "vsllink_usb_bulkin",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkin",
vsllink_handle_usb_bulkin_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "vsllink_usb_bulkout",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkout",
vsllink_handle_usb_bulkout_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "vsllink_usb_interface",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_interface",
vsllink_handle_usb_interface_command, COMMAND_CONFIG,
NULL);
register_command(cmd_ctx, NULL, "vsllink_mode",
COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_mode",
vsllink_handle_mode_command, COMMAND_CONFIG,
NULL);
......
......@@ -372,7 +372,7 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp,
int zy1000_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
COMMAND_REGISTER(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
"power <on/off> - turn power switch to target on/off. No arguments - print status.");
Jim_CreateCommand(interp, "zy1000_version", jim_zy1000_version, NULL, NULL);
......
......@@ -171,7 +171,7 @@ struct command_context *setup_command_handler(void)
global_cmd_ctx = cmd_ctx = command_init(openocd_startup_tcl);
register_command(cmd_ctx, NULL, "version", handle_version_command,
COMMAND_REGISTER(cmd_ctx, NULL, "version", handle_version_command,
COMMAND_EXEC, "show OpenOCD version");
/* register subsystem commands */
......@@ -198,7 +198,7 @@ struct command_context *setup_command_handler(void)
LOG_OUTPUT(OPENOCD_VERSION "\n");
register_command(cmd_ctx, NULL, "init", handle_init_command,
COMMAND_REGISTER(cmd_ctx, NULL, "init", handle_init_command,
COMMAND_ANY, "initializes target and servers - nop on subsequent invocations");
return cmd_ctx;
......
......@@ -189,10 +189,10 @@ int pld_init(struct command_context *cmd_ctx)
if (!pld_devices)
return ERROR_OK;
register_command(cmd_ctx, pld_cmd, "devices",
COMMAND_REGISTER(cmd_ctx, pld_cmd, "devices",
handle_pld_devices_command, COMMAND_EXEC,
"list configured pld devices");
register_command(cmd_ctx, pld_cmd, "load",
COMMAND_REGISTER(cmd_ctx, pld_cmd, "load",
handle_pld_load_command, COMMAND_EXEC,
"load configuration <file> into programmable logic device");
......@@ -201,9 +201,9 @@ int pld_init(struct command_context *cmd_ctx)
int pld_register_commands(struct command_context *cmd_ctx)
{
pld_cmd = register_command(cmd_ctx, NULL, "pld", NULL, COMMAND_ANY, "programmable logic device commands");
pld_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "pld", NULL, COMMAND_ANY, "programmable logic device commands");
register_command(cmd_ctx, pld_cmd, "device", handle_pld_device_command, COMMAND_CONFIG, NULL);
COMMAND_REGISTER(cmd_ctx, pld_cmd, "device", handle_pld_device_command, COMMAND_CONFIG, NULL);
return ERROR_OK;
}
......@@ -235,10 +235,10 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command)
static int virtex2_register_commands(struct command_context *cmd_ctx)
{
struct command *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2",
struct command *virtex2_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "virtex2",
NULL, COMMAND_ANY, "virtex2 specific commands");
register_command(cmd_ctx, virtex2_cmd, "read_stat",
COMMAND_REGISTER(cmd_ctx, virtex2_cmd, "read_stat",
&virtex2_handle_read_stat_command, COMMAND_EXEC,
"read Virtex-II status register");
......
......@@ -2328,23 +2328,23 @@ COMMAND_HANDLER(handle_gdb_breakpoint_override_command)
int gdb_register_commands(struct command_context *command_context)
{
register_command(command_context, NULL, "gdb_sync",
COMMAND_REGISTER(command_context, NULL, "gdb_sync",
handle_gdb_sync_command, COMMAND_ANY,
"next stepi will return immediately allowing GDB to "
"fetch register state without affecting target state");
register_command(command_context, NULL, "gdb_port",
COMMAND_REGISTER(command_context, NULL, "gdb_port",
handle_gdb_port_command, COMMAND_ANY,
"daemon configuration command gdb_port");
register_command(command_context, NULL, "gdb_memory_map",
COMMAND_REGISTER(command_context, NULL, "gdb_memory_map",
handle_gdb_memory_map_command, COMMAND_CONFIG,
"enable or disable memory map");
register_command(command_context, NULL, "gdb_flash_program",
COMMAND_REGISTER(command_context, NULL, "gdb_flash_program",
handle_gdb_flash_program_command, COMMAND_CONFIG,
"enable or disable flash program");
register_command(command_context, NULL, "gdb_report_data_abort",
COMMAND_REGISTER(command_context, NULL, "gdb_report_data_abort",
handle_gdb_report_data_abort_command, COMMAND_CONFIG,
"enable or disable reporting data aborts");
register_command(command_context, NULL, "gdb_breakpoint_override",
COMMAND_REGISTER(command_context, NULL, "gdb_breakpoint_override",
handle_gdb_breakpoint_override_command, COMMAND_EXEC,
"hard/soft/disable - force type of breakpoint "
"used by gdb 'break' commands.");
......
......@@ -541,7 +541,7 @@ COMMAND_HANDLER(handle_shutdown_command)
int server_register_commands(struct command_context *context)
{
register_command(context, NULL, "shutdown",
COMMAND_REGISTER(context, NULL, "shutdown",
handle_shutdown_command, COMMAND_ANY,
"shut the server down");
......
......@@ -177,7 +177,7 @@ COMMAND_HANDLER(handle_tcl_port_command)
int tcl_register_commands(struct command_context *cmd_ctx)
{
register_command(cmd_ctx, NULL, "tcl_port",
COMMAND_REGISTER(cmd_ctx, NULL, "tcl_port",
handle_tcl_port_command, COMMAND_CONFIG,
"port on which to listen for incoming TCL syntax");
return ERROR_OK;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment