X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Farm920t.c;h=781f624aa266e1f87f7e051c85633ae5e2478ea6;hb=c4567145ae8da57070e24824b8727b79dddc99a0;hp=67657c94ccd903062b4994db9be827a5736148b8;hpb=0960cbeeddd3023f45ed5541907819798e62dc1b;p=openocd.git diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 67657c94cc..781f624aa2 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -24,6 +24,7 @@ #include "arm920t.h" #include "jtag.h" #include "log.h" +#include "time_support.h" #include #include @@ -629,11 +630,12 @@ int arm920t_soft_reset_halt(struct target_s *target) arm9tdmi_common_t *arm9tdmi = arm7_9->arch_info; arm920t_common_t *arm920t = arm9tdmi->arch_info; reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT]; - int i; 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) { @@ -643,10 +645,16 @@ int arm920t_soft_reset_halt(struct target_s *target) { break; } - /* do not eat all CPU, time out after 1 se*/ - alive_sleep(100); + if (debug_level>=3) + { + /* 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;