diff --git a/src/platforms/hosted/stlinkv2.c b/src/platforms/hosted/stlinkv2.c index 42e81dd..1ecae9f 100644 --- a/src/platforms/hosted/stlinkv2.c +++ b/src/platforms/hosted/stlinkv2.c @@ -1010,7 +1010,7 @@ int jtag_scan_stlinkv2(bmp_info_t *info, const uint8_t *irlens) if((jtag_devs[i].jd_idcode & dev_descr[j].idmask) == dev_descr[j].idcode) { if(dev_descr[j].handler) - dev_descr[j].handler(&jtag_devs[i]); + dev_descr[j].handler(i, dev_descr[j].idcode); break; } diff --git a/src/target/adiv5.h b/src/target/adiv5.h index bd0985e..bcaa192 100644 --- a/src/target/adiv5.h +++ b/src/target/adiv5.h @@ -285,7 +285,7 @@ void adiv5_ap_ref(ADIv5_AP_t *ap); void adiv5_ap_unref(ADIv5_AP_t *ap); void platform_add_jtag_dev(const int dev_index, const jtag_dev_t *jtag_dev); -void adiv5_jtag_dp_handler(jtag_dev_t *jd); +void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode); int platform_jtag_dp_init(ADIv5_DP_t *dp); int swdptap_init(ADIv5_DP_t *dp); diff --git a/src/target/adiv5_jtagdp.c b/src/target/adiv5_jtagdp.c index 5273746..2c87dc7 100644 --- a/src/target/adiv5_jtagdp.c +++ b/src/target/adiv5_jtagdp.c @@ -39,7 +39,7 @@ static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp); -void adiv5_jtag_dp_handler(jtag_dev_t *jd) +void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode) { ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp)); if (!dp) { /* calloc failed: heap exhaustion */ @@ -47,8 +47,8 @@ void adiv5_jtag_dp_handler(jtag_dev_t *jd) return; } - dp->dp_jd_index = jd->jd_dev; - dp->idcode = jd->jd_idcode; + dp->dp_jd_index = jd_index; + dp->idcode = j_idcode; if ((PC_HOSTED == 0 ) || (!platform_jtag_dp_init(dp))) { dp->dp_read = fw_adiv5_jtagdp_read; dp->error = adiv5_jtagdp_error; diff --git a/src/target/jtag_devs.h b/src/target/jtag_devs.h index 8f87798..8c2c0b5 100644 --- a/src/target/jtag_devs.h +++ b/src/target/jtag_devs.h @@ -22,7 +22,7 @@ typedef const struct jtag_dev_descr_s { const uint32_t idcode; const uint32_t idmask; const char * const descr; - void (*const handler)(jtag_dev_t *jd); + void (*const handler)(uint8_t jd_index, uint32_t j_idcode); } jtag_dev_descr_t; extern jtag_dev_descr_t dev_descr[]; diff --git a/src/target/jtag_scan.c b/src/target/jtag_scan.c index f35aa67..761f5ff 100644 --- a/src/target/jtag_scan.c +++ b/src/target/jtag_scan.c @@ -30,7 +30,7 @@ #include "adiv5.h" #include "jtag_devs.h" -jtag_dev_t jtag_devs[JTAG_MAX_DEVS+1]; +struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS+1]; int jtag_dev_count; /* bucket of ones for don't care TDI */ diff --git a/src/target/jtag_scan.h b/src/target/jtag_scan.h index bc76e0b..cc6d361 100644 --- a/src/target/jtag_scan.h +++ b/src/target/jtag_scan.h @@ -40,7 +40,7 @@ typedef struct jtag_dev_s { uint32_t current_ir; } jtag_dev_t; -extern jtag_dev_t jtag_devs[JTAG_MAX_DEVS+1]; +extern struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS+1]; extern int jtag_dev_count; void jtag_dev_write_ir(jtag_proc_t *jp, uint8_t jd_index, uint32_t ir);