mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-23 09:36:24 +03:00
Replace and remove avr_memstr_is_...() functions
This commit is contained in:
22
src/avr.c
22
src/avr.c
@@ -1524,32 +1524,16 @@ int avr_get_mem_type(const char *str) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int avr_memstr_is_flash_type(const char *memstr) {
|
||||
return memstr && (
|
||||
str_eq(memstr, "flash") ||
|
||||
str_eq(memstr, "application") ||
|
||||
str_eq(memstr, "apptable") ||
|
||||
str_eq(memstr, "boot"));
|
||||
}
|
||||
|
||||
int avr_mem_is_flash_type(const AVRMEM *mem) {
|
||||
return avr_memstr_is_flash_type(mem->desc);
|
||||
}
|
||||
|
||||
int avr_memstr_is_eeprom_type(const char *memstr) {
|
||||
return memstr && str_eq(memstr, "eeprom");
|
||||
return mem_is_in_flash(mem);
|
||||
}
|
||||
|
||||
int avr_mem_is_eeprom_type(const AVRMEM *mem) {
|
||||
return avr_memstr_is_eeprom_type(mem->desc);
|
||||
}
|
||||
|
||||
int avr_memstr_is_usersig_type(const char *memstr) { // Bootrow is subsumed under usersig type
|
||||
return memstr && (str_eq(memstr, "bootrow") || str_eq(memstr, "usersig") || str_eq(memstr, "userrow"));
|
||||
return mem_is_eeprom(mem);
|
||||
}
|
||||
|
||||
int avr_mem_is_usersig_type(const AVRMEM *mem) {
|
||||
return avr_memstr_is_usersig_type(mem->desc);
|
||||
return mem_is_user_type(mem);
|
||||
}
|
||||
|
||||
int avr_mem_is_known(const char *str) {
|
||||
|
||||
@@ -400,6 +400,7 @@ typedef struct {
|
||||
#define mem_is_user_type(mem) (!!((mem)->type & MEM_USER_TYPE))
|
||||
#define mem_is_in_sigrow(mem) (!!((mem)->type & MEM_IN_SIGROW)) // If sigrow exists, that is
|
||||
#define mem_is_readonly(mem) (!!((mem)->type & MEM_READONLY))
|
||||
#define mem_is_paged_type(mem) (!!((mem)->type & (MEM_IN_FLASH | MEM_EEPROM | MEM_USER_TYPE)))
|
||||
|
||||
#define mem_fuse_offset(mem) ((mem)->type & MEM_FUSEOFF_MASK) // Valid if mem_is_a_fuse(mem)
|
||||
|
||||
@@ -1060,16 +1061,10 @@ char *avr_prog_modes(int pm);
|
||||
|
||||
int avr_get_mem_type(const char *str);
|
||||
|
||||
int avr_memstr_is_flash_type(const char *mem);
|
||||
|
||||
int avr_mem_is_flash_type(const AVRMEM *mem);
|
||||
|
||||
int avr_memstr_is_eeprom_type(const char *mem);
|
||||
|
||||
int avr_mem_is_eeprom_type(const AVRMEM *mem);
|
||||
|
||||
int avr_memstr_is_usersig_type(const char *mem);
|
||||
|
||||
int avr_mem_is_usersig_type(const AVRMEM *mem);
|
||||
|
||||
int avr_mem_is_known(const char *str);
|
||||
|
||||
@@ -1586,6 +1586,7 @@ skipopen:
|
||||
|
||||
int wrmem = 0, terminal = 0;
|
||||
for (ln=lfirst(updates); ln; ln=lnext(ln)) {
|
||||
const AVRMEM *m;
|
||||
upd = ldata(ln);
|
||||
if(upd->cmdline && wrmem) { // Invalidate cache if device was written to
|
||||
wrmem = 0;
|
||||
@@ -1600,7 +1601,7 @@ skipopen:
|
||||
if (rc && rc != LIBAVRDUDE_SOFTFAIL) {
|
||||
exitrc = 1;
|
||||
break;
|
||||
} else if(rc == 0 && upd->op == DEVICE_WRITE && avr_memstr_is_flash_type(upd->memstr))
|
||||
} else if(rc == 0 && upd->op == DEVICE_WRITE && (m = avr_locate_mem(p, upd->memstr)) && mem_is_in_flash(m))
|
||||
ce_delayed = 0; // Redeemed chip erase promise
|
||||
}
|
||||
pgm->flush_cache(pgm, p);
|
||||
|
||||
Reference in New Issue
Block a user