LOG_DEBUG("exec opcode 0x%08" PRIx32, opcode);
/* Wait for InstrCompl bit to be set */
+ long long then = timeval_ms();
while ((dscr & DSCR_INSTR_COMP) == 0)
{
retval = mem_ap_read_atomic_u32(swjdp,
LOG_ERROR("Could not read DSCR register, opcode = 0x%08" PRIx32, opcode);
return retval;
}
+ if (timeval_ms() > then + 1000)
+ {
+ LOG_ERROR("Timeout waiting for cortex_a8_exec_opcode");
+ return ERROR_FAIL;
+ }
}
retval = mem_ap_write_u32(swjdp, armv7a->debug_base + CPUDBG_ITR, opcode);
if (retval != ERROR_OK)
return retval;
+ then = timeval_ms();
do
{
retval = mem_ap_read_atomic_u32(swjdp,
LOG_ERROR("Could not read DSCR register");
return retval;
}
+ if (timeval_ms() > then + 1000)
+ {
+ LOG_ERROR("Timeout waiting for cortex_a8_exec_opcode");
+ return ERROR_FAIL;
+ }
}
while ((dscr & DSCR_INSTR_COMP) == 0); /* Wait for InstrCompl bit to be set */
}
/* Wait for DTRRXfull then read DTRRTX */
+ long long then = timeval_ms();
while ((dscr & DSCR_DTR_TX_FULL) == 0)
{
retval = mem_ap_read_atomic_u32(swjdp,
armv7a->debug_base + CPUDBG_DSCR, &dscr);
if (retval != ERROR_OK)
return retval;
+ if (timeval_ms() > then + 1000)
+ {
+ LOG_ERROR("Timeout waiting for cortex_a8_exec_opcode");
+ return ERROR_FAIL;
+ }
}
retval = mem_ap_read_atomic_u32(swjdp,
dscr = *dscr_p;
/* Wait for DTRRXfull */
+ long long then = timeval_ms();
while ((dscr & DSCR_DTR_TX_FULL) == 0) {
retval = mem_ap_read_atomic_u32(swjdp,
a8->armv7a_common.debug_base + CPUDBG_DSCR,
&dscr);
if (retval != ERROR_OK)
return retval;
+ if (timeval_ms() > then + 1000)
+ {
+ LOG_ERROR("Timeout waiting for read dcc");
+ return ERROR_FAIL;
+ }
}
retval = mem_ap_read_atomic_u32(swjdp,
struct reg *r;
int retval;
- int timeout = 100;
-
if (target->state != TARGET_HALTED)
{
LOG_WARNING("target not halted");
if (retval != ERROR_OK)
return retval;
+ long long then = timeval_ms();
while (target->state != TARGET_HALTED)
{
retval = cortex_a8_poll(target);
if (retval != ERROR_OK)
return retval;
- if (--timeout == 0)
+ if (timeval_ms() > then + 1000)
{
LOG_ERROR("timeout waiting for target halt");
return ERROR_FAIL;
}
cortex_a8_unset_breakpoint(target, &stepbreakpoint);
- if (timeout > 0)
- target->debug_reason = DBG_REASON_BREAKPOINT;
+
+ target->debug_reason = DBG_REASON_BREAKPOINT;
if (breakpoint)
cortex_a8_set_breakpoint(target, breakpoint, 0);