Merge commit '23534ab174ffadd63bbdb2e0626770753eff7c3b' into sam-update

This commit is contained in:
Jason Kotzin 2022-08-10 22:05:07 -07:00
commit ca1c0acb27
9 changed files with 15 additions and 15 deletions

View File

@ -721,9 +721,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS,
*p++ = transfers; *p++ = transfers;
for (int i = 0; i < transfers; i++) { for (int i = 0; i < transfers; i++) {
*p++ = 1 | ((DO) ? DAP_JTAG_TDO_CAPTURE : 0) | *p++ = 1 | ((DO) ? DAP_JTAG_TDO_CAPTURE : 0) |
((TMS[i / 8] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0); ((TMS[i >> 3] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0);
if (DI) if (DI)
*p++ = (DI[i / 8] & (1 << (i & 7))) ? 1 : 0; *p++ = (DI[i >> 3] & (1 << (i & 7))) ? 1 : 0;
else else
*p++ = 1; *p++ = 1;
} }
@ -733,9 +733,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS,
if (DO) { if (DO) {
for (int i = 0; i < transfers; i++) { for (int i = 0; i < transfers; i++) {
if (buf[i + 1]) if (buf[i + 1])
DO[i / 8] |= (1 << (i & 7)); DO[i >> 3] |= (1 << (i & 7));
else else
DO[i / 8] &= ~(1 << (i & 7)); DO[i >> 3] &= ~(1 << (i & 7));
} }
} }
ticks -= transfers; ticks -= transfers;

View File

@ -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) == 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(i);
break; break;
} }

View File

@ -378,7 +378,7 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
} else { } else {
num_targets = platform_adiv5_swdp_scan(opt->opt_targetid); num_targets = platform_adiv5_swdp_scan(opt->opt_targetid);
if (!num_targets) { if (!num_targets) {
DEBUG_WARN("Scan SWD failed, trying JTAG!\n"); DEBUG_INFO("Scan SWD failed, trying JTAG!\n");
num_targets = platform_jtag_scan(NULL); num_targets = platform_jtag_scan(NULL);
} }
} }

View File

@ -285,7 +285,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(uint8_t jd_index);
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);

View File

@ -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(uint8_t jd_index)
{ {
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 */
@ -48,7 +48,7 @@ void adiv5_jtag_dp_handler(uint8_t jd_index, uint32_t j_idcode)
} }
dp->dp_jd_index = jd_index; dp->dp_jd_index = jd_index;
dp->idcode = j_idcode; dp->idcode = jtag_devs[jd_index].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;

View File

@ -115,7 +115,7 @@ int adiv5_swdp_scan(uint32_t targetid)
} }
if (e2.type || initial_dp->fault) { if (e2.type || initial_dp->fault) {
DEBUG_WARN("No usable DP found\n"); DEBUG_WARN("No usable DP found\n");
return 0; return -1;
} }
} }
if ((idcode & ADIV5_DP_VERSION_MASK) == ADIV5_DPv2) { if ((idcode & ADIV5_DP_VERSION_MASK) == ADIV5_DPv2) {

View File

@ -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)(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

@ -215,7 +215,7 @@ int jtag_scan(const uint8_t *irlens)
jtag_devs[i].jd_descr = dev_descr[j].descr; jtag_devs[i].jd_descr = dev_descr[j].descr;
/* Call handler to initialise/probe device further */ /* Call handler to initialise/probe device further */
if(dev_descr[j].handler) if(dev_descr[j].handler)
dev_descr[j].handler(i, dev_descr[i].idcode); dev_descr[j].handler(i);
break; break;
} }

View File

@ -34,9 +34,9 @@ static bool nop_function(void)
return true; return true;
} }
static int null_function(void) static bool false_function(void)
{ {
return 0; return false;
} }
target *target_new(void) target *target_new(void)
@ -68,7 +68,7 @@ target *target_new(void)
t->halt_request = (void*)nop_function; t->halt_request = (void*)nop_function;
t->halt_poll = (void*)nop_function; t->halt_poll = (void*)nop_function;
t->halt_resume = (void*)nop_function; t->halt_resume = (void*)nop_function;
t->check_error = (void*)null_function; t->check_error = (void*)false_function;
t->target_storage = NULL; t->target_storage = NULL;