mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-24 10:06:25 +03:00
Make avr_mem_exclude() a libavrdude function
This commit is contained in:
@@ -1599,6 +1599,12 @@ Memtable avr_mem_order[100] = {
|
||||
{"sib", MEM_SIB | MEM_READONLY},
|
||||
};
|
||||
|
||||
// Whether a memory is an exception that shouldn't be there for this particular i/face
|
||||
int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
|
||||
return // Classic part usersig memories cannot be read/written using ISP
|
||||
mem_is_usersig(mem) && (p->prog_modes&PM_Classic) && (pgm->prog_modes&p->prog_modes&PM_ISP);
|
||||
}
|
||||
|
||||
int avr_get_mem_type(const char *str) {
|
||||
for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) {
|
||||
if(avr_mem_order[i].str && str_eq(avr_mem_order[i].str, str))
|
||||
|
||||
@@ -1144,6 +1144,8 @@ int avr_get_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int *cycles);
|
||||
|
||||
int avr_put_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int cycles);
|
||||
|
||||
int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem);
|
||||
|
||||
int avr_get_mem_type(const char *str);
|
||||
|
||||
int avr_mem_is_flash_type(const AVRMEM *mem);
|
||||
|
||||
@@ -269,15 +269,9 @@ static void ioerror(const char *iotype, const UPDATE *upd) {
|
||||
msg_ext_error("\n");
|
||||
}
|
||||
|
||||
// Whether a memory is an exception that shouldn't be included
|
||||
static int exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
|
||||
return // Classic part usersig memories cannot be read/written using ISP
|
||||
mem_is_usersig(mem) && (p->prog_modes&PM_Classic) && (pgm->prog_modes&p->prog_modes&PM_ISP);
|
||||
}
|
||||
|
||||
// Whether a memory should be returned for ALL: exclude IO/SRAM
|
||||
static int is_interesting_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
|
||||
return !mem_is_io(mem) && !mem_is_sram(mem) && !(pgm && exclude(pgm, p, mem));
|
||||
return !mem_is_io(mem) && !mem_is_sram(mem) && !(pgm && avr_mem_exclude(pgm, p, mem));
|
||||
}
|
||||
|
||||
// Whether a memory should be backup-ed: exclude sub-memories
|
||||
|
||||
Reference in New Issue
Block a user