aboutsummaryrefslogtreecommitdiff
path: root/src/adiv5_swdp.c
diff options
context:
space:
mode:
authorGareth McMullin2015-03-02 23:10:15 -0800
committerGareth McMullin2015-03-22 12:26:45 -0700
commit83b83ca48f71639d14673d1deb544bf39a7332be (patch)
tree14e82f524eb0419df72f03bb00e49a6cfe7e8229 /src/adiv5_swdp.c
parentd0a03f55a6e66907f73d046adb6f211da2544d29 (diff)
Use controlled timeout on SW/JTAG DP transactions.
Diffstat (limited to 'src/adiv5_swdp.c')
-rw-r--r--src/adiv5_swdp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/adiv5_swdp.c b/src/adiv5_swdp.c
index 1a6b158..b53fcb5 100644
--- a/src/adiv5_swdp.c
+++ b/src/adiv5_swdp.c
@@ -130,11 +130,11 @@ static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
if((addr == 4) || (addr == 8))
request ^= 0x20;
- size_t tries = 1000;
+ platform_timeout_set(2000);
do {
swdptap_seq_out(request, 8);
ack = swdptap_seq_in(3);
- } while(--tries && ack == SWDP_ACK_WAIT);
+ } while (!platform_timeout_is_expired() && ack == SWDP_ACK_WAIT);
if (ack == SWDP_ACK_WAIT)
raise_exception(EXCEPTION_TIMEOUT, "SWDP ACK timeout");