Clean up and simplify hvupdi handling, and set default hvupdi_variant to -1.

This commit is contained in:
Jan Egil Ruud 2022-07-11 14:07:45 +02:00
parent 913509d6e6
commit 173b4f9d0a
2 changed files with 5 additions and 9 deletions

View File

@ -573,6 +573,7 @@ AVRPART * avr_new_part(void)
memset(p->signature, 0xFF, 3);
p->ctl_stack_type = CTL_STACK_NONE;
p->ocdrev = -1;
p->hvupdi_variant = -1;
p->mem = lcreat(NULL, 0);
p->mem_alias = lcreat(NULL, 0);

View File

@ -1259,8 +1259,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
PDATA(pgm)->use_hvupdi == true &&
p->hvupdi_variant != HV_UPDI_VARIANT_1) {
for (hvupdi_support = lfirst(pgm->hvupdi_support); hvupdi_support != NULL; hvupdi_support = lnext(hvupdi_support)) {
unsigned int sup = (unsigned int)(*(int *)(ldata(hvupdi_support)));
if(sup == p->hvupdi_variant) {
if(*(int *) ldata(hvupdi_support) == p->hvupdi_variant) {
avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n",
progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET");
parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE;
@ -1496,8 +1495,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms)
continue;
}
else if ((matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) &&
(matches(ldata(lfirst(pgm->id)), "pickit4_updi") || matches(ldata(lfirst(pgm->id)), "powerdebugger_updi"))) {
else if (matches(extended_param, "hvupdi")) {
PDATA(pgm)->use_hvupdi = true;
continue;
}
@ -1650,12 +1648,9 @@ static int jtag3_open_updi(PROGRAMMER * pgm, char * port)
avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname);
LNODEID ln;
unsigned int hv_sup;
avrdude_message(MSG_NOTICE2, "%s: HV UPDI support:", progname);
for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln)) {
hv_sup = (unsigned int)(*(int *)ldata(ln));
avrdude_message(MSG_NOTICE2, " %d", hv_sup);
}
for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln))
avrdude_message(MSG_NOTICE2, " %d", *(int *) ldata(ln));
avrdude_message(MSG_NOTICE2, "\n", progname);
if (jtag3_open_common(pgm, port) < 0)