Fix -Y option. Reported by Joerg Wunsch.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@153 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2002-11-06 02:19:57 +00:00
parent 52f96a781a
commit f2604f3523
3 changed files with 14 additions and 11 deletions

11
avr.c
View File

@@ -823,6 +823,7 @@ int avr_chip_erase(int fd, AVRPART * p)
unsigned char cmd[4];
unsigned char res[4];
int cycles;
int rc;
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
fprintf(stderr, "chip erase instruction not defined for part \"%s\"\n",
@@ -830,13 +831,13 @@ int avr_chip_erase(int fd, AVRPART * p)
return -1;
}
cycles = avr_get_cycle_count(fd, p);
rc = avr_get_cycle_count(fd, p, &cycles);
/*
* only print out the current cycle count if we aren't going to
* display it below
*/
if (!do_cycles && ((cycles != -1) && (cycles != 0x00ffff))) {
if (!do_cycles && ((rc >= 0) && (cycles != 0xffffffff))) {
fprintf(stderr,
"%s: current erase-rewrite cycle count is %d%s\n",
progname, cycles,
@@ -1042,7 +1043,7 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size)
}
int avr_get_cycle_count(int fd, AVRPART * p)
int avr_get_cycle_count(int fd, AVRPART * p, int * cycles)
{
AVRMEM * a;
int cycle_count;
@@ -1092,7 +1093,9 @@ int avr_get_cycle_count(int fd, AVRPART * p)
(((unsigned int)v3) << 8) |
v4;
return cycle_count;
*cycles = cycle_count;
return 0;
}