From 27f7e6e5a49efc6b95cfe313e7a5402708afe730 Mon Sep 17 00:00:00 2001 From: Hannes Weisbach Date: Thu, 2 May 2013 11:06:45 +0000 Subject: [PATCH] avrftdi_tpi.c: Adds avrftdi_tpi_disable() In this function the NVM enable bit in TPISR is written to zero, like described in AVR918. The reset line is released in avrftdi_close(). git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1149 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrftdi_tpi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/avrftdi_tpi.c b/avrftdi_tpi.c index 1163cf0e..fd45d1a9 100644 --- a/avrftdi_tpi.c +++ b/avrftdi_tpi.c @@ -20,6 +20,8 @@ #include #include +static void avrftdi_tpi_disable(PROGRAMMER *); + static void avrftdi_debug_frame(uint16_t frame) { @@ -75,9 +77,11 @@ avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p) pgm->program_enable = avrftdi_tpi_program_enable; pgm->cmd_tpi = avrftdi_cmd_tpi; pgm->chip_erase = avrftdi_tpi_chip_erase; - //pgm->read_byte = avrftdi_tpi_read_byte; - //pgm->write_byte = avrftdi_tpi_write_byte; - + pgm->disable = avrftdi_tpi_disable; + + pgm->paged_load = NULL; + 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); @@ -341,7 +345,15 @@ avrftdi_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) usleep(p->chip_erase_delay); pgm->initialize(pgm, p); - return 0; + return 0; +} + +static void +avrftdi_tpi_disable(PROGRAMMER * pgm) +{ + log_info("Leaving Programming mode.\n"); + avrftdi_tpi_write_byte(pgm, TPI_OP_SSTCS(TPIPCR)); + avrftdi_tpi_write_byte(pgm, 0); } #else /*HAVE_LIBFTDI*/