adiv5: Reject APs duplicating last AP.

Seen with TM4C129 on black MSP432R401 Launchpad. Scanning of APs is aborted,
so valid APs after duplicated APs are ignored.
This commit is contained in:
Uwe Bonnes 2019-09-27 12:44:07 +02:00
parent fc3abf26ef
commit f010a567bd
1 changed files with 8 additions and 0 deletions

View File

@ -485,6 +485,7 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
DEBUG("TARGETID %08" PRIx32 "\n", dp->targetid); DEBUG("TARGETID %08" PRIx32 "\n", dp->targetid);
} }
/* Probe for APs on this DP */ /* Probe for APs on this DP */
uint32_t last_base = 0;
for(int i = 0; i < 256; i++) { for(int i = 0; i < 256; i++) {
ADIv5_AP_t *ap = NULL; ADIv5_AP_t *ap = NULL;
if (adiv5_ap_setup(i)) if (adiv5_ap_setup(i))
@ -496,6 +497,13 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
else else
continue; continue;
} }
if (ap->base == last_base) {
DEBUG("AP %d: Duplicate base\n", i);
adiv5_ap_cleanup(i);
/* FIXME: Should we expect valid APs behind duplicate ones? */
return;
}
last_base = ap->base;
extern void kinetis_mdm_probe(ADIv5_AP_t *); extern void kinetis_mdm_probe(ADIv5_AP_t *);
kinetis_mdm_probe(ap); kinetis_mdm_probe(ap);