summaryrefslogtreecommitdiff
path: root/src/target/arm920t.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/arm920t.c')
-rw-r--r--src/target/arm920t.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 67657c94..781f624a 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 <stdlib.h>
#include <string.h>
@@ -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;