Revert "Skip chaching when size of memory is 0."

This reverts commit bb808e8d5f.
This commit is contained in:
Jan Egil Ruud 2022-12-01 20:01:11 +01:00
parent bb808e8d5f
commit f78e14ee96
1 changed files with 7 additions and 11 deletions

View File

@ -343,7 +343,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont || !cp->size)
if(!mem || !cp->cont)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -367,8 +367,6 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!cp->size)
continue;
if(!cp->cont) // Ensure cache is initialised from now on
if(initCache(cp, pgm, p) < 0) {
if(quell_progress)
@ -421,7 +419,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->size)
if(!mem)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
@ -435,7 +433,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->size)
if(!mem)
continue;
for(int ird = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -462,7 +460,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->size)
if(!mem)
continue;
if(mems[i].isflash) { // flash
@ -510,7 +508,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->size)
if(!mem)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
@ -524,7 +522,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont || !cp->size)
if(!mem || !cp->cont)
continue;
for(int iwr = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -646,7 +644,7 @@ int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->size || !avr_has_paged_access(pgm, mem))
if(!mem || !avr_has_paged_access(pgm, mem))
continue;
if(!cp->cont) // Init cache if needed
@ -736,8 +734,6 @@ int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVR_Cache *cp = mems[i];
if(!cp->size)
continue;
if(cp->cont)
free(cp->cont);
if(cp->copy)