In jtagmkI_close(), revert baud rate to the initial

value in case we had changed it.

Fixes bug #18262: JTAGMKI/JTAG1 Reset Bug


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@699 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2006-12-11 15:15:50 +00:00
parent b4807ef7da
commit dd48976e55
2 changed files with 30 additions and 4 deletions

View File

@ -1,8 +1,13 @@
2006-12-11 Joerg Wunsch <j@uriah.heep.sax.de>
* jtagmkI.c (jtagmkI_close): revert baud rate to the initial
value in case we had changed it.
Fixes bug #18262: JTAGMKI/JTAG1 Reset Bug
2006-12-11 Colin O'Flynn <coflynn@newae.com>
* safemode.c: Stop ignoring return values!
Closes bug #18339
* safemode.c: Stop ignoring return values!
Closes bug #18339
2006-12-11 Joerg Wunsch <j@uriah.heep.sax.de>

View File

@ -46,7 +46,7 @@ extern int do_cycles;
* XXX There should really be a programmer-specific private data
* pointer in struct PROGRAMMER.
*/
static long initial_baudrate;
static int initial_baudrate;
/*
* See jtagmkI_read_byte() for an explanation of the flash and
@ -681,10 +681,31 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
static void jtagmkI_close(PROGRAMMER * pgm)
{
unsigned char b;
if (verbose >= 2)
fprintf(stderr, "%s: jtagmkI_close()\n", progname);
/*
* Revert baud rate to what it used to be when we started. This
* appears to make AVR Studio happier when it is about to access the
* ICE later on.
*/
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
if ((b = jtagmkI_get_baud(initial_baudrate)) == 0) {
fprintf(stderr, "%s: jtagmkI_close(): unsupported baudrate %d\n",
progname, initial_baudrate);
} else {
if (verbose >= 2)
fprintf(stderr, "%s: jtagmkI_close(): "
"trying to set baudrate to %d\n",
progname, initial_baudrate);
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
serial_setspeed(&pgm->fd, pgm->baudrate);
}
}
}
if (pgm->fd.ifd != -1) {
serial_close(&pgm->fd);
}