Provide avr_has_paged_write() and ..._load()

This commit is contained in:
stefanrueger
2026-02-28 15:59:57 +01:00
parent afd3338c74
commit 33530161fa
2 changed files with 16 additions and 0 deletions

View File

@@ -100,6 +100,8 @@
*
* // Does the programmer/memory combo have paged memory access?
* int avr_has_paged_access(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem);
* int avr_has_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem);
* int avr_has_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem);
*
* // Read the page containing addr from the device into buf
* int avr_read_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, unsigned char *buf);
@@ -128,6 +130,18 @@ int avr_has_paged_access(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *
mem->size > 0 && mem->size%mem->page_size == 0 && mem_is_paged_type(mem) && !(p && avr_mem_exclude(pgm, p, mem));
}
int avr_has_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
return pgm->paged_write &&
mem->page_size > 0 && (mem->page_size & (mem->page_size - 1)) == 0 &&
mem->size > 0 && mem->size%mem->page_size == 0 && mem_is_paged_type(mem) && !(p && avr_mem_exclude(pgm, p, mem));
}
int avr_has_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
return pgm->paged_load &&
mem->page_size > 0 && (mem->page_size & (mem->page_size - 1)) == 0 &&
mem->size > 0 && mem->size%mem->page_size == 0 && mem_is_paged_type(mem) && !(p && avr_mem_exclude(pgm, p, mem));
}
#define fallback_read_byte (pgm->read_byte != avr_read_byte_cached? led_read_byte: avr_read_byte_default)
#define fallback_write_byte (pgm->write_byte != avr_write_byte_cached? led_write_byte: avr_write_byte_default)

View File

@@ -1202,6 +1202,8 @@ extern "C" {
void report_progress(int completed, int total, const char *hdr);
void trace_buffer(const char *funstr, const unsigned char *buf, size_t buflen);
int avr_has_paged_access(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);
int avr_has_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);
int avr_has_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);
int avr_read_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
int addr, unsigned char *buf);
int avr_write_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,