Use controlled timeout on SW/JTAG DP transactions.
This commit is contained in:
parent
d0a03f55a6
commit
83b83ca48f
|
@ -85,11 +85,11 @@ static uint32_t adiv5_jtagdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
|
|||
|
||||
jtag_dev_write_ir(dp->dev, APnDP ? IR_APACC : IR_DPACC);
|
||||
|
||||
int tries = 1000;
|
||||
platform_timeout_set(2000);
|
||||
do {
|
||||
jtag_dev_shift_dr(dp->dev, (uint8_t*)&response, (uint8_t*)&request, 35);
|
||||
ack = response & 0x07;
|
||||
} while(--tries && (ack == JTAGDP_ACK_WAIT));
|
||||
} while(!platform_timeout_is_expired() && (ack == JTAGDP_ACK_WAIT));
|
||||
|
||||
if (ack == JTAGDP_ACK_WAIT)
|
||||
raise_exception(EXCEPTION_TIMEOUT, "JTAG-DP ACK timeout");
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue