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
This commit is contained in:
Hannes Weisbach 2013-05-02 11:06:45 +00:00
parent 2ce37b2895
commit 27f7e6e5a4
1 changed files with 16 additions and 4 deletions

View File

@ -20,6 +20,8 @@
#include <libusb-1.0/libusb.h>
#include <libftdi1/ftdi.h>
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*/