* avr910.c:

* fileio.c:
    * main.c:
    * stk500.c:
    More code cleanup to remove warnings.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@352 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Eric Weddington 2003-08-28 23:02:25 +00:00
parent 61c60d3b5b
commit 9560dfe881
5 changed files with 43 additions and 38 deletions

View File

@ -1,3 +1,11 @@
2003-08-28 Eric B. Weddington <eric@ecentral.com>
* avr910.c:
* fileio.c:
* main.c:
* stk500.c:
More code cleanup to remove warnings.
2003-08-27 Theodore A. Roth <troth@openavr.org>
* main.c (update_progress_no_tty): Properly terminate progress. Also

View File

@ -503,7 +503,7 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned int max_addr = n_bytes;
unsigned int page_addr;
int page_bytes = page_size;
int page_wr_cmd_pending;
int page_wr_cmd_pending = 0;
avr910_write_setup(pgm, p, m);

View File

@ -691,7 +691,7 @@ int fileio_rbin(struct fioparms * fio,
int fileio_imm(struct fioparms * fio,
char * filename, FILE * f, unsigned char * buf, int size)
{
int rc;
int rc = 0;
char * e, * p;
unsigned long b;
int loc;

View File

@ -611,7 +611,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, int nowrite,
/*
* write the buffer contents to the selected memory type
*/
fprintf(stderr, "%s: writing %s (%d bytes):\n",
fprintf(stderr, "%s: writing %s (%ld bytes):\n",
progname, upd->memtype, size);
if (!nowrite) {
@ -635,7 +635,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, int nowrite,
vsize = rc;
fprintf(stderr, "%s: %d bytes of %s written\n", progname,
fprintf(stderr, "%s: %ld bytes of %s written\n", progname,
vsize, upd->memtype);
}
@ -713,13 +713,11 @@ int main(int argc, char * argv [])
int exitrc; /* exit code for main() */
int i; /* general loop counter */
int ch; /* options flag */
int size; /* size of memory region */
int len; /* length for various strings */
struct avrpart * p; /* which avr part we are programming */
struct avrpart * v; /* used for verify */
int readorwrite; /* true if a chip read/write op was selected */
int ppidata; /* cached value of the ppi data register */
int vsize=-1; /* number of bytes to verify */
AVRMEM * sig; /* signature data */
struct stat sb;
UPDATE * upd;

View File

@ -934,41 +934,40 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v)
};
int idx, rc;
if (v <= 0.0) {
prescale = cmatch = 0;
goto setclock;
}
if (v > fbase / 2) {
const char *unit;
if (v > 1e6) {
v /= 1e6;
unit = "MHz";
} else if (v > 1e3) {
v /= 1e3;
unit = "kHz";
prescale = cmatch = 0;
if (v > 0.0) {
if (v > fbase / 2) {
const char *unit;
if (v > 1e6) {
v /= 1e6;
unit = "MHz";
} else if (v > 1e3) {
v /= 1e3;
unit = "kHz";
} else
unit = "Hz";
fprintf(stderr,
"%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
progname, v, unit, fbase / 2e6);
fosc = fbase / 2;
} else
unit = "Hz";
fprintf(stderr,
"%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
progname, v, unit, fbase / 2e6);
fosc = fbase / 2;
} else
fosc = (unsigned)v;
for (idx = 0; idx < sizeof(ps) / sizeof(ps[0]); idx++) {
if (fosc >= fbase / (256 * ps[idx] * 2)) {
/* this prescaler value can handle our frequency */
prescale = idx + 1;
cmatch = (unsigned)(fbase / (2 * v * ps[idx]));
break;
fosc = (unsigned)v;
for (idx = 0; idx < sizeof(ps) / sizeof(ps[0]); idx++) {
if (fosc >= fbase / (256 * ps[idx] * 2)) {
/* this prescaler value can handle our frequency */
prescale = idx + 1;
cmatch = (unsigned)(fbase / (2 * v * ps[idx]));
break;
}
}
if (idx == sizeof(ps) / sizeof(ps[0])) {
fprintf(stderr, "%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
progname, fosc, fbase / (256 * 1024 * 2));
return -1;
}
}
if (idx == sizeof(ps) / sizeof(ps[0])) {
fprintf(stderr, "%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
progname, fosc, fbase / (256 * 1024 * 2));
return -1;
}
setclock:
if ((rc = stk500_setparm(pgm, Parm_STK_OSC_PSCALE, prescale)) != 0
|| (rc = stk500_setparm(pgm, Parm_STK_OSC_CMATCH, cmatch)) != 0)
return rc;