summaryrefslogtreecommitdiff
path: root/src/target/arm720t.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/arm720t.c')
-rw-r--r--src/target/arm720t.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 848cbca5..48a6032e 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -24,6 +24,7 @@
#include "arm720t.h"
#include "jtag.h"
#include "log.h"
+#include "time_support.h"
#include <stdlib.h>
#include <string.h>
@@ -366,12 +367,13 @@ int arm720t_soft_reset_halt(struct target_s *target)
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
arm7tdmi_common_t *arm7tdmi = arm7_9->arch_info;
arm720t_common_t *arm720t = arm7tdmi->arch_info;
- int i;
reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
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)
{
@@ -381,10 +383,15 @@ int arm720t_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)
+ {
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
- if (i==10)
+ if (timeout)
{
LOG_ERROR("Failed to halt CPU after 1 sec");
return ERROR_TARGET_TIMEOUT;