jtag: Make jtag_devs argument to jtag_handler.
This commit is contained in:
parent
6dff2a9f31
commit
6308506276
|
@ -1008,7 +1008,7 @@ int jtag_scan_stlinkv2(bmp_info_t *info, const uint8_t *irlens)
|
||||||
if((jtag_devs[i].jd_idcode & dev_descr[j].idmask) ==
|
if((jtag_devs[i].jd_idcode & dev_descr[j].idmask) ==
|
||||||
dev_descr[j].idcode) {
|
dev_descr[j].idcode) {
|
||||||
if(dev_descr[j].handler)
|
if(dev_descr[j].handler)
|
||||||
dev_descr[j].handler(i, dev_descr[j].idcode);
|
dev_descr[j].handler(&jtag_devs[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ void adiv5_ap_ref(ADIv5_AP_t *ap);
|
||||||
void adiv5_ap_unref(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 platform_add_jtag_dev(const int dev_index, const jtag_dev_t *jtag_dev);
|
||||||
|
|
||||||
void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode);
|
void adiv5_jtag_dp_handler(jtag_dev_t *jd);
|
||||||
int platform_jtag_dp_init(ADIv5_DP_t *dp);
|
int platform_jtag_dp_init(ADIv5_DP_t *dp);
|
||||||
int swdptap_init(ADIv5_DP_t *dp);
|
int swdptap_init(ADIv5_DP_t *dp);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp);
|
static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp);
|
||||||
|
|
||||||
void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode)
|
void adiv5_jtag_dp_handler(jtag_dev_t *jd)
|
||||||
{
|
{
|
||||||
ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp));
|
ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp));
|
||||||
if (!dp) { /* calloc failed: heap exhaustion */
|
if (!dp) { /* calloc failed: heap exhaustion */
|
||||||
|
@ -47,8 +47,8 @@ void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp->dp_jd_index = jd_index;
|
dp->dp_jd_index = jd->jd_dev;
|
||||||
dp->idcode = j_idcode;
|
dp->idcode = jd->jd_idcode;
|
||||||
if ((PC_HOSTED == 0 ) || (!platform_jtag_dp_init(dp))) {
|
if ((PC_HOSTED == 0 ) || (!platform_jtag_dp_init(dp))) {
|
||||||
dp->dp_read = fw_adiv5_jtagdp_read;
|
dp->dp_read = fw_adiv5_jtagdp_read;
|
||||||
dp->error = adiv5_jtagdp_error;
|
dp->error = adiv5_jtagdp_error;
|
||||||
|
|
|
@ -22,7 +22,7 @@ typedef const struct jtag_dev_descr_s {
|
||||||
const uint32_t idcode;
|
const uint32_t idcode;
|
||||||
const uint32_t idmask;
|
const uint32_t idmask;
|
||||||
const char * const descr;
|
const char * const descr;
|
||||||
void (*const handler)(uint8_t jd_index, uint32_t j_idcode);
|
void (*const handler)(jtag_dev_t *jd);
|
||||||
} jtag_dev_descr_t;
|
} jtag_dev_descr_t;
|
||||||
extern jtag_dev_descr_t dev_descr[];
|
extern jtag_dev_descr_t dev_descr[];
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "adiv5.h"
|
#include "adiv5.h"
|
||||||
|
|
||||||
struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS+1];
|
jtag_dev_t jtag_devs[JTAG_MAX_DEVS+1];
|
||||||
int jtag_dev_count;
|
int jtag_dev_count;
|
||||||
|
|
||||||
/* bucket of ones for don't care TDI */
|
/* bucket of ones for don't care TDI */
|
||||||
|
@ -64,7 +64,7 @@ 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)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
void (*jd_handlers[JTAG_MAX_DEVS])(uint8_t jd_index, uint32_t j_idcode);
|
void (*jd_handlers[JTAG_MAX_DEVS])(jtag_dev_t *jd);
|
||||||
target_list_free();
|
target_list_free();
|
||||||
|
|
||||||
memset(jd_handlers, 0, sizeof(jd_handlers));
|
memset(jd_handlers, 0, sizeof(jd_handlers));
|
||||||
|
@ -220,7 +220,7 @@ int jtag_scan(const uint8_t *irlens)
|
||||||
for(i = 0; i < jtag_dev_count; i++)
|
for(i = 0; i < jtag_dev_count; i++)
|
||||||
/* Call handler to initialise/probe device further */
|
/* Call handler to initialise/probe device further */
|
||||||
if (jd_handlers[i])
|
if (jd_handlers[i])
|
||||||
jd_handlers[i](i, jtag_devs[i].jd_idcode);
|
jd_handlers[i](&jtag_devs[i]);
|
||||||
return jtag_dev_count;
|
return jtag_dev_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ typedef struct jtag_dev_s {
|
||||||
uint32_t current_ir;
|
uint32_t current_ir;
|
||||||
} jtag_dev_t;
|
} jtag_dev_t;
|
||||||
|
|
||||||
extern struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS+1];
|
extern jtag_dev_t jtag_devs[JTAG_MAX_DEVS+1];
|
||||||
extern int jtag_dev_count;
|
extern int jtag_dev_count;
|
||||||
|
|
||||||
void jtag_dev_write_ir(jtag_proc_t *jp, uint8_t jd_index, uint32_t ir);
|
void jtag_dev_write_ir(jtag_proc_t *jp, uint8_t jd_index, uint32_t ir);
|
||||||
|
|
Loading…
Reference in New Issue