* avr910.c (avr910_read_byte_flash): Eliminate a static variable that

hasn't been in use for 5 years.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@814 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2009-02-28 10:07:01 +00:00
parent 8d5144558b
commit 4a5715d348
2 changed files with 16 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2009-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr910.c (avr910_read_byte_flash): Eliminate a static variable that
hasn't been in use for 5 years.
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Post-release 5.6.

View File

@ -457,33 +457,20 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned long addr, unsigned char * value)
{
static int cached = 0;
static unsigned char cvalue;
static unsigned long caddr;
char buf[2];
if (cached && ((caddr + 1) == addr)) {
*value = cvalue;
cached = 0;
avr910_set_addr(pgm, addr >> 1);
avr910_send(pgm, "R", 1);
/* Read back the program mem word (MSB first) */
avr910_recv(pgm, buf, sizeof(buf));
if ((addr & 0x01) == 0) {
*value = buf[1];
}
else {
char buf[2];
avr910_set_addr(pgm, addr >> 1);
avr910_send(pgm, "R", 1);
/* Read back the program mem word (MSB first) */
avr910_recv(pgm, buf, sizeof(buf));
if ((addr & 0x01) == 0) {
*value = buf[1];
// cached = 1;
cvalue = buf[0];
caddr = addr;
}
else {
*value = buf[0];
}
*value = buf[0];
}
return 0;