Skip to content

Commit

Permalink
Utilise PM_Classic in code
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanrueger committed Jul 12, 2024
1 parent 6f92e18 commit 6ca23bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/jtag3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ static void jtag3_disable(const PROGRAMMER *pgm) {

static void jtag3_enable(PROGRAMMER *pgm, const AVRPART *p) {
// Page erase only useful for classic parts with usersig mem or AVR8X/XMEGAs
if(!(p->prog_modes & (PM_PDI | PM_UPDI)))
if(p->prog_modes & PM_Classic)
if(!avr_locate_usersig(p))
pgm->page_erase = NULL;
}
Expand Down Expand Up @@ -1865,7 +1865,7 @@ static int jtag3_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRME

pmsg_notice2("jtag3_page_erase(.., %s, 0x%x)\n", m->desc, addr);

if(!(p->prog_modes & (PM_PDI | PM_UPDI)) && !mem_is_userrow(m)) {
if((p->prog_modes & PM_Classic) && !mem_is_userrow(m)) {
pmsg_error("page erase only available for AVR8X/XMEGAs or classic-part usersig mem\n");
return -1;
}
Expand Down
12 changes: 6 additions & 6 deletions src/jtagmkII.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
return -1;
}

if (!(p->prog_modes & (PM_PDI | PM_UPDI)))
if (p->prog_modes & PM_Classic)
pgm->initialize(pgm, p);

PDATA(pgm)->recently_written = 1;
Expand Down Expand Up @@ -1292,7 +1292,7 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
return -1;
}

if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->prog_modes & (PM_PDI | PM_UPDI))) {
if ((pgm->flag & PGM_FL_IS_JTAG) && (p->prog_modes & PM_Classic)) {
int ocden = 0;
if(avr_get_config_value(pgm, p, "ocden", &ocden) == 0 && ocden) // ocden == 1 means disabled
pmsg_warning("OCDEN fuse not programmed, single-byte EEPROM updates not possible\n");
Expand Down Expand Up @@ -1323,7 +1323,7 @@ static void jtagmkII_disable(const PROGRAMMER *pgm) {

static void jtagmkII_enable(PROGRAMMER *pgm, const AVRPART *p) {
// Page erase only useful for classic parts with usersig mem or AVR8X/XMEGAs
if(!(p->prog_modes & (PM_PDI | PM_UPDI)))
if(p->prog_modes & PM_Classic)
if(!avr_locate_usersig(p))
pgm->page_erase = NULL;

Expand Down Expand Up @@ -1796,7 +1796,7 @@ static int jtagmkII_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AV

pmsg_notice2("jtagmkII_page_erase(.., %s, 0x%x)\n", m->desc, addr);

if (!(p->prog_modes & (PM_PDI | PM_UPDI)) && !mem_is_userrow(m)) {
if ((p->prog_modes & PM_Classic) && !mem_is_userrow(m)) {
pmsg_error("page erase only available for AVR8X/XMEGAs or classic-part usersig mem\n");
return -1;
}
Expand Down Expand Up @@ -2139,7 +2139,7 @@ static int jtagmkII_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVR
}
} else if(mem_is_a_fuse(mem) || mem_is_fuses(mem)) {
cmd[1] = MTYPE_FUSE_BITS;
if(!(p->prog_modes & (PM_PDI | PM_UPDI)) && mem_is_a_fuse(mem))
if((p->prog_modes & PM_Classic) && mem_is_a_fuse(mem))
addr = mem_fuse_offset(mem);
if (pgm->flag & PGM_FL_IS_DW)
unsupp = 1;
Expand Down Expand Up @@ -2311,7 +2311,7 @@ static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AV
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
} else if (mem_is_a_fuse(mem) || mem_is_fuses(mem)) {
cmd[1] = MTYPE_FUSE_BITS;
if(!(p->prog_modes & (PM_PDI | PM_UPDI)) && mem_is_a_fuse(mem))
if((p->prog_modes & PM_Classic) && mem_is_a_fuse(mem))
addr = mem_fuse_offset(mem);
if (pgm->flag & PGM_FL_IS_DW)
unsupp = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/stk500.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,9 @@ static int set_memchr_a_div(const PROGRAMMER *pgm, const AVRPART *p, const AVRME

if(mem_is_eeprom(m)) {
*memchrp = 'E';
// Word addr for bootloaders or Arduino as ISP if part is a "classic" part, byte addr otherwise
// Word addr for bootloaders or Arduino as ISP if part is a classic part; byte addr otherwise
*a_divp = ((pgm->prog_modes & PM_SPM) || str_caseeq(pgmid, "arduino_as_isp")) \
&& !(p->prog_modes & (PM_UPDI | PM_PDI))? 2: 1;
&& (p->prog_modes & PM_Classic)? 2: 1;
return 0;
}

Expand Down

0 comments on commit 6ca23bd

Please sign in to comment.