From 8c1ec4f0e1a7dd37a2549d83b6cd5c8c57eb34aa Mon Sep 17 00:00:00 2001 From: zwelch Date: Thu, 30 Apr 2009 09:49:38 +0000 Subject: [PATCH] Add static keywords to core target source file data and functions. git-svn-id: svn://svn.berlios.de/openocd/trunk@1579 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/target/breakpoints.c | 4 +- src/target/breakpoints.h | 4 -- src/target/embeddedice.c | 14 +++--- src/target/embeddedice.h | 2 +- src/target/etb.c | 30 ++++++------ src/target/etb.h | 2 - src/target/etm.c | 48 ++++++++++--------- src/target/etm_dummy.c | 14 +++--- src/target/etm_dummy.h | 1 - src/target/image.c | 10 ++-- src/target/oocd_trace.c | 24 +++++----- src/target/oocd_trace.h | 2 - src/target/target.c | 96 ++++++++++++++++++------------------- src/target/target_request.c | 14 +++--- src/target/trace.c | 4 +- 15 files changed, 132 insertions(+), 137 deletions(-) diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index fd121f2fe..6320d2ea8 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -30,13 +30,13 @@ #include "breakpoints.h" -char *breakpoint_type_strings[] = +static char *breakpoint_type_strings[] = { "hardware", "software" }; -char *watchpoint_rw_strings[] = +static char *watchpoint_rw_strings[] = { "read", "write", diff --git a/src/target/breakpoints.h b/src/target/breakpoints.h index 9b60254bb..800e6558e 100644 --- a/src/target/breakpoints.h +++ b/src/target/breakpoints.h @@ -30,15 +30,11 @@ enum breakpoint_type BKPT_SOFT, }; -extern char *breakpoint_type_strings[]; - enum watchpoint_rw { WPT_READ = 0, WPT_WRITE = 1, WPT_ACCESS = 2 }; -extern char *watchpoint_rw_strings[]; - typedef struct breakpoint_s { u32 address; diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index 15beb9f44..b663c1de8 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -42,15 +42,17 @@ #include -bitfield_desc_t embeddedice_comms_ctrl_bitfield_desc[] = +#if 0 +static bitfield_desc_t embeddedice_comms_ctrl_bitfield_desc[] = { {"R", 1}, {"W", 1}, {"reserved", 26}, {"version", 4} }; +#endif -int embeddedice_reg_arch_info[] = +static int embeddedice_reg_arch_info[] = { 0x0, 0x1, 0x4, 0x5, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, @@ -58,7 +60,7 @@ int embeddedice_reg_arch_info[] = 0x2 }; -char* embeddedice_reg_list[] = +static char* embeddedice_reg_list[] = { "debug_ctrl", "debug_status", @@ -83,9 +85,9 @@ char* embeddedice_reg_list[] = "vector catch" }; -int embeddedice_reg_arch_type = -1; +static int embeddedice_reg_arch_type = -1; -int embeddedice_get_reg(reg_t *reg); +static int embeddedice_get_reg(reg_t *reg); reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9) { @@ -215,7 +217,7 @@ int embeddedice_setup(target_t *target) return jtag_execute_queue(); } -int embeddedice_get_reg(reg_t *reg) +static int embeddedice_get_reg(reg_t *reg) { int retval; if ((retval = embeddedice_read_reg(reg)) != ERROR_OK) diff --git a/src/target/embeddedice.h b/src/target/embeddedice.h index a0483d36c..8c4bc6f2d 100644 --- a/src/target/embeddedice.h +++ b/src/target/embeddedice.h @@ -111,9 +111,9 @@ extern int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, u32 timeout); /* If many embeddedice_write_reg() follow eachother, then the >1 invocations can be this faster version of * embeddedice_write_reg */ -static const int embeddedice_num_bits[]={32,5,1}; static __inline__ void embeddedice_write_reg_inner( jtag_tap_t *tap, int reg_addr, u32 value) { + static const int embeddedice_num_bits[]={32,5,1}; u32 values[3]; values[0]=value; diff --git a/src/target/etb.c b/src/target/etb.c index 9f5e78a1f..b96ffe318 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -36,7 +36,7 @@ #include -char* etb_reg_list[] = +static char* etb_reg_list[] = { "ETB_identification", "ETB_ram_depth", @@ -49,13 +49,13 @@ char* etb_reg_list[] = "ETB_control", }; -int etb_reg_arch_type = -1; +static int etb_reg_arch_type = -1; -int etb_get_reg(reg_t *reg); +static int etb_get_reg(reg_t *reg); -int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int etb_set_instr(etb_t *etb, u32 new_instr) +static int etb_set_instr(etb_t *etb, u32 new_instr) { jtag_tap_t *tap; tap = etb->tap; @@ -85,7 +85,7 @@ int etb_set_instr(etb_t *etb, u32 new_instr) return ERROR_OK; } -int etb_scann(etb_t *etb, u32 new_scan_chain) +static int etb_scann(etb_t *etb, u32 new_scan_chain) { if(etb->cur_scan_chain != new_scan_chain) { @@ -156,7 +156,7 @@ reg_cache_t* etb_build_reg_cache(etb_t *etb) return reg_cache; } -int etb_get_reg(reg_t *reg) +static int etb_get_reg(reg_t *reg) { int retval; if ((retval = etb_read_reg(reg)) != ERROR_OK) @@ -174,7 +174,7 @@ int etb_get_reg(reg_t *reg) return ERROR_OK; } -int etb_read_ram(etb_t *etb, u32 *data, int num_frames) +static int etb_read_ram(etb_t *etb, u32 *data, int num_frames) { scan_field_t fields[3]; int i; @@ -397,7 +397,7 @@ int etb_store_reg(reg_t *reg) return etb_write_reg(reg, buf_get_u32(reg->value, 0, reg->size)); } -int etb_register_commands(struct command_context_s *cmd_ctx) +static int etb_register_commands(struct command_context_s *cmd_ctx) { command_t *etb_cmd; @@ -408,7 +408,7 @@ int etb_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; jtag_tap_t *tap; @@ -462,7 +462,7 @@ int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -int etb_init(etm_context_t *etm_ctx) +static int etb_init(etm_context_t *etm_ctx) { etb_t *etb = etm_ctx->capture_driver_priv; @@ -479,7 +479,7 @@ int etb_init(etm_context_t *etm_ctx) return ERROR_OK; } -trace_status_t etb_status(etm_context_t *etm_ctx) +static trace_status_t etb_status(etm_context_t *etm_ctx) { etb_t *etb = etm_ctx->capture_driver_priv; @@ -534,7 +534,7 @@ trace_status_t etb_status(etm_context_t *etm_ctx) return etm_ctx->capture_status; } -int etb_read_trace(etm_context_t *etm_ctx) +static int etb_read_trace(etm_context_t *etm_ctx) { etb_t *etb = etm_ctx->capture_driver_priv; int first_frame = 0; @@ -684,7 +684,7 @@ int etb_read_trace(etm_context_t *etm_ctx) return ERROR_OK; } -int etb_start_capture(etm_context_t *etm_ctx) +static int etb_start_capture(etm_context_t *etm_ctx) { etb_t *etb = etm_ctx->capture_driver_priv; u32 etb_ctrl_value = 0x1; @@ -716,7 +716,7 @@ int etb_start_capture(etm_context_t *etm_ctx) return ERROR_OK; } -int etb_stop_capture(etm_context_t *etm_ctx) +static int etb_stop_capture(etm_context_t *etm_ctx) { etb_t *etb = etm_ctx->capture_driver_priv; reg_t *etb_ctrl_reg = &etb->reg_cache->reg_list[ETB_CTRL]; diff --git a/src/target/etb.h b/src/target/etb.h index f5f9cf4a7..af6e25499 100644 --- a/src/target/etb.h +++ b/src/target/etb.h @@ -70,6 +70,4 @@ extern int etb_store_reg(reg_t *reg); extern int etb_set_reg(reg_t *reg, u32 value); extern int etb_set_reg_w_exec(reg_t *reg, u8 *buf); -extern int etb_register_commands(struct command_context_s *cmd_ctx); - #endif /* ETB_H */ diff --git a/src/target/etm.c b/src/target/etm.c index f95907099..41897ec00 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -46,15 +46,17 @@ * */ -bitfield_desc_t etm_comms_ctrl_bitfield_desc[] = +#if 0 +static bitfield_desc_t etm_comms_ctrl_bitfield_desc[] = { {"R", 1}, {"W", 1}, {"reserved", 26}, {"version", 4} }; +#endif -int etm_reg_arch_info[] = +static int etm_reg_arch_info[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -72,7 +74,7 @@ int etm_reg_arch_info[] = 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, }; -int etm_reg_arch_size_info[] = +static int etm_reg_arch_size_info[] = { 32, 32, 17, 8, 3, 9, 32, 16, 17, 26, 25, 8, 17, 32, 32, 17, @@ -90,7 +92,7 @@ int etm_reg_arch_size_info[] = 17, 17, 17, 17, 32, 32, 32, 32 }; -char* etm_reg_list[] = +static char* etm_reg_list[] = { "ETM_CTRL", "ETM_CONFIG", @@ -205,11 +207,11 @@ char* etm_reg_list[] = "ETM_CONTEXTID_COMPARATOR_MASK" }; -int etm_reg_arch_type = -1; +static int etm_reg_arch_type = -1; -int etm_get_reg(reg_t *reg); +static int etm_get_reg(reg_t *reg); -command_t *etm_cmd = NULL; +static command_t *etm_cmd = NULL; reg_cache_t* etm_build_reg_cache(target_t *target, arm_jtag_t *jtag_info, etm_context_t *etm_ctx) { @@ -480,7 +482,7 @@ extern etm_capture_driver_t etm_dummy_capture_driver; extern etm_capture_driver_t oocd_trace_capture_driver; #endif -etm_capture_driver_t *etm_capture_drivers[] = +static etm_capture_driver_t *etm_capture_drivers[] = { &etb_capture_driver, &etm_dummy_capture_driver, @@ -502,7 +504,7 @@ char *etmv1v1_branch_reason_strings[] = "reserved", }; -int etm_read_instruction(etm_context_t *ctx, arm_instruction_t *instruction) +static int etm_read_instruction(etm_context_t *ctx, arm_instruction_t *instruction) { int i; int section = -1; @@ -570,7 +572,7 @@ int etm_read_instruction(etm_context_t *ctx, arm_instruction_t *instruction) return ERROR_OK; } -int etmv1_next_packet(etm_context_t *ctx, u8 *packet, int apo) +static int etmv1_next_packet(etm_context_t *ctx, u8 *packet, int apo) { while (ctx->data_index < ctx->trace_depth) { @@ -635,7 +637,7 @@ int etmv1_next_packet(etm_context_t *ctx, u8 *packet, int apo) return -1; } -int etmv1_branch_address(etm_context_t *ctx) +static int etmv1_branch_address(etm_context_t *ctx) { int retval; u8 packet; @@ -721,7 +723,7 @@ int etmv1_branch_address(etm_context_t *ctx) return 0; } -int etmv1_data(etm_context_t *ctx, int size, u32 *data) +static int etmv1_data(etm_context_t *ctx, int size, u32 *data) { int j; u8 buf[4]; @@ -750,7 +752,7 @@ int etmv1_data(etm_context_t *ctx, int size, u32 *data) return 0; } -int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd_ctx) +static int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd_ctx) { int retval; arm_instruction_t instruction; @@ -1043,7 +1045,7 @@ int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd_ctx) return ERROR_OK; } -int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1223,7 +1225,7 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c return ERROR_OK; } -int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1423,7 +1425,7 @@ int handle_etm_info_command(struct command_context_s *cmd_ctx, char *cmd, char * return ERROR_OK; } -int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1471,7 +1473,7 @@ int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1530,7 +1532,7 @@ int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { fileio_t file; target_t *target; @@ -1598,7 +1600,7 @@ int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, char * return ERROR_OK; } -int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { fileio_t file; target_t *target; @@ -1680,7 +1682,7 @@ int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, char * return ERROR_OK; } -int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1720,7 +1722,7 @@ int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, char * return ERROR_OK; } -int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1765,7 +1767,7 @@ int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1801,7 +1803,7 @@ int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, char * return ERROR_OK; } -int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 9acf38fec..ee83f172d 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -36,7 +36,7 @@ #include -int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -69,7 +69,7 @@ int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } -int etm_dummy_register_commands(struct command_context_s *cmd_ctx) +static int etm_dummy_register_commands(struct command_context_s *cmd_ctx) { command_t *etm_dummy_cmd; @@ -80,27 +80,27 @@ int etm_dummy_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -int etm_dummy_init(etm_context_t *etm_ctx) +static int etm_dummy_init(etm_context_t *etm_ctx) { return ERROR_OK; } -trace_status_t etm_dummy_status(etm_context_t *etm_ctx) +static trace_status_t etm_dummy_status(etm_context_t *etm_ctx) { return TRACE_IDLE; } -int etm_dummy_read_trace(etm_context_t *etm_ctx) +static int etm_dummy_read_trace(etm_context_t *etm_ctx) { return ERROR_OK; } -int etm_dummy_start_capture(etm_context_t *etm_ctx) +static int etm_dummy_start_capture(etm_context_t *etm_ctx) { return ERROR_ETM_PORTMODE_NOT_SUPPORTED; } -int etm_dummy_stop_capture(etm_context_t *etm_ctx) +static int etm_dummy_stop_capture(etm_context_t *etm_ctx) { return ERROR_OK; } diff --git a/src/target/etm_dummy.h b/src/target/etm_dummy.h index 006db0122..a271fd460 100644 --- a/src/target/etm_dummy.h +++ b/src/target/etm_dummy.h @@ -28,6 +28,5 @@ #include "etm.h" extern etm_capture_driver_t etm_dummy_capture_driver; -extern int etm_dummy_register_commands(struct command_context_s *cmd_ctx); #endif /* ETB_H */ diff --git a/src/target/image.c b/src/target/image.c index fb4d8915a..2b6d0d11d 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -113,7 +113,7 @@ static int autodetect_image_type(image_t *image, char *url) return ERROR_OK; } -int identify_image_type(image_t *image, char *type_string, char *url) +static int identify_image_type(image_t *image, char *type_string, char *url) { if (type_string) { @@ -154,7 +154,7 @@ int identify_image_type(image_t *image, char *type_string, char *url) return ERROR_OK; } -int image_ihex_buffer_complete(image_t *image) +static int image_ihex_buffer_complete(image_t *image) { image_ihex_t *ihex = image->type_private; fileio_t *fileio = &ihex->fileio; @@ -344,7 +344,7 @@ int image_ihex_buffer_complete(image_t *image) return ERROR_IMAGE_FORMAT_ERROR; } -int image_elf_read_headers(image_t *image) +static int image_elf_read_headers(image_t *image) { image_elf_t *elf = image->type_private; u32 read_bytes; @@ -445,7 +445,7 @@ int image_elf_read_headers(image_t *image) return ERROR_OK; } -int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read) +static int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read) { image_elf_t *elf = image->type_private; Elf32_Phdr *segment = (Elf32_Phdr *)image->sections[section].private; @@ -486,7 +486,7 @@ int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 return ERROR_OK; } -int image_mot_buffer_complete(image_t *image) +static int image_mot_buffer_complete(image_t *image) { image_mot_t *mot = image->type_private; fileio_t *fileio = &mot->fileio; diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index e59c6203a..fe9927f81 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -41,7 +41,9 @@ #include -int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value) +static int oocd_trace_register_commands(struct command_context_s *cmd_ctx); + +static int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value) { size_t bytes_written, bytes_read, bytes_to_read; u8 cmd; @@ -61,7 +63,7 @@ int oocd_trace_read_reg(oocd_trace_t *oocd_trace, int reg, u32 *value) return ERROR_OK; } -int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, u32 value) +static int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, u32 value) { size_t bytes_written; u8 data[5]; @@ -78,7 +80,7 @@ int oocd_trace_write_reg(oocd_trace_t *oocd_trace, int reg, u32 value) return ERROR_OK; } -int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 address, u32 size) +static int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 address, u32 size) { size_t bytes_written, bytes_to_read; ssize_t bytes_read; @@ -105,7 +107,7 @@ int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 address, u32 return ERROR_OK; } -int oocd_trace_init(etm_context_t *etm_ctx) +static int oocd_trace_init(etm_context_t *etm_ctx) { u8 trash[256]; oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv; @@ -152,7 +154,7 @@ int oocd_trace_init(etm_context_t *etm_ctx) return ERROR_OK; } -trace_status_t oocd_trace_status(etm_context_t *etm_ctx) +static trace_status_t oocd_trace_status(etm_context_t *etm_ctx) { oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv; u32 status; @@ -184,7 +186,7 @@ trace_status_t oocd_trace_status(etm_context_t *etm_ctx) return etm_ctx->capture_status; } -int oocd_trace_read_trace(etm_context_t *etm_ctx) +static int oocd_trace_read_trace(etm_context_t *etm_ctx) { oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv; u32 status, address; @@ -242,7 +244,7 @@ int oocd_trace_read_trace(etm_context_t *etm_ctx) return ERROR_OK; } -int oocd_trace_start_capture(etm_context_t *etm_ctx) +static int oocd_trace_start_capture(etm_context_t *etm_ctx) { oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv; u32 control = 0x1; /* 0x1: enabled */ @@ -275,7 +277,7 @@ int oocd_trace_start_capture(etm_context_t *etm_ctx) return ERROR_OK; } -int oocd_trace_stop_capture(etm_context_t *etm_ctx) +static int oocd_trace_stop_capture(etm_context_t *etm_ctx) { oocd_trace_t *oocd_trace = etm_ctx->capture_driver_priv; @@ -298,7 +300,7 @@ etm_capture_driver_t oocd_trace_capture_driver = .read_trace = oocd_trace_read_trace, }; -int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -336,7 +338,7 @@ int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -376,7 +378,7 @@ int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; diff --git a/src/target/oocd_trace.h b/src/target/oocd_trace.h index 9a655b60b..dfa6449e4 100644 --- a/src/target/oocd_trace.h +++ b/src/target/oocd_trace.h @@ -59,6 +59,4 @@ typedef struct oocd_trace_s extern etm_capture_driver_t oocd_trace_capture_driver; -extern int oocd_trace_register_commands(struct command_context_s *cmd_ctx); - #endif /* OOCD_TRACE_TRACE_H */ diff --git a/src/target/target.c b/src/target/target.c index 0b058aeb0..dd61b04c1 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -59,32 +59,30 @@ #include #include -int cli_target_callback_event_handler(struct target_s *target, enum target_event event, void *priv); +static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_test_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc); -int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_fast_load_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_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv); @@ -1346,7 +1344,7 @@ int target_register_user_commands(struct command_context_s *cmd_ctx) return retval; } -int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { char *cp; target_t *target = all_targets; @@ -1542,7 +1540,7 @@ int handle_target(void *priv) return retval; } -int handle_reg_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) { target_t *target; reg_t *reg = NULL; @@ -1653,7 +1651,7 @@ int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args return ERROR_OK; } -int handle_poll_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) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -1688,7 +1686,7 @@ int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **arg return retval; } -int handle_wait_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) { int ms = 5000; @@ -1753,7 +1751,7 @@ int target_wait_state(target_t *target, enum target_state state, int ms) return ERROR_OK; } -int handle_halt_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) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1778,7 +1776,7 @@ int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **arg return handle_wait_halt_command(cmd_ctx, cmd, args, argc); } -int handle_soft_reset_halt_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) { target_t *target = get_current_target(cmd_ctx); @@ -1789,7 +1787,7 @@ int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } -int handle_reset_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) { const Jim_Nvp *n; enum target_reset_mode reset_mode = RESET_RUN; @@ -1808,7 +1806,7 @@ int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **ar } -int handle_resume_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) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1827,7 +1825,7 @@ int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **a return retval; } -int handle_step_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) { target_t *target = get_current_target(cmd_ctx); @@ -1842,7 +1840,7 @@ int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **arg return ERROR_OK; } -int handle_md_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) { const int line_bytecnt = 32; int count = 1; @@ -1919,7 +1917,7 @@ int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, return retval; } -int handle_mw_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) { u32 address = 0; u32 value = 0; @@ -1983,7 +1981,7 @@ int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, } -int handle_load_image_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) { u8 *buffer; u32 buf_cnt; @@ -2107,7 +2105,7 @@ int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char } -int handle_dump_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) { fileio_t fileio; @@ -2179,7 +2177,7 @@ int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -int handle_verify_image_command_internal(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, int verify) +static int handle_verify_image_command_internal(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, int verify) { u8 *buffer; u32 buf_cnt; @@ -2322,17 +2320,17 @@ done: return retval; } -int handle_verify_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) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1); } -int handle_test_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) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0); } -int handle_bp_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) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -2384,7 +2382,7 @@ int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, return ERROR_OK; } -int handle_rbp_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) { target_t *target = get_current_target(cmd_ctx); @@ -2394,7 +2392,7 @@ int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args return ERROR_OK; } -int handle_wp_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) { target_t *target = get_current_target(cmd_ctx); int retval; @@ -2456,7 +2454,7 @@ int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, return ERROR_OK; } -int handle_rwp_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) { target_t *target = get_current_target(cmd_ctx); @@ -2466,7 +2464,7 @@ int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args return ERROR_OK; } -int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc) +static int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -2610,7 +2608,7 @@ static void writeGmon(u32 *samples, u32 sampleNum, char *filename) } /* profiling samples the CPU PC as quickly as OpenOCD is able, which will be used as a random sampling of PC */ -int handle_profile_command(struct command_context_s *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) { target_t *target = get_current_target(cmd_ctx); struct timeval timeout, now; @@ -4092,7 +4090,7 @@ static void free_fastload(void) -int handle_fast_load_image_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) { u8 *buffer; u32 buf_cnt; @@ -4228,7 +4226,7 @@ int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, return retval; } -int handle_fast_load_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) { if (argc>0) return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/target_request.c b/src/target/target_request.c index 1aa7d3983..8d44a111c 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -38,10 +38,10 @@ #include #include -command_t *target_request_cmd = NULL; +static command_t *target_request_cmd = NULL; static int charmsg_mode = 0; -int target_asciimsg(target_t *target, u32 length) +static int target_asciimsg(target_t *target, u32 length) { char *msg = malloc(CEIL(length + 1, 4) * 4); debug_msg_receiver_t *c = target->dbgmsg; @@ -60,14 +60,14 @@ int target_asciimsg(target_t *target, u32 length) return ERROR_OK; } -int target_charmsg(target_t *target, u8 msg) +static int target_charmsg(target_t *target, u8 msg) { LOG_USER_N("%c", msg); return ERROR_OK; } -int target_hexmsg(target_t *target, int size, u32 length) +static int target_hexmsg(target_t *target, int size, u32 length) { u8 *data = malloc(CEIL(length * size, 4) * 4); char line[128]; @@ -154,7 +154,7 @@ int target_request(target_t *target, u32 request) return ERROR_OK; } -int add_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target) +static int add_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target) { debug_msg_receiver_t **p = &target->dbgmsg; @@ -182,7 +182,7 @@ int add_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target) return ERROR_OK; } -debug_msg_receiver_t* find_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target) +static debug_msg_receiver_t* find_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target) { int do_all_targets = 0; debug_msg_receiver_t **p = &target->dbgmsg; @@ -261,7 +261,7 @@ int delete_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *targe return ERROR_OK; } -int handle_target_request_debugmsgs_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_target_request_debugmsgs_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/trace.c b/src/target/trace.c index a9045c25e..50f526a94 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -53,7 +53,7 @@ int trace_point(target_t *target, u32 number) return ERROR_OK; } -int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info; @@ -99,7 +99,7 @@ int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } -int handle_trace_history_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_trace_history_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info;