From 946810fb81025763d0d440edae06a6ff34a859a1 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Thu, 23 Nov 2006 07:02:22 +0000 Subject: [PATCH] In avr_read() and avr_write(), if the paged access returns a failure, fall back to byte access. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@692 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 5 +++++ avr.c | 22 ++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65e8046f..04a271a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-23 Joerg Wunsch + + * avr.c (avr_read, avr_write): if the paged access returns a + failure, fall back to byte access. + 2006-11-21 Joerg Wunsch * jtagmkII.c: In jtagmkII_read_byte() and jtagmkII_write_byte(), diff --git a/avr.c b/avr.c index b8cc7e7c..4a692632 100644 --- a/avr.c +++ b/avr.c @@ -182,20 +182,13 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, * efficiently than we can read it directly, so use its routine * instead */ - if (mem->paged) { - rc = pgm->paged_load(pgm, p, mem, mem->page_size, size); - if (rc < 0) - return rc; + rc = pgm->paged_load(pgm, p, mem, mem->page_size, size); + if (rc == 0) { + if (strcasecmp(mem->desc, "flash") == 0) + return avr_mem_hiaddr(mem); + else + return 0; } - else { - rc = pgm->paged_load(pgm, p, mem, pgm->page_size, size); - if (rc < 0) - return rc; - } - if (strcasecmp(mem->desc, "flash") == 0) - return avr_mem_hiaddr(mem); - else - return rc; } } @@ -586,7 +579,8 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, * efficiently than we can read it directly, so use its routine * instead */ - return pgm->paged_write(pgm, p, m, m->page_size, size); + if (pgm->paged_write(pgm, p, m, m->page_size, size) == 0) + return 0; } }