summaryrefslogtreecommitdiff
path: root/src/target/arm926ejs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/arm926ejs.c')
-rw-r--r--src/target/arm926ejs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index feb8455f..4e15095a 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -24,6 +24,7 @@
#include "arm926ejs.h"
#include "jtag.h"
#include "log.h"
+#include "time_support.h"
#include <stdlib.h>
#include <string.h>
@@ -579,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_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)
{
@@ -593,10 +595,16 @@ int arm926ejs_soft_reset_halt(struct target_s *target)
{
break;
}
- /* do not eat all CPU, time out after 1 se*/
- alive_sleep(100);
+ 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;