summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-02-22 09:26:24 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2012-02-22 09:26:24 +0100
commit0e948cb87958d9c35e8232c898ae0ae9e9e1b2d5 (patch)
tree552e82075c2eda603d85e567eef6f753691e6453 /src/target
parent2dcf57363a5c1c55940e5701e5ec047c37c54560 (diff)
downloadopenocd_libswd-master.tar.gz
openocd_libswd-master.tar.bz2
openocd_libswd-master.tar.xz
openocd_libswd-master.zip
Diffstat (limited to 'src/target')
-rw-r--r--src/target/arm_adi_v5.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 039cf87e..883ec776 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1195,9 +1195,16 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
return retval;
}
- retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
+// retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
+// if (retval != ERROR_OK)
+// return retval;
+
+ retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
+ if ((retval = dap_run(dap)) != ERROR_OK)
+ return retval;
+ LOG_DEBUG("pre: ctrlstat=0x%08x", ctrlstat);
// We want to power on the core and debug, also reset them in case they were active.
// dap->dp_ctrl_stat = CDBGPWRUPREQ | CSYSPWRUPREQ | CDBGRSTREQ;
@@ -1215,29 +1222,31 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
// Wait for System powerup to complete.
while (!(ctrlstat & CSYSPWRUPACK) && (cnt++ < 10))
{
- LOG_DEBUG("DAP: wait CSYSPWRUPACK");
+ LOG_DEBUG("DAP: wait CSYSPWRUPACK, cnt=%d", cnt);
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
if ((retval = dap_run(dap)) != ERROR_OK)
return retval;
+ LOG_DEBUG("ctrlstat=0x%08x", ctrlstat);
}
// Wait for Debug Unit powerup to complete.
- while (!(ctrlstat & CDBGPWRUPACK) && (cnt++ < 20))
+ while (!(ctrlstat & CDBGPWRUPACK) && (cnt++ < 10))
{
- LOG_DEBUG("DAP: wait CDBGPWRUPACK");
+ LOG_DEBUG("DAP: wait CDBGPWRUPACK, cnt=%d", cnt);
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
if ((retval = dap_run(dap)) != ERROR_OK)
return retval;
+ LOG_DEBUG("ctrlstat=0x%08x", ctrlstat);
}
/* // wait for debug unit reset to complete.
while (!(ctrlstat & cdbgrstack) && (cnt++ < 30))
{
- log_debug("dap: wait cdbgrstack");
+ log_debug("DAP: wait CDBGRSTACK");
retval = dap_queue_dp_read(dap, dp_ctrl_stat, &ctrlstat);
if (retval != error_ok)
return retval;
@@ -1250,7 +1259,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
// At this point CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK still may not be set!
// We should not proceed, it may indicate target failure...
if (cnt>=10) {
- LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK FLAGS NOT SET IN RESPONSE!");
+ LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK FLAGS NOT SET IN RESPONSE!, cnt=%d", cnt);
return(ERROR_FAIL);
}