Merge pull request #3 from janegilruud/hv-updi
Clean up and simplify hvupdi handling, and set default hvupdi_variant
This commit is contained in:
commit
dc6c10dc6c
|
@ -573,6 +573,7 @@ AVRPART * avr_new_part(void)
|
||||||
memset(p->signature, 0xFF, 3);
|
memset(p->signature, 0xFF, 3);
|
||||||
p->ctl_stack_type = CTL_STACK_NONE;
|
p->ctl_stack_type = CTL_STACK_NONE;
|
||||||
p->ocdrev = -1;
|
p->ocdrev = -1;
|
||||||
|
p->hvupdi_variant = -1;
|
||||||
|
|
||||||
p->mem = lcreat(NULL, 0);
|
p->mem = lcreat(NULL, 0);
|
||||||
p->mem_alias = lcreat(NULL, 0);
|
p->mem_alias = lcreat(NULL, 0);
|
||||||
|
|
22
src/jtag3.c
22
src/jtag3.c
|
@ -1254,18 +1254,21 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate UPDI high-voltage pulse if user asks for it and hardware supports it
|
// Generate UPDI high-voltage pulse if user asks for it and hardware supports it
|
||||||
LNODEID hvupdi_support;
|
LNODEID support;
|
||||||
if (p->flags & AVRPART_HAS_UPDI &&
|
if (p->flags & AVRPART_HAS_UPDI &&
|
||||||
PDATA(pgm)->use_hvupdi == true &&
|
PDATA(pgm)->use_hvupdi == true &&
|
||||||
p->hvupdi_variant != HV_UPDI_VARIANT_1) {
|
p->hvupdi_variant != HV_UPDI_VARIANT_1) {
|
||||||
for (hvupdi_support = lfirst(pgm->hvupdi_support); hvupdi_support != NULL; hvupdi_support = lnext(hvupdi_support)) {
|
parm[0] = PARM3_UPDI_HV_NONE;
|
||||||
unsigned int sup = (unsigned int)(*(int *)(ldata(hvupdi_support)));
|
for (support = lfirst(pgm->hvupdi_support); support != NULL; support = lnext(support)) {
|
||||||
if(sup == p->hvupdi_variant) {
|
if(*(int *) ldata(support) == p->hvupdi_variant) {
|
||||||
avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n",
|
avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n",
|
||||||
progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET");
|
progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET");
|
||||||
parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE;
|
parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (parm[0] == PARM3_UPDI_HV_NONE)
|
||||||
|
avrdude_message(MSG_INFO, "%s: %s does not support sending HV pulse to target %s\n",
|
||||||
|
progname, pgm->desc, p->desc);
|
||||||
}
|
}
|
||||||
if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0)
|
if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1496,8 +1499,8 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) &&
|
else if ((strcmp(extended_param, "hvupdi") == 0) &&
|
||||||
(matches(ldata(lfirst(pgm->id)), "pickit4_updi") || matches(ldata(lfirst(pgm->id)), "powerdebugger_updi"))) {
|
(lsize(pgm->hvupdi_support) > 1)) {
|
||||||
PDATA(pgm)->use_hvupdi = true;
|
PDATA(pgm)->use_hvupdi = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1650,12 +1653,9 @@ static int jtag3_open_updi(PROGRAMMER * pgm, char * port)
|
||||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname);
|
avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname);
|
||||||
|
|
||||||
LNODEID ln;
|
LNODEID ln;
|
||||||
unsigned int hv_sup;
|
|
||||||
avrdude_message(MSG_NOTICE2, "%s: HV UPDI support:", progname);
|
avrdude_message(MSG_NOTICE2, "%s: HV UPDI support:", progname);
|
||||||
for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln)) {
|
for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln))
|
||||||
hv_sup = (unsigned int)(*(int *)ldata(ln));
|
avrdude_message(MSG_NOTICE2, " %d", *(int *) ldata(ln));
|
||||||
avrdude_message(MSG_NOTICE2, " %d", hv_sup);
|
|
||||||
}
|
|
||||||
avrdude_message(MSG_NOTICE2, "\n", progname);
|
avrdude_message(MSG_NOTICE2, "\n", progname);
|
||||||
|
|
||||||
if (jtag3_open_common(pgm, port) < 0)
|
if (jtag3_open_common(pgm, port) < 0)
|
||||||
|
|
Loading…
Reference in New Issue