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;
}
-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:
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;
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)
{
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))
{
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;
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 "
}
-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)
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;
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;
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;