jtag_scan: Cleaned up and reworked the BMDA integration and scan debugging information

This commit is contained in:
dragonmux 2022-07-27 11:13:04 +01:00 committed by Piotr Esden-Tempski
parent 8bf601a368
commit 36db97a57c
2 changed files with 12 additions and 15 deletions

View File

@ -25,4 +25,3 @@ typedef const struct jtag_dev_descr_s {
void (*const handler)(uint8_t jd_index); void (*const handler)(uint8_t jd_index);
} jtag_dev_descr_t; } jtag_dev_descr_t;
extern jtag_dev_descr_t dev_descr[]; extern jtag_dev_descr_t dev_descr[];

View File

@ -66,9 +66,6 @@ void jtag_add_device(const int dev_index, const jtag_dev_t *jtag_dev)
*/ */
int jtag_scan(const uint8_t *irlens) int jtag_scan(const uint8_t *irlens)
{ {
size_t i;
uint32_t j;
target_list_free(); target_list_free();
jtag_dev_count = 0; jtag_dev_count = 0;
@ -202,23 +199,24 @@ int jtag_scan(const uint8_t *irlens)
jtagtap_return_idle(jtag_proc.tap_idle_cycles); jtagtap_return_idle(jtag_proc.tap_idle_cycles);
#if PC_HOSTED == 1 #if PC_HOSTED == 1
/*Transfer needed device information to firmware jtag_devs*/ /*Transfer needed device information to firmware jtag_devs */
for(i = 0; i < jtag_dev_count; i++) for (size_t device = 0; device < jtag_dev_count; ++device)
platform_add_jtag_dev(i, &jtag_devs[i]); platform_add_jtag_dev(device, jtag_devs + device);
for(i = 0; i < jtag_dev_count; i++) { #endif
DEBUG_INFO("Idcode 0x%08" PRIx32, jtag_devs[i].jd_idcode);
for(j = 0; dev_descr[j].idcode; j++) { for (size_t device = 0; device < jtag_dev_count; ++device) {
if((jtag_devs[i].jd_idcode & dev_descr[j].idmask) == DEBUG_INFO("IDCode 0x%08" PRIx32, jtag_devs[device].jd_idcode);
dev_descr[j].idcode) { for (size_t descr = 0; dev_descr[descr].idcode; ++descr) {
DEBUG_INFO(": %s", if ((jtag_devs[device].jd_idcode & dev_descr[descr].idmask) == dev_descr[descr].idcode) {
(dev_descr[j].descr) ? dev_descr[j].descr : "unknown"); DEBUG_INFO(": %s", dev_descr[descr].descr ? dev_descr[descr].descr : "Unknown");
break; break;
} }
} }
DEBUG_INFO("\n"); DEBUG_INFO("\n");
} }
#endif
size_t i;
uint32_t j;
/* Check for known devices and handle accordingly */ /* Check for known devices and handle accordingly */
for(i = 0; i < jtag_dev_count; i++) for(i = 0; i < jtag_dev_count; i++)
for(j = 0; dev_descr[j].idcode; j++) for(j = 0; dev_descr[j].idcode; j++)