diff --git a/ChangeLog b/ChangeLog index 1ac9abe5..3aea788a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-05-06 Hannes Weisbach + + * 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 * pindefs.h: Include "ac_cfg.h" before testing for HAVE_* macros. diff --git a/avrftdi.c b/avrftdi.c index 1742919a..ff107042 100644 --- a/avrftdi.c +++ b/avrftdi.c @@ -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; diff --git a/avrftdi_private.h b/avrftdi_private.h index 45361bbd..0087db22 100644 --- a/avrftdi_private.h +++ b/avrftdi_private.h @@ -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, ...); diff --git a/avrftdi_tpi.c b/avrftdi_tpi.c index 6f14196c..cdcc8631 100644 --- a/avrftdi_tpi.c +++ b/avrftdi_tpi.c @@ -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);