mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-27 14:35:27 +00:00
* avr.c: Add avr_read_byte_default().
Have avr_read_byte() call pgm->read_byte() or avr_read_byte_default(). Add avr_write_byte_default(). Have avr_write_byte() call pgm->write_byte or avr_write_byte_default(). * pgm.c: Initialize pgm->write_byte and pgm->read_byte. * pgm.h: Add write_byte and read_byte fields to struct programmer_t. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@296 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
42
avr.c
42
avr.c
@@ -287,11 +287,8 @@ int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* read a byte of data from the indicated memory region
|
||||
*/
|
||||
int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value)
|
||||
int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
unsigned char res[4];
|
||||
@@ -340,6 +337,21 @@ int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* read a byte of data from the indicated memory region
|
||||
*/
|
||||
int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
if (pgm->read_byte) {
|
||||
return pgm->read_byte(pgm, p, mem, addr, value);
|
||||
}
|
||||
else {
|
||||
return avr_read_byte_default(pgm, p, mem, addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read the entirety of the specified memory type into the
|
||||
* corresponding buffer of the avrpart pointed to by 'p'. If size =
|
||||
@@ -465,10 +477,7 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* write a byte of data at the specified address
|
||||
*/
|
||||
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char data)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
@@ -653,6 +662,21 @@ int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* write a byte of data at the specified address
|
||||
*/
|
||||
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char data)
|
||||
{
|
||||
if (pgm->write_byte) {
|
||||
return pgm->write_byte(pgm, p, mem, addr, data);
|
||||
}
|
||||
else {
|
||||
return avr_write_byte_default(pgm, p, mem, addr, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write the whole memory region of the specified memory from the
|
||||
* corresponding buffer of the avrpart pointed to by 'p'. Write up to
|
||||
|
Reference in New Issue
Block a user