avrftdi: Use pgm->setpin instead of pgm->cookie->set_pin

avrftdi.c: remove set_pin init, add pgm->setpin init
avrftdi_private.h: remove avrftdi_t->set_pin member
avrftdi_tpi.c: change avrftdi_t->set_pin calls to pgm->setpin.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1163 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
hweisbach 2013-05-06 11:48:08 +00:00
parent 0e59564519
commit c8d3302128
4 changed files with 14 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2013-05-06 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi_tpi.c: instead of private set_pin() function pointer use the one
declared in struct PROGRAMMER.
* avrftdi_private.h: remove set_pin function pointer
* avrftdi.c: remove set_pin function pointer init, add pgm->setpin init.
2013-05-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* pindefs.h: Include "ac_cfg.h" before testing for HAVE_* macros.

View File

@ -1276,7 +1276,6 @@ avrftdi_setup(PROGRAMMER * pgm)
pdata->pin_value = 0;
pdata->pin_direction = 0;
pdata->led_mask = 0;
pdata->set_pin = &set_pin;
}
static void
@ -1324,6 +1323,8 @@ void avrftdi_initpgm(PROGRAMMER * pgm)
pgm->paged_write = avrftdi_paged_write;
pgm->paged_load = avrftdi_paged_load;
pgm->setpin = set_pin;
pgm->setup = avrftdi_setup;
pgm->teardown = avrftdi_teardown;

View File

@ -64,11 +64,6 @@ typedef struct avrftdi_s {
int pin_limit;
/* internal RX buffer of the device. needed for INOUT transfers */
int rx_buffer_size;
/* function pointer to the set_pin function, so that we do not have to drag
* it into global scope. it's a hack, but i think it's slightly better than
* the alternative.
*/
int (*set_pin)(PROGRAMMER *, int, int);
} avrftdi_t;
void avrftdi_log(int level, const char * func, int line, const char * fmt, ...);

View File

@ -86,17 +86,17 @@ avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
pgm->paged_write = NULL;
log_info("Setting /Reset pin low\n");
pdata->set_pin(pgm, PIN_AVR_RESET, OFF);
pdata->set_pin(pgm, PIN_AVR_SCK, OFF);
pdata->set_pin(pgm, PIN_AVR_MOSI, ON);
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
pgm->setpin(pgm, PIN_AVR_SCK, OFF);
pgm->setpin(pgm, PIN_AVR_MOSI, ON);
usleep(20 * 1000);
pdata->set_pin(pgm, PIN_AVR_RESET, ON);
pgm->setpin(pgm, PIN_AVR_RESET, ON);
/* worst case 128ms */
usleep(2 * 128 * 1000);
/*setting rst back to 0 */
pdata->set_pin(pgm, PIN_AVR_RESET, OFF);
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
/*wait at least 20ms bevor issuing spi commands to avr */
usleep(20 * 1000);