Be sure to read the exit specs after the pin configuration has been

assigned, otherwise, we may apply the exit specs to the wrong pins.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@71 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
bsd 2001-09-21 03:27:20 +00:00
parent 5ea5794168
commit a2f0a306bc
1 changed files with 20 additions and 5 deletions

25
main.c
View File

@ -696,6 +696,7 @@ int main ( int argc, char * argv [] )
int verify; /* perform a verify operation */ int verify; /* perform a verify operation */
int ppisetbits; /* bits to set in ppi data register at exit */ int ppisetbits; /* bits to set in ppi data register at exit */
int ppiclrbits; /* bits to clear in ppi data register at exit */ int ppiclrbits; /* bits to clear in ppi data register at exit */
char * exitspecs; /* exit specs string from command line */
readorwrite = 0; readorwrite = 0;
parallel = DEFAULT_PARALLEL; parallel = DEFAULT_PARALLEL;
@ -710,7 +711,9 @@ int main ( int argc, char * argv [] )
filefmt = FMT_AUTO; filefmt = FMT_AUTO;
nowrite = 0; nowrite = 0;
verify = 1; /* on by default; XXX can't turn it off */ verify = 1; /* on by default; XXX can't turn it off */
ppisetbits = ppiclrbits = 0; ppisetbits = 0;
ppiclrbits = 0;
exitspecs = NULL;
pinconfig = NULL; pinconfig = NULL;
strcpy(configfile, CONFIG_DIR); strcpy(configfile, CONFIG_DIR);
@ -836,10 +839,7 @@ int main ( int argc, char * argv [] )
break; break;
case 'E': case 'E':
if (getexitspecs(optarg, &ppisetbits, &ppiclrbits) < 0) { exitspecs = optarg;
usage();
exit(1);
}
break; break;
case 'i': /* specify input file */ case 'i': /* specify input file */
@ -931,6 +931,13 @@ int main ( int argc, char * argv [] )
} }
} }
if (exitspecs != NULL) {
if (getexitspecs(exitspecs, &ppisetbits, &ppiclrbits) < 0) {
usage();
exit(1);
}
}
/* /*
* set up seperate instances of the avr part, one for use in * set up seperate instances of the avr part, one for use in
@ -982,14 +989,18 @@ int main ( int argc, char * argv [] )
goto main_exit; goto main_exit;
} }
#if 0
fprintf(stderr, "initial port data = 0x%02x, pins %s\n", fprintf(stderr, "initial port data = 0x%02x, pins %s\n",
ppidata, vccpins_str(ppidata)); ppidata, vccpins_str(ppidata));
#endif
ppidata &= ~ppiclrbits; ppidata &= ~ppiclrbits;
ppidata |= ppisetbits; ppidata |= ppisetbits;
#if 0
fprintf(stderr, "apply exit specs, port data = 0x%02x, pins %s\n", fprintf(stderr, "apply exit specs, port data = 0x%02x, pins %s\n",
ppidata, vccpins_str(ppidata)); ppidata, vccpins_str(ppidata));
#endif
/* /*
* turn off all the status leds * turn off all the status leds
@ -1197,8 +1208,12 @@ int main ( int argc, char * argv [] )
*/ */
avr_powerdown(fd); avr_powerdown(fd);
#if 0
fprintf(stderr, "port data = 0x%02x, pins %s\n", fprintf(stderr, "port data = 0x%02x, pins %s\n",
ppidata, vccpins_str(ppidata)); ppidata, vccpins_str(ppidata));
#endif
ppi_setall(fd, PPIDATA, ppidata); ppi_setall(fd, PPIDATA, ppidata);
/* /*