X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Farm926ejs.c;h=110adee0404b43ffa2cf4df298bd11a840136ebc;hb=5ea46227b06af1a3680f62dc30715846f1e92e69;hp=50abd4627f149e097ce92be92ec25e906c21a259;hpb=0d7d64b5e9a463f63deb19f00efa14e6e5b1c34e;p=openocd.git diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 50abd4627f..110adee040 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -24,11 +24,12 @@ #include "arm926ejs.h" #include "jtag.h" #include "log.h" +#include "time_support.h" #include #include -#if 1 +#if 0 #define _DEBUG_INSTRUCTION_EXECUTION_ #endif @@ -46,9 +47,9 @@ int arm926ejs_handle_read_cache_command(struct command_context_s *cmd_ctx, char int arm926ejs_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); /* forward declarations */ -int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); +int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp); int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm926ejs_quit(); +int arm926ejs_quit(void); int arm926ejs_arch_state(struct target_s *target); int arm926ejs_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); @@ -79,6 +80,7 @@ target_type_t arm926ejs_target = .write_memory = arm926ejs_write_memory, .bulk_write_memory = arm7_9_bulk_write_memory, .checksum_memory = arm7_9_checksum_memory, + .blank_check_memory = arm7_9_blank_check_memory, .run_algorithm = armv4_5_run_algorithm, @@ -88,7 +90,7 @@ target_type_t arm926ejs_target = .remove_watchpoint = arm7_9_remove_watchpoint, .register_commands = arm926ejs_register_commands, - .target_command = arm926ejs_target_command, + .target_create = arm926ejs_target_create, .init_target = arm926ejs_init_target, .examine = arm9tdmi_examine, .quit = arm926ejs_quit, @@ -560,7 +562,7 @@ int arm926ejs_arch_state(struct target_s *target) "cpsr: 0x%8.8x pc: 0x%8.8x\n" "MMU: %s, D-Cache: %s, I-Cache: %s", armv4_5_state_strings[armv4_5->core_state], - target_debug_reason_strings[target->debug_reason], + Jim_Nvp_value2name_simple( nvp_target_debug_reason,target->debug_reason)->name, armv4_5_mode_strings[armv4_5_mode_to_number(armv4_5->core_mode)], buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32), buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32), @@ -578,11 +580,12 @@ int arm926ejs_soft_reset_halt(struct target_s *target) arm9tdmi_common_t *arm9tdmi = arm7_9->arch_info; arm926ejs_common_t *arm926ejs = arm9tdmi->arch_info; reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT]; - int i; - target->type->halt(target); + target_halt(target); - for (i=0; i<10; i++) + long long then=timeval_ms(); + int timeout; + while (!(timeout=((timeval_ms()-then)>1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { @@ -592,10 +595,16 @@ int arm926ejs_soft_reset_halt(struct target_s *target) { break; } - /* do not eat all CPU, time out after 1 se*/ - usleep(100*1000); + if (debug_level>=1) + { + /* do not eat all CPU, time out after 1 se*/ + alive_sleep(100); + } else + { + keep_alive(); + } } - if (i==10) + if (timeout) { LOG_ERROR("Failed to halt CPU after 1 sec"); return ERROR_TARGET_TIMEOUT; @@ -665,13 +674,13 @@ int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *ta } -int arm926ejs_quit() +int arm926ejs_quit(void) { return ERROR_OK; } -int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, char *variant) +int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, const char *variant) { arm9tdmi_common_t *arm9tdmi = &arm926ejs->arm9tdmi_common; arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common; @@ -705,33 +714,14 @@ int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, in arm7_9->arm_bkpt = ARMV5_BKPT(0x0); arm7_9->thumb_bkpt = ARMV5_T_BKPT(0x0) & 0xffff; - arm7_9->sw_bkpts_use_wp = 0; - arm7_9->sw_bkpts_enabled = 1; - return ERROR_OK; } -int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) +int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp) { - int chain_pos; - char *variant = NULL; - arm926ejs_common_t *arm926ejs = malloc(sizeof(arm926ejs_common_t)); - memset(arm926ejs, 0, sizeof(*arm926ejs)); - - if (argc < 4) - { - LOG_ERROR("'target arm926ejs' requires at least one additional argument"); - exit(-1); - } - - chain_pos = strtoul(args[3], NULL, 0); - - if (argc >= 5) - variant = args[4]; - - LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant); + arm926ejs_common_t *arm926ejs = calloc(1,sizeof(arm926ejs_common_t)); - arm926ejs_init_arch_info(target, arm926ejs, chain_pos, variant); + arm926ejs_init_arch_info(target, arm926ejs, target->chain_position, target->variant); return ERROR_OK; }