summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 22:23:07 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:51:46 -0800
commit5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87 (patch)
tree50cd2c3812b1b585301e66fa4cd1fcc84e357539 /src
parent1df5cc18f51366b823bccdaec4ffa1ee3fac2447 (diff)
downloadopenocd_libswd-5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87.tar.gz
openocd_libswd-5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87.tar.bz2
openocd_libswd-5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87.tar.xz
openocd_libswd-5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87.zip
use CALL_COMMAND_HANDLER instead of direct calls
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or even removed in inherited signatures, without requiring revisiting all of the various call sites.
Diffstat (limited to 'src')
-rw-r--r--src/flash/flash.c3
-rw-r--r--src/flash/nand.c3
-rw-r--r--src/jtag/tcl.c2
-rw-r--r--src/pld/pld.c3
-rw-r--r--src/server/gdb_server.c2
-rw-r--r--src/server/tcl_server.c2
-rw-r--r--src/server/telnet_server.c2
-rw-r--r--src/target/arm11.c7
-rw-r--r--src/target/etm.c2
-rw-r--r--src/target/target.c10
10 files changed, 20 insertions, 16 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index d3889b9b..da43e1a8 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -259,7 +259,8 @@ COMMAND_HANDLER(handle_flash_bank_command)
c->sectors = NULL;
c->next = NULL;
- if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
+ retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c);
+ if (ERROR_OK != retval)
{
LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
free(c);
diff --git a/src/flash/nand.c b/src/flash/nand.c
index 181700d0..88d3e42c 100644
--- a/src/flash/nand.c
+++ b/src/flash/nand.c
@@ -241,7 +241,8 @@ COMMAND_HANDLER(handle_nand_device_command)
c->use_raw = 0;
c->next = NULL;
- if ((retval = nand_flash_controllers[i]->nand_device_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
+ retval = CALL_COMMAND_HANDLER(nand_flash_controllers[i]->nand_device_command, c);
+ if (ERROR_OK != retval)
{
LOG_ERROR("'%s' driver rejected nand flash", c->controller->name);
free(c);
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 653d3a7e..4da8838d 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -658,7 +658,7 @@ COMMAND_HANDLER(handle_interface_command)
* didn't match one of the compiled-in interfaces
*/
LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]);
- handle_interface_list_command(cmd_ctx, cmd, args, argc);
+ CALL_COMMAND_HANDLER(handle_interface_list_command);
return ERROR_JTAG_INVALID_INTERFACE;
}
diff --git a/src/pld/pld.c b/src/pld/pld.c
index c20b936c..e8cd075e 100644
--- a/src/pld/pld.c
+++ b/src/pld/pld.c
@@ -85,7 +85,8 @@ COMMAND_HANDLER(handle_pld_device_command)
c->driver = pld_drivers[i];
c->next = NULL;
- if (pld_drivers[i]->pld_device_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK)
+ int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c);
+ if (ERROR_OK != retval)
{
LOG_ERROR("'%s' driver rejected pld device", args[0]);
free(c);
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index c0c5d775..761ae406 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2271,7 +2271,7 @@ COMMAND_HANDLER(handle_gdb_sync_command)
/* daemon configuration command gdb_port */
COMMAND_HANDLER(handle_gdb_port_command)
{
- return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port);
+ return CALL_COMMAND_HANDLER(server_port_command, &gdb_port);
}
COMMAND_HANDLER(handle_gdb_memory_map_command)
diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c
index 3410ca91..c8da5bca 100644
--- a/src/server/tcl_server.c
+++ b/src/server/tcl_server.c
@@ -172,7 +172,7 @@ int tcl_init(void)
COMMAND_HANDLER(handle_tcl_port_command)
{
- return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port);
+ return CALL_COMMAND_HANDLER(server_port_command, &tcl_port);
}
int tcl_register_commands(command_context_t *cmd_ctx)
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index c409ec0a..6cb47462 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -608,7 +608,7 @@ int telnet_init(char *banner)
/* daemon configuration command telnet_port */
COMMAND_HANDLER(handle_telnet_port_command)
{
- return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port);
+ return CALL_COMMAND_HANDLER(server_port_command, &telnet_port);
}
COMMAND_HANDLER(handle_exit_command)
diff --git a/src/target/arm11.c b/src/target/arm11.c
index 949c9475..5b11f8e0 100644
--- a/src/target/arm11.c
+++ b/src/target/arm11.c
@@ -2029,7 +2029,8 @@ static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name)
#define BOOL_WRAPPER(name, print_name) \
COMMAND_HANDLER(arm11_handle_bool_##name) \
{ \
- return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \
+ return CALL_COMMAND_HANDLER(arm11_handle_bool, \
+ &arm11_config_##name, print_name); \
}
BOOL_WRAPPER(memwrite_burst, "memory write burst mode")
@@ -2186,12 +2187,12 @@ static COMMAND_HELPER(arm11_handle_etm_read_write, bool read)
COMMAND_HANDLER(arm11_handle_etmr)
{
- return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true);
+ return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, true);
}
COMMAND_HANDLER(arm11_handle_etmw)
{
- return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false);
+ return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, false);
}
#define ARM11_HANDLER(x) .x = arm11_##x
diff --git a/src/target/etm.c b/src/target/etm.c
index df029042..a4ff6c5f 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1271,7 +1271,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
case 0:
break;
case 4:
- handle_etm_tracemode_command_update(cmd_ctx, cmd, args, argc, &tracemode);
+ CALL_COMMAND_HANDLER(handle_etm_tracemode_command_update, &tracemode);
break;
default:
command_print(cmd_ctx, "usage: configure trace mode "
diff --git a/src/target/target.c b/src/target/target.c
index 26c20cf3..21c0526f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2121,7 +2121,7 @@ COMMAND_HANDLER(handle_halt_command)
return ERROR_OK;
}
- return handle_wait_halt_command(cmd_ctx, cmd, args, argc);
+ return CALL_COMMAND_HANDLER(handle_wait_halt_command);
}
COMMAND_HANDLER(handle_soft_reset_halt_command)
@@ -2410,7 +2410,7 @@ COMMAND_HANDLER(handle_load_image_command)
int i;
image_t image;
- int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
@@ -2701,12 +2701,12 @@ done:
COMMAND_HANDLER(handle_verify_image_command)
{
- return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1);
+ return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1);
}
COMMAND_HANDLER(handle_test_image_command)
{
- return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0);
+ return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0);
}
static int handle_bp_command_list(struct command_context_s *cmd_ctx)
@@ -4547,7 +4547,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
image_t image;
- int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;