Remove misleading typedef and redundant suffix from struct command.
static int
sam3_register_commands(struct command_context *cmd_ctx)
{
- command_t *pCmd;
+ struct command *pCmd;
// only register once
if (!sam3_registered) {
static int at91sam7_register_commands(struct command_context *cmd_ctx)
{
- command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7",
+ struct command *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7",
NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, at91sam7_cmd, "gpnvm",
static int avrf_register_commands(struct command_context *cmd_ctx)
{
- command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr",
+ struct command *avr_cmd = register_command(cmd_ctx, NULL, "avr",
NULL, COMMAND_ANY, "avr flash specific commands");
register_command(cmd_ctx, avr_cmd, "mass_erase",
static int cfi_register_commands(struct command_context *cmd_ctx)
{
- /*command_t *cfi_cmd = */
+ /*struct command *cfi_cmd = */
register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, "flash bank cfi <base> <size> <chip_width> <bus_width> <targetNum> [jedec_probe/x16_as_x8]");
/*
register_command(cmd_ctx, cfi_cmd, "part_id", cfi_handle_part_id_command, COMMAND_EXEC,
};
struct flash_bank *flash_banks;
-static command_t *flash_cmd;
+static struct command *flash_cmd;
/* wafer thin wrapper for invoking the flash driver */
static int flash_driver_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
static int lpc2000_register_commands(struct command_context *cmd_ctx)
{
- command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000",
+ struct command *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000",
NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, lpc2000_cmd, "part_id",
*/
static int lpc2900_register_commands(struct command_context *cmd_ctx)
{
- command_t *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900",
+ struct command *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900",
NULL, COMMAND_ANY, NULL);
register_command(
static int lpc3180_register_commands(struct command_context *cmd_ctx)
{
- command_t *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers");
+ struct command *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers");
register_command(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)");
static int pxa270_set_gpio_to_output (struct mflash_gpio_num gpio);
static int pxa270_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val);
-static command_t *mflash_cmd;
+static struct command *mflash_cmd;
static struct mflash_bank *mflash_bank;
/* configured NAND devices and NAND Flash command handler */
static struct nand_device *nand_devices = NULL;
-static command_t *nand_cmd;
+static struct command *nand_cmd;
/* Chip ID list
*
static int pic32mx_register_commands(struct command_context *cmd_ctx)
{
- command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx",
+ struct command *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx",
NULL, COMMAND_ANY, "pic32mx flash specific commands");
#if 0
register_command(cmd_ctx, pic32mx_cmd, "lock",
static int stellaris_register_commands(struct command_context *cmd_ctx)
{
- command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris",
+ struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris",
NULL, COMMAND_ANY, "stellaris flash specific commands");
register_command(cmd_ctx, stm32x_cmd, "mass_erase",
static int stm32x_register_commands(struct command_context *cmd_ctx)
{
- command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x",
+ struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x",
NULL, COMMAND_ANY, "stm32x flash specific commands");
register_command(cmd_ctx, stm32x_cmd, "lock",
static int str7x_register_commands(struct command_context *cmd_ctx)
{
- command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x",
+ struct command *str7x_cmd = register_command(cmd_ctx, NULL, "str7x",
NULL, COMMAND_ANY, "str7x flash specific commands");
register_command(cmd_ctx, str7x_cmd, "disable_jtag",
static int str9x_register_commands(struct command_context *cmd_ctx)
{
- command_t *str9x_cmd = register_command(cmd_ctx, NULL, "str9x",
+ struct command *str9x_cmd = register_command(cmd_ctx, NULL, "str9x",
NULL, COMMAND_ANY, "str9x flash commands");
register_command(cmd_ctx, str9x_cmd, "flash_config",
static int str9xpec_register_commands(struct command_context *cmd_ctx)
{
- command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec",
+ struct command *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec",
NULL, COMMAND_ANY, "str9xpec flash specific commands");
register_command(cmd_ctx, str9xpec_cmd, "enable_turbo",
static int tms470_register_commands(struct command_context *cmd_ctx)
{
- command_t *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family");
+ struct command *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family");
register_command(cmd_ctx, tms470_cmd, "flash_keyset", tms470_handle_flash_keyset_command, COMMAND_ANY, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
register_command(cmd_ctx, tms470_cmd, "osc_megahertz", tms470_handle_osc_megahertz_command, COMMAND_ANY, "tms470 osc_megahertz <MHz>");
int hello_register_commands(struct command_context *cmd_ctx)
{
- struct command_s *cmd = register_command(cmd_ctx, NULL, "hello",
+ struct command *cmd = register_command(cmd_ctx, NULL, "hello",
&handle_hello_command, COMMAND_ANY,
"option");
return cmd ? ERROR_OK : -ENOMEM;
Jim_Interp *interp = NULL;
static int run_command(struct command_context *context,
- command_t *c, const char *words[], unsigned num_words);
+ struct command *c, const char *words[], unsigned num_words);
static void tcl_output(void *privData, const char *file, unsigned line,
const char *function, const char *string)
static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
/* the private data is stashed in the interp structure */
- command_t *c;
+ struct command *c;
struct command_context *context;
int retval;
int i;
return (retval == ERROR_OK)?JIM_OK:JIM_ERR;
}
-static Jim_Obj *command_name_list(struct command_s *c)
+static Jim_Obj *command_name_list(struct command *c)
{
Jim_Obj *cmd_list = c->parent ?
command_name_list(c->parent) :
* Find a command by name from a list of commands.
* @returns The named command if found, or NULL.
*/
-static struct command_s *command_find(struct command_s **head, const char *name)
+static struct command *command_find(struct command **head, const char *name)
{
assert(head);
- for (struct command_s *cc = *head; cc; cc = cc->next)
+ for (struct command *cc = *head; cc; cc = cc->next)
{
if (strcmp(cc->name, name) == 0)
return cc;
* @returns Returns false if the named command already exists in the list.
* Returns true otherwise.
*/
-static void command_add_child(struct command_s **head, struct command_s *c)
+static void command_add_child(struct command **head, struct command *c)
{
assert(head);
if (NULL == *head)
*head = c;
return;
}
- struct command_s *cc = *head;
+ struct command *cc = *head;
while (cc->next) cc = cc->next;
cc->next = c;
}
-command_t* register_command(struct command_context *context,
- command_t *parent, char *name, command_handler_t handler,
+struct command* register_command(struct command_context *context,
+ struct command *parent, char *name, command_handler_t handler,
enum command_mode mode, char *help)
{
if (!context || !name)
return NULL;
- struct command_s **head = parent ? &parent->children : &context->commands;
- struct command_s *c = command_find(head, name);
+ struct command **head = parent ? &parent->children : &context->commands;
+ struct command *c = command_find(head, name);
if (NULL != c)
return c;
- c = malloc(sizeof(command_t));
+ c = malloc(sizeof(struct command));
c->name = strdup(name);
c->parent = parent;
int unregister_all_commands(struct command_context *context)
{
- command_t *c, *c2;
+ struct command *c, *c2;
if (context == NULL)
return ERROR_OK;
int unregister_command(struct command_context *context, char *name)
{
- command_t *c, *p = NULL, *c2;
+ struct command *c, *p = NULL, *c2;
if ((!context) || (!name))
return ERROR_INVALID_ARGUMENTS;
va_end(ap);
}
-static char *__command_name(struct command_s *c, char delim, unsigned extra)
+static char *__command_name(struct command *c, char delim, unsigned extra)
{
char *name;
unsigned len = strlen(c->name);
}
return name;
}
-char *command_name(struct command_s *c, char delim)
+char *command_name(struct command *c, char delim)
{
return __command_name(c, delim, 0);
}
static int run_command(struct command_context *context,
- command_t *c, const char *words[], unsigned num_words)
+ struct command *c, const char *words[], unsigned num_words)
{
int start_word = 0;
if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode)))
struct command_context
{
enum command_mode mode;
- struct command_s *commands;
+ struct command *commands;
int current_target;
/* Execute a command.
*
/// The type signature for commands' handler functions.
typedef __COMMAND_HANDLER((*command_handler_t));
-typedef struct command_s
+struct command
{
char *name;
- struct command_s *parent;
- struct command_s *children;
+ struct command *parent;
+ struct command *children;
command_handler_t handler;
enum command_mode mode;
- struct command_s *next;
-} command_t;
+ struct command *next;
+};
/**
* @param c The command to be named.
* are separated by single spaces. The caller must free() the string
* when done with it.
*/
-char *command_name(struct command_s *c, char delim);
+char *command_name(struct command *c, char delim);
-command_t* register_command(struct command_context *context,
- command_t *parent, char *name, command_handler_t handler,
+struct command* register_command(struct command_context *context,
+ struct command *parent, char *name, command_handler_t handler,
enum command_mode mode, char *help);
int unregister_command(struct command_context *context, char *name);
return ERROR_OK;
}
-/*extern jtag_command_t **jtag_get_last_command_p(void);*/
+/*extern jtag_struct command **jtag_get_last_command_p(void);*/
int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
{
struct dtc_reply_queue_entry {
struct dtc_reply_queue_entry_s *next;
- jtag_command_t *cmd; /* the command that resulted in this entry */
+ jtag_struct command *cmd; /* the command that resulted in this entry */
struct {
uint8_t *buffer; /* the scan buffer */
int size,
int offset,
int length,
- jtag_command_t *cmd
+ jtag_struct command *cmd
) {
struct dtc_reply_queue_entry *rq_entry;
static
int
rlink_scan(
- jtag_command_t *cmd,
+ jtag_struct command *cmd,
enum scan_type type,
uint8_t *buffer,
int scan_size
static
int rlink_execute_queue(void)
{
- jtag_command_t *cmd = jtag_command_queue; /* currently processed command */
+ jtag_struct command *cmd = jtag_command_queue; /* currently processed command */
int scan_size;
enum scan_type type;
uint8_t *buffer;
return ERROR_OK;
}
-/*extern jtag_command_t **jtag_get_last_command_p(void);*/
+/*extern jtag_struct command **jtag_get_last_command_p(void);*/
int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
{
};
static struct pld_device *pld_devices;
-static command_t *pld_cmd;
+static struct command *pld_cmd;
struct pld_device *get_pld_device_by_num(int num)
{
static int virtex2_register_commands(struct command_context *cmd_ctx)
{
- command_t *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2",
+ struct command *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2",
NULL, COMMAND_ANY, "virtex2 specific commands");
register_command(cmd_ctx, virtex2_cmd, "read_stat",
{
FNC_INFO;
- command_t *top_cmd, *mw_cmd;
+ struct command *top_cmd, *mw_cmd;
top_cmd = register_command(cmd_ctx, NULL, "arm11",
NULL, COMMAND_ANY, NULL);
static int arm720t_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *arm720t_cmd;
+ struct command *arm720t_cmd;
retval = arm7_9_register_commands(cmd_ctx);
int arm7_9_register_commands(struct command_context *cmd_ctx)
{
- command_t *arm7_9_cmd;
+ struct command *arm7_9_cmd;
arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9",
NULL, COMMAND_ANY, "arm7/9 specific commands");
int arm920t_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *arm920t_cmd;
+ struct command *arm920t_cmd;
retval = arm9tdmi_register_commands(cmd_ctx);
int arm926ejs_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *arm926ejs_cmd;
+ struct command *arm926ejs_cmd;
retval = arm9tdmi_register_commands(cmd_ctx);
int arm966e_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *arm966e_cmd;
+ struct command *arm966e_cmd;
retval = arm9tdmi_register_commands(cmd_ctx);
arm966e_cmd = register_command(cmd_ctx, NULL, "arm966e",
int arm9tdmi_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *arm9tdmi_cmd;
+ struct command *arm9tdmi_cmd;
retval = arm7_9_register_commands(cmd_ctx);
arm9tdmi_cmd = register_command(cmd_ctx, NULL, "arm9",
int armv4_5_register_commands(struct command_context *cmd_ctx)
{
- command_t *armv4_5_cmd;
+ struct command *armv4_5_cmd;
armv4_5_cmd = register_command(cmd_ctx, NULL, "armv4_5",
NULL, COMMAND_ANY,
int armv7a_register_commands(struct command_context *cmd_ctx)
{
- command_t *arm_adi_v5_dap_cmd;
- command_t *armv7a_cmd;
+ struct command *arm_adi_v5_dap_cmd;
+ struct command *armv7a_cmd;
arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap",
NULL, COMMAND_ANY,
/** Registers commands used to access DAP resources. */
int armv7m_register_commands(struct command_context *cmd_ctx)
{
- command_t *arm_adi_v5_dap_cmd;
+ struct command *arm_adi_v5_dap_cmd;
arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap",
NULL, COMMAND_ANY,
static int cortex_a8_register_commands(struct command_context *cmd_ctx)
{
- command_t *cortex_a8_cmd;
+ struct command *cortex_a8_cmd;
int retval = ERROR_OK;
armv4_5_register_commands(cmd_ctx);
static int cortex_m3_register_commands(struct command_context *cmd_ctx)
{
int retval;
- command_t *cortex_m3_cmd;
+ struct command *cortex_m3_cmd;
retval = armv7m_register_commands(cmd_ctx);
static int etb_register_commands(struct command_context *cmd_ctx)
{
- command_t *etb_cmd = register_command(cmd_ctx, NULL, "etb",
+ struct command *etb_cmd = register_command(cmd_ctx, NULL, "etb",
NULL, COMMAND_ANY, "Embedded Trace Buffer");
register_command(cmd_ctx, etb_cmd, "config",
static int etm_set_reg_w_exec(struct reg *reg, uint8_t *buf);
static int etm_write_reg(struct reg *reg, uint32_t value);
-static command_t *etm_cmd;
+static struct command *etm_cmd;
/* Look up register by ID ... most ETM instances only
static int etm_dummy_register_commands(struct command_context *cmd_ctx)
{
- command_t *etm_dummy_cmd;
+ struct command *etm_dummy_cmd;
etm_dummy_cmd = register_command(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver");
int oocd_trace_register_commands(struct command_context *cmd_ctx)
{
- command_t *oocd_trace_cmd;
+ struct command *oocd_trace_cmd;
oocd_trace_cmd = register_command(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD + trace");
#include "log.h"
-static command_t *target_request_cmd = NULL;
+static struct command *target_request_cmd = NULL;
static int charmsg_mode = 0;
static int target_asciimsg(struct target *target, uint32_t length)
int trace_register_commands(struct command_context *cmd_ctx)
{
- command_t *trace_cmd =
+ struct command *trace_cmd =
register_command(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands");
register_command(cmd_ctx, trace_cmd, "history", handle_trace_history_command,
static int xscale_register_commands(struct command_context *cmd_ctx)
{
- command_t *xscale_cmd;
+ struct command *xscale_cmd;
xscale_cmd = register_command(cmd_ctx, NULL, "xscale", NULL, COMMAND_ANY, "xscale specific commands");