target.c: remove useless declarations

This patch removes the last batch of forward references from the tree,
moving the target command registration routines to the end of the file.
__archive__
Zachary T Welch 2009-11-09 19:24:06 -08:00
parent 2351641b8f
commit ef6387a0c9
1 changed files with 127 additions and 103 deletions

View File

@ -43,35 +43,7 @@
#include "jtag.h"
static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_test_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc);
static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int target_array2mem(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv);
static int target_mem2array(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv);
@ -1251,19 +1223,6 @@ void target_free_all_working_areas(struct target_s *target)
target_free_all_working_areas_restore(target, 1);
}
int target_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "targets",
handle_targets_command, COMMAND_EXEC,
"change current command line target (one parameter) "
"or list targets (no parameters)");
register_jim(cmd_ctx, "target", jim_target, "configure target");
return ERROR_OK;
}
int target_arch_state(struct target_s *target)
{
int retval;
@ -1658,68 +1617,6 @@ int target_write_u8(struct target_s *target, uint32_t address, uint8_t value)
return retval;
}
int target_register_user_commands(struct command_context_s *cmd_ctx)
{
int retval = ERROR_OK;
/* script procedures */
register_command(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC");
register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY,
"same args as load_image, image stored in memory - mainly for profiling purposes");
register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY,
"loads active fast load image to current target - mainly for profiling purposes");
register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address");
register_command(cmd_ctx, NULL, "reg", handle_reg_command, COMMAND_EXEC, "display or set a register");
register_command(cmd_ctx, NULL, "poll", handle_poll_command, COMMAND_EXEC, "poll target state");
register_command(cmd_ctx, NULL, "wait_halt", handle_wait_halt_command, COMMAND_EXEC, "wait for target halt [time (s)]");
register_command(cmd_ctx, NULL, "halt", handle_halt_command, COMMAND_EXEC, "halt target");
register_command(cmd_ctx, NULL, "resume", handle_resume_command, COMMAND_EXEC, "resume target [addr]");
register_command(cmd_ctx, NULL, "step", handle_step_command, COMMAND_EXEC, "step one instruction from current PC or [addr]");
register_command(cmd_ctx, NULL, "reset", handle_reset_command, COMMAND_EXEC, "reset target [run | halt | init] - default is run");
register_command(cmd_ctx, NULL, "soft_reset_halt", handle_soft_reset_halt_command, COMMAND_EXEC, "halt the target and do a soft reset");
register_command(cmd_ctx, NULL, "mdw", handle_md_command, COMMAND_EXEC, "display memory words [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mdh", handle_md_command, COMMAND_EXEC, "display memory half-words [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mdb", handle_md_command, COMMAND_EXEC, "display memory bytes [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mww", handle_mw_command, COMMAND_EXEC, "write memory word [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "mwh", handle_mw_command, COMMAND_EXEC, "write memory half-word [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "mwb", handle_mw_command, COMMAND_EXEC, "write memory byte [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "bp",
handle_bp_command, COMMAND_EXEC,
"list or set breakpoint [<address> <length> [hw]]");
register_command(cmd_ctx, NULL, "rbp",
handle_rbp_command, COMMAND_EXEC,
"remove breakpoint <address>");
register_command(cmd_ctx, NULL, "wp",
handle_wp_command, COMMAND_EXEC,
"list or set watchpoint "
"[<address> <length> <r/w/a> [value] [mask]]");
register_command(cmd_ctx, NULL, "rwp",
handle_rwp_command, COMMAND_EXEC,
"remove watchpoint <address>");
register_command(cmd_ctx, NULL, "load_image", handle_load_image_command, COMMAND_EXEC, "load_image <file> <address> ['bin'|'ihex'|'elf'|'s19'] [min_address] [max_length]");
register_command(cmd_ctx, NULL, "dump_image", handle_dump_image_command, COMMAND_EXEC, "dump_image <file> <address> <size>");
register_command(cmd_ctx, NULL, "verify_image", handle_verify_image_command, COMMAND_EXEC, "verify_image <file> [offset] [type]");
register_command(cmd_ctx, NULL, "test_image", handle_test_image_command, COMMAND_EXEC, "test_image <file> [offset] [type]");
if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)
return retval;
if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK)
return retval;
return retval;
}
static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target = all_targets;
@ -4835,3 +4732,130 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
int target_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "targets",
handle_targets_command, COMMAND_EXEC,
"change current command line target (one parameter) "
"or list targets (no parameters)");
register_jim(cmd_ctx, "target", jim_target, "configure target");
return ERROR_OK;
}
int target_register_user_commands(struct command_context_s *cmd_ctx)
{
int retval = ERROR_OK;
if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)
return retval;
if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK)
return retval;
register_command(cmd_ctx, NULL, "profile",
handle_profile_command, COMMAND_EXEC,
"profiling samples the CPU PC");
register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array,
"read memory and return as a TCL array for script processing "
"<ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem,
"convert a TCL array to memory locations and write the values "
"<ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
register_command(cmd_ctx, NULL, "fast_load_image",
handle_fast_load_image_command, COMMAND_ANY,
"same args as load_image, image stored in memory "
"- mainly for profiling purposes");
register_command(cmd_ctx, NULL, "fast_load",
handle_fast_load_command, COMMAND_ANY,
"loads active fast load image to current target "
"- mainly for profiling purposes");
register_command(cmd_ctx, NULL, "virt2phys",
handle_virt2phys_command, COMMAND_ANY,
"translate a virtual address into a physical address");
register_command(cmd_ctx, NULL, "reg",
handle_reg_command, COMMAND_EXEC,
"display or set a register");
register_command(cmd_ctx, NULL, "poll",
handle_poll_command, COMMAND_EXEC,
"poll target state");
register_command(cmd_ctx, NULL, "wait_halt",
handle_wait_halt_command, COMMAND_EXEC,
"wait for target halt [time (s)]");
register_command(cmd_ctx, NULL, "halt",
handle_halt_command, COMMAND_EXEC,
"halt target");
register_command(cmd_ctx, NULL, "resume",
handle_resume_command, COMMAND_EXEC,
"resume target [addr]");
register_command(cmd_ctx, NULL, "reset",
handle_reset_command, COMMAND_EXEC,
"reset target [run | halt | init] - default is run");
register_command(cmd_ctx, NULL, "soft_reset_halt",
handle_soft_reset_halt_command, COMMAND_EXEC,
"halt the target and do a soft reset");
register_command(cmd_ctx, NULL, "step",
handle_step_command, COMMAND_EXEC,
"step one instruction from current PC or [addr]");
register_command(cmd_ctx, NULL, "mdw",
handle_md_command, COMMAND_EXEC,
"display memory words [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mdh",
handle_md_command, COMMAND_EXEC,
"display memory half-words [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mdb",
handle_md_command, COMMAND_EXEC,
"display memory bytes [phys] <addr> [count]");
register_command(cmd_ctx, NULL, "mww",
handle_mw_command, COMMAND_EXEC,
"write memory word [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "mwh",
handle_mw_command, COMMAND_EXEC,
"write memory half-word [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "mwb",
handle_mw_command, COMMAND_EXEC,
"write memory byte [phys] <addr> <value> [count]");
register_command(cmd_ctx, NULL, "bp",
handle_bp_command, COMMAND_EXEC,
"list or set breakpoint [<address> <length> [hw]]");
register_command(cmd_ctx, NULL, "rbp",
handle_rbp_command, COMMAND_EXEC,
"remove breakpoint <address>");
register_command(cmd_ctx, NULL, "wp",
handle_wp_command, COMMAND_EXEC,
"list or set watchpoint "
"[<address> <length> <r/w/a> [value] [mask]]");
register_command(cmd_ctx, NULL, "rwp",
handle_rwp_command, COMMAND_EXEC,
"remove watchpoint <address>");
register_command(cmd_ctx, NULL, "load_image",
handle_load_image_command, COMMAND_EXEC,
"load_image <file> <address> "
"['bin'|'ihex'|'elf'|'s19'] [min_address] [max_length]");
register_command(cmd_ctx, NULL, "dump_image",
handle_dump_image_command, COMMAND_EXEC,
"dump_image <file> <address> <size>");
register_command(cmd_ctx, NULL, "verify_image",
handle_verify_image_command, COMMAND_EXEC,
"verify_image <file> [offset] [type]");
register_command(cmd_ctx, NULL, "test_image",
handle_test_image_command, COMMAND_EXEC,
"test_image <file> [offset] [type]");
return ERROR_OK;
}