Implemented byte and page read operations
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1514 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
748bee8ecf
commit
8f67f9c50b
|
@ -195,19 +195,33 @@ static int serialupdi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||||
static int serialupdi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
static int serialupdi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
unsigned long addr, unsigned char * value)
|
unsigned long addr, unsigned char * value)
|
||||||
{
|
{
|
||||||
// avrdude_message(MSG_INFO, "%s: error: read byte not implemented yet\n",
|
|
||||||
// progname);
|
|
||||||
return updi_read_byte(pgm, mem->offset + addr, value);
|
return updi_read_byte(pgm, mem->offset + addr, value);
|
||||||
// return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int serialupdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
static int serialupdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
unsigned int page_size,
|
unsigned int page_size,
|
||||||
unsigned int addr, unsigned int n_bytes)
|
unsigned int addr, unsigned int n_bytes)
|
||||||
{
|
{
|
||||||
avrdude_message(MSG_INFO, "%s: error: paged load not implemented yet\n",
|
if (n_bytes > m->readsize) {
|
||||||
progname);
|
unsigned int read_offset = addr;
|
||||||
return -1;
|
unsigned int remaining_bytes = n_bytes;
|
||||||
|
int read_bytes = 0;
|
||||||
|
int rc;
|
||||||
|
while (remaining_bytes > 0) {
|
||||||
|
rc = updi_read_data(pgm, m->offset + read_offset, m->buf + read_offset, m->readsize);
|
||||||
|
if (rc < 0) {
|
||||||
|
avrdude_message(MSG_INFO, "%s: Paged load operation failed\n", progname);
|
||||||
|
return rc;
|
||||||
|
} else {
|
||||||
|
read_bytes+=rc;
|
||||||
|
read_offset+=m->readsize;
|
||||||
|
remaining_bytes-=m->readsize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return read_bytes;
|
||||||
|
} else {
|
||||||
|
return updi_read_data(pgm, m->offset + addr, m->buf, n_bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int serialupdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
static int serialupdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
|
|
|
@ -153,7 +153,7 @@ int updi_read_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_
|
||||||
# Do the read(s)
|
# Do the read(s)
|
||||||
return self.datalink.ld_ptr_inc(size)
|
return self.datalink.ld_ptr_inc(size)
|
||||||
*/
|
*/
|
||||||
avrdude_message(MSG_DEBUG, "%s: Reading %d bytes from 0x%06X", progname, size, address);
|
avrdude_message(MSG_DEBUG, "%s: Reading %d bytes from 0x%06X\n", progname, size, address);
|
||||||
|
|
||||||
if (size > UPDI_MAX_REPEAT_SIZE) {
|
if (size > UPDI_MAX_REPEAT_SIZE) {
|
||||||
avrdude_message(MSG_INFO, "%s: Can't read that many bytes in one go\n", progname);
|
avrdude_message(MSG_INFO, "%s: Can't read that many bytes in one go\n", progname);
|
||||||
|
|
Loading…
Reference in New Issue