mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-10-01 14:32:17 +03:00
Look for matching prog_modes in locate_part_by_signature() (#1605)
This commit is contained in:
@@ -1031,21 +1031,21 @@ AVRPART *locate_part_by_avr910_devcode(const LISTID parts, int devcode) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVRPART *locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize) {
|
||||
if(parts && sigsize == 3)
|
||||
for(LNODEID ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
|
||||
AVRPART *p = ldata(ln1);
|
||||
int i;
|
||||
for(i=0; i<3; i++)
|
||||
if(p->signature[i] != sig[i])
|
||||
break;
|
||||
if(i == 3)
|
||||
AVRPART *locate_part_by_signature_pm(const LISTID parts, unsigned char *sig, int sigsize, int prog_modes) {
|
||||
if(parts && sigsize == 3) {
|
||||
for(LNODEID ln=lfirst(parts); ln; ln=lnext(ln)) {
|
||||
AVRPART *p = ldata(ln);
|
||||
if(memcmp(p->signature, sig, 3) == 0 && p->prog_modes & prog_modes)
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVRPART *locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize) {
|
||||
return locate_part_by_signature_pm(parts, sig, sigsize, PM_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate over the list of avrparts given as "avrparts", and
|
||||
* call the callback function cb for each entry found. cb is being
|
||||
|
||||
@@ -207,6 +207,7 @@ typedef struct opcode {
|
||||
#define PM_XMEGAJTAG 1024 // JTAG, some XMEGA parts
|
||||
#define PM_AVR32JTAG 2048 // JTAG for 32-bit AVRs
|
||||
#define PM_aWire 4096 // For 32-bit AVRs
|
||||
#define PM_ALL 0x1fff // All programming interfaces
|
||||
|
||||
#define HV_UPDI_VARIANT_0 0 /* Shared UPDI/GPIO/RESET pin, HV on UPDI pin (tinyAVR0/1/2)*/
|
||||
#define HV_UPDI_VARIANT_1 1 /* Dedicated UPDI pin, no HV (megaAVR0/AVR-Dx) */
|
||||
@@ -548,6 +549,7 @@ void avr_free_part(AVRPART * d);
|
||||
AVRPART * locate_part(const LISTID parts, const char *partdesc);
|
||||
AVRPART * locate_part_by_avr910_devcode(const LISTID parts, int devcode);
|
||||
AVRPART * locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize);
|
||||
AVRPART * locate_part_by_signature_pm(const LISTID parts, unsigned char *sig, int sigsize, int prog_modes);
|
||||
const char *avr_prog_modes_str(int pm);
|
||||
void avr_display(FILE *f, const AVRPART *p, const char *prefix, int verbose);
|
||||
int avr_variants_display(FILE *f, const AVRPART *p, const char *prefix);
|
||||
|
||||
@@ -1617,9 +1617,10 @@ skipopen:
|
||||
sig->buf[2] == p->signature[2];
|
||||
|
||||
if (quell_progress < 2) {
|
||||
AVRPART * part;
|
||||
if((part = locate_part_by_signature(part_list, sig->buf, sig->size)))
|
||||
msg_info(" (probably %s)", signature_matches ? p->id : part->id);
|
||||
AVRPART *part;
|
||||
if((part = locate_part_by_signature_pm(part_list, sig->buf, sig->size, pgm->prog_modes)) ||
|
||||
(part = locate_part_by_signature(part_list, sig->buf, sig->size)))
|
||||
msg_info(" (probably %s)", signature_matches? p->id: part->id);
|
||||
}
|
||||
if (ff || zz) {
|
||||
if (++attempt < 3) {
|
||||
|
||||
Reference in New Issue
Block a user