summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomek CEDRO <cederom@tlen.pl>2011-11-04 02:06:49 +0000
committerTomek CEDRO <cederom@tlen.pl>2011-11-04 02:06:49 +0000
commit08db63ec5d22fdc47577d01f15a129390079a2ae (patch)
tree00e7f7b4cef712dd88a3e1a53d4b5fdb1fa27668
parent5a95ae191619f6b693bdd011ded3827d2c3d7978 (diff)
downloadopenocd+libswd-08db63ec5d22fdc47577d01f15a129390079a2ae.tar.gz
openocd+libswd-08db63ec5d22fdc47577d01f15a129390079a2ae.tar.bz2
openocd+libswd-08db63ec5d22fdc47577d01f15a129390079a2ae.tar.xz
openocd+libswd-08db63ec5d22fdc47577d01f15a129390079a2ae.zip
target/arm_adi_v5: Added SW-DP style sticky error flag hanfling in ahbap_debugport_init().
-rw-r--r--src/target/arm_adi_v5.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 413511c7..cacfac8f 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1096,9 +1096,21 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
if (retval != ERROR_OK)
return retval;
- retval = dap_queue_dp_write(dap, DP_CTRL_STAT, SSTICKYERR);
- if (retval != ERROR_OK)
- return retval;
+ //Sticky Flags handling is different for JTAG and SWD.
+ //TODO: Create one function that will take care of error handling based on transport type.
+ if ((strncmp(jtag_interface->transport->name, "swd", 3)==0)) {
+ //Clear error flags on SW-DP
+ retval = dap_queue_dp_write(dap, DP_ABORT, \
+ SWD_DP_ABORT_ORUNERRCLR|SWD_DP_ABORT_WDERRCLR \
+ |SWD_DP_ABORT_STKERRCLR|SWD_DP_ABORT_STKCMPCLR);
+ if (retval != ERROR_OK)
+ return retval;
+ } else {
+ //Clear error flags on JTAG-DP
+ retval = dap_queue_dp_write(dap, DP_CTRL_STAT, SSTICKYERR);
+ if (retval != ERROR_OK)
+ return retval;
+ }
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
if (retval != ERROR_OK)
@@ -1138,6 +1150,10 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
alive_sleep(10);
}
+ //TC: Here CDBGPWRUPACK|CSYSPWRUPACK still may not be set!
+ //TODO: Should we proceed anyway?
+ if (cnt>=10) LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK FLAGS NOT SET IN RESPONSE!");
+
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
if (retval != ERROR_OK)
return retval;