* avr910.c: Reading a 16 bit word in paged load needs to swap the
bytes since the 'R' command returns MSB first and the internal buffer stores LSB first. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@307 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
23aee9f8da
commit
299e6aa6ad
|
@ -1,3 +1,9 @@
|
|||
2003-04-09 Theodore A. Roth <troth@openavr.org>
|
||||
|
||||
* avr910.c: Reading a 16 bit word in paged load needs to swap the
|
||||
bytes since the 'R' command returns MSB first and the internal buffer
|
||||
stores LSB first.
|
||||
|
||||
2003-04-07 Theodore A. Roth <troth@openavr.org>
|
||||
|
||||
* stk500.c: Don't print out read/write byte progress unless the verbose
|
||||
|
|
12
avr910.c
12
avr910.c
|
@ -572,6 +572,7 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
int rd_size;
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr;
|
||||
unsigned char buf[2];
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd = 'R';
|
||||
|
@ -591,7 +592,16 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
|
||||
while (addr < max_addr) {
|
||||
avr910_send(pgm, &cmd, 1);
|
||||
avr910_recv(pgm, &m->buf[addr], rd_size);
|
||||
if (cmd == 'R') {
|
||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
||||
into the memory buffer LSB first. */
|
||||
avr910_recv(pgm, buf, 2);
|
||||
m->buf[addr*2] = buf[1]; /* LSB */
|
||||
m->buf[addr*2+1] = buf[0]; /* MSB */
|
||||
}
|
||||
else {
|
||||
avr910_recv(pgm, &m->buf[addr], 1);
|
||||
}
|
||||
|
||||
addr++;
|
||||
|
||||
|
|
Loading…
Reference in New Issue