Allow the baud rate to be specified on the command line with a new -b
switch. The specified baud rate will override the default serial port baud rate for a particular programmer. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@416 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
86c7465611
commit
86b1947132
|
@ -699,6 +699,7 @@ int main(int argc, char * argv [])
|
||||||
int set_cycles; /* value to set the erase-rewrite cycles to */
|
int set_cycles; /* value to set the erase-rewrite cycles to */
|
||||||
char * e; /* for strtol() error checking */
|
char * e; /* for strtol() error checking */
|
||||||
int quell_progress;
|
int quell_progress;
|
||||||
|
int baudrate; /* override default programmer baud rate */
|
||||||
#if !defined(__CYGWIN__)
|
#if !defined(__CYGWIN__)
|
||||||
char * homedir;
|
char * homedir;
|
||||||
#endif
|
#endif
|
||||||
|
@ -738,6 +739,7 @@ int main(int argc, char * argv [])
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
do_cycles = 0;
|
do_cycles = 0;
|
||||||
set_cycles = -1;
|
set_cycles = -1;
|
||||||
|
baudrate = 0;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
|
@ -782,9 +784,18 @@ int main(int argc, char * argv [])
|
||||||
/*
|
/*
|
||||||
* process command line arguments
|
* process command line arguments
|
||||||
*/
|
*/
|
||||||
while ((ch = getopt(argc,argv,"?c:C:DeE:Fnp:P:qtU:vVyY:")) != -1) {
|
while ((ch = getopt(argc,argv,"?b:c:C:DeE:Fnp:P:qtU:vVyY:")) != -1) {
|
||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
case 'b': /* override default programmer baud rate */
|
||||||
|
baudrate = strtol(optarg, &e, 0);
|
||||||
|
if ((e == optarg) || (*e != 0)) {
|
||||||
|
fprintf(stderr, "%s: invalid baud rate specified '%s'\n",
|
||||||
|
progname, optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'c': /* programmer id */
|
case 'c': /* programmer id */
|
||||||
programmer = optarg;
|
programmer = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -1064,6 +1075,13 @@ int main(int argc, char * argv [])
|
||||||
fprintf(stderr, "%sUsing Programmer : %s\n", progbuf, programmer);
|
fprintf(stderr, "%sUsing Programmer : %s\n", progbuf, programmer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (baudrate != 0) {
|
||||||
|
if (verbose) {
|
||||||
|
fprintf(stderr, "%sOverriding Baud Rate : %d\n", progbuf, baudrate);
|
||||||
|
}
|
||||||
|
pgm->baudrate = baudrate;
|
||||||
|
}
|
||||||
|
|
||||||
rc = pgm->open(pgm, port);
|
rc = pgm->open(pgm, port);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
exitrc = 1;
|
exitrc = 1;
|
||||||
|
|
|
@ -540,7 +540,10 @@ static void stk500_enable(PROGRAMMER * pgm)
|
||||||
static int stk500_open(PROGRAMMER * pgm, char * port)
|
static int stk500_open(PROGRAMMER * pgm, char * port)
|
||||||
{
|
{
|
||||||
strcpy(pgm->port, port);
|
strcpy(pgm->port, port);
|
||||||
pgm->fd = serial_open(port, 115200);
|
if (pgm->baudrate)
|
||||||
|
pgm->fd = serial_open(port, pgm->baudrate);
|
||||||
|
else
|
||||||
|
pgm->fd = serial_open(port, 115200);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* drain any extraneous input
|
* drain any extraneous input
|
||||||
|
|
Loading…
Reference in New Issue