aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 03:12:21 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:51:45 -0800
commit63a26b421b1731df5826a157ea633b9d2c02aaee (patch)
tree08697690015b3f09bf22b10fcd10599af15a4041 /src
parentcfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e (diff)
downloadriscv-openocd-63a26b421b1731df5826a157ea633b9d2c02aaee.zip
riscv-openocd-63a26b421b1731df5826a157ea633b9d2c02aaee.tar.gz
riscv-openocd-63a26b421b1731df5826a157ea633b9d2c02aaee.tar.bz2
use COMMAND_HELPER for command helper functions
Define the numerous helpers that inherit command handler parameters using the COMMAND_HELPER macro.
Diffstat (limited to 'src')
-rw-r--r--src/jtag/parport.c4
-rw-r--r--src/server/server.c3
-rw-r--r--src/server/server.h12
-rw-r--r--src/target/arm11.c5
-rw-r--r--src/target/etm.c7
-rw-r--r--src/target/target.c9
6 files changed, 21 insertions, 19 deletions
diff --git a/src/jtag/parport.c b/src/jtag/parport.c
index cee7a16..a18b3f6 100644
--- a/src/jtag/parport.c
+++ b/src/jtag/parport.c
@@ -462,9 +462,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command)
return ERROR_OK;
}
-static int
-parport_handle_parport_toggling_time_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc)
+COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
{
if (argc == 1) {
uint32_t ns;
diff --git a/src/server/server.c b/src/server/server.c
index c000b7c..ada0a60 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -551,8 +551,7 @@ int server_register_commands(command_context_t *context)
}
-int server_port_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc, unsigned short *out)
+SERVER_PORT_COMMAND()
{
switch (argc) {
case 0:
diff --git a/src/server/server.h b/src/server/server.h
index d4f1b6b..abb501d 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -81,8 +81,16 @@ int server_loop(command_context_t *command_context);
int server_register_commands(command_context_t *context);
-int server_port_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc, unsigned short *port);
+/**
+ * Defines an extended command handler function declaration to enable
+ * access to (and manipulation of) the server port number.
+ * Call server_port like a normal COMMAND_HANDLER with an extra @a out parameter
+ * to receive the specified port number.
+ */
+#define SERVER_PORT_COMMAND() \
+ COMMAND_HELPER(server_port_command, unsigned short *out)
+
+SERVER_PORT_COMMAND();
extern int server_use_pipes;
diff --git a/src/target/arm11.c b/src/target/arm11.c
index 098b0af..949c947 100644
--- a/src/target/arm11.c
+++ b/src/target/arm11.c
@@ -1991,8 +1991,7 @@ static int arm11_build_reg_cache(target_t *target)
return ERROR_OK;
}
-static int arm11_handle_bool(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc, bool * var, char * name)
+static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name)
{
if (argc == 0)
{
@@ -2143,7 +2142,7 @@ static int arm11_mcr(target_t *target, int cpnum,
return arm11_mrc_inner(target, cpnum, op1, op2, CRn, CRm, &value, false);
}
-static int arm11_handle_etm_read_write(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, bool read)
+static COMMAND_HELPER(arm11_handle_etm_read_write, bool read)
{
if (argc != (read ? 2 : 3))
{
diff --git a/src/target/etm.c b/src/target/etm.c
index 0fc9249..df02904 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1176,9 +1176,8 @@ static int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd
return ERROR_OK;
}
-static int handle_etm_tracemode_command_update(
- struct command_context_s *cmd_ctx,
- char **args, etmv1_tracemode_t *mode)
+static COMMAND_HELPER(handle_etm_tracemode_command_update,
+ etmv1_tracemode_t *mode)
{
etmv1_tracemode_t tracemode;
@@ -1272,7 +1271,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
case 0:
break;
case 4:
- handle_etm_tracemode_command_update(cmd_ctx, args, &tracemode);
+ handle_etm_tracemode_command_update(cmd_ctx, cmd, args, argc, &tracemode);
break;
default:
command_print(cmd_ctx, "usage: configure trace mode "
diff --git a/src/target/target.c b/src/target/target.c
index 401f4df..26c20cf 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2363,8 +2363,7 @@ COMMAND_HANDLER(handle_mw_command)
}
-static int parse_load_image_command_args(struct command_context_s *cmd_ctx,
- char **args, int argc, image_t *image,
+static COMMAND_HELPER(parse_load_image_command_args, image_t *image,
uint32_t *min_address, uint32_t *max_address)
{
if (argc < 1 || argc > 5)
@@ -2411,7 +2410,7 @@ COMMAND_HANDLER(handle_load_image_command)
int i;
image_t image;
- int retval = parse_load_image_command_args(cmd_ctx, args, argc,
+ int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
@@ -2555,7 +2554,7 @@ COMMAND_HANDLER(handle_dump_image_command)
return retval;
}
-static int handle_verify_image_command_internal(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, int verify)
+static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
{
uint8_t *buffer;
uint32_t buf_cnt;
@@ -4548,7 +4547,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
image_t image;
- int retval = parse_load_image_command_args(cmd_ctx, args, argc,
+ int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;