Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change condition for using paged access in avr_read() and avr_write() #1110

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ int avr_read_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, con
return avr_mem_hiaddr(mem);
}

if (pgm->paged_load != NULL && mem->page_size > 1 &&
mem->size % mem->page_size == 0) {
if (avr_has_paged_access(pgm, mem)) {
/*
* the programmer supports a paged mode read
*/
Expand Down Expand Up @@ -898,7 +897,7 @@ int avr_write_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, int
return i;
}

if (pgm->paged_write != NULL && m->page_size > 1) {
if (avr_has_paged_access(pgm, m)) {
/*
* the programmer supports a paged mode write
*/
Expand Down
4 changes: 2 additions & 2 deletions src/avrcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
* - Programmer must have paged routines
* - Memory has positive page size, which is a power of two
* - Memory has positive size, which is a multiple of the page size
* - Memory is flash type or eeprom type
* - Memory is either flash type with page size > 1 or eeprom
*/
int avr_has_paged_access(const PROGRAMMER *pgm, const AVRMEM *mem) {
return pgm->paged_load && pgm->paged_write &&
mem->page_size > 0 && (mem->page_size & (mem->page_size-1)) == 0 &&
mem->size > 0 && mem->size % mem->page_size == 0 &&
(avr_mem_is_flash_type(mem) || avr_mem_is_eeprom_type(mem));
((avr_mem_is_flash_type(mem) && mem->page_size > 1) || avr_mem_is_eeprom_type(mem));
}


Expand Down