The STK500 can perform paged read/write operations even on standard

"non-paged" parts.  Take advantage of that and use the faster internal
routines of the STK500 for those parts as well.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@162 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2002-12-01 15:05:56 +00:00
parent d36b48d92b
commit 5a8ebeb1ce
5 changed files with 124 additions and 89 deletions

42
avr.c
View File

@@ -374,12 +374,20 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
size = mem->size;
}
if (mem->paged && pgm->paged_load != NULL) {
/*
* the programmer directly supports writing this memory, perhaps
* more efficiently than we can from here
*/
return pgm->paged_load(pgm, p, mem, size);
if ((strcmp(mem->desc, "flash")==0) || (strcmp(mem->desc, "eeprom")==0)) {
if (pgm->paged_load != NULL) {
/*
* the programmer supports a paged mode read, perhaps more
* efficiently than we can read it directly, so use its routine
* instead
*/
if (mem->paged) {
return pgm->paged_load(pgm, p, mem, mem->page_size, size);
}
else {
return pgm->paged_load(pgm, p, mem, pgm->page_size, size);
}
}
}
@@ -434,7 +442,7 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
* if this memory is word-addressable, adjust the address
* accordingly
*/
if (mem->op[AVR_OP_LOADPAGE_LO])
if ((mem->op[AVR_OP_LOADPAGE_LO]) || (mem->op[AVR_OP_READ_LO]))
addr = addr / 2;
pgm->pgm_led(pgm, ON);
@@ -674,12 +682,20 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
pgm->err_led(pgm, OFF);
if (m->paged && pgm->paged_write != NULL) {
/*
* the programmer directly supports writing this memory, perhaps
* more efficiently than we can from here
*/
return pgm->paged_write(pgm, p, m, size);
if ((strcmp(m->desc, "flash")==0) || (strcmp(m->desc, "eeprom")==0)) {
if (pgm->paged_write != NULL) {
/*
* the programmer supports a paged mode write, perhaps more
* efficiently than we can read it directly, so use its routine
* instead
*/
if (m->paged) {
return pgm->paged_write(pgm, p, m, m->page_size, size);
}
else {
return pgm->paged_write(pgm, p, m, pgm->page_size, size);
}
}
}
printed = 0;