* avr.c (avr_read_byte): If pgm->read_byte method fails, retry with
avr_read_byte_default. * avr.c (avr_write_byte): If pgm->write_byte method fails, retry with avr_write_byte_default. * avr910.c (avr910_cmd): Implement using universal command. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@364 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
10a26677f8
commit
3827320f15
|
@ -1,3 +1,12 @@
|
|||
2003-09-05 Theodore A. Roth <troth@openavr.org>
|
||||
[Contributed by Jan-Hinnerk Reichert <jan-hinnerk_reichert@hamburg.de>]
|
||||
|
||||
* avr.c (avr_read_byte): If pgm->read_byte method fails, retry with
|
||||
avr_read_byte_default.
|
||||
* avr.c (avr_write_byte): If pgm->write_byte method fails, retry with
|
||||
avr_write_byte_default.
|
||||
* avr910.c (avr910_cmd): Implement using universal command.
|
||||
|
||||
2003-09-04 Theodore A. Roth <troth@openavr.org>
|
||||
|
||||
* Makefile.am: Change AM_CPPFLAGS to avrdude_CPPFLAGS.
|
||||
|
|
22
avr.c
22
avr.c
|
@ -343,12 +343,17 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (pgm->read_byte) {
|
||||
return pgm->read_byte(pgm, p, mem, addr, value);
|
||||
rc = pgm->read_byte(pgm, p, mem, addr, value);
|
||||
if (rc == 0) {
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
/* read_byte() method failed, try again with default. */
|
||||
}
|
||||
|
||||
return avr_read_byte_default(pgm, p, mem, addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -699,12 +704,17 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char data)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (pgm->write_byte) {
|
||||
return pgm->write_byte(pgm, p, mem, addr, data);
|
||||
rc = pgm->write_byte(pgm, p, mem, addr, data);
|
||||
if (rc == 0) {
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
/* write_byte() method failed, try again with default. */
|
||||
}
|
||||
|
||||
return avr_write_byte_default(pgm, p, mem, addr, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
20
avr910.c
20
avr910.c
|
@ -324,13 +324,25 @@ static void avr910_enable(PROGRAMMER * pgm)
|
|||
static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
{
|
||||
int i;
|
||||
unsigned char buf[5];
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
fprintf(stderr, "cmd[%d] = 0x%02x\n", i, cmd[i]);
|
||||
}
|
||||
/* FIXME: Insert version check here */
|
||||
|
||||
buf[0] = '.'; /* New Universal Command */
|
||||
buf[1] = cmd[0];
|
||||
buf[2] = cmd[1];
|
||||
buf[3] = cmd[2];
|
||||
buf[4] = cmd[3];
|
||||
|
||||
avr910_send (pgm, buf, 5);
|
||||
avr910_recv (pgm, buf, 2);
|
||||
|
||||
res[0] = 0x00; /* Dummy value */
|
||||
res[1] = cmd[0];
|
||||
res[2] = cmd[1];
|
||||
res[3] = buf[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue