aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvan Hunter <ehunter@broadcom.com>2013-01-17 18:23:55 +0800
committerSpencer Oliver <spen@spen-soft.co.uk>2013-04-02 15:10:25 +0000
commit704fc7eb3dea26308a0af09c2f4a35b64ad3346f (patch)
tree3b5f0112d568aa8df0f3d1bd741ef3719889d5d3 /src
parent2a8a89edcba49051315f59cea05834b5b704ee61 (diff)
Add abort when JTAG-DP transaction times out.
Fixes system hang for devices that don't ignore transactions to bad addresses. Change-Id: Ia98344d7efc12951ef79dbc82b8f792b70a22cee Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/1115 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/target/adi_v5_jtag.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c
index e500416b..0445d548 100644
--- a/src/target/adi_v5_jtag.c
+++ b/src/target/adi_v5_jtag.c
@@ -50,6 +50,8 @@
#define JTAG_ACK_OK_FAULT 0x2
#define JTAG_ACK_WAIT 0x1
+static int jtag_ap_q_abort(struct adiv5_dap *dap, uint8_t *ack);
+
/***************************************************************************
*
* DPACC and APACC scanchain access through JTAG-DP (or SWJ-DP)
@@ -232,12 +234,16 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)
while (dap->ack != JTAG_ACK_OK_FAULT) {
if (dap->ack == JTAG_ACK_WAIT) {
if ((timeval_ms()-then) > 1000) {
- /* NOTE: this would be a good spot
- * to use JTAG_DP_ABORT.
- */
LOG_WARNING("Timeout (1000ms) waiting "
"for ACK=OK/FAULT "
- "in JTAG-DP transaction");
+ "in JTAG-DP transaction - aborting");
+
+ uint8_t ack;
+ int abort_ret = jtag_ap_q_abort(dap, &ack);
+
+ if (abort_ret != 0)
+ LOG_WARNING("Abort failed : return=%d ack=%d", abort_ret, ack);
+
return ERROR_JTAG_DEVICE_ERROR;
}
} else {