adiv5.c: Read all CIDR data in one call.
E.g on STM32WXXX AP1 with C2BOOT not set, the AP base registers have valid values but reading them fails and turns the AP unusable. BMDA reading CIDR with multiple calls will will loop and finally hang up BMD. Other target devices may show similar behaviour. Reading CIDR with a single call allows recovery from in that case and additional spares target transactions.
This commit is contained in:
parent
14d3846663
commit
471ba19a77
|
@ -294,9 +294,10 @@ static uint32_t adiv5_mem_read32(ADIv5_AP_t *ap, uint32_t addr)
|
||||||
static uint32_t adiv5_ap_read_id(ADIv5_AP_t *ap, uint32_t addr)
|
static uint32_t adiv5_ap_read_id(ADIv5_AP_t *ap, uint32_t addr)
|
||||||
{
|
{
|
||||||
uint32_t res = 0;
|
uint32_t res = 0;
|
||||||
|
uint8_t data[16];
|
||||||
|
adiv5_mem_read(ap, data, addr, sizeof(data));
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
uint32_t x = adiv5_mem_read32(ap, addr + 4 * i);
|
res |= (data[4 * i] << (i * 8));
|
||||||
res |= (x & 0xff) << (i * 8);
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue