* main.c, stk500v2.c: Added patch 4804 from eolson@mit.edu

Which stops sck from being writtend needlessly


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@568 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
c_oflynn 2006-01-17 21:11:39 +00:00
parent 7cc29c373c
commit c1bd17edb2
3 changed files with 27 additions and 3 deletions

View File

@ -1,6 +1,8 @@
2006-01-17 Colin O'Flynn <coflynn@newae.com> 2006-01-17 Colin O'Flynn <coflynn@newae.com>
* main.c: Fixed a typo in safemode variable names, fixed bug 15113 * main.c: Fixed a typo in safemode variable names, fixed bug 15113
* avrdude.conf.in : Added BS2 and pagel to M162, Patch 4766 * avrdude.conf.in : Added BS2 and pagel to M162, Patch 4766
* main.c, stk500v2.c: Added patch 4804 from eolson@mit.edu
Which stops sck from being writtend needlessly
2006-01-13 Joerg Wunsch <j@uriah.heep.sax.de> 2006-01-13 Joerg Wunsch <j@uriah.heep.sax.de>

3
main.c
View File

@ -101,7 +101,7 @@ void usage(void)
"Options:\n" "Options:\n"
" -p <partno> Required. Specify AVR device.\n" " -p <partno> Required. Specify AVR device.\n"
" -b <baudrate> Override RS-232 baud rate.\n" " -b <baudrate> Override RS-232 baud rate.\n"
" -B <bitclock> Specify JTAG bit clock period (us).\n" " -B <bitclock> Specify JTAG/STK500v2 bit clock period (us).\n"
" -C <config-file> Specify location of configuration file.\n" " -C <config-file> Specify location of configuration file.\n"
" -c <programmer> Specify programmer type.\n" " -c <programmer> Specify programmer type.\n"
" -D Disable auto erase for flash memory\n" " -D Disable auto erase for flash memory\n"
@ -1129,6 +1129,7 @@ int main(int argc, char * argv [])
if (verbose) { if (verbose) {
fprintf(stderr, "%sSetting bit clk period: %.1f\n", progbuf, bitclock); fprintf(stderr, "%sSetting bit clk period: %.1f\n", progbuf, bitclock);
} }
pgm->bitclock = bitclock * 1e-6; pgm->bitclock = bitclock * 1e-6;
} }

View File

@ -508,6 +508,11 @@ static int stk500v2_open(PROGRAMMER * pgm, char * port)
stk500v2_drain(pgm, 0); stk500v2_drain(pgm, 0);
if (pgm->bitclock != 0.0) {
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
return -1;
}
return 0; return 0;
} }
@ -940,8 +945,7 @@ static int stk500v2_getparm(PROGRAMMER * pgm, unsigned char parm, unsigned char
return 0; return 0;
} }
static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned char value)
static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value)
{ {
unsigned char buf[32]; unsigned char buf[32];
@ -958,6 +962,23 @@ static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char
return 0; return 0;
} }
static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value)
{
unsigned char current_value;
int res;
res = stk500v2_getparm(pgm, parm, &current_value);
if (res < 0)
fprintf(stderr, "%s: Unable to get parameter 0x%02x\n", progname, parm);
// don't issue a write if the correct value is already set.
if (value == current_value) {
fprintf(stderr, "%s: Skipping paramter write; parameter value already set.\n", progname);
return 0;
}
return stk500v2_setparm_real(pgm, parm, value);
}
static void stk500v2_display(PROGRAMMER * pgm, char * p) static void stk500v2_display(PROGRAMMER * pgm, char * p)
{ {