• R/O
  • SSH
  • HTTPS

avrdude: Commit


Commit MetaInfo

Revision1321 (tree)
Time2014-06-14 05:07:40
Authorawachtler

Log Message

added verbose level in avrdude_message()

Change Summary

Incremental Difference

--- trunk/avrdude/ChangeLog (revision 1320)
+++ trunk/avrdude/ChangeLog (revision 1321)
@@ -1,3 +1,51 @@
1+2014-06-13 Axel Wachtler <axel@uracoli.de>
2+
3+ start removing global "verbose" variable, for avrdude library.
4+ * arduino.c: added verbose level in avrdude_message()
5+ * avr910.c: (Dito.)
6+ * avr.c: (Dito.)
7+ * avrdude.h: (Dito.)
8+ * avrftdi.c: (Dito.)
9+ * avrpart.c: (Dito.)
10+ * bitbang.c: (Dito.)
11+ * buspirate.c: (Dito.)
12+ * butterfly.c: (Dito.)
13+ * config.c: (Dito.)
14+ * config_gram.y: (Dito.)
15+ * dfu.c: (Dito.)
16+ * fileio.c: (Dito.)
17+ * flip1.c: (Dito.)
18+ * flip2.c: (Dito.)
19+ * ft245r.c: (Dito.)
20+ * jtag3.c: (Dito.)
21+ * jtagmkI.c: (Dito.)
22+ * jtagmkII.c: (Dito.)
23+ * lexer.l: (Dito.)
24+ * libavrdude.h: (Dito.)
25+ * linuxgpio.c: (Dito.)
26+ * main.c: (Dito.)
27+ * par.c: (Dito.)
28+ * pgm.c: (Dito.)
29+ * pickit2.c: (Dito.)
30+ * pindefs.c: (Dito.)
31+ * ppi.c: (Dito.)
32+ * ppiwin.c: (Dito.)
33+ * safemode.c: (Dito.)
34+ * ser_avrdoper.c: (Dito.)
35+ * serbb_posix.c: (Dito.)
36+ * serbb_win32.c: (Dito.)
37+ * ser_posix.c: (Dito.)
38+ * ser_win32.c: (Dito.)
39+ * stk500.c: (Dito.)
40+ * stk500generic.c: (Dito.)
41+ * stk500v2.c: (Dito.)
42+ * term.c: (Dito.)
43+ * update.c: (Dito.)
44+ * usbasp.c: (Dito.)
45+ * usb_libusb.c: (Dito.)
46+ * usbtiny.c: (Dito.)
47+ * wiring.c: (Dito.)
48+
149 2014-06-11 Rene Liebscher <R.Liebscher@gmx.de>
250
351 bug #42516 spelling-error-in-binary
--- trunk/avrdude/arduino.c (revision 1320)
+++ trunk/avrdude/arduino.c (revision 1321)
@@ -45,7 +45,7 @@
4545 /* Signature byte reads are always 3 bytes. */
4646
4747 if (m->size < 3) {
48- avrdude_message("%s: memsize too small for sig byte read", progname);
48+ avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
4949 return -1;
5050 }
5151
@@ -57,17 +57,17 @@
5757 if (serial_recv(&pgm->fd, buf, 5) < 0)
5858 return -1;
5959 if (buf[0] == Resp_STK_NOSYNC) {
60- avrdude_message("%s: stk500_cmd(): programmer is out of sync\n",
60+ avrdude_message(MSG_INFO, "%s: stk500_cmd(): programmer is out of sync\n",
6161 progname);
6262 return -1;
6363 } else if (buf[0] != Resp_STK_INSYNC) {
64- avrdude_message("\n%s: arduino_read_sig_bytes(): (a) protocol error, "
64+ avrdude_message(MSG_INFO, "\n%s: arduino_read_sig_bytes(): (a) protocol error, "
6565 "expect=0x%02x, resp=0x%02x\n",
6666 progname, Resp_STK_INSYNC, buf[0]);
6767 return -2;
6868 }
6969 if (buf[4] != Resp_STK_OK) {
70- avrdude_message("\n%s: arduino_read_sig_bytes(): (a) protocol error, "
70+ avrdude_message(MSG_INFO, "\n%s: arduino_read_sig_bytes(): (a) protocol error, "
7171 "expect=0x%02x, resp=0x%02x\n",
7272 progname, Resp_STK_OK, buf[4]);
7373 return -3;
--- trunk/avrdude/avr.c (revision 1320)
+++ trunk/avrdude/avr.c (revision 1321)
@@ -60,7 +60,7 @@
6060 /* Set Pointer Register */
6161 mem = avr_locate_mem(p, "flash");
6262 if (mem == NULL) {
63- avrdude_message("No flash memory to erase for part %s\n",
63+ avrdude_message(MSG_INFO, "No flash memory to erase for part %s\n",
6464 p->desc);
6565 return -1;
6666 }
@@ -92,7 +92,7 @@
9292
9393 return 0;
9494 } else {
95- avrdude_message("%s called for a part that has no TPI\n", __func__);
95+ avrdude_message(MSG_INFO, "%s called for a part that has no TPI\n", __func__);
9696 return -1;
9797 }
9898 }
@@ -117,7 +117,7 @@
117117 cmd[0] = (TPI_CMD_SLDCS | TPI_REG_TPIIR);
118118 err = pgm->cmd_tpi(pgm, cmd, 1, &response, sizeof(response));
119119 if (err || response != TPI_IDENT_CODE) {
120- avrdude_message("TPIIR not correct\n");
120+ avrdude_message(MSG_INFO, "TPIIR not correct\n");
121121 return -1;
122122 }
123123
@@ -137,12 +137,12 @@
137137 return 0;
138138 }
139139
140- avrdude_message("Error enabling TPI external programming mode:");
141- avrdude_message("Target does not reply\n");
140+ avrdude_message(MSG_INFO, "Error enabling TPI external programming mode:");
141+ avrdude_message(MSG_INFO, "Target does not reply\n");
142142 return -1;
143143
144144 } else {
145- avrdude_message("%s called for a part that has no TPI\n", __func__);
145+ avrdude_message(MSG_INFO, "%s called for a part that has no TPI\n", __func__);
146146 return -1;
147147 }
148148 }
@@ -187,7 +187,7 @@
187187 OPCODE * readop, * lext;
188188
189189 if (pgm->cmd == NULL) {
190- avrdude_message("%s: Error: %s programmer uses avr_read_byte_default() but does not\n"
190+ avrdude_message(MSG_INFO, "%s: Error: %s programmer uses avr_read_byte_default() but does not\n"
191191 "provide a cmd() method.\n",
192192 progname, pgm->type);
193193 return -1;
@@ -198,7 +198,7 @@
198198
199199 if (p->flags & AVRPART_HAS_TPI) {
200200 if (pgm->cmd_tpi == NULL) {
201- avrdude_message("%s: Error: %s programmer does not support TPI\n",
201+ avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n",
202202 progname, pgm->type);
203203 return -1;
204204 }
@@ -233,7 +233,7 @@
233233
234234 if (readop == NULL) {
235235 #if DEBUG
236- avrdude_message("avr_read_byte(): operation not supported on memory type \"%s\"\n",
236+ avrdude_message(MSG_INFO, "avr_read_byte(): operation not supported on memory type \"%s\"\n",
237237 mem->desc);
238238 #endif
239239 return -1;
@@ -318,7 +318,7 @@
318318 if (v != NULL)
319319 vmem = avr_locate_mem(v, memtype);
320320 if (mem == NULL) {
321- avrdude_message("No \"%s\" memory for part %s\n",
321+ avrdude_message(MSG_INFO, "No \"%s\" memory for part %s\n",
322322 memtype, p->desc);
323323 return -1;
324324 }
@@ -351,7 +351,7 @@
351351 rc = pgm->cmd_tpi(pgm, cmd, 1, mem->buf + i, 1);
352352 lastaddr++;
353353 if (rc == -1) {
354- avrdude_message("avr_read(): error reading address 0x%04lx\n", i);
354+ avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i);
355355 return -1;
356356 }
357357 }
@@ -407,8 +407,8 @@
407407 if (rc < 0)
408408 /* paged load failed, fall back to byte-at-a-time read below */
409409 failure = 1;
410- } else if (verbose >= 3) {
411- avrdude_message("%s: avr_read(): skipping page %u: no interesting data\n",
410+ } else {
411+ avrdude_message(MSG_DEBUG, "%s: avr_read(): skipping page %u: no interesting data\n",
412412 progname, pageaddr / mem->page_size);
413413 }
414414 nread++;
@@ -438,9 +438,9 @@
438438 {
439439 rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i);
440440 if (rc != 0) {
441- avrdude_message("avr_read(): error reading address 0x%04lx\n", i);
441+ avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i);
442442 if (rc == -1)
443- avrdude_message(" read operation not supported for memory \"%s\"\n",
443+ avrdude_message(MSG_INFO, " read operation not supported for memory \"%s\"\n",
444444 memtype);
445445 return -2;
446446 }
@@ -469,7 +469,7 @@
469469 OPCODE * wp, * lext;
470470
471471 if (pgm->cmd == NULL) {
472- avrdude_message("%s: Error: %s programmer uses avr_write_page() but does not\n"
472+ avrdude_message(MSG_INFO, "%s: Error: %s programmer uses avr_write_page() but does not\n"
473473 "provide a cmd() method.\n",
474474 progname, pgm->type);
475475 return -1;
@@ -477,7 +477,7 @@
477477
478478 wp = mem->op[AVR_OP_WRITEPAGE];
479479 if (wp == NULL) {
480- avrdude_message("avr_write_page(): memory \"%s\" not configured for page writes\n",
480+ avrdude_message(MSG_INFO, "avr_write_page(): memory \"%s\" not configured for page writes\n",
481481 mem->desc);
482482 return -1;
483483 }
@@ -539,7 +539,7 @@
539539 struct timeval tv;
540540
541541 if (pgm->cmd == NULL) {
542- avrdude_message("%s: Error: %s programmer uses avr_write_byte_default() but does not\n"
542+ avrdude_message(MSG_INFO, "%s: Error: %s programmer uses avr_write_byte_default() but does not\n"
543543 "provide a cmd() method.\n",
544544 progname, pgm->type);
545545 return -1;
@@ -547,16 +547,16 @@
547547
548548 if (p->flags & AVRPART_HAS_TPI) {
549549 if (pgm->cmd_tpi == NULL) {
550- avrdude_message("%s: Error: %s programmer does not support TPI\n",
550+ avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n",
551551 progname, pgm->type);
552552 return -1;
553553 }
554554
555555 if (strcmp(mem->desc, "flash") == 0) {
556- avrdude_message("Writing a byte to flash is not supported for %s\n", p->desc);
556+ avrdude_message(MSG_INFO, "Writing a byte to flash is not supported for %s\n", p->desc);
557557 return -1;
558558 } else if ((mem->offset + addr) & 1) {
559- avrdude_message("Writing a byte to an odd location is not supported for %s\n", p->desc);
559+ avrdude_message(MSG_INFO, "Writing a byte to an odd location is not supported for %s\n", p->desc);
560560 return -1;
561561 }
562562
@@ -644,7 +644,7 @@
644644
645645 if (writeop == NULL) {
646646 #if DEBUG
647- avrdude_message("avr_write_byte(): write not supported for memory type \"%s\"\n",
647+ avrdude_message(MSG_INFO, "avr_write_byte(): write not supported for memory type \"%s\"\n",
648648 mem->desc);
649649 #endif
650650 return -1;
@@ -737,24 +737,24 @@
737737 * device if the data read back does not match what we wrote.
738738 */
739739 pgm->pgm_led(pgm, OFF);
740- avrdude_message("%s: this device must be powered off and back on to continue\n",
740+ avrdude_message(MSG_INFO, "%s: this device must be powered off and back on to continue\n",
741741 progname);
742742 if (pgm->pinno[PPI_AVR_VCC]) {
743- avrdude_message("%s: attempting to do this now ...\n", progname);
743+ avrdude_message(MSG_INFO, "%s: attempting to do this now ...\n", progname);
744744 pgm->powerdown(pgm);
745745 usleep(250000);
746746 rc = pgm->initialize(pgm, p);
747747 if (rc < 0) {
748- avrdude_message("%s: initialization failed, rc=%d\n", progname, rc);
749- avrdude_message("%s: can't re-initialize device after programming the "
748+ avrdude_message(MSG_INFO, "%s: initialization failed, rc=%d\n", progname, rc);
749+ avrdude_message(MSG_INFO, "%s: can't re-initialize device after programming the "
750750 "%s bits\n", progname, mem->desc);
751- avrdude_message("%s: you must manually power-down the device and restart\n"
751+ avrdude_message(MSG_INFO, "%s: you must manually power-down the device and restart\n"
752752 "%s: %s to continue.\n",
753753 progname, progname, progname);
754754 return -3;
755755 }
756756
757- avrdude_message("%s: device was successfully re-initialized\n",
757+ avrdude_message(MSG_INFO, "%s: device was successfully re-initialized\n",
758758 progname);
759759 return 0;
760760 }
@@ -836,7 +836,7 @@
836836
837837 m = avr_locate_mem(p, memtype);
838838 if (m == NULL) {
839- avrdude_message("No \"%s\" memory for part %s\n",
839+ avrdude_message(MSG_INFO, "No \"%s\" memory for part %s\n",
840840 memtype, p->desc);
841841 return -1;
842842 }
@@ -850,7 +850,7 @@
850850 wsize = size;
851851 }
852852 else if (size > wsize) {
853- avrdude_message("%s: WARNING: %d bytes requested, but memory region is only %d"
853+ avrdude_message(MSG_INFO, "%s: WARNING: %d bytes requested, but memory region is only %d"
854854 "bytes\n"
855855 "%sOnly %d bytes will actually be written\n",
856856 progname, size, wsize,
@@ -940,8 +940,8 @@
940940 if (rc < 0)
941941 /* paged write failed, fall back to byte-at-a-time write below */
942942 failure = 1;
943- } else if (verbose >= 3) {
944- avrdude_message("%s: avr_write(): skipping page %u: no interesting data\n",
943+ } else {
944+ avrdude_message(MSG_DEBUG, "%s: avr_write(): skipping page %u: no interesting data\n",
945945 progname, pageaddr / m->page_size);
946946 }
947947 nwritten++;
@@ -1001,8 +1001,8 @@
10011001 if (do_write) {
10021002 rc = avr_write_byte(pgm, p, m, i, data);
10031003 if (rc) {
1004- avrdude_message(" ***failed; ");
1005- avrdude_message("\n");
1004+ avrdude_message(MSG_INFO, " ***failed; ");
1005+ avrdude_message(MSG_INFO, "\n");
10061006 pgm->err_led(pgm, ON);
10071007 werror = 1;
10081008 }
@@ -1015,11 +1015,11 @@
10151015 if (flush_page) {
10161016 rc = avr_write_page(pgm, p, m, i);
10171017 if (rc) {
1018- avrdude_message(" *** page %d (addresses 0x%04x - 0x%04x) failed "
1018+ avrdude_message(MSG_INFO, " *** page %d (addresses 0x%04x - 0x%04x) failed "
10191019 "to write\n",
10201020 i % m->page_size,
10211021 i - m->page_size + 1, i);
1022- avrdude_message("\n");
1022+ avrdude_message(MSG_INFO, "\n");
10231023 pgm->err_led(pgm, ON);
10241024 werror = 1;
10251025 }
@@ -1049,7 +1049,7 @@
10491049 report_progress (0,1,"Reading");
10501050 rc = avr_read(pgm, p, "signature", 0);
10511051 if (rc < 0) {
1052- avrdude_message("%s: error reading signature data for part \"%s\", rc=%d\n",
1052+ avrdude_message(MSG_INFO, "%s: error reading signature data for part \"%s\", rc=%d\n",
10531053 progname, p->desc, rc);
10541054 return -1;
10551055 }
@@ -1075,7 +1075,7 @@
10751075
10761076 a = avr_locate_mem(p, memtype);
10771077 if (a == NULL) {
1078- avrdude_message("avr_verify(): memory type \"%s\" not defined for part %s\n",
1078+ avrdude_message(MSG_INFO, "avr_verify(): memory type \"%s\" not defined for part %s\n",
10791079 memtype, p->desc);
10801080 return -1;
10811081 }
@@ -1082,7 +1082,7 @@
10821082
10831083 b = avr_locate_mem(v, memtype);
10841084 if (b == NULL) {
1085- avrdude_message("avr_verify(): memory type \"%s\" not defined for part %s\n",
1085+ avrdude_message(MSG_INFO, "avr_verify(): memory type \"%s\" not defined for part %s\n",
10861086 memtype, v->desc);
10871087 return -1;
10881088 }
@@ -1092,7 +1092,7 @@
10921092 vsize = a->size;
10931093
10941094 if (vsize < size) {
1095- avrdude_message("%s: WARNING: requested verification for %d bytes\n"
1095+ avrdude_message(MSG_INFO, "%s: WARNING: requested verification for %d bytes\n"
10961096 "%s%s memory region only contains %d bytes\n"
10971097 "%sOnly %d bytes will be verified.\n",
10981098 progname, size,
@@ -1104,7 +1104,7 @@
11041104 for (i=0; i<size; i++) {
11051105 if ((b->tags[i] & TAG_ALLOCATED) != 0 &&
11061106 buf1[i] != buf2[i]) {
1107- avrdude_message("%s: verification error, first mismatch at byte 0x%04x\n"
1107+ avrdude_message(MSG_INFO, "%s: verification error, first mismatch at byte 0x%04x\n"
11081108 "%s0x%02x != 0x%02x\n",
11091109 progname, i,
11101110 progbuf, buf1[i], buf2[i]);
@@ -1132,7 +1132,7 @@
11321132 for (i=4; i>0; i--) {
11331133 rc = pgm->read_byte(pgm, p, a, a->size-i, &v1);
11341134 if (rc < 0) {
1135- avrdude_message("%s: WARNING: can't read memory for cycle count, rc=%d\n",
1135+ avrdude_message(MSG_INFO, "%s: WARNING: can't read memory for cycle count, rc=%d\n",
11361136 progname, rc);
11371137 return -1;
11381138 }
@@ -1173,7 +1173,7 @@
11731173
11741174 rc = avr_write_byte(pgm, p, a, a->size-i, v1);
11751175 if (rc < 0) {
1176- avrdude_message("%s: WARNING: can't write memory for cycle count, rc=%d\n",
1176+ avrdude_message(MSG_INFO, "%s: WARNING: can't write memory for cycle count, rc=%d\n",
11771177 progname, rc);
11781178 return -1;
11791179 }
--- trunk/avrdude/avr910.c (revision 1320)
+++ trunk/avrdude/avr910.c (revision 1321)
@@ -57,7 +57,7 @@
5757 static void avr910_setup(PROGRAMMER * pgm)
5858 {
5959 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
60- avrdude_message("%s: avr910_setup(): Out of memory allocating private data\n",
60+ avrdude_message(MSG_INFO, "%s: avr910_setup(): Out of memory allocating private data\n",
6161 progname);
6262 exit(1);
6363 }
@@ -83,7 +83,7 @@
8383
8484 rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
8585 if (rv < 0) {
86- avrdude_message("%s: avr910_recv(): programmer is not responding\n",
86+ avrdude_message(MSG_INFO, "%s: avr910_recv(): programmer is not responding\n",
8787 progname);
8888 return 1;
8989 }
@@ -103,7 +103,7 @@
103103
104104 avr910_recv(pgm, &c, 1);
105105 if (c != '\r') {
106- avrdude_message("%s: error: programmer did not respond to command: %s\n",
106+ avrdude_message(MSG_INFO, "%s: error: programmer did not respond to command: %s\n",
107107 progname, errmsg);
108108 return 1;
109109 }
@@ -185,9 +185,9 @@
185185 avr910_send(pgm, "p", 1);
186186 avr910_recv(pgm, &type, 1);
187187
188- avrdude_message("Found programmer: Id = \"%s\"; type = %c\n", id, type);
189- avrdude_message(" Software Version = %c.%c; ", sw[0], sw[1]);
190- avrdude_message("Hardware Version = %c.%c\n", hw[0], hw[1]);
188+ avrdude_message(MSG_INFO, "Found programmer: Id = \"%s\"; type = %c\n", id, type);
189+ avrdude_message(MSG_INFO, " Software Version = %c.%c; ", sw[0], sw[1]);
190+ avrdude_message(MSG_INFO, "Hardware Version = %c.%c\n", hw[0], hw[1]);
191191
192192 /* See if programmer supports autoincrement of address. */
193193
@@ -194,7 +194,7 @@
194194 avr910_send(pgm, "a", 1);
195195 avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
196196 if (PDATA(pgm)->has_auto_incr_addr == 'Y')
197- avrdude_message("Programmer supports auto addr increment.\n");
197+ avrdude_message(MSG_INFO, "Programmer supports auto addr increment.\n");
198198
199199 /* Check support for buffered memory access, ignore if not available */
200200
@@ -206,7 +206,7 @@
206206 PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
207207 avr910_recv(pgm, &c, 1);
208208 PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
209- avrdude_message("Programmer supports buffered memory access with "
209+ avrdude_message(MSG_INFO, "Programmer supports buffered memory access with "
210210 "buffersize = %u bytes.\n",
211211 PDATA(pgm)->buffersize);
212212 PDATA(pgm)->use_blockmode = 1;
@@ -224,7 +224,7 @@
224224 /* Get list of devices that the programmer supports. */
225225
226226 avr910_send(pgm, "t", 1);
227- avrdude_message("\nProgrammer supports the following devices:\n");
227+ avrdude_message(MSG_INFO, "\nProgrammer supports the following devices:\n");
228228 devtype_1st = 0;
229229 while (1) {
230230 avr910_recv(pgm, &c, 1);
@@ -234,7 +234,7 @@
234234 break;
235235 part = locate_part_by_avr910_devcode(part_list, c);
236236
237- avrdude_message(" Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
237+ avrdude_message(MSG_INFO, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
238238
239239 /* FIXME: Need to lookup devcode and report the device. */
240240
@@ -241,10 +241,10 @@
241241 if (p->avr910_devcode == c)
242242 dev_supported = 1;
243243 };
244- avrdude_message("\n");
244+ avrdude_message(MSG_INFO, "\n");
245245
246246 if (!dev_supported) {
247- avrdude_message("%s: %s: selected device is not supported by programmer: %s\n",
247+ avrdude_message(MSG_INFO, "%s: %s: selected device is not supported by programmer: %s\n",
248248 progname, ovsigck? "warning": "error", p->id);
249249 if (!ovsigck)
250250 return -1;
@@ -264,9 +264,8 @@
264264 avr910_send(pgm, buf, 2);
265265 avr910_vfy_cmd_sent(pgm, "select device");
266266
267- if (verbose)
268- avrdude_message("%s: avr910_devcode selected: 0x%02x\n",
269- progname, (unsigned)buf[1]);
267+ avrdude_message(MSG_NOTICE, "%s: avr910_devcode selected: 0x%02x\n",
268+ progname, (unsigned)buf[1]);
270269
271270 avr910_enter_prog_mode(pgm);
272271
@@ -332,30 +331,26 @@
332331 int devcode;
333332 if (sscanf(extended_param, "devcode=%i", &devcode) != 1 ||
334333 devcode <= 0 || devcode > 255) {
335- avrdude_message("%s: avr910_parseextparms(): invalid devcode '%s'\n",
334+ avrdude_message(MSG_INFO, "%s: avr910_parseextparms(): invalid devcode '%s'\n",
336335 progname, extended_param);
337336 rv = -1;
338337 continue;
339338 }
340- if (verbose >= 2) {
341- avrdude_message("%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
342- progname, devcode);
343- }
339+ avrdude_message(MSG_NOTICE2, "%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
340+ progname, devcode);
344341 PDATA(pgm)->devcode = devcode;
345342
346343 continue;
347344 }
348345 if (strncmp(extended_param, "no_blockmode", strlen("no_blockmode")) == 0) {
349- if (verbose >= 2) {
350- avrdude_message("%s: avr910_parseextparms(-x): no testing for Blockmode\n",
351- progname);
352- }
346+ avrdude_message(MSG_NOTICE2, "%s: avr910_parseextparms(-x): no testing for Blockmode\n",
347+ progname);
353348 PDATA(pgm)->test_blockmode = 0;
354349
355350 continue;
356351 }
357352
358- avrdude_message("%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
353+ avrdude_message(MSG_INFO, "%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
359354 progname, extended_param);
360355 rv = -1;
361356 }
@@ -728,7 +723,7 @@
728723 unsigned char tmp;
729724
730725 if (m->size < 3) {
731- avrdude_message("%s: memsize too small for sig byte read", progname);
726+ avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
732727 return -1;
733728 }
734729
--- trunk/avrdude/avrdude.h (revision 1320)
+++ trunk/avrdude/avrdude.h (revision 1321)
@@ -28,8 +28,15 @@
2828 extern int verbose; /* verbosity level (-v, -vv, ...) */
2929 extern int quell_progress; /* quiteness level (-q, -qq) */
3030
31-int avrdude_message(const char *format, ...);
31+int avrdude_message(const int msglvl, const char *format, ...);
3232
33+#define MSG_INFO (0) /* no -v option, can be supressed with -qq */
34+#define MSG_NOTICE (1) /* displayed with -v */
35+#define MSG_NOTICE2 (2) /* displayed with -vv, used rarely */
36+#define MSG_DEBUG (3) /* displayed with -vvv */
37+#define MSG_TRACE (4) /* displayed with -vvvv, show trace commuication */
38+#define MSG_TRACE2 (5) /* displayed with -vvvvv */
39+
3340 #if defined(WIN32NATIVE)
3441
3542 #include "ac_cfg.h"
--- trunk/avrdude/avrftdi.c (revision 1320)
+++ trunk/avrdude/avrftdi.c (revision 1321)
@@ -52,7 +52,7 @@
5252
5353 static int avrftdi_noftdi_open (struct programmer_t *pgm, char * name)
5454 {
55- avrdude_message("%s: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
55+ avrdude_message(MSG_INFO, "%s: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
5656 progname);
5757
5858 return -1;
@@ -142,17 +142,17 @@
142142 if(!skip_prefix)
143143 {
144144 switch(level) {
145- case ERR: avrdude_message("E "); break;
146- case WARN: avrdude_message("W "); break;
147- case INFO: avrdude_message("I "); break;
148- case DEBUG: avrdude_message("D "); break;
149- case TRACE: avrdude_message("T "); break;
150- default: avrdude_message(" ");
145+ case ERR: avrdude_message(MSG_INFO, "E "); break;
146+ case WARN: avrdude_message(MSG_INFO, "W "); break;
147+ case INFO: avrdude_message(MSG_INFO, "I "); break;
148+ case DEBUG: avrdude_message(MSG_INFO, "D "); break;
149+ case TRACE: avrdude_message(MSG_INFO, "T "); break;
150+ default: avrdude_message(MSG_INFO, " ");
151151 }
152- avrdude_message("%s(%d): ", func, line);
152+ avrdude_message(MSG_INFO, "%s(%d): ", func, line);
153153 }
154154 va_start(ap, fmt);
155- avrdude_message(fmt, ap);
155+ avrdude_message(MSG_INFO, fmt, ap);
156156 va_end(ap);
157157 }
158158
@@ -172,16 +172,16 @@
172172 int offset, int width)
173173 {
174174 int i;
175- avrdude_message("%s begin:\n", desc);
175+ avrdude_message(MSG_INFO, "%s begin:\n", desc);
176176 for (i = 0; i < offset; i++)
177- avrdude_message("%02x ", buf[i]);
178- avrdude_message("\n");
177+ avrdude_message(MSG_INFO, "%02x ", buf[i]);
178+ avrdude_message(MSG_INFO, "\n");
179179 for (i++; i <= len; i++) {
180- avrdude_message("%02x ", buf[i-1]);
180+ avrdude_message(MSG_INFO, "%02x ", buf[i-1]);
181181 if((i-offset) != 0 && (i-offset)%width == 0)
182- avrdude_message("\n");
182+ avrdude_message(MSG_INFO, "\n");
183183 }
184- avrdude_message("%s end\n", desc);
184+ avrdude_message(MSG_INFO, "%s end\n", desc);
185185 }
186186
187187 /*
@@ -354,7 +354,7 @@
354354 size_t max_size = MIN(pdata->ftdic->max_packet_size,pdata->tx_buffer_size);
355355 // select block size so that resulting commands does not exceed max_size if possible
356356 blocksize = MAX(1,(max_size-7)/((8*2*6)+(8*1*2)));
357- //avrdude_message("blocksize %d \n",blocksize);
357+ //avrdude_message(MSG_INFO, "blocksize %d \n",blocksize);
358358
359359 while(remaining)
360360 {
@@ -670,7 +670,7 @@
670670 if (usbpid) {
671671 pid = *(int *)(ldata(usbpid));
672672 if (lnext(usbpid))
673- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
673+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
674674 progname, pid);
675675 } else
676676 pid = USB_DEVICE_FT2232;
--- trunk/avrdude/avrpart.c (revision 1320)
+++ trunk/avrdude/avrpart.c (revision 1321)
@@ -36,7 +36,7 @@
3636
3737 m = (OPCODE *)malloc(sizeof(*m));
3838 if (m == NULL) {
39- avrdude_message("avr_new_opcode(): out of memory\n");
39+ avrdude_message(MSG_INFO, "avr_new_opcode(): out of memory\n");
4040 exit(1);
4141 }
4242
@@ -56,7 +56,7 @@
5656
5757 m = (OPCODE *)malloc(sizeof(*m));
5858 if (m == NULL) {
59- avrdude_message("avr_dup_opcode(): out of memory\n");
59+ avrdude_message(MSG_INFO, "avr_dup_opcode(): out of memory\n");
6060 exit(1);
6161 }
6262
@@ -249,7 +249,7 @@
249249
250250 m = (AVRMEM *)malloc(sizeof(*m));
251251 if (m == NULL) {
252- avrdude_message("avr_new_memtype(): out of memory\n");
252+ avrdude_message(MSG_INFO, "avr_new_memtype(): out of memory\n");
253253 exit(1);
254254 }
255255
@@ -272,13 +272,13 @@
272272 m = ldata(ln);
273273 m->buf = (unsigned char *) malloc(m->size);
274274 if (m->buf == NULL) {
275- avrdude_message("%s: can't alloc buffer for %s size of %d bytes\n",
275+ avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
276276 progname, m->desc, m->size);
277277 return -1;
278278 }
279279 m->tags = (unsigned char *) malloc(m->size);
280280 if (m->tags == NULL) {
281- avrdude_message("%s: can't alloc buffer for %s size of %d bytes\n",
281+ avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
282282 progname, m->desc, m->size);
283283 return -1;
284284 }
@@ -300,7 +300,7 @@
300300 if (m->buf != NULL) {
301301 n->buf = (unsigned char *)malloc(n->size);
302302 if (n->buf == NULL) {
303- avrdude_message("avr_dup_mem(): out of memory (memsize=%d)\n",
303+ avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n",
304304 n->size);
305305 exit(1);
306306 }
@@ -310,7 +310,7 @@
310310 if (m->tags != NULL) {
311311 n->tags = (unsigned char *)malloc(n->size);
312312 if (n->tags == NULL) {
313- avrdude_message("avr_dup_mem(): out of memory (memsize=%d)\n",
313+ avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n",
314314 n->size);
315315 exit(1);
316316 }
@@ -404,7 +404,7 @@
404404 m->readback[0],
405405 m->readback[1]);
406406 if (verbose > 4) {
407- avrdude_message("%s Memory Ops:\n"
407+ avrdude_message(MSG_TRACE2, "%s Memory Ops:\n"
408408 "%s Oeration Inst Bit Bit Type Bitno Value\n"
409409 "%s ----------- -------- -------- ----- -----\n",
410410 prefix, prefix, prefix);
@@ -441,7 +441,7 @@
441441
442442 p = (AVRPART *)malloc(sizeof(AVRPART));
443443 if (p == NULL) {
444- avrdude_message("new_part(): out of memory\n");
444+ avrdude_message(MSG_INFO, "new_part(): out of memory\n");
445445 exit(1);
446446 }
447447
--- trunk/avrdude/bitbang.c (revision 1320)
+++ trunk/avrdude/bitbang.c (revision 1321)
@@ -73,9 +73,8 @@
7373 if (QueryPerformanceFrequency(&freq))
7474 {
7575 has_perfcount = 1;
76- if (verbose >= 2)
77- avrdude_message("%s: Using performance counter for bitbang delays\n",
78- progname);
76+ avrdude_message(MSG_NOTICE2, "%s: Using performance counter for bitbang delays\n",
77+ progname);
7978 }
8079 else
8180 {
@@ -88,9 +87,8 @@
8887 * auto-calibration figures seen on various Unix systems on
8988 * comparable hardware.
9089 */
91- if (verbose >= 2)
92- avrdude_message("%s: Using guessed per-microsecond delay count for bitbang delays\n",
93- progname);
90+ avrdude_message(MSG_NOTICE2, "%s: Using guessed per-microsecond delay count for bitbang delays\n",
91+ progname);
9492 delay_decrement = 100;
9593 }
9694 #else /* !WIN32NATIVE */
@@ -97,9 +95,8 @@
9795 struct itimerval itv;
9896 volatile int i;
9997
100- if (verbose >= 2)
101- avrdude_message("%s: Calibrating delay loop...",
102- progname);
98+ avrdude_message(MSG_NOTICE2, "%s: Calibrating delay loop...",
99+ progname);
103100 i = 0;
104101 done = 0;
105102 saved_alarmhandler = signal(SIGALRM, alarmhandler);
@@ -125,9 +122,8 @@
125122 * Calculate back from 100 ms to 1 us.
126123 */
127124 delay_decrement = -i / 100000;
128- if (verbose >= 2)
129- avrdude_message(" calibrated to %d cycles per us\n",
130- delay_decrement);
125+ avrdude_message(MSG_NOTICE2, " calibrated to %d cycles per us\n",
126+ delay_decrement);
131127 #endif /* WIN32NATIVE */
132128 }
133129
@@ -266,7 +262,7 @@
266262 break;
267263 }
268264 if (b != 0) {
269- avrdude_message("bitbang_tpi_rx: start bit not received correctly\n");
265+ avrdude_message(MSG_INFO, "bitbang_tpi_rx: start bit not received correctly\n");
270266 return -1;
271267 }
272268
@@ -281,7 +277,7 @@
281277
282278 /* parity bit */
283279 if (bitbang_tpi_clk(pgm) != parity) {
284- avrdude_message("bitbang_tpi_rx: parity bit is wrong\n");
280+ avrdude_message(MSG_INFO, "bitbang_tpi_rx: parity bit is wrong\n");
285281 return -1;
286282 }
287283
@@ -290,7 +286,7 @@
290286 b &= bitbang_tpi_clk(pgm);
291287 b &= bitbang_tpi_clk(pgm);
292288 if (b != 1) {
293- avrdude_message("bitbang_tpi_rx: stop bits not received correctly\n");
289+ avrdude_message(MSG_INFO, "bitbang_tpi_rx: stop bits not received correctly\n");
294290 return -1;
295291 }
296292
@@ -337,15 +333,15 @@
337333
338334 if(verbose >= 2)
339335 {
340- avrdude_message("bitbang_cmd(): [ ");
336+ avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
341337 for(i = 0; i < 4; i++)
342- avrdude_message("%02X ", cmd[i]);
343- avrdude_message("] [ ");
338+ avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
339+ avrdude_message(MSG_NOTICE2, "] [ ");
344340 for(i = 0; i < 4; i++)
345341 {
346- avrdude_message("%02X ", res[i]);
342+ avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
347343 }
348- avrdude_message("]\n");
344+ avrdude_message(MSG_NOTICE2, "]\n");
349345 }
350346
351347 return 0;
@@ -372,15 +368,15 @@
372368
373369 if(verbose >= 2)
374370 {
375- avrdude_message("bitbang_cmd_tpi(): [ ");
371+ avrdude_message(MSG_NOTICE2, "bitbang_cmd_tpi(): [ ");
376372 for(i = 0; i < cmd_len; i++)
377- avrdude_message("%02X ", cmd[i]);
378- avrdude_message("] [ ");
373+ avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
374+ avrdude_message(MSG_NOTICE2, "] [ ");
379375 for(i = 0; i < res_len; i++)
380376 {
381- avrdude_message("%02X ", res[i]);
377+ avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
382378 }
383- avrdude_message("]\n");
379+ avrdude_message(MSG_NOTICE2, "]\n");
384380 }
385381
386382 pgm->pgm_led(pgm, OFF);
@@ -408,15 +404,15 @@
408404
409405 if(verbose >= 2)
410406 {
411- avrdude_message("bitbang_cmd(): [ ");
407+ avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
412408 for(i = 0; i < count; i++)
413- avrdude_message("%02X ", cmd[i]);
414- avrdude_message("] [ ");
409+ avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
410+ avrdude_message(MSG_NOTICE2, "] [ ");
415411 for(i = 0; i < count; i++)
416412 {
417- avrdude_message("%02X ", res[i]);
413+ avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
418414 }
419- avrdude_message("]\n");
415+ avrdude_message(MSG_NOTICE2, "]\n");
420416 }
421417
422418 return 0;
@@ -444,7 +440,7 @@
444440 /* Set Pointer Register */
445441 mem = avr_locate_mem(p, "flash");
446442 if (mem == NULL) {
447- avrdude_message("No flash memory to erase for part %s\n",
443+ avrdude_message(MSG_INFO, "No flash memory to erase for part %s\n",
448444 p->desc);
449445 return -1;
450446 }
@@ -465,7 +461,7 @@
465461 }
466462
467463 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
468- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
464+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
469465 p->desc);
470466 return -1;
471467 }
@@ -506,7 +502,7 @@
506502 }
507503
508504 if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
509- avrdude_message("program enable instruction not defined for part \"%s\"\n",
505+ avrdude_message(MSG_INFO, "program enable instruction not defined for part \"%s\"\n",
510506 p->desc);
511507 return -1;
512508 }
@@ -539,7 +535,7 @@
539535 if (p->flags & AVRPART_HAS_TPI) {
540536 /* make sure cmd_tpi() is defined */
541537 if (pgm->cmd_tpi == NULL) {
542- avrdude_message("%s: Error: %s programmer does not support TPI\n",
538+ avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n",
543539 progname, pgm->type);
544540 return -1;
545541 }
@@ -548,22 +544,20 @@
548544 pgm->setpin(pgm, PIN_AVR_RESET, 1);
549545 usleep(1000);
550546
551- if (verbose >= 2)
552- avrdude_message("doing MOSI-MISO link check\n");
547+ avrdude_message(MSG_NOTICE2, "doing MOSI-MISO link check\n");
553548
554549 pgm->setpin(pgm, PIN_AVR_MOSI, 0);
555550 if (pgm->getpin(pgm, PIN_AVR_MISO) != 0) {
556- avrdude_message("MOSI->MISO 0 failed\n");
551+ avrdude_message(MSG_INFO, "MOSI->MISO 0 failed\n");
557552 return -1;
558553 }
559554 pgm->setpin(pgm, PIN_AVR_MOSI, 1);
560555 if (pgm->getpin(pgm, PIN_AVR_MISO) != 1) {
561- avrdude_message("MOSI->MISO 1 failed\n");
556+ avrdude_message(MSG_INFO, "MOSI->MISO 1 failed\n");
562557 return -1;
563558 }
564559
565- if (verbose >= 2)
566- avrdude_message("MOSI-MISO link present\n");
560+ avrdude_message(MSG_NOTICE2, "MOSI-MISO link present\n");
567561 }
568562
569563 pgm->setpin(pgm, PIN_AVR_SCK, 0);
@@ -584,7 +578,7 @@
584578 bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR);
585579 rc = bitbang_tpi_rx(pgm);
586580 if (rc != 0x80) {
587- avrdude_message("TPIIR not correct\n");
581+ avrdude_message(MSG_INFO, "TPIIR not correct\n");
588582 return -1;
589583 }
590584 } else {
@@ -618,7 +612,7 @@
618612 * can't sync with the device, maybe it's not attached?
619613 */
620614 if (rc) {
621- avrdude_message("%s: AVR device not responding\n", progname);
615+ avrdude_message(MSG_INFO, "%s: AVR device not responding\n", progname);
622616 return -1;
623617 }
624618 }
@@ -629,7 +623,7 @@
629623 static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc)
630624 {
631625 if (pgm->pinno[pin] == 0) {
632- avrdude_message("%s: error: no pin has been assigned for %s\n",
626+ avrdude_message(MSG_INFO, "%s: error: no pin has been assigned for %s\n",
633627 progname, desc);
634628 return -1;
635629 }
@@ -653,7 +647,7 @@
653647 return -1;
654648
655649 if (pgm->cmd == NULL) {
656- avrdude_message("%s: error: no cmd() method defined for bitbang programmer\n",
650+ avrdude_message(MSG_INFO, "%s: error: no cmd() method defined for bitbang programmer\n",
657651 progname);
658652 return -1;
659653 }
--- trunk/avrdude/buspirate.c (revision 1320)
+++ trunk/avrdude/buspirate.c (revision 1321)
@@ -97,15 +97,15 @@
9797
9898 for (i = 0; i<len; i++) {
9999 if (i % 8 == 0)
100- avrdude_message("\t");
101- avrdude_message("0x%02x ", (unsigned)buf[i] & 0xFF);
100+ avrdude_message(MSG_INFO, "\t");
101+ avrdude_message(MSG_INFO, "0x%02x ", (unsigned)buf[i] & 0xFF);
102102 if (i % 8 == 3)
103- avrdude_message(" ");
103+ avrdude_message(MSG_INFO, " ");
104104 else if (i % 8 == 7)
105- avrdude_message("\n");
105+ avrdude_message(MSG_INFO, "\n");
106106 }
107107 if (i % 8 != 7)
108- avrdude_message("\n");
108+ avrdude_message(MSG_INFO, "\n");
109109 }
110110
111111 static int buspirate_send_bin(struct programmer_t *pgm, char *data, size_t len)
@@ -113,7 +113,7 @@
113113 int rc;
114114
115115 if (verbose > 1) {
116- avrdude_message("%s: buspirate_send_bin():\n", progname);
116+ avrdude_message(MSG_INFO, "%s: buspirate_send_bin():\n", progname);
117117 dump_mem(data, len);
118118 }
119119
@@ -130,7 +130,7 @@
130130 if (rc < 0)
131131 return EOF;
132132 if (verbose > 1) {
133- avrdude_message("%s: buspirate_recv_bin():\n", progname);
133+ avrdude_message(MSG_INFO, "%s: buspirate_recv_bin():\n", progname);
134134 dump_mem(buf, len);
135135 }
136136
@@ -143,7 +143,7 @@
143143 {
144144 char *recv_buf = alloca(expect_len);
145145 if (!pgm->flag & BP_FLAG_IN_BINMODE) {
146- avrdude_message("BusPirate: Internal error: buspirate_send_bin() called from ascii mode");
146+ avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_send_bin() called from ascii mode");
147147 return -1;
148148 }
149149
@@ -168,7 +168,7 @@
168168 unsigned char ch = 0;
169169
170170 if (pgm->flag & BP_FLAG_IN_BINMODE) {
171- avrdude_message("BusPirate: Internal error: buspirate_getc() called from binmode");
171+ avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_getc() called from binmode");
172172 return EOF;
173173 }
174174
@@ -206,10 +206,9 @@
206206 serial_recv_timeout = PDATA(pgm)->serial_recv_timeout;
207207 }
208208 serial_recv_timeout = orig_serial_recv_timeout;
209- if (verbose)
210- avrdude_message("%s: buspirate_readline(): %s%s",
211- progname, buf,
212- buf[strlen(buf) - 1] == '\n' ? "" : "\n");
209+ avrdude_message(MSG_NOTICE, "%s: buspirate_readline(): %s%s",
210+ progname, buf,
211+ buf[strlen(buf) - 1] == '\n' ? "" : "\n");
213212 if (! buf[0])
214213 return NULL;
215214
@@ -222,7 +221,7 @@
222221
223222 ret = buspirate_readline_noexit(pgm, buf, len);
224223 if (! ret) {
225- avrdude_message("%s: buspirate_readline(): programmer is not responding\n",
224+ avrdude_message(MSG_INFO, "%s: buspirate_readline(): programmer is not responding\n",
226225 progname);
227226 return NULL;
228227 }
@@ -232,11 +231,10 @@
232231 {
233232 int rc;
234233
235- if (verbose)
236- avrdude_message("%s: buspirate_send(): %s", progname, str);
234+ avrdude_message(MSG_NOTICE, "%s: buspirate_send(): %s", progname, str);
237235
238236 if (pgm->flag & BP_FLAG_IN_BINMODE) {
239- avrdude_message("BusPirate: Internal error: buspirate_send() called from binmode");
237+ avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_send() called from binmode");
240238 return -1;
241239 }
242240
@@ -309,8 +307,8 @@
309307 }
310308 if (sscanf(extended_param, "spifreq=%d", &spifreq) == 1) {
311309 if (spifreq & (~0x07)) {
312- avrdude_message("BusPirate: spifreq must be between 0 and 7.\n");
313- avrdude_message("BusPirate: see BusPirate manual for details.\n");
310+ avrdude_message(MSG_INFO, "BusPirate: spifreq must be between 0 and 7.\n");
311+ avrdude_message(MSG_INFO, "BusPirate: see BusPirate manual for details.\n");
314312 return -1;
315313 }
316314 pgm->flag = (pgm->flag & ~BP_FLAG_XPARM_RAWFREQ) |
@@ -322,7 +320,7 @@
322320 unsigned rawfreq;
323321 if (sscanf(extended_param, "rawfreq=%u", &rawfreq) == 1) {
324322 if (rawfreq >= 4) {
325- avrdude_message("BusPirate: rawfreq must be "
323+ avrdude_message(MSG_INFO, "BusPirate: rawfreq must be "
326324 "between 0 and 3.\n");
327325 return -1;
328326 }
@@ -335,8 +333,8 @@
335333 if (sscanf(extended_param, "cpufreq=%d", &cpufreq) == 1) {
336334 /* lower limit comes from 'cpufreq > 4 * spifreq', spifreq in ascii mode is 30kHz. */
337335 if (cpufreq < 125 || cpufreq > 4000) {
338- avrdude_message("BusPirate: cpufreq must be between 125 and 4000 kHz.\n");
339- avrdude_message("BusPirate: see BusPirate manual for details.\n");
336+ avrdude_message(MSG_INFO, "BusPirate: cpufreq must be between 125 and 4000 kHz.\n");
337+ avrdude_message(MSG_INFO, "BusPirate: see BusPirate manual for details.\n");
340338 return -1;
341339 }
342340 PDATA(pgm)->cpufreq = cpufreq;
@@ -355,7 +353,7 @@
355353 else if (strcasecmp(resetpin, "aux2") == 0)
356354 PDATA(pgm)->reset |= BP_RESET_AUX2;
357355 else {
358- avrdude_message("BusPirate: reset must be either CS or AUX.\n");
356+ avrdude_message(MSG_INFO, "BusPirate: reset must be either CS or AUX.\n");
359357 return -1;
360358 }
361359 }
@@ -374,7 +372,7 @@
374372 }
375373 if (sscanf(extended_param, "serial_recv_timeout=%d", &serial_recv_timeout) == 1) {
376374 if (serial_recv_timeout < 1) {
377- avrdude_message("BusPirate: serial_recv_timeout must be greater 0.\n");
375+ avrdude_message(MSG_INFO, "BusPirate: serial_recv_timeout must be greater 0.\n");
378376 return -1;
379377 }
380378 PDATA(pgm)->serial_recv_timeout = serial_recv_timeout;
@@ -393,18 +391,18 @@
393391 PDATA(pgm)->reset |= BP_RESET_CS;
394392
395393 if ((PDATA(pgm)->reset != BP_RESET_CS) && buspirate_uses_ascii(pgm)) {
396- avrdude_message("BusPirate: RESET pin other than CS is not supported in ASCII mode\n");
394+ avrdude_message(MSG_INFO, "BusPirate: RESET pin other than CS is not supported in ASCII mode\n");
397395 return -1;
398396 }
399397
400398 if (( (pgm->flag & BP_FLAG_XPARM_SPIFREQ) ||
401399 (pgm->flag & BP_FLAG_XPARM_RAWFREQ) ) && buspirate_uses_ascii(pgm)) {
402- avrdude_message("BusPirate: SPI speed selection is not supported in ASCII mode\n");
400+ avrdude_message(MSG_INFO, "BusPirate: SPI speed selection is not supported in ASCII mode\n");
403401 return -1;
404402 }
405403
406404 if ((pgm->flag & BP_FLAG_XPARM_CPUFREQ) && !buspirate_uses_ascii(pgm)) {
407- avrdude_message("BusPirate: Setting cpufreq is only supported in ASCII mode\n");
405+ avrdude_message(MSG_INFO, "BusPirate: Setting cpufreq is only supported in ASCII mode\n");
408406 return -1;
409407 }
410408
@@ -463,12 +461,11 @@
463461 }
464462
465463 if (pgm->flag & BP_FLAG_IN_BINMODE) {
466- avrdude_message("BusPirate reset failed. You may need to powercycle it.\n");
464+ avrdude_message(MSG_INFO, "BusPirate reset failed. You may need to powercycle it.\n");
467465 return;
468466 }
469467
470- if (verbose)
471- avrdude_message("BusPirate is back in the text mode\n");
468+ avrdude_message(MSG_NOTICE, "BusPirate is back in the text mode\n");
472469 }
473470
474471 static int buspirate_start_mode_bin(struct programmer_t *pgm)
@@ -513,13 +510,12 @@
513510 memset(buf, 0, sizeof(buf));
514511 buspirate_recv_bin(pgm, buf, 5);
515512 if (sscanf(buf, "BBIO%d", &PDATA(pgm)->binmode_version) != 1) {
516- avrdude_message("Binary mode not confirmed: '%s'\n", buf);
513+ avrdude_message(MSG_INFO, "Binary mode not confirmed: '%s'\n", buf);
517514 buspirate_reset_from_binmode(pgm);
518515 return -1;
519516 }
520- if (verbose)
521- avrdude_message("BusPirate binmode version: %d\n",
522- PDATA(pgm)->binmode_version);
517+ avrdude_message(MSG_NOTICE, "BusPirate binmode version: %d\n",
518+ PDATA(pgm)->binmode_version);
523519
524520 pgm->flag |= BP_FLAG_IN_BINMODE;
525521
@@ -530,18 +526,16 @@
530526 buspirate_recv_bin(pgm, buf, 4);
531527 if (sscanf(buf, submode->entered_format,
532528 &PDATA(pgm)->submode_version) != 1) {
533- avrdude_message("%s mode not confirmed: '%s'\n",
529+ avrdude_message(MSG_INFO, "%s mode not confirmed: '%s'\n",
534530 submode->name, buf);
535531 buspirate_reset_from_binmode(pgm);
536532 return -1;
537533 }
538- if (verbose)
539- avrdude_message("BusPirate %s version: %d\n",
540- submode->name, PDATA(pgm)->submode_version);
534+ avrdude_message(MSG_NOTICE, "BusPirate %s version: %d\n",
535+ submode->name, PDATA(pgm)->submode_version);
541536
542537 if (pgm->flag & BP_FLAG_NOPAGEDWRITE) {
543- if (verbose)
544- avrdude_message("%s: Paged flash write disabled.\n", progname);
538+ avrdude_message(MSG_NOTICE, "%s: Paged flash write disabled.\n", progname);
545539 pgm->paged_write = NULL;
546540 } else {
547541 /* Check for write-then-read without !CS/CS and disable paged_write if absent: */
@@ -558,14 +552,12 @@
558552 buf[0] = 0x1;
559553 buspirate_send_bin(pgm, buf, 1);
560554
561- if (verbose)
562- avrdude_message("%s: Disabling paged flash write. (Need BusPirate firmware >=v5.10.)\n", progname);
555+ avrdude_message(MSG_NOTICE, "%s: Disabling paged flash write. (Need BusPirate firmware >=v5.10.)\n", progname);
563556
564557 /* Flush serial buffer: */
565558 serial_drain(&pgm->fd, 0);
566559 } else {
567- if (verbose)
568- avrdude_message("%s: Paged flash write enabled.\n", progname);
560+ avrdude_message(MSG_INFO, "%s: Paged flash write enabled.\n", progname);
569561 }
570562 }
571563
@@ -586,8 +578,7 @@
586578
587579 /* AVR Extended Commands - test for existence */
588580 if (pgm->flag & BP_FLAG_NOPAGEDREAD) {
589- if (verbose)
590- avrdude_message("%s: Paged flash read disabled.\n", progname);
581+ avrdude_message(MSG_NOTICE, "%s: Paged flash read disabled.\n", progname);
591582 pgm->paged_load = NULL;
592583 } else {
593584 int rv = buspirate_expect_bin_byte(pgm, 0x06, 0x01);
@@ -598,9 +589,9 @@
598589 buspirate_send_bin(pgm, buf, 1);
599590 buspirate_recv_bin(pgm, buf, 3);
600591 ver = buf[1] << 8 | buf[2];
601- if (verbose) avrdude_message("AVR Extended Commands version %d\n", ver);
592+ avrdude_message(MSG_NOTICE, "AVR Extended Commands version %d\n", ver);
602593 } else {
603- if (verbose) avrdude_message("AVR Extended Commands not found.\n");
594+ avrdude_message(MSG_NOTICE, "AVR Extended Commands not found.\n");
604595 pgm->flag |= BP_FLAG_NOPAGEDREAD;
605596 pgm->paged_load = NULL;
606597 }
@@ -626,9 +617,9 @@
626617 break;
627618 }
628619 if (spi_cmd == -1) {
629- avrdude_message("%s: SPI mode number not found. Does your BusPirate support SPI?\n",
620+ avrdude_message(MSG_INFO, "%s: SPI mode number not found. Does your BusPirate support SPI?\n",
630621 progname);
631- avrdude_message("%s: Try powercycling your BusPirate and try again.\n",
622+ avrdude_message(MSG_INFO, "%s: Try powercycling your BusPirate and try again.\n",
632623 progname);
633624 return -1;
634625 }
@@ -646,7 +637,7 @@
646637 }
647638 if (buspirate_is_prompt(rcvd)) {
648639 if (strncmp(rcvd, "SPI>", 4) == 0) {
649- if (verbose) avrdude_message("BusPirate is now configured for SPI\n");
640+ if (verbose) avrdude_message(MSG_INFO, "BusPirate is now configured for SPI\n");
650641 break;
651642 }
652643 /* Not yet 'SPI>' prompt */
@@ -673,7 +664,7 @@
673664
674665 /* Attempt to start binary SPI mode unless explicitly told otherwise: */
675666 if (!buspirate_uses_ascii(pgm)) {
676- avrdude_message("Attempting to initiate BusPirate binary mode...\n");
667+ avrdude_message(MSG_INFO, "Attempting to initiate BusPirate binary mode...\n");
677668
678669 /* Send two CRs to ensure we're not in a sub-menu of the UI if we're in ASCII mode: */
679670 buspirate_send_bin(pgm, "\n\n", 2);
@@ -685,16 +676,16 @@
685676 if (buspirate_start_mode_bin(pgm) >= 0)
686677 return;
687678 else
688- avrdude_message("%s: Failed to start binary mode, falling back to ASCII...\n", progname);
679+ avrdude_message(MSG_INFO, "%s: Failed to start binary mode, falling back to ASCII...\n", progname);
689680 }
690681
691- avrdude_message("Attempting to initiate BusPirate ASCII mode...\n");
682+ avrdude_message(MSG_INFO, "Attempting to initiate BusPirate ASCII mode...\n");
692683
693684 /* Call buspirate_send_bin() instead of buspirate_send()
694685 * because we don't know if BP is in text or bin mode */
695686 rc = buspirate_send_bin(pgm, reset_str, strlen(reset_str));
696687 if (rc) {
697- avrdude_message("BusPirate is not responding. Serial port error: %d\n", rc);
688+ avrdude_message(MSG_INFO, "BusPirate is not responding. Serial port error: %d\n", rc);
698689 return;
699690 }
700691
@@ -701,7 +692,7 @@
701692 while(1) {
702693 rcvd = buspirate_readline_noexit(pgm, NULL, 0);
703694 if (! rcvd) {
704- avrdude_message("%s: Fatal: Programmer is not responding.\n", progname);
695+ avrdude_message(MSG_INFO, "%s: Fatal: Programmer is not responding.\n", progname);
705696 return;
706697 }
707698 if (strncmp(rcvd, "Are you sure?", 13) == 0) {
@@ -716,13 +707,13 @@
716707 break;
717708 }
718709 if (print_banner)
719- avrdude_message("** %s", rcvd);
710+ avrdude_message(MSG_INFO, "** %s", rcvd);
720711 }
721712
722713 if (!(pgm->flag & BP_FLAG_IN_BINMODE)) {
723- avrdude_message("BusPirate: using ASCII mode\n");
714+ avrdude_message(MSG_INFO, "BusPirate: using ASCII mode\n");
724715 if (buspirate_start_spi_mode_ascii(pgm) < 0) {
725- avrdude_message("%s: Failed to start ascii SPI mode\n", progname);
716+ avrdude_message(MSG_INFO, "%s: Failed to start ascii SPI mode\n", progname);
726717 return;
727718 }
728719 }
@@ -763,7 +754,7 @@
763754 }
764755 }
765756 if(!ok) {
766- avrdude_message("%s: warning: did not get a response to start PWM command.\n", progname);
757+ avrdude_message(MSG_INFO, "%s: warning: did not get a response to start PWM command.\n", progname);
767758 }
768759 }
769760 return;
@@ -770,8 +761,8 @@
770761 }
771762 }
772763
773- avrdude_message("%s: warning: did not get a response to PowerUp command.\n", progname);
774- avrdude_message("%s: warning: Trying to continue anyway...\n", progname);
764+ avrdude_message(MSG_INFO, "%s: warning: did not get a response to PowerUp command.\n", progname);
765+ avrdude_message(MSG_INFO, "%s: warning: Trying to continue anyway...\n", progname);
775766 }
776767
777768 static void buspirate_powerdown(struct programmer_t *pgm)
@@ -784,7 +775,7 @@
784775 } else {
785776 if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) {
786777 if (!buspirate_expect(pgm, "g\n", "PWM disabled", 1)) {
787- avrdude_message("%s: warning: did not get a response to stop PWM command.\n", progname);
778+ avrdude_message(MSG_INFO, "%s: warning: did not get a response to stop PWM command.\n", progname);
788779 }
789780 }
790781 if (buspirate_expect(pgm, "w\n", "Power supplies OFF", 1))
@@ -791,7 +782,7 @@
791782 return;
792783 }
793784
794- avrdude_message("%s: warning: did not get a response to PowerDown command.\n", progname);
785+ avrdude_message(MSG_INFO, "%s: warning: did not get a response to PowerDown command.\n", progname);
795786 }
796787
797788 static int buspirate_cmd_bin(struct programmer_t *pgm,
@@ -834,7 +825,7 @@
834825 }
835826
836827 if (i != 4) {
837- avrdude_message("%s: error: SPI has not read 4 bytes back\n", progname);
828+ avrdude_message(MSG_INFO, "%s: error: SPI has not read 4 bytes back\n", progname);
838829 return -1;
839830 }
840831
@@ -868,11 +859,11 @@
868859 unsigned char buf[275];
869860 unsigned int addr = 0;
870861
871- if (verbose > 1) avrdude_message("BusPirate: buspirate_paged_load(..,%s,%d,%d,%d)\n",m->desc,m->page_size,address,n_bytes);
862+ avrdude_message(MSG_NOTICE, "BusPirate: buspirate_paged_load(..,%s,%d,%d,%d)\n",m->desc,m->page_size,address,n_bytes);
872863
873864 // This should never happen, but still...
874865 if (pgm->flag & BP_FLAG_NOPAGEDREAD) {
875- avrdude_message("BusPirate: buspirate_paged_load() called while in nopagedread mode!\n");
866+ avrdude_message(MSG_INFO, "BusPirate: buspirate_paged_load() called while in nopagedread mode!\n");
876867 return -1;
877868 }
878869
@@ -901,7 +892,7 @@
901892 buspirate_recv_bin(pgm, buf, 1);
902893
903894 if (buf[0] != 0x01) {
904- avrdude_message("BusPirate: Paged Read command returned zero.\n");
895+ avrdude_message(MSG_INFO, "BusPirate: Paged Read command returned zero.\n");
905896 return -1;
906897 }
907898
@@ -948,12 +939,12 @@
948939
949940 /* pre-check opcodes */
950941 if (m->op[AVR_OP_LOADPAGE_LO] == NULL) {
951- avrdude_message("%s failure: %s command not defined for %s\n",
942+ avrdude_message(MSG_INFO, "%s failure: %s command not defined for %s\n",
952943 progname, "AVR_OP_LOADPAGE_LO", p->desc);
953944 return -1;
954945 }
955946 if (m->op[AVR_OP_LOADPAGE_HI] == NULL) {
956- avrdude_message("%s failure: %s command not defined for %s\n",
947+ avrdude_message(MSG_INFO, "%s failure: %s command not defined for %s\n",
957948 progname, "AVR_OP_LOADPAGE_HI", p->desc);
958949 return -1;
959950 }
@@ -1014,7 +1005,7 @@
10141005
10151006 /* Check for write failure: */
10161007 if ((buspirate_recv_bin(pgm, &recv_byte, 1) == EOF) || (recv_byte != 0x01)) {
1017- avrdude_message("BusPirate: Fatal error: Write Then Read did not succeed.\n");
1008+ avrdude_message(MSG_INFO, "BusPirate: Fatal error: Write Then Read did not succeed.\n");
10181009 pgm->pgm_led(pgm, OFF);
10191010 pgm->err_led(pgm, ON);
10201011 return -1;
@@ -1045,7 +1036,7 @@
10451036 buspirate_expect(pgm, "{\n", "CS ENABLED", 1);
10461037
10471038 if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
1048- avrdude_message("program enable instruction not defined for part \"%s\"\n",
1039+ avrdude_message(MSG_INFO, "program enable instruction not defined for part \"%s\"\n",
10491040 p->desc);
10501041 return -1;
10511042 }
@@ -1066,7 +1057,7 @@
10661057 unsigned char res[4];
10671058
10681059 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
1069- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
1060+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
10701061 p->desc);
10711062 return -1;
10721063 }
@@ -1090,7 +1081,7 @@
10901081 {
10911082 /* Allocate private data */
10921083 if ((pgm->cookie = calloc(1, sizeof(struct pdata))) == 0) {
1093- avrdude_message("%s: buspirate_initpgm(): Out of memory allocating private data\n",
1084+ avrdude_message(MSG_INFO, "%s: buspirate_initpgm(): Out of memory allocating private data\n",
10941085 progname);
10951086 exit(1);
10961087 }
@@ -1144,7 +1135,7 @@
11441135 if (bitbang_check_prerequisites(pgm) < 0)
11451136 return; /* XXX should treat as error */
11461137
1147- avrdude_message("Attempting to initiate BusPirate bitbang binary mode...\n");
1138+ avrdude_message(MSG_INFO, "Attempting to initiate BusPirate bitbang binary mode...\n");
11481139
11491140 /* Send two CRs to ensure we're not in a sub-menu of the UI if we're in ASCII mode: */
11501141 buspirate_send_bin(pgm, "\n\n", 2);
@@ -1159,11 +1150,11 @@
11591150 memset(buf, 0, sizeof(buf));
11601151 buspirate_recv_bin(pgm, buf, 5);
11611152 if (sscanf(buf, "BBIO%d", &PDATA(pgm)->binmode_version) != 1) {
1162- avrdude_message("Binary mode not confirmed: '%s'\n", buf);
1153+ avrdude_message(MSG_INFO, "Binary mode not confirmed: '%s'\n", buf);
11631154 buspirate_reset_from_binmode(pgm);
11641155 return;
11651156 }
1166- avrdude_message("BusPirate binmode version: %d\n",
1157+ avrdude_message(MSG_INFO, "BusPirate binmode version: %d\n",
11671158 PDATA(pgm)->binmode_version);
11681159
11691160 pgm->flag |= BP_FLAG_IN_BINMODE;
--- trunk/avrdude/butterfly.c (revision 1320)
+++ trunk/avrdude/butterfly.c (revision 1321)
@@ -63,7 +63,7 @@
6363 static void butterfly_setup(PROGRAMMER * pgm)
6464 {
6565 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
66- avrdude_message("%s: butterfly_setup(): Out of memory allocating private data\n",
66+ avrdude_message(MSG_INFO, "%s: butterfly_setup(): Out of memory allocating private data\n",
6767 progname);
6868 exit(1);
6969 }
@@ -87,7 +87,7 @@
8787
8888 rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
8989 if (rv < 0) {
90- avrdude_message("%s: butterfly_recv(): programmer is not responding\n",
90+ avrdude_message(MSG_INFO, "%s: butterfly_recv(): programmer is not responding\n",
9191 progname);
9292 return -1;
9393 }
@@ -107,7 +107,7 @@
107107
108108 butterfly_recv(pgm, &c, 1);
109109 if (c != '\r') {
110- avrdude_message("%s: error: programmer did not respond to command: %s\n",
110+ avrdude_message(MSG_INFO, "%s: error: programmer did not respond to command: %s\n",
111111 progname, errmsg);
112112 return -1;
113113 }
@@ -222,7 +222,7 @@
222222 * Send some ESC to activate butterfly bootloader. This is not needed
223223 * for plain avr109 bootloaders but does not harm there either.
224224 */
225- avrdude_message("Connecting to programmer: ");
225+ avrdude_message(MSG_INFO, "Connecting to programmer: ");
226226 if (pgm->flag & IS_BUTTERFLY_MK)
227227 {
228228 char mk_reset_cmd[6] = {"#aR@S\r"};
@@ -246,7 +246,7 @@
246246 butterfly_recv(pgm, &c, 1);
247247 if ( c != 'M' && c != '?')
248248 {
249- avrdude_message("\nConnection FAILED.");
249+ avrdude_message(MSG_INFO, "\nConnection FAILED.");
250250 return -1;
251251 }
252252 else
@@ -293,12 +293,12 @@
293293 butterfly_send(pgm, "p", 1);
294294 butterfly_recv(pgm, &type, 1);
295295
296- avrdude_message("Found programmer: Id = \"%s\"; type = %c\n", id, type);
297- avrdude_message(" Software Version = %c.%c; ", sw[0], sw[1]);
296+ avrdude_message(MSG_INFO, "Found programmer: Id = \"%s\"; type = %c\n", id, type);
297+ avrdude_message(MSG_INFO, " Software Version = %c.%c; ", sw[0], sw[1]);
298298 if (hw[0]=='?') {
299- avrdude_message("No Hardware Version given.\n");
299+ avrdude_message(MSG_INFO, "No Hardware Version given.\n");
300300 } else {
301- avrdude_message("Hardware Version = %c.%c\n", hw[0], hw[1]);
301+ avrdude_message(MSG_INFO, "Hardware Version = %c.%c\n", hw[0], hw[1]);
302302 };
303303
304304 /* See if programmer supports autoincrement of address. */
@@ -306,7 +306,7 @@
306306 butterfly_send(pgm, "a", 1);
307307 butterfly_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
308308 if (PDATA(pgm)->has_auto_incr_addr == 'Y')
309- avrdude_message("Programmer supports auto addr increment.\n");
309+ avrdude_message(MSG_INFO, "Programmer supports auto addr increment.\n");
310310
311311 /* Check support for buffered memory access, abort if not available */
312312
@@ -313,7 +313,7 @@
313313 butterfly_send(pgm, "b", 1);
314314 butterfly_recv(pgm, &c, 1);
315315 if (c != 'Y') {
316- avrdude_message("%s: error: buffered memory access not supported. Maybe it isn't\n"\
316+ avrdude_message(MSG_INFO, "%s: error: buffered memory access not supported. Maybe it isn't\n"\
317317 "a butterfly/AVR109 but a AVR910 device?\n", progname);
318318 return -1;
319319 };
@@ -321,13 +321,13 @@
321321 PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
322322 butterfly_recv(pgm, &c, 1);
323323 PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
324- avrdude_message("Programmer supports buffered memory access with buffersize=%i bytes.\n",
324+ avrdude_message(MSG_INFO, "Programmer supports buffered memory access with buffersize=%i bytes.\n",
325325 PDATA(pgm)->buffersize);
326326
327327 /* Get list of devices that the programmer supports. */
328328
329329 butterfly_send(pgm, "t", 1);
330- avrdude_message("\nProgrammer supports the following devices:\n");
330+ avrdude_message(MSG_INFO, "\nProgrammer supports the following devices:\n");
331331 devtype_1st = 0;
332332 while (1) {
333333 butterfly_recv(pgm, &c, 1);
@@ -336,9 +336,9 @@
336336
337337 if (c == 0)
338338 break;
339- avrdude_message(" Device code: 0x%02x\n", (unsigned int)(unsigned char)c);
339+ avrdude_message(MSG_INFO, " Device code: 0x%02x\n", (unsigned int)(unsigned char)c);
340340 };
341- avrdude_message("\n");
341+ avrdude_message(MSG_INFO, "\n");
342342
343343 /* Tell the programmer which part we selected.
344344 According to the AVR109 code, this is ignored by the bootloader. As
@@ -356,7 +356,7 @@
356356 return -1;
357357
358358 if (verbose)
359- avrdude_message("%s: devcode selected: 0x%02x\n",
359+ avrdude_message(MSG_INFO, "%s: devcode selected: 0x%02x\n",
360360 progname, (unsigned)buf[1]);
361361
362362 butterfly_enter_prog_mode(pgm);
@@ -550,7 +550,7 @@
550550 return -1; /* not supported */
551551 if (strcmp(m->desc, "eeprom") == 0)
552552 return 0; /* nothing to do */
553- avrdude_message("%s: butterfly_page_erase() called on memory type \"%s\"\n",
553+ avrdude_message(MSG_INFO, "%s: butterfly_page_erase() called on memory type \"%s\"\n",
554554 progname, m->desc);
555555 return -1;
556556 }
@@ -697,7 +697,7 @@
697697 unsigned char tmp;
698698
699699 if (m->size < 3) {
700- avrdude_message("%s: memsize too small for sig byte read", progname);
700+ avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
701701 return -1;
702702 }
703703
--- trunk/avrdude/config.c (revision 1320)
+++ trunk/avrdude/config.c (revision 1321)
@@ -93,7 +93,7 @@
9393
9494 tkn = (TOKEN *)malloc(sizeof(TOKEN));
9595 if (tkn == NULL) {
96- avrdude_message("new_token(): out of memory\n");
96+ avrdude_message(MSG_INFO, "new_token(): out of memory\n");
9797 exit(1);
9898 }
9999
@@ -145,7 +145,7 @@
145145 tkn->value.number = atoi(text);
146146
147147 #if DEBUG
148- avrdude_message("NUMBER(%d)\n", tkn->value.number);
148+ avrdude_message(MSG_INFO, "NUMBER(%d)\n", tkn->value.number);
149149 #endif
150150
151151 return tkn;
@@ -160,7 +160,7 @@
160160 tkn->value.number_real = atof(text);
161161
162162 #if DEBUG
163- avrdude_message("NUMBER(%g)\n", tkn->value.number_real);
163+ avrdude_message(MSG_INFO, "NUMBER(%g)\n", tkn->value.number_real);
164164 #endif
165165
166166 return tkn;
@@ -175,12 +175,12 @@
175175 tkn->value.type = V_NUM;
176176 tkn->value.number = strtoul(text, &e, 16);
177177 if ((e == text) || (*e != 0)) {
178- avrdude_message("error at %s:%d: can't scan hex number \"%s\"\n",
178+ avrdude_message(MSG_INFO, "error at %s:%d: can't scan hex number \"%s\"\n",
179179 infile, lineno, text);
180180 }
181181
182182 #if DEBUG
183- avrdude_message("HEXNUMBER(%g)\n", tkn->value.number);
183+ avrdude_message(MSG_INFO, "HEXNUMBER(%g)\n", tkn->value.number);
184184 #endif
185185
186186 return tkn;
@@ -199,13 +199,13 @@
199199 tkn->value.type = V_STR;
200200 tkn->value.string = (char *) malloc(len+1);
201201 if (tkn->value.string == NULL) {
202- avrdude_message("id(): out of memory\n");
202+ avrdude_message(MSG_INFO, "id(): out of memory\n");
203203 exit(1);
204204 }
205205 strcpy(tkn->value.string, text);
206206
207207 #if DEBUG
208- avrdude_message("STRING(%s)\n", tkn->value.string);
208+ avrdude_message(MSG_INFO, "STRING(%s)\n", tkn->value.string);
209209 #endif
210210
211211 return tkn;
@@ -227,26 +227,26 @@
227227 if (!tkn)
228228 return;
229229
230- avrdude_message("token = %d = ", tkn->primary);
230+ avrdude_message(MSG_INFO, "token = %d = ", tkn->primary);
231231 switch (tkn->value.type) {
232232 case V_NUM:
233- avrdude_message("NUMBER, value=%d", tkn->value.number);
233+ avrdude_message(MSG_INFO, "NUMBER, value=%d", tkn->value.number);
234234 break;
235235
236236 case V_NUM_REAL:
237- avrdude_message("NUMBER, value=%g", tkn->value.number_real);
237+ avrdude_message(MSG_INFO, "NUMBER, value=%g", tkn->value.number_real);
238238 break;
239239
240240 case V_STR:
241- avrdude_message("STRING, value=%s", tkn->value.string);
241+ avrdude_message(MSG_INFO, "STRING, value=%s", tkn->value.string);
242242 break;
243243
244244 default:
245- avrdude_message("<other>");
245+ avrdude_message(MSG_INFO, "<other>");
246246 break;
247247 }
248248
249- avrdude_message("\n");
249+ avrdude_message(MSG_INFO, "\n");
250250 }
251251
252252
@@ -253,7 +253,7 @@
253253 void pyytext(void)
254254 {
255255 #if DEBUG
256- avrdude_message("TOKEN: \"%s\"\n", yytext);
256+ avrdude_message(MSG_INFO, "TOKEN: \"%s\"\n", yytext);
257257 #endif
258258 }
259259
@@ -264,7 +264,7 @@
264264
265265 s = strdup(str);
266266 if (s == NULL) {
267- avrdude_message("dup_string(): out of memory\n");
267+ avrdude_message(MSG_INFO, "dup_string(): out of memory\n");
268268 exit(1);
269269 }
270270
@@ -282,7 +282,7 @@
282282
283283 f = fopen(file, "r");
284284 if (f == NULL) {
285- avrdude_message("%s: can't open config file \"%s\": %s\n",
285+ avrdude_message(MSG_INFO, "%s: can't open config file \"%s\": %s\n",
286286 progname, file, strerror(errno));
287287 return -1;
288288 }
--- trunk/avrdude/config_gram.y (revision 1320)
+++ trunk/avrdude/config_gram.y (revision 1321)
@@ -271,12 +271,12 @@
271271 PROGRAMMER * existing_prog;
272272 char * id;
273273 if (lsize(current_prog->id) == 0) {
274- avrdude_message("%s: error at %s:%d: required parameter id not specified\n",
274+ avrdude_message(MSG_INFO, "%s: error at %s:%d: required parameter id not specified\n",
275275 progname, infile, lineno);
276276 exit(1);
277277 }
278278 if (current_prog->initpgm == NULL) {
279- avrdude_message("%s: error at %s:%d: programmer type not specified\n",
279+ avrdude_message(MSG_INFO, "%s: error at %s:%d: programmer type not specified\n",
280280 progname, infile, lineno);
281281 exit(1);
282282 }
@@ -283,7 +283,7 @@
283283 id = ldata(lfirst(current_prog->id));
284284 existing_prog = locate_programmer(programmers, id);
285285 if (existing_prog) {
286- avrdude_message("%s: warning at %s:%d: programmer %s overwrites "
286+ avrdude_message(MSG_INFO, "%s: warning at %s:%d: programmer %s overwrites "
287287 "previous definition %s:%d.\n",
288288 progname, infile, current_prog->lineno,
289289 id, existing_prog->config_file, existing_prog->lineno);
@@ -309,7 +309,7 @@
309309 {
310310 struct programmer_t * pgm = locate_programmer(programmers, $3->value.string);
311311 if (pgm == NULL) {
312- avrdude_message("%s: error at %s:%d: parent programmer %s not found\n",
312+ avrdude_message(MSG_INFO, "%s: error at %s:%d: parent programmer %s not found\n",
313313 progname, infile, lineno, $3->value.string);
314314 exit(1);
315315 }
@@ -329,7 +329,7 @@
329329 AVRPART * existing_part;
330330
331331 if (current_part->id[0] == 0) {
332- avrdude_message("%s: error at %s:%d: required parameter id not specified\n",
332+ avrdude_message(MSG_INFO, "%s: error at %s:%d: required parameter id not specified\n",
333333 progname, infile, lineno);
334334 exit(1);
335335 }
@@ -343,19 +343,19 @@
343343 m = ldata(ln);
344344 if (m->paged) {
345345 if (m->page_size == 0) {
346- avrdude_message("%s: error at %s:%d: must specify page_size for paged "
346+ avrdude_message(MSG_INFO, "%s: error at %s:%d: must specify page_size for paged "
347347 "memory\n",
348348 progname, infile, lineno);
349349 exit(1);
350350 }
351351 if (m->num_pages == 0) {
352- avrdude_message("%s: error at %s:%d: must specify num_pages for paged "
352+ avrdude_message(MSG_INFO, "%s: error at %s:%d: must specify num_pages for paged "
353353 "memory\n",
354354 progname, infile, lineno);
355355 exit(1);
356356 }
357357 if (m->size != m->page_size * m->num_pages) {
358- avrdude_message("%s: error at %s:%d: page size (%u) * num_pages (%u) = "
358+ avrdude_message(MSG_INFO, "%s: error at %s:%d: page size (%u) * num_pages (%u) = "
359359 "%u does not match memory size (%u)\n",
360360 progname, infile, lineno,
361361 m->page_size,
@@ -370,7 +370,7 @@
370370
371371 existing_part = locate_part(part_list, current_part->id);
372372 if (existing_part) {
373- avrdude_message("%s: warning at %s:%d: part %s overwrites "
373+ avrdude_message(MSG_INFO, "%s: warning at %s:%d: part %s overwrites "
374374 "previous definition %s:%d.\n",
375375 progname, infile, current_part->lineno, current_part->id,
376376 existing_part->config_file, existing_part->lineno);
@@ -393,7 +393,7 @@
393393 {
394394 AVRPART * parent_part = locate_part(part_list, $3->value.string);
395395 if (parent_part == NULL) {
396- avrdude_message("%s: error at %s:%d: can't find parent part",
396+ avrdude_message(MSG_INFO, "%s: error at %s:%d: can't find parent part",
397397 progname, infile, lineno);
398398 exit(1);
399399 }
@@ -462,7 +462,7 @@
462462 TKN_STRING {
463463 const struct programmer_type_t * pgm_type = locate_programmer_type($1->value.string);
464464 if (pgm_type == NULL) {
465- avrdude_message("%s: error at %s:%d: programmer type %s not found\n",
465+ avrdude_message(MSG_INFO, "%s: error at %s:%d: programmer type %s not found\n",
466466 progname, infile, lineno, $1->value.string);
467467 exit(1);
468468 }
@@ -471,7 +471,7 @@
471471 }
472472 | error
473473 {
474- avrdude_message("%s: error at %s:%d: programmer type must be written as \"id_type\"\n",
474+ avrdude_message(MSG_INFO, "%s: error at %s:%d: programmer type must be written as \"id_type\"\n",
475475 progname, infile, lineno);
476476 exit(1);
477477 }
@@ -643,7 +643,7 @@
643643
644644 K_DEVICECODE TKN_EQUAL TKN_NUMBER {
645645 {
646- avrdude_message("%s: error at %s:%d: devicecode is deprecated, use "
646+ avrdude_message(MSG_INFO, "%s: error at %s:%d: devicecode is deprecated, use "
647647 "stk500_devcode instead\n",
648648 progname, infile, lineno);
649649 exit(1);
@@ -708,7 +708,7 @@
708708 }
709709 if (!ok)
710710 {
711- avrdude_message("%s: Warning: line %d of %s: "
711+ avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: "
712712 "too many bytes in control stack\n",
713713 progname, lineno, infile);
714714 }
@@ -741,7 +741,7 @@
741741 }
742742 if (!ok)
743743 {
744- avrdude_message("%s: Warning: line %d of %s: "
744+ avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: "
745745 "too many bytes in control stack\n",
746746 progname, lineno, infile);
747747 }
@@ -773,7 +773,7 @@
773773 }
774774 if (!ok)
775775 {
776- avrdude_message("%s: Warning: line %d of %s: "
776+ avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: "
777777 "too many bytes in flash instructions\n",
778778 progname, lineno, infile);
779779 }
@@ -805,7 +805,7 @@
805805 }
806806 if (!ok)
807807 {
808- avrdude_message("%s: Warning: line %d of %s: "
808+ avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: "
809809 "too many bytes in EEPROM instructions\n",
810810 progname, lineno, infile);
811811 }
@@ -1211,7 +1211,7 @@
12111211 op = avr_new_opcode();
12121212 parse_cmdbits(op);
12131213 if (current_part->op[opnum] != NULL) {
1214- /*avrdude_message("%s: warning at %s:%d: operation redefined\n",
1214+ /*avrdude_message(MSG_INFO, "%s: warning at %s:%d: operation redefined\n",
12151215 progname, infile, lineno);*/
12161216 avr_free_opcode(current_part->op[opnum]);
12171217 }
@@ -1337,7 +1337,7 @@
13371337 op = avr_new_opcode();
13381338 parse_cmdbits(op);
13391339 if (current_mem->op[opnum] != NULL) {
1340- /*avrdude_message("%s: warning at %s:%d: operation redefined\n",
1340+ /*avrdude_message(MSG_INFO, "%s: warning at %s:%d: operation redefined\n",
13411341 progname, infile, lineno);*/
13421342 avr_free_opcode(current_mem->op[opnum]);
13431343 }
@@ -1373,7 +1373,7 @@
13731373 free_token(v);
13741374
13751375 if ((value < PIN_MIN) || (value > PIN_MAX)) {
1376- avrdude_message("%s: error at line %d of %s: pin must be in the "
1376+ avrdude_message(MSG_INFO, "%s: error at line %d of %s: pin must be in the "
13771377 "range %d-%d\n",
13781378 progname, lineno, infile, PIN_MIN, PIN_MAX);
13791379 exit(1);
@@ -1394,7 +1394,7 @@
13941394 t = lrmv_n(number_list, 1);
13951395 pin = t->value.number;
13961396 if ((pin < PIN_MIN) || (pin > PIN_MAX)) {
1397- avrdude_message("%s: error at line %d of %s: pin must be in the "
1397+ avrdude_message(MSG_INFO, "%s: error at line %d of %s: pin must be in the "
13981398 "range %d-%d\n",
13991399 progname, lineno, infile, PIN_MIN, PIN_MAX);
14001400 exit(1);
@@ -1423,7 +1423,7 @@
14231423 case K_CHIP_ERASE : return AVR_OP_CHIP_ERASE; break;
14241424 case K_PGM_ENABLE : return AVR_OP_PGM_ENABLE; break;
14251425 default :
1426- avrdude_message("%s: error at %s:%d: invalid opcode\n",
1426+ avrdude_message(MSG_INFO, "%s: error at %s:%d: invalid opcode\n",
14271427 progname, infile, lineno);
14281428 exit(1);
14291429 break;
@@ -1451,7 +1451,7 @@
14511451
14521452 bitno--;
14531453 if (bitno < 0) {
1454- avrdude_message("%s: error at %s:%d: too many opcode bits for instruction\n",
1454+ avrdude_message(MSG_INFO, "%s: error at %s:%d: too many opcode bits for instruction\n",
14551455 progname, infile, lineno);
14561456 exit(1);
14571457 }
@@ -1459,7 +1459,7 @@
14591459 len = strlen(s);
14601460
14611461 if (len == 0) {
1462- avrdude_message("%s: error at %s:%d: invalid bit specifier \"\"\n",
1462+ avrdude_message(MSG_INFO, "%s: error at %s:%d: invalid bit specifier \"\"\n",
14631463 progname, infile, lineno);
14641464 exit(1);
14651465 }
@@ -1499,7 +1499,7 @@
14991499 op->bit[bitno].bitno = bitno % 8;
15001500 break;
15011501 default :
1502- avrdude_message("%s: error at %s:%d: invalid bit specifier '%c'\n",
1502+ avrdude_message(MSG_INFO, "%s: error at %s:%d: invalid bit specifier '%c'\n",
15031503 progname, infile, lineno, ch);
15041504 exit(1);
15051505 break;
@@ -1510,7 +1510,7 @@
15101510 q = &s[1];
15111511 op->bit[bitno].bitno = strtol(q, &e, 0);
15121512 if ((e == q)||(*e != 0)) {
1513- avrdude_message("%s: error at %s:%d: can't parse bit number from \"%s\"\n",
1513+ avrdude_message(MSG_INFO, "%s: error at %s:%d: can't parse bit number from \"%s\"\n",
15141514 progname, infile, lineno, q);
15151515 exit(1);
15161516 }
@@ -1518,7 +1518,7 @@
15181518 op->bit[bitno].value = 0;
15191519 }
15201520 else {
1521- avrdude_message("%s: error at %s:%d: invalid bit specifier \"%s\"\n",
1521+ avrdude_message(MSG_INFO, "%s: error at %s:%d: invalid bit specifier \"%s\"\n",
15221522 progname, infile, lineno, s);
15231523 exit(1);
15241524 }
--- trunk/avrdude/dfu.c (revision 1320)
+++ trunk/avrdude/dfu.c (revision 1321)
@@ -39,7 +39,7 @@
3939 #ifndef HAVE_LIBUSB
4040
4141 struct dfu_dev *dfu_open(char *port_name) {
42- avrdude_message("%s: Error: No USB support in this compile of avrdude\n",
42+ avrdude_message(MSG_INFO, "%s: Error: No USB support in this compile of avrdude\n",
4343 progname);
4444 return NULL;
4545 }
@@ -112,7 +112,7 @@
112112 */
113113
114114 if (strncmp(port_spec, "usb", 3) != 0) {
115- avrdude_message("%s: Error: "
115+ avrdude_message(MSG_INFO, "%s: Error: "
116116 "Invalid port specification \"%s\" for USB device\n",
117117 progname, port_spec);
118118 return NULL;
@@ -121,7 +121,7 @@
121121 if(':' == port_spec[3]) {
122122 bus_name = strdup(port_spec + 3 + 1);
123123 if (bus_name == NULL) {
124- avrdude_message("%s: Out of memory in strdup\n", progname);
124+ avrdude_message(MSG_INFO, "%s: Out of memory in strdup\n", progname);
125125 return NULL;
126126 }
127127
@@ -138,7 +138,7 @@
138138
139139 if (dfu == NULL)
140140 {
141- avrdude_message("%s: out of memory\n", progname);
141+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
142142 return 0;
143143 }
144144
@@ -171,7 +171,7 @@
171171 */
172172
173173 if (pid == 0 && dfu->dev_name == NULL) {
174- avrdude_message("%s: Error: No DFU support for part; "
174+ avrdude_message(MSG_INFO, "%s: Error: No DFU support for part; "
175175 "specify PID in config or USB address (via -P) to override.\n",
176176 progname);
177177 return -1;
@@ -208,12 +208,12 @@
208208 * why the match failed, and if we came across another DFU-capable part.
209209 */
210210
211- avrdude_message("%s: Error: No matching USB device found\n", progname);
211+ avrdude_message(MSG_INFO, "%s: Error: No matching USB device found\n", progname);
212212 return -1;
213213 }
214214
215215 if(verbose)
216- avrdude_message("%s: Found VID=0x%04x PID=0x%04x at %s:%s\n",
216+ avrdude_message(MSG_INFO, "%s: Found VID=0x%04x PID=0x%04x at %s:%s\n",
217217 progname, found->descriptor.idVendor, found->descriptor.idProduct,
218218 found->bus->dirname, found->filename);
219219
@@ -220,7 +220,7 @@
220220 dfu->dev_handle = usb_open(found);
221221
222222 if (dfu->dev_handle == NULL) {
223- avrdude_message("%s: Error: USB device at %s:%s: %s\n",
223+ avrdude_message(MSG_INFO, "%s: Error: USB device at %s:%s: %s\n",
224224 progname, found->bus->dirname, found->filename, usb_strerror());
225225 return -1;
226226 }
@@ -271,8 +271,7 @@
271271 {
272272 int result;
273273
274- if (verbose > 3)
275- avrdude_message("%s: dfu_getstatus(): issuing control IN message\n",
274+ avrdude_message(MSG_TRACE, "%s: dfu_getstatus(): issuing control IN message\n",
276275 progname);
277276
278277 result = usb_control_msg(dfu->dev_handle,
@@ -280,30 +279,29 @@
280279 (char*) status, sizeof(struct dfu_status), dfu->timeout);
281280
282281 if (result < 0) {
283- avrdude_message("%s: Error: Failed to get DFU status: %s\n",
282+ avrdude_message(MSG_INFO, "%s: Error: Failed to get DFU status: %s\n",
284283 progname, usb_strerror());
285284 return -1;
286285 }
287286
288287 if (result < sizeof(struct dfu_status)) {
289- avrdude_message("%s: Error: Failed to get DFU status: %s\n",
288+ avrdude_message(MSG_INFO, "%s: Error: Failed to get DFU status: %s\n",
290289 progname, "short read");
291290 return -1;
292291 }
293292
294293 if (result > sizeof(struct dfu_status)) {
295- avrdude_message("%s: Error: Oversize read (should not happen); "
294+ avrdude_message(MSG_INFO, "%s: Error: Oversize read (should not happen); "
296295 "exiting\n", progname);
297296 exit(1);
298297 }
299298
300- if (verbose > 3)
301- avrdude_message("%s: dfu_getstatus(): bStatus 0x%02x, bwPollTimeout %d, bState 0x%02x, iString %d\n",
302- progname,
303- status->bStatus,
304- status->bwPollTimeout[0] | (status->bwPollTimeout[1] << 8) | (status->bwPollTimeout[2] << 16),
305- status->bState,
306- status->iString);
299+ avrdude_message(MSG_TRACE, "%s: dfu_getstatus(): bStatus 0x%02x, bwPollTimeout %d, bState 0x%02x, iString %d\n",
300+ progname,
301+ status->bStatus,
302+ status->bwPollTimeout[0] | (status->bwPollTimeout[1] << 8) | (status->bwPollTimeout[2] << 16),
303+ status->bState,
304+ status->iString);
307305
308306 return 0;
309307 }
@@ -312,9 +310,8 @@
312310 {
313311 int result;
314312
315- if (verbose > 3)
316- avrdude_message("%s: dfu_clrstatus(): issuing control OUT message\n",
317- progname);
313+ avrdude_message(MSG_TRACE, "%s: dfu_clrstatus(): issuing control OUT message\n",
314+ progname);
318315
319316 result = usb_control_msg(dfu->dev_handle,
320317 USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_CLRSTATUS, 0, 0,
@@ -321,7 +318,7 @@
321318 NULL, 0, dfu->timeout);
322319
323320 if (result < 0) {
324- avrdude_message("%s: Error: Failed to clear DFU status: %s\n",
321+ avrdude_message(MSG_INFO, "%s: Error: Failed to clear DFU status: %s\n",
325322 progname, usb_strerror());
326323 return -1;
327324 }
@@ -333,9 +330,8 @@
333330 {
334331 int result;
335332
336- if (verbose > 3)
337- avrdude_message("%s: dfu_abort(): issuing control OUT message\n",
338- progname);
333+ avrdude_message(MSG_TRACE, "%s: dfu_abort(): issuing control OUT message\n",
334+ progname);
339335
340336 result = usb_control_msg(dfu->dev_handle,
341337 USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_ABORT, 0, 0,
@@ -342,7 +338,7 @@
342338 NULL, 0, dfu->timeout);
343339
344340 if (result < 0) {
345- avrdude_message("%s: Error: Failed to reset DFU state: %s\n",
341+ avrdude_message(MSG_INFO, "%s: Error: Failed to reset DFU state: %s\n",
346342 progname, usb_strerror());
347343 return -1;
348344 }
@@ -355,9 +351,8 @@
355351 {
356352 int result;
357353
358- if (verbose > 3)
359- avrdude_message("%s: dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
360- progname, wIndex, ptr, size);
354+ avrdude_message(MSG_TRACE, "%s: dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
355+ progname, wIndex, ptr, size);
361356
362357 result = usb_control_msg(dfu->dev_handle,
363358 USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0,
@@ -364,19 +359,19 @@
364359 ptr, size, dfu->timeout);
365360
366361 if (result < 0) {
367- avrdude_message("%s: Error: DFU_DNLOAD failed: %s\n",
362+ avrdude_message(MSG_INFO, "%s: Error: DFU_DNLOAD failed: %s\n",
368363 progname, usb_strerror());
369364 return -1;
370365 }
371366
372367 if (result < size) {
373- avrdude_message("%s: Error: DFU_DNLOAD failed: %s\n",
368+ avrdude_message(MSG_INFO, "%s: Error: DFU_DNLOAD failed: %s\n",
374369 progname, "short write");
375370 return -1;
376371 }
377372
378373 if (result > size) {
379- avrdude_message("%s: Error: Oversize write (should not happen); " \
374+ avrdude_message(MSG_INFO, "%s: Error: Oversize write (should not happen); " \
380375 "exiting\n", progname);
381376 exit(1);
382377 }
@@ -388,9 +383,8 @@
388383 {
389384 int result;
390385
391- if (verbose > 3)
392- avrdude_message("%s: dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
393- progname, wIndex, ptr, size);
386+ avrdude_message(MSG_TRACE, "%s: dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
387+ progname, wIndex, ptr, size);
394388
395389 result = usb_control_msg(dfu->dev_handle,
396390 0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0,
@@ -397,19 +391,19 @@
397391 ptr, size, dfu->timeout);
398392
399393 if (result < 0) {
400- avrdude_message("%s: Error: DFU_UPLOAD failed: %s\n",
394+ avrdude_message(MSG_INFO, "%s: Error: DFU_UPLOAD failed: %s\n",
401395 progname, usb_strerror());
402396 return -1;
403397 }
404398
405399 if (result < size) {
406- avrdude_message("%s: Error: DFU_UPLOAD failed: %s\n",
400+ avrdude_message(MSG_INFO, "%s: Error: DFU_UPLOAD failed: %s\n",
407401 progname, "short read");
408402 return -1;
409403 }
410404
411405 if (result > size) {
412- avrdude_message("%s: Error: Oversize read (should not happen); "
406+ avrdude_message(MSG_INFO, "%s: Error: Oversize read (should not happen); "
413407 "exiting\n", progname);
414408 exit(1);
415409 }
@@ -420,26 +414,26 @@
420414 void dfu_show_info(struct dfu_dev *dfu)
421415 {
422416 if (dfu->manf_str != NULL)
423- avrdude_message(" USB Vendor : %s (0x%04hX)\n",
417+ avrdude_message(MSG_INFO, " USB Vendor : %s (0x%04hX)\n",
424418 dfu->manf_str, (unsigned short) dfu->dev_desc.idVendor);
425419 else
426- avrdude_message(" USB Vendor : 0x%04hX\n",
420+ avrdude_message(MSG_INFO, " USB Vendor : 0x%04hX\n",
427421 (unsigned short) dfu->dev_desc.idVendor);
428422
429423 if (dfu->prod_str != NULL)
430- avrdude_message(" USB Product : %s (0x%04hX)\n",
424+ avrdude_message(MSG_INFO, " USB Product : %s (0x%04hX)\n",
431425 dfu->prod_str, (unsigned short) dfu->dev_desc.idProduct);
432426 else
433- avrdude_message(" USB Product : 0x%04hX\n",
427+ avrdude_message(MSG_INFO, " USB Product : 0x%04hX\n",
434428 (unsigned short) dfu->dev_desc.idProduct);
435429
436- avrdude_message(" USB Release : %hu.%hu.%hu\n",
430+ avrdude_message(MSG_INFO, " USB Release : %hu.%hu.%hu\n",
437431 ((unsigned short) dfu->dev_desc.bcdDevice >> 8) & 0xFF,
438432 ((unsigned short) dfu->dev_desc.bcdDevice >> 4) & 0xF,
439433 ((unsigned short) dfu->dev_desc.bcdDevice >> 0) & 0xF);
440434
441435 if (dfu->serno_str != NULL)
442- avrdude_message(" USB Serial No : %s\n", dfu->serno_str);
436+ avrdude_message(MSG_INFO, " USB Serial No : %s\n", dfu->serno_str);
443437 }
444438
445439 /* INTERNAL FUNCTION DEFINITIONS
@@ -456,7 +450,7 @@
456450 result = usb_get_string_simple(dev_handle, index, buffer, sizeof(buffer)-1);
457451
458452 if (result < 0) {
459- avrdude_message("%s: Warning: Failed to read USB device string %d: %s\n",
453+ avrdude_message(MSG_INFO, "%s: Warning: Failed to read USB device string %d: %s\n",
460454 progname, index, usb_strerror());
461455 return NULL;
462456 }
@@ -464,7 +458,7 @@
464458 str = malloc(result+1);
465459
466460 if (str == NULL) {
467- avrdude_message("%s: Out of memory allocating a string\n", progname);
461+ avrdude_message(MSG_INFO, "%s: Out of memory allocating a string\n", progname);
468462 return 0;
469463 }
470464
--- trunk/avrdude/fileio.c (revision 1320)
+++ trunk/avrdude/fileio.c (revision 1321)
@@ -125,7 +125,7 @@
125125 unsigned char cksum;
126126
127127 if (recsize > 255) {
128- avrdude_message("%s: recsize=%d, must be < 256\n",
128+ avrdude_message(MSG_INFO, "%s: recsize=%d, must be < 256\n",
129129 progname, recsize);
130130 return -1;
131131 }
@@ -305,14 +305,14 @@
305305 continue;
306306 rc = ihex_readrec(&ihex, buffer);
307307 if (rc < 0) {
308- avrdude_message("%s: invalid record at line %d of \"%s\"\n",
308+ avrdude_message(MSG_INFO, "%s: invalid record at line %d of \"%s\"\n",
309309 progname, lineno, infile);
310310 return -1;
311311 }
312312 else if (rc != ihex.cksum) {
313- avrdude_message("%s: ERROR: checksum mismatch at line %d of \"%s\"\n",
313+ avrdude_message(MSG_INFO, "%s: ERROR: checksum mismatch at line %d of \"%s\"\n",
314314 progname, lineno, infile);
315- avrdude_message("%s: checksum=0x%02x, computed checksum=0x%02x\n",
315+ avrdude_message(MSG_INFO, "%s: checksum=0x%02x, computed checksum=0x%02x\n",
316316 progname, ihex.cksum, rc);
317317 return -1;
318318 }
@@ -320,13 +320,13 @@
320320 switch (ihex.rectyp) {
321321 case 0: /* data record */
322322 if (fileoffset != 0 && baseaddr < fileoffset) {
323- avrdude_message("%s: ERROR: address 0x%04x out of range (below fileoffset 0x%x) at line %d of %s\n",
323+ avrdude_message(MSG_INFO, "%s: ERROR: address 0x%04x out of range (below fileoffset 0x%x) at line %d of %s\n",
324324 progname, baseaddr, fileoffset, lineno, infile);
325325 return -1;
326326 }
327327 nextaddr = ihex.loadofs + baseaddr - fileoffset;
328328 if (nextaddr + ihex.reclen > bufsize) {
329- avrdude_message("%s: ERROR: address 0x%04x out of range at line %d of %s\n",
329+ avrdude_message(MSG_INFO, "%s: ERROR: address 0x%04x out of range at line %d of %s\n",
330330 progname, nextaddr+ihex.reclen, lineno, infile);
331331 return -1;
332332 }
@@ -359,7 +359,7 @@
359359 break;
360360
361361 default:
362- avrdude_message("%s: don't know how to deal with rectype=%d "
362+ avrdude_message(MSG_INFO, "%s: don't know how to deal with rectype=%d "
363363 "at line %d of %s\n",
364364 progname, ihex.rectyp, lineno, infile);
365365 return -1;
@@ -369,7 +369,7 @@
369369 } /* while */
370370
371371 if (maxaddr == 0) {
372- avrdude_message("%s: ERROR: No valid record found in Intel Hex "
372+ avrdude_message(MSG_INFO, "%s: ERROR: No valid record found in Intel Hex "
373373 "file \"%s\"\n",
374374 progname, infile);
375375
@@ -376,7 +376,7 @@
376376 return -1;
377377 }
378378 else {
379- avrdude_message("%s: WARNING: no end of file record found for Intel Hex "
379+ avrdude_message(MSG_INFO, "%s: WARNING: no end of file record found for Intel Hex "
380380 "file \"%s\"\n",
381381 progname, infile);
382382
@@ -397,7 +397,7 @@
397397 char * tmpl=0;
398398
399399 if (recsize > 255) {
400- avrdude_message("%s: ERROR: recsize=%d, must be < 256\n",
400+ avrdude_message(MSG_INFO, "%s: ERROR: recsize=%d, must be < 256\n",
401401 progname, recsize);
402402 return -1;
403403 }
@@ -430,7 +430,7 @@
430430 tmpl="S3%02X%08X";
431431 }
432432 else {
433- avrdude_message("%s: ERROR: address=%d, out of range\n",
433+ avrdude_message(MSG_INFO, "%s: ERROR: address=%d, out of range\n",
434434 progname, nextaddr);
435435 return -1;
436436 }
@@ -595,14 +595,14 @@
595595 rc = srec_readrec(&srec, buffer);
596596
597597 if (rc < 0) {
598- avrdude_message("%s: ERROR: invalid record at line %d of \"%s\"\n",
598+ avrdude_message(MSG_INFO, "%s: ERROR: invalid record at line %d of \"%s\"\n",
599599 progname, lineno, infile);
600600 return -1;
601601 }
602602 else if (rc != srec.cksum) {
603- avrdude_message("%s: ERROR: checksum mismatch at line %d of \"%s\"\n",
603+ avrdude_message(MSG_INFO, "%s: ERROR: checksum mismatch at line %d of \"%s\"\n",
604604 progname, lineno, infile);
605- avrdude_message("%s: checksum=0x%02x, computed checksum=0x%02x\n",
605+ avrdude_message(MSG_INFO, "%s: checksum=0x%02x, computed checksum=0x%02x\n",
606606 progname, srec.cksum, rc);
607607 return -1;
608608 }
@@ -629,16 +629,16 @@
629629 break;
630630
631631 case 0x34: /* S4 - symbol record (LSI extension) */
632- avrdude_message("%s: ERROR: not supported record at line %d of %s\n",
632+ avrdude_message(MSG_INFO, "%s: ERROR: not supported record at line %d of %s\n",
633633 progname, lineno, infile);
634634 return -1;
635635
636636 case 0x35: /* S5 - count of S1,S2 and S3 records previously tx'd */
637637 if (srec.loadofs != reccount){
638- avrdude_message("%s: ERROR: count of transmitted data records mismatch "
638+ avrdude_message(MSG_INFO, "%s: ERROR: count of transmitted data records mismatch "
639639 "at line %d of \"%s\"\n",
640640 progname, lineno, infile);
641- avrdude_message("%s: transmitted data records= %d, expected "
641+ avrdude_message(MSG_INFO, "%s: transmitted data records= %d, expected "
642642 "value= %d\n",
643643 progname, reccount, srec.loadofs);
644644 return -1;
@@ -651,7 +651,7 @@
651651 return maxaddr;
652652
653653 default:
654- avrdude_message("%s: ERROR: don't know how to deal with rectype S%d "
654+ avrdude_message(MSG_INFO, "%s: ERROR: don't know how to deal with rectype S%d "
655655 "at line %d of %s\n",
656656 progname, srec.rectyp, lineno, infile);
657657 return -1;
@@ -660,7 +660,7 @@
660660 if (datarec == 1) {
661661 nextaddr = srec.loadofs;
662662 if (nextaddr < fileoffset) {
663- avrdude_message(msg, progname, nextaddr,
663+ avrdude_message(MSG_INFO, msg, progname, nextaddr,
664664 "(below fileoffset) ",
665665 lineno, infile);
666666 return -1;
@@ -667,7 +667,7 @@
667667 }
668668 nextaddr -= fileoffset;
669669 if (nextaddr + srec.reclen > bufsize) {
670- avrdude_message(msg, progname, nextaddr+srec.reclen, "",
670+ avrdude_message(MSG_INFO, msg, progname, nextaddr+srec.reclen, "",
671671 lineno, infile);
672672 return -1;
673673 }
@@ -682,7 +682,7 @@
682682
683683 }
684684
685- avrdude_message("%s: WARNING: no end of file record found for Motorola S-Records "
685+ avrdude_message(MSG_INFO, "%s: WARNING: no end of file record found for Motorola S-Records "
686686 "file \"%s\"\n",
687687 progname, infile);
688688
@@ -727,7 +727,7 @@
727727 Elf32_Shdr *sh;
728728 size_t ndx = elf_ndxscn(s);
729729 if ((sh = elf32_getshdr(s)) == NULL) {
730- avrdude_message("%s: ERROR: Error reading section #%u header: %s\n",
730+ avrdude_message(MSG_INFO, "%s: ERROR: Error reading section #%u header: %s\n",
731731 progname, (unsigned int)ndx, elf_errmsg(-1));
732732 continue;
733733 }
@@ -745,7 +745,7 @@
745745 }
746746 }
747747
748- avrdude_message("%s: ERROR: Cannot find a matching section for "
748+ avrdude_message(MSG_INFO, "%s: ERROR: Cannot find a matching section for "
749749 "program header entry @p_vaddr 0x%x\n",
750750 progname, ph->p_vaddr);
751751 return NULL;
@@ -818,7 +818,7 @@
818818 unsigned int low, high, foff;
819819
820820 if (elf_mem_limits(mem, p, &low, &high, &foff) != 0) {
821- avrdude_message("%s: ERROR: Cannot handle \"%s\" memory region from ELF file\n",
821+ avrdude_message(MSG_INFO, "%s: ERROR: Cannot handle \"%s\" memory region from ELF file\n",
822822 progname, mem->desc);
823823 return -1;
824824 }
@@ -836,7 +836,7 @@
836836 strcmp(mem->desc, "apptable") == 0)) {
837837 AVRMEM *flashmem = avr_locate_mem(p, "flash");
838838 if (flashmem == NULL) {
839- avrdude_message("%s: ERROR: No \"flash\" memory region found, "
839+ avrdude_message(MSG_INFO, "%s: ERROR: No \"flash\" memory region found, "
840840 "cannot compute bounds of \"%s\" sub-region.\n",
841841 progname, mem->desc);
842842 return -1;
@@ -847,17 +847,17 @@
847847 }
848848
849849 if (elf_version(EV_CURRENT) == EV_NONE) {
850- avrdude_message("%s: ERROR: ELF library initialization failed: %s\n",
850+ avrdude_message(MSG_INFO, "%s: ERROR: ELF library initialization failed: %s\n",
851851 progname, elf_errmsg(-1));
852852 return -1;
853853 }
854854 if ((e = elf_begin(fileno(inf), ELF_C_READ, NULL)) == NULL) {
855- avrdude_message("%s: ERROR: Cannot open \"%s\" as an ELF file: %s\n",
855+ avrdude_message(MSG_INFO, "%s: ERROR: Cannot open \"%s\" as an ELF file: %s\n",
856856 progname, infile, elf_errmsg(-1));
857857 return -1;
858858 }
859859 if (elf_kind(e) != ELF_K_ELF) {
860- avrdude_message("%s: ERROR: Cannot use \"%s\" as an ELF input file\n",
860+ avrdude_message(MSG_INFO, "%s: ERROR: Cannot use \"%s\" as an ELF input file\n",
861861 progname, infile);
862862 goto done;
863863 }
@@ -866,7 +866,7 @@
866866 const char *id = elf_getident(e, &isize);
867867
868868 if (id == NULL) {
869- avrdude_message("%s: ERROR: Error reading ident area of \"%s\": %s\n",
869+ avrdude_message(MSG_INFO, "%s: ERROR: Error reading ident area of \"%s\": %s\n",
870870 progname, infile, elf_errmsg(-1));
871871 goto done;
872872 }
@@ -882,7 +882,7 @@
882882 }
883883 if (id[EI_CLASS] != ELFCLASS32 ||
884884 id[EI_DATA] != endianess) {
885- avrdude_message("%s: ERROR: ELF file \"%s\" is not a "
885+ avrdude_message(MSG_INFO, "%s: ERROR: ELF file \"%s\" is not a "
886886 "32-bit, %s-endian file that was expected\n",
887887 progname, infile, endianname);
888888 goto done;
@@ -890,13 +890,13 @@
890890
891891 Elf32_Ehdr *eh;
892892 if ((eh = elf32_getehdr(e)) == NULL) {
893- avrdude_message("%s: ERROR: Error reading ehdr of \"%s\": %s\n",
893+ avrdude_message(MSG_INFO, "%s: ERROR: Error reading ehdr of \"%s\": %s\n",
894894 progname, infile, elf_errmsg(-1));
895895 goto done;
896896 }
897897
898898 if (eh->e_type != ET_EXEC) {
899- avrdude_message("%s: ERROR: ELF file \"%s\" is not an executable file\n",
899+ avrdude_message(MSG_INFO, "%s: ERROR: ELF file \"%s\" is not an executable file\n",
900900 progname, infile);
901901 goto done;
902902 }
@@ -911,12 +911,12 @@
911911 mname = "AVR";
912912 }
913913 if (eh->e_machine != machine) {
914- avrdude_message("%s: ERROR: ELF file \"%s\" is not for machine %s\n",
914+ avrdude_message(MSG_INFO, "%s: ERROR: ELF file \"%s\" is not for machine %s\n",
915915 progname, infile, mname);
916916 goto done;
917917 }
918918 if (eh->e_phnum == 0xffff /* PN_XNUM */) {
919- avrdude_message("%s: ERROR: ELF file \"%s\" uses extended "
919+ avrdude_message(MSG_INFO, "%s: ERROR: ELF file \"%s\" uses extended "
920920 "program header numbers which are not expected\n",
921921 progname, infile);
922922 goto done;
@@ -924,7 +924,7 @@
924924
925925 Elf32_Phdr *ph;
926926 if ((ph = elf32_getphdr(e)) == NULL) {
927- avrdude_message("%s: ERROR: Error reading program header table of \"%s\": %s\n",
927+ avrdude_message(MSG_INFO, "%s: ERROR: Error reading program header table of \"%s\": %s\n",
928928 progname, infile, elf_errmsg(-1));
929929 goto done;
930930 }
@@ -931,7 +931,7 @@
931931
932932 size_t sndx;
933933 if (elf_getshdrstrndx(e, &sndx) != 0) {
934- avrdude_message("%s: ERROR: Error obtaining section name string table: %s\n",
934+ avrdude_message(MSG_INFO, "%s: ERROR: Error obtaining section name string table: %s\n",
935935 progname, elf_errmsg(-1));
936936 sndx = 0;
937937 }
@@ -945,11 +945,9 @@
945945 ph[i].p_filesz == 0)
946946 continue;
947947
948- if (verbose >= 2) {
949- avrdude_message("%s: Considering PT_LOAD program header entry #%d:\n"
950- " p_vaddr 0x%x, p_paddr 0x%x, p_filesz %d\n",
951- progname, i, ph[i].p_vaddr, ph[i].p_paddr, ph[i].p_filesz);
952- }
948+ avrdude_message(MSG_NOTICE2, "%s: Considering PT_LOAD program header entry #%d:\n"
949+ " p_vaddr 0x%x, p_paddr 0x%x, p_filesz %d\n",
950+ progname, i, ph[i].p_vaddr, ph[i].p_paddr, ph[i].p_filesz);
953951
954952 Elf32_Shdr *sh;
955953 Elf_Scn *s = elf_get_scn(e, ph + i, &sh);
@@ -968,19 +966,15 @@
968966 unsigned int lma;
969967 lma = ph[i].p_paddr + sh->sh_offset - ph[i].p_offset;
970968
971- if (verbose >= 2) {
972- avrdude_message("%s: Found section \"%s\", LMA 0x%x, sh_size %u\n",
973- progname, sname, lma, sh->sh_size);
974- }
969+ avrdude_message(MSG_NOTICE2, "%s: Found section \"%s\", LMA 0x%x, sh_size %u\n",
970+ progname, sname, lma, sh->sh_size);
975971
976972 if (lma >= low &&
977973 lma + sh->sh_size < high) {
978974 /* OK */
979975 } else {
980- if (verbose >= 2) {
981- avrdude_message(" => skipping, inappropriate for \"%s\" memory region\n",
982- mem->desc);
983- }
976+ avrdude_message(MSG_NOTICE2, " => skipping, inappropriate for \"%s\" memory region\n",
977+ mem->desc);
984978 continue;
985979 }
986980 /*
@@ -993,7 +987,7 @@
993987 */
994988 if (mem->size != 1 &&
995989 sh->sh_size > mem->size) {
996- avrdude_message("%s: ERROR: section \"%s\" does not fit into \"%s\" memory:\n"
990+ avrdude_message(MSG_INFO, "%s: ERROR: section \"%s\" does not fit into \"%s\" memory:\n"
997991 " 0x%x + %u > %u\n",
998992 progname, sname, mem->desc,
999993 lma, sh->sh_size, mem->size);
@@ -1002,22 +996,18 @@
1002996
1003997 Elf_Data *d = NULL;
1004998 while ((d = elf_getdata(s, d)) != NULL) {
1005- if (verbose >= 2) {
1006- avrdude_message(" Data block: d_buf %p, d_off 0x%x, d_size %d\n",
1007- d->d_buf, (unsigned int)d->d_off, d->d_size);
1008- }
999+ avrdude_message(MSG_NOTICE2, " Data block: d_buf %p, d_off 0x%x, d_size %d\n",
1000+ d->d_buf, (unsigned int)d->d_off, d->d_size);
10091001 if (mem->size == 1) {
10101002 if (d->d_off != 0) {
1011- avrdude_message("%s: ERROR: unexpected data block at offset != 0\n",
1003+ avrdude_message(MSG_INFO, "%s: ERROR: unexpected data block at offset != 0\n",
10121004 progname);
10131005 } else if (foff >= d->d_size) {
1014- avrdude_message("%s: ERROR: ELF file section does not contain byte at offset %d\n",
1006+ avrdude_message(MSG_INFO, "%s: ERROR: ELF file section does not contain byte at offset %d\n",
10151007 progname, foff);
10161008 } else {
1017- if (verbose >= 2) {
1018- avrdude_message(" Extracting one byte from file offset %d\n",
1019- foff);
1020- }
1009+ avrdude_message(MSG_NOTICE2, " Extracting one byte from file offset %d\n",
1010+ foff);
10211011 mem->buf[0] = ((unsigned char *)d->d_buf)[foff];
10221012 mem->tags[0] = TAG_ALLOCATED;
10231013 rv = 1;
@@ -1028,10 +1018,8 @@
10281018 idx = lma - low + d->d_off;
10291019 if ((int)(idx + d->d_size) > rv)
10301020 rv = idx + d->d_size;
1031- if (verbose >= 3) {
1032- avrdude_message(" Writing %d bytes to mem offset 0x%x\n",
1033- d->d_size, idx);
1034- }
1021+ avrdude_message(MSG_DEBUG, " Writing %d bytes to mem offset 0x%x\n",
1022+ d->d_size, idx);
10351023 memcpy(mem->buf + idx, d->d_buf, d->d_size);
10361024 memset(mem->tags + idx, TAG_ALLOCATED, d->d_size);
10371025 }
@@ -1100,13 +1088,13 @@
11001088 rc = fwrite(buf, 1, size, f);
11011089 break;
11021090 default:
1103- avrdude_message("%s: fileio: invalid operation=%d\n",
1091+ avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n",
11041092 progname, fio->op);
11051093 return -1;
11061094 }
11071095
11081096 if (rc < 0 || (fio->op == FIO_WRITE && rc < size)) {
1109- avrdude_message("%s: %s error %s %s: %s; %s %d of the expected %d bytes\n",
1097+ avrdude_message(MSG_INFO, "%s: %s error %s %s: %s; %s %d of the expected %d bytes\n",
11101098 progname, fio->iodesc, fio->dir, filename, strerror(errno),
11111099 fio->rw, rc, size);
11121100 return -1;
@@ -1135,7 +1123,7 @@
11351123 strtoul (p, &e, 0):
11361124 strtoul (p + 2, &e, 2);
11371125 if (*e != 0) {
1138- avrdude_message("%s: invalid byte value (%s) specified for immediate mode\n",
1126+ avrdude_message(MSG_INFO, "%s: invalid byte value (%s) specified for immediate mode\n",
11391127 progname, p);
11401128 return -1;
11411129 }
@@ -1146,13 +1134,13 @@
11461134 }
11471135 break;
11481136 default:
1149- avrdude_message("%s: fileio: invalid operation=%d\n",
1137+ avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n",
11501138 progname, fio->op);
11511139 return -1;
11521140 }
11531141
11541142 if (rc < 0 || (fio->op == FIO_WRITE && rc < size)) {
1155- avrdude_message("%s: %s error %s %s: %s; %s %d of the expected %d bytes\n",
1143+ avrdude_message(MSG_INFO, "%s: %s error %s %s: %s; %s %d of the expected %d bytes\n",
11561144 progname, fio->iodesc, fio->dir, filename, strerror(errno),
11571145 fio->rw, rc, size);
11581146 return -1;
@@ -1182,7 +1170,7 @@
11821170 break;
11831171
11841172 default:
1185- avrdude_message("%s: invalid Intex Hex file I/O operation=%d\n",
1173+ avrdude_message(MSG_INFO, "%s: invalid Intex Hex file I/O operation=%d\n",
11861174 progname, fio->op);
11871175 return -1;
11881176 break;
@@ -1212,7 +1200,7 @@
12121200 break;
12131201
12141202 default:
1215- avrdude_message("%s: ERROR: invalid Motorola S-Records file I/O "
1203+ avrdude_message(MSG_INFO, "%s: ERROR: invalid Motorola S-Records file I/O "
12161204 "operation=%d\n",
12171205 progname, fio->op);
12181206 return -1;
@@ -1232,7 +1220,7 @@
12321220
12331221 switch (fio->op) {
12341222 case FIO_WRITE:
1235- avrdude_message("%s: ERROR: write operation not (yet) "
1223+ avrdude_message(MSG_INFO, "%s: ERROR: write operation not (yet) "
12361224 "supported for ELF\n",
12371225 progname);
12381226 return -1;
@@ -1243,7 +1231,7 @@
12431231 return rc;
12441232
12451233 default:
1246- avrdude_message("%s: ERROR: invalid ELF file I/O "
1234+ avrdude_message(MSG_INFO, "%s: ERROR: invalid ELF file I/O "
12471235 "operation=%d\n",
12481236 progname, fio->op);
12491237 return -1;
@@ -1289,7 +1277,7 @@
12891277 case FIO_WRITE:
12901278 break;
12911279 default:
1292- avrdude_message("%s: fileio: invalid operation=%d\n",
1280+ avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n",
12931281 progname, fio->op);
12941282 return -1;
12951283 }
@@ -1319,7 +1307,7 @@
13191307 return 0;
13201308
13211309 writeerr:
1322- avrdude_message("%s: error writing to %s: %s\n",
1310+ avrdude_message(MSG_INFO, "%s: error writing to %s: %s\n",
13231311 progname, filename, strerror(errno));
13241312 return -1;
13251313 }
@@ -1346,7 +1334,7 @@
13461334 break;
13471335
13481336 default:
1349- avrdude_message("%s: invalid I/O operation %d\n",
1337+ avrdude_message(MSG_INFO, "%s: invalid I/O operation %d\n",
13501338 progname, op);
13511339 return -1;
13521340 break;
@@ -1385,7 +1373,7 @@
13851373 f = fopen(fname, "rb");
13861374 #endif
13871375 if (f == NULL) {
1388- avrdude_message("%s: error opening %s: %s\n",
1376+ avrdude_message(MSG_INFO, "%s: error opening %s: %s\n",
13891377 progname, fname, strerror(errno));
13901378 return -1;
13911379 }
@@ -1468,7 +1456,7 @@
14681456
14691457 mem = avr_locate_mem(p, memtype);
14701458 if (mem == NULL) {
1471- avrdude_message("fileio(): memory type \"%s\" not configured for device \"%s\"\n",
1459+ avrdude_message(MSG_INFO, "fileio(): memory type \"%s\" not configured for device \"%s\"\n",
14721460 memtype, p->desc);
14731461 return -1;
14741462 }
@@ -1506,7 +1494,7 @@
15061494
15071495 if (format == FMT_AUTO) {
15081496 if (using_stdio) {
1509- avrdude_message("%s: can't auto detect file format when using stdin/out.\n"
1497+ avrdude_message(MSG_INFO, "%s: can't auto detect file format when using stdin/out.\n"
15101498 "%s Please specify a file format and try again.\n",
15111499 progname, progbuf);
15121500 return -1;
@@ -1514,13 +1502,13 @@
15141502
15151503 format = fmt_autodetect(fname);
15161504 if (format < 0) {
1517- avrdude_message("%s: can't determine file format for %s, specify explicitly\n",
1505+ avrdude_message(MSG_INFO, "%s: can't determine file format for %s, specify explicitly\n",
15181506 progname, fname);
15191507 return -1;
15201508 }
15211509
15221510 if (quell_progress < 2) {
1523- avrdude_message("%s: %s file %s auto detected as %s\n",
1511+ avrdude_message(MSG_INFO, "%s: %s file %s auto detected as %s\n",
15241512 progname, fio.iodesc, fname, fmtstr(format));
15251513 }
15261514 }
@@ -1544,7 +1532,7 @@
15441532 if (!using_stdio) {
15451533 f = fopen(fname, fio.mode);
15461534 if (f == NULL) {
1547- avrdude_message("%s: can't open %s file %s: %s\n",
1535+ avrdude_message(MSG_INFO, "%s: can't open %s file %s: %s\n",
15481536 progname, fio.iodesc, fname, strerror(errno));
15491537 return -1;
15501538 }
@@ -1568,7 +1556,7 @@
15681556 #ifdef HAVE_LIBELF
15691557 rc = fileio_elf(&fio, fname, f, mem, p, size);
15701558 #else
1571- avrdude_message("%s: can't handle ELF file %s, "
1559+ avrdude_message(MSG_INFO, "%s: can't handle ELF file %s, "
15721560 "ELF file support was not compiled in\n",
15731561 progname, fname);
15741562 rc = -1;
@@ -1587,7 +1575,7 @@
15871575 break;
15881576
15891577 default:
1590- avrdude_message("%s: invalid %s file format: %d\n",
1578+ avrdude_message(MSG_INFO, "%s: invalid %s file format: %d\n",
15911579 progname, fio.iodesc, format);
15921580 return -1;
15931581 }
--- trunk/avrdude/flip1.c (revision 1320)
+++ trunk/avrdude/flip1.c (revision 1321)
@@ -243,13 +243,13 @@
243243 if (usbpid) {
244244 pid = *(int *)(ldata(usbpid));
245245 if (lnext(usbpid))
246- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
246+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
247247 progname, pid);
248248 } else {
249249 pid = part->usbpid;
250250 }
251251 if (!ovsigck && (part->flags & AVRPART_HAS_PDI)) {
252- avrdude_message("%s: \"flip1\" (FLIP protocol version 1) is for AT90USB* and ATmega*U* devices.\n"
252+ avrdude_message(MSG_INFO, "%s: \"flip1\" (FLIP protocol version 1) is for AT90USB* and ATmega*U* devices.\n"
253253 "%s For Xmega devices, use \"flip2\".\n"
254254 "%s (Use -F to bypass this check.)\n",
255255 progname, progbuf, progbuf);
@@ -264,31 +264,31 @@
264264 /* Check if descriptor values are what we expect. */
265265
266266 if (dfu->dev_desc.idVendor != vid)
267- avrdude_message("%s: Warning: USB idVendor = 0x%04X (expected 0x%04X)\n",
267+ avrdude_message(MSG_INFO, "%s: Warning: USB idVendor = 0x%04X (expected 0x%04X)\n",
268268 progname, dfu->dev_desc.idVendor, vid);
269269
270270 if (pid != 0 && dfu->dev_desc.idProduct != pid)
271- avrdude_message("%s: Warning: USB idProduct = 0x%04X (expected 0x%04X)\n",
271+ avrdude_message(MSG_INFO, "%s: Warning: USB idProduct = 0x%04X (expected 0x%04X)\n",
272272 progname, dfu->dev_desc.idProduct, pid);
273273
274274 if (dfu->dev_desc.bNumConfigurations != 1)
275- avrdude_message("%s: Warning: USB bNumConfigurations = %d (expected 1)\n",
275+ avrdude_message(MSG_INFO, "%s: Warning: USB bNumConfigurations = %d (expected 1)\n",
276276 progname, (int) dfu->dev_desc.bNumConfigurations);
277277
278278 if (dfu->conf_desc.bNumInterfaces != 1)
279- avrdude_message("%s: Warning: USB bNumInterfaces = %d (expected 1)\n",
279+ avrdude_message(MSG_INFO, "%s: Warning: USB bNumInterfaces = %d (expected 1)\n",
280280 progname, (int) dfu->conf_desc.bNumInterfaces);
281281
282282 if (dfu->dev_desc.bDeviceClass != 254)
283- avrdude_message("%s: Warning: USB bDeviceClass = %d (expected 254)\n",
283+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceClass = %d (expected 254)\n",
284284 progname, (int) dfu->dev_desc.bDeviceClass);
285285
286286 if (dfu->dev_desc.bDeviceSubClass != 1)
287- avrdude_message("%s: Warning: USB bDeviceSubClass = %d (expected 1)\n",
287+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceSubClass = %d (expected 1)\n",
288288 progname, (int) dfu->dev_desc.bDeviceSubClass);
289289
290290 if (dfu->dev_desc.bDeviceProtocol != 0)
291- avrdude_message("%s: Warning: USB bDeviceProtocol = %d (expected 0)\n",
291+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceProtocol = %d (expected 0)\n",
292292 progname, (int) dfu->dev_desc.bDeviceProtocol);
293293
294294 /*
@@ -299,20 +299,20 @@
299299 */
300300 if (0) {
301301 if (dfu->intf_desc.bInterfaceClass != 254)
302- avrdude_message("%s: Warning: USB bInterfaceClass = %d (expected 254)\n",
302+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceClass = %d (expected 254)\n",
303303 progname, (int) dfu->intf_desc.bInterfaceClass);
304304
305305 if (dfu->intf_desc.bInterfaceSubClass != 1)
306- avrdude_message("%s: Warning: USB bInterfaceSubClass = %d (expected 1)\n",
306+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceSubClass = %d (expected 1)\n",
307307 progname, (int) dfu->intf_desc.bInterfaceSubClass);
308308
309309 if (dfu->intf_desc.bInterfaceProtocol != 0)
310- avrdude_message("%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
310+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
311311 progname, (int) dfu->intf_desc.bInterfaceProtocol);
312312 }
313313
314314 if (dfu->dev_desc.bMaxPacketSize0 != 32)
315- avrdude_message("%s: Warning: bMaxPacketSize0 (%d) != 32, things might go wrong\n",
315+ avrdude_message(MSG_INFO, "%s: Warning: bMaxPacketSize0 (%d) != 32, things might go wrong\n",
316316 progname, dfu->dev_desc.bMaxPacketSize0);
317317
318318 if (verbose)
@@ -368,8 +368,7 @@
368368 int aux_result;
369369 unsigned int default_timeout = FLIP1(pgm)->dfu->timeout;
370370
371- if (verbose > 1)
372- avrdude_message("%s: flip_chip_erase()\n", progname);
371+ avrdude_message(MSG_NOTICE2, "%s: flip_chip_erase()\n", progname);
373372
374373 struct flip1_cmd cmd = {
375374 FLIP1_CMD_WRITE_COMMAND, { 0, 0xff }
@@ -384,7 +383,7 @@
384383 return -1;
385384
386385 if (status.bStatus != DFU_STATUS_OK) {
387- avrdude_message("%s: failed to send chip erase command: %s\n",
386+ avrdude_message(MSG_INFO, "%s: failed to send chip erase command: %s\n",
388387 progname, flip1_status_str(&status));
389388 if (status.bState == STATE_dfuERROR)
390389 dfu_clrstatus(FLIP1(pgm)->dfu);
@@ -406,7 +405,7 @@
406405 if (flip1_read_sig_bytes(pgm, part, mem) < 0)
407406 return -1;
408407 if (addr > mem->size) {
409- avrdude_message("%s: flip1_read_byte(signature): address %lu out of range\n",
408+ avrdude_message(MSG_INFO, "%s: flip1_read_byte(signature): address %lu out of range\n",
410409 progname, addr);
411410 return -1;
412411 }
@@ -417,10 +416,10 @@
417416 mem_unit = flip1_mem_unit(mem->desc);
418417
419418 if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) {
420- avrdude_message("%s: Error: "
419+ avrdude_message(MSG_INFO, "%s: Error: "
421420 "\"%s\" memory not accessible using FLIP",
422421 progname, mem->desc);
423- avrdude_message("\n");
422+ avrdude_message(MSG_INFO, "\n");
424423 return -1;
425424 }
426425
@@ -442,10 +441,10 @@
442441 mem_unit = flip1_mem_unit(mem->desc);
443442
444443 if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) {
445- avrdude_message("%s: Error: "
444+ avrdude_message(MSG_INFO, "%s: Error: "
446445 "\"%s\" memory not accessible using FLIP",
447446 progname, mem->desc);
448- avrdude_message("\n");
447+ avrdude_message(MSG_INFO, "\n");
449448 return -1;
450449 }
451450
@@ -463,10 +462,10 @@
463462 mem_unit = flip1_mem_unit(mem->desc);
464463
465464 if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) {
466- avrdude_message("%s: Error: "
465+ avrdude_message(MSG_INFO, "%s: Error: "
467466 "\"%s\" memory not accessible using FLIP",
468467 progname, mem->desc);
469- avrdude_message("\n");
468+ avrdude_message(MSG_INFO, "\n");
470469 return -1;
471470 }
472471
@@ -489,16 +488,16 @@
489488 mem_unit = flip1_mem_unit(mem->desc);
490489
491490 if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) {
492- avrdude_message("%s: Error: "
491+ avrdude_message(MSG_INFO, "%s: Error: "
493492 "\"%s\" memory not accessible using FLIP",
494493 progname, mem->desc);
495- avrdude_message("\n");
494+ avrdude_message(MSG_INFO, "\n");
496495 return -1;
497496 }
498497
499498 if (n_bytes > INT_MAX) {
500499 /* This should never happen, unless the int type is only 16 bits. */
501- avrdude_message("%s: Error: Attempting to read more than %d bytes\n",
500+ avrdude_message(MSG_INFO, "%s: Error: Attempting to read more than %d bytes\n",
502501 progname, INT_MAX);
503502 exit(1);
504503 }
@@ -511,14 +510,13 @@
511510
512511 int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem)
513512 {
514- if (verbose > 1)
515- avrdude_message("%s: flip1_read_sig_bytes(): ", progname);
513+ avrdude_message(MSG_NOTICE2, "%s: flip1_read_sig_bytes(): ", progname);
516514
517515 if (FLIP1(pgm)->dfu == NULL)
518516 return -1;
519517
520518 if (mem->size < sizeof(FLIP1(pgm)->part_sig)) {
521- avrdude_message("%s: Error: Signature read must be at least %u bytes\n",
519+ avrdude_message(MSG_INFO, "%s: Error: Signature read must be at least %u bytes\n",
522520 progname, (unsigned int) sizeof(FLIP1(pgm)->part_sig));
523521 return -1;
524522 }
@@ -536,8 +534,7 @@
536534 FLIP1_CMD_READ_COMMAND, FLIP1_READ_FAMILY_CODE
537535 };
538536
539- if (verbose > 1)
540- avrdude_message("from device\n");
537+ avrdude_message(MSG_NOTICE2, "from device\n");
541538
542539 for (i = 0; i < 3; i++)
543540 {
@@ -554,7 +551,7 @@
554551
555552 if (status.bStatus != DFU_STATUS_OK)
556553 {
557- avrdude_message("%s: failed to send cmd for signature byte %d: %s\n",
554+ avrdude_message(MSG_INFO, "%s: failed to send cmd for signature byte %d: %s\n",
558555 progname, i, flip1_status_str(&status));
559556 if (status.bState == STATE_dfuERROR)
560557 dfu_clrstatus(FLIP1(pgm)->dfu);
@@ -569,7 +566,7 @@
569566
570567 if (status.bStatus != DFU_STATUS_OK)
571568 {
572- avrdude_message("%s: failed to read signature byte %d: %s\n",
569+ avrdude_message(MSG_INFO, "%s: failed to read signature byte %d: %s\n",
573570 progname, i, flip1_status_str(&status));
574571 if (status.bState == STATE_dfuERROR)
575572 dfu_clrstatus(FLIP1(pgm)->dfu);
@@ -579,8 +576,7 @@
579576 }
580577 else
581578 {
582- if (verbose > 1)
583- avrdude_message("cached\n");
579+ avrdude_message(MSG_NOTICE2, "cached\n");
584580 }
585581
586582 memcpy(mem->buf, FLIP1(pgm)->part_sig, sizeof(FLIP1(pgm)->part_sig));
@@ -593,7 +589,7 @@
593589 pgm->cookie = calloc(1, sizeof(struct flip1));
594590
595591 if (pgm->cookie == NULL) {
596- avrdude_message("%s: Out of memory allocating private data structure\n",
592+ avrdude_message(MSG_INFO, "%s: Out of memory allocating private data structure\n",
597593 progname);
598594 exit(1);
599595 }
@@ -611,7 +607,7 @@
611607 void flip1_show_info(struct flip1 *flip1)
612608 {
613609 dfu_show_info(flip1->dfu);
614- avrdude_message(" USB max packet size : %hu\n",
610+ avrdude_message(MSG_INFO, " USB max packet size : %hu\n",
615611 (unsigned short) flip1->dfu->dev_desc.bMaxPacketSize0);
616612 }
617613
@@ -629,9 +625,8 @@
629625 unsigned int default_timeout = dfu->timeout;
630626
631627
632- if (verbose > 1)
633- avrdude_message("%s: flip_read_memory(%s, 0x%04x, %d)\n",
634- progname, flip1_mem_unit_str(mem_unit), addr, size);
628+ avrdude_message(MSG_NOTICE2, "%s: flip_read_memory(%s, 0x%04x, %d)\n",
629+ progname, flip1_mem_unit_str(mem_unit), addr, size);
635630
636631 /*
637632 * As this function is called once per page, no need to handle 64
@@ -661,7 +656,7 @@
661656
662657 if (status.bStatus != DFU_STATUS_OK)
663658 {
664- avrdude_message("%s: failed to read %u bytes of %s memory @%u: %s\n",
659+ avrdude_message(MSG_INFO, "%s: failed to read %u bytes of %s memory @%u: %s\n",
665660 progname, size, flip1_mem_unit_str(mem_unit), addr,
666661 flip1_status_str(&status));
667662 if (status.bState == STATE_dfuERROR)
@@ -675,7 +670,7 @@
675670 if (cmd_result < 0 && aux_result == 0 &&
676671 status.bStatus == DFU_STATUS_ERR_WRITE) {
677672 if (FLIP1(pgm)->security_mode_flag == 0)
678- avrdude_message("\n%s:\n"
673+ avrdude_message(MSG_INFO, "\n%s:\n"
679674 "%s***********************************************************************\n"
680675 "%sMaybe the device is in ``security mode´´, and needs a chip erase first?\n"
681676 "%s***********************************************************************\n"
@@ -689,7 +684,7 @@
689684
690685 if (status.bStatus != DFU_STATUS_OK)
691686 {
692- avrdude_message("%s: failed to read %u bytes of %s memory @%u: %s\n",
687+ avrdude_message(MSG_INFO, "%s: failed to read %u bytes of %s memory @%u: %s\n",
693688 progname, size, flip1_mem_unit_str(mem_unit), addr,
694689 flip1_status_str(&status));
695690 if (status.bState == STATE_dfuERROR)
@@ -723,14 +718,13 @@
723718 unsigned int default_timeout = dfu->timeout;
724719 unsigned char *buf;
725720
726- if (verbose > 1)
727- avrdude_message("%s: flip_write_memory(%s, 0x%04x, %d)\n",
728- progname, flip1_mem_unit_str(mem_unit), addr, size);
721+ avrdude_message(MSG_NOTICE2, "%s: flip_write_memory(%s, 0x%04x, %d)\n",
722+ progname, flip1_mem_unit_str(mem_unit), addr, size);
729723
730724 if (size < 32) {
731725 /* presumably single-byte updates; must be padded to USB endpoint size */
732726 if ((addr + size - 1) / 32 != addr / 32) {
733- avrdude_message("%s: flip_write_memory(): begin (0x%x) and end (0x%x) not within same 32-byte block\n",
727+ avrdude_message(MSG_INFO, "%s: flip_write_memory(): begin (0x%x) and end (0x%x) not within same 32-byte block\n",
734728 progname, addr, addr + size - 1);
735729 return -1;
736730 }
@@ -742,7 +736,7 @@
742736 if ((buf = malloc(sizeof(struct flip1_cmd_header) +
743737 write_size +
744738 sizeof(struct flip1_prog_footer))) == 0) {
745- avrdude_message("%s: Out of memory\n", progname);
739+ avrdude_message(MSG_INFO, "%s: Out of memory\n", progname);
746740 return -1;
747741 }
748742
@@ -791,7 +785,7 @@
791785
792786 if (status.bStatus != DFU_STATUS_OK)
793787 {
794- avrdude_message("%s: failed to write %u bytes of %s memory @%u: %s\n",
788+ avrdude_message(MSG_INFO, "%s: failed to write %u bytes of %s memory @%u: %s\n",
795789 progname, size, flip1_mem_unit_str(mem_unit), addr,
796790 flip1_status_str(&status));
797791 if (status.bState == STATE_dfuERROR)
@@ -822,7 +816,7 @@
822816
823817 if (status.bStatus != DFU_STATUS_OK)
824818 {
825- avrdude_message("%s: failed to set memory page: %s\n",
819+ avrdude_message(MSG_INFO, "%s: failed to set memory page: %s\n",
826820 progname, flip1_status_str(&status));
827821 if (status.bState == STATE_dfuERROR)
828822 dfu_clrstatus(dfu);
--- trunk/avrdude/flip2.c (revision 1320)
+++ trunk/avrdude/flip2.c (revision 1321)
@@ -236,7 +236,7 @@
236236 if (usbpid) {
237237 pid = *(int *)(ldata(usbpid));
238238 if (lnext(usbpid))
239- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
239+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
240240 progname, pid);
241241 } else {
242242 pid = part->usbpid;
@@ -243,7 +243,7 @@
243243 }
244244
245245 if (!ovsigck && !(part->flags & AVRPART_HAS_PDI)) {
246- avrdude_message("%s: \"flip2\" (FLIP protocol version 2) is for Xmega devices.\n"
246+ avrdude_message(MSG_INFO, "%s: \"flip2\" (FLIP protocol version 2) is for Xmega devices.\n"
247247 "%s For AT90USB* or ATmega*U* devices, use \"flip1\".\n"
248248 "%s (Use -F to bypass this check.)\n",
249249 progname, progbuf, progbuf);
@@ -258,43 +258,43 @@
258258 /* Check if descriptor values are what we expect. */
259259
260260 if (dfu->dev_desc.idVendor != vid)
261- avrdude_message("%s: Warning: USB idVendor = 0x%04X (expected 0x%04X)\n",
261+ avrdude_message(MSG_INFO, "%s: Warning: USB idVendor = 0x%04X (expected 0x%04X)\n",
262262 progname, dfu->dev_desc.idVendor, vid);
263263
264264 if (pid != 0 && dfu->dev_desc.idProduct != pid)
265- avrdude_message("%s: Warning: USB idProduct = 0x%04X (expected 0x%04X)\n",
265+ avrdude_message(MSG_INFO, "%s: Warning: USB idProduct = 0x%04X (expected 0x%04X)\n",
266266 progname, dfu->dev_desc.idProduct, pid);
267267
268268 if (dfu->dev_desc.bNumConfigurations != 1)
269- avrdude_message("%s: Warning: USB bNumConfigurations = %d (expected 1)\n",
269+ avrdude_message(MSG_INFO, "%s: Warning: USB bNumConfigurations = %d (expected 1)\n",
270270 progname, (int) dfu->dev_desc.bNumConfigurations);
271271
272272 if (dfu->conf_desc.bNumInterfaces != 1)
273- avrdude_message("%s: Warning: USB bNumInterfaces = %d (expected 1)\n",
273+ avrdude_message(MSG_INFO, "%s: Warning: USB bNumInterfaces = %d (expected 1)\n",
274274 progname, (int) dfu->conf_desc.bNumInterfaces);
275275
276276 if (dfu->dev_desc.bDeviceClass != 0)
277- avrdude_message("%s: Warning: USB bDeviceClass = %d (expected 0)\n",
277+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceClass = %d (expected 0)\n",
278278 progname, (int) dfu->dev_desc.bDeviceClass);
279279
280280 if (dfu->dev_desc.bDeviceSubClass != 0)
281- avrdude_message("%s: Warning: USB bDeviceSubClass = %d (expected 0)\n",
281+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceSubClass = %d (expected 0)\n",
282282 progname, (int) dfu->dev_desc.bDeviceSubClass);
283283
284284 if (dfu->dev_desc.bDeviceProtocol != 0)
285- avrdude_message("%s: Warning: USB bDeviceProtocol = %d (expected 0)\n",
285+ avrdude_message(MSG_INFO, "%s: Warning: USB bDeviceProtocol = %d (expected 0)\n",
286286 progname, (int) dfu->dev_desc.bDeviceProtocol);
287287
288288 if (dfu->intf_desc.bInterfaceClass != 0xFF)
289- avrdude_message("%s: Warning: USB bInterfaceClass = %d (expected 255)\n",
289+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceClass = %d (expected 255)\n",
290290 progname, (int) dfu->intf_desc.bInterfaceClass);
291291
292292 if (dfu->intf_desc.bInterfaceSubClass != 0)
293- avrdude_message("%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
293+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
294294 progname, (int) dfu->intf_desc.bInterfaceSubClass);
295295
296296 if (dfu->intf_desc.bInterfaceProtocol != 0)
297- avrdude_message("%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
297+ avrdude_message(MSG_INFO, "%s: Warning: USB bInterfaceSubClass = %d (expected 0)\n",
298298 progname, (int) dfu->intf_desc.bInterfaceProtocol);
299299
300300 result = flip2_read_memory(FLIP2(pgm)->dfu,
@@ -359,8 +359,7 @@
359359 int cmd_result = 0;
360360 int aux_result;
361361
362- if (verbose > 1)
363- avrdude_message("%s: flip_chip_erase()\n", progname);
362+ avrdude_message(MSG_NOTICE2, "%s: flip_chip_erase()\n", progname);
364363
365364 struct flip2_cmd cmd = {
366365 FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_CHIP_ERASE, { 0xFF, 0, 0, 0 }
@@ -379,7 +378,7 @@
379378 {
380379 continue;
381380 } else
382- avrdude_message("%s: Error: DFU status %s\n", progname,
381+ avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname,
383382 flip2_status_str(&status));
384383 dfu_clrstatus(FLIP2(pgm)->dfu);
385384 } else
@@ -400,12 +399,12 @@
400399 mem_unit = flip2_mem_unit(mem->desc);
401400
402401 if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
403- avrdude_message("%s: Error: "
402+ avrdude_message(MSG_INFO, "%s: Error: "
404403 "\"%s\" memory not accessible using FLIP",
405404 progname, mem->desc);
406405 if (strcmp(mem->desc, "flash") == 0)
407- avrdude_message(" (did you mean \"application\"?)");
408- avrdude_message("\n");
406+ avrdude_message(MSG_INFO, " (did you mean \"application\"?)");
407+ avrdude_message(MSG_INFO, "\n");
409408 return -1;
410409 }
411410
@@ -423,12 +422,12 @@
423422 mem_unit = flip2_mem_unit(mem->desc);
424423
425424 if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
426- avrdude_message("%s: Error: "
425+ avrdude_message(MSG_INFO, "%s: Error: "
427426 "\"%s\" memory not accessible using FLIP",
428427 progname, mem->desc);
429428 if (strcmp(mem->desc, "flash") == 0)
430- avrdude_message(" (did you mean \"application\"?)");
431- avrdude_message("\n");
429+ avrdude_message(MSG_INFO, " (did you mean \"application\"?)");
430+ avrdude_message(MSG_INFO, "\n");
432431 return -1;
433432 }
434433
@@ -447,18 +446,18 @@
447446 mem_unit = flip2_mem_unit(mem->desc);
448447
449448 if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
450- avrdude_message("%s: Error: "
449+ avrdude_message(MSG_INFO, "%s: Error: "
451450 "\"%s\" memory not accessible using FLIP",
452451 progname, mem->desc);
453452 if (strcmp(mem->desc, "flash") == 0)
454- avrdude_message(" (did you mean \"application\"?)");
455- avrdude_message("\n");
453+ avrdude_message(MSG_INFO, " (did you mean \"application\"?)");
454+ avrdude_message(MSG_INFO, "\n");
456455 return -1;
457456 }
458457
459458 if (n_bytes > INT_MAX) {
460459 /* This should never happen, unless the int type is only 16 bits. */
461- avrdude_message("%s: Error: Attempting to read more than %d bytes\n",
460+ avrdude_message(MSG_INFO, "%s: Error: Attempting to read more than %d bytes\n",
462461 progname, INT_MAX);
463462 exit(1);
464463 }
@@ -481,18 +480,18 @@
481480 mem_unit = flip2_mem_unit(mem->desc);
482481
483482 if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
484- avrdude_message("%s: Error: "
483+ avrdude_message(MSG_INFO, "%s: Error: "
485484 "\"%s\" memory not accessible using FLIP",
486485 progname, mem->desc);
487486 if (strcmp(mem->desc, "flash") == 0)
488- avrdude_message(" (did you mean \"application\"?)");
489- avrdude_message("\n");
487+ avrdude_message(MSG_INFO, " (did you mean \"application\"?)");
488+ avrdude_message(MSG_INFO, "\n");
490489 return -1;
491490 }
492491
493492 if (n_bytes > INT_MAX) {
494493 /* This should never happen, unless the int type is only 16 bits. */
495- avrdude_message("%s: Error: Attempting to read more than %d bytes\n",
494+ avrdude_message(MSG_INFO, "%s: Error: Attempting to read more than %d bytes\n",
496495 progname, INT_MAX);
497496 exit(1);
498497 }
@@ -509,7 +508,7 @@
509508 return -1;
510509
511510 if (mem->size < sizeof(FLIP2(pgm)->part_sig)) {
512- avrdude_message("%s: Error: Signature read must be at least %u bytes\n",
511+ avrdude_message(MSG_INFO, "%s: Error: Signature read must be at least %u bytes\n",
513512 progname, (unsigned int) sizeof(FLIP2(pgm)->part_sig));
514513 return -1;
515514 }
@@ -523,7 +522,7 @@
523522 pgm->cookie = calloc(1, sizeof(struct flip2));
524523
525524 if (pgm->cookie == NULL) {
526- avrdude_message("%s: Out of memory allocating private data structure\n",
525+ avrdude_message(MSG_INFO, "%s: Out of memory allocating private data structure\n",
527526 progname);
528527 exit(1);
529528 }
@@ -542,24 +541,24 @@
542541 {
543542 dfu_show_info(flip2->dfu);
544543
545- avrdude_message(" Part signature : 0x%02X%02X%02X\n",
544+ avrdude_message(MSG_INFO, " Part signature : 0x%02X%02X%02X\n",
546545 (int) flip2->part_sig[0],
547546 (int) flip2->part_sig[1],
548547 (int) flip2->part_sig[2]);
549548
550549 if (flip2->part_rev < 26)
551- avrdude_message(" Part revision : %c\n",
550+ avrdude_message(MSG_INFO, " Part revision : %c\n",
552551 (char) (flip2->part_rev + 'A'));
553552 else
554- avrdude_message(" Part revision : %c%c\n",
553+ avrdude_message(MSG_INFO, " Part revision : %c%c\n",
555554 (char) (flip2->part_rev / 26 - 1 + 'A'),
556555 (char) (flip2->part_rev % 26 + 'A'));
557556
558- avrdude_message(" Bootloader version : 2.%hu.%hu\n",
557+ avrdude_message(MSG_INFO, " Bootloader version : 2.%hu.%hu\n",
559558 ((unsigned short) flip2->boot_ver >> 4) & 0xF,
560559 ((unsigned short) flip2->boot_ver >> 0) & 0xF);
561560
562- avrdude_message(" USB max packet size : %hu\n",
561+ avrdude_message(MSG_INFO, " USB max packet size : %hu\n",
563562 (unsigned short) flip2->dfu->dev_desc.bMaxPacketSize0);
564563 }
565564
@@ -572,18 +571,17 @@
572571 int read_size;
573572 int result;
574573
575- if (verbose > 1)
576- avrdude_message("%s: flip_read_memory(%s, 0x%04x, %d)\n",
577- progname, flip2_mem_unit_str(mem_unit), addr, size);
574+ avrdude_message(MSG_NOTICE2, "%s: flip_read_memory(%s, 0x%04x, %d)\n",
575+ progname, flip2_mem_unit_str(mem_unit), addr, size);
578576
579577 result = flip2_set_mem_unit(dfu, mem_unit);
580578
581579 if (result != 0) {
582580 if ((mem_name = flip2_mem_unit_str(mem_unit)) != NULL)
583- avrdude_message("%s: Error: Failed to set memory unit 0x%02X (%s)\n",
581+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory unit 0x%02X (%s)\n",
584582 progname, (int) mem_unit, mem_name);
585583 else
586- avrdude_message("%s: Error: Failed to set memory unit 0x%02X\n",
584+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory unit 0x%02X\n",
587585 progname, (int) mem_unit);
588586 return -1;
589587 }
@@ -592,7 +590,7 @@
592590 result = flip2_set_mem_page(dfu, page_addr);
593591
594592 if (result != 0) {
595- avrdude_message("%s: Error: Failed to set memory page 0x%04hX\n",
593+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory page 0x%04hX\n",
596594 progname, page_addr);
597595 return -1;
598596 }
@@ -604,7 +602,7 @@
604602 if (page_addr != prev_page_addr) {
605603 result = flip2_set_mem_page(dfu, page_addr);
606604 if (result != 0) {
607- avrdude_message("%s: Error: Failed to set memory page 0x%04hX\n",
605+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory page 0x%04hX\n",
608606 progname, page_addr);
609607 return -1;
610608 }
@@ -614,7 +612,7 @@
614612 result = flip2_read_max1k(dfu, addr & 0xFFFF, ptr, read_size);
615613
616614 if (result != 0) {
617- avrdude_message("%s: Error: Failed to read 0x%04X bytes at 0x%04lX\n",
615+ avrdude_message(MSG_INFO, "%s: Error: Failed to read 0x%04X bytes at 0x%04lX\n",
618616 progname, read_size, (unsigned long) addr);
619617 return -1;
620618 }
@@ -636,18 +634,17 @@
636634 int write_size;
637635 int result;
638636
639- if (verbose > 1)
640- avrdude_message("%s: flip_write_memory(%s, 0x%04x, %d)\n",
641- progname, flip2_mem_unit_str(mem_unit), addr, size);
637+ avrdude_message(MSG_NOTICE2, "%s: flip_write_memory(%s, 0x%04x, %d)\n",
638+ progname, flip2_mem_unit_str(mem_unit), addr, size);
642639
643640 result = flip2_set_mem_unit(dfu, mem_unit);
644641
645642 if (result != 0) {
646643 if ((mem_name = flip2_mem_unit_str(mem_unit)) != NULL)
647- avrdude_message("%s: Error: Failed to set memory unit 0x%02X (%s)\n",
644+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory unit 0x%02X (%s)\n",
648645 progname, (int) mem_unit, mem_name);
649646 else
650- avrdude_message("%s: Error: Failed to set memory unit 0x%02X\n",
647+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory unit 0x%02X\n",
651648 progname, (int) mem_unit);
652649 return -1;
653650 }
@@ -656,7 +653,7 @@
656653 result = flip2_set_mem_page(dfu, page_addr);
657654
658655 if (result != 0) {
659- avrdude_message("%s: Error: Failed to set memory page 0x%04hX\n",
656+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory page 0x%04hX\n",
660657 progname, page_addr);
661658 return -1;
662659 }
@@ -668,7 +665,7 @@
668665 if (page_addr != prev_page_addr) {
669666 result = flip2_set_mem_page(dfu, page_addr);
670667 if (result != 0) {
671- avrdude_message("%s: Error: Failed to set memory page 0x%04hX\n",
668+ avrdude_message(MSG_INFO, "%s: Error: Failed to set memory page 0x%04hX\n",
672669 progname, page_addr);
673670 return -1;
674671 }
@@ -678,7 +675,7 @@
678675 result = flip2_write_max1k(dfu, addr & 0xFFFF, ptr, write_size);
679676
680677 if (result != 0) {
681- avrdude_message("%s: Error: Failed to write 0x%04X bytes at 0x%04lX\n",
678+ avrdude_message(MSG_INFO, "%s: Error: Failed to write 0x%04X bytes at 0x%04lX\n",
682679 progname, write_size, (unsigned long) addr);
683680 return -1;
684681 }
@@ -715,10 +712,10 @@
715712 if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) &&
716713 status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF))
717714 {
718- avrdude_message("%s: Error: Unknown memory unit (0x%02x)\n",
715+ avrdude_message(MSG_INFO, "%s: Error: Unknown memory unit (0x%02x)\n",
719716 progname, (unsigned int) mem_unit);
720717 } else
721- avrdude_message("%s: Error: DFU status %s\n", progname,
718+ avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname,
722719 flip2_status_str(&status));
723720 dfu_clrstatus(dfu);
724721 }
@@ -752,10 +749,10 @@
752749 if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) &&
753750 status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF))
754751 {
755- avrdude_message("%s: Error: Page address out of range (0x%04hx)\n",
752+ avrdude_message(MSG_INFO, "%s: Error: Page address out of range (0x%04hx)\n",
756753 progname, page_addr);
757754 } else
758- avrdude_message("%s: Error: DFU status %s\n", progname,
755+ avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname,
759756 flip2_status_str(&status));
760757 dfu_clrstatus(dfu);
761758 }
@@ -797,10 +794,10 @@
797794 if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) &&
798795 status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF))
799796 {
800- avrdude_message("%s: Error: Address out of range [0x%04hX,0x%04hX]\n",
797+ avrdude_message(MSG_INFO, "%s: Error: Address out of range [0x%04hX,0x%04hX]\n",
801798 progname, offset, offset+size-1);
802799 } else
803- avrdude_message("%s: Error: DFU status %s\n", progname,
800+ avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname,
804801 flip2_status_str(&status));
805802 dfu_clrstatus(dfu);
806803 }
@@ -827,7 +824,7 @@
827824 cmd.args[3] = ((offset+size-1) >> 0) & 0xFF;
828825
829826 if (size > 0x400) {
830- avrdude_message("%s: Error: Write block too large (%hu > 1024)\n",
827+ avrdude_message(MSG_INFO, "%s: Error: Write block too large (%hu > 1024)\n",
831828 progname, size);
832829 return -1;
833830 }
@@ -858,10 +855,10 @@
858855 if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) &&
859856 status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF))
860857 {
861- avrdude_message("%s: Error: Address out of range [0x%04hX,0x%04hX]\n",
858+ avrdude_message(MSG_INFO, "%s: Error: Address out of range [0x%04hX,0x%04hX]\n",
862859 progname, offset, offset+size-1);
863860 } else
864- avrdude_message("%s: Error: DFU status %s\n", progname,
861+ avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname,
865862 flip2_status_str(&status));
866863 dfu_clrstatus(dfu);
867864 }
--- trunk/avrdude/ft245r.c (revision 1320)
+++ trunk/avrdude/ft245r.c (revision 1321)
@@ -89,7 +89,7 @@
8989 #ifndef HAVE_PTHREAD_H
9090
9191 static int ft245r_nopthread_open (struct programmer_t *pgm, char * name) {
92- avrdude_message("%s: error: no pthread support. Please compile again with pthread installed."
92+ avrdude_message(MSG_INFO, "%s: error: no pthread support. Please compile again with pthread installed."
9393 #if defined(_WIN32)
9494 " See http://sourceware.org/pthreads-win32/."
9595 #endif
@@ -107,7 +107,7 @@
107107 #elif defined(DO_NOT_BUILD_FT245R)
108108
109109 static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
110- avrdude_message("%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
110+ avrdude_message(MSG_INFO, "%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
111111 progname);
112112
113113 return -1;
@@ -165,7 +165,7 @@
165165 else nh = head + 1;
166166
167167 if (nh == tail) {
168- avrdude_message("buffer overflow. Cannot happen!\n");
168+ avrdude_message(MSG_INFO, "buffer overflow. Cannot happen!\n");
169169 }
170170 buffer[head] = c;
171171 head = nh;
@@ -235,7 +235,7 @@
235235 unsigned char res[4];
236236
237237 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
238- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
238+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
239239 p->desc);
240240 return -1;
241241 }
@@ -260,13 +260,13 @@
260260 rate = 150000; /* should work for all ftdi chips and the avr default internal clock of 1MHz */
261261 }
262262
263- if ((verbose>1) || FT245R_DEBUG) {
264- avrdude_message(" ft245r: spi bitclk %d -> ft baudrate %d\n",
263+ if (FT245R_DEBUG) {
264+ avrdude_message(MSG_NOTICE2, " ft245r: spi bitclk %d -> ft baudrate %d\n",
265265 rate / 2, rate);
266266 }
267267 r = ftdi_set_baudrate(handle, rate);
268268 if (r) {
269- avrdude_message("Set baudrate (%d) failed with error '%s'.\n",
269+ avrdude_message(MSG_INFO, "Set baudrate (%d) failed with error '%s'.\n",
270270 rate, ftdi_get_error_string (handle));
271271 return -1;
272272 }
@@ -373,7 +373,7 @@
373373 int i;
374374
375375 if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
376- avrdude_message("%s: AVR_OP_PGM_ENABLE command not defined for %s\n",
376+ avrdude_message(MSG_INFO, "%s: AVR_OP_PGM_ENABLE command not defined for %s\n",
377377 progname, p->desc);
378378 fflush(stderr);
379379 return -1;
@@ -386,8 +386,8 @@
386386
387387 if (res[p->pollindex-1] == p->pollvalue) return 0;
388388
389- if ((verbose>=1) || FT245R_DEBUG) {
390- avrdude_message("%s: Program enable command not successful. Retrying.\n",
389+ if (FT245R_DEBUG) {
390+ avrdude_message(MSG_NOTICE, "%s: Program enable command not successful. Retrying.\n",
391391 progname);
392392 fflush(stderr);
393393 }
@@ -401,7 +401,7 @@
401401 }
402402 }
403403
404- avrdude_message("%s: Device is not responding to program enable. Check connection.\n",
404+ avrdude_message(MSG_INFO, "%s: Device is not responding to program enable. Check connection.\n",
405405 progname);
406406 fflush(stderr);
407407
@@ -541,7 +541,7 @@
541541 }
542542 }
543543 if (devnum < 0) {
544- avrdude_message("%s: invalid portname '%s': use 'ft[0-9]+'\n",
544+ avrdude_message(MSG_INFO, "%s: invalid portname '%s': use 'ft[0-9]+'\n",
545545 progname,port);
546546 return -1;
547547 }
@@ -556,7 +556,7 @@
556556 if (usbpid) {
557557 pid = *(int *)(ldata(usbpid));
558558 if (lnext(usbpid))
559- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
559+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
560560 progname, pid);
561561 } else {
562562 pid = USB_DEVICE_FT245;
@@ -568,7 +568,7 @@
568568 pgm->usbsn[0]?pgm->usbsn:NULL,
569569 devnum);
570570 if (rv) {
571- avrdude_message("can't open ftdi device %d. (%s)\n", devnum, ftdi_get_error_string(handle));
571+ avrdude_message(MSG_INFO, "can't open ftdi device %d. (%s)\n", devnum, ftdi_get_error_string(handle));
572572 goto cleanup_no_usb;
573573 }
574574
@@ -598,7 +598,7 @@
598598
599599 rv = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronous BitBang
600600 if (rv) {
601- avrdude_message("%s: Synchronous BitBangMode is not supported (%s)\n",
601+ avrdude_message(MSG_INFO, "%s: Synchronous BitBangMode is not supported (%s)\n",
602602 progname, ftdi_get_error_string(handle));
603603 goto cleanup;
604604 }
@@ -652,7 +652,7 @@
652652 }
653653
654654 static void ft245r_display(PROGRAMMER * pgm, const char * p) {
655- avrdude_message("%sPin assignment : 0..7 = DBUS0..7\n",p);/* , 8..11 = GPIO0..3\n",p);*/
655+ avrdude_message(MSG_INFO, "%sPin assignment : 0..7 = DBUS0..7\n",p);/* , 8..11 = GPIO0..3\n",p);*/
656656 pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS);
657657 }
658658
@@ -705,7 +705,7 @@
705705 } else {
706706 p = malloc(sizeof(struct ft245r_request));
707707 if (!p) {
708- avrdude_message("can't alloc memory\n");
708+ avrdude_message(MSG_INFO, "can't alloc memory\n");
709709 exit(1);
710710 }
711711 }
@@ -799,7 +799,7 @@
799799 put_request(addr_save, buf_pos, 0);
800800 //ft245r_sync(pgm);
801801 #if 0
802- avrdude_message("send addr 0x%04x bufsize %d [%02x %02x] page_write %d\n",
802+ avrdude_message(MSG_INFO, "send addr 0x%04x bufsize %d [%02x %02x] page_write %d\n",
803803 addr_save,buf_pos,
804804 extract_data_out(pgm, buf , (0*4 + 3) ),
805805 extract_data_out(pgm, buf , (1*4 + 3) ),
--- trunk/avrdude/jtag3.c (revision 1320)
+++ trunk/avrdude/jtag3.c (revision 1321)
@@ -109,7 +109,7 @@
109109 void jtag3_setup(PROGRAMMER * pgm)
110110 {
111111 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
112- avrdude_message("%s: jtag3_setup(): Out of memory allocating private data\n",
112+ avrdude_message(MSG_INFO, "%s: jtag3_setup(): Out of memory allocating private data\n",
113113 progname);
114114 exit(1);
115115 }
@@ -168,7 +168,7 @@
168168 return;
169169
170170 for (i = 0; i < s; i++) {
171- avrdude_message("0x%02x", b[i]);
171+ avrdude_message(MSG_INFO, "0x%02x", b[i]);
172172 if (i % 16 == 15)
173173 putc('\n', stderr);
174174 else
@@ -183,10 +183,10 @@
183183 int i;
184184
185185 if (verbose >= 4) {
186- avrdude_message("Raw message:\n");
186+ avrdude_message(MSG_TRACE, "Raw message:\n");
187187
188188 for (i = 0; i < len; i++) {
189- avrdude_message("%02x ", data[i]);
189+ avrdude_message(MSG_TRACE, "%02x ", data[i]);
190190 if (i % 16 == 15)
191191 putc('\n', stderr);
192192 else
@@ -198,34 +198,34 @@
198198
199199 switch (data[0]) {
200200 case SCOPE_INFO:
201- avrdude_message("[info] ");
201+ avrdude_message(MSG_INFO, "[info] ");
202202 break;
203203
204204 case SCOPE_GENERAL:
205- avrdude_message("[general] ");
205+ avrdude_message(MSG_INFO, "[general] ");
206206 break;
207207
208208 case SCOPE_AVR_ISP:
209- avrdude_message("[AVRISP] ");
209+ avrdude_message(MSG_INFO, "[AVRISP] ");
210210 jtag3_print_data(data + 1, len - 1);
211211 return;
212212
213213 case SCOPE_AVR:
214- avrdude_message("[AVR] ");
214+ avrdude_message(MSG_INFO, "[AVR] ");
215215 break;
216216
217217 default:
218- avrdude_message("[scope 0x%02x] ", data[0]);
218+ avrdude_message(MSG_INFO, "[scope 0x%02x] ", data[0]);
219219 break;
220220 }
221221
222222 switch (data[1]) {
223223 case RSP3_OK:
224- avrdude_message("OK\n");
224+ avrdude_message(MSG_INFO, "OK\n");
225225 break;
226226
227227 case RSP3_FAILED:
228- avrdude_message("FAILED");
228+ avrdude_message(MSG_INFO, "FAILED");
229229 if (len > 3)
230230 {
231231 char reason[50];
@@ -264,26 +264,26 @@
264264 strcpy(reason, "debugWIRE communication failed");
265265 break;
266266 }
267- avrdude_message(", reason: %s\n", reason);
267+ avrdude_message(MSG_INFO, ", reason: %s\n", reason);
268268 }
269269 else
270270 {
271- avrdude_message(", unspecified reason\n");
271+ avrdude_message(MSG_INFO, ", unspecified reason\n");
272272 }
273273 break;
274274
275275 case RSP3_DATA:
276- avrdude_message("Data returned:\n");
276+ avrdude_message(MSG_INFO, "Data returned:\n");
277277 jtag3_print_data(data + 2, len - 2);
278278 break;
279279
280280 case RSP3_INFO:
281- avrdude_message("Info returned:\n");
281+ avrdude_message(MSG_INFO, "Info returned:\n");
282282 for (i = 2; i < len; i++) {
283283 if (isprint(data[i]))
284284 putc(data[i], stderr);
285285 else
286- avrdude_message("\\%03o", data[i]);
286+ avrdude_message(MSG_INFO, "\\%03o", data[i]);
287287 }
288288 putc('\n', stderr);
289289 break;
@@ -291,18 +291,18 @@
291291 case RSP3_PC:
292292 if (len < 7)
293293 {
294- avrdude_message("PC reply too short\n");
294+ avrdude_message(MSG_INFO, "PC reply too short\n");
295295 }
296296 else
297297 {
298298 unsigned long pc = (data[6] << 24) | (data[5] << 16)
299299 | (data[4] << 8) | data[3];
300- avrdude_message("PC 0x%0lx\n", pc);
300+ avrdude_message(MSG_INFO, "PC 0x%0lx\n", pc);
301301 }
302302 break;
303303
304304 default:
305- avrdude_message("unknown message 0x%02x\n", data[1]);
305+ avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[1]);
306306 }
307307 }
308308
@@ -311,10 +311,10 @@
311311 int i;
312312
313313 if (verbose >= 4) {
314- avrdude_message("Raw event:\n");
314+ avrdude_message(MSG_TRACE, "Raw event:\n");
315315
316316 for (i = 0; i < len; i++) {
317- avrdude_message("%02x ", data[i]);
317+ avrdude_message(MSG_TRACE, "%02x ", data[i]);
318318 if (i % 16 == 15)
319319 putc('\n', stderr);
320320 else
@@ -324,47 +324,47 @@
324324 putc('\n', stderr);
325325 }
326326
327- avrdude_message("Event serial 0x%04x, ",
327+ avrdude_message(MSG_INFO, "Event serial 0x%04x, ",
328328 (data[3] << 8) | data[2]);
329329
330330 switch (data[4]) {
331331 case SCOPE_INFO:
332- avrdude_message("[info] ");
332+ avrdude_message(MSG_INFO, "[info] ");
333333 break;
334334
335335 case SCOPE_GENERAL:
336- avrdude_message("[general] ");
336+ avrdude_message(MSG_INFO, "[general] ");
337337 break;
338338
339339 case SCOPE_AVR:
340- avrdude_message("[AVR] ");
340+ avrdude_message(MSG_INFO, "[AVR] ");
341341 break;
342342
343343 default:
344- avrdude_message("[scope 0x%02x] ", data[0]);
344+ avrdude_message(MSG_INFO, "[scope 0x%02x] ", data[0]);
345345 break;
346346 }
347347
348348 switch (data[5]) {
349349 case EVT3_BREAK:
350- avrdude_message("BREAK");
350+ avrdude_message(MSG_INFO, "BREAK");
351351 if (len >= 11) {
352- avrdude_message(", PC = 0x%lx, reason ", b4_to_u32(data + 6));
352+ avrdude_message(MSG_INFO, ", PC = 0x%lx, reason ", b4_to_u32(data + 6));
353353 switch (data[10]) {
354354 case 0x00:
355- avrdude_message("unspecified");
355+ avrdude_message(MSG_INFO, "unspecified");
356356 break;
357357 case 0x01:
358- avrdude_message("program break");
358+ avrdude_message(MSG_INFO, "program break");
359359 break;
360360 case 0x02:
361- avrdude_message("data break PDSB");
361+ avrdude_message(MSG_INFO, "data break PDSB");
362362 break;
363363 case 0x03:
364- avrdude_message("data break PDMSB");
364+ avrdude_message(MSG_INFO, "data break PDMSB");
365365 break;
366366 default:
367- avrdude_message("unknown: 0x%02x", data[10]);
367+ avrdude_message(MSG_INFO, "unknown: 0x%02x", data[10]);
368368 }
369369 /* There are two more bytes of data which always appear to be
370370 * 0x01, 0x00. Purpose unknown. */
@@ -373,24 +373,24 @@
373373
374374 case EVT3_SLEEP:
375375 if (len >= 8 && data[7] == 0)
376- avrdude_message("sleeping");
376+ avrdude_message(MSG_INFO, "sleeping");
377377 else if (len >= 8 && data[7] == 1)
378- avrdude_message("wakeup");
378+ avrdude_message(MSG_INFO, "wakeup");
379379 else
380- avrdude_message("unknown SLEEP event");
380+ avrdude_message(MSG_INFO, "unknown SLEEP event");
381381 break;
382382
383383 case EVT3_POWER:
384384 if (len >= 8 && data[7] == 0)
385- avrdude_message("power-down");
385+ avrdude_message(MSG_INFO, "power-down");
386386 else if (len >= 8 && data[7] == 1)
387- avrdude_message("power-up");
387+ avrdude_message(MSG_INFO, "power-up");
388388 else
389- avrdude_message("unknown POWER event");
389+ avrdude_message(MSG_INFO, "unknown POWER event");
390390 break;
391391
392392 default:
393- avrdude_message("UNKNOWN 0x%02x", data[5]);
393+ avrdude_message(MSG_INFO, "UNKNOWN 0x%02x", data[5]);
394394 break;
395395 }
396396 putc('\n', stderr);
@@ -405,13 +405,12 @@
405405 if (pgm->flag & PGM_FL_IS_EDBG)
406406 return jtag3_edbg_send(pgm, data, len);
407407
408- if (verbose >= 3)
409- avrdude_message("\n%s: jtag3_send(): sending %lu bytes\n",
408+ avrdude_message(MSG_DEBUG, "\n%s: jtag3_send(): sending %lu bytes\n",
410409 progname, (unsigned long)len);
411410
412411 if ((buf = malloc(len + 4)) == NULL)
413412 {
414- avrdude_message("%s: jtag3_send(): out of memory",
413+ avrdude_message(MSG_INFO, "%s: jtag3_send(): out of memory",
415414 progname);
416415 return -1;
417416 }
@@ -422,7 +421,7 @@
422421 memcpy(buf + 4, data, len);
423422
424423 if (serial_send(&pgm->fd, buf, len + 4) != 0) {
425- avrdude_message("%s: jtag3_send(): failed to send command to serial port\n",
424+ avrdude_message(MSG_INFO, "%s: jtag3_send(): failed to send command to serial port\n",
426425 progname);
427426 return -1;
428427 }
@@ -444,13 +443,12 @@
444443 memset(status, 0, USBDEV_MAX_XFER_3);
445444 }
446445
447- if (verbose >= 3)
448- avrdude_message("\n%s: jtag3_edbg_send(): sending %lu bytes\n",
446+ avrdude_message(MSG_DEBUG, "\n%s: jtag3_edbg_send(): sending %lu bytes\n",
449447 progname, (unsigned long)len);
450448
451449 if (len + 8 > USBDEV_MAX_XFER_3)
452450 {
453- avrdude_message("%s: jtag3_edbg_send(): Fragmentation not (yet) implemented!\n",
451+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_send(): Fragmentation not (yet) implemented!\n",
454452 progname);
455453 return -1;
456454 }
@@ -464,7 +462,7 @@
464462 memcpy(buf + 8, data, len);
465463
466464 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
467- avrdude_message("%s: jtag3_edbg_send(): failed to send command to serial port\n",
465+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_send(): failed to send command to serial port\n",
468466 progname);
469467 return -1;
470468 }
@@ -472,8 +470,7 @@
472470
473471 if (rv < 0) {
474472 /* timeout in receive */
475- if (verbose > 1)
476- avrdude_message("%s: jtag3_edbg_send(): Timeout receiving packet\n",
473+ avrdude_message(MSG_NOTICE2, "%s: jtag3_edbg_send(): Timeout receiving packet\n",
477474 progname);
478475 return -1;
479476 }
@@ -480,7 +477,7 @@
480477 if (status[0] != EDBG_VENDOR_AVR_CMD || status[1] != 0x01)
481478 {
482479 /* what to do in this case? */
483- avrdude_message("%s: jtag3_edbg_send(): Unexpected response 0x%02x, 0x%02x\n",
480+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_send(): Unexpected response 0x%02x, 0x%02x\n",
484481 progname, status[0], status[1]);
485482 }
486483
@@ -496,8 +493,7 @@
496493 unsigned char status[USBDEV_MAX_XFER_3];
497494 int rv;
498495
499- if (verbose >= 3)
500- avrdude_message("\n%s: jtag3_edbg_prepare()\n",
496+ avrdude_message(MSG_DEBUG, "\n%s: jtag3_edbg_prepare()\n",
501497 progname);
502498
503499 if (verbose >= 4)
@@ -506,22 +502,21 @@
506502 buf[0] = CMSISDAP_CMD_CONNECT;
507503 buf[1] = CMSISDAP_CONN_SWD;
508504 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
509- avrdude_message("%s: jtag3_edbg_prepare(): failed to send command to serial port\n",
505+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): failed to send command to serial port\n",
510506 progname);
511507 return -1;
512508 }
513509 rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3);
514510 if (rv != USBDEV_MAX_XFER_3) {
515- avrdude_message("%s: jtag3_edbg_prepare(): failed to read from serial port (%d)\n",
511+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): failed to read from serial port (%d)\n",
516512 progname, rv);
517513 return -1;
518514 }
519515 if (status[0] != CMSISDAP_CMD_CONNECT ||
520516 status[1] == 0)
521- avrdude_message("%s: jtag3_edbg_prepare(): unexpected response 0x%02x, 0x%02x\n",
517+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): unexpected response 0x%02x, 0x%02x\n",
522518 progname, status[0], status[1]);
523- if (verbose >= 2)
524- avrdude_message("%s: jtag3_edbg_prepare(): connection status 0x%02x\n",
519+ avrdude_message(MSG_NOTICE2, "%s: jtag3_edbg_prepare(): connection status 0x%02x\n",
525520 progname, status[1]);
526521
527522 buf[0] = CMSISDAP_CMD_LED;
@@ -528,19 +523,19 @@
528523 buf[1] = CMSISDAP_LED_CONNECT;
529524 buf[2] = 1;
530525 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
531- avrdude_message("%s: jtag3_edbg_prepare(): failed to send command to serial port\n",
526+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): failed to send command to serial port\n",
532527 progname);
533528 return -1;
534529 }
535530 rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3);
536531 if (rv != USBDEV_MAX_XFER_3) {
537- avrdude_message("%s: jtag3_edbg_prepare(): failed to read from serial port (%d)\n",
532+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): failed to read from serial port (%d)\n",
538533 progname, rv);
539534 return -1;
540535 }
541536 if (status[0] != CMSISDAP_CMD_LED ||
542537 status[1] != 0)
543- avrdude_message("%s: jtag3_edbg_prepare(): unexpected response 0x%02x, 0x%02x\n",
538+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_prepare(): unexpected response 0x%02x, 0x%02x\n",
544539 progname, status[0], status[1]);
545540
546541 return 0;
@@ -556,8 +551,7 @@
556551 unsigned char status[USBDEV_MAX_XFER_3];
557552 int rv;
558553
559- if (verbose >= 3)
560- avrdude_message("\n%s: jtag3_edbg_signoff()\n",
554+ avrdude_message(MSG_DEBUG, "\n%s: jtag3_edbg_signoff()\n",
561555 progname);
562556
563557 if (verbose >= 4)
@@ -567,36 +561,36 @@
567561 buf[1] = CMSISDAP_LED_CONNECT;
568562 buf[2] = 0;
569563 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
570- avrdude_message("%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
564+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
571565 progname);
572566 return -1;
573567 }
574568 rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3);
575569 if (rv != USBDEV_MAX_XFER_3) {
576- avrdude_message("%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
570+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
577571 progname, rv);
578572 return -1;
579573 }
580574 if (status[0] != CMSISDAP_CMD_LED ||
581575 status[1] != 0)
582- avrdude_message("%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
576+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
583577 progname, status[0], status[1]);
584578
585579 buf[0] = CMSISDAP_CMD_DISCONNECT;
586580 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
587- avrdude_message("%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
581+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
588582 progname);
589583 return -1;
590584 }
591585 rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3);
592586 if (rv != USBDEV_MAX_XFER_3) {
593- avrdude_message("%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
587+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
594588 progname, rv);
595589 return -1;
596590 }
597591 if (status[0] != CMSISDAP_CMD_DISCONNECT ||
598592 status[1] != 0)
599- avrdude_message("%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
593+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
600594 progname, status[0], status[1]);
601595
602596 return 0;
@@ -624,11 +618,10 @@
624618 if (pgm->flag & PGM_FL_IS_EDBG)
625619 return jtag3_edbg_recv_frame(pgm, msg);
626620
627- if (verbose >= 4)
628- avrdude_message("%s: jtag3_recv():\n", progname);
621+ avrdude_message(MSG_TRACE, "%s: jtag3_recv():\n", progname);
629622
630623 if ((buf = malloc(pgm->fd.usb.max_xfer)) == NULL) {
631- avrdude_message("%s: jtag3_recv(): out of memory\n",
624+ avrdude_message(MSG_INFO, "%s: jtag3_recv(): out of memory\n",
632625 progname);
633626 return -1;
634627 }
@@ -639,8 +632,7 @@
639632
640633 if (rv < 0) {
641634 /* timeout in receive */
642- if (verbose > 1)
643- avrdude_message("%s: jtag3_recv(): Timeout receiving packet\n",
635+ avrdude_message(MSG_NOTICE2, "%s: jtag3_recv(): Timeout receiving packet\n",
644636 progname);
645637 free(buf);
646638 return -1;
@@ -655,11 +647,10 @@
655647 int rv, len;
656648 unsigned char *buf = NULL;
657649
658- if (verbose >= 4)
659- avrdude_message("%s: jtag3_edbg_recv():\n", progname);
650+ avrdude_message(MSG_TRACE, "%s: jtag3_edbg_recv():\n", progname);
660651
661652 if ((buf = malloc(USBDEV_MAX_XFER_3)) == NULL) {
662- avrdude_message("%s: jtag3_edbg_recv(): out of memory\n",
653+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): out of memory\n",
663654 progname);
664655 return -1;
665656 }
@@ -667,7 +658,7 @@
667658 buf[0] = EDBG_VENDOR_AVR_RSP;
668659
669660 if (serial_send(&pgm->fd, buf, USBDEV_MAX_XFER_3) != 0) {
670- avrdude_message("%s: jtag3_edbg_recv(): error sending CMSIS-DAP vendor command\n",
661+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): error sending CMSIS-DAP vendor command\n",
671662 progname);
672663 return -1;
673664 }
@@ -676,8 +667,7 @@
676667
677668 if (rv < 0) {
678669 /* timeout in receive */
679- if (verbose > 1)
680- avrdude_message("%s: jtag3_edbg_recv(): Timeout receiving packet\n",
670+ avrdude_message(MSG_NOTICE2, "%s: jtag3_edbg_recv(): Timeout receiving packet\n",
681671 progname);
682672 free(buf);
683673 return -1;
@@ -685,7 +675,7 @@
685675
686676 if (buf[0] != EDBG_VENDOR_AVR_RSP ||
687677 buf[1] != ((1 << 4) | 1)) {
688- avrdude_message("%s: jtag3_edbg_recv(): Unexpected response 0x%02x, 0x%02x\n",
678+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): Unexpected response 0x%02x, 0x%02x\n",
689679 progname, buf[0], buf[1]);
690680 return -1;
691681 }
@@ -692,7 +682,7 @@
692682 /* calculate length from response; CMSIS-DAP response might be larger */
693683 len = (buf[2] << 8) | buf[3];
694684 if (len > rv + 4) {
695- avrdude_message("%s: jtag3_edbg_recv(): Unexpected length value (%d > %d)\n",
685+ avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): Unexpected length value (%d > %d)\n",
696686 progname, len, rv + 4);
697687 len = rv + 4;
698688 }
@@ -721,8 +711,7 @@
721711
722712 rv &= USB_RECV_LENGTH_MASK;
723713 r_seqno = ((*msg)[2] << 8) | (*msg)[1];
724- if (verbose >= 3)
725- avrdude_message("%s: jtag3_recv(): "
714+ avrdude_message(MSG_DEBUG, "%s: jtag3_recv(): "
726715 "Got message seqno %d (command_sequence == %d)\n",
727716 progname, r_seqno, PDATA(pgm)->command_sequence);
728717 if (r_seqno == PDATA(pgm)->command_sequence) {
@@ -738,8 +727,7 @@
738727
739728 return rv;
740729 }
741- if (verbose >= 2)
742- avrdude_message("%s: jtag3_recv(): "
730+ avrdude_message(MSG_NOTICE2, "%s: jtag3_recv(): "
743731 "got wrong sequence number, %u != %u\n",
744732 progname, r_seqno, PDATA(pgm)->command_sequence);
745733
@@ -753,8 +741,7 @@
753741 int status;
754742 unsigned char c;
755743
756- if (verbose >= 2)
757- avrdude_message("%s: Sending %s command: ",
744+ avrdude_message(MSG_NOTICE2, "%s: Sending %s command: ",
758745 progname, descr);
759746 jtag3_send(pgm, cmd, cmdlen);
760747
@@ -762,18 +749,19 @@
762749 if (status <= 0) {
763750 if (verbose >= 2)
764751 putc('\n', stderr);
765- avrdude_message("%s: %s command: timeout/error communicating with programmer (status %d)\n",
752+ avrdude_message(MSG_NOTICE2, "%s: %s command: timeout/error communicating with programmer (status %d)\n",
766753 progname, descr, status);
767754 return -1;
768755 } else if (verbose >= 3) {
769756 putc('\n', stderr);
770757 jtag3_prmsg(pgm, *resp, status);
771- } else if (verbose == 2)
772- avrdude_message("0x%02x (%d bytes msg)\n", (*resp)[1], status);
758+ } else {
759+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", (*resp)[1], status);
760+ }
773761
774762 c = (*resp)[1];
775763 if ((c & RSP3_STATUS_MASK) != RSP3_OK) {
776- avrdude_message("%s: bad response to %s command: 0x%02x\n",
764+ avrdude_message(MSG_INFO, "%s: bad response to %s command: 0x%02x\n",
777765 progname, descr, c);
778766 free(*resp);
779767 resp = 0;
@@ -788,8 +776,7 @@
788776
789777 unsigned char buf[3], *resp;
790778
791- if (verbose >= 3)
792- avrdude_message("%s: jtag3_getsync()\n", progname);
779+ avrdude_message(MSG_DEBUG, "%s: jtag3_getsync()\n", progname);
793780
794781 if (pgm->flag & PGM_FL_IS_EDBG) {
795782 if (jtag3_edbg_prepare(pgm) < 0)
@@ -835,7 +822,7 @@
835822 static int jtag3_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p)
836823 {
837824
838- avrdude_message("%s: Chip erase not supported in debugWire mode\n",
825+ avrdude_message(MSG_INFO, "%s: Chip erase not supported in debugWire mode\n",
839826 progname);
840827
841828 return 0;
@@ -865,8 +852,7 @@
865852 }
866853
867854 /* XXX activate external reset here */
868- if (verbose > 0)
869- avrdude_message("%s: retrying with external reset applied\n",
855+ avrdude_message(MSG_NOTICE, "%s: retrying with external reset applied\n",
870856 progname);
871857 }
872858
@@ -939,10 +925,10 @@
939925 if (jtag3_getparm(pgm, SCOPE_GENERAL, 0, PARM3_FW_MAJOR, parm, 2) < 0)
940926 return -1;
941927 if (pgm->fd.usb.max_xfer < USBDEV_MAX_XFER_3 && (pgm->flag & PGM_FL_IS_EDBG) == 0) {
942- avrdude_message("%s: the JTAGICE3's firmware %d.%d is broken on USB 1.1 connections, sorry\n",
928+ avrdude_message(MSG_INFO, "%s: the JTAGICE3's firmware %d.%d is broken on USB 1.1 connections, sorry\n",
943929 progname, parm[0], parm[1]);
944930 if (ovsigck) {
945- avrdude_message("%s: forced to continue by option -F; THIS PUTS THE DEVICE'S DATA INTEGRITY AT RISK!\n",
931+ avrdude_message(MSG_INFO, "%s: forced to continue by option -F; THIS PUTS THE DEVICE'S DATA INTEGRITY AT RISK!\n",
946932 progname);
947933 } else {
948934 return -1;
@@ -964,7 +950,7 @@
964950 }
965951
966952 if (conn == 0) {
967- avrdude_message("%s: jtag3_initialize(): part %s has no %s interface\n",
953+ avrdude_message(MSG_INFO, "%s: jtag3_initialize(): part %s has no %s interface\n",
968954 progname, p->desc, ifname);
969955 return -1;
970956 }
@@ -997,8 +983,7 @@
997983 if (pgm->bitclock != 0.0 && PDATA(pgm)->set_sck != NULL)
998984 {
999985 unsigned int clock = 1E-3 / pgm->bitclock; /* kHz */
1000- if (verbose >= 2)
1001- avrdude_message("%s: jtag3_initialize(): "
986+ avrdude_message(MSG_NOTICE2, "%s: jtag3_initialize(): "
1002987 "trying to set JTAG clock to %u kHz\n",
1003988 progname, clock);
1004989 parm[0] = clock & 0xff;
@@ -1009,8 +994,7 @@
1009994
1010995 if (conn == PARM3_CONN_JTAG)
1011996 {
1012- if (verbose >= 2)
1013- avrdude_message("%s: jtag3_initialize(): "
997+ avrdude_message(MSG_NOTICE2, "%s: jtag3_initialize(): "
1014998 "trying to set JTAG daisy-chain info to %d,%d,%d,%d\n",
1015999 progname,
10161000 PDATA(pgm)->jtagchain[0], PDATA(pgm)->jtagchain[1],
@@ -1102,7 +1086,7 @@
11021086 ocdrev = 4;
11031087 else
11041088 ocdrev = 3; /* many exceptions from that, actually */
1105- avrdude_message("%s: part definition for %s lacks \"ocdrev\"; guessing %d\n",
1089+ avrdude_message(MSG_INFO, "%s: part definition for %s lacks \"ocdrev\"; guessing %d\n",
11061090 progname, p->desc, ocdrev);
11071091 md.ocd_revision = ocdrev;
11081092 } else {
@@ -1141,9 +1125,9 @@
11411125 * (except ISP which is handled completely differently, but that
11421126 * doesn't apply here anyway), the response is just RSP_OK.
11431127 */
1144- if (resp[1] == RSP3_DATA && status >= 7 && verbose >= 1)
1128+ if (resp[1] == RSP3_DATA && status >= 7)
11451129 /* JTAG ID has been returned */
1146- avrdude_message("%s: JTAG ID returned: 0x%02x 0x%02x 0x%02x 0x%02x\n",
1130+ avrdude_message(MSG_NOTICE, "%s: JTAG ID returned: 0x%02x 0x%02x 0x%02x 0x%02x\n",
11471131 progname, resp[3], resp[4], resp[5], resp[6]);
11481132
11491133 free(resp);
@@ -1157,7 +1141,7 @@
11571141 AVRMEM *bootmem = avr_locate_mem(p, "boot");
11581142 AVRMEM *flashmem = avr_locate_mem(p, "flash");
11591143 if (bootmem == NULL || flashmem == NULL) {
1160- avrdude_message("%s: jtagmk3_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
1144+ avrdude_message(MSG_INFO, "%s: jtagmk3_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
11611145 progname);
11621146 } else {
11631147 PDATA(pgm)->boot_start = bootmem->offset - flashmem->offset;
@@ -1167,12 +1151,12 @@
11671151 free(PDATA(pgm)->flash_pagecache);
11681152 free(PDATA(pgm)->eeprom_pagecache);
11691153 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
1170- avrdude_message("%s: jtag3_initialize(): Out of memory\n",
1154+ avrdude_message(MSG_INFO, "%s: jtag3_initialize(): Out of memory\n",
11711155 progname);
11721156 return -1;
11731157 }
11741158 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
1175- avrdude_message("%s: jtag3_initialize(): Out of memory\n",
1159+ avrdude_message(MSG_INFO, "%s: jtag3_initialize(): Out of memory\n",
11761160 progname);
11771161 free(PDATA(pgm)->flash_pagecache);
11781162 return -1;
@@ -1216,17 +1200,15 @@
12161200 unsigned int ub, ua, bb, ba;
12171201 if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba)
12181202 != 4) {
1219- avrdude_message("%s: jtag3_parseextparms(): invalid JTAG chain '%s'\n",
1203+ avrdude_message(MSG_INFO, "%s: jtag3_parseextparms(): invalid JTAG chain '%s'\n",
12201204 progname, extended_param);
12211205 rv = -1;
12221206 continue;
12231207 }
1224- if (verbose >= 2) {
1225- avrdude_message("%s: jtag3_parseextparms(): JTAG chain parsed as:\n"
1208+ avrdude_message(MSG_NOTICE2, "%s: jtag3_parseextparms(): JTAG chain parsed as:\n"
12261209 "%s %u units before, %u units after, %u bits before, %u bits after\n",
12271210 progname,
12281211 progbuf, ub, ua, bb, ba);
1229- }
12301212 PDATA(pgm)->jtagchain[0] = ub;
12311213 PDATA(pgm)->jtagchain[1] = ua;
12321214 PDATA(pgm)->jtagchain[2] = bb;
@@ -1235,7 +1217,7 @@
12351217 continue;
12361218 }
12371219
1238- avrdude_message("%s: jtag3_parseextparms(): invalid extended parameter '%s'\n",
1220+ avrdude_message(MSG_INFO, "%s: jtag3_parseextparms(): invalid extended parameter '%s'\n",
12391221 progname, extended_param);
12401222 rv = -1;
12411223 }
@@ -1250,12 +1232,12 @@
12501232 int rv = -1;
12511233
12521234 #if !defined(HAVE_LIBUSB)
1253- avrdude_message("avrdude was compiled without usb support.\n");
1235+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
12541236 return -1;
12551237 #endif
12561238
12571239 if (strncmp(port, "usb", 3) != 0) {
1258- avrdude_message("%s: jtag3_open_common(): JTAGICE3/EDBG port names must start with \"usb\"\n",
1240+ avrdude_message(MSG_INFO, "%s: jtag3_open_common(): JTAGICE3/EDBG port names must start with \"usb\"\n",
12591241 progname);
12601242 return -1;
12611243 }
@@ -1282,13 +1264,13 @@
12821264 rv = serial_open(port, pinfo, &pgm->fd);
12831265 }
12841266 if (rv < 0) {
1285- avrdude_message("%s: jtag3_open_common(): Did not find any device matching VID 0x%04x and PID list: ",
1267+ avrdude_message(MSG_INFO, "%s: jtag3_open_common(): Did not find any device matching VID 0x%04x and PID list: ",
12861268 progname, (unsigned)pinfo.usbinfo.vid);
12871269 int notfirst = 0;
12881270 for (usbpid = lfirst(pgm->usbpid); usbpid != NULL; usbpid = lnext(usbpid)) {
12891271 if (notfirst)
1290- avrdude_message(", ");
1291- avrdude_message("0x%04x", (unsigned int)(*(int *)(ldata(usbpid))));
1272+ avrdude_message(MSG_INFO, ", ");
1273+ avrdude_message(MSG_INFO, "0x%04x", (unsigned int)(*(int *)(ldata(usbpid))));
12921274 notfirst = 1;
12931275 }
12941276 fputc('\n', stderr);
@@ -1301,8 +1283,7 @@
13011283 /* The event EP has been deleted by usb_open(), so we are
13021284 running on a CMSIS-DAP device, using EDBG protocol */
13031285 pgm->flag |= PGM_FL_IS_EDBG;
1304- if (verbose)
1305- avrdude_message("%s: Found CMSIS-DAP compliant device, using EDBG protocol\n",
1286+ avrdude_message(MSG_NOTICE, "%s: Found CMSIS-DAP compliant device, using EDBG protocol\n",
13061287 progname);
13071288 }
13081289
@@ -1318,8 +1299,7 @@
13181299
13191300 static int jtag3_open(PROGRAMMER * pgm, char * port)
13201301 {
1321- if (verbose >= 2)
1322- avrdude_message("%s: jtag3_open()\n", progname);
1302+ avrdude_message(MSG_NOTICE2, "%s: jtag3_open()\n", progname);
13231303
13241304 if (jtag3_open_common(pgm, port) < 0)
13251305 return -1;
@@ -1332,8 +1312,7 @@
13321312
13331313 static int jtag3_open_dw(PROGRAMMER * pgm, char * port)
13341314 {
1335- if (verbose >= 2)
1336- avrdude_message("%s: jtag3_open_dw()\n", progname);
1315+ avrdude_message(MSG_NOTICE2, "%s: jtag3_open_dw()\n", progname);
13371316
13381317 if (jtag3_open_common(pgm, port) < 0)
13391318 return -1;
@@ -1346,8 +1325,7 @@
13461325
13471326 static int jtag3_open_pdi(PROGRAMMER * pgm, char * port)
13481327 {
1349- if (verbose >= 2)
1350- avrdude_message("%s: jtag3_open_pdi()\n", progname);
1328+ avrdude_message(MSG_NOTICE2, "%s: jtag3_open_pdi()\n", progname);
13511329
13521330 if (jtag3_open_common(pgm, port) < 0)
13531331 return -1;
@@ -1363,8 +1341,7 @@
13631341 {
13641342 unsigned char buf[4], *resp;
13651343
1366- if (verbose >= 2)
1367- avrdude_message("%s: jtag3_close()\n", progname);
1344+ avrdude_message(MSG_NOTICE2, "%s: jtag3_close()\n", progname);
13681345
13691346 buf[0] = SCOPE_AVR;
13701347 buf[1] = CMD3_SIGN_OFF;
@@ -1391,12 +1368,11 @@
13911368 {
13921369 unsigned char cmd[8], *resp;
13931370
1394- if (verbose >= 2)
1395- avrdude_message("%s: jtag3_page_erase(.., %s, 0x%x)\n",
1371+ avrdude_message(MSG_NOTICE2, "%s: jtag3_page_erase(.., %s, 0x%x)\n",
13961372 progname, m->desc, addr);
13971373
13981374 if (!(p->flags & AVRPART_HAS_PDI)) {
1399- avrdude_message("%s: jtag3_page_erase: not an Xmega device\n",
1375+ avrdude_message(MSG_INFO, "%s: jtag3_page_erase: not an Xmega device\n",
14001376 progname);
14011377 return -1;
14021378 }
@@ -1443,8 +1419,7 @@
14431419 int status, dynamic_memtype = 0;
14441420 long otimeout = serial_recv_timeout;
14451421
1446- if (verbose >= 2)
1447- avrdude_message("%s: jtag3_paged_write(.., %s, %d, %d)\n",
1422+ avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_write(.., %s, %d, %d)\n",
14481423 progname, m->desc, page_size, n_bytes);
14491424
14501425 if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
@@ -1453,7 +1428,7 @@
14531428 if (page_size == 0) page_size = 256;
14541429
14551430 if ((cmd = malloc(page_size + 13)) == NULL) {
1456- avrdude_message("%s: jtag3_paged_write(): Out of memory\n",
1431+ avrdude_message(MSG_INFO, "%s: jtag3_paged_write(): Out of memory\n",
14571432 progname);
14581433 return -1;
14591434 }
@@ -1500,8 +1475,7 @@
15001475 block_size = maxaddr - addr;
15011476 else
15021477 block_size = page_size;
1503- if (verbose >= 3)
1504- avrdude_message("%s: jtag3_paged_write(): "
1478+ avrdude_message(MSG_DEBUG, "%s: jtag3_paged_write(): "
15051479 "block_size at addr %d is %d\n",
15061480 progname, addr, block_size);
15071481
@@ -1549,8 +1523,7 @@
15491523 int status, dynamic_memtype = 0;
15501524 long otimeout = serial_recv_timeout;
15511525
1552- if (verbose >= 2)
1553- avrdude_message("%s: jtag3_paged_load(.., %s, %d, %d)\n",
1526+ avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_load(.., %s, %d, %d)\n",
15541527 progname, m->desc, page_size, n_bytes);
15551528
15561529 if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
@@ -1588,8 +1561,7 @@
15881561 block_size = maxaddr - addr;
15891562 else
15901563 block_size = page_size;
1591- if (verbose >= 3)
1592- avrdude_message("%s: jtag3_paged_load(): "
1564+ avrdude_message(MSG_DEBUG, "%s: jtag3_paged_load(): "
15931565 "block_size at addr %d is %d\n",
15941566 progname, addr, block_size);
15951567
@@ -1604,7 +1576,7 @@
16041576
16051577 if (resp[1] != RSP3_DATA ||
16061578 status < block_size + 4) {
1607- avrdude_message("%s: wrong/short reply to read memory command\n",
1579+ avrdude_message(MSG_INFO, "%s: wrong/short reply to read memory command\n",
16081580 progname);
16091581 serial_recv_timeout = otimeout;
16101582 free(resp);
@@ -1627,8 +1599,7 @@
16271599 unsigned long paddr = 0UL, *paddr_ptr = NULL;
16281600 unsigned int pagesize = 0;
16291601
1630- if (verbose >= 2)
1631- avrdude_message("%s: jtag3_read_byte(.., %s, 0x%lx, ...)\n",
1602+ avrdude_message(MSG_NOTICE2, "%s: jtag3_read_byte(.., %s, 0x%lx, ...)\n",
16321603 progname, mem->desc, addr);
16331604
16341605 if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
@@ -1716,7 +1687,7 @@
17161687 return 0;
17171688 } else {
17181689 /* should not happen */
1719- avrdude_message("address out of range for signature memory: %lu\n", addr);
1690+ avrdude_message(MSG_INFO, "address out of range for signature memory: %lu\n", addr);
17201691 return -1;
17211692 }
17221693 }
@@ -1757,7 +1728,7 @@
17571728
17581729 if (resp[1] != RSP3_DATA ||
17591730 status < (pagesize? pagesize: 1) + 4) {
1760- avrdude_message("%s: wrong/short reply to read memory command\n",
1731+ avrdude_message(MSG_INFO, "%s: wrong/short reply to read memory command\n",
17611732 progname);
17621733 free(resp);
17631734 return -1;
@@ -1783,8 +1754,7 @@
17831754 int status, unsupp = 0;
17841755 unsigned int pagesize = 0;
17851756
1786- if (verbose >= 2)
1787- avrdude_message("%s: jtag3_write_byte(.., %s, 0x%lx, ...)\n",
1757+ avrdude_message(MSG_NOTICE2, "%s: jtag3_write_byte(.., %s, 0x%lx, ...)\n",
17881758 progname, mem->desc, addr);
17891759
17901760 cmd[0] = SCOPE_AVR;
@@ -1901,7 +1871,7 @@
19011871 parm[1] = (clock >> 8) & 0xff;
19021872
19031873 if (PDATA(pgm)->set_sck == NULL) {
1904- avrdude_message("%s: No backend to set the SCK period for\n",
1874+ avrdude_message(MSG_INFO, "%s: No backend to set the SCK period for\n",
19051875 progname);
19061876 return -1;
19071877 }
@@ -1921,8 +1891,7 @@
19211891 unsigned char buf[6], *resp, c;
19221892 char descr[60];
19231893
1924- if (verbose >= 2)
1925- avrdude_message("%s: jtag3_getparm()\n", progname);
1894+ avrdude_message(MSG_NOTICE2, "%s: jtag3_getparm()\n", progname);
19261895
19271896 buf[0] = scope;
19281897 buf[1] = CMD3_GET_PARAMETER;
@@ -1939,7 +1908,7 @@
19391908
19401909 c = resp[1];
19411910 if (c != RSP3_DATA || status < 3) {
1942- avrdude_message("%s: jtag3_getparm(): "
1911+ avrdude_message(MSG_INFO, "%s: jtag3_getparm(): "
19431912 "bad response to %s\n",
19441913 progname, descr);
19451914 free(resp);
@@ -1964,8 +1933,7 @@
19641933 unsigned char *buf, *resp;
19651934 char descr[60];
19661935
1967- if (verbose >= 2)
1968- avrdude_message("%s: jtag3_setparm()\n", progname);
1936+ avrdude_message(MSG_NOTICE2, "%s: jtag3_setparm()\n", progname);
19691937
19701938 sprintf(descr, "set parameter (scope 0x%02x, section %d, parm %d)",
19711939 scope, section, parm);
@@ -1972,7 +1940,7 @@
19721940
19731941 if ((buf = malloc(6 + length)) == NULL)
19741942 {
1975- avrdude_message("%s: jtag3_setparm(): Out of memory\n",
1943+ avrdude_message(MSG_INFO, "%s: jtag3_setparm(): Out of memory\n",
19761944 progname);
19771945 return -1;
19781946 }
@@ -2021,7 +1989,7 @@
20211989
20221990 c = resp[1];
20231991 if (c != RSP3_INFO) {
2024- avrdude_message("%s: jtag3_display(): response is not RSP3_INFO\n",
1992+ avrdude_message(MSG_INFO, "%s: jtag3_display(): response is not RSP3_INFO\n",
20251993 progname);
20261994 free(resp);
20271995 return;
@@ -2029,11 +1997,11 @@
20291997 memmove(resp, resp + 3, status - 3);
20301998 resp[status - 3] = 0;
20311999
2032- avrdude_message("%sICE hardware version: %d\n", p, parms[0]);
2033- avrdude_message("%sICE firmware version: %d.%02d (rel. %d)\n", p,
2000+ avrdude_message(MSG_INFO, "%sICE hardware version: %d\n", p, parms[0]);
2001+ avrdude_message(MSG_INFO, "%sICE firmware version: %d.%02d (rel. %d)\n", p,
20342002 parms[1], parms[2],
20352003 (parms[3] | (parms[4] << 8)));
2036- avrdude_message("%sSerial number : %s\n", p, resp);
2004+ avrdude_message(MSG_INFO, "%sSerial number : %s\n", p, resp);
20372005 free(resp);
20382006
20392007 jtag3_print_parms1(pgm, p);
@@ -2047,27 +2015,27 @@
20472015 if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, buf, 2) < 0)
20482016 return;
20492017
2050- avrdude_message("%sVtarget : %.2f V\n", p,
2018+ avrdude_message(MSG_INFO, "%sVtarget : %.2f V\n", p,
20512019 b2_to_u16(buf) / 1000.0);
20522020
20532021 if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, buf, 2) < 0)
20542022 return;
2055- avrdude_message("%sJTAG clock megaAVR/program: %u kHz\n", p,
2023+ avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/program: %u kHz\n", p,
20562024 b2_to_u16(buf));
20572025
20582026 if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_DEBUG, buf, 2) < 0)
20592027 return;
2060- avrdude_message("%sJTAG clock megaAVR/debug: %u kHz\n", p,
2028+ avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/debug: %u kHz\n", p,
20612029 b2_to_u16(buf));
20622030
20632031 if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_JTAG, buf, 2) < 0)
20642032 return;
2065- avrdude_message("%sJTAG clock Xmega: %u kHz\n", p,
2033+ avrdude_message(MSG_INFO, "%sJTAG clock Xmega: %u kHz\n", p,
20662034 b2_to_u16(buf));
20672035
20682036 if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_PDI, buf, 2) < 0)
20692037 return;
2070- avrdude_message("%sPDI clock Xmega : %u kHz\n", p,
2038+ avrdude_message(MSG_INFO, "%sPDI clock Xmega : %u kHz\n", p,
20712039 b2_to_u16(buf));
20722040 }
20732041
--- trunk/avrdude/jtagmkI.c (revision 1320)
+++ trunk/avrdude/jtagmkI.c (revision 1321)
@@ -111,7 +111,7 @@
111111 static void jtagmkI_setup(PROGRAMMER * pgm)
112112 {
113113 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
114- avrdude_message("%s: jtagmkI_setup(): Out of memory allocating private data\n",
114+ avrdude_message(MSG_INFO, "%s: jtagmkI_setup(): Out of memory allocating private data\n",
115115 progname);
116116 exit(1);
117117 }
@@ -144,10 +144,10 @@
144144 int i;
145145
146146 if (verbose >= 4) {
147- avrdude_message("Raw message:\n");
147+ avrdude_message(MSG_TRACE, "Raw message:\n");
148148
149149 for (i = 0; i < len; i++) {
150- avrdude_message("0x%02x ", data[i]);
150+ avrdude_message(MSG_TRACE, "0x%02x ", data[i]);
151151 if (i % 16 == 15)
152152 putc('\n', stderr);
153153 else
@@ -159,34 +159,34 @@
159159
160160 switch (data[0]) {
161161 case RESP_OK:
162- avrdude_message("OK\n");
162+ avrdude_message(MSG_INFO, "OK\n");
163163 break;
164164
165165 case RESP_FAILED:
166- avrdude_message("FAILED\n");
166+ avrdude_message(MSG_INFO, "FAILED\n");
167167 break;
168168
169169 case RESP_BREAK:
170- avrdude_message("breakpoint hit\n");
170+ avrdude_message(MSG_INFO, "breakpoint hit\n");
171171 break;
172172
173173 case RESP_INFO:
174- avrdude_message("IDR dirty\n");
174+ avrdude_message(MSG_INFO, "IDR dirty\n");
175175 break;
176176
177177 case RESP_SYNC_ERROR:
178- avrdude_message("Synchronization lost\n");
178+ avrdude_message(MSG_INFO, "Synchronization lost\n");
179179 break;
180180
181181 case RESP_SLEEP:
182- avrdude_message("sleep instruction hit\n");
182+ avrdude_message(MSG_INFO, "sleep instruction hit\n");
183183 break;
184184
185185 case RESP_POWER:
186- avrdude_message("target power lost\n");
186+ avrdude_message(MSG_INFO, "target power lost\n");
187187
188188 default:
189- avrdude_message("unknown message 0x%02x\n", data[0]);
189+ avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[0]);
190190 }
191191
192192 putc('\n', stderr);
@@ -197,13 +197,12 @@
197197 {
198198 unsigned char *buf;
199199
200- if (verbose >= 3)
201- avrdude_message("\n%s: jtagmkI_send(): sending %u bytes\n",
200+ avrdude_message(MSG_DEBUG, "\n%s: jtagmkI_send(): sending %u bytes\n",
202201 progname, (unsigned int)len);
203202
204203 if ((buf = malloc(len + 2)) == NULL)
205204 {
206- avrdude_message("%s: jtagmkI_send(): out of memory",
205+ avrdude_message(MSG_INFO, "%s: jtagmkI_send(): out of memory",
207206 progname);
208207 exit(1);
209208 }
@@ -213,7 +212,7 @@
213212 buf[len + 1] = ' '; /* EOP */
214213
215214 if (serial_send(&pgm->fd, buf, len + 2) != 0) {
216- avrdude_message("%s: jtagmkI_send(): failed to send command to serial port\n",
215+ avrdude_message(MSG_INFO, "%s: jtagmkI_send(): failed to send command to serial port\n",
217216 progname);
218217 return -1;
219218 }
@@ -226,7 +225,7 @@
226225 static int jtagmkI_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len)
227226 {
228227 if (serial_recv(&pgm->fd, buf, len) != 0) {
229- avrdude_message("\n%s: jtagmkI_recv(): failed to send command to serial port\n",
228+ avrdude_message(MSG_INFO, "\n%s: jtagmkI_recv(): failed to send command to serial port\n",
230229 progname);
231230 return -1;
232231 }
@@ -252,8 +251,7 @@
252251
253252 serial_recv_timeout = 200;
254253
255- if (verbose >= 3)
256- avrdude_message("%s: jtagmkI_resync()\n", progname);
254+ avrdude_message(MSG_TRACE, "%s: jtagmkI_resync()\n", progname);
257255
258256 jtagmkI_drain(pgm, 0);
259257
@@ -261,19 +259,17 @@
261259
262260 /* Get the sign-on information. */
263261 buf[0] = CMD_GET_SYNC;
264- if (verbose >= 2)
265- avrdude_message("%s: jtagmkI_resync(): Sending sync command: ",
262+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_resync(): Sending sync command: ",
266263 progname);
267264
268265 if (serial_send(&pgm->fd, buf, 1) != 0) {
269- avrdude_message("\n%s: jtagmkI_resync(): failed to send command to serial port\n",
266+ avrdude_message(MSG_INFO, "\n%s: jtagmkI_resync(): failed to send command to serial port\n",
270267 progname);
271268 serial_recv_timeout = otimeout;
272269 return -1;
273270 }
274271 if (serial_recv(&pgm->fd, resp, 1) == 0 && resp[0] == RESP_OK) {
275- if (verbose >= 2)
276- avrdude_message("got RESP_OK\n");
272+ avrdude_message(MSG_NOTICE2, "got RESP_OK\n");
277273 break;
278274 }
279275
@@ -292,26 +288,23 @@
292288 buf[1] = 'E';
293289 buf[2] = ' ';
294290 buf[3] = ' ';
295- if (verbose >= 2)
296- avrdude_message("%s: jtagmkI_resync(): Sending sign-on command: ",
291+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_resync(): Sending sign-on command: ",
297292 progname);
298293
299294 if (serial_send(&pgm->fd, buf, 4) != 0) {
300- avrdude_message("\n%s: jtagmkI_resync(): failed to send command to serial port\n",
295+ avrdude_message(MSG_INFO, "\n%s: jtagmkI_resync(): failed to send command to serial port\n",
301296 progname);
302297 serial_recv_timeout = otimeout;
303298 return -1;
304299 }
305300 if (serial_recv(&pgm->fd, resp, 9) == 0 && resp[0] == RESP_OK) {
306- if (verbose >= 2)
307- avrdude_message("got RESP_OK\n");
301+ avrdude_message(MSG_NOTICE2, "got RESP_OK\n");
308302 break;
309303 }
310304 }
311305 }
312306 if (tries >= maxtries) {
313- if (verbose >= 2)
314- avrdude_message("%s: jtagmkI_resync(): "
307+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_resync(): "
315308 "timeout/error communicating with programmer\n",
316309 progname);
317310 serial_recv_timeout = otimeout;
@@ -333,8 +326,7 @@
333326
334327 jtagmkI_drain(pgm, 0);
335328
336- if (verbose >= 2)
337- avrdude_message("%s: jtagmkI_getsync(): Sending sign-on command: ",
329+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_getsync(): Sending sign-on command: ",
338330 progname);
339331
340332 buf[0] = CMD_GET_SIGNON;
@@ -343,7 +335,7 @@
343335 return -1;
344336 if (verbose >= 2) {
345337 resp[8] = '\0';
346- avrdude_message("got %s\n", resp + 1);
338+ avrdude_message(MSG_NOTICE2, "got %s\n", resp + 1);
347339 }
348340
349341 return 0;
@@ -357,8 +349,7 @@
357349 unsigned char buf[1], resp[2];
358350
359351 buf[0] = CMD_CHIP_ERASE;
360- if (verbose >= 2)
361- avrdude_message("%s: jtagmkI_chip_erase(): Sending chip erase command: ",
352+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_chip_erase(): Sending chip erase command: ",
362353 progname);
363354 jtagmkI_send(pgm, buf, 1);
364355 if (jtagmkI_recv(pgm, resp, 2) < 0)
@@ -366,13 +357,13 @@
366357 if (resp[0] != RESP_OK) {
367358 if (verbose >= 2)
368359 putc('\n', stderr);
369- avrdude_message("%s: jtagmkI_chip_erase(): "
360+ avrdude_message(MSG_INFO, "%s: jtagmkI_chip_erase(): "
370361 "timeout/error communicating with programmer (resp %c)\n",
371362 progname, resp[0]);
372363 return -1;
373364 } else {
374365 if (verbose == 2)
375- avrdude_message("OK\n");
366+ avrdude_message(MSG_NOTICE2, "OK\n");
376367 }
377368
378369 pgm->initialize(pgm, p);
@@ -405,8 +396,7 @@
405396 }
406397 }
407398
408- if (verbose >= 2)
409- avrdude_message("%s: jtagmkI_set_devdescr(): "
399+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_set_devdescr(): "
410400 "Sending set device descriptor command: ",
411401 progname);
412402 jtagmkI_send(pgm, (unsigned char *)&sendbuf, sizeof(sendbuf));
@@ -416,12 +406,12 @@
416406 if (resp[0] != RESP_OK) {
417407 if (verbose >= 2)
418408 putc('\n', stderr);
419- avrdude_message("%s: jtagmkI_set_devdescr(): "
409+ avrdude_message(MSG_INFO, "%s: jtagmkI_set_devdescr(): "
420410 "timeout/error communicating with programmer (resp %c)\n",
421411 progname, resp[0]);
422412 } else {
423413 if (verbose == 2)
424- avrdude_message("OK\n");
414+ avrdude_message(MSG_NOTICE2, "OK\n");
425415 }
426416 }
427417
@@ -433,8 +423,7 @@
433423 unsigned char buf[1], resp[2];
434424
435425 buf[0] = CMD_RESET;
436- if (verbose >= 2)
437- avrdude_message("%s: jtagmkI_reset(): Sending reset command: ",
426+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_reset(): Sending reset command: ",
438427 progname);
439428 jtagmkI_send(pgm, buf, 1);
440429
@@ -443,13 +432,13 @@
443432 if (resp[0] != RESP_OK) {
444433 if (verbose >= 2)
445434 putc('\n', stderr);
446- avrdude_message("%s: jtagmkI_reset(): "
435+ avrdude_message(MSG_INFO, "%s: jtagmkI_reset(): "
447436 "timeout/error communicating with programmer (resp %c)\n",
448437 progname, resp[0]);
449438 return -1;
450439 } else {
451440 if (verbose == 2)
452- avrdude_message("OK\n");
441+ avrdude_message(MSG_NOTICE2, "OK\n");
453442 }
454443
455444 return 0;
@@ -469,8 +458,7 @@
469458 return 0;
470459
471460 buf[0] = CMD_ENTER_PROGMODE;
472- if (verbose >= 2)
473- avrdude_message("%s: jtagmkI_program_enable(): "
461+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_program_enable(): "
474462 "Sending enter progmode command: ",
475463 progname);
476464 jtagmkI_send(pgm, buf, 1);
@@ -480,13 +468,13 @@
480468 if (resp[0] != RESP_OK) {
481469 if (verbose >= 2)
482470 putc('\n', stderr);
483- avrdude_message("%s: jtagmkI_program_enable(): "
471+ avrdude_message(MSG_INFO, "%s: jtagmkI_program_enable(): "
484472 "timeout/error communicating with programmer (resp %c)\n",
485473 progname, resp[0]);
486474 return -1;
487475 } else {
488476 if (verbose == 2)
489- avrdude_message("OK\n");
477+ avrdude_message(MSG_NOTICE2, "OK\n");
490478 }
491479
492480 PDATA(pgm)->prog_enabled = 1;
@@ -503,8 +491,7 @@
503491
504492 if (pgm->fd.ifd != -1) {
505493 buf[0] = CMD_LEAVE_PROGMODE;
506- if (verbose >= 2)
507- avrdude_message("%s: jtagmkI_program_disable(): "
494+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_program_disable(): "
508495 "Sending leave progmode command: ",
509496 progname);
510497 jtagmkI_send(pgm, buf, 1);
@@ -514,13 +501,13 @@
514501 if (resp[0] != RESP_OK) {
515502 if (verbose >= 2)
516503 putc('\n', stderr);
517- avrdude_message("%s: jtagmkI_program_disable(): "
504+ avrdude_message(MSG_INFO, "%s: jtagmkI_program_disable(): "
518505 "timeout/error communicating with programmer (resp %c)\n",
519506 progname, resp[0]);
520507 return -1;
521508 } else {
522509 if (verbose == 2)
523- avrdude_message("OK\n");
510+ avrdude_message(MSG_NOTICE2, "OK\n");
524511 }
525512 }
526513 PDATA(pgm)->prog_enabled = 0;
@@ -549,7 +536,7 @@
549536 unsigned char b;
550537
551538 if (!(p->flags & AVRPART_HAS_JTAG)) {
552- avrdude_message("%s: jtagmkI_initialize(): part %s has no JTAG interface\n",
539+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): part %s has no JTAG interface\n",
553540 progname, p->desc);
554541 return -1;
555542 }
@@ -558,11 +545,10 @@
558545
559546 if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
560547 if ((b = jtagmkI_get_baud(pgm->baudrate)) == 0) {
561- avrdude_message("%s: jtagmkI_initialize(): unsupported baudrate %d\n",
548+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): unsupported baudrate %d\n",
562549 progname, pgm->baudrate);
563550 } else {
564- if (verbose >= 2)
565- avrdude_message("%s: jtagmkI_initialize(): "
551+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_initialize(): "
566552 "trying to set baudrate to %d\n",
567553 progname, pgm->baudrate);
568554 if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
@@ -573,8 +559,7 @@
573559 }
574560
575561 if (pgm->bitclock != 0.0) {
576- if (verbose >= 2)
577- avrdude_message("%s: jtagmkI_initialize(): "
562+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_initialize(): "
578563 "trying to set JTAG clock period to %.1f us\n",
579564 progname, pgm->bitclock);
580565 if (jtagmkI_set_sck_period(pgm, pgm->bitclock) != 0)
@@ -588,12 +573,12 @@
588573 if (resp[0] != RESP_OK) {
589574 if (verbose >= 2)
590575 putc('\n', stderr);
591- avrdude_message("%s: jtagmkI_initialize(): "
576+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): "
592577 "timeout/error communicating with programmer (resp %c)\n",
593578 progname, resp[0]);
594579 } else {
595580 if (verbose == 2)
596- avrdude_message("OK\n");
581+ avrdude_message(MSG_NOTICE2, "OK\n");
597582 }
598583
599584 /*
@@ -608,12 +593,12 @@
608593 free(PDATA(pgm)->flash_pagecache);
609594 free(PDATA(pgm)->eeprom_pagecache);
610595 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
611- avrdude_message("%s: jtagmkI_initialize(): Out of memory\n",
596+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): Out of memory\n",
612597 progname);
613598 return -1;
614599 }
615600 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
616- avrdude_message("%s: jtagmkI_initialize(): Out of memory\n",
601+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): Out of memory\n",
617602 progname);
618603 free(PDATA(pgm)->flash_pagecache);
619604 return -1;
@@ -627,7 +612,7 @@
627612 if (jtagmkI_read_byte(pgm, p, &hfuse, 1, &b) < 0)
628613 return -1;
629614 if ((b & OCDEN) != 0)
630- avrdude_message("%s: jtagmkI_initialize(): warning: OCDEN fuse not programmed, "
615+ avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): warning: OCDEN fuse not programmed, "
631616 "single-byte EEPROM updates not possible\n",
632617 progname);
633618
@@ -656,8 +641,7 @@
656641 {
657642 size_t i;
658643
659- if (verbose >= 2)
660- avrdude_message("%s: jtagmkI_open()\n", progname);
644+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_open()\n", progname);
661645
662646 strcpy(pgm->port, port);
663647 PDATA(pgm)->initial_baudrate = -1L;
@@ -665,8 +649,7 @@
665649 for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) {
666650 union pinfo pinfo;
667651 pinfo.baud = baudtab[i].baud;
668- if (verbose >= 2)
669- avrdude_message("%s: jtagmkI_open(): trying to sync at baud rate %ld:\n",
652+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_open(): trying to sync at baud rate %ld:\n",
670653 progname, pinfo.baud);
671654 if (serial_open(port, pinfo, &pgm->fd)==-1) {
672655 return -1;
@@ -679,8 +662,7 @@
679662
680663 if (jtagmkI_getsync(pgm) == 0) {
681664 PDATA(pgm)->initial_baudrate = baudtab[i].baud;
682- if (verbose >= 2)
683- avrdude_message("%s: jtagmkI_open(): succeeded\n", progname);
665+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_open(): succeeded\n", progname);
684666 return 0;
685667 }
686668
@@ -687,7 +669,7 @@
687669 serial_close(&pgm->fd);
688670 }
689671
690- avrdude_message("%s: jtagmkI_open(): failed to synchronize to ICE\n",
672+ avrdude_message(MSG_INFO, "%s: jtagmkI_open(): failed to synchronize to ICE\n",
691673 progname);
692674 pgm->fd.ifd = -1;
693675
@@ -699,8 +681,7 @@
699681 {
700682 unsigned char b;
701683
702- if (verbose >= 2)
703- avrdude_message("%s: jtagmkI_close()\n", progname);
684+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_close()\n", progname);
704685
705686 /*
706687 * Revert baud rate to what it used to be when we started. This
@@ -709,11 +690,10 @@
709690 */
710691 if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
711692 if ((b = jtagmkI_get_baud(PDATA(pgm)->initial_baudrate)) == 0) {
712- avrdude_message("%s: jtagmkI_close(): unsupported baudrate %d\n",
693+ avrdude_message(MSG_INFO, "%s: jtagmkI_close(): unsupported baudrate %d\n",
713694 progname, PDATA(pgm)->initial_baudrate);
714695 } else {
715- if (verbose >= 2)
716- avrdude_message("%s: jtagmkI_close(): "
696+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_close(): "
717697 "trying to set baudrate to %d\n",
718698 progname, PDATA(pgm)->initial_baudrate);
719699 if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
@@ -742,8 +722,7 @@
742722 long otimeout = serial_recv_timeout;
743723 #define MAXTRIES 3
744724
745- if (verbose >= 2)
746- avrdude_message("%s: jtagmkI_paged_write(.., %s, %d, %d)\n",
725+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_paged_write(.., %s, %d, %d)\n",
747726 progname, m->desc, page_size, n_bytes);
748727
749728 if (jtagmkI_program_enable(pgm) < 0)
@@ -752,13 +731,13 @@
752731 if (page_size == 0) page_size = 256;
753732
754733 if (page_size > 256) {
755- avrdude_message("%s: jtagmkI_paged_write(): page size %d too large\n",
734+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): page size %d too large\n",
756735 progname, page_size);
757736 return -1;
758737 }
759738
760739 if ((datacmd = malloc(page_size + 1)) == NULL) {
761- avrdude_message("%s: jtagmkI_paged_write(): Out of memory\n",
740+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): Out of memory\n",
762741 progname);
763742 return -1;
764743 }
@@ -782,7 +761,7 @@
782761 again:
783762
784763 if (tries != 0 && jtagmkI_resync(pgm, 2000, 0) < 0) {
785- avrdude_message("%s: jtagmkI_paged_write(): sync loss, retries exhausted\n",
764+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): sync loss, retries exhausted\n",
786765 progname);
787766 return -1;
788767 }
@@ -791,8 +770,7 @@
791770 block_size = n_bytes - addr;
792771 else
793772 block_size = page_size;
794- if (verbose >= 3)
795- avrdude_message("%s: jtagmkI_paged_write(): "
773+ avrdude_message(MSG_DEBUG, "%s: jtagmkI_paged_write(): "
796774 "block_size at addr %d is %d\n",
797775 progname, addr, block_size);
798776
@@ -806,8 +784,7 @@
806784 u32_to_b3(cmd + 3, addr);
807785 }
808786
809- if (verbose >= 2)
810- avrdude_message("%s: jtagmkI_paged_write(): "
787+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_paged_write(): "
811788 "Sending write memory command: ",
812789 progname);
813790
@@ -818,7 +795,7 @@
818795 if (resp[0] != RESP_OK) {
819796 if (verbose >= 2)
820797 putc('\n', stderr);
821- avrdude_message("%s: jtagmkI_paged_write(): "
798+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): "
822799 "timeout/error communicating with programmer (resp %c)\n",
823800 progname, resp[0]);
824801 if (tries++ < MAXTRIES)
@@ -827,7 +804,7 @@
827804 return -1;
828805 } else {
829806 if (verbose == 2)
830- avrdude_message("OK\n");
807+ avrdude_message(MSG_NOTICE2, "OK\n");
831808 }
832809
833810 /*
@@ -847,7 +824,7 @@
847824 if (resp[1] != RESP_OK) {
848825 if (verbose >= 2)
849826 putc('\n', stderr);
850- avrdude_message("%s: jtagmkI_paged_write(): "
827+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): "
851828 "timeout/error communicating with programmer (resp %c)\n",
852829 progname, resp[0]);
853830 if (tries++ < MAXTRIES)
@@ -856,7 +833,7 @@
856833 return -1;
857834 } else {
858835 if (verbose == 2)
859- avrdude_message("OK\n");
836+ avrdude_message(MSG_NOTICE2, "OK\n");
860837 }
861838 }
862839
@@ -877,8 +854,7 @@
877854 long otimeout = serial_recv_timeout;
878855 #define MAXTRIES 3
879856
880- if (verbose >= 2)
881- avrdude_message("%s: jtagmkI_paged_load(.., %s, %d, %d)\n",
857+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_paged_load(.., %s, %d, %d)\n",
882858 progname, m->desc, page_size, n_bytes);
883859
884860 if (jtagmkI_program_enable(pgm) < 0)
@@ -895,7 +871,7 @@
895871 }
896872
897873 if (page_size > (is_flash? 512: 256)) {
898- avrdude_message("%s: jtagmkI_paged_load(): page size %d too large\n",
874+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_load(): page size %d too large\n",
899875 progname, page_size);
900876 return -1;
901877 }
@@ -905,7 +881,7 @@
905881 tries = 0;
906882 again:
907883 if (tries != 0 && jtagmkI_resync(pgm, 2000, 0) < 0) {
908- avrdude_message("%s: jtagmkI_paged_load(): sync loss, retries exhausted\n",
884+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_load(): sync loss, retries exhausted\n",
909885 progname);
910886 return -1;
911887 }
@@ -914,8 +890,7 @@
914890 block_size = n_bytes - addr;
915891 else
916892 block_size = page_size;
917- if (verbose >= 3)
918- avrdude_message("%s: jtagmkI_paged_load(): "
893+ avrdude_message(MSG_DEBUG, "%s: jtagmkI_paged_load(): "
919894 "block_size at addr %d is %d\n",
920895 progname, addr, block_size);
921896
@@ -929,8 +904,7 @@
929904 u32_to_b3(cmd + 3, addr);
930905 }
931906
932- if (verbose >= 2)
933- avrdude_message("%s: jtagmkI_paged_load(): Sending read memory command: ",
907+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_paged_load(): Sending read memory command: ",
934908 progname);
935909
936910 jtagmkI_send(pgm, cmd, 6);
@@ -940,7 +914,7 @@
940914 if (resp[read_size + 3 - 1] != RESP_OK) {
941915 if (verbose >= 2)
942916 putc('\n', stderr);
943- avrdude_message("%s: jtagmkI_paged_load(): "
917+ avrdude_message(MSG_INFO, "%s: jtagmkI_paged_load(): "
944918 "timeout/error communicating with programmer (resp %c)\n",
945919 progname, resp[read_size + 3 - 1]);
946920 if (tries++ < MAXTRIES)
@@ -950,7 +924,7 @@
950924 return -1;
951925 } else {
952926 if (verbose == 2)
953- avrdude_message("OK\n");
927+ avrdude_message(MSG_NOTICE2, "OK\n");
954928 }
955929
956930 memcpy(m->buf + addr, resp + 1, block_size);
@@ -971,8 +945,7 @@
971945 int respsize = 3 + 1;
972946 int is_flash = 0;
973947
974- if (verbose >= 2)
975- avrdude_message("%s: jtagmkI_read_byte(.., %s, 0x%lx, ...)\n",
948+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_read_byte(.., %s, 0x%lx, ...)\n",
976949 progname, mem->desc, addr);
977950
978951 if (jtagmkI_program_enable(pgm) < 0)
@@ -1056,13 +1029,13 @@
10561029 if (resp[respsize - 1] != RESP_OK) {
10571030 if (verbose >= 2)
10581031 putc('\n', stderr);
1059- avrdude_message("%s: jtagmkI_read_byte(): "
1032+ avrdude_message(MSG_INFO, "%s: jtagmkI_read_byte(): "
10601033 "timeout/error communicating with programmer (resp %c)\n",
10611034 progname, resp[respsize - 1]);
10621035 return -1;
10631036 } else {
10641037 if (verbose == 2)
1065- avrdude_message("OK\n");
1038+ avrdude_message(MSG_NOTICE2, "OK\n");
10661039 }
10671040
10681041 if (pagesize) {
@@ -1085,8 +1058,7 @@
10851058 unsigned char resp[1], writedata;
10861059 int len, need_progmode = 1;
10871060
1088- if (verbose >= 2)
1089- avrdude_message("%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n",
1061+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n",
10901062 progname, mem->desc, addr);
10911063
10921064 writedata = data;
@@ -1141,13 +1113,13 @@
11411113 if (resp[0] != RESP_OK) {
11421114 if (verbose >= 2)
11431115 putc('\n', stderr);
1144- avrdude_message("%s: jtagmkI_write_byte(): "
1116+ avrdude_message(MSG_INFO, "%s: jtagmkI_write_byte(): "
11451117 "timeout/error communicating with programmer (resp %c)\n",
11461118 progname, resp[0]);
11471119 return -1;
11481120 } else {
11491121 if (verbose == 2)
1150- avrdude_message("OK\n");
1122+ avrdude_message(MSG_NOTICE2, "OK\n");
11511123 }
11521124
11531125 /* Now, send the data buffer. */
@@ -1171,13 +1143,13 @@
11711143 if (resp[0] != RESP_OK) {
11721144 if (verbose >= 2)
11731145 putc('\n', stderr);
1174- avrdude_message("%s: jtagmkI_write_byte(): "
1146+ avrdude_message(MSG_INFO, "%s: jtagmkI_write_byte(): "
11751147 "timeout/error communicating with programmer (resp %c)\n",
11761148 progname, resp[0]);
11771149 return -1;
11781150 } else {
11791151 if (verbose == 2)
1180- avrdude_message("OK\n");
1152+ avrdude_message(MSG_NOTICE2, "OK\n");
11811153 }
11821154
11831155 return 0;
@@ -1221,13 +1193,12 @@
12211193 {
12221194 unsigned char buf[2], resp[3];
12231195
1224- if (verbose >= 2)
1225- avrdude_message("%s: jtagmkI_getparm()\n", progname);
1196+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_getparm()\n", progname);
12261197
12271198 buf[0] = CMD_GET_PARAM;
12281199 buf[1] = parm;
12291200 if (verbose >= 2)
1230- avrdude_message("%s: jtagmkI_getparm(): "
1201+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_getparm(): "
12311202 "Sending get parameter command (parm 0x%02x): ",
12321203 progname, parm);
12331204 jtagmkI_send(pgm, buf, 2);
@@ -1237,7 +1208,7 @@
12371208 if (resp[0] != RESP_OK) {
12381209 if (verbose >= 2)
12391210 putc('\n', stderr);
1240- avrdude_message("%s: jtagmkI_getparm(): "
1211+ avrdude_message(MSG_INFO, "%s: jtagmkI_getparm(): "
12411212 "timeout/error communicating with programmer (resp %c)\n",
12421213 progname, resp[0]);
12431214 return -1;
@@ -1244,13 +1215,13 @@
12441215 } else if (resp[2] != RESP_OK) {
12451216 if (verbose >= 2)
12461217 putc('\n', stderr);
1247- avrdude_message("%s: jtagmkI_getparm(): "
1218+ avrdude_message(MSG_INFO, "%s: jtagmkI_getparm(): "
12481219 "unknown parameter 0x%02x\n",
12491220 progname, parm);
12501221 return -1;
12511222 } else {
12521223 if (verbose == 2)
1253- avrdude_message("OK, value 0x%02x\n", resp[1]);
1224+ avrdude_message(MSG_NOTICE2, "OK, value 0x%02x\n", resp[1]);
12541225 }
12551226
12561227 *value = resp[1];
@@ -1266,14 +1237,12 @@
12661237 {
12671238 unsigned char buf[3], resp[2];
12681239
1269- if (verbose >= 2)
1270- avrdude_message("%s: jtagmkI_setparm()\n", progname);
1240+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_setparm()\n", progname);
12711241
12721242 buf[0] = CMD_SET_PARAM;
12731243 buf[1] = parm;
12741244 buf[2] = value;
1275- if (verbose >= 2)
1276- avrdude_message("%s: jtagmkI_setparm(): "
1245+ avrdude_message(MSG_NOTICE2, "%s: jtagmkI_setparm(): "
12771246 "Sending set parameter command (parm 0x%02x): ",
12781247 progname, parm);
12791248 jtagmkI_send(pgm, buf, 3);
@@ -1282,13 +1251,13 @@
12821251 if (resp[0] != RESP_OK) {
12831252 if (verbose >= 2)
12841253 putc('\n', stderr);
1285- avrdude_message("%s: jtagmkI_setparm(): "
1254+ avrdude_message(MSG_INFO, "%s: jtagmkI_setparm(): "
12861255 "timeout/error communicating with programmer (resp %c)\n",
12871256 progname, resp[0]);
12881257 return -1;
12891258 } else {
12901259 if (verbose == 2)
1291- avrdude_message("OK\n");
1260+ avrdude_message(MSG_NOTICE2, "OK\n");
12921261 }
12931262
12941263 return 0;
@@ -1304,8 +1273,8 @@
13041273 jtagmkI_getparm(pgm, PARM_SW_VERSION, &fw) < 0)
13051274 return;
13061275
1307- avrdude_message("%sICE hardware version: 0x%02x\n", p, hw);
1308- avrdude_message("%sICE firmware version: 0x%02x\n", p, fw);
1276+ avrdude_message(MSG_INFO, "%sICE hardware version: 0x%02x\n", p, hw);
1277+ avrdude_message(MSG_INFO, "%sICE firmware version: 0x%02x\n", p, fw);
13091278
13101279 jtagmkI_print_parms1(pgm, p);
13111280
@@ -1349,9 +1318,9 @@
13491318 clk = 1e6;
13501319 }
13511320
1352- avrdude_message("%sVtarget : %.1f V\n", p,
1321+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
13531322 6.25 * (unsigned)vtarget / 255.0);
1354- avrdude_message("%sJTAG clock : %s (%.1f us)\n", p, clkstr,
1323+ avrdude_message(MSG_INFO, "%sJTAG clock : %s (%.1f us)\n", p, clkstr,
13551324 1.0e6 / clk);
13561325
13571326 return;
--- trunk/avrdude/jtagmkII.c (revision 1320)
+++ trunk/avrdude/jtagmkII.c (revision 1321)
@@ -176,7 +176,7 @@
176176 void jtagmkII_setup(PROGRAMMER * pgm)
177177 {
178178 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
179- avrdude_message("%s: jtagmkII_setup(): Out of memory allocating private data\n",
179+ avrdude_message(MSG_INFO, "%s: jtagmkII_setup(): Out of memory allocating private data\n",
180180 progname);
181181 exit(1);
182182 }
@@ -269,7 +269,7 @@
269269 return;
270270
271271 for (i = 0; i < s - 1; i++) {
272- avrdude_message("0x%02x ", b[i + 1]);
272+ avrdude_message(MSG_INFO, "0x%02x ", b[i + 1]);
273273 if (i % 16 == 15)
274274 putc('\n', stderr);
275275 else
@@ -284,10 +284,10 @@
284284 int i;
285285
286286 if (verbose >= 4) {
287- avrdude_message("Raw message:\n");
287+ avrdude_message(MSG_TRACE, "Raw message:\n");
288288
289289 for (i = 0; i < len; i++) {
290- avrdude_message("0x%02x", data[i]);
290+ avrdude_message(MSG_TRACE, "0x%02x", data[i]);
291291 if (i % 16 == 15)
292292 putc('\n', stderr);
293293 else
@@ -299,114 +299,114 @@
299299
300300 switch (data[0]) {
301301 case RSP_OK:
302- avrdude_message("OK\n");
302+ avrdude_message(MSG_INFO, "OK\n");
303303 break;
304304
305305 case RSP_FAILED:
306- avrdude_message("FAILED\n");
306+ avrdude_message(MSG_INFO, "FAILED\n");
307307 break;
308308
309309 case RSP_ILLEGAL_BREAKPOINT:
310- avrdude_message("Illegal breakpoint\n");
310+ avrdude_message(MSG_INFO, "Illegal breakpoint\n");
311311 break;
312312
313313 case RSP_ILLEGAL_COMMAND:
314- avrdude_message("Illegal command\n");
314+ avrdude_message(MSG_INFO, "Illegal command\n");
315315 break;
316316
317317 case RSP_ILLEGAL_EMULATOR_MODE:
318- avrdude_message("Illegal emulator mode");
318+ avrdude_message(MSG_INFO, "Illegal emulator mode");
319319 if (len > 1)
320320 switch (data[1]) {
321- case EMULATOR_MODE_DEBUGWIRE: avrdude_message(": DebugWire"); break;
322- case EMULATOR_MODE_JTAG: avrdude_message(": JTAG"); break;
323- case EMULATOR_MODE_HV: avrdude_message(": HVSP/PP"); break;
324- case EMULATOR_MODE_SPI: avrdude_message(": SPI"); break;
325- case EMULATOR_MODE_JTAG_XMEGA: avrdude_message(": JTAG/Xmega"); break;
321+ case EMULATOR_MODE_DEBUGWIRE: avrdude_message(MSG_INFO, ": DebugWire"); break;
322+ case EMULATOR_MODE_JTAG: avrdude_message(MSG_INFO, ": JTAG"); break;
323+ case EMULATOR_MODE_HV: avrdude_message(MSG_INFO, ": HVSP/PP"); break;
324+ case EMULATOR_MODE_SPI: avrdude_message(MSG_INFO, ": SPI"); break;
325+ case EMULATOR_MODE_JTAG_XMEGA: avrdude_message(MSG_INFO, ": JTAG/Xmega"); break;
326326 }
327327 putc('\n', stderr);
328328 break;
329329
330330 case RSP_ILLEGAL_JTAG_ID:
331- avrdude_message("Illegal JTAG ID\n");
331+ avrdude_message(MSG_INFO, "Illegal JTAG ID\n");
332332 break;
333333
334334 case RSP_ILLEGAL_MCU_STATE:
335- avrdude_message("Illegal MCU state");
335+ avrdude_message(MSG_INFO, "Illegal MCU state");
336336 if (len > 1)
337337 switch (data[1]) {
338- case STOPPED: avrdude_message(": Stopped"); break;
339- case RUNNING: avrdude_message(": Running"); break;
340- case PROGRAMMING: avrdude_message(": Programming"); break;
338+ case STOPPED: avrdude_message(MSG_INFO, ": Stopped"); break;
339+ case RUNNING: avrdude_message(MSG_INFO, ": Running"); break;
340+ case PROGRAMMING: avrdude_message(MSG_INFO, ": Programming"); break;
341341 }
342342 putc('\n', stderr);
343343 break;
344344
345345 case RSP_ILLEGAL_MEMORY_TYPE:
346- avrdude_message("Illegal memory type\n");
346+ avrdude_message(MSG_INFO, "Illegal memory type\n");
347347 break;
348348
349349 case RSP_ILLEGAL_MEMORY_RANGE:
350- avrdude_message("Illegal memory range\n");
350+ avrdude_message(MSG_INFO, "Illegal memory range\n");
351351 break;
352352
353353 case RSP_ILLEGAL_PARAMETER:
354- avrdude_message("Illegal parameter\n");
354+ avrdude_message(MSG_INFO, "Illegal parameter\n");
355355 break;
356356
357357 case RSP_ILLEGAL_POWER_STATE:
358- avrdude_message("Illegal power state\n");
358+ avrdude_message(MSG_INFO, "Illegal power state\n");
359359 break;
360360
361361 case RSP_ILLEGAL_VALUE:
362- avrdude_message("Illegal value\n");
362+ avrdude_message(MSG_INFO, "Illegal value\n");
363363 break;
364364
365365 case RSP_NO_TARGET_POWER:
366- avrdude_message("No target power\n");
366+ avrdude_message(MSG_INFO, "No target power\n");
367367 break;
368368
369369 case RSP_SIGN_ON:
370- avrdude_message("Sign-on succeeded\n");
370+ avrdude_message(MSG_INFO, "Sign-on succeeded\n");
371371 /* Sign-on data will be printed below anyway. */
372372 break;
373373
374374 case RSP_MEMORY:
375- avrdude_message("memory contents:\n");
375+ avrdude_message(MSG_INFO, "memory contents:\n");
376376 jtagmkII_print_memory(data, len);
377377 break;
378378
379379 case RSP_PARAMETER:
380- avrdude_message("parameter values:\n");
380+ avrdude_message(MSG_INFO, "parameter values:\n");
381381 jtagmkII_print_memory(data, len);
382382 break;
383383
384384 case RSP_SPI_DATA:
385- avrdude_message("SPI data returned:\n");
385+ avrdude_message(MSG_INFO, "SPI data returned:\n");
386386 for (i = 1; i < len; i++)
387- avrdude_message("0x%02x ", data[i]);
387+ avrdude_message(MSG_INFO, "0x%02x ", data[i]);
388388 putc('\n', stderr);
389389 break;
390390
391391 case EVT_BREAK:
392- avrdude_message("BREAK event");
392+ avrdude_message(MSG_INFO, "BREAK event");
393393 if (len >= 6) {
394- avrdude_message(", PC = 0x%lx, reason ", b4_to_u32(data + 1));
394+ avrdude_message(MSG_INFO, ", PC = 0x%lx, reason ", b4_to_u32(data + 1));
395395 switch (data[5]) {
396396 case 0x00:
397- avrdude_message("unspecified");
397+ avrdude_message(MSG_INFO, "unspecified");
398398 break;
399399 case 0x01:
400- avrdude_message("program break");
400+ avrdude_message(MSG_INFO, "program break");
401401 break;
402402 case 0x02:
403- avrdude_message("data break PDSB");
403+ avrdude_message(MSG_INFO, "data break PDSB");
404404 break;
405405 case 0x03:
406- avrdude_message("data break PDMSB");
406+ avrdude_message(MSG_INFO, "data break PDMSB");
407407 break;
408408 default:
409- avrdude_message("unknown: 0x%02x", data[5]);
409+ avrdude_message(MSG_INFO, "unknown: 0x%02x", data[5]);
410410 }
411411 }
412412 putc('\n', stderr);
@@ -413,7 +413,7 @@
413413 break;
414414
415415 default:
416- avrdude_message("unknown message 0x%02x\n", data[0]);
416+ avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[0]);
417417 }
418418
419419 putc('\n', stderr);
@@ -424,13 +424,12 @@
424424 {
425425 unsigned char *buf;
426426
427- if (verbose >= 3)
428- avrdude_message("\n%s: jtagmkII_send(): sending %lu bytes\n",
427+ avrdude_message(MSG_DEBUG, "\n%s: jtagmkII_send(): sending %lu bytes\n",
429428 progname, (unsigned long)len);
430429
431430 if ((buf = malloc(len + 10)) == NULL)
432431 {
433- avrdude_message("%s: jtagmkII_send(): out of memory",
432+ avrdude_message(MSG_INFO, "%s: jtagmkII_send(): out of memory",
434433 progname);
435434 return -1;
436435 }
@@ -444,7 +443,7 @@
444443 crcappend(buf, len + 8);
445444
446445 if (serial_send(&pgm->fd, buf, len + 10) != 0) {
447- avrdude_message("%s: jtagmkII_send(): failed to send command to serial port\n",
446+ avrdude_message(MSG_INFO, "%s: jtagmkII_send(): failed to send command to serial port\n",
448447 progname);
449448 return -1;
450449 }
@@ -494,8 +493,7 @@
494493 double timeoutval = 100; /* seconds */
495494 double tstart, tnow;
496495
497- if (verbose >= 4)
498- avrdude_message("%s: jtagmkII_recv():\n", progname);
496+ avrdude_message(MSG_TRACE, "%s: jtagmkII_recv():\n", progname);
499497
500498 gettimeofday(&tv, NULL);
501499 tstart = tv.tv_sec;
@@ -513,8 +511,7 @@
513511 if (rv != 0) {
514512 timedout:
515513 /* timeout in receive */
516- if (verbose > 1)
517- avrdude_message("%s: jtagmkII_recv(): Timeout receiving packet\n",
514+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_recv(): Timeout receiving packet\n",
518515 progname);
519516 free(buf);
520517 return -1;
@@ -554,13 +551,13 @@
554551 if (c == TOKEN) {
555552 state = sDATA;
556553 if (msglen > MAX_MESSAGE) {
557- avrdude_message("%s: jtagmkII_recv(): msglen %lu exceeds max message "
554+ avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): msglen %lu exceeds max message "
558555 "size %u, ignoring message\n",
559556 progname, msglen, MAX_MESSAGE);
560557 state = sSTART;
561558 headeridx = 0;
562559 } else if ((buf = malloc(msglen + 10)) == NULL) {
563- avrdude_message("%s: jtagmkII_recv(): out of memory\n",
560+ avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): out of memory\n",
564561 progname);
565562 ignorpkt++;
566563 } else {
@@ -582,11 +579,11 @@
582579 if (state == sCSUM2) {
583580 if (crcverify(buf, msglen + 10)) {
584581 if (verbose >= 9)
585- avrdude_message("%s: jtagmkII_recv(): CRC OK",
582+ avrdude_message(MSG_TRACE2, "%s: jtagmkII_recv(): CRC OK",
586583 progname);
587584 state = sDONE;
588585 } else {
589- avrdude_message("%s: jtagmkII_recv(): checksum error\n",
586+ avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): checksum error\n",
590587 progname);
591588 free(buf);
592589 return -4;
@@ -595,7 +592,7 @@
595592 state++;
596593 break;
597594 default:
598- avrdude_message("%s: jtagmkII_recv(): unknown state\n",
595+ avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): unknown state\n",
599596 progname);
600597 free(buf);
601598 return -5;
@@ -604,14 +601,13 @@
604601 gettimeofday(&tv, NULL);
605602 tnow = tv.tv_sec;
606603 if (tnow - tstart > timeoutval) {
607- avrdude_message("%s: jtagmkII_recv_frame(): timeout\n",
604+ avrdude_message(MSG_INFO, "%s: jtagmkII_recv_frame(): timeout\n",
608605 progname);
609606 return -1;
610607 }
611608
612609 }
613- if (verbose >= 3)
614- avrdude_message("\n");
610+ avrdude_message(MSG_DEBUG, "\n");
615611
616612 *seqno = r_seqno;
617613 *msg = buf;
@@ -626,8 +622,7 @@
626622 for (;;) {
627623 if ((rv = jtagmkII_recv_frame(pgm, msg, &r_seqno)) <= 0)
628624 return rv;
629- if (verbose >= 3)
630- avrdude_message("%s: jtagmkII_recv(): "
625+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_recv(): "
631626 "Got message seqno %d (command_sequence == %d)\n",
632627 progname, r_seqno, PDATA(pgm)->command_sequence);
633628 if (r_seqno == PDATA(pgm)->command_sequence) {
@@ -644,32 +639,30 @@
644639 {
645640 int i = rv;
646641 unsigned char *p = *msg;
647- avrdude_message("%s: Recv: ", progname);
642+ avrdude_message(MSG_TRACE, "%s: Recv: ", progname);
648643
649644 while (i) {
650645 unsigned char c = *p;
651646 if (isprint(c)) {
652- avrdude_message("%c ", c);
647+ avrdude_message(MSG_TRACE, "%c ", c);
653648 }
654649 else {
655- avrdude_message(". ");
650+ avrdude_message(MSG_TRACE, ". ");
656651 }
657- avrdude_message("[%02x] ", c);
652+ avrdude_message(MSG_TRACE, "[%02x] ", c);
658653
659654 p++;
660655 i--;
661656 }
662- avrdude_message("\n");
657+ avrdude_message(MSG_TRACE, "\n");
663658 }
664659 return rv;
665660 }
666661 if (r_seqno == 0xffff) {
667- if (verbose >= 3)
668- avrdude_message("%s: jtagmkII_recv(): got asynchronous event\n",
662+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_recv(): got asynchronous event\n",
669663 progname);
670664 } else {
671- if (verbose >= 2)
672- avrdude_message("%s: jtagmkII_recv(): "
665+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_recv(): "
673666 "got wrong sequence number, %u != %u\n",
674667 progname, r_seqno, PDATA(pgm)->command_sequence);
675668 }
@@ -686,8 +679,7 @@
686679 unsigned int fwver, hwver;
687680 int is_dragon;
688681
689- if (verbose >= 3)
690- avrdude_message("%s: jtagmkII_getsync()\n", progname);
682+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_getsync()\n", progname);
691683
692684 if (strncmp(pgm->type, "JTAG", strlen("JTAG")) == 0) {
693685 is_dragon = 0;
@@ -694,7 +686,7 @@
694686 } else if (strncmp(pgm->type, "DRAGON", strlen("DRAGON")) == 0) {
695687 is_dragon = 1;
696688 } else {
697- avrdude_message("%s: Programmer is neither JTAG ICE mkII nor AVR Dragon\n",
689+ avrdude_message(MSG_INFO, "%s: Programmer is neither JTAG ICE mkII nor AVR Dragon\n",
698690 progname);
699691 return -1;
700692 }
@@ -702,14 +694,13 @@
702694
703695 /* Get the sign-on information. */
704696 buf[0] = CMND_GET_SIGN_ON;
705- if (verbose >= 2)
706- avrdude_message("%s: jtagmkII_getsync(): Sending sign-on command: ",
697+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getsync(): Sending sign-on command: ",
707698 progname);
708699 jtagmkII_send(pgm, buf, 1);
709700
710701 status = jtagmkII_recv(pgm, &resp);
711702 if (status <= 0) {
712- avrdude_message("%s: jtagmkII_getsync(): sign-on command: "
703+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): sign-on command: "
713704 "status %d\n",
714705 progname, status);
715706 } else if (verbose >= 3) {
@@ -716,7 +707,7 @@
716707 putc('\n', stderr);
717708 jtagmkII_prmsg(pgm, resp, status);
718709 } else if (verbose == 2)
719- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
710+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
720711
721712 if (status > 0) {
722713 if ((c = resp[0]) == RSP_SIGN_ON) {
@@ -724,29 +715,29 @@
724715 PDATA(pgm)->fwver = fwver;
725716 hwver = (unsigned)resp[9];
726717 memcpy(PDATA(pgm)->serno, resp + 10, 6);
727- if (verbose >= 1 && status > 17) {
728- avrdude_message("JTAG ICE mkII sign-on message:\n");
729- avrdude_message("Communications protocol version: %u\n",
718+ if (status > 17) {
719+ avrdude_message(MSG_NOTICE, "JTAG ICE mkII sign-on message:\n");
720+ avrdude_message(MSG_NOTICE, "Communications protocol version: %u\n",
730721 (unsigned)resp[1]);
731- avrdude_message("M_MCU:\n");
732- avrdude_message(" boot-loader FW version: %u\n",
722+ avrdude_message(MSG_NOTICE, "M_MCU:\n");
723+ avrdude_message(MSG_NOTICE, " boot-loader FW version: %u\n",
733724 (unsigned)resp[2]);
734- avrdude_message(" firmware version: %u.%02u\n",
725+ avrdude_message(MSG_NOTICE, " firmware version: %u.%02u\n",
735726 (unsigned)resp[4], (unsigned)resp[3]);
736- avrdude_message(" hardware version: %u\n",
727+ avrdude_message(MSG_NOTICE, " hardware version: %u\n",
737728 (unsigned)resp[5]);
738- avrdude_message("S_MCU:\n");
739- avrdude_message(" boot-loader FW version: %u\n",
729+ avrdude_message(MSG_NOTICE, "S_MCU:\n");
730+ avrdude_message(MSG_NOTICE, " boot-loader FW version: %u\n",
740731 (unsigned)resp[6]);
741- avrdude_message(" firmware version: %u.%02u\n",
732+ avrdude_message(MSG_NOTICE, " firmware version: %u.%02u\n",
742733 (unsigned)resp[8], (unsigned)resp[7]);
743- avrdude_message(" hardware version: %u\n",
734+ avrdude_message(MSG_NOTICE, " hardware version: %u\n",
744735 (unsigned)resp[9]);
745- avrdude_message("Serial number: "
736+ avrdude_message(MSG_NOTICE, "Serial number: "
746737 "%02x:%02x:%02x:%02x:%02x:%02x\n",
747738 PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]);
748739 resp[status - 1] = '\0';
749- avrdude_message("Device ID: %s\n",
740+ avrdude_message(MSG_NOTICE, "Device ID: %s\n",
750741 resp + 16);
751742 }
752743 break;
@@ -756,11 +747,11 @@
756747 }
757748 if (tries >= MAXTRIES) {
758749 if (status <= 0)
759- avrdude_message("%s: jtagmkII_getsync(): "
750+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
760751 "timeout/error communicating with programmer (status %d)\n",
761752 progname, status);
762753 else
763- avrdude_message("%s: jtagmkII_getsync(): "
754+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
764755 "bad response to sign-on command: %s\n",
765756 progname, jtagmkII_get_rc(c));
766757 return -1;
@@ -775,19 +766,19 @@
775766 #define FWVER(maj, min) ((maj << 8) | (min))
776767 if (!is_dragon && fwver < FWVER(3, 16)) {
777768 PDATA(pgm)->device_descriptor_length -= 2;
778- avrdude_message("%s: jtagmkII_getsync(): "
769+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
779770 "S_MCU firmware version might be too old to work correctly\n",
780771 progname);
781772 } else if (!is_dragon && fwver < FWVER(4, 0)) {
782773 PDATA(pgm)->device_descriptor_length -= 2;
783774 }
784- if (verbose >= 2 && mode != EMULATOR_MODE_SPI)
785- avrdude_message("%s: jtagmkII_getsync(): Using a %u-byte device descriptor\n",
775+ if (mode != EMULATOR_MODE_SPI)
776+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getsync(): Using a %u-byte device descriptor\n",
786777 progname, (unsigned)PDATA(pgm)->device_descriptor_length);
787778 if (mode == EMULATOR_MODE_SPI) {
788779 PDATA(pgm)->device_descriptor_length = 0;
789780 if (!is_dragon && fwver < FWVER(4, 14)) {
790- avrdude_message("%s: jtagmkII_getsync(): ISP functionality requires firmware "
781+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): ISP functionality requires firmware "
791782 "version >= 4.14\n",
792783 progname);
793784 return -1;
@@ -795,19 +786,19 @@
795786 }
796787 if (mode == EMULATOR_MODE_PDI || mode == EMULATOR_MODE_JTAG_XMEGA) {
797788 if (!is_dragon && mode == EMULATOR_MODE_PDI && hwver < 1) {
798- avrdude_message("%s: jtagmkII_getsync(): Xmega PDI support requires hardware "
789+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): Xmega PDI support requires hardware "
799790 "revision >= 1\n",
800791 progname);
801792 return -1;
802793 }
803794 if (!is_dragon && fwver < FWVER(5, 37)) {
804- avrdude_message("%s: jtagmkII_getsync(): Xmega support requires firmware "
795+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): Xmega support requires firmware "
805796 "version >= 5.37\n",
806797 progname);
807798 return -1;
808799 }
809800 if (is_dragon && fwver < FWVER(6, 11)) {
810- avrdude_message("%s: jtagmkII_getsync(): Xmega support requires firmware "
801+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): Xmega support requires firmware "
811802 "version >= 6.11\n",
812803 progname);
813804 return -1;
@@ -823,7 +814,7 @@
823814 buf[0] = mode;
824815 if (jtagmkII_setparm(pgm, PAR_EMULATOR_MODE, buf) < 0) {
825816 if (mode == EMULATOR_MODE_SPI) {
826- avrdude_message("%s: jtagmkII_getsync(): "
817+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
827818 "ISP activation failed, trying debugWire\n",
828819 progname);
829820 buf[0] = EMULATOR_MODE_DEBUGWIRE;
@@ -843,11 +834,11 @@
843834 */
844835 (void)jtagmkII_reset(pgm, 0x04);
845836 if (tries++ > 3) {
846- avrdude_message("%s: Failed to return from debugWIRE to ISP.\n",
837+ avrdude_message(MSG_INFO, "%s: Failed to return from debugWIRE to ISP.\n",
847838 progname);
848839 return -1;
849840 }
850- avrdude_message("%s: Target prepared for ISP, signed off.\n"
841+ avrdude_message(MSG_INFO, "%s: Target prepared for ISP, signed off.\n"
851842 "%s: Now retrying without power-cycling the target.\n",
852843 progname, progname);
853844 goto retry;
@@ -859,8 +850,7 @@
859850
860851 /* GET SYNC forces the target into STOPPED mode */
861852 buf[0] = CMND_GET_SYNC;
862- if (verbose >= 2)
863- avrdude_message("%s: jtagmkII_getsync(): Sending get sync command: ",
853+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getsync(): Sending get sync command: ",
864854 progname);
865855 jtagmkII_send(pgm, buf, 1);
866856
@@ -868,7 +858,7 @@
868858 if (status <= 0) {
869859 if (verbose >= 2)
870860 putc('\n', stderr);
871- avrdude_message("%s: jtagmkII_getsync(): "
861+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
872862 "timeout/error communicating with programmer (status %d)\n",
873863 progname, status);
874864 return -1;
@@ -877,11 +867,11 @@
877867 putc('\n', stderr);
878868 jtagmkII_prmsg(pgm, resp, status);
879869 } else if (verbose == 2)
880- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
870+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
881871 c = resp[0];
882872 free(resp);
883873 if (c != RSP_OK) {
884- avrdude_message("%s: jtagmkII_getsync(): "
874+ avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): "
885875 "bad response to set parameter command: %s\n",
886876 progname, jtagmkII_get_rc(c));
887877 return -1;
@@ -907,8 +897,7 @@
907897 buf[0] = CMND_CHIP_ERASE;
908898 len = 1;
909899 }
910- if (verbose >= 2)
911- avrdude_message("%s: jtagmkII_chip_erase(): Sending %schip erase command: ",
900+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_chip_erase(): Sending %schip erase command: ",
912901 progname,
913902 (p->flags & AVRPART_HAS_PDI)? "Xmega ": "");
914903 jtagmkII_send(pgm, buf, len);
@@ -917,7 +906,7 @@
917906 if (status <= 0) {
918907 if (verbose >= 2)
919908 putc('\n', stderr);
920- avrdude_message("%s: jtagmkII_chip_erase(): "
909+ avrdude_message(MSG_INFO, "%s: jtagmkII_chip_erase(): "
921910 "timeout/error communicating with programmer (status %d)\n",
922911 progname, status);
923912 return -1;
@@ -926,11 +915,11 @@
926915 putc('\n', stderr);
927916 jtagmkII_prmsg(pgm, resp, status);
928917 } else if (verbose == 2)
929- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
918+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
930919 c = resp[0];
931920 free(resp);
932921 if (c != RSP_OK) {
933- avrdude_message("%s: jtagmkII_chip_erase(): "
922+ avrdude_message(MSG_INFO, "%s: jtagmkII_chip_erase(): "
934923 "bad response to chip erase command: %s\n",
935924 progname, jtagmkII_get_rc(c));
936925 return -1;
@@ -948,7 +937,7 @@
948937 static int jtagmkII_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p)
949938 {
950939
951- avrdude_message("%s: Chip erase not supported in debugWire mode\n",
940+ avrdude_message(MSG_INFO, "%s: Chip erase not supported in debugWire mode\n",
952941 progname);
953942
954943 return 0;
@@ -996,8 +985,7 @@
996985 sendbuf.dd.ucCacheType =
997986 (p->flags & AVRPART_HAS_PDI)? 0x02 /* ATxmega */: 0x00;
998987
999- if (verbose >= 2)
1000- avrdude_message("%s: jtagmkII_set_devdescr(): "
988+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_devdescr(): "
1001989 "Sending set device descriptor command: ",
1002990 progname);
1003991 jtagmkII_send(pgm, (unsigned char *)&sendbuf,
@@ -1007,7 +995,7 @@
1007995 if (status <= 0) {
1008996 if (verbose >= 2)
1009997 putc('\n', stderr);
1010- avrdude_message("%s: jtagmkII_set_devdescr(): "
998+ avrdude_message(MSG_INFO, "%s: jtagmkII_set_devdescr(): "
1011999 "timeout/error communicating with programmer (status %d)\n",
10121000 progname, status);
10131001 return;
@@ -1016,11 +1004,11 @@
10161004 putc('\n', stderr);
10171005 jtagmkII_prmsg(pgm, resp, status);
10181006 } else if (verbose == 2)
1019- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1007+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
10201008 c = resp[0];
10211009 free(resp);
10221010 if (c != RSP_OK) {
1023- avrdude_message("%s: jtagmkII_set_devdescr(): "
1011+ avrdude_message(MSG_INFO, "%s: jtagmkII_set_devdescr(): "
10241012 "bad response to set device descriptor command: %s\n",
10251013 progname, jtagmkII_get_rc(c));
10261014 }
@@ -1075,8 +1063,7 @@
10751063 }
10761064 }
10771065
1078- if (verbose >= 2)
1079- avrdude_message("%s: jtagmkII_set_xmega_params(): "
1066+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_xmega_params(): "
10801067 "Sending set Xmega params command: ",
10811068 progname);
10821069 jtagmkII_send(pgm, (unsigned char *)&sendbuf, sizeof sendbuf);
@@ -1085,7 +1072,7 @@
10851072 if (status <= 0) {
10861073 if (verbose >= 2)
10871074 putc('\n', stderr);
1088- avrdude_message("%s: jtagmkII_set_xmega_params(): "
1075+ avrdude_message(MSG_INFO, "%s: jtagmkII_set_xmega_params(): "
10891076 "timeout/error communicating with programmer (status %d)\n",
10901077 progname, status);
10911078 return;
@@ -1094,11 +1081,11 @@
10941081 putc('\n', stderr);
10951082 jtagmkII_prmsg(pgm, resp, status);
10961083 } else if (verbose == 2)
1097- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1084+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
10981085 c = resp[0];
10991086 free(resp);
11001087 if (c != RSP_OK) {
1101- avrdude_message("%s: jtagmkII_set_xmega_params(): "
1088+ avrdude_message(MSG_INFO, "%s: jtagmkII_set_xmega_params(): "
11021089 "bad response to set device descriptor command: %s\n",
11031090 progname, jtagmkII_get_rc(c));
11041091 }
@@ -1124,8 +1111,7 @@
11241111
11251112 buf[0] = (pgm->flag & PGM_FL_IS_DW)? CMND_FORCED_STOP: CMND_RESET;
11261113 buf[1] = (pgm->flag & PGM_FL_IS_DW)? 1: flags;
1127- if (verbose >= 2)
1128- avrdude_message("%s: jtagmkII_reset(): Sending %s command: ",
1114+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_reset(): Sending %s command: ",
11291115 progname, (pgm->flag & PGM_FL_IS_DW)? "stop": "reset");
11301116 jtagmkII_send(pgm, buf, 2);
11311117
@@ -1133,7 +1119,7 @@
11331119 if (status <= 0) {
11341120 if (verbose >= 2)
11351121 putc('\n', stderr);
1136- avrdude_message("%s: jtagmkII_reset(): "
1122+ avrdude_message(MSG_INFO, "%s: jtagmkII_reset(): "
11371123 "timeout/error communicating with programmer (status %d)\n",
11381124 progname, status);
11391125 return -1;
@@ -1142,11 +1128,11 @@
11421128 putc('\n', stderr);
11431129 jtagmkII_prmsg(pgm, resp, status);
11441130 } else if (verbose == 2)
1145- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1131+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
11461132 c = resp[0];
11471133 free(resp);
11481134 if (c != RSP_OK) {
1149- avrdude_message("%s: jtagmkII_reset(): "
1135+ avrdude_message(MSG_INFO, "%s: jtagmkII_reset(): "
11501136 "bad response to reset command: %s\n",
11511137 progname, jtagmkII_get_rc(c));
11521138 return -1;
@@ -1155,7 +1141,7 @@
11551141 return 0;
11561142 }
11571143
1158-static int jtagmkII_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p)
1144+static int jtagmkII_program_enable_INFO(PROGRAMMER * pgm, AVRPART * p)
11591145 {
11601146 return 0;
11611147 }
@@ -1171,8 +1157,7 @@
11711157
11721158 for (use_ext_reset = 0; use_ext_reset <= 1; use_ext_reset++) {
11731159 buf[0] = CMND_ENTER_PROGMODE;
1174- if (verbose >= 2)
1175- avrdude_message("%s: jtagmkII_program_enable(): "
1160+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_program_enable(): "
11761161 "Sending enter progmode command: ",
11771162 progname);
11781163 jtagmkII_send(pgm, buf, 1);
@@ -1181,7 +1166,7 @@
11811166 if (status <= 0) {
11821167 if (verbose >= 2)
11831168 putc('\n', stderr);
1184- avrdude_message("%s: jtagmkII_program_enable(): "
1169+ avrdude_message(MSG_INFO, "%s: jtagmkII_program_enable(): "
11851170 "timeout/error communicating with programmer (status %d)\n",
11861171 progname, status);
11871172 return -1;
@@ -1190,18 +1175,17 @@
11901175 putc('\n', stderr);
11911176 jtagmkII_prmsg(pgm, resp, status);
11921177 } else if (verbose == 2)
1193- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1178+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
11941179 c = resp[0];
11951180 free(resp);
11961181 if (c != RSP_OK) {
1197- avrdude_message("%s: jtagmkII_program_enable(): "
1182+ avrdude_message(MSG_INFO, "%s: jtagmkII_program_enable(): "
11981183 "bad response to enter progmode command: %s\n",
11991184 progname, jtagmkII_get_rc(c));
12001185 if (c == RSP_ILLEGAL_JTAG_ID) {
12011186 if (use_ext_reset == 0) {
12021187 unsigned char parm[] = { 1};
1203- if (verbose > 0)
1204- avrdude_message("%s: retrying with external reset applied\n",
1188+ avrdude_message(MSG_INFO, "%s: retrying with external reset applied\n",
12051189 progname);
12061190
12071191 (void)jtagmkII_setparm(pgm, PAR_EXTERNAL_RESET, parm);
@@ -1208,7 +1192,7 @@
12081192 continue;
12091193 }
12101194
1211- avrdude_message("%s: JTAGEN fuse disabled?\n", progname);
1195+ avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname);
12121196 return -1;
12131197 }
12141198 }
@@ -1227,8 +1211,7 @@
12271211 return 0;
12281212
12291213 buf[0] = CMND_LEAVE_PROGMODE;
1230- if (verbose >= 2)
1231- avrdude_message("%s: jtagmkII_program_disable(): "
1214+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_program_disable(): "
12321215 "Sending leave progmode command: ",
12331216 progname);
12341217 jtagmkII_send(pgm, buf, 1);
@@ -1237,7 +1220,7 @@
12371220 if (status <= 0) {
12381221 if (verbose >= 2)
12391222 putc('\n', stderr);
1240- avrdude_message("%s: jtagmkII_program_disable(): "
1223+ avrdude_message(MSG_INFO, "%s: jtagmkII_program_disable(): "
12411224 "timeout/error communicating with programmer (status %d)\n",
12421225 progname, status);
12431226 return -1;
@@ -1246,11 +1229,11 @@
12461229 putc('\n', stderr);
12471230 jtagmkII_prmsg(pgm, resp, status);
12481231 } else if (verbose == 2)
1249- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1232+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
12501233 c = resp[0];
12511234 free(resp);
12521235 if (c != RSP_OK) {
1253- avrdude_message("%s: jtagmkII_program_disable(): "
1236+ avrdude_message(MSG_INFO, "%s: jtagmkII_program_disable(): "
12541237 "bad response to leave progmode command: %s\n",
12551238 progname, jtagmkII_get_rc(c));
12561239 return -1;
@@ -1312,7 +1295,7 @@
13121295 }
13131296
13141297 if (!ok) {
1315- avrdude_message("%s: jtagmkII_initialize(): part %s has no %s interface\n",
1298+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): part %s has no %s interface\n",
13161299 progname, p->desc, ifname);
13171300 return -1;
13181301 }
@@ -1319,11 +1302,10 @@
13191302
13201303 if ((serdev->flags & SERDEV_FL_CANSETSPEED) && pgm->baudrate && pgm->baudrate != 19200) {
13211304 if ((b = jtagmkII_get_baud(pgm->baudrate)) == 0) {
1322- avrdude_message("%s: jtagmkII_initialize(): unsupported baudrate %d\n",
1305+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): unsupported baudrate %d\n",
13231306 progname, pgm->baudrate);
13241307 } else {
1325- if (verbose >= 2)
1326- avrdude_message("%s: jtagmkII_initialize(): "
1308+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_initialize(): "
13271309 "trying to set baudrate to %d\n",
13281310 progname, pgm->baudrate);
13291311 if (jtagmkII_setparm(pgm, PAR_BAUD_RATE, &b) == 0)
@@ -1331,8 +1313,7 @@
13311313 }
13321314 }
13331315 if ((pgm->flag & PGM_FL_IS_JTAG) && pgm->bitclock != 0.0) {
1334- if (verbose >= 2)
1335- avrdude_message("%s: jtagmkII_initialize(): "
1316+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_initialize(): "
13361317 "trying to set JTAG clock period to %.1f us\n",
13371318 progname, pgm->bitclock);
13381319 if (jtagmkII_set_sck_period(pgm, pgm->bitclock) != 0)
@@ -1341,7 +1322,7 @@
13411322
13421323 if ((pgm->flag & PGM_FL_IS_JTAG) &&
13431324 jtagmkII_setparm(pgm, PAR_DAISY_CHAIN_INFO, PDATA(pgm)->jtagchain) < 0) {
1344- avrdude_message("%s: jtagmkII_initialize(): Failed to setup JTAG chain\n",
1325+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Failed to setup JTAG chain\n",
13451326 progname);
13461327 return -1;
13471328 }
@@ -1377,7 +1358,7 @@
13771358 AVRMEM *bootmem = avr_locate_mem(p, "boot");
13781359 AVRMEM *flashmem = avr_locate_mem(p, "flash");
13791360 if (bootmem == NULL || flashmem == NULL) {
1380- avrdude_message("%s: jtagmkII_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
1361+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
13811362 progname);
13821363 } else {
13831364 if (PDATA(pgm)->fwver < 0x700) {
@@ -1397,12 +1378,12 @@
13971378 free(PDATA(pgm)->flash_pagecache);
13981379 free(PDATA(pgm)->eeprom_pagecache);
13991380 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
1400- avrdude_message("%s: jtagmkII_initialize(): Out of memory\n",
1381+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Out of memory\n",
14011382 progname);
14021383 return -1;
14031384 }
14041385 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
1405- avrdude_message("%s: jtagmkII_initialize(): Out of memory\n",
1386+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Out of memory\n",
14061387 progname);
14071388 free(PDATA(pgm)->flash_pagecache);
14081389 return -1;
@@ -1431,7 +1412,7 @@
14311412 if (jtagmkII_read_byte(pgm, p, &hfuse, 1, &b) < 0)
14321413 return -1;
14331414 if ((b & OCDEN) != 0)
1434- avrdude_message("%s: jtagmkII_initialize(): warning: OCDEN fuse not programmed, "
1415+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): warning: OCDEN fuse not programmed, "
14351416 "single-byte EEPROM updates not possible\n",
14361417 progname);
14371418 }
@@ -1473,17 +1454,15 @@
14731454 unsigned int ub, ua, bb, ba;
14741455 if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba)
14751456 != 4) {
1476- avrdude_message("%s: jtagmkII_parseextparms(): invalid JTAG chain '%s'\n",
1457+ avrdude_message(MSG_INFO, "%s: jtagmkII_parseextparms(): invalid JTAG chain '%s'\n",
14771458 progname, extended_param);
14781459 rv = -1;
14791460 continue;
14801461 }
1481- if (verbose >= 2) {
1482- avrdude_message("%s: jtagmkII_parseextparms(): JTAG chain parsed as:\n"
1462+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_parseextparms(): JTAG chain parsed as:\n"
14831463 "%s %u units before, %u units after, %u bits before, %u bits after\n",
14841464 progname,
14851465 progbuf, ub, ua, bb, ba);
1486- }
14871466 PDATA(pgm)->jtagchain[0] = ub;
14881467 PDATA(pgm)->jtagchain[1] = ua;
14891468 PDATA(pgm)->jtagchain[2] = bb;
@@ -1492,7 +1471,7 @@
14921471 continue;
14931472 }
14941473
1495- avrdude_message("%s: jtagmkII_parseextparms(): invalid extended parameter '%s'\n",
1474+ avrdude_message(MSG_INFO, "%s: jtagmkII_parseextparms(): invalid extended parameter '%s'\n",
14961475 progname, extended_param);
14971476 rv = -1;
14981477 }
@@ -1505,8 +1484,7 @@
15051484 {
15061485 union pinfo pinfo;
15071486
1508- if (verbose >= 2)
1509- avrdude_message("%s: jtagmkII_open()\n", progname);
1487+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open()\n", progname);
15101488
15111489 /*
15121490 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1533,7 +1511,7 @@
15331511 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
15341512 pgm->fd.usb.eep = 0; /* no seperate EP for events */
15351513 #else
1536- avrdude_message("avrdude was compiled without usb support.\n");
1514+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
15371515 return -1;
15381516 #endif
15391517 }
@@ -1558,8 +1536,7 @@
15581536 {
15591537 union pinfo pinfo;
15601538
1561- if (verbose >= 2)
1562- avrdude_message("%s: jtagmkII_open_dw()\n", progname);
1539+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_dw()\n", progname);
15631540
15641541 /*
15651542 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1586,7 +1563,7 @@
15861563 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
15871564 pgm->fd.usb.eep = 0; /* no seperate EP for events */
15881565 #else
1589- avrdude_message("avrdude was compiled without usb support.\n");
1566+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
15901567 return -1;
15911568 #endif
15921569 }
@@ -1611,8 +1588,7 @@
16111588 {
16121589 union pinfo pinfo;
16131590
1614- if (verbose >= 2)
1615- avrdude_message("%s: jtagmkII_open_pdi()\n", progname);
1591+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_pdi()\n", progname);
16161592
16171593 /*
16181594 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1639,7 +1615,7 @@
16391615 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
16401616 pgm->fd.usb.eep = 0; /* no seperate EP for events */
16411617 #else
1642- avrdude_message("avrdude was compiled without usb support.\n");
1618+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
16431619 return -1;
16441620 #endif
16451621 }
@@ -1665,8 +1641,7 @@
16651641 {
16661642 union pinfo pinfo;
16671643
1668- if (verbose >= 2)
1669- avrdude_message("%s: jtagmkII_dragon_open()\n", progname);
1644+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open()\n", progname);
16701645
16711646 /*
16721647 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1693,7 +1668,7 @@
16931668 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
16941669 pgm->fd.usb.eep = 0; /* no seperate EP for events */
16951670 #else
1696- avrdude_message("avrdude was compiled without usb support.\n");
1671+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
16971672 return -1;
16981673 #endif
16991674 }
@@ -1719,8 +1694,7 @@
17191694 {
17201695 union pinfo pinfo;
17211696
1722- if (verbose >= 2)
1723- avrdude_message("%s: jtagmkII_dragon_open_dw()\n", progname);
1697+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open_dw()\n", progname);
17241698
17251699 /*
17261700 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1747,7 +1721,7 @@
17471721 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
17481722 pgm->fd.usb.eep = 0; /* no seperate EP for events */
17491723 #else
1750- avrdude_message("avrdude was compiled without usb support.\n");
1724+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
17511725 return -1;
17521726 #endif
17531727 }
@@ -1773,8 +1747,7 @@
17731747 {
17741748 union pinfo pinfo;
17751749
1776- if (verbose >= 2)
1777- avrdude_message("%s: jtagmkII_dragon_open_pdi()\n", progname);
1750+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open_pdi()\n", progname);
17781751
17791752 /*
17801753 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -1801,7 +1774,7 @@
18011774 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
18021775 pgm->fd.usb.eep = 0; /* no seperate EP for events */
18031776 #else
1804- avrdude_message("avrdude was compiled without usb support.\n");
1777+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
18051778 return -1;
18061779 #endif
18071780 }
@@ -1828,14 +1801,12 @@
18281801 int status;
18291802 unsigned char buf[1], *resp, c;
18301803
1831- if (verbose >= 2)
1832- avrdude_message("%s: jtagmkII_close()\n", progname);
1804+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close()\n", progname);
18331805
18341806 if (pgm->flag & PGM_FL_IS_PDI) {
18351807 /* When in PDI mode, restart target. */
18361808 buf[0] = CMND_GO;
1837- if (verbose >= 2)
1838- avrdude_message("%s: jtagmkII_close(): Sending GO command: ",
1809+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending GO command: ",
18391810 progname);
18401811 jtagmkII_send(pgm, buf, 1);
18411812
@@ -1843,7 +1814,7 @@
18431814 if (status <= 0) {
18441815 if (verbose >= 2)
18451816 putc('\n', stderr);
1846- avrdude_message("%s: jtagmkII_close(): "
1817+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
18471818 "timeout/error communicating with programmer (status %d)\n",
18481819 progname, status);
18491820 } else {
@@ -1851,11 +1822,11 @@
18511822 putc('\n', stderr);
18521823 jtagmkII_prmsg(pgm, resp, status);
18531824 } else if (verbose == 2)
1854- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1825+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
18551826 c = resp[0];
18561827 free(resp);
18571828 if (c != RSP_OK) {
1858- avrdude_message("%s: jtagmkII_close(): "
1829+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
18591830 "bad response to GO command: %s\n",
18601831 progname, jtagmkII_get_rc(c));
18611832 }
@@ -1863,8 +1834,7 @@
18631834 }
18641835
18651836 buf[0] = CMND_SIGN_OFF;
1866- if (verbose >= 2)
1867- avrdude_message("%s: jtagmkII_close(): Sending sign-off command: ",
1837+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending sign-off command: ",
18681838 progname);
18691839 jtagmkII_send(pgm, buf, 1);
18701840
@@ -1872,7 +1842,7 @@
18721842 if (status <= 0) {
18731843 if (verbose >= 2)
18741844 putc('\n', stderr);
1875- avrdude_message("%s: jtagmkII_close(): "
1845+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
18761846 "timeout/error communicating with programmer (status %d)\n",
18771847 progname, status);
18781848 return;
@@ -1881,11 +1851,11 @@
18811851 putc('\n', stderr);
18821852 jtagmkII_prmsg(pgm, resp, status);
18831853 } else if (verbose == 2)
1884- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1854+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
18851855 c = resp[0];
18861856 free(resp);
18871857 if (c != RSP_OK) {
1888- avrdude_message("%s: jtagmkII_close(): "
1858+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
18891859 "bad response to sign-off command: %s\n",
18901860 progname, jtagmkII_get_rc(c));
18911861 }
@@ -1902,17 +1872,16 @@
19021872 int status, tries;
19031873 long otimeout = serial_recv_timeout;
19041874
1905- if (verbose >= 2)
1906- avrdude_message("%s: jtagmkII_page_erase(.., %s, 0x%x)\n",
1875+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(.., %s, 0x%x)\n",
19071876 progname, m->desc, addr);
19081877
19091878 if (!(p->flags & AVRPART_HAS_PDI)) {
1910- avrdude_message("%s: jtagmkII_page_erase: not an Xmega device\n",
1879+ avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase: not an Xmega device\n",
19111880 progname);
19121881 return -1;
19131882 }
19141883 if ((pgm->flag & PGM_FL_IS_DW)) {
1915- avrdude_message("%s: jtagmkII_page_erase: not applicable to debugWIRE\n",
1884+ avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase: not applicable to debugWIRE\n",
19161885 progname);
19171886 return -1;
19181887 }
@@ -1948,8 +1917,7 @@
19481917 tries = 0;
19491918
19501919 retry:
1951- if (verbose >= 2)
1952- avrdude_message("%s: jtagmkII_page_erase(): "
1920+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(): "
19531921 "Sending xmega erase command: ",
19541922 progname);
19551923 jtagmkII_send(pgm, cmd, sizeof cmd);
@@ -1958,8 +1926,7 @@
19581926 if (status <= 0) {
19591927 if (verbose >= 2)
19601928 putc('\n', stderr);
1961- if (verbose >= 1)
1962- avrdude_message("%s: jtagmkII_page_erase(): "
1929+ avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): "
19631930 "timeout/error communicating with programmer (status %d)\n",
19641931 progname, status);
19651932 if (tries++ < 4) {
@@ -1966,7 +1933,7 @@
19661933 serial_recv_timeout *= 2;
19671934 goto retry;
19681935 }
1969- avrdude_message("%s: jtagmkII_page_erase(): fatal timeout/"
1936+ avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): fatal timeout/"
19701937 "error communicating with programmer (status %d)\n",
19711938 progname, status);
19721939 serial_recv_timeout = otimeout;
@@ -1976,9 +1943,9 @@
19761943 putc('\n', stderr);
19771944 jtagmkII_prmsg(pgm, resp, status);
19781945 } else if (verbose == 2)
1979- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
1946+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
19801947 if (resp[0] != RSP_OK) {
1981- avrdude_message("%s: jtagmkII_page_erase(): "
1948+ avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): "
19821949 "bad response to xmega erase command: %s\n",
19831950 progname, jtagmkII_get_rc(resp[0]));
19841951 free(resp);
@@ -2003,8 +1970,7 @@
20031970 int status, tries, dynamic_memtype = 0;
20041971 long otimeout = serial_recv_timeout;
20051972
2006- if (verbose >= 2)
2007- avrdude_message("%s: jtagmkII_paged_write(.., %s, %d, %d)\n",
1973+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_write(.., %s, %d, %d)\n",
20081974 progname, m->desc, page_size, n_bytes);
20091975
20101976 if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0)
@@ -2014,7 +1980,7 @@
20141980 else if (page_size > 256) page_size = 256;
20151981
20161982 if ((cmd = malloc(page_size + 10)) == NULL) {
2017- avrdude_message("%s: jtagmkII_paged_write(): Out of memory\n",
1983+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): Out of memory\n",
20181984 progname);
20191985 return -1;
20201986 }
@@ -2059,8 +2025,7 @@
20592025 block_size = maxaddr - addr;
20602026 else
20612027 block_size = page_size;
2062- if (verbose >= 3)
2063- avrdude_message("%s: jtagmkII_paged_write(): "
2028+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_write(): "
20642029 "block_size at addr %d is %d\n",
20652030 progname, addr, block_size);
20662031
@@ -2083,8 +2048,7 @@
20832048 tries = 0;
20842049
20852050 retry:
2086- if (verbose >= 2)
2087- avrdude_message("%s: jtagmkII_paged_write(): "
2051+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_write(): "
20882052 "Sending write memory command: ",
20892053 progname);
20902054 jtagmkII_send(pgm, cmd, page_size + 10);
@@ -2093,8 +2057,7 @@
20932057 if (status <= 0) {
20942058 if (verbose >= 2)
20952059 putc('\n', stderr);
2096- if (verbose >= 1)
2097- avrdude_message("%s: jtagmkII_paged_write(): "
2060+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): "
20982061 "timeout/error communicating with programmer (status %d)\n",
20992062 progname, status);
21002063 if (tries++ < 4) {
@@ -2101,7 +2064,7 @@
21012064 serial_recv_timeout *= 2;
21022065 goto retry;
21032066 }
2104- avrdude_message("%s: jtagmkII_paged_write(): fatal timeout/"
2067+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): fatal timeout/"
21052068 "error communicating with programmer (status %d)\n",
21062069 progname, status);
21072070 free(cmd);
@@ -2112,9 +2075,9 @@
21122075 putc('\n', stderr);
21132076 jtagmkII_prmsg(pgm, resp, status);
21142077 } else if (verbose == 2)
2115- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2078+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
21162079 if (resp[0] != RSP_OK) {
2117- avrdude_message("%s: jtagmkII_paged_write(): "
2080+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): "
21182081 "bad response to write memory command: %s\n",
21192082 progname, jtagmkII_get_rc(resp[0]));
21202083 free(resp);
@@ -2142,8 +2105,7 @@
21422105 int status, tries, dynamic_memtype = 0;
21432106 long otimeout = serial_recv_timeout;
21442107
2145- if (verbose >= 2)
2146- avrdude_message("%s: jtagmkII_paged_load(.., %s, %d, %d)\n",
2108+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_load(.., %s, %d, %d)\n",
21472109 progname, m->desc, page_size, n_bytes);
21482110
21492111 if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0)
@@ -2178,8 +2140,7 @@
21782140 block_size = maxaddr - addr;
21792141 else
21802142 block_size = page_size;
2181- if (verbose >= 3)
2182- avrdude_message("%s: jtagmkII_paged_load(): "
2143+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_load(): "
21832144 "block_size at addr %d is %d\n",
21842145 progname, addr, block_size);
21852146
@@ -2192,8 +2153,7 @@
21922153 tries = 0;
21932154
21942155 retry:
2195- if (verbose >= 2)
2196- avrdude_message("%s: jtagmkII_paged_load(): Sending read memory command: ",
2156+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_load(): Sending read memory command: ",
21972157 progname);
21982158 jtagmkII_send(pgm, cmd, 10);
21992159
@@ -2201,8 +2161,7 @@
22012161 if (status <= 0) {
22022162 if (verbose >= 2)
22032163 putc('\n', stderr);
2204- if (verbose >= 1)
2205- avrdude_message("%s: jtagmkII_paged_load(): "
2164+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): "
22062165 "timeout/error communicating with programmer (status %d)\n",
22072166 progname, status);
22082167 if (tries++ < 4) {
@@ -2209,7 +2168,7 @@
22092168 serial_recv_timeout *= 2;
22102169 goto retry;
22112170 }
2212- avrdude_message("%s: jtagmkII_paged_load(): fatal timeout/"
2171+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): fatal timeout/"
22132172 "error communicating with programmer (status %d)\n",
22142173 progname, status);
22152174 serial_recv_timeout = otimeout;
@@ -2219,9 +2178,9 @@
22192178 putc('\n', stderr);
22202179 jtagmkII_prmsg(pgm, resp, status);
22212180 } else if (verbose == 2)
2222- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2181+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
22232182 if (resp[0] != RSP_MEMORY) {
2224- avrdude_message("%s: jtagmkII_paged_load(): "
2183+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): "
22252184 "bad response to read memory command: %s\n",
22262185 progname, jtagmkII_get_rc(resp[0]));
22272186 free(resp);
@@ -2245,8 +2204,7 @@
22452204 unsigned long paddr = 0UL, *paddr_ptr = NULL;
22462205 unsigned int pagesize = 0;
22472206
2248- if (verbose >= 2)
2249- avrdude_message("%s: jtagmkII_read_byte(.., %s, 0x%lx, ...)\n",
2207+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_read_byte(.., %s, 0x%lx, ...)\n",
22502208 progname, mem->desc, addr);
22512209
22522210 if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0)
@@ -2329,7 +2287,7 @@
23292287 break;
23302288
23312289 default:
2332- avrdude_message("%s: illegal address %lu for signature memory\n",
2290+ avrdude_message(MSG_INFO, "%s: illegal address %lu for signature memory\n",
23332291 progname, addr);
23342292 return -1;
23352293 }
@@ -2371,8 +2329,7 @@
23712329
23722330 tries = 0;
23732331 retry:
2374- if (verbose >= 2)
2375- avrdude_message("%s: jtagmkII_read_byte(): Sending read memory command: ",
2332+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_read_byte(): Sending read memory command: ",
23762333 progname);
23772334 jtagmkII_send(pgm, cmd, 10);
23782335
@@ -2380,13 +2337,12 @@
23802337 if (status <= 0) {
23812338 if (verbose >= 2)
23822339 putc('\n', stderr);
2383- if (verbose >= 1)
2384- avrdude_message("%s: jtagmkII_read_byte(): "
2340+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): "
23852341 "timeout/error communicating with programmer (status %d)\n",
23862342 progname, status);
23872343 if (tries++ < 3)
23882344 goto retry;
2389- avrdude_message("%s: jtagmkII_read_byte(): "
2345+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): "
23902346 "fatal timeout/error communicating with programmer (status %d)\n",
23912347 progname, status);
23922348 if (status < 0)
@@ -2397,9 +2353,9 @@
23972353 putc('\n', stderr);
23982354 jtagmkII_prmsg(pgm, resp, status);
23992355 } else if (verbose == 2)
2400- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2356+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
24012357 if (resp[0] != RSP_MEMORY) {
2402- avrdude_message("%s: jtagmkII_read_byte(): "
2358+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): "
24032359 "bad response to read memory command: %s\n",
24042360 progname, jtagmkII_get_rc(resp[0]));
24052361 goto fail;
@@ -2427,8 +2383,7 @@
24272383 unsigned char *resp = NULL, writedata, writedata2 = 0xFF;
24282384 int status, tries, need_progmode = 1, unsupp = 0, writesize = 1;
24292385
2430- if (verbose >= 2)
2431- avrdude_message("%s: jtagmkII_write_byte(.., %s, 0x%lx, ...)\n",
2386+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_write_byte(.., %s, 0x%lx, ...)\n",
24322387 progname, mem->desc, addr);
24332388
24342389 addr += mem->offset;
@@ -2505,8 +2460,7 @@
25052460
25062461 tries = 0;
25072462 retry:
2508- if (verbose >= 2)
2509- avrdude_message("%s: jtagmkII_write_byte(): Sending write memory command: ",
2463+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_write_byte(): Sending write memory command: ",
25102464 progname);
25112465 jtagmkII_send(pgm, cmd, 10 + writesize);
25122466
@@ -2514,13 +2468,12 @@
25142468 if (status <= 0) {
25152469 if (verbose >= 2)
25162470 putc('\n', stderr);
2517- if (verbose > 1)
2518- avrdude_message("%s: jtagmkII_write_byte(): "
2471+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_write_byte(): "
25192472 "timeout/error communicating with programmer (status %d)\n",
25202473 progname, status);
25212474 if (tries++ < 3)
25222475 goto retry;
2523- avrdude_message("%s: jtagmkII_write_byte(): "
2476+ avrdude_message(MSG_INFO, "%s: jtagmkII_write_byte(): "
25242477 "fatal timeout/error communicating with programmer (status %d)\n",
25252478 progname, status);
25262479 goto fail;
@@ -2529,9 +2482,9 @@
25292482 putc('\n', stderr);
25302483 jtagmkII_prmsg(pgm, resp, status);
25312484 } else if (verbose == 2)
2532- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2485+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
25332486 if (resp[0] != RSP_OK) {
2534- avrdude_message("%s: jtagmkII_write_byte(): "
2487+ avrdude_message(MSG_INFO, "%s: jtagmkII_write_byte(): "
25352488 "bad response to write memory command: %s\n",
25362489 progname, jtagmkII_get_rc(resp[0]));
25372490 goto fail;
@@ -2584,13 +2537,11 @@
25842537 int status;
25852538 unsigned char buf[2], *resp, c;
25862539
2587- if (verbose >= 2)
2588- avrdude_message("%s: jtagmkII_getparm()\n", progname);
2540+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getparm()\n", progname);
25892541
25902542 buf[0] = CMND_GET_PARAMETER;
25912543 buf[1] = parm;
2592- if (verbose >= 2)
2593- avrdude_message("%s: jtagmkII_getparm(): "
2544+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getparm(): "
25942545 "Sending get parameter command (parm 0x%02x): ",
25952546 progname, parm);
25962547 jtagmkII_send(pgm, buf, 2);
@@ -2599,7 +2550,7 @@
25992550 if (status <= 0) {
26002551 if (verbose >= 2)
26012552 putc('\n', stderr);
2602- avrdude_message("%s: jtagmkII_getparm(): "
2553+ avrdude_message(MSG_INFO, "%s: jtagmkII_getparm(): "
26032554 "timeout/error communicating with programmer (status %d)\n",
26042555 progname, status);
26052556 return -1;
@@ -2608,10 +2559,10 @@
26082559 putc('\n', stderr);
26092560 jtagmkII_prmsg(pgm, resp, status);
26102561 } else if (verbose == 2)
2611- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2562+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
26122563 c = resp[0];
26132564 if (c != RSP_PARAMETER) {
2614- avrdude_message("%s: jtagmkII_getparm(): "
2565+ avrdude_message(MSG_INFO, "%s: jtagmkII_getparm(): "
26152566 "bad response to get parameter command: %s\n",
26162567 progname, jtagmkII_get_rc(c));
26172568 free(resp);
@@ -2638,8 +2589,7 @@
26382589 unsigned char buf[2 + 4], *resp, c;
26392590 size_t size;
26402591
2641- if (verbose >= 2)
2642- avrdude_message("%s: jtagmkII_setparm()\n", progname);
2592+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_setparm()\n", progname);
26432593
26442594 switch (parm) {
26452595 case PAR_HW_VERSION: size = 2; break;
@@ -2654,7 +2604,7 @@
26542604 case PAR_PDI_OFFSET_START:
26552605 case PAR_PDI_OFFSET_END: size = 4; break;
26562606 default:
2657- avrdude_message("%s: jtagmkII_setparm(): unknown parameter 0x%02x\n",
2607+ avrdude_message(MSG_INFO, "%s: jtagmkII_setparm(): unknown parameter 0x%02x\n",
26582608 progname, parm);
26592609 return -1;
26602610 }
@@ -2662,8 +2612,7 @@
26622612 buf[0] = CMND_SET_PARAMETER;
26632613 buf[1] = parm;
26642614 memcpy(buf + 2, value, size);
2665- if (verbose >= 2)
2666- avrdude_message("%s: jtagmkII_setparm(): "
2615+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_setparm(): "
26672616 "Sending set parameter command (parm 0x%02x, %u bytes): ",
26682617 progname, parm, (unsigned)size);
26692618 jtagmkII_send(pgm, buf, size + 2);
@@ -2672,7 +2621,7 @@
26722621 if (status <= 0) {
26732622 if (verbose >= 2)
26742623 putc('\n', stderr);
2675- avrdude_message("%s: jtagmkII_setparm(): "
2624+ avrdude_message(MSG_INFO, "%s: jtagmkII_setparm(): "
26762625 "timeout/error communicating with programmer (status %d)\n",
26772626 progname, status);
26782627 return -1;
@@ -2681,11 +2630,11 @@
26812630 putc('\n', stderr);
26822631 jtagmkII_prmsg(pgm, resp, status);
26832632 } else if (verbose == 2)
2684- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
2633+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
26852634 c = resp[0];
26862635 free(resp);
26872636 if (c != RSP_OK) {
2688- avrdude_message("%s: jtagmkII_setparm(): "
2637+ avrdude_message(MSG_INFO, "%s: jtagmkII_setparm(): "
26892638 "bad response to set parameter command: %s\n",
26902639 progname, jtagmkII_get_rc(c));
26912640 return -1;
@@ -2703,11 +2652,11 @@
27032652 jtagmkII_getparm(pgm, PAR_FW_VERSION, fw) < 0)
27042653 return;
27052654
2706- avrdude_message("%sM_MCU hardware version: %d\n", p, hw[0]);
2707- avrdude_message("%sM_MCU firmware version: %d.%02d\n", p, fw[1], fw[0]);
2708- avrdude_message("%sS_MCU hardware version: %d\n", p, hw[1]);
2709- avrdude_message("%sS_MCU firmware version: %d.%02d\n", p, fw[3], fw[2]);
2710- avrdude_message("%sSerial number: %02x:%02x:%02x:%02x:%02x:%02x\n",
2655+ avrdude_message(MSG_INFO, "%sM_MCU hardware version: %d\n", p, hw[0]);
2656+ avrdude_message(MSG_INFO, "%sM_MCU firmware version: %d.%02d\n", p, fw[1], fw[0]);
2657+ avrdude_message(MSG_INFO, "%sS_MCU hardware version: %d\n", p, hw[1]);
2658+ avrdude_message(MSG_INFO, "%sS_MCU firmware version: %d.%02d\n", p, fw[3], fw[2]);
2659+ avrdude_message(MSG_INFO, "%sSerial number: %02x:%02x:%02x:%02x:%02x:%02x\n",
27112660 p, PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]);
27122661
27132662 jtagmkII_print_parms1(pgm, p);
@@ -2725,7 +2674,7 @@
27252674 if (jtagmkII_getparm(pgm, PAR_OCD_VTARGET, vtarget) < 0)
27262675 return;
27272676
2728- avrdude_message("%sVtarget : %.1f V\n", p,
2677+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
27292678 b2_to_u16(vtarget) / 1000.0);
27302679
27312680 if ((pgm->flag & PGM_FL_IS_JTAG)) {
@@ -2745,7 +2694,7 @@
27452694 sprintf(clkbuf, "%.1f kHz", 5.35e3 / (double)jtag_clock[0]);
27462695 clk = 5.35e6 / (double)jtag_clock[0];
27472696
2748- avrdude_message("%sJTAG clock : %s (%.1f us)\n", p, clkbuf,
2697+ avrdude_message(MSG_INFO, "%sJTAG clock : %s (%.1f us)\n", p, clkbuf,
27492698 1.0e6 / clk);
27502699 }
27512700 }
@@ -2806,7 +2755,7 @@
28062755 int status;
28072756 unsigned char buf[3], *resp;
28082757
2809- if(verbose) avrdude_message("%s: jtagmkII_avr32_reset(%2.2x)\n",
2758+ avrdude_message(MSG_NOTICE, "%s: jtagmkII_avr32_reset(%2.2x)\n",
28102759 progname, val);
28112760
28122761 buf[0] = CMND_GET_IR;
@@ -2816,7 +2765,7 @@
28162765
28172766 status = jtagmkII_recv(pgm, &resp);
28182767 if (status != 2 || resp[0] != 0x87 || resp[1] != ret1) {
2819- if(verbose) avrdude_message("%s: jtagmkII_avr32_reset(): "
2768+ avrdude_message(MSG_NOTICE, "%s: jtagmkII_avr32_reset(): "
28202769 "Get_IR, expecting %2.2x but got %2.2x\n",
28212770 progname, ret1, resp[1]);
28222771
@@ -2831,7 +2780,7 @@
28312780
28322781 status = jtagmkII_recv(pgm, &resp);
28332782 if (status != 2 || resp[0] != 0x87 || resp[1] != ret2) {
2834- if(verbose) avrdude_message("%s: jtagmkII_avr32_reset(): "
2783+ avrdude_message(MSG_NOTICE, "%s: jtagmkII_avr32_reset(): "
28352784 "Get_XXX, expecting %2.2x but got %2.2x\n",
28362785 progname, ret2, resp[1]);
28372786 //return -1;
@@ -2847,7 +2796,7 @@
28472796 unsigned char *resp, buf[3];
28482797 unsigned long val=0;
28492798
2850- if(verbose) avrdude_message("%s: jtagmkII_reset32(%2.2x)\n",
2799+ avrdude_message(MSG_NOTICE, "%s: jtagmkII_reset32(%2.2x)\n",
28512800 progname, flags);
28522801
28532802 status = -1;
@@ -3025,7 +2974,7 @@
30252974 return 0;
30262975
30272976 eRR:
3028- avrdude_message("%s: jtagmkII_reset32(): "
2977+ avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): "
30292978 "failed at line %d (status=%x val=%lx)\n",
30302979 progname, lineno, status, val);
30312980 return -1;
@@ -3124,7 +3073,7 @@
31243073 return 0;
31253074
31263075 eRR:
3127- avrdude_message("%s: jtagmkII_smc_init32(): "
3076+ avrdude_message(MSG_INFO, "%s: jtagmkII_smc_init32(): "
31283077 "failed at line %d\n",
31293078 progname, lineno);
31303079 return -1;
@@ -3140,7 +3089,7 @@
31403089 unsigned char buf[6], *resp;
31413090
31423091 if (jtagmkII_setparm(pgm, PAR_DAISY_CHAIN_INFO, PDATA(pgm)->jtagchain) < 0) {
3143- avrdude_message("%s: jtagmkII_initialize(): Failed to setup JTAG chain\n",
3092+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Failed to setup JTAG chain\n",
31443093 progname);
31453094 return -1;
31463095 }
@@ -3148,12 +3097,12 @@
31483097 free(PDATA(pgm)->flash_pagecache);
31493098 free(PDATA(pgm)->eeprom_pagecache);
31503099 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
3151- avrdude_message("%s: jtagmkII_initialize(): Out of memory\n",
3100+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Out of memory\n",
31523101 progname);
31533102 return -1;
31543103 }
31553104 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
3156- avrdude_message("%s: jtagmkII_initialize32(): Out of memory\n",
3105+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize32(): Out of memory\n",
31573106 progname);
31583107 free(PDATA(pgm)->flash_pagecache);
31593108 return -1;
@@ -3169,7 +3118,7 @@
31693118 if(status <= 0 || resp[0] != 0x87) {
31703119 if (verbose >= 2)
31713120 putc('\n', stderr);
3172- avrdude_message("%s: jtagmkII_initialize32(): "
3121+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize32(): "
31733122 "timeout/error communicating with programmer (status %d)\n",
31743123 progname, status);
31753124 return -1;
@@ -3185,7 +3134,7 @@
31853134 if(status <= 0 || resp[0] != 0x87) {
31863135 if (verbose >= 2)
31873136 putc('\n', stderr);
3188- avrdude_message("%s: jtagmkII_initialize32(): "
3137+ avrdude_message(MSG_INFO, "%s: jtagmkII_initialize32(): "
31893138 "timeout/error communicating with programmer (status %d)\n",
31903139 progname, status);
31913140 return -1;
@@ -3195,11 +3144,11 @@
31953144 resp[2] != p->signature[0] ||
31963145 resp[3] != p->signature[1] ||
31973146 resp[4] != p->signature[2]) {
3198- avrdude_message("%s: Expected signature for %s is %02X %02X %02X\n",
3147+ avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n",
31993148 progname, p->desc,
32003149 p->signature[0], p->signature[1], p->signature[2]);
32013150 if (!ovsigck) {
3202- avrdude_message("%sDouble check chip, "
3151+ avrdude_message(MSG_INFO, "%sDouble check chip, "
32033152 "or use -F to override this check.\n",
32043153 progbuf);
32053154 return -1;
@@ -3218,7 +3167,7 @@
32183167 unsigned long val=0;
32193168 unsigned int lineno;
32203169
3221- if(verbose) avrdude_message("%s: jtagmkII_chip_erase32()\n",
3170+ avrdude_message(MSG_NOTICE, "%s: jtagmkII_chip_erase32()\n",
32223171 progname);
32233172
32243173 status = jtagmkII_reset32(pgm, AVR32_RESET_CHIP_ERASE);
@@ -3266,7 +3215,7 @@
32663215 return 0;
32673216
32683217 eRR:
3269- avrdude_message("%s: jtagmkII_reset32(): "
3218+ avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): "
32703219 "failed at line %d (status=%x val=%lx)\n",
32713220 progname, lineno, status, val);
32723221 return -1;
@@ -3293,7 +3242,7 @@
32933242 if(status <= 0 || resp[0] != 0x87) {
32943243 if (verbose >= 2)
32953244 putc('\n', stderr);
3296- avrdude_message("%s: jtagmkII_read_SABaddr(): "
3245+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): "
32973246 "timeout/error communicating with programmer (status %d) resp=%x\n",
32983247 progname, status, resp[0]);
32993248 serial_recv_timeout = otimeout;
@@ -3300,12 +3249,12 @@
33003249
33013250 if(status > 0) {
33023251 int i;
3303- avrdude_message("Cmd: ");
3304- for(i=0; i<6; ++i) avrdude_message("%2.2x ", buf[i]);
3305- avrdude_message("\n");
3306- avrdude_message("Data: ");
3307- for(i=0; i<status; ++i) avrdude_message("%2.2x ", resp[i]);
3308- avrdude_message("\n");
3252+ avrdude_message(MSG_INFO, "Cmd: ");
3253+ for(i=0; i<6; ++i) avrdude_message(MSG_INFO, "%2.2x ", buf[i]);
3254+ avrdude_message(MSG_INFO, "\n");
3255+ avrdude_message(MSG_INFO, "Data: ");
3256+ for(i=0; i<status; ++i) avrdude_message(MSG_INFO, "%2.2x ", resp[i]);
3257+ avrdude_message(MSG_INFO, "\n");
33093258 }
33103259 return ERROR_SAB;
33113260 }
@@ -3313,7 +3262,7 @@
33133262 if(status != 5) {
33143263 if (verbose >= 2)
33153264 putc('\n', stderr);
3316- avrdude_message("%s: jtagmkII_read_SABaddr(): "
3265+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): "
33173266 "wrong number of bytes (status %d)\n",
33183267 progname, status);
33193268 serial_recv_timeout = otimeout;
@@ -3326,7 +3275,7 @@
33263275 if (verbose) {
33273276 if (verbose >= 2)
33283277 putc('\n', stderr);
3329- avrdude_message("%s: jtagmkII_read_SABaddr(): "
3278+ avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): "
33303279 "OCD Register %lx -> %4.4lx\n",
33313280 progname, addr, val);
33323281 }
@@ -3352,7 +3301,7 @@
33523301 if(status <= 0 || resp[0] != RSP_OK) {
33533302 if (verbose >= 2)
33543303 putc('\n', stderr);
3355- avrdude_message("%s: jtagmkII_write_SABaddr(): "
3304+ avrdude_message(MSG_INFO, "%s: jtagmkII_write_SABaddr(): "
33563305 "timeout/error communicating with programmer (status %d)\n",
33573306 progname, status);
33583307 return -1;
@@ -3362,7 +3311,7 @@
33623311 if (verbose) {
33633312 if (verbose >= 2)
33643313 putc('\n', stderr);
3365- avrdude_message("%s: jtagmkII_write_SABaddr(): "
3314+ avrdude_message(MSG_INFO, "%s: jtagmkII_write_SABaddr(): "
33663315 "OCD Register %lx -> %4.4lx\n",
33673316 progname, addr, val);
33683317 }
@@ -3375,8 +3324,7 @@
33753324 unsigned char buf[6], *resp;
33763325 union pinfo pinfo;
33773326
3378- if (verbose >= 2)
3379- avrdude_message("%s: jtagmkII_open32()\n", progname);
3327+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open32()\n", progname);
33803328
33813329 /*
33823330 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -3403,7 +3351,7 @@
34033351 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
34043352 pgm->fd.usb.eep = 0; /* no seperate EP for events */
34053353 #else
3406- avrdude_message("avrdude was compiled without usb support.\n");
3354+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
34073355 return -1;
34083356 #endif
34093357 }
@@ -3456,8 +3404,7 @@
34563404 unsigned char *resp, buf[3], c;
34573405 unsigned long val=0;
34583406
3459- if (verbose >= 2)
3460- avrdude_message("%s: jtagmkII_close32()\n", progname);
3407+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close32()\n", progname);
34613408
34623409 // AVR32 "special"
34633410 buf[0] = CMND_SET_PARAMETER;
@@ -3469,8 +3416,7 @@
34693416 free(resp);
34703417
34713418 buf[0] = CMND_SIGN_OFF;
3472- if (verbose >= 2)
3473- avrdude_message("%s: jtagmkII_close(): Sending sign-off command: ",
3419+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending sign-off command: ",
34743420 progname);
34753421 jtagmkII_send(pgm, buf, 1);
34763422
@@ -3478,7 +3424,7 @@
34783424 if (status <= 0) {
34793425 if (verbose >= 2)
34803426 putc('\n', stderr);
3481- avrdude_message("%s: jtagmkII_close(): "
3427+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
34823428 "timeout/error communicating with programmer (status %d)\n",
34833429 progname, status);
34843430 return;
@@ -3487,11 +3433,11 @@
34873433 putc('\n', stderr);
34883434 jtagmkII_prmsg(pgm, resp, status);
34893435 } else if (verbose == 2)
3490- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
3436+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
34913437 c = resp[0];
34923438 free(resp);
34933439 if (c != RSP_OK) {
3494- avrdude_message("%s: jtagmkII_close(): "
3440+ avrdude_message(MSG_INFO, "%s: jtagmkII_close(): "
34953441 "bad response to sign-off command: %s\n",
34963442 progname, jtagmkII_get_rc(c));
34973443 }
@@ -3502,7 +3448,7 @@
35023448 return;
35033449
35043450 eRR:
3505- avrdude_message("%s: jtagmkII_reset32(): "
3451+ avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): "
35063452 "failed at line %d (status=%x val=%lx)\n",
35073453 progname, lineno, status, val);
35083454 goto ret;
@@ -3520,8 +3466,7 @@
35203466 unsigned long val=0;
35213467 long otimeout = serial_recv_timeout;
35223468
3523- if (verbose >= 2)
3524- avrdude_message("%s: jtagmkII_paged_load32(.., %s, %d, %d)\n",
3469+ avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_load32(.., %s, %d, %d)\n",
35253470 progname, m->desc, page_size, n_bytes);
35263471
35273472 serial_recv_timeout = 256;
@@ -3545,7 +3490,7 @@
35453490 p->flags |= AVRPART_INIT_SMC;
35463491 }
35473492
3548- //avrdude_message("\n pageSize=%d bytes=%d pages=%d m->offset=0x%x pgm->page_size %d\n",
3493+ //avrdude_message(MSG_INFO, "\n pageSize=%d bytes=%d pages=%d m->offset=0x%x pgm->page_size %d\n",
35493494 // page_size, n_bytes, pages, m->offset, pgm->page_size);
35503495
35513496 cmd[0] = CMND_READ_MEMORY32;
@@ -3554,8 +3499,7 @@
35543499
35553500 for (; addr < maxaddr; addr += block_size) {
35563501 block_size = ((maxaddr-addr) < pgm->page_size) ? (maxaddr - addr) : pgm->page_size;
3557- if (verbose >= 3)
3558- avrdude_message("%s: jtagmkII_paged_load32(): "
3502+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_load32(): "
35593503 "block_size at addr %d is %d\n",
35603504 progname, addr, block_size);
35613505
@@ -3570,9 +3514,9 @@
35703514 putc('\n', stderr);
35713515 jtagmkII_prmsg(pgm, resp, status);
35723516 } else if (verbose == 2)
3573- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
3517+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
35743518 if (resp[0] != 0x87) {
3575- avrdude_message("%s: jtagmkII_paged_load32(): "
3519+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load32(): "
35763520 "bad response to write memory command: %s\n",
35773521 progname, jtagmkII_get_rc(resp[0]));
35783522 free(resp);
@@ -3592,7 +3536,7 @@
35923536
35933537 eRR:
35943538 serial_recv_timeout = otimeout;
3595- avrdude_message("%s: jtagmkII_paged_load32(): "
3539+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load32(): "
35963540 "failed at line %d (status=%x val=%lx)\n",
35973541 progname, lineno, status, val);
35983542 return -1;
@@ -3620,12 +3564,12 @@
36203564
36213565 pages = (n_bytes - addr - 1)/page_size + 1;
36223566 sPageNum = addr/page_size;
3623- //avrdude_message("\n pageSize=%d bytes=%d pages=%d m->offset=0x%x pgm->page_size %d\n",
3567+ //avrdude_message(MSG_INFO, "\n pageSize=%d bytes=%d pages=%d m->offset=0x%x pgm->page_size %d\n",
36243568 // page_size, n_bytes, pages, m->offset, pgm->page_size);
36253569
36263570 // Before any errors can happen
36273571 if ((cmd = malloc(pgm->page_size + 10)) == NULL) {
3628- avrdude_message("%s: jtagmkII_paged_write32(): Out of memory\n", progname);
3572+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write32(): Out of memory\n", progname);
36293573 return -1;
36303574 }
36313575
@@ -3659,8 +3603,7 @@
36593603
36603604 for(blocks=0; blocks<2; ++blocks) {
36613605 block_size = ((maxaddr-addr) < pgm->page_size) ? (maxaddr - addr) : pgm->page_size;
3662- if (verbose >= 3)
3663- avrdude_message("%s: jtagmkII_paged_write32(): "
3606+ avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_write32(): "
36643607 "block_size at addr %d is %d\n",
36653608 progname, addr, block_size);
36663609
@@ -3677,9 +3620,9 @@
36773620 putc('\n', stderr);
36783621 jtagmkII_prmsg(pgm, resp, status);
36793622 } else if (verbose == 2)
3680- avrdude_message("0x%02x (%d bytes msg)\n", resp[0], status);
3623+ avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", resp[0], status);
36813624 if (resp[0] != RSP_OK) {
3682- avrdude_message("%s: jtagmkII_paged_write32(): "
3625+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write32(): "
36833626 "bad response to write memory command: %s\n",
36843627 progname, jtagmkII_get_rc(resp[0]));
36853628 free(resp);
@@ -3706,7 +3649,7 @@
37063649 eRR:
37073650 serial_recv_timeout = otimeout;
37083651 free(cmd);
3709- avrdude_message("%s: jtagmkII_paged_write32(): "
3652+ avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write32(): "
37103653 "failed at line %d (status=%x val=%lx)\n",
37113654 progname, lineno, status, val);
37123655 return -1;
@@ -3734,7 +3677,7 @@
37343677 return 0;
37353678
37363679 eRR:
3737- avrdude_message("%s: jtagmkII_flash_lock32(): "
3680+ avrdude_message(MSG_INFO, "%s: jtagmkII_flash_lock32(): "
37383681 "failed at line %d page %d cmd %8.8lx\n",
37393682 progname, lineno, page, cmd);
37403683 return -1;
@@ -3758,7 +3701,7 @@
37583701 status = jtagmkII_write_SABaddr(pgm, AVR32_FLASHC_FCMD, 0x05, cmd);
37593702 if (status < 0) {lineno = __LINE__; goto eRR;}
37603703
3761-//avrdude_message("ERASE %x -> %x\n", cmd, AVR32_FLASHC_FCMD);
3704+//avrdude_message(MSG_INFO, "ERASE %x -> %x\n", cmd, AVR32_FLASHC_FCMD);
37623705
37633706 err = 0;
37643707 for(i=0; i<256; ++i) {
@@ -3774,7 +3717,7 @@
37743717 return 0;
37753718
37763719 eRR:
3777- avrdude_message("%s: jtagmkII_flash_erase32(): "
3720+ avrdude_message(MSG_INFO, "%s: jtagmkII_flash_erase32(): "
37783721 "failed at line %d page %d cmd %8.8lx val %lx\n",
37793722 progname, lineno, page, cmd, val);
37803723 return -1;
@@ -3804,7 +3747,7 @@
38043747 return 0;
38053748
38063749 eRR:
3807- avrdude_message("%s: jtagmkII_flash_write_page32(): "
3750+ avrdude_message(MSG_INFO, "%s: jtagmkII_flash_write_page32(): "
38083751 "failed at line %d page %d cmd %8.8lx val %lx\n",
38093752 progname, lineno, page, cmd, val);
38103753 return -1;
@@ -3833,7 +3776,7 @@
38333776 return 0;
38343777
38353778 eRR:
3836- avrdude_message("%s: jtagmkII_flash_clear_pagebuffer32(): "
3779+ avrdude_message(MSG_INFO, "%s: jtagmkII_flash_clear_pagebuffer32(): "
38373780 "failed at line %d cmd %8.8lx val %lx\n",
38383781 progname, lineno, cmd, val);
38393782 return -1;
@@ -3856,7 +3799,7 @@
38563799 pgm->display = jtagmkII_display;
38573800 pgm->enable = jtagmkII_enable;
38583801 pgm->disable = jtagmkII_disable;
3859- pgm->program_enable = jtagmkII_program_enable_dummy;
3802+ pgm->program_enable = jtagmkII_program_enable_INFO;
38603803 pgm->chip_erase = jtagmkII_chip_erase;
38613804 pgm->open = jtagmkII_open;
38623805 pgm->close = jtagmkII_close;
@@ -3891,7 +3834,7 @@
38913834 pgm->display = jtagmkII_display;
38923835 pgm->enable = jtagmkII_enable;
38933836 pgm->disable = jtagmkII_disable;
3894- pgm->program_enable = jtagmkII_program_enable_dummy;
3837+ pgm->program_enable = jtagmkII_program_enable_INFO;
38953838 pgm->chip_erase = jtagmkII_chip_erase_dw;
38963839 pgm->open = jtagmkII_open_dw;
38973840 pgm->close = jtagmkII_close;
@@ -3923,7 +3866,7 @@
39233866 pgm->display = jtagmkII_display;
39243867 pgm->enable = jtagmkII_enable;
39253868 pgm->disable = jtagmkII_disable;
3926- pgm->program_enable = jtagmkII_program_enable_dummy;
3869+ pgm->program_enable = jtagmkII_program_enable_INFO;
39273870 pgm->chip_erase = jtagmkII_chip_erase;
39283871 pgm->open = jtagmkII_open_pdi;
39293872 pgm->close = jtagmkII_close;
@@ -3956,7 +3899,7 @@
39563899 pgm->display = jtagmkII_display;
39573900 pgm->enable = jtagmkII_enable;
39583901 pgm->disable = jtagmkII_disable;
3959- pgm->program_enable = jtagmkII_program_enable_dummy;
3902+ pgm->program_enable = jtagmkII_program_enable_INFO;
39603903 pgm->chip_erase = jtagmkII_chip_erase;
39613904 pgm->open = jtagmkII_dragon_open;
39623905 pgm->close = jtagmkII_close;
@@ -3991,7 +3934,7 @@
39913934 pgm->display = jtagmkII_display;
39923935 pgm->enable = jtagmkII_enable;
39933936 pgm->disable = jtagmkII_disable;
3994- pgm->program_enable = jtagmkII_program_enable_dummy;
3937+ pgm->program_enable = jtagmkII_program_enable_INFO;
39953938 pgm->chip_erase = jtagmkII_chip_erase_dw;
39963939 pgm->open = jtagmkII_dragon_open_dw;
39973940 pgm->close = jtagmkII_close;
@@ -4023,7 +3966,7 @@
40233966 pgm->display = jtagmkII_display;
40243967 pgm->enable = jtagmkII_enable;
40253968 pgm->disable = jtagmkII_disable;
4026- pgm->program_enable = jtagmkII_program_enable_dummy;
3969+ pgm->program_enable = jtagmkII_program_enable_INFO;
40273970 pgm->chip_erase = jtagmkII_chip_erase32;
40283971 pgm->open = jtagmkII_open32;
40293972 pgm->close = jtagmkII_close32;
@@ -4057,7 +4000,7 @@
40574000 pgm->display = jtagmkII_display;
40584001 pgm->enable = jtagmkII_enable;
40594002 pgm->disable = jtagmkII_disable;
4060- pgm->program_enable = jtagmkII_program_enable_dummy;
4003+ pgm->program_enable = jtagmkII_program_enable_INFO;
40614004 pgm->chip_erase = jtagmkII_chip_erase;
40624005 pgm->open = jtagmkII_dragon_open_pdi;
40634006 pgm->close = jtagmkII_close;
--- trunk/avrdude/lexer.l (revision 1320)
+++ trunk/avrdude/lexer.l (revision 1321)
@@ -94,9 +94,9 @@
9494 }
9595
9696 if (c == EOF) {
97- avrdude_message("error at %s:%d: EOF in comment\n",
97+ avrdude_message(MSG_INFO, "error at %s:%d: EOF in comment\n",
9898 infile, lineno);
99- avrdude_message(" comment started on line %d\n",
99+ avrdude_message(MSG_INFO, " comment started on line %d\n",
100100 comment_start);
101101 exit(1);
102102 break;
@@ -115,7 +115,7 @@
115115 <strng>\\(.|\n) *(string_buf_ptr++) = yytext[1];
116116 <strng>[^\\\n\"]+ { char *yptr = yytext; while (*yptr)
117117 *(string_buf_ptr++) = *(yptr++); }
118-<strng>\n { avrdude_message("error at line %d: unterminated character constant\n",
118+<strng>\n { avrdude_message(MSG_INFO, "error at line %d: unterminated character constant\n",
119119 lineno);
120120 exit(1); }
121121
@@ -254,9 +254,9 @@
254254 "\n" { lineno++; }
255255 [ \r\t]+ { /* ignore whitespace */ }
256256
257-c: { avrdude_message("error at %s:%d: possible old-style config file entry\n",
257+c: { avrdude_message(MSG_INFO, "error at %s:%d: possible old-style config file entry\n",
258258 infile, lineno);
259- avrdude_message(" Update your config file (see %s%s for a sample)\n",
259+ avrdude_message(MSG_INFO, " Update your config file (see %s%s for a sample)\n",
260260 CONFIG_DIR, "/avrdude.conf.sample");
261261 return YYERRCODE; }
262262
--- trunk/avrdude/libavrdude.h (revision 1320)
+++ trunk/avrdude/libavrdude.h (revision 1321)
@@ -812,10 +812,10 @@
812812
813813 /* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or "efuse") and verifies it. Will try up to tries
814814 amount of times before giving up */
815-int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm, AVRPART * p, int tries, int verbose);
815+int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm, AVRPART * p, int tries);
816816
817817 /* Reads the fuses three times, checking that all readings are the same. This will ensure that the before values aren't in error! */
818-int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse, PROGRAMMER * pgm, AVRPART * p, int verbose);
818+int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse, PROGRAMMER * pgm, AVRPART * p);
819819
820820 /* This routine will store the current values pointed to by lfuse, hfuse, and efuse into an internal buffer in this routine
821821 when save is set to 1. When save is 0 (or not 1 really) it will copy the values from the internal buffer into the locations
--- trunk/avrdude/linuxgpio.c (revision 1320)
+++ trunk/avrdude/linuxgpio.c (revision 1321)
@@ -218,7 +218,7 @@
218218
219219 static void linuxgpio_display(PROGRAMMER *pgm, const char *p)
220220 {
221- avrdude_message("%sPin assignment : /sys/class/gpio/gpio{n}\n",p);
221+ avrdude_message(MSG_INFO, "%sPin assignment : /sys/class/gpio/gpio{n}\n",p);
222222 pgm_display_generic_mask(pgm, p, SHOW_AVR_PINS);
223223 }
224224
@@ -268,7 +268,7 @@
268268 i == PIN_AVR_MISO ) {
269269 pin = pgm->pinno[i] & PIN_MASK;
270270 if ((r=linuxgpio_export(pin)) < 0) {
271- avrdude_message("Can't export GPIO %d, already exported/busy?: %s",
271+ avrdude_message(MSG_INFO, "Can't export GPIO %d, already exported/busy?: %s",
272272 pin, strerror(errno));
273273 return r;
274274 }
@@ -345,7 +345,7 @@
345345
346346 void linuxgpio_initpgm(PROGRAMMER * pgm)
347347 {
348- avrdude_message("%s: Linux sysfs GPIO support not available in this configuration\n",
348+ avrdude_message(MSG_INFO, "%s: Linux sysfs GPIO support not available in this configuration\n",
349349 progname);
350350 }
351351
--- trunk/avrdude/main.c (revision 1320)
+++ trunk/avrdude/main.c (revision 1321)
@@ -59,19 +59,21 @@
5959 length as progname; used for lining up
6060 multiline messages */
6161
62-int avrdude_message(const char *format, ...)
62+int avrdude_message(const int msglvl, const char *format, ...)
6363 {
64- int rc;
64+ int rc = 0;
6565 va_list ap;
66- va_start(ap, format);
67- rc = vfprintf(stderr, format, ap);
68- va_end(ap);
66+ if (verbose >= msglvl) {
67+ va_start(ap, format);
68+ rc = vfprintf(stderr, format, ap);
69+ va_end(ap);
70+ }
6971 return rc;
7072 }
7173
7274 int yyerror(char * errmsg)
7375 {
74- avrdude_message("%s: %s at %s:%d\n", progname, errmsg, infile, lineno);
76+ avrdude_message(MSG_INFO, "%s: %s at %s:%d\n", progname, errmsg, infile, lineno);
7577 exit(1);
7678 }
7779
@@ -104,7 +106,7 @@
104106 */
105107 static void usage(void)
106108 {
107- avrdude_message(
109+ avrdude_message(MSG_INFO,
108110 "Usage: %s [options]\n"
109111 "Options:\n"
110112 " -p <partno> Required. Specify AVR device.\n"
@@ -158,18 +160,18 @@
158160 }
159161
160162 if (hdr) {
161- avrdude_message("\n");
163+ avrdude_message(MSG_INFO, "\n");
162164 last = 0;
163165 header = hdr;
164166 }
165167
166168 if (last == 0) {
167- avrdude_message("\r%s | %s | %d%% %0.2fs",
169+ avrdude_message(MSG_INFO, "\r%s | %s | %d%% %0.2fs",
168170 header, hashes, percent, etime);
169171 }
170172
171173 if (percent == 100) {
172- if (!last) avrdude_message("\n\n");
174+ if (!last) avrdude_message(MSG_INFO, "\n\n");
173175 last = 1;
174176 }
175177
@@ -185,19 +187,19 @@
185187 setvbuf(stderr, (char*)NULL, _IONBF, 0);
186188
187189 if (hdr) {
188- avrdude_message("\n%s | ", hdr);
190+ avrdude_message(MSG_INFO, "\n%s | ", hdr);
189191 last = 0;
190192 done = 0;
191193 }
192194 else {
193195 while ((cnt > last) && (done == 0)) {
194- avrdude_message("#");
196+ avrdude_message(MSG_INFO, "#");
195197 cnt -= 2;
196198 }
197199 }
198200
199201 if ((percent == 100) && (done == 0)) {
200- avrdude_message(" | 100%% %0.2fs\n\n", etime);
202+ avrdude_message(MSG_INFO, " | 100%% %0.2fs\n\n", etime);
201203 last = 0;
202204 done = 1;
203205 }
@@ -386,19 +388,19 @@
386388
387389 updates = lcreat(NULL, 0);
388390 if (updates == NULL) {
389- avrdude_message("%s: cannot initialize updater list\n", progname);
391+ avrdude_message(MSG_INFO, "%s: cannot initialize updater list\n", progname);
390392 exit(1);
391393 }
392394
393395 extended_params = lcreat(NULL, 0);
394396 if (extended_params == NULL) {
395- avrdude_message("%s: cannot initialize extended parameter list\n", progname);
397+ avrdude_message(MSG_INFO, "%s: cannot initialize extended parameter list\n", progname);
396398 exit(1);
397399 }
398400
399401 additional_config_files = lcreat(NULL, 0);
400402 if (additional_config_files == NULL) {
401- avrdude_message("%s: cannot initialize additional config files list\n", progname);
403+ avrdude_message(MSG_INFO, "%s: cannot initialize additional config files list\n", progname);
402404 exit(1);
403405 }
404406
@@ -471,7 +473,7 @@
471473 case 'b': /* override default programmer baud rate */
472474 baudrate = strtol(optarg, &e, 0);
473475 if ((e == optarg) || (*e != 0)) {
474- avrdude_message("%s: invalid baud rate specified '%s'\n",
476+ avrdude_message(MSG_INFO, "%s: invalid baud rate specified '%s'\n",
475477 progname, optarg);
476478 exit(1);
477479 }
@@ -480,7 +482,7 @@
480482 case 'B': /* specify JTAG ICE bit clock period */
481483 bitclock = strtod(optarg, &e);
482484 if ((e == optarg) || (*e != 0) || bitclock == 0.0) {
483- avrdude_message("%s: invalid bit clock period specified '%s'\n",
485+ avrdude_message(MSG_INFO, "%s: invalid bit clock period specified '%s'\n",
484486 progname, optarg);
485487 exit(1);
486488 }
@@ -489,7 +491,7 @@
489491 case 'i': /* specify isp clock delay */
490492 ispdelay = strtol(optarg, &e,10);
491493 if ((e == optarg) || (*e != 0) || ispdelay == 0) {
492- avrdude_message("%s: invalid isp clock delay specified '%s'\n",
494+ avrdude_message(MSG_INFO, "%s: invalid isp clock delay specified '%s'\n",
493495 progname, optarg);
494496 exit(1);
495497 }
@@ -565,7 +567,7 @@
565567 case 'U':
566568 upd = parse_op(optarg);
567569 if (upd == NULL) {
568- avrdude_message("%s: error parsing update operation '%s'\n",
570+ avrdude_message(MSG_INFO, "%s: error parsing update operation '%s'\n",
569571 progname, optarg);
570572 exit(1);
571573 }
@@ -591,12 +593,12 @@
591593 break;
592594
593595 case 'y':
594- avrdude_message("%s: erase cycle counter no longer supported\n",
596+ avrdude_message(MSG_INFO, "%s: erase cycle counter no longer supported\n",
595597 progname);
596598 break;
597599
598600 case 'Y':
599- avrdude_message("%s: erase cycle counter no longer supported\n",
601+ avrdude_message(MSG_INFO, "%s: erase cycle counter no longer supported\n",
600602 progname);
601603 break;
602604
@@ -606,7 +608,7 @@
606608 break;
607609
608610 default:
609- avrdude_message("%s: invalid option -%c\n\n", progname, ch);
611+ avrdude_message(MSG_INFO, "%s: invalid option -%c\n\n", progname, ch);
610612 usage();
611613 exit(1);
612614 break;
@@ -637,47 +639,38 @@
637639 }
638640 }
639641
640- if (verbose) {
641- /*
642- * Print out an identifying string so folks can tell what version
643- * they are running
644- */
645- avrdude_message("\n%s: Version %s, compiled on %s at %s\n"
642+ /*
643+ * Print out an identifying string so folks can tell what version
644+ * they are running
645+ */
646+ avrdude_message(MSG_NOTICE, "\n%s: Version %s, compiled on %s at %s\n"
646647 "%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n"
647648 "%sCopyright (c) 2007-2014 Joerg Wunsch\n\n",
648649 progname, version, __DATE__, __TIME__, progbuf, progbuf);
649- }
650-
651- if (verbose) {
652- avrdude_message("%sSystem wide configuration file is \"%s\"\n",
650+ avrdude_message(MSG_NOTICE, "%sSystem wide configuration file is \"%s\"\n",
653651 progbuf, sys_config);
654- }
655652
656653 rc = read_config(sys_config);
657654 if (rc) {
658- avrdude_message("%s: error reading system wide configuration file \"%s\"\n",
655+ avrdude_message(MSG_INFO, "%s: error reading system wide configuration file \"%s\"\n",
659656 progname, sys_config);
660657 exit(1);
661658 }
662659
663660 if (usr_config[0] != 0) {
664- if (verbose) {
665- avrdude_message("%sUser configuration file is \"%s\"\n",
661+ avrdude_message(MSG_NOTICE, "%sUser configuration file is \"%s\"\n",
666662 progbuf, usr_config);
667- }
668663
669664 rc = stat(usr_config, &sb);
670665 if ((rc < 0) || ((sb.st_mode & S_IFREG) == 0)) {
671- if (verbose) {
672- avrdude_message("%sUser configuration file does not exist or is not a "
673- "regular file, skipping\n",
674- progbuf);
675- }
666+ avrdude_message(MSG_NOTICE, "%sUser configuration file does not exist or is not a "
667+ "regular file, skipping\n",
668+ progbuf);
676669 }
677670 else {
678671 rc = read_config(usr_config);
679672 if (rc) {
680- avrdude_message("%s: error reading user configuration file \"%s\"\n",
673+ avrdude_message(MSG_INFO, "%s: error reading user configuration file \"%s\"\n",
681674 progname, usr_config);
682675 exit(1);
683676 }
@@ -690,14 +683,12 @@
690683
691684 for (ln1=lfirst(additional_config_files); ln1; ln1=lnext(ln1)) {
692685 p = ldata(ln1);
693- if (verbose) {
694- avrdude_message("%sAdditional configuration file is \"%s\"\n",
695- progbuf, p);
696- }
686+ avrdude_message(MSG_NOTICE, "%sAdditional configuration file is \"%s\"\n",
687+ progbuf, p);
697688
698689 rc = read_config(p);
699690 if (rc) {
700- avrdude_message("%s: error reading additional configuration file \"%s\"\n",
691+ avrdude_message(MSG_INFO, "%s: error reading additional configuration file \"%s\"\n",
701692 progname, p);
702693 exit(1);
703694 }
@@ -709,16 +700,14 @@
709700 bitclock = default_bitclock;
710701 }
711702
712- if (verbose) {
713- avrdude_message("\n");
714- }
703+ avrdude_message(MSG_NOTICE, "\n");
715704
716705 if (partdesc) {
717706 if (strcmp(partdesc, "?") == 0) {
718- avrdude_message("\n");
719- avrdude_message("Valid parts are:\n");
707+ avrdude_message(MSG_INFO, "\n");
708+ avrdude_message(MSG_INFO, "Valid parts are:\n");
720709 list_parts(stderr, " ", part_list);
721- avrdude_message("\n");
710+ avrdude_message(MSG_INFO, "\n");
722711 exit(1);
723712 }
724713 }
@@ -725,17 +714,17 @@
725714
726715 if (programmer) {
727716 if (strcmp(programmer, "?") == 0) {
728- avrdude_message("\n");
729- avrdude_message("Valid programmers are:\n");
717+ avrdude_message(MSG_INFO, "\n");
718+ avrdude_message(MSG_INFO, "Valid programmers are:\n");
730719 list_programmers(stderr, " ", programmers);
731- avrdude_message("\n");
720+ avrdude_message(MSG_INFO, "\n");
732721 exit(1);
733722 }
734723 if (strcmp(programmer, "?type") == 0) {
735- avrdude_message("\n");
736- avrdude_message("Valid programmer types are:\n");
724+ avrdude_message(MSG_INFO, "\n");
725+ avrdude_message(MSG_INFO, "Valid programmer types are:\n");
737726 list_programmer_types(stderr, " ");
738- avrdude_message("\n");
727+ avrdude_message(MSG_INFO, "\n");
739728 exit(1);
740729 }
741730 }
@@ -742,10 +731,10 @@
742731
743732
744733 if (programmer[0] == 0) {
745- avrdude_message("\n%s: no programmer has been specified on the command line "
734+ avrdude_message(MSG_INFO, "\n%s: no programmer has been specified on the command line "
746735 "or the config file\n",
747736 progname);
748- avrdude_message("%sSpecify a programmer using the -c option and try again\n\n",
737+ avrdude_message(MSG_INFO, "%sSpecify a programmer using the -c option and try again\n\n",
749738 progbuf);
750739 exit(1);
751740 }
@@ -752,12 +741,12 @@
752741
753742 pgm = locate_programmer(programmers, programmer);
754743 if (pgm == NULL) {
755- avrdude_message("\n");
756- avrdude_message("%s: Can't find programmer id \"%s\"\n",
744+ avrdude_message(MSG_INFO, "\n");
745+ avrdude_message(MSG_INFO, "%s: Can't find programmer id \"%s\"\n",
757746 progname, programmer);
758- avrdude_message("\nValid programmers are:\n");
747+ avrdude_message(MSG_INFO, "\nValid programmers are:\n");
759748 list_programmers(stderr, " ", programmers);
760- avrdude_message("\n");
749+ avrdude_message(MSG_INFO, "\n");
761750 exit(1);
762751 }
763752
@@ -764,7 +753,7 @@
764753 if (pgm->initpgm) {
765754 pgm->initpgm(pgm);
766755 } else {
767- avrdude_message("\n%s: Can't initialize the programmer.\n\n",
756+ avrdude_message(MSG_INFO, "\n%s: Can't initialize the programmer.\n\n",
768757 progname);
769758 exit(1);
770759 }
@@ -778,12 +767,12 @@
778767
779768 if (lsize(extended_params) > 0) {
780769 if (pgm->parseextparams == NULL) {
781- avrdude_message("%s: WARNING: Programmer doesn't support extended parameters,"
770+ avrdude_message(MSG_INFO, "%s: WARNING: Programmer doesn't support extended parameters,"
782771 " -x option(s) ignored\n",
783772 progname);
784773 } else {
785774 if (pgm->parseextparams(pgm, extended_params) < 0) {
786- avrdude_message("%s: Error parsing extended parameter list\n",
775+ avrdude_message(MSG_INFO, "%s: Error parsing extended parameter list\n",
787776 progname);
788777 exit(1);
789778 }
@@ -808,11 +797,11 @@
808797 }
809798
810799 if (partdesc == NULL) {
811- avrdude_message("%s: No AVR part has been specified, use \"-p Part\"\n\n",
800+ avrdude_message(MSG_INFO, "%s: No AVR part has been specified, use \"-p Part\"\n\n",
812801 progname);
813- avrdude_message("Valid parts are:\n");
802+ avrdude_message(MSG_INFO, "Valid parts are:\n");
814803 list_parts(stderr, " ", part_list);
815- avrdude_message("\n");
804+ avrdude_message(MSG_INFO, "\n");
816805 exit(1);
817806 }
818807
@@ -819,11 +808,11 @@
819808
820809 p = locate_part(part_list, partdesc);
821810 if (p == NULL) {
822- avrdude_message("%s: AVR Part \"%s\" not found.\n\n",
811+ avrdude_message(MSG_INFO, "%s: AVR Part \"%s\" not found.\n\n",
823812 progname, partdesc);
824- avrdude_message("Valid parts are:\n");
813+ avrdude_message(MSG_INFO, "Valid parts are:\n");
825814 list_parts(stderr, " ", part_list);
826- avrdude_message("\n");
815+ avrdude_message(MSG_INFO, "\n");
827816 exit(1);
828817 }
829818
@@ -830,7 +819,7 @@
830819
831820 if (exitspecs != NULL) {
832821 if (pgm->parseexitspecs == NULL) {
833- avrdude_message("%s: WARNING: -E option not supported by this programmer type\n",
822+ avrdude_message(MSG_INFO, "%s: WARNING: -E option not supported by this programmer type\n",
834823 progname);
835824 exitspecs = NULL;
836825 }
@@ -865,7 +854,7 @@
865854
866855 if (avr_initmem(p) != 0)
867856 {
868- avrdude_message("\n%s: failed to initialize memories\n",
857+ avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n",
869858 progname);
870859 exit(1);
871860 }
@@ -880,14 +869,12 @@
880869 upd = ldata(ln);
881870 if (upd->memtype == NULL) {
882871 const char *mtype = (p->flags & AVRPART_HAS_PDI)? "application": "flash";
883- if (verbose >= 2) {
884- avrdude_message("%s: defaulting memtype in -U %c:%s option to \"%s\"\n",
885- progname,
886- (upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v',
887- upd->filename, mtype);
888- }
872+ avrdude_message(MSG_NOTICE2, "%s: defaulting memtype in -U %c:%s option to \"%s\"\n",
873+ progname,
874+ (upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v',
875+ upd->filename, mtype);
889876 if ((upd->memtype = strdup(mtype)) == NULL) {
890- avrdude_message("%s: out of memory\n", progname);
877+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
891878 exit(1);
892879 }
893880 }
@@ -897,42 +884,36 @@
897884 * open the programmer
898885 */
899886 if (port[0] == 0) {
900- avrdude_message("\n%s: no port has been specified on the command line "
887+ avrdude_message(MSG_INFO, "\n%s: no port has been specified on the command line "
901888 "or the config file\n",
902889 progname);
903- avrdude_message("%sSpecify a port using the -P option and try again\n\n",
890+ avrdude_message(MSG_INFO, "%sSpecify a port using the -P option and try again\n\n",
904891 progbuf);
905892 exit(1);
906893 }
907894
908895 if (verbose) {
909- avrdude_message("%sUsing Port : %s\n", progbuf, port);
910- avrdude_message("%sUsing Programmer : %s\n", progbuf, programmer);
896+ avrdude_message(MSG_NOTICE, "%sUsing Port : %s\n", progbuf, port);
897+ avrdude_message(MSG_NOTICE, "%sUsing Programmer : %s\n", progbuf, programmer);
911898 if ((strcmp(pgm->type, "avr910") == 0)) {
912- avrdude_message("%savr910_devcode (avrdude.conf) : ", progbuf);
913- if(p->avr910_devcode)avrdude_message("0x%x\n", p->avr910_devcode);
914- else avrdude_message("none\n");
899+ avrdude_message(MSG_NOTICE, "%savr910_devcode (avrdude.conf) : ", progbuf);
900+ if(p->avr910_devcode)avrdude_message(MSG_INFO, "0x%x\n", p->avr910_devcode);
901+ else avrdude_message(MSG_NOTICE, "none\n");
915902 }
916903 }
917904
918905 if (baudrate != 0) {
919- if (verbose) {
920- avrdude_message("%sOverriding Baud Rate : %d\n", progbuf, baudrate);
921- }
906+ avrdude_message(MSG_NOTICE, "%sOverriding Baud Rate : %d\n", progbuf, baudrate);
922907 pgm->baudrate = baudrate;
923908 }
924909
925910 if (bitclock != 0.0) {
926- if (verbose) {
927- avrdude_message("%sSetting bit clk period : %.1f\n", progbuf, bitclock);
928- }
911+ avrdude_message(MSG_NOTICE, "%sSetting bit clk period : %.1f\n", progbuf, bitclock);
929912 pgm->bitclock = bitclock * 1e-6;
930913 }
931914
932915 if (ispdelay != 0) {
933- if (verbose) {
934- avrdude_message("%sSetting isp clock delay : %3i\n", progbuf, ispdelay);
935- }
916+ avrdude_message(MSG_NOTICE, "%sSetting isp clock delay : %3i\n", progbuf, ispdelay);
936917 pgm->ispdelay = ispdelay;
937918 }
938919
@@ -950,15 +931,15 @@
950931 * as outlined in appnote AVR053
951932 */
952933 if (pgm->perform_osccal == 0) {
953- avrdude_message("%s: programmer does not support RC oscillator calibration\n",
934+ avrdude_message(MSG_INFO, "%s: programmer does not support RC oscillator calibration\n",
954935 progname);
955936 exitrc = 1;
956937 } else {
957- avrdude_message("%s: performing RC oscillator calibration\n", progname);
938+ avrdude_message(MSG_INFO, "%s: performing RC oscillator calibration\n", progname);
958939 exitrc = pgm->perform_osccal(pgm);
959940 }
960941 if (exitrc == 0 && quell_progress < 2) {
961- avrdude_message("%s: calibration value is now stored in EEPROM at address 0\n",
942+ avrdude_message(MSG_INFO, "%s: calibration value is now stored in EEPROM at address 0\n",
962943 progname);
963944 }
964945 goto main_exit;
@@ -966,12 +947,12 @@
966947
967948 if (verbose) {
968949 avr_display(stderr, p, progbuf, verbose);
969- avrdude_message("\n");
950+ avrdude_message(MSG_NOTICE, "\n");
970951 programmer_display(pgm, progbuf);
971952 }
972953
973954 if (quell_progress < 2) {
974- avrdude_message("\n");
955+ avrdude_message(MSG_INFO, "\n");
975956 }
976957
977958 exitrc = 0;
@@ -994,9 +975,9 @@
994975 */
995976 init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
996977 if (!init_ok) {
997- avrdude_message("%s: initialization failed, rc=%d\n", progname, rc);
978+ avrdude_message(MSG_INFO, "%s: initialization failed, rc=%d\n", progname, rc);
998979 if (!ovsigck) {
999- avrdude_message("%sDouble check connections and try again, "
980+ avrdude_message(MSG_INFO, "%sDouble check connections and try again, "
1000981 "or use -F to override\n"
1001982 "%sthis check.\n\n",
1002983 progbuf, progbuf);
@@ -1009,7 +990,7 @@
1009990 pgm->rdy_led(pgm, ON);
1010991
1011992 if (quell_progress < 2) {
1012- avrdude_message("%s: AVR device initialized and ready to accept instructions\n",
993+ avrdude_message(MSG_INFO, "%s: AVR device initialized and ready to accept instructions\n",
1013994 progname);
1014995 }
1015996
@@ -1028,7 +1009,7 @@
10281009 if (init_ok) {
10291010 rc = avr_signature(pgm, p);
10301011 if (rc != 0) {
1031- avrdude_message("%s: error reading signature data, rc=%d\n",
1012+ avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
10321013 progname, rc);
10331014 exitrc = 1;
10341015 goto main_exit;
@@ -1037,7 +1018,7 @@
10371018
10381019 sig = avr_locate_mem(p, "signature");
10391020 if (sig == NULL) {
1040- avrdude_message("%s: WARNING: signature data not defined for device \"%s\"\n",
1021+ avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
10411022 progname, p->desc);
10421023 }
10431024
@@ -1045,12 +1026,12 @@
10451026 int ff, zz;
10461027
10471028 if (quell_progress < 2) {
1048- avrdude_message("%s: Device signature = 0x", progname);
1029+ avrdude_message(MSG_INFO, "%s: Device signature = 0x", progname);
10491030 }
10501031 ff = zz = 1;
10511032 for (i=0; i<sig->size; i++) {
10521033 if (quell_progress < 2) {
1053- avrdude_message("%02x", sig->buf[i]);
1034+ avrdude_message(MSG_INFO, "%02x", sig->buf[i]);
10541035 }
10551036 if (sig->buf[i] != 0xff)
10561037 ff = 0;
@@ -1061,16 +1042,16 @@
10611042 if (++attempt < 3) {
10621043 waittime *= 5;
10631044 if (quell_progress < 2) {
1064- avrdude_message(" (retrying)\n");
1045+ avrdude_message(MSG_INFO, " (retrying)\n");
10651046 }
10661047 goto sig_again;
10671048 }
10681049 if (quell_progress < 2) {
1069- avrdude_message("\n");
1050+ avrdude_message(MSG_INFO, "\n");
10701051 }
1071- avrdude_message("%s: Yikes! Invalid device signature.\n", progname);
1052+ avrdude_message(MSG_INFO, "%s: Yikes! Invalid device signature.\n", progname);
10721053 if (!ovsigck) {
1073- avrdude_message("%sDouble check connections and try again, "
1054+ avrdude_message(MSG_INFO, "%sDouble check connections and try again, "
10741055 "or use -F to override\n"
10751056 "%sthis check.\n\n",
10761057 progbuf, progbuf);
@@ -1079,7 +1060,7 @@
10791060 }
10801061 } else {
10811062 if (quell_progress < 2) {
1082- avrdude_message("\n");
1063+ avrdude_message(MSG_INFO, "\n");
10831064 }
10841065 }
10851066
@@ -1087,11 +1068,11 @@
10871068 sig->buf[0] != p->signature[0] ||
10881069 sig->buf[1] != p->signature[1] ||
10891070 sig->buf[2] != p->signature[2]) {
1090- avrdude_message("%s: Expected signature for %s is %02X %02X %02X\n",
1071+ avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n",
10911072 progname, p->desc,
10921073 p->signature[0], p->signature[1], p->signature[2]);
10931074 if (!ovsigck) {
1094- avrdude_message("%sDouble check chip, "
1075+ avrdude_message(MSG_INFO, "%sDouble check chip, "
10951076 "or use -F to override this check.\n",
10961077 progbuf);
10971078 exitrc = 1;
@@ -1106,7 +1087,7 @@
11061087 and extended fuse bytes as needed */
11071088
11081089 rc = safemode_readfuses(&safemode_lfuse, &safemode_hfuse,
1109- &safemode_efuse, &safemode_fuse, pgm, p, verbose);
1090+ &safemode_efuse, &safemode_fuse, pgm, p);
11101091
11111092 if (rc != 0) {
11121093
@@ -1113,17 +1094,13 @@
11131094 //Check if the programmer just doesn't support reading
11141095 if (rc == -5)
11151096 {
1116- if (verbose > 0)
1117- {
1118- avrdude_message("%s: safemode: Fuse reading not support by programmer.\n"
1119- " Safemode disabled.\n", progname);
1120- }
1121- safemode = 0;
1097+ avrdude_message(MSG_NOTICE, "%s: safemode: Fuse reading not support by programmer.\n"
1098+ " Safemode disabled.\n", progname);
11221099 }
11231100 else
11241101 {
11251102
1126- avrdude_message("%s: safemode: To protect your AVR the programming "
1103+ avrdude_message(MSG_INFO, "%s: safemode: To protect your AVR the programming "
11271104 "will be aborted\n",
11281105 progname);
11291106 exitrc = 1;
@@ -1139,7 +1116,7 @@
11391116 if ((p->flags & AVRPART_HAS_PDI) && pgm->page_erase != NULL &&
11401117 lsize(updates) > 0) {
11411118 if (quell_progress < 2) {
1142- avrdude_message("%s: NOTE: Programmer supports page erase for Xmega devices.\n"
1119+ avrdude_message(MSG_INFO, "%s: NOTE: Programmer supports page erase for Xmega devices.\n"
11431120 "%sEach page will be erased before programming it, but no chip erase is performed.\n"
11441121 "%sTo disable page erases, specify the -D option; for a chip-erase, use the -e option.\n",
11451122 progname, progbuf, progbuf);
@@ -1157,7 +1134,7 @@
11571134 if ((strcasecmp(m->desc, memname) == 0) && (upd->op == DEVICE_WRITE)) {
11581135 erase = 1;
11591136 if (quell_progress < 2) {
1160- avrdude_message("%s: NOTE: \"%s\" memory has been specified, an erase cycle "
1137+ avrdude_message(MSG_INFO, "%s: NOTE: \"%s\" memory has been specified, an erase cycle "
11611138 "will be performed\n"
11621139 "%sTo disable this feature, specify the -D option.\n",
11631140 progname, memname, progbuf);
@@ -1174,11 +1151,11 @@
11741151 * before the chip can accept new programming
11751152 */
11761153 if (uflags & UF_NOWRITE) {
1177- avrdude_message("%s: conflicting -e and -n options specified, NOT erasing chip\n",
1154+ avrdude_message(MSG_INFO, "%s: conflicting -e and -n options specified, NOT erasing chip\n",
11781155 progname);
11791156 } else {
11801157 if (quell_progress < 2) {
1181- avrdude_message("%s: erasing chip\n", progname);
1158+ avrdude_message(MSG_INFO, "%s: erasing chip\n", progname);
11821159 }
11831160 exitrc = avr_chip_erase(pgm, p);
11841161 if(exitrc) goto main_exit;
@@ -1223,7 +1200,7 @@
12231200 char yes[1] = {'y'};
12241201
12251202 if (quell_progress < 2) {
1226- avrdude_message("\n");
1203+ avrdude_message(MSG_INFO, "\n");
12271204 }
12281205
12291206 //Restore the default fuse values
@@ -1231,11 +1208,11 @@
12311208
12321209 /* Try reading back fuses, make sure they are reliable to read back */
12331210 if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
1234- &safemodeafter_efuse, &safemodeafter_fuse, pgm, p, verbose) != 0) {
1211+ &safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
12351212 /* Uh-oh.. try once more to read back fuses */
12361213 if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
1237- &safemodeafter_efuse, &safemodeafter_fuse, pgm, p, verbose) != 0) {
1238- avrdude_message("%s: safemode: Sorry, reading back fuses was unreliable. "
1214+ &safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
1215+ avrdude_message(MSG_INFO, "%s: safemode: Sorry, reading back fuses was unreliable. "
12391216 "I have given up and exited programming mode\n",
12401217 progname);
12411218 exitrc = 1;
@@ -1246,7 +1223,7 @@
12461223 /* Now check what fuses are against what they should be */
12471224 if (safemodeafter_fuse != safemode_fuse) {
12481225 fuses_updated = 1;
1249- avrdude_message("%s: safemode: fuse changed! Was %x, and is now %x\n",
1226+ avrdude_message(MSG_INFO, "%s: safemode: fuse changed! Was %x, and is now %x\n",
12501227 progname, safemode_fuse, safemodeafter_fuse);
12511228
12521229
@@ -1261,11 +1238,11 @@
12611238
12621239 /* Enough chit-chat, time to program some fuses and check them */
12631240 if (safemode_writefuse (safemode_fuse, "fuse", pgm, p,
1264- 10, verbose) == 0) {
1265- avrdude_message("%s: safemode: and is now rescued\n", progname);
1241+ 10) == 0) {
1242+ avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
12661243 }
12671244 else {
1268- avrdude_message("%s: and COULD NOT be changed\n", progname);
1245+ avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
12691246 failures++;
12701247 }
12711248 }
@@ -1274,7 +1251,7 @@
12741251 /* Now check what fuses are against what they should be */
12751252 if (safemodeafter_lfuse != safemode_lfuse) {
12761253 fuses_updated = 1;
1277- avrdude_message("%s: safemode: lfuse changed! Was %x, and is now %x\n",
1254+ avrdude_message(MSG_INFO, "%s: safemode: lfuse changed! Was %x, and is now %x\n",
12781255 progname, safemode_lfuse, safemodeafter_lfuse);
12791256
12801257
@@ -1289,11 +1266,11 @@
12891266
12901267 /* Enough chit-chat, time to program some fuses and check them */
12911268 if (safemode_writefuse (safemode_lfuse, "lfuse", pgm, p,
1292- 10, verbose) == 0) {
1293- avrdude_message("%s: safemode: and is now rescued\n", progname);
1269+ 10) == 0) {
1270+ avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
12941271 }
12951272 else {
1296- avrdude_message("%s: and COULD NOT be changed\n", progname);
1273+ avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
12971274 failures++;
12981275 }
12991276 }
@@ -1302,7 +1279,7 @@
13021279 /* Now check what fuses are against what they should be */
13031280 if (safemodeafter_hfuse != safemode_hfuse) {
13041281 fuses_updated = 1;
1305- avrdude_message("%s: safemode: hfuse changed! Was %x, and is now %x\n",
1282+ avrdude_message(MSG_INFO, "%s: safemode: hfuse changed! Was %x, and is now %x\n",
13061283 progname, safemode_hfuse, safemodeafter_hfuse);
13071284
13081285 /* Ask user - should we change them */
@@ -1314,11 +1291,11 @@
13141291
13151292 /* Enough chit-chat, time to program some fuses and check them */
13161293 if (safemode_writefuse(safemode_hfuse, "hfuse", pgm, p,
1317- 10, verbose) == 0) {
1318- avrdude_message("%s: safemode: and is now rescued\n", progname);
1294+ 10) == 0) {
1295+ avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
13191296 }
13201297 else {
1321- avrdude_message("%s: and COULD NOT be changed\n", progname);
1298+ avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
13221299 failures++;
13231300 }
13241301 }
@@ -1327,7 +1304,7 @@
13271304 /* Now check what fuses are against what they should be */
13281305 if (safemodeafter_efuse != safemode_efuse) {
13291306 fuses_updated = 1;
1330- avrdude_message("%s: safemode: efuse changed! Was %x, and is now %x\n",
1307+ avrdude_message(MSG_INFO, "%s: safemode: efuse changed! Was %x, and is now %x\n",
13311308 progname, safemode_efuse, safemodeafter_efuse);
13321309
13331310 /* Ask user - should we change them */
@@ -1339,11 +1316,11 @@
13391316
13401317 /* Enough chit-chat, time to program some fuses and check them */
13411318 if (safemode_writefuse (safemode_efuse, "efuse", pgm, p,
1342- 10, verbose) == 0) {
1343- avrdude_message("%s: safemode: and is now rescued\n", progname);
1319+ 10) == 0) {
1320+ avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
13441321 }
13451322 else {
1346- avrdude_message("%s: and COULD NOT be changed\n", progname);
1323+ avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
13471324 failures++;
13481325 }
13491326 }
@@ -1350,13 +1327,13 @@
13501327 }
13511328
13521329 if (quell_progress < 2) {
1353- avrdude_message("%s: safemode: ", progname);
1330+ avrdude_message(MSG_INFO, "%s: safemode: ", progname);
13541331 if (failures == 0) {
1355- avrdude_message("Fuses OK (E:%02X, H:%02X, L:%02X)\n",
1332+ avrdude_message(MSG_INFO, "Fuses OK (E:%02X, H:%02X, L:%02X)\n",
13561333 safemode_efuse, safemode_hfuse, safemode_lfuse);
13571334 }
13581335 else {
1359- avrdude_message("Fuses not recovered, sorry\n");
1336+ avrdude_message(MSG_INFO, "Fuses not recovered, sorry\n");
13601337 }
13611338 }
13621339
@@ -1384,7 +1361,7 @@
13841361 }
13851362
13861363 if (quell_progress < 2) {
1387- avrdude_message("\n%s done. Thank you.\n\n", progname);
1364+ avrdude_message(MSG_INFO, "\n%s done. Thank you.\n\n", progname);
13881365 }
13891366
13901367 return exitrc;
--- trunk/avrdude/par.c (revision 1320)
+++ trunk/avrdude/par.c (revision 1321)
@@ -241,7 +241,7 @@
241241
242242 ppi_open(port, &pgm->fd);
243243 if (pgm->fd.ifd < 0) {
244- avrdude_message("%s: failed to open parallel port \"%s\"\n\n",
244+ avrdude_message(MSG_INFO, "%s: failed to open parallel port \"%s\"\n\n",
245245 progname, port);
246246 return -1;
247247 }
@@ -251,7 +251,7 @@
251251 */
252252 rc = ppi_getall(&pgm->fd, PPIDATA);
253253 if (rc < 0) {
254- avrdude_message("%s: error reading status of ppi data port\n", progname);
254+ avrdude_message(MSG_INFO, "%s: error reading status of ppi data port\n", progname);
255255 return -1;
256256 }
257257 pgm->ppidata = rc;
@@ -258,7 +258,7 @@
258258
259259 rc = ppi_getall(&pgm->fd, PPICTRL);
260260 if (rc < 0) {
261- avrdude_message("%s: error reading status of ppi ctrl port\n", progname);
261+ avrdude_message(MSG_INFO, "%s: error reading status of ppi ctrl port\n", progname);
262262 return -1;
263263 }
264264 pgm->ppictrl = rc;
@@ -402,7 +402,7 @@
402402
403403 void par_initpgm(PROGRAMMER * pgm)
404404 {
405- avrdude_message("%s: parallel port access not available in this configuration\n",
405+ avrdude_message(MSG_INFO, "%s: parallel port access not available in this configuration\n",
406406 progname);
407407 }
408408
--- trunk/avrdude/pgm.c (revision 1320)
+++ trunk/avrdude/pgm.c (revision 1321)
@@ -39,7 +39,7 @@
3939
4040 static int pgm_default_open (struct programmer_t *pgm, char * name)
4141 {
42- avrdude_message("\n%s: Fatal error: Programmer does not support open()",
42+ avrdude_message(MSG_INFO, "\n%s: Fatal error: Programmer does not support open()",
4343 progname);
4444 return -1;
4545 }
@@ -68,7 +68,7 @@
6868
6969 pgm = (PROGRAMMER *)malloc(sizeof(*pgm));
7070 if (pgm == NULL) {
71- avrdude_message("%s: out of memory allocating programmer structure\n",
71+ avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
7272 progname);
7373 exit(1);
7474 }
@@ -159,7 +159,7 @@
159159
160160 pgm = (PROGRAMMER *)malloc(sizeof(*pgm));
161161 if (pgm == NULL) {
162- avrdude_message("%s: out of memory allocating programmer structure\n",
162+ avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
163163 progname);
164164 exit(1);
165165 }
@@ -172,7 +172,7 @@
172172 for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) {
173173 int *ip = malloc(sizeof(int));
174174 if (ip == NULL) {
175- avrdude_message("%s: out of memory allocating programmer structure\n",
175+ avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
176176 progname);
177177 exit(1);
178178 }
@@ -186,7 +186,7 @@
186186
187187 static void pgm_default(void)
188188 {
189- avrdude_message("%s: programmer operation not supported\n", progname);
189+ avrdude_message(MSG_INFO, "%s: programmer operation not supported\n", progname);
190190 }
191191
192192
@@ -223,8 +223,8 @@
223223
224224 void programmer_display(PROGRAMMER * pgm, const char * p)
225225 {
226- avrdude_message("%sProgrammer Type : %s\n", p, pgm->type);
227- avrdude_message("%sDescription : %s\n", p, pgm->desc);
226+ avrdude_message(MSG_INFO, "%sProgrammer Type : %s\n", p, pgm->type);
227+ avrdude_message(MSG_INFO, "%sDescription : %s\n", p, pgm->desc);
228228
229229 pgm->display(pgm, p);
230230 }
@@ -233,25 +233,25 @@
233233 void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show)
234234 {
235235 if(show & (1<<PPI_AVR_VCC))
236- avrdude_message("%s VCC = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_VCC]));
236+ avrdude_message(MSG_INFO, "%s VCC = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_VCC]));
237237 if(show & (1<<PPI_AVR_BUFF))
238- avrdude_message("%s BUFF = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_BUFF]));
238+ avrdude_message(MSG_INFO, "%s BUFF = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_BUFF]));
239239 if(show & (1<<PIN_AVR_RESET))
240- avrdude_message("%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
240+ avrdude_message(MSG_INFO, "%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
241241 if(show & (1<<PIN_AVR_SCK))
242- avrdude_message("%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
242+ avrdude_message(MSG_INFO, "%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
243243 if(show & (1<<PIN_AVR_MOSI))
244- avrdude_message("%s MOSI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MOSI]));
244+ avrdude_message(MSG_INFO, "%s MOSI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MOSI]));
245245 if(show & (1<<PIN_AVR_MISO))
246- avrdude_message("%s MISO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MISO]));
246+ avrdude_message(MSG_INFO, "%s MISO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MISO]));
247247 if(show & (1<<PIN_LED_ERR))
248- avrdude_message("%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
248+ avrdude_message(MSG_INFO, "%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
249249 if(show & (1<<PIN_LED_RDY))
250- avrdude_message("%s RDY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_RDY]));
250+ avrdude_message(MSG_INFO, "%s RDY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_RDY]));
251251 if(show & (1<<PIN_LED_PGM))
252- avrdude_message("%s PGM LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_PGM]));
252+ avrdude_message(MSG_INFO, "%s PGM LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_PGM]));
253253 if(show & (1<<PIN_LED_VFY))
254- avrdude_message("%s VFY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_VFY]));
254+ avrdude_message(MSG_INFO, "%s VFY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_VFY]));
255255 }
256256
257257 void pgm_display_generic(PROGRAMMER * pgm, const char * p)
--- trunk/avrdude/pickit2.c (revision 1320)
+++ trunk/avrdude/pickit2.c (revision 1321)
@@ -75,13 +75,13 @@
7575 #endif
7676
7777 #if 0
78-#define DEBUG(...) do { avrdude_message(__VA_ARGS__); } while(0)
78+#define DEBUG(...) do { avrdude_message(MSG_INFO, __VA_ARGS__); } while(0)
7979 #else
8080 #define DEBUG(...) ((void)0)
8181 #endif
8282
8383 #if 0
84-#define DEBUGRECV(...) do { avrdude_message(__VA_ARGS__); } while(0)
84+#define DEBUGRECV(...) do { avrdude_message(MSG_INFO, __VA_ARGS__); } while(0)
8585 #else
8686 #define DEBUGRECV(...) ((void)0)
8787 #endif
@@ -168,7 +168,7 @@
168168 {
169169 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0)
170170 {
171- avrdude_message("%s: pickit2_setup(): Out of memory allocating private data\n",
171+ avrdude_message(MSG_INFO, "%s: pickit2_setup(): Out of memory allocating private data\n",
172172 progname);
173173 exit(1);
174174 }
@@ -191,7 +191,7 @@
191191 if (PDATA(pgm)->usb_handle == INVALID_HANDLE_VALUE)
192192 {
193193 /* no PICkit2 found */
194- avrdude_message("%s: error: could not find PICkit2 with vid=0x%x pid=0x%x\n",
194+ avrdude_message(MSG_INFO, "%s: error: could not find PICkit2 with vid=0x%x pid=0x%x\n",
195195 progname, PICKIT2_VID, PICKIT2_PID);
196196 return -1;
197197 }
@@ -212,7 +212,7 @@
212212 if (usb_open_device(&(PDATA(pgm)->usb_handle), PICKIT2_VID, PICKIT2_PID) < 0)
213213 {
214214 /* no PICkit2 found */
215- avrdude_message("%s: error: could not find PICkit2 with vid=0x%x pid=0x%x\n",
215+ avrdude_message(MSG_INFO, "%s: error: could not find PICkit2 with vid=0x%x pid=0x%x\n",
216216 progname, PICKIT2_VID, PICKIT2_PID);
217217 return -1;
218218 }
@@ -261,10 +261,7 @@
261261 memset(report, 0, sizeof(report));
262262 if ((errorCode = pickit2_read_report(pgm, report)) >= 4)
263263 {
264- if (verbose)
265- {
266- avrdude_message("%s: %s firmware version %d.%d.%d\n", progname, pgm->desc, (int)report[1], (int)report[2], (int)report[3]);
267- }
264+ avrdude_message(MSG_NOTICE, "%s: %s firmware version %d.%d.%d\n", progname, pgm->desc, (int)report[1], (int)report[2], (int)report[3]);
268265
269266 // set the pins, apply reset,
270267 // TO DO: apply vtarget (if requested though -x option)
@@ -299,19 +296,19 @@
299296
300297 if (pickit2_write_report(pgm, report) < 0)
301298 {
302- avrdude_message("pickit2_read_report failed (ec %d). %s\n", errorCode, usb_strerror());
299+ avrdude_message(MSG_INFO, "pickit2_read_report failed (ec %d). %s\n", errorCode, usb_strerror());
303300 return -1;
304301 }
305302 }
306303 else
307304 {
308- avrdude_message("pickit2_read_report failed (ec %d). %s\n", errorCode, usb_strerror());
305+ avrdude_message(MSG_INFO, "pickit2_read_report failed (ec %d). %s\n", errorCode, usb_strerror());
309306 return -1;
310307 }
311308 }
312309 else
313310 {
314- avrdude_message("pickit2_write_report failed (ec %d). %s\n", errorCode, usb_strerror());
311+ avrdude_message(MSG_INFO, "pickit2_write_report failed (ec %d). %s\n", errorCode, usb_strerror());
315312 return -1;
316313 }
317314
@@ -424,7 +421,7 @@
424421
425422 if (p->op[AVR_OP_PGM_ENABLE] == NULL)
426423 {
427- avrdude_message("program enable instruction not defined for part \"%s\"\n",
424+ avrdude_message(MSG_INFO, "program enable instruction not defined for part \"%s\"\n",
428425 p->desc);
429426 return -1;
430427 }
@@ -436,13 +433,13 @@
436433 if (verbose)
437434 {
438435 int i;
439- avrdude_message("program_enable(): sending command. Resp = ");
436+ avrdude_message(MSG_NOTICE, "program_enable(): sending command. Resp = ");
440437
441438 for (i = 0; i < 4; i++)
442439 {
443- avrdude_message("%x ", (int)res[i]);
440+ avrdude_message(MSG_NOTICE, "%x ", (int)res[i]);
444441 }
445- avrdude_message("\n");
442+ avrdude_message(MSG_NOTICE, "\n");
446443 }
447444
448445 // check for sync character
@@ -459,7 +456,7 @@
459456
460457 if (p->op[AVR_OP_CHIP_ERASE] == NULL)
461458 {
462- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
459+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
463460 p->desc);
464461 return -1;
465462 }
@@ -536,7 +533,7 @@
536533 }
537534 else
538535 {
539- avrdude_message("no read command specified\n");
536+ avrdude_message(MSG_INFO, "no read command specified\n");
540537 return -1;
541538 }
542539
@@ -548,7 +545,7 @@
548545
549546 if (bytes_read < 0)
550547 {
551- avrdude_message("Failed @ pgm->spi()\n");
548+ avrdude_message(MSG_INFO, "Failed @ pgm->spi()\n");
552549 pgm->err_led(pgm, ON);
553550 return -1;
554551 }
@@ -582,7 +579,7 @@
582579 wp = mem->op[AVR_OP_WRITEPAGE];
583580 if (wp == NULL)
584581 {
585- avrdude_message("pickit2_commit_page(): memory \"%s\" not configured for page writes\n",
582+ avrdude_message(MSG_INFO, "pickit2_commit_page(): memory \"%s\" not configured for page writes\n",
586583 mem->desc);
587584 return -1;
588585 }
@@ -630,7 +627,7 @@
630627 // only paged write for flash implemented
631628 if (strcmp(mem->desc, "flash") != 0 && strcmp(mem->desc, "eeprom") != 0)
632629 {
633- avrdude_message("Part does not support %d paged write of %s\n", page_size, mem->desc);
630+ avrdude_message(MSG_INFO, "Part does not support %d paged write of %s\n", page_size, mem->desc);
634631 return -1;
635632 }
636633
@@ -687,7 +684,7 @@
687684 writeop = mem->op[AVR_OP_WRITE_LO];
688685 caddr = addr; // maybe this should divide by 2 & use the write_high opcode also
689686
690- avrdude_message("Error AVR_OP_WRITE_LO defined only (where's the HIGH command?)\n");
687+ avrdude_message(MSG_INFO, "Error AVR_OP_WRITE_LO defined only (where's the HIGH command?)\n");
691688 return -1;
692689 }
693690 else
@@ -712,7 +709,7 @@
712709
713710 if (bytes_read < 0)
714711 {
715- avrdude_message("Failed @ pgm->spi()\n");
712+ avrdude_message(MSG_INFO, "Failed @ pgm->spi()\n");
716713 pgm->err_led(pgm, ON);
717714 return -1;
718715 }
@@ -1154,7 +1151,7 @@
11541151 if (handle == NULL)
11551152 {
11561153 errorCode = USB_ERROR_ACCESS;
1157- avrdude_message("%s: Warning: cannot open USB device: %s\n", progname, usb_strerror());
1154+ avrdude_message(MSG_INFO, "%s: Warning: cannot open USB device: %s\n", progname, usb_strerror());
11581155 continue;
11591156 }
11601157
@@ -1161,20 +1158,17 @@
11611158 // return with opened device handle
11621159 else
11631160 {
1164- if (verbose)
1165- {
1166- avrdude_message("Device %p seemed to open OK.\n", handle);
1167- }
1161+ avrdude_message(MSG_NOTICE, "Device %p seemed to open OK.\n", handle);
11681162
11691163 if ((errorCode = usb_set_configuration(handle, 1)) < 0)
11701164 {
1171- avrdude_message("Could not set configuration. Error code %d, %s.\n"
1165+ avrdude_message(MSG_INFO, "Could not set configuration. Error code %d, %s.\n"
11721166 "You may need to run avrdude as root or set up correct usb port permissions.", errorCode, usb_strerror());
11731167 }
11741168
11751169 if ((errorCode = usb_claim_interface(handle, 0)) < 0)
11761170 {
1177- avrdude_message("Could not claim interface. Error code %d, %s\n"
1171+ avrdude_message(MSG_INFO, "Could not claim interface. Error code %d, %s\n"
11781172 "You may need to run avrdude as root or set up correct usb port permissions.", errorCode, usb_strerror());
11791173 }
11801174
@@ -1217,7 +1211,7 @@
12171211 int clock_rate;
12181212 if (sscanf(extended_param, "clockrate=%i", &clock_rate) != 1 || clock_rate <= 0)
12191213 {
1220- avrdude_message("%s: pickit2_parseextparms(): invalid clockrate '%s'\n",
1214+ avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid clockrate '%s'\n",
12211215 progname, extended_param);
12221216 rv = -1;
12231217 continue;
@@ -1226,11 +1220,8 @@
12261220 int clock_period = MIN(1000000 / clock_rate, 255); // max period is 255
12271221 clock_rate = (int)(1000000 / (clock_period + 5e-7)); // assume highest speed is 2MHz - should probably check this
12281222
1229- if (verbose >= 2)
1230- {
1231- avrdude_message("%s: pickit2_parseextparms(): clockrate set to 0x%02x\n",
1223+ avrdude_message(MSG_NOTICE2, "%s: pickit2_parseextparms(): clockrate set to 0x%02x\n",
12321224 progname, clock_rate);
1233- }
12341225 PDATA(pgm)->clock_period = clock_period;
12351226
12361227 continue;
@@ -1241,23 +1232,20 @@
12411232 int timeout;
12421233 if (sscanf(extended_param, "timeout=%i", &timeout) != 1 || timeout <= 0)
12431234 {
1244- avrdude_message("%s: pickit2_parseextparms(): invalid timeout '%s'\n",
1235+ avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid timeout '%s'\n",
12451236 progname, extended_param);
12461237 rv = -1;
12471238 continue;
12481239 }
12491240
1250- if (verbose >= 2)
1251- {
1252- avrdude_message("%s: pickit2_parseextparms(): usb timeout set to 0x%02x\n",
1241+ avrdude_message(MSG_NOTICE2, "%s: pickit2_parseextparms(): usb timeout set to 0x%02x\n",
12531242 progname, timeout);
1254- }
12551243 PDATA(pgm)->transaction_timeout = timeout;
12561244
12571245 continue;
12581246 }
12591247
1260- avrdude_message("%s: pickit2_parseextparms(): invalid extended parameter '%s'\n",
1248+ avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid extended parameter '%s'\n",
12611249 progname, extended_param);
12621250 rv = -1;
12631251 }
@@ -1323,7 +1311,7 @@
13231311 }
13241312 #else
13251313 static int pickit2_nousb_open (struct programmer_t *pgm, char * name) {
1326- avrdude_message(
1314+ avrdude_message(MSG_INFO,
13271315 #ifdef WIN32NATIVE
13281316 "%s: error: no usb or hid support. Please compile again with libusb or HID support from Win32 DDK installed.\n",
13291317 #else
--- trunk/avrdude/pindefs.c (revision 1320)
+++ trunk/avrdude/pindefs.c (revision 1321)
@@ -63,7 +63,7 @@
6363 for(i = 0; i < PIN_MAX; i++) {
6464 if(pindef->mask[i / PIN_FIELD_ELEMENT_SIZE] & (1 << (i % PIN_FIELD_ELEMENT_SIZE))) {
6565 if(found) {
66- avrdude_message("Multiple pins found\n"); //TODO
66+ avrdude_message(MSG_INFO, "Multiple pins found\n"); //TODO
6767 return -1;
6868 }
6969 found = true;
@@ -88,7 +88,7 @@
8888 for(i = 0; i < PIN_FIELD_SIZE; i++) {
8989 if(i == 0) {
9090 if((pindef->mask[i] & ~PIN_MASK) != 0) {
91- avrdude_message("Pins of higher index than max field size for old pinno found\n");
91+ avrdude_message(MSG_INFO, "Pins of higher index than max field size for old pinno found\n");
9292 return -1;
9393 }
9494 if (pindef->mask[i] == 0) {
@@ -100,11 +100,11 @@
100100 } else if(pindef->mask[i] == ((~pindef->inverse[i]) & pindef->mask[i])) { /* all set bits in mask are cleared in inverse */
101101 *pinno = pindef->mask[i];
102102 } else {
103- avrdude_message("pins have different polarity set\n");
103+ avrdude_message(MSG_INFO, "pins have different polarity set\n");
104104 return -1;
105105 }
106106 } else if(pindef->mask[i] != 0) {
107- avrdude_message("Pins have higher number than fit in old format\n");
107+ avrdude_message(MSG_INFO, "Pins have higher number than fit in old format\n");
108108 return -1;
109109 }
110110 }
@@ -270,29 +270,25 @@
270270 }
271271 if(invalid) {
272272 if(output) {
273- avrdude_message("%s: %s: Following pins are not valid pins for this function: %s\n",
273+ avrdude_message(MSG_INFO, "%s: %s: Following pins are not valid pins for this function: %s\n",
274274 progname, avr_pin_name(pinname), pinmask_to_str(invalid_used));
275- if(verbose >= 2) {
276- avrdude_message("%s: %s: Valid pins for this function are: %s\n",
275+ avrdude_message(MSG_NOTICE2, "%s: %s: Valid pins for this function are: %s\n",
277276 progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->mask));
278- }
279277 }
280278 is_ok = false;
281279 }
282280 if(inverse) {
283281 if(output) {
284- avrdude_message("%s: %s: Following pins are not usable as inverse pins for this function: %s\n",
282+ avrdude_message(MSG_INFO, "%s: %s: Following pins are not usable as inverse pins for this function: %s\n",
285283 progname, avr_pin_name(pinname), pinmask_to_str(inverse_used));
286- if(verbose >= 2) {
287- avrdude_message("%s: %s: Valid inverse pins for this function are: %s\n",
284+ avrdude_message(MSG_NOTICE2, "%s: %s: Valid inverse pins for this function are: %s\n",
288285 progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->inverse));
289- }
290286 }
291287 is_ok = false;
292288 }
293289 if(used) {
294290 if(output) {
295- avrdude_message("%s: %s: Following pins are set for other functions too: %s\n",
291+ avrdude_message(MSG_INFO, "%s: %s: Following pins are set for other functions too: %s\n",
296292 progname, avr_pin_name(pinname), pinmask_to_str(already_used));
297293 is_ok = false;
298294 }
@@ -299,7 +295,7 @@
299295 }
300296 if(!mandatory_used && is_mandatory && !invalid) {
301297 if(output) {
302- avrdude_message("%s: %s: Mandatory pin is not defined.\n",
298+ avrdude_message(MSG_INFO, "%s: %s: Mandatory pin is not defined.\n",
303299 progname, avr_pin_name(pinname));
304300 }
305301 is_ok = false;
@@ -306,8 +302,8 @@
306302 }
307303 if(!is_ok) {
308304 rv = -1;
309- } else if(output && verbose >= 3) {
310- avrdude_message("%s: %s: Pin is ok.\n",
305+ } else if(output) {
306+ avrdude_message(MSG_DEBUG, "%s: %s: Pin is ok.\n",
311307 progname, avr_pin_name(pinname));
312308 }
313309 }
--- trunk/avrdude/ppi.c (revision 1320)
+++ trunk/avrdude/ppi.c (revision 1321)
@@ -68,7 +68,7 @@
6868 shadow_num = 2;
6969 break;
7070 default:
71- avrdude_message("%s: avr_set(): invalid register=%d\n",
71+ avrdude_message(MSG_INFO, "%s: avr_set(): invalid register=%d\n",
7272 progname, reg);
7373 return -1;
7474 break;
@@ -205,7 +205,7 @@
205205
206206 fd = open(port, O_RDWR);
207207 if (fd < 0) {
208- avrdude_message("%s: can't open device \"%s\": %s\n",
208+ avrdude_message(MSG_INFO, "%s: can't open device \"%s\": %s\n",
209209 progname, port, strerror(errno));
210210 fdp->ifd = -1;
211211 return;
--- trunk/avrdude/ppiwin.c (revision 1320)
+++ trunk/avrdude/ppiwin.c (revision 1321)
@@ -92,7 +92,7 @@
9292
9393 if(fd < 0)
9494 {
95- avrdude_message("%s: can't open device \"giveio\"\n\n", progname);
95+ avrdude_message(MSG_INFO, "%s: can't open device \"giveio\"\n\n", progname);
9696 fdp->ifd = -1;
9797 return;
9898 }
@@ -120,7 +120,7 @@
120120 fd = strtol(port, &cp, 0);
121121 if(*port == '\0' || *cp != '\0')
122122 {
123- avrdude_message("%s: port name \"%s\" is neither lpt1/2/3 nor valid number\n",
123+ avrdude_message(MSG_INFO, "%s: port name \"%s\" is neither lpt1/2/3 nor valid number\n",
124124 progname, port);
125125 fd = -1;
126126 }
@@ -127,7 +127,7 @@
127127 }
128128 if(fd < 0)
129129 {
130- avrdude_message("%s: can't open device \"%s\"\n\n", progname, port);
130+ avrdude_message(MSG_INFO, "%s: can't open device \"%s\"\n\n", progname, port);
131131 fdp->ifd = -1;
132132 return;
133133 }
@@ -361,7 +361,7 @@
361361 unsigned long dt; \
362362 dt = (unsigned long)((stop.QuadPart - start.QuadPart) * 1000 * 1000 \
363363 / freq.QuadPart); \
364- avrdude_message(\
364+ avrdude_message(MSG_INFO, \
365365 "hpt:%i usleep usec:%lu sleep msec:%lu timed usec:%lu\n", \
366366 has_highperf, us, ((us + 999) / 1000), dt); \
367367 } while (0)
--- trunk/avrdude/safemode.c (revision 1320)
+++ trunk/avrdude/safemode.c (revision 1321)
@@ -33,7 +33,7 @@
3333 * before giving up
3434 */
3535 int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm,
36- AVRPART * p, int tries, int verbose)
36+ AVRPART * p, int tries)
3737 {
3838 AVRMEM * m;
3939 unsigned char fuseread;
@@ -56,10 +56,8 @@
5656 }
5757
5858 /* Report information to user if needed */
59- if (verbose > 0) {
60- avrdude_message("%s: safemode: Wrote %s to %x, read as %x. %d attempts left\n",
59+ avrdude_message(MSG_NOTICE, "%s: safemode: Wrote %s to %x, read as %x. %d attempts left\n",
6160 progname, fusename, fuse, fuseread, tries-1);
62- }
6361
6462 /* If fuse wrote OK, no need to keep going */
6563 if (fuse == fuseread) {
@@ -78,7 +76,7 @@
7876 */
7977 int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
8078 unsigned char * efuse, unsigned char * fuse,
81- PROGRAMMER * pgm, AVRPART * p, int verbose)
79+ PROGRAMMER * pgm, AVRPART * p)
8280 {
8381
8482 unsigned char value;
@@ -106,27 +104,18 @@
106104 {
107105 allowfuseread = 0;
108106 }
109- if (verbose > 2)
110- {
111- avrdude_message("%s: safemode read 1, fuse value: %x\n",progname, safemode_fuse);
112- }
107+ avrdude_message(MSG_DEBUG, "%s: safemode read 1, fuse value: %x\n",progname, safemode_fuse);
113108 if(pgm->read_byte(pgm, p, m, 0, &value) != 0)
114109 {
115110 allowfuseread = 0;
116111 }
117- if (verbose > 2)
118- {
119- avrdude_message("%s: safemode read 2, fuse value: %x\n",progname, value);
120- }
112+ avrdude_message(MSG_DEBUG, "%s: safemode read 2, fuse value: %x\n",progname, value);
121113 if (value == safemode_fuse) {
122114 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
123115 {
124116 allowfuseread = 0;
125117 }
126- if (verbose > 2)
127- {
128- avrdude_message("%s: safemode read 3, fuse value: %x\n",progname, value);
129- }
118+ avrdude_message(MSG_DEBUG, "%s: safemode read 3, fuse value: %x\n",progname, value);
130119 if (value == safemode_fuse)
131120 {
132121 fusegood = 1; /* Fuse read OK three times */
@@ -141,12 +130,12 @@
141130 }
142131
143132 if (fusegood == 0) {
144- avrdude_message("%s: safemode: Verify error - unable to read fuse properly. "
133+ avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read fuse properly. "
145134 "Programmer may not be reliable.\n", progname);
146135 return -1;
147136 }
148- else if ((fusegood == 1) && (verbose > 0)) {
149- avrdude_message("%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
137+ else if ((fusegood == 1)) {
138+ avrdude_message(MSG_NOTICE, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
150139 }
151140
152141
@@ -160,27 +149,18 @@
160149 {
161150 allowfuseread = 0;
162151 }
163- if (verbose > 2)
164- {
165- avrdude_message("%s: safemode read 1, lfuse value: %x\n",progname, safemode_lfuse);
166- }
152+ avrdude_message(MSG_DEBUG, "%s: safemode read 1, lfuse value: %x\n",progname, safemode_lfuse);
167153 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
168154 {
169155 allowfuseread = 0;
170156 }
171- if (verbose > 2)
172- {
173- avrdude_message("%s: safemode read 2, lfuse value: %x\n",progname, value);
174- }
157+ avrdude_message(MSG_DEBUG, "%s: safemode read 2, lfuse value: %x\n",progname, value);
175158 if (value == safemode_lfuse) {
176159 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
177160 {
178161 allowfuseread = 0;
179162 }
180- if (verbose > 2)
181- {
182- avrdude_message("%s: safemode read 3, lfuse value: %x\n",progname, value);
183- }
163+ avrdude_message(MSG_DEBUG, "%s: safemode read 3, lfuse value: %x\n",progname, value);
184164 if (value == safemode_lfuse){
185165 fusegood = 1; /* Fuse read OK three times */
186166 }
@@ -195,12 +175,12 @@
195175
196176
197177 if (fusegood == 0) {
198- avrdude_message("%s: safemode: Verify error - unable to read lfuse properly. "
178+ avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read lfuse properly. "
199179 "Programmer may not be reliable.\n", progname);
200180 return -1;
201181 }
202- else if ((fusegood == 1) && (verbose > 0)) {
203- avrdude_message("%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
182+ else if (fusegood == 1) {
183+ avrdude_message(MSG_DEBUG, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
204184 }
205185
206186 /* Read hfuse three times */
@@ -213,27 +193,18 @@
213193 {
214194 allowfuseread = 0;
215195 }
216- if (verbose > 2)
217- {
218- avrdude_message("%s: safemode read 1, hfuse value: %x\n",progname, safemode_hfuse);
219- }
196+ avrdude_message(MSG_DEBUG, "%s: safemode read 1, hfuse value: %x\n",progname, safemode_hfuse);
220197 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
221198 {
222199 allowfuseread = 0;
223200 }
224- if (verbose > 2)
225- {
226- avrdude_message("%s: safemode read 2, hfuse value: %x\n",progname, value);
227- }
201+ avrdude_message(MSG_DEBUG, "%s: safemode read 2, hfuse value: %x\n",progname, value);
228202 if (value == safemode_hfuse) {
229203 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
230204 {
231205 allowfuseread = 0;
232206 }
233- if (verbose > 2)
234- {
235- avrdude_message("%s: safemode read 3, hfuse value: %x\n",progname, value);
236- }
207+ avrdude_message(MSG_DEBUG, "%s: safemode read 3, hfuse value: %x\n",progname, value);
237208 if (value == safemode_hfuse){
238209 fusegood = 1; /* Fuse read OK three times */
239210 }
@@ -247,12 +218,12 @@
247218 }
248219
249220 if (fusegood == 0) {
250- avrdude_message("%s: safemode: Verify error - unable to read hfuse properly. "
221+ avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read hfuse properly. "
251222 "Programmer may not be reliable.\n", progname);
252223 return -2;
253224 }
254- else if ((fusegood == 1) && (verbose > 0)){
255- avrdude_message("%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
225+ else if (fusegood == 1){
226+ avrdude_message(MSG_NOTICE, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
256227 }
257228
258229 /* Read efuse three times */
@@ -265,27 +236,18 @@
265236 {
266237 allowfuseread = 0;
267238 }
268- if (verbose > 2)
269- {
270- avrdude_message("%s: safemode read 1, efuse value: %x\n",progname, safemode_efuse);
271- }
239+ avrdude_message(MSG_DEBUG, "%s: safemode read 1, efuse value: %x\n",progname, safemode_efuse);
272240 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
273241 {
274242 allowfuseread = 0;
275243 }
276- if (verbose > 2)
277- {
278- avrdude_message("%s: safemode read 2, efuse value: %x\n",progname, value);
279- }
244+ avrdude_message(MSG_DEBUG, "%s: safemode read 2, efuse value: %x\n",progname, value);
280245 if (value == safemode_efuse) {
281246 if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
282247 {
283248 allowfuseread = 0;
284249 }
285- if (verbose > 2)
286- {
287- avrdude_message("%s: safemode read 3, efuse value: %x\n",progname, value);
288- }
250+ avrdude_message(MSG_DEBUG, "%s: safemode read 3, efuse value: %x\n",progname, value);
289251 if (value == safemode_efuse){
290252 fusegood = 1; /* Fuse read OK three times */
291253 }
@@ -299,12 +261,12 @@
299261 }
300262
301263 if (fusegood == 0) {
302- avrdude_message("%s: safemode: Verify error - unable to read efuse properly. "
264+ avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read efuse properly. "
303265 "Programmer may not be reliable.\n", progname);
304266 return -3;
305267 }
306- else if ((fusegood == 1) && (verbose > 0)) {
307- avrdude_message("%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
268+ else if (fusegood == 1) {
269+ avrdude_message(MSG_NOTICE, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
308270 }
309271
310272 *lfuse = safemode_lfuse;
--- trunk/avrdude/ser_avrdoper.c (revision 1320)
+++ trunk/avrdude/ser_avrdoper.c (revision 1321)
@@ -313,7 +313,7 @@
313313 handle = usb_open(dev); /* we need to open the device in order to query strings */
314314 if(!handle){
315315 errorCode = USB_ERROR_ACCESS;
316- avrdude_message("Warning: cannot open USB device: %s\n",
316+ avrdude_message(MSG_INFO, "Warning: cannot open USB device: %s\n",
317317 usb_strerror());
318318 continue;
319319 }
@@ -325,21 +325,21 @@
325325 0x0409, string, sizeof(string));
326326 if(len < 0){
327327 errorCode = USB_ERROR_IO;
328- avrdude_message("Warning: cannot query manufacturer for device: %s\n",
328+ avrdude_message(MSG_INFO, "Warning: cannot query manufacturer for device: %s\n",
329329 usb_strerror());
330330 }else{
331331 errorCode = USB_ERROR_NOTFOUND;
332- /* avrdude_message("seen device from vendor ->%s<-\n", string); */
332+ /* avrdude_message(MSG_INFO, "seen device from vendor ->%s<-\n", string); */
333333 if(strcmp(string, vendorName) == 0){
334334 len = usbGetStringAscii(handle, dev->descriptor.iProduct,
335335 0x0409, string, sizeof(string));
336336 if(len < 0){
337337 errorCode = USB_ERROR_IO;
338- avrdude_message("Warning: cannot query product for device: %s\n",
338+ avrdude_message(MSG_INFO, "Warning: cannot query product for device: %s\n",
339339 usb_strerror());
340340 }else{
341341 errorCode = USB_ERROR_NOTFOUND;
342- /* avrdude_message("seen product ->%s<-\n", string); */
342+ /* avrdude_message(MSG_INFO, "seen product ->%s<-\n", string); */
343343 if(strcmp(string, productName) == 0)
344344 break;
345345 }
@@ -355,7 +355,7 @@
355355 if(handle != NULL){
356356 int rval, retries = 3;
357357 if(usb_set_configuration(handle, 1)){
358- avrdude_message("Warning: could not set configuration: %s\n",
358+ avrdude_message(MSG_INFO, "Warning: could not set configuration: %s\n",
359359 usb_strerror());
360360 }
361361 /* now try to claim the interface and detach the kernel HID driver on
@@ -364,13 +364,13 @@
364364 while((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0){
365365 #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
366366 if(usb_detach_kernel_driver_np(handle, 0) < 0){
367- avrdude_message("Warning: could not detach kernel HID driver: %s\n",
367+ avrdude_message(MSG_INFO, "Warning: could not detach kernel HID driver: %s\n",
368368 usb_strerror());
369369 }
370370 #endif
371371 }
372372 if(rval != 0)
373- avrdude_message("Warning: could not claim interface\n");
373+ avrdude_message(MSG_INFO, "Warning: could not claim interface\n");
374374 /* Continue anyway, even if we could not claim the interface. Control transfers
375375 * should still work.
376376 */
@@ -403,7 +403,7 @@
403403 reportType << 8 | buffer[0], 0, buffer, len, 5000);
404404 if(bytesSent != len){
405405 if(bytesSent < 0)
406- avrdude_message("Error sending message: %s\n", usb_strerror());
406+ avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
407407 return USB_ERROR_IO;
408408 }
409409 return 0;
@@ -424,7 +424,7 @@
424424 USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT,
425425 reportType << 8 | reportNumber, 0, buffer, maxLen, 5000);
426426 if(bytesReceived < 0){
427- avrdude_message("Error sending message: %s\n", usb_strerror());
427+ avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
428428 return USB_ERROR_IO;
429429 }
430430 *len = bytesReceived;
@@ -448,11 +448,11 @@
448448 int i;
449449
450450 if(len <= 8){ /* more compact format for short blocks */
451- avrdude_message("%s: %d bytes: ", prefix, len);
451+ avrdude_message(MSG_INFO, "%s: %d bytes: ", prefix, len);
452452 for(i = 0; i < len; i++){
453- avrdude_message("%02x ", buf[i]);
453+ avrdude_message(MSG_INFO, "%02x ", buf[i]);
454454 }
455- avrdude_message(" \"");
455+ avrdude_message(MSG_INFO, " \"");
456456 for(i = 0; i < len; i++){
457457 if(buf[i] >= 0x20 && buf[i] < 0x7f){
458458 fputc(buf[i], stderr);
@@ -460,20 +460,20 @@
460460 fputc('.', stderr);
461461 }
462462 }
463- avrdude_message("\"\n");
463+ avrdude_message(MSG_INFO, "\"\n");
464464 }else{
465- avrdude_message("%s: %d bytes:\n", prefix, len);
465+ avrdude_message(MSG_INFO, "%s: %d bytes:\n", prefix, len);
466466 while(len > 0){
467467 for(i = 0; i < 16; i++){
468468 if(i < len){
469- avrdude_message("%02x ", buf[i]);
469+ avrdude_message(MSG_INFO, "%02x ", buf[i]);
470470 }else{
471- avrdude_message(" ");
471+ avrdude_message(MSG_INFO, " ");
472472 }
473473 if(i == 7)
474474 fputc(' ', stderr);
475475 }
476- avrdude_message(" \"");
476+ avrdude_message(MSG_INFO, " \"");
477477 for(i = 0; i < 16; i++){
478478 if(i < len){
479479 if(buf[i] >= 0x20 && buf[i] < 0x7f){
@@ -483,7 +483,7 @@
483483 }
484484 }
485485 }
486- avrdude_message("\"\n");
486+ avrdude_message(MSG_INFO, "\"\n");
487487 buf += 16;
488488 len -= 16;
489489 }
@@ -516,7 +516,7 @@
516516
517517 rval = usbOpenDevice(fdp, USB_VENDOR_ID, vname, USB_PRODUCT_ID, devname, 1);
518518 if(rval != 0){
519- avrdude_message("%s: avrdoper_open(): %s\n", progname, usbErrorText(rval));
519+ avrdude_message(MSG_INFO, "%s: avrdoper_open(): %s\n", progname, usbErrorText(rval));
520520 return -1;
521521 }
522522 return 0;
@@ -554,12 +554,11 @@
554554 buffer[0] = lenIndex + 1; /* report ID */
555555 buffer[1] = thisLen;
556556 memcpy(buffer + 2, buf, thisLen);
557- if(verbose > 3)
558- avrdude_message("Sending %d bytes data chunk\n", thisLen);
557+ avrdude_message(MSG_TRACE, "Sending %d bytes data chunk\n", thisLen);
559558 rval = usbSetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, (char *)buffer,
560559 reportDataSizes[lenIndex] + 2);
561560 if(rval != 0){
562- avrdude_message("%s: avrdoper_send(): %s\n", progname, usbErrorText(rval));
561+ avrdude_message(MSG_INFO, "%s: avrdoper_send(): %s\n", progname, usbErrorText(rval));
563562 return -1;
564563 }
565564 buflen -= thisLen;
@@ -585,17 +584,16 @@
585584 usbErr = usbGetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, lenIndex + 1,
586585 (char *)buffer, &len);
587586 if(usbErr != 0){
588- avrdude_message("%s: avrdoperFillBuffer(): %s\n", progname, usbErrorText(usbErr));
587+ avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): %s\n", progname, usbErrorText(usbErr));
589588 return -1;
590589 }
591- if(verbose > 3)
592- avrdude_message("Received %d bytes data chunk of total %d\n", len - 2, buffer[1]);
590+ avrdude_message(MSG_TRACE, "Received %d bytes data chunk of total %d\n", len - 2, buffer[1]);
593591 len -= 2; /* compensate for report ID and length byte */
594592 bytesPending = buffer[1] - len; /* amount still buffered */
595593 if(len > buffer[1]) /* cut away padding */
596594 len = buffer[1];
597595 if(avrdoperRxLength + len > sizeof(avrdoperRxBuffer)){
598- avrdude_message("%s: avrdoperFillBuffer(): internal error: buffer overflow\n",
596+ avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): internal error: buffer overflow\n",
599597 progname);
600598 return -1;
601599 }
@@ -643,7 +641,7 @@
643641
644642 static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on)
645643 {
646- avrdude_message("%s: AVR-Doper doesn't support DTR/RTS setting\n", progname);
644+ avrdude_message(MSG_INFO, "%s: AVR-Doper doesn't support DTR/RTS setting\n", progname);
647645 return -1;
648646 }
649647
--- trunk/avrdude/ser_posix.c (revision 1320)
+++ trunk/avrdude/ser_posix.c (revision 1321)
@@ -90,8 +90,7 @@
9090 * If a non-standard BAUD rate is used, issue
9191 * a warning (if we are verbose) and return the raw rate
9292 */
93- if (verbose > 0)
94- avrdude_message("%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
93+ avrdude_message(MSG_NOTICE, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
9594 progname, baud);
9695
9796 return baud;
@@ -111,7 +110,7 @@
111110 */
112111 rc = tcgetattr(fd->ifd, &termios);
113112 if (rc < 0) {
114- avrdude_message("%s: ser_setspeed(): tcgetattr() failed",
113+ avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcgetattr() failed",
115114 progname);
116115 return -errno;
117116 }
@@ -135,7 +134,7 @@
135134
136135 rc = tcsetattr(fd->ifd, TCSANOW, &termios);
137136 if (rc < 0) {
138- avrdude_message("%s: ser_setspeed(): tcsetattr() failed\n",
137+ avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcsetattr() failed\n",
139138 progname);
140139 return -errno;
141140 }
@@ -167,13 +166,13 @@
167166 struct hostent *hp;
168167
169168 if ((hstr = strdup(port)) == NULL) {
170- avrdude_message("%s: net_open(): Out of memory!\n",
169+ avrdude_message(MSG_INFO, "%s: net_open(): Out of memory!\n",
171170 progname);
172171 return -1;
173172 }
174173
175174 if (((pstr = strchr(hstr, ':')) == NULL) || (pstr == hstr)) {
176- avrdude_message("%s: net_open(): Mangled host:port string \"%s\"\n",
175+ avrdude_message(MSG_INFO, "%s: net_open(): Mangled host:port string \"%s\"\n",
177176 progname, hstr);
178177 free(hstr);
179178 return -1;
@@ -187,7 +186,7 @@
187186 pnum = strtoul(pstr, &end, 10);
188187
189188 if ((*pstr == '\0') || (*end != '\0') || (pnum == 0) || (pnum > 65535)) {
190- avrdude_message("%s: net_open(): Bad port number \"%s\"\n",
189+ avrdude_message(MSG_INFO, "%s: net_open(): Bad port number \"%s\"\n",
191190 progname, pstr);
192191 free(hstr);
193192 return -1;
@@ -194,7 +193,7 @@
194193 }
195194
196195 if ((hp = gethostbyname(hstr)) == NULL) {
197- avrdude_message("%s: net_open(): unknown host \"%s\"\n",
196+ avrdude_message(MSG_INFO, "%s: net_open(): unknown host \"%s\"\n",
198197 progname, hstr);
199198 free(hstr);
200199 return -1;
@@ -203,7 +202,7 @@
203202 free(hstr);
204203
205204 if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
206- avrdude_message("%s: net_open(): Cannot open socket: %s\n",
205+ avrdude_message(MSG_INFO, "%s: net_open(): Cannot open socket: %s\n",
207206 progname, strerror(errno));
208207 return -1;
209208 }
@@ -214,7 +213,7 @@
214213 memcpy(&(sockaddr.sin_addr.s_addr), hp->h_addr, sizeof(struct in_addr));
215214
216215 if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
217- avrdude_message("%s: net_open(): Connect failed: %s\n",
216+ avrdude_message(MSG_INFO, "%s: net_open(): Connect failed: %s\n",
218217 progname, strerror(errno));
219218 return -1;
220219 }
@@ -271,7 +270,7 @@
271270 */
272271 fd = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK);
273272 if (fd < 0) {
274- avrdude_message("%s: ser_open(): can't open device \"%s\": %s\n",
273+ avrdude_message(MSG_INFO, "%s: ser_open(): can't open device \"%s\": %s\n",
275274 progname, port, strerror(errno));
276275 return -1;
277276 }
@@ -283,7 +282,7 @@
283282 */
284283 rc = ser_setspeed(fdp, pinfo.baud);
285284 if (rc) {
286- avrdude_message("%s: ser_open(): can't set attributes for device \"%s\": %s\n",
285+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set attributes for device \"%s\": %s\n",
287286 progname, port, strerror(-rc));
288287 close(fd);
289288 return -1;
@@ -300,7 +299,7 @@
300299 if (saved_original_termios) {
301300 int rc = tcsetattr(fd->ifd, TCSANOW | TCSADRAIN, &original_termios);
302301 if (rc) {
303- avrdude_message("%s: ser_close(): can't reset attributes for device: %s\n",
302+ avrdude_message(MSG_INFO, "%s: ser_close(): can't reset attributes for device: %s\n",
304303 progname, strerror(errno));
305304 }
306305 saved_original_termios = 0;
@@ -321,29 +320,29 @@
321320
322321 if (verbose > 3)
323322 {
324- avrdude_message("%s: Send: ", progname);
323+ avrdude_message(MSG_TRACE, "%s: Send: ", progname);
325324
326325 while (buflen) {
327326 unsigned char c = *buf;
328327 if (isprint(c)) {
329- avrdude_message("%c ", c);
328+ avrdude_message(MSG_TRACE, "%c ", c);
330329 }
331330 else {
332- avrdude_message(". ");
331+ avrdude_message(MSG_TRACE, ". ");
333332 }
334- avrdude_message("[%02x] ", c);
333+ avrdude_message(MSG_TRACE, "[%02x] ", c);
335334
336335 buf++;
337336 buflen--;
338337 }
339338
340- avrdude_message("\n");
339+ avrdude_message(MSG_TRACE, "\n");
341340 }
342341
343342 while (len) {
344343 rc = write(fd->ifd, p, (len > 1024) ? 1024 : len);
345344 if (rc < 0) {
346- avrdude_message("%s: ser_send(): write error: %s\n",
345+ avrdude_message(MSG_INFO, "%s: ser_send(): write error: %s\n",
347346 progname, strerror(errno));
348347 return -1;
349348 }
@@ -375,19 +374,18 @@
375374
376375 nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &to2);
377376 if (nfds == 0) {
378- if (verbose > 1)
379- avrdude_message("%s: ser_recv(): programmer is not responding\n",
377+ avrdude_message(MSG_NOTICE2, "%s: ser_recv(): programmer is not responding\n",
380378 progname);
381379 return -1;
382380 }
383381 else if (nfds == -1) {
384382 if (errno == EINTR || errno == EAGAIN) {
385- avrdude_message("%s: ser_recv(): programmer is not responding,reselecting\n",
383+ avrdude_message(MSG_INFO, "%s: ser_recv(): programmer is not responding,reselecting\n",
386384 progname);
387385 goto reselect;
388386 }
389387 else {
390- avrdude_message("%s: ser_recv(): select(): %s\n",
388+ avrdude_message(MSG_INFO, "%s: ser_recv(): select(): %s\n",
391389 progname, strerror(errno));
392390 return -1;
393391 }
@@ -395,7 +393,7 @@
395393
396394 rc = read(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len);
397395 if (rc < 0) {
398- avrdude_message("%s: ser_recv(): read error: %s\n",
396+ avrdude_message(MSG_INFO, "%s: ser_recv(): read error: %s\n",
399397 progname, strerror(errno));
400398 return -1;
401399 }
@@ -407,22 +405,22 @@
407405
408406 if (verbose > 3)
409407 {
410- avrdude_message("%s: Recv: ", progname);
408+ avrdude_message(MSG_TRACE, "%s: Recv: ", progname);
411409
412410 while (len) {
413411 unsigned char c = *p;
414412 if (isprint(c)) {
415- avrdude_message("%c ", c);
413+ avrdude_message(MSG_TRACE, "%c ", c);
416414 }
417415 else {
418- avrdude_message(". ");
416+ avrdude_message(MSG_TRACE, ". ");
419417 }
420- avrdude_message("[%02x] ", c);
418+ avrdude_message(MSG_TRACE, "[%02x] ", c);
421419
422420 p++;
423421 len--;
424422 }
425- avrdude_message("\n");
423+ avrdude_message(MSG_TRACE, "\n");
426424 }
427425
428426 return 0;
@@ -441,7 +439,7 @@
441439 timeout.tv_usec = 250000;
442440
443441 if (display) {
444- avrdude_message("drain>");
442+ avrdude_message(MSG_INFO, "drain>");
445443 }
446444
447445 while (1) {
@@ -452,7 +450,7 @@
452450 nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &timeout);
453451 if (nfds == 0) {
454452 if (display) {
455- avrdude_message("<drain\n");
453+ avrdude_message(MSG_INFO, "<drain\n");
456454 }
457455
458456 break;
@@ -462,7 +460,7 @@
462460 goto reselect;
463461 }
464462 else {
465- avrdude_message("%s: ser_drain(): select(): %s\n",
463+ avrdude_message(MSG_INFO, "%s: ser_drain(): select(): %s\n",
466464 progname, strerror(errno));
467465 return -1;
468466 }
@@ -470,12 +468,12 @@
470468
471469 rc = read(fd->ifd, &buf, 1);
472470 if (rc < 0) {
473- avrdude_message("%s: ser_drain(): read error: %s\n",
471+ avrdude_message(MSG_INFO, "%s: ser_drain(): read error: %s\n",
474472 progname, strerror(errno));
475473 return -1;
476474 }
477475 if (display) {
478- avrdude_message("%02x ", buf);
476+ avrdude_message(MSG_INFO, "%02x ", buf);
479477 }
480478 }
481479
--- trunk/avrdude/ser_win32.c (revision 1320)
+++ trunk/avrdude/ser_win32.c (revision 1321)
@@ -69,8 +69,7 @@
6969 * If a non-standard BAUD rate is used, issue
7070 * a warning (if we are verbose) and return the raw rate
7171 */
72- if (verbose > 0)
73- avrdude_message("%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
72+ avrdude_message(MSG_NOTICE, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
7473 progname, baud);
7574
7675 return baud;
@@ -123,7 +122,7 @@
123122 * This is curently not implemented for Win32.
124123 */
125124 if (strncmp(port, "net:", strlen("net:")) == 0) {
126- avrdude_message("%s: ser_open(): network connects are currently not"
125+ avrdude_message(MSG_INFO, "%s: ser_open(): network connects are currently not"
127126 "implemented for Win32 environments\n",
128127 progname);
129128 return -1;
@@ -135,7 +134,7 @@
135134 newname = malloc(strlen("\\\\.\\") + strlen(port) + 1);
136135
137136 if (newname == 0) {
138- avrdude_message("%s: ser_open(): out of memory\n",
137+ avrdude_message(MSG_INFO, "%s: ser_open(): out of memory\n",
139138 progname);
140139 exit(1);
141140 }
@@ -159,7 +158,7 @@
159158 (LPTSTR) &lpMsgBuf,
160159 0,
161160 NULL);
162- avrdude_message("%s: ser_open(): can't open device \"%s\": %s\n",
161+ avrdude_message(MSG_INFO, "%s: ser_open(): can't open device \"%s\": %s\n",
163162 progname, port, (char*)lpMsgBuf);
164163 LocalFree( lpMsgBuf );
165164 return -1;
@@ -168,7 +167,7 @@
168167 if (!SetupComm(hComPort, W32SERBUFSIZE, W32SERBUFSIZE))
169168 {
170169 CloseHandle(hComPort);
171- avrdude_message("%s: ser_open(): can't set buffers for \"%s\"\n",
170+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set buffers for \"%s\"\n",
172171 progname, port);
173172 return -1;
174173 }
@@ -177,7 +176,7 @@
177176 if (ser_setspeed(fdp, pinfo.baud) != 0)
178177 {
179178 CloseHandle(hComPort);
180- avrdude_message("%s: ser_open(): can't set com-state for \"%s\"\n",
179+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set com-state for \"%s\"\n",
181180 progname, port);
182181 return -1;
183182 }
@@ -185,7 +184,7 @@
185184 if (!serial_w32SetTimeOut(hComPort,0))
186185 {
187186 CloseHandle(hComPort);
188- avrdude_message("%s: ser_open(): can't set initial timeout for \"%s\"\n",
187+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set initial timeout for \"%s\"\n",
189188 progname, port);
190189 return -1;
191190 }
@@ -231,7 +230,7 @@
231230 HANDLE hComPort=(HANDLE)fd->pfd;
232231
233232 if (hComPort == INVALID_HANDLE_VALUE) {
234- avrdude_message("%s: ser_send(): port not open\n",
233+ avrdude_message(MSG_INFO, "%s: ser_send(): port not open\n",
235234 progname);
236235 return -1;
237236 }
@@ -241,33 +240,33 @@
241240
242241 if (verbose > 3)
243242 {
244- avrdude_message("%s: Send: ", progname);
243+ avrdude_message(MSG_TRACE, "%s: Send: ", progname);
245244
246245 while (len) {
247246 c = *b;
248247 if (isprint(c)) {
249- avrdude_message("%c ", c);
248+ avrdude_message(MSG_TRACE, "%c ", c);
250249 }
251250 else {
252- avrdude_message(". ");
251+ avrdude_message(MSG_TRACE, ". ");
253252 }
254- avrdude_message("[%02x] ", c);
253+ avrdude_message(MSG_TRACE, "[%02x] ", c);
255254 b++;
256255 len--;
257256 }
258- avrdude_message("\n");
257+ avrdude_message(MSG_INFO, "\n");
259258 }
260259
261260 serial_w32SetTimeOut(hComPort,500);
262261
263262 if (!WriteFile (hComPort, buf, buflen, &written, NULL)) {
264- avrdude_message("%s: ser_send(): write error: %s\n",
263+ avrdude_message(MSG_INFO, "%s: ser_send(): write error: %s\n",
265264 progname, "sorry no info avail"); // TODO
266265 return -1;
267266 }
268267
269268 if (written != buflen) {
270- avrdude_message("%s: ser_send(): size/send mismatch\n",
269+ avrdude_message(MSG_INFO, "%s: ser_send(): size/send mismatch\n",
271270 progname);
272271 return -1;
273272 }
@@ -285,7 +284,7 @@
285284 HANDLE hComPort=(HANDLE)fd->pfd;
286285
287286 if (hComPort == INVALID_HANDLE_VALUE) {
288- avrdude_message("%s: ser_read(): port not open\n",
287+ avrdude_message(MSG_INFO, "%s: ser_read(): port not open\n",
289288 progname);
290289 return -1;
291290 }
@@ -304,7 +303,7 @@
304303 (LPTSTR) &lpMsgBuf,
305304 0,
306305 NULL );
307- avrdude_message("%s: ser_recv(): read error: %s\n",
306+ avrdude_message(MSG_INFO, "%s: ser_recv(): read error: %s\n",
308307 progname, (char*)lpMsgBuf);
309308 LocalFree( lpMsgBuf );
310309 return -1;
@@ -312,8 +311,7 @@
312311
313312 /* time out detected */
314313 if (read == 0) {
315- if (verbose > 1)
316- avrdude_message("%s: ser_recv(): programmer is not responding\n",
314+ avrdude_message(MSG_NOTICE2, "%s: ser_recv(): programmer is not responding\n",
317315 progname);
318316 return -1;
319317 }
@@ -322,22 +320,22 @@
322320
323321 if (verbose > 3)
324322 {
325- avrdude_message("%s: Recv: ", progname);
323+ avrdude_message(MSG_TRACE, "%s: Recv: ", progname);
326324
327325 while (read) {
328326 c = *p;
329327 if (isprint(c)) {
330- avrdude_message("%c ", c);
328+ avrdude_message(MSG_TRACE, "%c ", c);
331329 }
332330 else {
333- avrdude_message(". ");
331+ avrdude_message(MSG_TRACE, ". ");
334332 }
335- avrdude_message("[%02x] ", c);
333+ avrdude_message(MSG_TRACE, "[%02x] ", c);
336334
337335 p++;
338336 read--;
339337 }
340- avrdude_message("\n");
338+ avrdude_message(MSG_INFO, "\n");
341339 }
342340 return 0;
343341 }
@@ -353,7 +351,7 @@
353351 HANDLE hComPort=(HANDLE)fd->pfd;
354352
355353 if (hComPort == INVALID_HANDLE_VALUE) {
356- avrdude_message("%s: ser_drain(): port not open\n",
354+ avrdude_message(MSG_INFO, "%s: ser_drain(): port not open\n",
357355 progname);
358356 return -1;
359357 }
@@ -361,7 +359,7 @@
361359 serial_w32SetTimeOut(hComPort,250);
362360
363361 if (display) {
364- avrdude_message("drain>");
362+ avrdude_message(MSG_INFO, "drain>");
365363 }
366364
367365 while (1) {
@@ -378,7 +376,7 @@
378376 (LPTSTR) &lpMsgBuf,
379377 0,
380378 NULL );
381- avrdude_message("%s: ser_drain(): read error: %s\n",
379+ avrdude_message(MSG_INFO, "%s: ser_drain(): read error: %s\n",
382380 progname, (char*)lpMsgBuf);
383381 LocalFree( lpMsgBuf );
384382 return -1;
@@ -385,10 +383,10 @@
385383 }
386384
387385 if (read) { // data avail
388- if (display) avrdude_message("%02x ", buf[0]);
386+ if (display) avrdude_message(MSG_INFO, "%02x ", buf[0]);
389387 }
390388 else { // no more data
391- if (display) avrdude_message("<drain\n");
389+ if (display) avrdude_message(MSG_INFO, "<drain\n");
392390 break;
393391 }
394392 } // while
--- trunk/avrdude/serbb_posix.c (revision 1320)
+++ trunk/avrdude/serbb_posix.c (revision 1321)
@@ -238,7 +238,7 @@
238238
239239 r = tcgetattr(pgm->fd.ifd, &mode);
240240 if (r < 0) {
241- avrdude_message("%s: ", port);
241+ avrdude_message(MSG_INFO, "%s: ", port);
242242 perror("tcgetattr");
243243 return(-1);
244244 }
@@ -252,7 +252,7 @@
252252
253253 r = tcsetattr(pgm->fd.ifd, TCSANOW, &mode);
254254 if (r < 0) {
255- avrdude_message("%s: ", port);
255+ avrdude_message(MSG_INFO, "%s: ", port);
256256 perror("tcsetattr");
257257 return(-1);
258258 }
@@ -261,7 +261,7 @@
261261 flags = fcntl(pgm->fd.ifd, F_GETFL, 0);
262262 if (flags == -1)
263263 {
264- avrdude_message("%s: Can not get flags: %s\n",
264+ avrdude_message(MSG_INFO, "%s: Can not get flags: %s\n",
265265 progname, strerror(errno));
266266 return(-1);
267267 }
@@ -268,7 +268,7 @@
268268 flags &= ~O_NONBLOCK;
269269 if (fcntl(pgm->fd.ifd, F_SETFL, flags) == -1)
270270 {
271- avrdude_message("%s: Can not clear nonblock flag: %s\n",
271+ avrdude_message(MSG_INFO, "%s: Can not clear nonblock flag: %s\n",
272272 progname, strerror(errno));
273273 return(-1);
274274 }
--- trunk/avrdude/serbb_win32.c (revision 1320)
+++ trunk/avrdude/serbb_win32.c (revision 1321)
@@ -97,13 +97,11 @@
9797 break;
9898
9999 default:
100- if (verbose)
101- avrdude_message("%s: serbb_setpin(): unknown pin %d\n",
100+ avrdude_message(MSG_NOTICE, "%s: serbb_setpin(): unknown pin %d\n",
102101 progname, pin + 1);
103102 return -1;
104103 }
105- if (verbose > 4)
106- avrdude_message("%s: serbb_setpin(): EscapeCommFunction(%s)\n",
104+ avrdude_message(MSG_TRACE2, "%s: serbb_setpin(): EscapeCommFunction(%s)\n",
107105 progname, name);
108106 if (!EscapeCommFunction(hComPort, dwFunc))
109107 {
@@ -117,7 +115,7 @@
117115 (LPTSTR) &lpMsgBuf,
118116 0,
119117 NULL);
120- avrdude_message("%s: serbb_setpin(): SetCommState() failed: %s\n",
118+ avrdude_message(MSG_INFO, "%s: serbb_setpin(): SetCommState() failed: %s\n",
121119 progname, (char *)lpMsgBuf);
122120 CloseHandle(hComPort);
123121 LocalFree(lpMsgBuf);
@@ -163,14 +161,13 @@
163161 (LPTSTR) &lpMsgBuf,
164162 0,
165163 NULL);
166- avrdude_message("%s: serbb_setpin(): GetCommModemStatus() failed: %s\n",
164+ avrdude_message(MSG_INFO, "%s: serbb_setpin(): GetCommModemStatus() failed: %s\n",
167165 progname, (char *)lpMsgBuf);
168166 CloseHandle(hComPort);
169167 LocalFree(lpMsgBuf);
170168 return -1;
171169 }
172- if (verbose > 4)
173- avrdude_message("%s: serbb_getpin(): GetCommState() => 0x%lx\n",
170+ avrdude_message(MSG_TRACE2, "%s: serbb_getpin(): GetCommState() => 0x%lx\n",
174171 progname, modemstate);
175172 switch (pin)
176173 {
@@ -206,13 +203,11 @@
206203 name = "RTS";
207204 break;
208205 default:
209- if (verbose)
210- avrdude_message("%s: serbb_getpin(): unknown pin %d\n",
206+ avrdude_message(MSG_NOTICE, "%s: serbb_getpin(): unknown pin %d\n",
211207 progname, pin + 1);
212208 return -1;
213209 }
214- if (verbose > 4)
215- avrdude_message("%s: serbb_getpin(): return cached state for %s\n",
210+ avrdude_message(MSG_TRACE2, "%s: serbb_getpin(): return cached state for %s\n",
216211 progname, name);
217212 if (invert)
218213 rv = !rv;
@@ -281,7 +276,7 @@
281276 (LPTSTR) &lpMsgBuf,
282277 0,
283278 NULL);
284- avrdude_message("%s: ser_open(): can't open device \"%s\": %s\n",
279+ avrdude_message(MSG_INFO, "%s: ser_open(): can't open device \"%s\": %s\n",
285280 progname, port, (char*)lpMsgBuf);
286281 LocalFree(lpMsgBuf);
287282 return -1;
@@ -290,7 +285,7 @@
290285 if (!SetupComm(hComPort, W32SERBUFSIZE, W32SERBUFSIZE))
291286 {
292287 CloseHandle(hComPort);
293- avrdude_message("%s: ser_open(): can't set buffers for \"%s\"\n",
288+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set buffers for \"%s\"\n",
294289 progname, port);
295290 return -1;
296291 }
@@ -309,12 +304,11 @@
309304 if (!SetCommState(hComPort, &dcb))
310305 {
311306 CloseHandle(hComPort);
312- avrdude_message("%s: ser_open(): can't set com-state for \"%s\"\n",
307+ avrdude_message(MSG_INFO, "%s: ser_open(): can't set com-state for \"%s\"\n",
313308 progname, port);
314309 return -1;
315310 }
316- if (verbose > 2)
317- avrdude_message("%s: ser_open(): opened comm port \"%s\", handle 0x%x\n",
311+ avrdude_message(MSG_DEBUG, "%s: ser_open(): opened comm port \"%s\", handle 0x%x\n",
318312 progname, port, (int)hComPort);
319313
320314 pgm->fd.pfd = (void *)hComPort;
@@ -332,8 +326,7 @@
332326 pgm->setpin(pgm, PIN_AVR_RESET, 1);
333327 CloseHandle (hComPort);
334328 }
335- if (verbose > 2)
336- avrdude_message("%s: ser_close(): closed comm port handle 0x%x\n",
329+ avrdude_message(MSG_DEBUG, "%s: ser_close(): closed comm port handle 0x%x\n",
337330 progname, (int)hComPort);
338331
339332 hComPort = INVALID_HANDLE_VALUE;
--- trunk/avrdude/stk500.c (revision 1320)
+++ trunk/avrdude/stk500.c (revision 1321)
@@ -71,7 +71,7 @@
7171
7272 rv = serial_recv(&pgm->fd, buf, len);
7373 if (rv < 0) {
74- avrdude_message("%s: stk500_recv(): programmer is not responding\n",
74+ avrdude_message(MSG_INFO, "%s: stk500_recv(): programmer is not responding\n",
7575 progname);
7676 return -1;
7777 }
@@ -110,7 +110,7 @@
110110 if (resp[0] == Resp_STK_INSYNC){
111111 break;
112112 }
113- avrdude_message("%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n",
113+ avrdude_message(MSG_INFO, "%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n",
114114 progname, attempt + 1, MAX_SYNC_ATTEMPTS, resp[0]);
115115 }
116116 if (attempt == MAX_SYNC_ATTEMPTS) {
@@ -121,7 +121,7 @@
121121 if (stk500_recv(pgm, resp, 1) < 0)
122122 return -1;
123123 if (resp[0] != Resp_STK_OK) {
124- avrdude_message("%s: stk500_getsync(): can't communicate with device: "
124+ avrdude_message(MSG_INFO, "%s: stk500_getsync(): can't communicate with device: "
125125 "resp=0x%02x\n",
126126 progname, resp[0]);
127127 return -1;
@@ -152,7 +152,7 @@
152152 if (stk500_recv(pgm, buf, 1) < 0)
153153 return -1;
154154 if (buf[0] != Resp_STK_INSYNC) {
155- avrdude_message("%s: stk500_cmd(): programmer is out of sync\n", progname);
155+ avrdude_message(MSG_INFO, "%s: stk500_cmd(): programmer is out of sync\n", progname);
156156 return -1;
157157 }
158158
@@ -165,7 +165,7 @@
165165 if (stk500_recv(pgm, buf, 1) < 0)
166166 return -1;
167167 if (buf[0] != Resp_STK_OK) {
168- avrdude_message("%s: stk500_cmd(): protocol error\n", progname);
168+ avrdude_message(MSG_INFO, "%s: stk500_cmd(): protocol error\n", progname);
169169 return -1;
170170 }
171171
@@ -183,7 +183,7 @@
183183 unsigned char res[4];
184184
185185 if (pgm->cmd == NULL) {
186- avrdude_message("%s: Error: %s programmer uses stk500_chip_erase() but does not\n"
186+ avrdude_message(MSG_INFO, "%s: Error: %s programmer uses stk500_chip_erase() but does not\n"
187187 "provide a cmd() method.\n",
188188 progname, pgm->type);
189189 return -1;
@@ -190,7 +190,7 @@
190190 }
191191
192192 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
193- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
193+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
194194 p->desc);
195195 return -1;
196196 }
@@ -229,7 +229,7 @@
229229 return -1;
230230 if (buf[0] == Resp_STK_NOSYNC) {
231231 if (tries > 33) {
232- avrdude_message("%s: stk500_program_enable(): can't get into sync\n",
232+ avrdude_message(MSG_INFO, "%s: stk500_program_enable(): can't get into sync\n",
233233 progname);
234234 return -1;
235235 }
@@ -238,7 +238,7 @@
238238 goto retry;
239239 }
240240 else if (buf[0] != Resp_STK_INSYNC) {
241- avrdude_message("%s: stk500_program_enable(): protocol error, "
241+ avrdude_message(MSG_INFO, "%s: stk500_program_enable(): protocol error, "
242242 "expect=0x%02x, resp=0x%02x\n",
243243 progname, Resp_STK_INSYNC, buf[0]);
244244 return -1;
@@ -250,7 +250,7 @@
250250 return 0;
251251 }
252252 else if (buf[0] == Resp_STK_NODEVICE) {
253- avrdude_message("%s: stk500_program_enable(): no device\n",
253+ avrdude_message(MSG_INFO, "%s: stk500_program_enable(): no device\n",
254254 progname);
255255 return -1;
256256 }
@@ -257,13 +257,13 @@
257257
258258 if(buf[0] == Resp_STK_FAILED)
259259 {
260- avrdude_message("%s: stk500_program_enable(): failed to enter programming mode\n",
260+ avrdude_message(MSG_INFO, "%s: stk500_program_enable(): failed to enter programming mode\n",
261261 progname);
262262 return -1;
263263 }
264264
265265
266- avrdude_message("%s: stk500_program_enable(): unknown response=0x%02x\n",
266+ avrdude_message(MSG_INFO, "%s: stk500_program_enable(): unknown response=0x%02x\n",
267267 progname, buf[0]);
268268
269269 return -1;
@@ -294,7 +294,7 @@
294294 return -1;
295295 if (buf[0] == Resp_STK_NOSYNC) {
296296 if (tries > 33) {
297- avrdude_message("%s: stk500_set_extended_parms(): can't get into sync\n",
297+ avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): can't get into sync\n",
298298 progname);
299299 return -1;
300300 }
@@ -303,7 +303,7 @@
303303 goto retry;
304304 }
305305 else if (buf[0] != Resp_STK_INSYNC) {
306- avrdude_message("%s: stk500_set_extended_parms(): protocol error, "
306+ avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): protocol error, "
307307 "expect=0x%02x, resp=0x%02x\n",
308308 progname, Resp_STK_INSYNC, buf[0]);
309309 return -1;
@@ -315,7 +315,7 @@
315315 return 0;
316316 }
317317 else if (buf[0] == Resp_STK_NODEVICE) {
318- avrdude_message("%s: stk500_set_extended_parms(): no device\n",
318+ avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): no device\n",
319319 progname);
320320 return -1;
321321 }
@@ -322,7 +322,7 @@
322322
323323 if(buf[0] == Resp_STK_FAILED)
324324 {
325- avrdude_message("%s: stk500_set_extended_parms(): failed to set extended "
325+ avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): failed to set extended "
326326 "device programming parameters\n",
327327 progname);
328328 return -1;
@@ -329,7 +329,7 @@
329329 }
330330
331331
332- avrdude_message("%s: stk500_set_extended_parms(): unknown response=0x%02x\n",
332+ avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): unknown response=0x%02x\n",
333333 progname, buf[0]);
334334
335335 return -1;
@@ -364,7 +364,7 @@
364364 return -1;
365365 if (buf[0] == Resp_STK_NOSYNC) {
366366 if (tries > 33) {
367- avrdude_message("%s: mib510_isp(): can't get into sync\n",
367+ avrdude_message(MSG_INFO, "%s: mib510_isp(): can't get into sync\n",
368368 progname);
369369 return -1;
370370 }
@@ -373,7 +373,7 @@
373373 goto retry;
374374 }
375375 else if (buf[0] != Resp_STK_INSYNC) {
376- avrdude_message("%s: mib510_isp(): protocol error, "
376+ avrdude_message(MSG_INFO, "%s: mib510_isp(): protocol error, "
377377 "expect=0x%02x, resp=0x%02x\n",
378378 progname, Resp_STK_INSYNC, buf[0]);
379379 return -1;
@@ -385,7 +385,7 @@
385385 return 0;
386386 }
387387 else if (buf[0] == Resp_STK_NODEVICE) {
388- avrdude_message("%s: mib510_isp(): no device\n",
388+ avrdude_message(MSG_INFO, "%s: mib510_isp(): no device\n",
389389 progname);
390390 return -1;
391391 }
@@ -392,13 +392,13 @@
392392
393393 if (buf[0] == Resp_STK_FAILED)
394394 {
395- avrdude_message("%s: mib510_isp(): command %d failed\n",
395+ avrdude_message(MSG_INFO, "%s: mib510_isp(): command %d failed\n",
396396 progname, cmd);
397397 return -1;
398398 }
399399
400400
401- avrdude_message("%s: mib510_isp(): unknown response=0x%02x\n",
401+ avrdude_message(MSG_INFO, "%s: mib510_isp(): unknown response=0x%02x\n",
402402 progname, buf[0]);
403403
404404 return -1;
@@ -459,7 +459,7 @@
459459 }
460460
461461 #if 0
462- avrdude_message("%s: stk500_initialize(): n_extparms = %d\n",
462+ avrdude_message(MSG_INFO, "%s: stk500_initialize(): n_extparms = %d\n",
463463 progname, n_extparms);
464464 #endif
465465
@@ -533,7 +533,7 @@
533533 if (stk500_recv(pgm, buf, 1) < 0)
534534 return -1;
535535 if (buf[0] == Resp_STK_NOSYNC) {
536- avrdude_message("%s: stk500_initialize(): programmer not in sync, resp=0x%02x\n",
536+ avrdude_message(MSG_INFO, "%s: stk500_initialize(): programmer not in sync, resp=0x%02x\n",
537537 progname, buf[0]);
538538 if (tries > 33)
539539 return -1;
@@ -542,7 +542,7 @@
542542 goto retry;
543543 }
544544 else if (buf[0] != Resp_STK_INSYNC) {
545- avrdude_message("%s: stk500_initialize(): (a) protocol error, "
545+ avrdude_message(MSG_INFO, "%s: stk500_initialize(): (a) protocol error, "
546546 "expect=0x%02x, resp=0x%02x\n",
547547 progname, Resp_STK_INSYNC, buf[0]);
548548 return -1;
@@ -551,7 +551,7 @@
551551 if (stk500_recv(pgm, buf, 1) < 0)
552552 return -1;
553553 if (buf[0] != Resp_STK_OK) {
554- avrdude_message("%s: stk500_initialize(): (b) protocol error, "
554+ avrdude_message(MSG_INFO, "%s: stk500_initialize(): (b) protocol error, "
555555 "expect=0x%02x, resp=0x%02x\n",
556556 progname, Resp_STK_OK, buf[0]);
557557 return -1;
@@ -559,8 +559,7 @@
559559
560560 if (n_extparms) {
561561 if ((p->pagel == 0) || (p->bs2 == 0)) {
562- if (verbose > 1)
563- avrdude_message("%s: PAGEL and BS2 signals not defined in the configuration "
562+ avrdude_message(MSG_NOTICE2, "%s: PAGEL and BS2 signals not defined in the configuration "
564563 "file for part %s, using dummy values\n",
565564 progname, p->desc);
566565 buf[2] = 0xD7; /* they look somehow possible, */
@@ -590,7 +589,7 @@
590589
591590 rc = stk500_set_extended_parms(pgm, n_extparms+1, buf);
592591 if (rc) {
593- avrdude_message("%s: stk500_initialize(): failed\n", progname);
592+ avrdude_message(MSG_INFO, "%s: stk500_initialize(): failed\n", progname);
594593 return -1;
595594 }
596595 }
@@ -616,7 +615,7 @@
616615 return;
617616 if (buf[0] == Resp_STK_NOSYNC) {
618617 if (tries > 33) {
619- avrdude_message("%s: stk500_disable(): can't get into sync\n",
618+ avrdude_message(MSG_INFO, "%s: stk500_disable(): can't get into sync\n",
620619 progname);
621620 return;
622621 }
@@ -625,7 +624,7 @@
625624 goto retry;
626625 }
627626 else if (buf[0] != Resp_STK_INSYNC) {
628- avrdude_message("%s: stk500_disable(): protocol error, expect=0x%02x, "
627+ avrdude_message(MSG_INFO, "%s: stk500_disable(): protocol error, expect=0x%02x, "
629628 "resp=0x%02x\n",
630629 progname, Resp_STK_INSYNC, buf[0]);
631630 return;
@@ -637,12 +636,12 @@
637636 return;
638637 }
639638 else if (buf[0] == Resp_STK_NODEVICE) {
640- avrdude_message("%s: stk500_disable(): no device\n",
639+ avrdude_message(MSG_INFO, "%s: stk500_disable(): no device\n",
641640 progname);
642641 return;
643642 }
644643
645- avrdude_message("%s: stk500_disable(): unknown response=0x%02x\n",
644+ avrdude_message(MSG_INFO, "%s: stk500_disable(): unknown response=0x%02x\n",
646645 progname, buf[0]);
647646
648647 return;
@@ -727,7 +726,7 @@
727726 return -1;
728727 if (buf[0] == Resp_STK_NOSYNC) {
729728 if (tries > 33) {
730- avrdude_message("%s: stk500_loadaddr(): can't get into sync\n",
729+ avrdude_message(MSG_INFO, "%s: stk500_loadaddr(): can't get into sync\n",
731730 progname);
732731 return -1;
733732 }
@@ -736,7 +735,7 @@
736735 goto retry;
737736 }
738737 else if (buf[0] != Resp_STK_INSYNC) {
739- avrdude_message("%s: stk500_loadaddr(): (a) protocol error, "
738+ avrdude_message(MSG_INFO, "%s: stk500_loadaddr(): (a) protocol error, "
740739 "expect=0x%02x, resp=0x%02x\n",
741740 progname, Resp_STK_INSYNC, buf[0]);
742741 return -1;
@@ -748,7 +747,7 @@
748747 return 0;
749748 }
750749
751- avrdude_message("%s: loadaddr(): (b) protocol error, "
750+ avrdude_message(MSG_INFO, "%s: loadaddr(): (b) protocol error, "
752751 "expect=0x%02x, resp=0x%02x\n",
753752 progname, Resp_STK_INSYNC, buf[0]);
754753
@@ -785,7 +784,7 @@
785784
786785 n = addr + n_bytes;
787786 #if 0
788- avrdude_message("n_bytes = %d\n"
787+ avrdude_message(MSG_INFO, "n_bytes = %d\n"
789788 "n = %u\n"
790789 "a_div = %d\n"
791790 "page_size = %d\n",
@@ -823,7 +822,7 @@
823822 return -1;
824823 if (buf[0] == Resp_STK_NOSYNC) {
825824 if (tries > 33) {
826- avrdude_message("\n%s: stk500_paged_write(): can't get into sync\n",
825+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): can't get into sync\n",
827826 progname);
828827 return -3;
829828 }
@@ -832,7 +831,7 @@
832831 goto retry;
833832 }
834833 else if (buf[0] != Resp_STK_INSYNC) {
835- avrdude_message("\n%s: stk500_paged_write(): (a) protocol error, "
834+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (a) protocol error, "
836835 "expect=0x%02x, resp=0x%02x\n",
837836 progname, Resp_STK_INSYNC, buf[0]);
838837 return -4;
@@ -841,7 +840,7 @@
841840 if (stk500_recv(pgm, buf, 1) < 0)
842841 return -1;
843842 if (buf[0] != Resp_STK_OK) {
844- avrdude_message("\n%s: stk500_paged_write(): (a) protocol error, "
843+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (a) protocol error, "
845844 "expect=0x%02x, resp=0x%02x\n",
846845 progname, Resp_STK_INSYNC, buf[0]);
847846 return -5;
@@ -904,7 +903,7 @@
904903 return -1;
905904 if (buf[0] == Resp_STK_NOSYNC) {
906905 if (tries > 33) {
907- avrdude_message("\n%s: stk500_paged_load(): can't get into sync\n",
906+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): can't get into sync\n",
908907 progname);
909908 return -3;
910909 }
@@ -913,7 +912,7 @@
913912 goto retry;
914913 }
915914 else if (buf[0] != Resp_STK_INSYNC) {
916- avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
915+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
917916 "expect=0x%02x, resp=0x%02x\n",
918917 progname, Resp_STK_INSYNC, buf[0]);
919918 return -4;
@@ -927,7 +926,7 @@
927926
928927 if(strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
929928 if (buf[0] != Resp_STK_INSYNC) {
930- avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
929+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
931930 "expect=0x%02x, resp=0x%02x\n",
932931 progname, Resp_STK_INSYNC, buf[0]);
933932 return -5;
@@ -935,7 +934,7 @@
935934 }
936935 else {
937936 if (buf[0] != Resp_STK_OK) {
938- avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
937+ avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
939938 "expect=0x%02x, resp=0x%02x\n",
940939 progname, Resp_STK_OK, buf[0]);
941940 return -5;
@@ -954,13 +953,13 @@
954953 utarg = (unsigned)((v + 0.049) * 10);
955954
956955 if (stk500_getparm(pgm, Parm_STK_VADJUST, &uaref) != 0) {
957- avrdude_message("%s: stk500_set_vtarget(): cannot obtain V[aref]\n",
956+ avrdude_message(MSG_INFO, "%s: stk500_set_vtarget(): cannot obtain V[aref]\n",
958957 progname);
959958 return -1;
960959 }
961960
962961 if (uaref > utarg) {
963- avrdude_message("%s: stk500_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
962+ avrdude_message(MSG_INFO, "%s: stk500_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
964963 progname, uaref / 10.0, v);
965964 if (stk500_setparm(pgm, Parm_STK_VADJUST, utarg)
966965 != 0)
@@ -978,13 +977,13 @@
978977 uaref = (unsigned)((v + 0.049) * 10);
979978
980979 if (stk500_getparm(pgm, Parm_STK_VTARGET, &utarg) != 0) {
981- avrdude_message("%s: stk500_set_varef(): cannot obtain V[target]\n",
980+ avrdude_message(MSG_INFO, "%s: stk500_set_varef(): cannot obtain V[target]\n",
982981 progname);
983982 return -1;
984983 }
985984
986985 if (uaref > utarg) {
987- avrdude_message("%s: stk500_set_varef(): V[aref] must not be greater than "
986+ avrdude_message(MSG_INFO, "%s: stk500_set_varef(): V[aref] must not be greater than "
988987 "V[target] = %.1f\n",
989988 progname, utarg / 10.0);
990989 return -1;
@@ -1013,7 +1012,7 @@
10131012 unit = "kHz";
10141013 } else
10151014 unit = "Hz";
1016- avrdude_message("%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
1015+ avrdude_message(MSG_INFO, "%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
10171016 progname, v, unit, STK500_XTAL / 2e6);
10181017 fosc = STK500_XTAL / 2;
10191018 } else
@@ -1028,7 +1027,7 @@
10281027 }
10291028 }
10301029 if (idx == sizeof(ps) / sizeof(ps[0])) {
1031- avrdude_message("%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
1030+ avrdude_message(MSG_INFO, "%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
10321031 progname, fosc, STK500_XTAL / (256 * 1024 * 2));
10331032 return -1;
10341033 }
@@ -1060,11 +1059,11 @@
10601059
10611060 if (v < min) {
10621061 dur = 1;
1063- avrdude_message("%s: stk500_set_sck_period(): p = %.1f us too small, using %.1f us\n",
1062+ avrdude_message(MSG_INFO, "%s: stk500_set_sck_period(): p = %.1f us too small, using %.1f us\n",
10641063 progname, v / 1e-6, dur * min / 1e-6);
10651064 } else if (v > max) {
10661065 dur = 255;
1067- avrdude_message("%s: stk500_set_sck_period(): p = %.1f us too large, using %.1f us\n",
1066+ avrdude_message(MSG_INFO, "%s: stk500_set_sck_period(): p = %.1f us too large, using %.1f us\n",
10681067 progname, v / 1e-6, dur * min / 1e-6);
10691068 }
10701069
@@ -1090,7 +1089,7 @@
10901089 return -1;
10911090 if (buf[0] == Resp_STK_NOSYNC) {
10921091 if (tries > 33) {
1093- avrdude_message("\n%s: stk500_getparm(): can't get into sync\n",
1092+ avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): can't get into sync\n",
10941093 progname);
10951094 return -1;
10961095 }
@@ -1099,7 +1098,7 @@
10991098 goto retry;
11001099 }
11011100 else if (buf[0] != Resp_STK_INSYNC) {
1102- avrdude_message("\n%s: stk500_getparm(): (a) protocol error, "
1101+ avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (a) protocol error, "
11031102 "expect=0x%02x, resp=0x%02x\n",
11041103 progname, Resp_STK_INSYNC, buf[0]);
11051104 return -2;
@@ -1112,12 +1111,12 @@
11121111 if (stk500_recv(pgm, buf, 1) < 0)
11131112 return -1;
11141113 if (buf[0] == Resp_STK_FAILED) {
1115- avrdude_message("\n%s: stk500_getparm(): parameter 0x%02x failed\n",
1114+ avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): parameter 0x%02x failed\n",
11161115 progname, v);
11171116 return -3;
11181117 }
11191118 else if (buf[0] != Resp_STK_OK) {
1120- avrdude_message("\n%s: stk500_getparm(): (a) protocol error, "
1119+ avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (a) protocol error, "
11211120 "expect=0x%02x, resp=0x%02x\n",
11221121 progname, Resp_STK_INSYNC, buf[0]);
11231122 return -3;
@@ -1147,7 +1146,7 @@
11471146 return -1;
11481147 if (buf[0] == Resp_STK_NOSYNC) {
11491148 if (tries > 33) {
1150- avrdude_message("\n%s: stk500_setparm(): can't get into sync\n",
1149+ avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): can't get into sync\n",
11511150 progname);
11521151 return -1;
11531152 }
@@ -1156,7 +1155,7 @@
11561155 goto retry;
11571156 }
11581157 else if (buf[0] != Resp_STK_INSYNC) {
1159- avrdude_message("\n%s: stk500_setparm(): (a) protocol error, "
1158+ avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, "
11601159 "expect=0x%02x, resp=0x%02x\n",
11611160 progname, Resp_STK_INSYNC, buf[0]);
11621161 return -2;
@@ -1171,12 +1170,12 @@
11711170 if (stk500_recv(pgm, buf, 1) < 0)
11721171 return -1;
11731172 if (buf[0] == Resp_STK_FAILED) {
1174- avrdude_message("\n%s: stk500_setparm(): parameter 0x%02x failed\n",
1173+ avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): parameter 0x%02x failed\n",
11751174 progname, parm);
11761175 return -3;
11771176 }
11781177 else {
1179- avrdude_message("\n%s: stk500_setparm(): (a) protocol error, "
1178+ avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, "
11801179 "expect=0x%02x, resp=0x%02x\n",
11811180 progname, Resp_STK_INSYNC, buf[0]);
11821181 return -3;
@@ -1193,8 +1192,8 @@
11931192 stk500_getparm(pgm, Parm_STK_SW_MINOR, &min);
11941193 stk500_getparm(pgm, Param_STK500_TOPCARD_DETECT, &topcard);
11951194
1196- avrdude_message("%sHardware Version: %d\n", p, hdw);
1197- avrdude_message("%sFirmware Version: %d.%d\n", p, maj, min);
1195+ avrdude_message(MSG_INFO, "%sHardware Version: %d\n", p, hdw);
1196+ avrdude_message(MSG_INFO, "%sFirmware Version: %d.%d\n", p, maj, min);
11981197 if (topcard < 3) {
11991198 const char *n = "Unknown";
12001199
@@ -1207,7 +1206,7 @@
12071206 n = "STK501";
12081207 break;
12091208 }
1210- avrdude_message("%sTopcard : %s\n", p, n);
1209+ avrdude_message(MSG_INFO, "%sTopcard : %s\n", p, n);
12111210 }
12121211 stk500_print_parms1(pgm, p);
12131212
@@ -1225,11 +1224,11 @@
12251224 stk500_getparm(pgm, Parm_STK_OSC_CMATCH, &osc_cmatch);
12261225 stk500_getparm(pgm, Parm_STK_SCK_DURATION, &sck_duration);
12271226
1228- avrdude_message("%sVtarget : %.1f V\n", p, vtarget / 10.0);
1229- avrdude_message("%sVaref : %.1f V\n", p, vadjust / 10.0);
1230- avrdude_message("%sOscillator : ", p);
1227+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, vtarget / 10.0);
1228+ avrdude_message(MSG_INFO, "%sVaref : %.1f V\n", p, vadjust / 10.0);
1229+ avrdude_message(MSG_INFO, "%sOscillator : ", p);
12311230 if (osc_pscale == 0)
1232- avrdude_message("Off\n");
1231+ avrdude_message(MSG_INFO, "Off\n");
12331232 else {
12341233 int prescale = 1;
12351234 double f = STK500_XTAL / 2;
@@ -1253,9 +1252,9 @@
12531252 unit = "kHz";
12541253 } else
12551254 unit = "Hz";
1256- avrdude_message("%.3f %s\n", f, unit);
1255+ avrdude_message(MSG_INFO, "%.3f %s\n", f, unit);
12571256 }
1258- avrdude_message("%sSCK period : %.1f us\n", p,
1257+ avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p,
12591258 sck_duration * 8.0e6 / STK500_XTAL + 0.05);
12601259
12611260 return;
@@ -1270,7 +1269,7 @@
12701269 static void stk500_setup(PROGRAMMER * pgm)
12711270 {
12721271 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
1273- avrdude_message("%s: stk500_setup(): Out of memory allocating private data\n",
1272+ avrdude_message(MSG_INFO, "%s: stk500_setup(): Out of memory allocating private data\n",
12741273 progname);
12751274 return;
12761275 }
--- trunk/avrdude/stk500generic.c (revision 1320)
+++ trunk/avrdude/stk500generic.c (revision 1321)
@@ -43,7 +43,7 @@
4343 stk500_initpgm(pgm);
4444 if (pgm->open(pgm, port) >= 0)
4545 {
46- avrdude_message("%s: successfully opened stk500v1 device -- please use -c stk500v1\n",
46+ avrdude_message(MSG_INFO, "%s: successfully opened stk500v1 device -- please use -c stk500v1\n",
4747 progname);
4848 return 0;
4949 }
@@ -53,12 +53,12 @@
5353 stk500v2_initpgm(pgm);
5454 if (pgm->open(pgm, port) >= 0)
5555 {
56- avrdude_message("%s: successfully opened stk500v2 device -- please use -c stk500v2\n",
56+ avrdude_message(MSG_INFO, "%s: successfully opened stk500v2 device -- please use -c stk500v2\n",
5757 progname);
5858 return 0;
5959 }
6060
61- avrdude_message("%s: cannot open either stk500v1 or stk500v2 programmer\n",
61+ avrdude_message(MSG_INFO, "%s: cannot open either stk500v1 or stk500v2 programmer\n",
6262 progname);
6363 return -1;
6464 }
--- trunk/avrdude/stk500v2.c (revision 1320)
+++ trunk/avrdude/stk500v2.c (revision 1321)
@@ -79,13 +79,13 @@
7979 #define RETRIES 5
8080
8181 #if 0
82-#define DEBUG(...) avrdude_message(__VA_ARGS__)
82+#define DEBUG(...) avrdude_message(MSG_INFO, __VA_ARGS__)
8383 #else
8484 #define DEBUG(...)
8585 #endif
8686
8787 #if 0
88-#define DEBUGRECV(...) avrdude_message(__VA_ARGS__)
88+#define DEBUGRECV(...) avrdude_message(MSG_INFO, __VA_ARGS__)
8989 #else
9090 #define DEBUGRECV(...)
9191 #endif
@@ -292,7 +292,7 @@
292292 void stk500v2_setup(PROGRAMMER * pgm)
293293 {
294294 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
295- avrdude_message("%s: stk500v2_setup(): Out of memory allocating private data\n",
295+ avrdude_message(MSG_INFO, "%s: stk500v2_setup(): Out of memory allocating private data\n",
296296 progname);
297297 exit(1);
298298 }
@@ -306,7 +306,7 @@
306306 void *mycookie, *theircookie;
307307
308308 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
309- avrdude_message("%s: stk500v2_setup(): Out of memory allocating private data\n",
309+ avrdude_message(MSG_INFO, "%s: stk500v2_setup(): Out of memory allocating private data\n",
310310 progname);
311311 exit(1);
312312 }
@@ -329,7 +329,7 @@
329329 void *mycookie, *theircookie;
330330
331331 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
332- avrdude_message("%s: stk500v2_setup(): Out of memory allocating private data\n",
332+ avrdude_message(MSG_INFO, "%s: stk500v2_setup(): Out of memory allocating private data\n",
333333 progname);
334334 exit(1);
335335 }
@@ -388,7 +388,7 @@
388388 static int stk500v2_send_mk2(PROGRAMMER * pgm, unsigned char * data, size_t len)
389389 {
390390 if (serial_send(&pgm->fd, data, len) != 0) {
391- avrdude_message("%s: stk500_send_mk2(): failed to send command to serial port\n",progname);
391+ avrdude_message(MSG_INFO, "%s: stk500_send_mk2(): failed to send command to serial port\n",progname);
392392 return -1;
393393 }
394394
@@ -421,7 +421,7 @@
421421
422422 sz = get_jtagisp_return_size(data[0]);
423423 if (sz == 0) {
424- avrdude_message("%s: unsupported encapsulated ISP command: %#x\n",
424+ avrdude_message(MSG_INFO, "%s: unsupported encapsulated ISP command: %#x\n",
425425 progname, data[0]);
426426 return -1;
427427 }
@@ -441,7 +441,7 @@
441441 }
442442
443443 if ((cmdbuf = malloc(len + 3)) == NULL) {
444- avrdude_message("%s: out of memory for command packet\n",
444+ avrdude_message(MSG_INFO, "%s: out of memory for command packet\n",
445445 progname);
446446 exit(1);
447447 }
@@ -468,7 +468,7 @@
468468 void *mycookie;
469469
470470 if ((cmdbuf = malloc(len + 1)) == NULL) {
471- avrdude_message("%s: out of memory for command packet\n",
471+ avrdude_message(MSG_INFO, "%s: out of memory for command packet\n",
472472 progname);
473473 exit(1);
474474 }
@@ -513,7 +513,7 @@
513513 DEBUG(", %d)\n",len+6);
514514
515515 if (serial_send(&pgm->fd, buf, len+6) != 0) {
516- avrdude_message("%s: stk500_send(): failed to send command to serial port\n",progname);
516+ avrdude_message(MSG_INFO, "%s: stk500_send(): failed to send command to serial port\n",progname);
517517 return -1;
518518 }
519519
@@ -533,7 +533,7 @@
533533
534534 rv = serial_recv(&pgm->fd, msg, maxsize);
535535 if (rv < 0) {
536- avrdude_message("%s: stk500v2_recv_mk2: error in USB receive\n", progname);
536+ avrdude_message(MSG_INFO, "%s: stk500v2_recv_mk2: error in USB receive\n", progname);
537537 return -1;
538538 }
539539
@@ -552,12 +552,12 @@
552552 rv = jtagmkII_recv(pgm, &jtagmsg);
553553 pgm->cookie = mycookie;
554554 if (rv <= 0) {
555- avrdude_message("%s: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()\n",
555+ avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()\n",
556556 progname);
557557 return -1;
558558 }
559559 if (rv - 1 > maxsize) {
560- avrdude_message("%s: stk500v2_jtagmkII_recv(): got %u bytes, have only room for %u bytes\n",
560+ avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): got %u bytes, have only room for %u bytes\n",
561561 progname, (unsigned)rv - 1, (unsigned)maxsize);
562562 rv = maxsize;
563563 }
@@ -565,15 +565,15 @@
565565 case RSP_SPI_DATA:
566566 break;
567567 case RSP_FAILED:
568- avrdude_message("%s: stk500v2_jtagmkII_recv(): failed\n",
568+ avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): failed\n",
569569 progname);
570570 return -1;
571571 case RSP_ILLEGAL_MCU_STATE:
572- avrdude_message("%s: stk500v2_jtagmkII_recv(): illegal MCU state\n",
572+ avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): illegal MCU state\n",
573573 progname);
574574 return -1;
575575 default:
576- avrdude_message("%s: stk500v2_jtagmkII_recv(): unknown status %d\n",
576+ avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): unknown status %d\n",
577577 progname, jtagmsg[0]);
578578 return -1;
579579 }
@@ -593,7 +593,7 @@
593593 rv = jtag3_recv(pgm, &jtagmsg);
594594 pgm->cookie = mycookie;
595595 if (rv <= 0) {
596- avrdude_message("%s: stk500v2_jtag3_recv(): error in jtagmkII_recv()\n",
596+ avrdude_message(MSG_INFO, "%s: stk500v2_jtag3_recv(): error in jtagmkII_recv()\n",
597597 progname);
598598 return -1;
599599 }
@@ -602,13 +602,12 @@
602602 octets from the ICE. Thus, only complain at high verbose
603603 levels. */
604604 if (rv - 1 > maxsize) {
605- if (verbose > 2)
606- avrdude_message("%s: stk500v2_jtag3_recv(): got %u bytes, have only room for %u bytes\n",
605+ avrdude_message(MSG_DEBUG, "%s: stk500v2_jtag3_recv(): got %u bytes, have only room for %u bytes\n",
607606 progname, (unsigned)rv - 1, (unsigned)maxsize);
608607 rv = maxsize;
609608 }
610609 if (jtagmsg[0] != SCOPE_AVR_ISP) {
611- avrdude_message("%s: stk500v2_jtag3_recv(): message is not AVR ISP: 0x%02x\n",
610+ avrdude_message(MSG_INFO, "%s: stk500v2_jtag3_recv(): message is not AVR ISP: 0x%02x\n",
612611 progname, jtagmsg[0]);
613612 free(jtagmsg);
614613 return -1;
@@ -688,12 +687,12 @@
688687 if (curlen < maxsize) {
689688 msg[curlen] = c;
690689 } else {
691- avrdude_message("%s: stk500v2_recv(): buffer too small, received %d byte into %u byte buffer\n",
690+ avrdude_message(MSG_INFO, "%s: stk500v2_recv(): buffer too small, received %d byte into %u byte buffer\n",
692691 progname,curlen,(unsigned int)maxsize);
693692 return -2;
694693 }
695694 if ((curlen == 0) && (msg[0] == ANSWER_CKSUM_ERROR)) {
696- avrdude_message("%s: stk500v2_recv(): previous packet sent with wrong checksum\n",
695+ avrdude_message(MSG_INFO, "%s: stk500v2_recv(): previous packet sent with wrong checksum\n",
697696 progname);
698697 return -3;
699698 }
@@ -705,13 +704,13 @@
705704 state = sDONE;
706705 } else {
707706 state = sSTART;
708- avrdude_message("%s: stk500v2_recv(): checksum error\n",
707+ avrdude_message(MSG_INFO, "%s: stk500v2_recv(): checksum error\n",
709708 progname);
710709 return -4;
711710 }
712711 break;
713712 default:
714- avrdude_message("%s: stk500v2_recv(): unknown state\n",
713+ avrdude_message(MSG_INFO, "%s: stk500v2_recv(): unknown state\n",
715714 progname);
716715 return -5;
717716 } /* switch */
@@ -720,7 +719,7 @@
720719 tnow = tv.tv_sec;
721720 if (tnow-tstart > timeoutval) { // wuff - signed/unsigned/overflow
722721 timedout:
723- avrdude_message("%s: stk500v2_ReceiveMessage(): timeout\n",
722+ avrdude_message(MSG_INFO, "%s: stk500v2_ReceiveMessage(): timeout\n",
724723 progname);
725724 return -1;
726725 }
@@ -774,19 +773,17 @@
774773 PDATA(pgm)->pgmtype = PGMTYPE_STK600;
775774 } else {
776775 resp[siglen + 3] = 0;
777- if (verbose)
778- avrdude_message("%s: stk500v2_getsync(): got response from unknown "
776+ avrdude_message(MSG_NOTICE, "%s: stk500v2_getsync(): got response from unknown "
779777 "programmer %s, assuming STK500\n",
780778 progname, resp + 3);
781779 PDATA(pgm)->pgmtype = PGMTYPE_STK500;
782780 }
783- if (verbose >= 3)
784- avrdude_message("%s: stk500v2_getsync(): found %s programmer\n",
781+ avrdude_message(MSG_DEBUG, "%s: stk500v2_getsync(): found %s programmer\n",
785782 progname, pgmname[PDATA(pgm)->pgmtype]);
786783 return 0;
787784 } else {
788785 if (tries > RETRIES) {
789- avrdude_message("%s: stk500v2_getsync(): can't communicate with device: resp=0x%02x\n",
786+ avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): can't communicate with device: resp=0x%02x\n",
790787 progname, resp[0]);
791788 return -6;
792789 } else
@@ -796,7 +793,7 @@
796793 // or if we got a timeout
797794 } else if (status == -1) {
798795 if (tries > RETRIES) {
799- avrdude_message("%s: stk500v2_getsync(): timeout communicating with programmer\n",
796+ avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): timeout communicating with programmer\n",
800797 progname);
801798 return -1;
802799 } else
@@ -805,7 +802,7 @@
805802 // or any other error
806803 } else {
807804 if (tries > RETRIES) {
808- avrdude_message("%s: stk500v2_getsync(): error communicating with programmer: (%d)\n",
805+ avrdude_message(MSG_INFO, "%s: stk500v2_getsync(): error communicating with programmer: (%d)\n",
809806 progname,status);
810807 } else
811808 goto retry;
@@ -836,7 +833,7 @@
836833 if (status > 0) {
837834 DEBUG(" = %d\n",status);
838835 if (status < 2) {
839- avrdude_message("%s: stk500v2_command(): short reply\n", progname);
836+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): short reply\n", progname);
840837 return -1;
841838 }
842839 if (buf[0] == CMD_XPROG_SETMODE || buf[0] == CMD_XPROG) {
@@ -860,7 +857,7 @@
860857 case XPRG_ERR_TIMEOUT: msg = "Timeout"; break;
861858 default: msg = "Unknown"; break;
862859 }
863- avrdude_message("%s: stk500v2_command(): error in %s: %s\n",
860+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): error in %s: %s\n",
864861 progname,
865862 (buf[0] == CMD_XPROG_SETMODE? "CMD_XPROG_SETMODE": "CMD_XPROG"),
866863 msg);
@@ -893,19 +890,19 @@
893890 break;
894891 }
895892 if (quell_progress < 2) {
896- avrdude_message("%s: stk500v2_command(): warning: %s\n",
893+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): warning: %s\n",
897894 progname, msg);
898895 }
899896 } else if (buf[1] == STATUS_CMD_OK) {
900897 return status;
901898 } else if (buf[1] == STATUS_CMD_FAILED) {
902- avrdude_message("%s: stk500v2_command(): command failed\n",
899+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): command failed\n",
903900 progname);
904901 } else if (buf[1] == STATUS_CMD_UNKNOWN) {
905- avrdude_message("%s: stk500v2_command(): unknown command\n",
902+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): unknown command\n",
906903 progname);
907904 } else {
908- avrdude_message("%s: stk500v2_command(): unknown status 0x%02x\n",
905+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): unknown status 0x%02x\n",
909906 progname, buf[1]);
910907 }
911908 return -1;
@@ -916,7 +913,7 @@
916913 status = stk500v2_getsync(pgm);
917914 if (status != 0) {
918915 if (tries > RETRIES) {
919- avrdude_message("%s: stk500v2_command(): failed miserably to execute command 0x%02x\n",
916+ avrdude_message(MSG_INFO, "%s: stk500v2_command(): failed miserably to execute command 0x%02x\n",
920917 progname,buf[0]);
921918 return -1;
922919 } else
@@ -946,11 +943,11 @@
946943
947944 result = stk500v2_command(pgm, buf, 8, sizeof(buf));
948945 if (result < 0) {
949- avrdude_message("%s: stk500v2_cmd(): failed to send command\n",
946+ avrdude_message(MSG_INFO, "%s: stk500v2_cmd(): failed to send command\n",
950947 progname);
951948 return -1;
952949 } else if (result < 6) {
953- avrdude_message("%s: stk500v2_cmd(): short reply, len = %d\n",
950+ avrdude_message(MSG_INFO, "%s: stk500v2_cmd(): short reply, len = %d\n",
954951 progname, result);
955952 return -1;
956953 }
@@ -967,7 +964,7 @@
967964 static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
968965 unsigned char *res)
969966 {
970- avrdude_message("%s: stk500v2_jtag3_cmd(): Not available in JTAGICE3\n",
967+ avrdude_message(MSG_INFO, "%s: stk500v2_jtag3_cmd(): Not available in JTAGICE3\n",
971968 progname);
972969
973970 return -1;
@@ -983,7 +980,7 @@
983980 unsigned char buf[16];
984981
985982 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
986- avrdude_message("%s: stk500v2_chip_erase: chip erase instruction not defined for part \"%s\"\n",
983+ avrdude_message(MSG_INFO, "%s: stk500v2_chip_erase: chip erase instruction not defined for part \"%s\"\n",
987984 progname, p->desc);
988985 return -1;
989986 }
@@ -1103,7 +1100,7 @@
11031100 PDATA(pgm)->lastpart = p;
11041101
11051102 if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
1106- avrdude_message("%s: stk500v2_program_enable(): program enable instruction not defined for part \"%s\"\n",
1103+ avrdude_message(MSG_INFO, "%s: stk500v2_program_enable(): program enable instruction not defined for part \"%s\"\n",
11071104 progname, p->desc);
11081105 return -1;
11091106 }
@@ -1134,11 +1131,11 @@
11341131 case PGMTYPE_STK600:
11351132 case PGMTYPE_AVRISP_MKII:
11361133 if (stk500v2_getparm(pgm, PARAM_STATUS_TGT_CONN, &buf[0]) != 0) {
1137- avrdude_message("%s: stk500v2_program_enable(): cannot get connection status\n",
1134+ avrdude_message(MSG_INFO, "%s: stk500v2_program_enable(): cannot get connection status\n",
11381135 progname);
11391136 } else {
11401137 stk500v2_translate_conn_status(buf[0], msg);
1141- avrdude_message("%s: stk500v2_program_enable():"
1138+ avrdude_message(MSG_INFO, "%s: stk500v2_program_enable():"
11421139 " bad AVRISPmkII connection status: %s\n",
11431140 progname, msg);
11441141 }
@@ -1151,8 +1148,7 @@
11511148 unsigned char cmd[4], *resp;
11521149
11531150 /* Try debugWIRE, and MONCON_DISABLE */
1154- if (verbose >= 2)
1155- avrdude_message("%s: No response in ISP mode, trying debugWIRE\n",
1151+ avrdude_message(MSG_NOTICE2, "%s: No response in ISP mode, trying debugWIRE\n",
11561152 progname);
11571153
11581154 mycookie = pgm->cookie;
@@ -1182,11 +1178,11 @@
11821178 }
11831179 pgm->cookie = mycookie;
11841180 if (tries++ > 3) {
1185- avrdude_message("%s: Failed to return from debugWIRE to ISP.\n",
1181+ avrdude_message(MSG_INFO, "%s: Failed to return from debugWIRE to ISP.\n",
11861182 progname);
11871183 break;
11881184 }
1189- avrdude_message("%s: Target prepared for ISP, signed off.\n"
1185+ avrdude_message(MSG_INFO, "%s: Target prepared for ISP, signed off.\n"
11901186 "%s: Now retrying without power-cycling the target.\n",
11911187 progname, progname);
11921188 goto retry;
@@ -1270,7 +1266,7 @@
12701266 AVRMEM *bootmem = avr_locate_mem(p, "boot");
12711267 AVRMEM *flashmem = avr_locate_mem(p, "flash");
12721268 if (bootmem == NULL || flashmem == NULL) {
1273- avrdude_message("%s: stk500v2_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
1269+ avrdude_message(MSG_INFO, "%s: stk500v2_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
12741270 progname);
12751271 } else {
12761272 PDATA(pgm)->boot_start = bootmem->offset - flashmem->offset;
@@ -1306,7 +1302,7 @@
13061302
13071303 if ((p->flags & AVRPART_HAS_PDI) ||
13081304 (p->flags & AVRPART_HAS_TPI)) {
1309- avrdude_message("%s: jtag3_initialize(): part %s has no ISP interface\n",
1305+ avrdude_message(MSG_INFO, "%s: jtag3_initialize(): part %s has no ISP interface\n",
13101306 progname, p->desc);
13111307 return -1;
13121308 }
@@ -1368,12 +1364,12 @@
13681364 free(PDATA(pgm)->flash_pagecache);
13691365 free(PDATA(pgm)->eeprom_pagecache);
13701366 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
1371- avrdude_message("%s: stk500hv_initialize(): Out of memory\n",
1367+ avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
13721368 progname);
13731369 return -1;
13741370 }
13751371 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
1376- avrdude_message("%s: stk500hv_initialize(): Out of memory\n",
1372+ avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
13771373 progname);
13781374 free(PDATA(pgm)->flash_pagecache);
13791375 return -1;
@@ -1395,7 +1391,7 @@
13951391 AVRMEM * m;
13961392
13971393 if (p->ctl_stack_type != (mode == PPMODE? CTL_STACK_PP: CTL_STACK_HVSP)) {
1398- avrdude_message("%s: stk500hv_initialize(): "
1394+ avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): "
13991395 "%s programming control stack not defined for part \"%s\"\n",
14001396 progname,
14011397 (mode == PPMODE? "parallel": "high-voltage serial"),
@@ -1409,7 +1405,7 @@
14091405 result = stk500v2_command(pgm, buf, CTL_STACK_SIZE + 1, sizeof(buf));
14101406
14111407 if (result < 0) {
1412- avrdude_message("%s: stk500hv_initalize(): "
1408+ avrdude_message(MSG_INFO, "%s: stk500hv_initalize(): "
14131409 "failed to set control stack\n",
14141410 progname);
14151411 return -1;
@@ -1439,12 +1435,12 @@
14391435 free(PDATA(pgm)->flash_pagecache);
14401436 free(PDATA(pgm)->eeprom_pagecache);
14411437 if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
1442- avrdude_message("%s: stk500hv_initialize(): Out of memory\n",
1438+ avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
14431439 progname);
14441440 return -1;
14451441 }
14461442 if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
1447- avrdude_message("%s: stk500hv_initialize(): Out of memory\n",
1443+ avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
14481444 progname);
14491445 free(PDATA(pgm)->flash_pagecache);
14501446 return -1;
@@ -1487,7 +1483,7 @@
14871483 result = stk500v2_command(pgm, buf, 3, sizeof(buf));
14881484
14891485 if (result < 0) {
1490- avrdude_message("%s: stk500v2_disable(): failed to leave programming mode\n",
1486+ avrdude_message(MSG_INFO, "%s: stk500v2_disable(): failed to leave programming mode\n",
14911487 progname);
14921488 }
14931489
@@ -1506,7 +1502,7 @@
15061502 result = stk500v2_command(pgm, buf, 3, sizeof(buf));
15071503
15081504 if (result < 0) {
1509- avrdude_message("%s: stk500v2_disable(): failed to leave programming mode\n",
1505+ avrdude_message(MSG_INFO, "%s: stk500v2_disable(): failed to leave programming mode\n",
15101506 progname);
15111507 }
15121508
@@ -1536,7 +1532,7 @@
15361532 result = stk500v2_command(pgm, buf, 3, sizeof(buf));
15371533
15381534 if (result < 0) {
1539- avrdude_message("%s: stk500hv_disable(): "
1535+ avrdude_message(MSG_INFO, "%s: stk500hv_disable(): "
15401536 "failed to leave programming mode\n",
15411537 progname);
15421538 }
@@ -1582,7 +1578,7 @@
15821578 serdev = &avrdoper_serdev;
15831579 PDATA(pgm)->pgmtype = PGMTYPE_STK500;
15841580 #else
1585- avrdude_message("avrdude was compiled without usb support.\n");
1581+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
15861582 return -1;
15871583 #endif
15881584 }
@@ -1606,7 +1602,7 @@
16061602 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
16071603 pgm->fd.usb.eep = 0; /* no seperate EP for events */
16081604 #else
1609- avrdude_message("avrdude was compiled without usb support.\n");
1605+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
16101606 return -1;
16111607 #endif
16121608 }
@@ -1664,7 +1660,7 @@
16641660 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_STK600;
16651661 pgm->fd.usb.eep = 0; /* no seperate EP for events */
16661662 #else
1667- avrdude_message("avrdude was compiled without usb support.\n");
1663+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
16681664 return -1;
16691665 #endif
16701666 }
@@ -1717,7 +1713,7 @@
17171713 result = stk500v2_command(pgm, buf, 5, sizeof(buf));
17181714
17191715 if (result < 0) {
1720- avrdude_message("%s: stk500v2_loadaddr(): failed to set load address\n",
1716+ avrdude_message(MSG_INFO, "%s: stk500v2_loadaddr(): failed to set load address\n",
17211717 progname);
17221718 return -1;
17231719 }
@@ -1739,8 +1735,7 @@
17391735 unsigned int pagesize = 0, use_ext_addr = 0, addrshift = 0;
17401736 unsigned char *cache_ptr = NULL;
17411737
1742- if (verbose >= 2)
1743- avrdude_message("%s: stk500hv_read_byte(.., %s, 0x%lx, ...)\n",
1738+ avrdude_message(MSG_NOTICE2, "%s: stk500hv_read_byte(.., %s, 0x%lx, ...)\n",
17441739 progname, mem->desc, addr);
17451740
17461741 if (strcmp(mem->desc, "flash") == 0) {
@@ -1813,14 +1808,13 @@
18131808 buf[1] = addr;
18141809 }
18151810
1816- if (verbose >= 2)
1817- avrdude_message("%s: stk500hv_read_byte(): Sending read memory command: ",
1811+ avrdude_message(MSG_NOTICE2, "%s: stk500hv_read_byte(): Sending read memory command: ",
18181812 progname);
18191813
18201814 result = stk500v2_command(pgm, buf, cmdlen, sizeof(buf));
18211815
18221816 if (result < 0) {
1823- avrdude_message("%s: stk500hv_read_byte(): "
1817+ avrdude_message(MSG_INFO, "%s: stk500hv_read_byte(): "
18241818 "timeout/error communicating with programmer\n",
18251819 progname);
18261820 return -1;
@@ -1871,8 +1865,7 @@
18711865 unsigned char *cache_ptr = NULL;
18721866 OPCODE *op;
18731867
1874- if (verbose >= 2)
1875- avrdude_message("%s: stk500isp_read_byte(.., %s, 0x%lx, ...)\n",
1868+ avrdude_message(MSG_NOTICE2, "%s: stk500isp_read_byte(.., %s, 0x%lx, ...)\n",
18761869 progname, mem->desc, addr);
18771870
18781871 if (strcmp(mem->desc, "flash") == 0 ||
@@ -1927,13 +1920,13 @@
19271920
19281921 memset(buf + 1, 0, 5);
19291922 if ((op = mem->op[AVR_OP_READ]) == NULL) {
1930- avrdude_message("%s: stk500isp_read_byte(): invalid operation AVR_OP_READ on %s memory\n",
1923+ avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): invalid operation AVR_OP_READ on %s memory\n",
19311924 progname, mem->desc);
19321925 return -1;
19331926 }
19341927 avr_set_bits(op, buf + 2);
19351928 if ((pollidx = avr_get_output_index(op)) == -1) {
1936- avrdude_message("%s: stk500isp_read_byte(): cannot determine pollidx to read %s memory\n",
1929+ avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): cannot determine pollidx to read %s memory\n",
19371930 progname, mem->desc);
19381931 pollidx = 3;
19391932 }
@@ -1940,14 +1933,13 @@
19401933 buf[1] = pollidx + 1;
19411934 avr_set_addr(op, buf + 2, addr);
19421935
1943- if (verbose >= 2)
1944- avrdude_message("%s: stk500isp_read_byte(): Sending read memory command: ",
1936+ avrdude_message(MSG_NOTICE2, "%s: stk500isp_read_byte(): Sending read memory command: ",
19451937 progname);
19461938
19471939 result = stk500v2_command(pgm, buf, 6, sizeof(buf));
19481940
19491941 if (result < 0) {
1950- avrdude_message("%s: stk500isp_read_byte(): "
1942+ avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): "
19511943 "timeout/error communicating with programmer\n",
19521944 progname);
19531945 return -1;
@@ -1971,8 +1963,7 @@
19711963 unsigned int pagesize = 0, use_ext_addr = 0, addrshift = 0;
19721964 unsigned char *cache_ptr = NULL;
19731965
1974- if (verbose >= 2)
1975- avrdude_message("%s: stk500hv_write_byte(.., %s, 0x%lx, ...)\n",
1966+ avrdude_message(MSG_NOTICE2, "%s: stk500hv_write_byte(.., %s, 0x%lx, ...)\n",
19761967 progname, mem->desc, addr);
19771968
19781969 if (strcmp(mem->desc, "flash") == 0) {
@@ -2020,7 +2011,7 @@
20202011 pulsewidth = p->programlockpulsewidth;
20212012 timeout = p->programlockpolltimeout;
20222013 } else {
2023- avrdude_message("%s: stk500hv_write_byte(): "
2014+ avrdude_message(MSG_INFO, "%s: stk500hv_write_byte(): "
20242015 "unsupported memory type: %s\n",
20252016 progname, mem->desc);
20262017 return -1;
@@ -2080,14 +2071,13 @@
20802071 }
20812072 }
20822073
2083- if (verbose >= 2)
2084- avrdude_message("%s: stk500hv_write_byte(): Sending write memory command: ",
2074+ avrdude_message(MSG_NOTICE2, "%s: stk500hv_write_byte(): Sending write memory command: ",
20852075 progname);
20862076
20872077 result = stk500v2_command(pgm, buf, cmdlen, sizeof(buf));
20882078
20892079 if (result < 0) {
2090- avrdude_message("%s: stk500hv_write_byte(): "
2080+ avrdude_message(MSG_INFO, "%s: stk500hv_write_byte(): "
20912081 "timeout/error communicating with programmer\n",
20922082 progname);
20932083 return -1;
@@ -2133,8 +2123,7 @@
21332123 unsigned char *cache_ptr = NULL;
21342124 OPCODE *op;
21352125
2136- if (verbose >= 2)
2137- avrdude_message("%s: stk500isp_write_byte(.., %s, 0x%lx, ...)\n",
2126+ avrdude_message(MSG_NOTICE2, "%s: stk500isp_write_byte(.., %s, 0x%lx, ...)\n",
21382127 progname, mem->desc, addr);
21392128
21402129 if (strcmp(mem->desc, "flash") == 0 ||
@@ -2186,7 +2175,7 @@
21862175 } else if (strcmp(mem->desc, "lock") == 0) {
21872176 buf[0] = CMD_PROGRAM_LOCK_ISP;
21882177 } else {
2189- avrdude_message("%s: stk500isp_write_byte(): "
2178+ avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): "
21902179 "unsupported memory type: %s\n",
21912180 progname, mem->desc);
21922181 return -1;
@@ -2193,7 +2182,7 @@
21932182 }
21942183
21952184 if ((op = mem->op[AVR_OP_WRITE]) == NULL) {
2196- avrdude_message("%s: stk500isp_write_byte(): "
2185+ avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): "
21972186 "no AVR_OP_WRITE for %s memory\n",
21982187 progname, mem->desc);
21992188 return -1;
@@ -2203,14 +2192,13 @@
22032192 avr_set_addr(op, buf + 1, addr);
22042193 avr_set_input(op, buf + 1, data);
22052194
2206- if (verbose >= 2)
2207- avrdude_message("%s: stk500isp_write_byte(): Sending write memory command: ",
2195+ avrdude_message(MSG_NOTICE2, "%s: stk500isp_write_byte(): Sending write memory command: ",
22082196 progname);
22092197
22102198 result = stk500v2_command(pgm, buf, 5, sizeof(buf));
22112199
22122200 if (result < 0) {
2213- avrdude_message("%s: stk500isp_write_byte(): "
2201+ avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): "
22142202 "timeout/error communicating with programmer\n",
22152203 progname);
22162204 return -1;
@@ -2284,7 +2272,7 @@
22842272 commandbuf[3] = m->mode | 0x80; // yes, write the page to flash
22852273
22862274 if (m->op[AVR_OP_LOADPAGE_LO] == NULL) {
2287- avrdude_message("%s: stk500v2_paged_write: loadpage instruction not defined for part \"%s\"\n",
2275+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_write: loadpage instruction not defined for part \"%s\"\n",
22882276 progname, p->desc);
22892277 return -1;
22902278 }
@@ -2292,7 +2280,7 @@
22922280 commandbuf[5] = cmds[0];
22932281
22942282 if (m->op[AVR_OP_WRITEPAGE] == NULL) {
2295- avrdude_message("%s: stk500v2_paged_write: write page instruction not defined for part \"%s\"\n",
2283+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_write: write page instruction not defined for part \"%s\"\n",
22962284 progname, p->desc);
22972285 return -1;
22982286 }
@@ -2305,7 +2293,7 @@
23052293 commandbuf[3] = m->mode | 0x80; // yes, write the words to flash
23062294
23072295 if (wop == NULL) {
2308- avrdude_message("%s: stk500v2_paged_write: write instruction not defined for part \"%s\"\n",
2296+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_write: write instruction not defined for part \"%s\"\n",
23092297 progname, p->desc);
23102298 return -1;
23112299 }
@@ -2316,7 +2304,7 @@
23162304
23172305 // the read command is common to both methods
23182306 if (rop == NULL) {
2319- avrdude_message("%s: stk500v2_paged_write: read instruction not defined for part \"%s\"\n",
2307+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_write: read instruction not defined for part \"%s\"\n",
23202308 progname, p->desc);
23212309 return -1;
23222310 }
@@ -2351,7 +2339,7 @@
23512339
23522340 result = stk500v2_command(pgm,buf,block_size+10, sizeof(buf));
23532341 if (result < 0) {
2354- avrdude_message("%s: stk500v2_paged_write: write command failed\n",
2342+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_write: write command failed\n",
23552343 progname);
23562344 return -1;
23572345 }
@@ -2446,7 +2434,7 @@
24462434
24472435 result = stk500v2_command(pgm, buf, page_size + 5, sizeof(buf));
24482436 if (result < 0) {
2449- avrdude_message("%s: stk500hv_paged_write: write command failed\n",
2437+ avrdude_message(MSG_INFO, "%s: stk500hv_paged_write: write command failed\n",
24502438 progname);
24512439 return -1;
24522440 }
@@ -2519,7 +2507,7 @@
25192507
25202508 // the read command is common to both methods
25212509 if (rop == NULL) {
2522- avrdude_message("%s: stk500v2_paged_load: read instruction not defined for part \"%s\"\n",
2510+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_load: read instruction not defined for part \"%s\"\n",
25232511 progname, p->desc);
25242512 return -1;
25252513 }
@@ -2548,14 +2536,14 @@
25482536
25492537 result = stk500v2_command(pgm,buf,4,sizeof(buf));
25502538 if (result < 0) {
2551- avrdude_message("%s: stk500v2_paged_load: read command failed\n",
2539+ avrdude_message(MSG_INFO, "%s: stk500v2_paged_load: read command failed\n",
25522540 progname);
25532541 return -1;
25542542 }
25552543 #if 0
25562544 for (i=0;i<page_size;i++) {
2557- avrdude_message("%02X",buf[2+i]);
2558- if (i%16 == 15) avrdude_message("\n");
2545+ avrdude_message(MSG_INFO, "%02X",buf[2+i]);
2546+ if (i%16 == 15) avrdude_message(MSG_INFO, "\n");
25592547 }
25602548 #endif
25612549
@@ -2628,14 +2616,14 @@
26282616
26292617 result = stk500v2_command(pgm, buf, 3, sizeof(buf));
26302618 if (result < 0) {
2631- avrdude_message("%s: stk500hv_paged_load: read command failed\n",
2619+ avrdude_message(MSG_INFO, "%s: stk500hv_paged_load: read command failed\n",
26322620 progname);
26332621 return -1;
26342622 }
26352623 #if 0
26362624 for (i = 0; i < page_size; i++) {
2637- avrdude_message("%02X", buf[2 + i]);
2638- if (i % 16 == 15) avrdude_message("\n");
2625+ avrdude_message(MSG_INFO, "%02X", buf[2 + i]);
2626+ if (i % 16 == 15) avrdude_message(MSG_INFO, "\n");
26392627 }
26402628 #endif
26412629
@@ -2669,7 +2657,7 @@
26692657 static int stk500v2_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
26702658 unsigned int addr)
26712659 {
2672- avrdude_message("%s: stk500v2_page_erase(): this function must never be called\n",
2660+ avrdude_message(MSG_INFO, "%s: stk500v2_page_erase(): this function must never be called\n",
26732661 progname);
26742662 return -1;
26752663 }
@@ -2681,13 +2669,13 @@
26812669 utarg = (unsigned)((v + 0.049) * 10);
26822670
26832671 if (stk500v2_getparm(pgm, PARAM_VADJUST, &uaref) != 0) {
2684- avrdude_message("%s: stk500v2_set_vtarget(): cannot obtain V[aref]\n",
2672+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): cannot obtain V[aref]\n",
26852673 progname);
26862674 return -1;
26872675 }
26882676
26892677 if (uaref > utarg) {
2690- avrdude_message("%s: stk500v2_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
2678+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
26912679 progname, uaref / 10.0, v);
26922680 if (stk500v2_setparm(pgm, PARAM_VADJUST, utarg)
26932681 != 0)
@@ -2705,13 +2693,13 @@
27052693 uaref = (unsigned)((v + 0.049) * 10);
27062694
27072695 if (stk500v2_getparm(pgm, PARAM_VTARGET, &utarg) != 0) {
2708- avrdude_message("%s: stk500v2_set_varef(): cannot obtain V[target]\n",
2696+ avrdude_message(MSG_INFO, "%s: stk500v2_set_varef(): cannot obtain V[target]\n",
27092697 progname);
27102698 return -1;
27112699 }
27122700
27132701 if (uaref > utarg) {
2714- avrdude_message("%s: stk500v2_set_varef(): V[aref] must not be greater than "
2702+ avrdude_message(MSG_INFO, "%s: stk500v2_set_varef(): V[aref] must not be greater than "
27152703 "V[target] = %.1f\n",
27162704 progname, utarg / 10.0);
27172705 return -1;
@@ -2741,7 +2729,7 @@
27412729 unit = "kHz";
27422730 } else
27432731 unit = "Hz";
2744- avrdude_message("%s: stk500v2_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
2732+ avrdude_message(MSG_INFO, "%s: stk500v2_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
27452733 progname, v, unit, STK500V2_XTAL / 2e6);
27462734 fosc = STK500V2_XTAL / 2;
27472735 } else
@@ -2756,7 +2744,7 @@
27562744 }
27572745 }
27582746 if (idx == sizeof(ps) / sizeof(ps[0])) {
2759- avrdude_message("%s: stk500v2_set_fosc(): f = %u Hz too low, %u Hz min\n",
2747+ avrdude_message(MSG_INFO, "%s: stk500v2_set_fosc(): f = %u Hz too low, %u Hz min\n",
27602748 progname, fosc, STK500V2_XTAL / (256 * 1024 * 2));
27612749 return -1;
27622750 }
@@ -2802,8 +2790,7 @@
28022790 break;
28032791 }
28042792
2805- if (verbose > 2)
2806- avrdude_message("Using p = %.2f us for SCK (param = %d)\n",
2793+ avrdude_message(MSG_NOTICE2, "Using p = %.2f us for SCK (param = %d)\n",
28072794 1000000 / avrispmkIIfreqs[i], i);
28082795
28092796 return stk500v2_setparm(pgm, PARAM_SCK_DURATION, i);
@@ -2826,7 +2813,7 @@
28262813 case 64: return 6u << 1;
28272814 case 128: return 7u << 1;
28282815 }
2829- avrdude_message("%s: stk500v2_mode_for_pagesize(): invalid pagesize: %u\n",
2816+ avrdude_message(MSG_INFO, "%s: stk500v2_mode_for_pagesize(): invalid pagesize: %u\n",
28302817 progname, pagesize);
28312818 return 0;
28322819 }
@@ -2895,13 +2882,13 @@
28952882 utarg = (unsigned)((v + 0.049) * 10);
28962883
28972884 if (stk500v2_getparm2(pgm, PARAM2_AREF0, &uaref) != 0) {
2898- avrdude_message("%s: stk500v2_set_vtarget(): cannot obtain V[aref][0]\n",
2885+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): cannot obtain V[aref][0]\n",
28992886 progname);
29002887 return -1;
29012888 }
29022889
29032890 if (uaref > (unsigned)utarg * 10) {
2904- avrdude_message("%s: stk500v2_set_vtarget(): reducing V[aref][0] from %.2f to %.1f\n",
2891+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): reducing V[aref][0] from %.2f to %.1f\n",
29052892 progname, uaref / 100.0, v);
29062893 uaref = 10 * (unsigned)utarg;
29072894 if (stk500v2_setparm2(pgm, PARAM2_AREF0, uaref)
@@ -2910,13 +2897,13 @@
29102897 }
29112898
29122899 if (stk500v2_getparm2(pgm, PARAM2_AREF1, &uaref) != 0) {
2913- avrdude_message("%s: stk500v2_set_vtarget(): cannot obtain V[aref][1]\n",
2900+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): cannot obtain V[aref][1]\n",
29142901 progname);
29152902 return -1;
29162903 }
29172904
29182905 if (uaref > (unsigned)utarg * 10) {
2919- avrdude_message("%s: stk500v2_set_vtarget(): reducing V[aref][1] from %.2f to %.1f\n",
2906+ avrdude_message(MSG_INFO, "%s: stk500v2_set_vtarget(): reducing V[aref][1] from %.2f to %.1f\n",
29202907 progname, uaref / 100.0, v);
29212908 uaref = 10 * (unsigned)utarg;
29222909 if (stk500v2_setparm2(pgm, PARAM2_AREF1, uaref)
@@ -2946,13 +2933,13 @@
29462933 uaref = (unsigned)((v + 0.0049) * 100);
29472934
29482935 if (stk500v2_getparm(pgm, PARAM_VTARGET, &utarg) != 0) {
2949- avrdude_message("%s: stk500v2_set_varef(): cannot obtain V[target]\n",
2936+ avrdude_message(MSG_INFO, "%s: stk500v2_set_varef(): cannot obtain V[target]\n",
29502937 progname);
29512938 return -1;
29522939 }
29532940
29542941 if (uaref > (unsigned)utarg * 10) {
2955- avrdude_message("%s: stk500v2_set_varef(): V[aref] must not be greater than "
2942+ avrdude_message(MSG_INFO, "%s: stk500v2_set_varef(): V[aref] must not be greater than "
29562943 "V[target] = %.1f\n",
29572944 progname, utarg / 10.0);
29582945 return -1;
@@ -2967,7 +2954,7 @@
29672954 return stk500v2_setparm2(pgm, PARAM2_AREF1, uaref);
29682955
29692956 default:
2970- avrdude_message("%s: stk500v2_set_varef(): invalid channel %d\n",
2957+ avrdude_message(MSG_INFO, "%s: stk500v2_set_varef(): invalid channel %d\n",
29712958 progname, chan);
29722959 return -1;
29732960 }
@@ -3027,7 +3014,7 @@
30273014 buf[1] = parm;
30283015
30293016 if (stk500v2_command(pgm, buf, 2, sizeof(buf)) < 0) {
3030- avrdude_message("%s: stk500v2_getparm(): failed to get parameter 0x%02x\n",
3017+ avrdude_message(MSG_INFO, "%s: stk500v2_getparm(): failed to get parameter 0x%02x\n",
30313018 progname, parm);
30323019 return -1;
30333020 }
@@ -3046,7 +3033,7 @@
30463033 buf[2] = value;
30473034
30483035 if (stk500v2_command(pgm, buf, 3, sizeof(buf)) < 0) {
3049- avrdude_message("\n%s: stk500v2_setparm(): failed to set parameter 0x%02x\n",
3036+ avrdude_message(MSG_INFO, "\n%s: stk500v2_setparm(): failed to set parameter 0x%02x\n",
30503037 progname, parm);
30513038 return -1;
30523039 }
@@ -3061,11 +3048,11 @@
30613048
30623049 res = stk500v2_getparm(pgm, parm, &current_value);
30633050 if (res < 0)
3064- avrdude_message("%s: Unable to get parameter 0x%02x\n", progname, parm);
3051+ avrdude_message(MSG_INFO, "%s: Unable to get parameter 0x%02x\n", progname, parm);
30653052
30663053 // don't issue a write if the correct value is already set.
3067- if (value == current_value && verbose > 2) {
3068- avrdude_message("%s: Skipping parameter write; parameter value already set.\n", progname);
3054+ if (value == current_value) {
3055+ avrdude_message(MSG_NOTICE2, "%s: Skipping parameter write; parameter value already set.\n", progname);
30693056 return 0;
30703057 }
30713058
@@ -3080,7 +3067,7 @@
30803067 buf[1] = parm;
30813068
30823069 if (stk500v2_command(pgm, buf, 2, sizeof(buf)) < 0) {
3083- avrdude_message("%s: stk500v2_getparm2(): failed to get parameter 0x%02x\n",
3070+ avrdude_message(MSG_INFO, "%s: stk500v2_getparm2(): failed to get parameter 0x%02x\n",
30843071 progname, parm);
30853072 return -1;
30863073 }
@@ -3100,7 +3087,7 @@
31003087 buf[3] = value;
31013088
31023089 if (stk500v2_command(pgm, buf, 4, sizeof(buf)) < 0) {
3103- avrdude_message("\n%s: stk500v2_setparm2(): failed to set parameter 0x%02x\n",
3090+ avrdude_message(MSG_INFO, "\n%s: stk500v2_setparm2(): failed to set parameter 0x%02x\n",
31043091 progname, parm);
31053092 return -1;
31063093 }
@@ -3141,19 +3128,19 @@
31413128 }
31423129 if (PDATA(pgm)->pgmtype != PGMTYPE_JTAGICE_MKII &&
31433130 PDATA(pgm)->pgmtype != PGMTYPE_JTAGICE3) {
3144- avrdude_message("%sProgrammer Model: %s\n", p, pgmname);
3131+ avrdude_message(MSG_INFO, "%sProgrammer Model: %s\n", p, pgmname);
31453132 stk500v2_getparm(pgm, PARAM_HW_VER, &hdw);
31463133 stk500v2_getparm(pgm, PARAM_SW_MAJOR, &maj);
31473134 stk500v2_getparm(pgm, PARAM_SW_MINOR, &min);
3148- avrdude_message("%sHardware Version: %d\n", p, hdw);
3149- avrdude_message("%sFirmware Version Master : %d.%02d\n", p, maj, min);
3135+ avrdude_message(MSG_INFO, "%sHardware Version: %d\n", p, hdw);
3136+ avrdude_message(MSG_INFO, "%sFirmware Version Master : %d.%02d\n", p, maj, min);
31503137 if (PDATA(pgm)->pgmtype == PGMTYPE_STK600) {
31513138 stk500v2_getparm(pgm, PARAM_SW_MAJOR_SLAVE1, &maj_s1);
31523139 stk500v2_getparm(pgm, PARAM_SW_MINOR_SLAVE1, &min_s1);
31533140 stk500v2_getparm(pgm, PARAM_SW_MAJOR_SLAVE2, &maj_s2);
31543141 stk500v2_getparm(pgm, PARAM_SW_MINOR_SLAVE2, &min_s2);
3155- avrdude_message("%sFirmware Version Slave 1: %d.%02d\n", p, maj_s1, min_s1);
3156- avrdude_message("%sFirmware Version Slave 2: %d.%02d\n", p, maj_s2, min_s2);
3142+ avrdude_message(MSG_INFO, "%sFirmware Version Slave 1: %d.%02d\n", p, maj_s1, min_s1);
3143+ avrdude_message(MSG_INFO, "%sFirmware Version Slave 2: %d.%02d\n", p, maj_s2, min_s2);
31573144 }
31583145 }
31593146
@@ -3168,22 +3155,22 @@
31683155 case 0xDD: topcard_name = "STK520"; break;
31693156 default: topcard_name = "Unknown"; break;
31703157 }
3171- avrdude_message("%sTopcard : %s\n", p, topcard_name);
3158+ avrdude_message(MSG_INFO, "%sTopcard : %s\n", p, topcard_name);
31723159 } else if (PDATA(pgm)->pgmtype == PGMTYPE_STK600) {
31733160 stk500v2_getparm(pgm, PARAM_ROUTINGCARD_ID, &topcard);
3174- avrdude_message("%sRouting card : %s\n", p,
3161+ avrdude_message(MSG_INFO, "%sRouting card : %s\n", p,
31753162 stk600_get_cardname(routing_cards,
31763163 sizeof routing_cards / sizeof routing_cards[0],
31773164 topcard));
31783165 stk500v2_getparm(pgm, PARAM_SOCKETCARD_ID, &topcard);
3179- avrdude_message("%sSocket card : %s\n", p,
3166+ avrdude_message(MSG_INFO, "%sSocket card : %s\n", p,
31803167 stk600_get_cardname(socket_cards,
31813168 sizeof socket_cards / sizeof socket_cards[0],
31823169 topcard));
31833170 stk500v2_getparm2(pgm, PARAM2_RC_ID_TABLE_REV, &rev);
3184- avrdude_message("%sRC_ID table rev : %d\n", p, rev);
3171+ avrdude_message(MSG_INFO, "%sRC_ID table rev : %d\n", p, rev);
31853172 stk500v2_getparm2(pgm, PARAM2_EC_ID_TABLE_REV, &rev);
3186- avrdude_message("%sEC_ID table rev : %d\n", p, rev);
3173+ avrdude_message(MSG_INFO, "%sEC_ID table rev : %d\n", p, rev);
31873174 }
31883175 stk500v2_print_parms1(pgm, p);
31893176
@@ -3220,7 +3207,7 @@
32203207 pgm->cookie = PDATA(pgm)->chained_pdata;
32213208 jtagmkII_getparm(pgm, PAR_OCD_VTARGET, vtarget_jtag);
32223209 pgm->cookie = mycookie;
3223- avrdude_message("%sVtarget : %.1f V\n", p,
3210+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
32243211 b2_to_u16(vtarget_jtag) / 1000.0);
32253212 } else if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE3) {
32263213 mycookie = pgm->cookie;
@@ -3227,12 +3214,12 @@
32273214 pgm->cookie = PDATA(pgm)->chained_pdata;
32283215 jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, vtarget_jtag, 2);
32293216 pgm->cookie = mycookie;
3230- avrdude_message("%sVtarget : %.1f V\n", p,
3217+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
32313218 b2_to_u16(vtarget_jtag) / 1000.0);
32323219
32333220 } else {
32343221 stk500v2_getparm(pgm, PARAM_VTARGET, &vtarget);
3235- avrdude_message("%sVtarget : %.1f V\n", p, vtarget / 10.0);
3222+ avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, vtarget / 10.0);
32363223 }
32373224
32383225 switch (PDATA(pgm)->pgmtype) {
@@ -3241,12 +3228,12 @@
32413228 stk500v2_getparm(pgm, PARAM_VADJUST, &vadjust);
32423229 stk500v2_getparm(pgm, PARAM_OSC_PSCALE, &osc_pscale);
32433230 stk500v2_getparm(pgm, PARAM_OSC_CMATCH, &osc_cmatch);
3244- avrdude_message("%sSCK period : %.1f us\n", p,
3231+ avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p,
32453232 stk500v2_sck_to_us(pgm, sck_duration));
3246- avrdude_message("%sVaref : %.1f V\n", p, vadjust / 10.0);
3247- avrdude_message("%sOscillator : ", p);
3233+ avrdude_message(MSG_INFO, "%sVaref : %.1f V\n", p, vadjust / 10.0);
3234+ avrdude_message(MSG_INFO, "%sOscillator : ", p);
32483235 if (osc_pscale == 0)
3249- avrdude_message("Off\n");
3236+ avrdude_message(MSG_INFO, "Off\n");
32503237 else {
32513238 prescale = 1;
32523239 f = STK500V2_XTAL / 2;
@@ -3262,7 +3249,7 @@
32623249 f /= prescale;
32633250 f /= (osc_cmatch + 1);
32643251 f = f_to_kHz_MHz(f, &unit);
3265- avrdude_message("%.3f %s\n", f, unit);
3252+ avrdude_message(MSG_INFO, "%.3f %s\n", f, unit);
32663253 }
32673254 break;
32683255
@@ -3269,7 +3256,7 @@
32693256 case PGMTYPE_AVRISP_MKII:
32703257 case PGMTYPE_JTAGICE_MKII:
32713258 stk500v2_getparm(pgm, PARAM_SCK_DURATION, &sck_duration);
3272- avrdude_message("%sSCK period : %.2f us\n", p,
3259+ avrdude_message(MSG_INFO, "%sSCK period : %.2f us\n", p,
32733260 (float) 1000000 / avrispmkIIfreqs[sck_duration]);
32743261 break;
32753262
@@ -3281,7 +3268,7 @@
32813268 if (stk500v2_jtag3_send(pgm, cmd, 1) >= 0 &&
32823269 stk500v2_jtag3_recv(pgm, cmd, 4) >= 2) {
32833270 unsigned int sck = cmd[1] | (cmd[2] << 8);
3284- avrdude_message("%sSCK period : %.2f us\n", p,
3271+ avrdude_message(MSG_INFO, "%sSCK period : %.2f us\n", p,
32853272 (float)(1E6 / (1000.0 * sck)));
32863273 }
32873274 }
@@ -3289,11 +3276,11 @@
32893276
32903277 case PGMTYPE_STK600:
32913278 stk500v2_getparm2(pgm, PARAM2_AREF0, &varef);
3292- avrdude_message("%sVaref 0 : %.2f V\n", p, varef / 100.0);
3279+ avrdude_message(MSG_INFO, "%sVaref 0 : %.2f V\n", p, varef / 100.0);
32933280 stk500v2_getparm2(pgm, PARAM2_AREF1, &varef);
3294- avrdude_message("%sVaref 1 : %.2f V\n", p, varef / 100.0);
3281+ avrdude_message(MSG_INFO, "%sVaref 1 : %.2f V\n", p, varef / 100.0);
32953282 stk500v2_getparm2(pgm, PARAM2_SCK_DURATION, &sck_stk600);
3296- avrdude_message("%sSCK period : %.2f us\n", p,
3283+ avrdude_message(MSG_INFO, "%sSCK period : %.2f us\n", p,
32973284 (float) (sck_stk600 + 1) / 8.0);
32983285 stk500v2_getparm2(pgm, PARAM2_CLOCK_CONF, &clock_conf);
32993286 oct = (clock_conf & 0xf000) >> 12u;
@@ -3300,12 +3287,12 @@
33003287 dac = (clock_conf & 0x0ffc) >> 2u;
33013288 f = pow(2, (double)oct) * 2078.0 / (2 - (double)dac / 1024.0);
33023289 f = f_to_kHz_MHz(f, &unit);
3303- avrdude_message("%sOscillator : %.3f %s\n",
3290+ avrdude_message(MSG_INFO, "%sOscillator : %.3f %s\n",
33043291 p, f, unit);
33053292 break;
33063293
33073294 default:
3308- avrdude_message("%sSCK period : %.1f us\n", p,
3295+ avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p,
33093296 sck_duration * 8.0e6 / STK500V2_XTAL + 0.05);
33103297 break;
33113298 }
@@ -3328,7 +3315,7 @@
33283315
33293316 rv = stk500v2_command(pgm, buf, 1, sizeof(buf));
33303317 if (rv < 0) {
3331- avrdude_message("%s: stk500v2_perform_osccal(): failed\n",
3318+ avrdude_message(MSG_INFO, "%s: stk500v2_perform_osccal(): failed\n",
33323319 progname);
33333320 return -1;
33343321 }
@@ -3352,8 +3339,7 @@
33523339 void *mycookie;
33533340 int rv;
33543341
3355- if (verbose >= 2)
3356- avrdude_message("%s: stk500v2_jtagmkII_open()\n", progname);
3342+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtagmkII_open()\n", progname);
33573343
33583344 /*
33593345 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -3380,7 +3366,7 @@
33803366 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
33813367 pgm->fd.usb.eep = 0; /* no seperate EP for events */
33823368 #else
3383- avrdude_message("avrdude was compiled without usb support.\n");
3369+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
33843370 return -1;
33853371 #endif
33863372 }
@@ -3399,7 +3385,7 @@
33993385 pgm->cookie = PDATA(pgm)->chained_pdata;
34003386 if ((rv = jtagmkII_getsync(pgm, EMULATOR_MODE_SPI)) != 0) {
34013387 if (rv != JTAGII_GETSYNC_FAIL_GRACEFUL)
3402- avrdude_message("%s: failed to sync with the JTAG ICE mkII in ISP mode\n",
3388+ avrdude_message(MSG_INFO, "%s: failed to sync with the JTAG ICE mkII in ISP mode\n",
34033389 progname);
34043390 pgm->cookie = mycookie;
34053391 return -1;
@@ -3424,8 +3410,7 @@
34243410 {
34253411 void *mycookie;
34263412
3427- if (verbose >= 2)
3428- avrdude_message("%s: stk500v2_jtagmkII_close()\n", progname);
3413+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtagmkII_close()\n", progname);
34293414
34303415 mycookie = pgm->cookie;
34313416 pgm->cookie = PDATA(pgm)->chained_pdata;
@@ -3441,8 +3426,7 @@
34413426 {
34423427 void *mycookie;
34433428
3444- if (verbose >= 2)
3445- avrdude_message("%s: stk500v2_jtag3_close()\n", progname);
3429+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtag3_close()\n", progname);
34463430
34473431 mycookie = pgm->cookie;
34483432 pgm->cookie = PDATA(pgm)->chained_pdata;
@@ -3466,8 +3450,7 @@
34663450 union pinfo pinfo;
34673451 void *mycookie;
34683452
3469- if (verbose >= 2)
3470- avrdude_message("%s: stk500v2_dragon_isp_open()\n", progname);
3453+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_dragon_isp_open()\n", progname);
34713454
34723455 /*
34733456 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -3494,7 +3477,7 @@
34943477 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
34953478 pgm->fd.usb.eep = 0; /* no seperate EP for events */
34963479 #else
3497- avrdude_message("avrdude was compiled without usb support.\n");
3480+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
34983481 return -1;
34993482 #endif
35003483 }
@@ -3512,7 +3495,7 @@
35123495 mycookie = pgm->cookie;
35133496 pgm->cookie = PDATA(pgm)->chained_pdata;
35143497 if (jtagmkII_getsync(pgm, EMULATOR_MODE_SPI) != 0) {
3515- avrdude_message("%s: failed to sync with the AVR Dragon in ISP mode\n",
3498+ avrdude_message(MSG_INFO, "%s: failed to sync with the AVR Dragon in ISP mode\n",
35163499 progname);
35173500 pgm->cookie = mycookie;
35183501 return -1;
@@ -3545,8 +3528,7 @@
35453528 union pinfo pinfo;
35463529 void *mycookie;
35473530
3548- if (verbose >= 2)
3549- avrdude_message("%s: stk500v2_dragon_hv_open()\n", progname);
3531+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_dragon_hv_open()\n", progname);
35503532
35513533 /*
35523534 * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
@@ -3573,7 +3555,7 @@
35733555 pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
35743556 pgm->fd.usb.eep = 0; /* no seperate EP for events */
35753557 #else
3576- avrdude_message("avrdude was compiled without usb support.\n");
3558+ avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
35773559 return -1;
35783560 #endif
35793561 }
@@ -3591,7 +3573,7 @@
35913573 mycookie = pgm->cookie;
35923574 pgm->cookie = PDATA(pgm)->chained_pdata;
35933575 if (jtagmkII_getsync(pgm, EMULATOR_MODE_HV) != 0) {
3594- avrdude_message("%s: failed to sync with the AVR Dragon in HV mode\n",
3576+ avrdude_message(MSG_INFO, "%s: failed to sync with the AVR Dragon in HV mode\n",
35953577 progname);
35963578 pgm->cookie = mycookie;
35973579 return -1;
@@ -3623,8 +3605,7 @@
36233605 void *mycookie;
36243606 int rv;
36253607
3626- if (verbose >= 2)
3627- avrdude_message("%s: stk500v2_jtag3_open()\n", progname);
3608+ avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtag3_open()\n", progname);
36283609
36293610 if (jtag3_open_common(pgm, port) < 0)
36303611 return -1;
@@ -3633,7 +3614,7 @@
36333614 pgm->cookie = PDATA(pgm)->chained_pdata;
36343615 if ((rv = jtag3_getsync(pgm, 42)) != 0) {
36353616 if (rv != JTAGII_GETSYNC_FAIL_GRACEFUL)
3636- avrdude_message("%s: failed to sync with the JTAGICE3 in ISP mode\n",
3617+ avrdude_message(MSG_INFO, "%s: failed to sync with the JTAGICE3 in ISP mode\n",
36373618 progname);
36383619 pgm->cookie = mycookie;
36393620 return -1;
@@ -3667,7 +3648,7 @@
36673648 s = cmdsize;
36683649
36693650 if ((newb = malloc(s + 1)) == 0) {
3670- avrdude_message("%s: stk600_xprog_cmd(): out of memory\n",
3651+ avrdude_message(MSG_INFO, "%s: stk600_xprog_cmd(): out of memory\n",
36713652 progname);
36723653 return -1;
36733654 }
@@ -3700,13 +3681,13 @@
37003681
37013682 if (!use_tpi) {
37023683 if (p->nvm_base == 0) {
3703- avrdude_message("%s: stk600_xprog_program_enable(): no nvm_base parameter for PDI device\n",
3684+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): no nvm_base parameter for PDI device\n",
37043685 progname);
37053686 return -1;
37063687 }
37073688 if ((mem = avr_locate_mem(p, "eeprom")) != NULL) {
37083689 if (mem->page_size == 0) {
3709- avrdude_message("%s: stk600_xprog_program_enable(): no EEPROM page_size parameter for PDI device\n",
3690+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): no EEPROM page_size parameter for PDI device\n",
37103691 progname);
37113692 return -1;
37123693 }
@@ -3717,7 +3698,7 @@
37173698 buf[0] = CMD_XPROG_SETMODE;
37183699 buf[1] = use_tpi? XPRG_MODE_TPI: XPRG_MODE_PDI;
37193700 if (stk500v2_command(pgm, buf, 2, sizeof(buf)) < 0) {
3720- avrdude_message("%s: stk600_xprog_program_enable(): CMD_XPROG_SETMODE(XPRG_MODE_%s) failed\n",
3701+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): CMD_XPROG_SETMODE(XPRG_MODE_%s) failed\n",
37213702 progname, use_tpi? "TPI": "PDI");
37223703 return -1;
37233704 }
@@ -3724,7 +3705,7 @@
37243705
37253706 buf[0] = XPRG_CMD_ENTER_PROGMODE;
37263707 if (stk600_xprog_command(pgm, buf, 1, 2) < 0) {
3727- avrdude_message("%s: stk600_xprog_program_enable(): XPRG_CMD_ENTER_PROGMODE failed\n",
3708+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): XPRG_CMD_ENTER_PROGMODE failed\n",
37283709 progname);
37293710 return -1;
37303711 }
@@ -3741,7 +3722,7 @@
37413722 buf[1] = XPRG_PARAM_TPI_3;
37423723 buf[2] = 51;
37433724 if (stk600_xprog_command(pgm, buf, 3, 2) < 0) {
3744- avrdude_message("%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_TPI_3) failed\n",
3725+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_TPI_3) failed\n",
37453726 progname);
37463727 return -1;
37473728 }
@@ -3750,7 +3731,7 @@
37503731 buf[1] = XPRG_PARAM_TPI_4;
37513732 buf[2] = 50;
37523733 if (stk600_xprog_command(pgm, buf, 3, 2) < 0) {
3753- avrdude_message("%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_TPI_4) failed\n",
3734+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_TPI_4) failed\n",
37543735 progname);
37553736 return -1;
37563737 }
@@ -3770,7 +3751,7 @@
37703751 buf[4] = nvm_base >> 8;
37713752 buf[5] = nvm_base;
37723753 if (stk600_xprog_command(pgm, buf, 6, 2) < 0) {
3773- avrdude_message("%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_NVMBASE) failed\n",
3754+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_NVMBASE) failed\n",
37743755 progname);
37753756 return -1;
37763757 }
@@ -3781,7 +3762,7 @@
37813762 buf[2] = eepagesize >> 8;
37823763 buf[3] = eepagesize;
37833764 if (stk600_xprog_command(pgm, buf, 4, 2) < 0) {
3784- avrdude_message("%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_EEPPAGESIZE) failed\n",
3765+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_enable(): XPRG_CMD_SET_PARAM(XPRG_PARAM_EEPPAGESIZE) failed\n",
37853766 progname);
37863767 return -1;
37873768 }
@@ -3806,7 +3787,7 @@
38063787
38073788 buf[0] = XPRG_CMD_LEAVE_PROGMODE;
38083789 if (stk600_xprog_command(pgm, buf, 1, 2) < 0) {
3809- avrdude_message("%s: stk600_xprog_program_disable(): XPRG_CMD_LEAVE_PROGMODE failed\n",
3790+ avrdude_message(MSG_INFO, "%s: stk600_xprog_program_disable(): XPRG_CMD_LEAVE_PROGMODE failed\n",
38103791 progname);
38113792 }
38123793 }
@@ -3843,7 +3824,7 @@
38433824 } else if (strcmp(mem->desc, "usersig") == 0) {
38443825 memcode = XPRG_MEM_TYPE_USERSIG;
38453826 } else {
3846- avrdude_message("%s: stk600_xprog_write_byte(): unknown memory \"%s\"\n",
3827+ avrdude_message(MSG_INFO, "%s: stk600_xprog_write_byte(): unknown memory \"%s\"\n",
38473828 progname, mem->desc);
38483829 return -1;
38493830 }
@@ -3857,7 +3838,7 @@
38573838 b[4] = mem->offset >> 8;
38583839 b[5] = mem->offset + 1;
38593840 if (stk600_xprog_command(pgm, b, 6, 2) < 0) {
3860- avrdude_message("%s: stk600_xprog_chip_erase(): XPRG_CMD_ERASE(XPRG_ERASE_CONFIG) failed\n",
3841+ avrdude_message(MSG_INFO, "%s: stk600_xprog_chip_erase(): XPRG_CMD_ERASE(XPRG_ERASE_CONFIG) failed\n",
38613842 progname);
38623843 return -1;
38633844 }
@@ -3884,7 +3865,7 @@
38843865 b[8] = write_size;
38853866 b[9] = data;
38863867 if (stk600_xprog_command(pgm, b, 9 + write_size, 2) < 0) {
3887- avrdude_message("%s: stk600_xprog_write_byte(): XPRG_CMD_WRITE_MEM failed\n",
3868+ avrdude_message(MSG_INFO, "%s: stk600_xprog_write_byte(): XPRG_CMD_WRITE_MEM failed\n",
38883869 progname);
38893870 return -1;
38903871 }
@@ -3917,7 +3898,7 @@
39173898 } else if (strcmp(mem->desc, "usersig") == 0) {
39183899 b[1] = XPRG_MEM_TYPE_USERSIG;
39193900 } else {
3920- avrdude_message("%s: stk600_xprog_read_byte(): unknown memory \"%s\"\n",
3901+ avrdude_message(MSG_INFO, "%s: stk600_xprog_read_byte(): unknown memory \"%s\"\n",
39213902 progname, mem->desc);
39223903 return -1;
39233904 }
@@ -3931,7 +3912,7 @@
39313912 b[6] = 0;
39323913 b[7] = 1;
39333914 if (stk600_xprog_command(pgm, b, 8, 3) < 0) {
3934- avrdude_message("%s: stk600_xprog_read_byte(): XPRG_CMD_READ_MEM failed\n",
3915+ avrdude_message(MSG_INFO, "%s: stk600_xprog_read_byte(): XPRG_CMD_READ_MEM failed\n",
39353916 progname);
39363917 return -1;
39373918 }
@@ -3991,7 +3972,7 @@
39913972 } else if (strcmp(mem->desc, "usersig") == 0) {
39923973 memtype = XPRG_MEM_TYPE_USERSIG;
39933974 } else {
3994- avrdude_message("%s: stk600_xprog_paged_load(): unknown paged memory \"%s\"\n",
3975+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_load(): unknown paged memory \"%s\"\n",
39953976 progname, mem->desc);
39963977 return -1;
39973978 }
@@ -3999,7 +3980,7 @@
39993980 addr += mem->offset;
40003981
40013982 if ((b = malloc(page_size + 2)) == NULL) {
4002- avrdude_message("%s: stk600_xprog_paged_load(): out of memory\n",
3983+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_load(): out of memory\n",
40033984 progname);
40043985 return -1;
40053986 }
@@ -4022,7 +4003,7 @@
40224003 b[6] = page_size >> 8;
40234004 b[7] = page_size;
40244005 if (stk600_xprog_command(pgm, b, 8, page_size + 2) < 0) {
4025- avrdude_message("%s: stk600_xprog_paged_load(): XPRG_CMD_READ_MEM failed\n",
4006+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_load(): XPRG_CMD_READ_MEM failed\n",
40264007 progname);
40274008 free(b);
40284009 return -1;
@@ -4057,7 +4038,7 @@
40574038 * transfer.
40584039 */
40594040 if (page_size > 512) {
4060- avrdude_message("%s: stk600_xprog_paged_write(): cannot handle page size > 512\n",
4041+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): cannot handle page size > 512\n",
40614042 progname);
40624043 return -1;
40634044 }
@@ -4105,7 +4086,7 @@
41054086 memtype = XPRG_MEM_TYPE_USERSIG;
41064087 writemode = (1 << XPRG_MEM_WRITE_WRITE);
41074088 } else {
4108- avrdude_message("%s: stk600_xprog_paged_write(): unknown paged memory \"%s\"\n",
4089+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): unknown paged memory \"%s\"\n",
41094090 progname, mem->desc);
41104091 return -1;
41114092 }
@@ -4113,7 +4094,7 @@
41134094 addr += mem->offset;
41144095
41154096 if ((b = malloc(page_size + 9)) == NULL) {
4116- avrdude_message("%s: stk600_xprog_paged_write(): out of memory\n",
4097+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): out of memory\n",
41174098 progname);
41184099 return -1;
41194100 }
@@ -4139,7 +4120,7 @@
41394120 * erase page / write page bits in the final chunk helps.
41404121 */
41414122 if (page_size % 256 != 0) {
4142- avrdude_message("%s: stk600_xprog_paged_write(): page size not multiple of 256\n",
4123+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): page size not multiple of 256\n",
41434124 progname);
41444125 free(b);
41454126 return -1;
@@ -4163,7 +4144,7 @@
41634144 b[8] = 0;
41644145 memcpy(b + 9, mem->buf + offset, writesize);
41654146 if (stk600_xprog_command(pgm, b, 256 + 9, 2) < 0) {
4166- avrdude_message("%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
4147+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
41674148 progname);
41684149 free(b);
41694150 return -1;
@@ -4197,7 +4178,7 @@
41974178 b[8] = page_size;
41984179 memcpy(b + 9, mem->buf + offset, writesize);
41994180 if (stk600_xprog_command(pgm, b, page_size + 9, 2) < 0) {
4200- avrdude_message("%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
4181+ avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
42014182 progname);
42024183 free(b);
42034184 return -1;
@@ -4223,7 +4204,7 @@
42234204
42244205 if (p->flags & AVRPART_HAS_TPI) {
42254206 if ((mem = avr_locate_mem(p, "flash")) == NULL) {
4226- avrdude_message("%s: stk600_xprog_chip_erase(): no FLASH definition found for TPI device\n",
4207+ avrdude_message(MSG_INFO, "%s: stk600_xprog_chip_erase(): no FLASH definition found for TPI device\n",
42274208 progname);
42284209 return -1;
42294210 }
@@ -4237,7 +4218,7 @@
42374218 b[4] = addr >> 8;
42384219 b[5] = addr;
42394220 if (stk600_xprog_command(pgm, b, 6, 2) < 0) {
4240- avrdude_message("%s: stk600_xprog_chip_erase(): XPRG_CMD_ERASE(XPRG_ERASE_CHIP) failed\n",
4221+ avrdude_message(MSG_INFO, "%s: stk600_xprog_chip_erase(): XPRG_CMD_ERASE(XPRG_ERASE_CHIP) failed\n",
42414222 progname);
42424223 return -1;
42434224 }
@@ -4262,7 +4243,7 @@
42624243 } else if (strcmp(m->desc, "usersig") == 0) {
42634244 b[1] = XPRG_ERASE_USERSIG;
42644245 } else {
4265- avrdude_message("%s: stk600_xprog_page_erase(): unknown paged memory \"%s\"\n",
4246+ avrdude_message(MSG_INFO, "%s: stk600_xprog_page_erase(): unknown paged memory \"%s\"\n",
42664247 progname, m->desc);
42674248 return -1;
42684249 }
@@ -4273,7 +4254,7 @@
42734254 b[4] = addr >> 8;
42744255 b[5] = addr;
42754256 if (stk600_xprog_command(pgm, b, 6, 2) < 0) {
4276- avrdude_message("%s: stk600_xprog_page_erase(): XPRG_CMD_ERASE(%d) failed\n",
4257+ avrdude_message(MSG_INFO, "%s: stk600_xprog_page_erase(): XPRG_CMD_ERASE(%d) failed\n",
42774258 progname, b[1]);
42784259 return -1;
42794260 }
--- trunk/avrdude/term.c (revision 1320)
+++ trunk/avrdude/term.c (revision 1321)
@@ -243,7 +243,7 @@
243243 int rc;
244244
245245 if (!((argc == 2) || (argc == 4))) {
246- avrdude_message("Usage: dump <memtype> [<addr> <len>]\n");
246+ avrdude_message(MSG_INFO, "Usage: dump <memtype> [<addr> <len>]\n");
247247 return -1;
248248 }
249249
@@ -258,7 +258,7 @@
258258
259259 mem = avr_locate_mem(p, memtype);
260260 if (mem == NULL) {
261- avrdude_message("\"%s\" memory type not defined for part \"%s\"\n",
261+ avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n",
262262 memtype, p->desc);
263263 return -1;
264264 }
@@ -266,7 +266,7 @@
266266 if (argc == 4) {
267267 addr = strtoul(argv[2], &e, 0);
268268 if (*e || (e == argv[2])) {
269- avrdude_message("%s (dump): can't parse address \"%s\"\n",
269+ avrdude_message(MSG_INFO, "%s (dump): can't parse address \"%s\"\n",
270270 progname, argv[2]);
271271 return -1;
272272 }
@@ -273,7 +273,7 @@
273273
274274 len = strtol(argv[3], &e, 0);
275275 if (*e || (e == argv[3])) {
276- avrdude_message("%s (dump): can't parse length \"%s\"\n",
276+ avrdude_message(MSG_INFO, "%s (dump): can't parse length \"%s\"\n",
277277 progname, argv[3]);
278278 return -1;
279279 }
@@ -287,7 +287,7 @@
287287 addr = 0;
288288 }
289289 else {
290- avrdude_message("%s (dump): address 0x%05lx is out of range for %s memory\n",
290+ avrdude_message(MSG_INFO, "%s (dump): address 0x%05lx is out of range for %s memory\n",
291291 progname, addr, mem->desc);
292292 return -1;
293293 }
@@ -299,7 +299,7 @@
299299
300300 buf = malloc(len);
301301 if (buf == NULL) {
302- avrdude_message("%s (dump): out of memory\n", progname);
302+ avrdude_message(MSG_INFO, "%s (dump): out of memory\n", progname);
303303 return -1;
304304 }
305305
@@ -306,10 +306,10 @@
306306 for (i=0; i<len; i++) {
307307 rc = pgm->read_byte(pgm, p, mem, addr+i, &buf[i]);
308308 if (rc != 0) {
309- avrdude_message("error reading %s address 0x%05lx of part %s\n",
309+ avrdude_message(MSG_INFO, "error reading %s address 0x%05lx of part %s\n",
310310 mem->desc, addr+i, p->desc);
311311 if (rc == -1)
312- avrdude_message("read operation not supported on memory type \"%s\"\n",
312+ avrdude_message(MSG_INFO, "read operation not supported on memory type \"%s\"\n",
313313 mem->desc);
314314 return -1;
315315 }
@@ -341,7 +341,7 @@
341341 AVRMEM * mem;
342342
343343 if (argc < 4) {
344- avrdude_message("Usage: write <memtype> <addr> <byte1> "
344+ avrdude_message(MSG_INFO, "Usage: write <memtype> <addr> <byte1> "
345345 "<byte2> ... byteN>\n");
346346 return -1;
347347 }
@@ -350,7 +350,7 @@
350350
351351 mem = avr_locate_mem(p, memtype);
352352 if (mem == NULL) {
353- avrdude_message("\"%s\" memory type not defined for part \"%s\"\n",
353+ avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n",
354354 memtype, p->desc);
355355 return -1;
356356 }
@@ -359,13 +359,13 @@
359359
360360 addr = strtoul(argv[2], &e, 0);
361361 if (*e || (e == argv[2])) {
362- avrdude_message("%s (write): can't parse address \"%s\"\n",
362+ avrdude_message(MSG_INFO, "%s (write): can't parse address \"%s\"\n",
363363 progname, argv[2]);
364364 return -1;
365365 }
366366
367367 if (addr > maxsize) {
368- avrdude_message("%s (write): address 0x%05lx is out of range for %s memory\n",
368+ avrdude_message(MSG_INFO, "%s (write): address 0x%05lx is out of range for %s memory\n",
369369 progname, addr, memtype);
370370 return -1;
371371 }
@@ -374,7 +374,7 @@
374374 len = argc - 3;
375375
376376 if ((addr + len) > maxsize) {
377- avrdude_message("%s (write): selected address and # bytes exceed "
377+ avrdude_message(MSG_INFO, "%s (write): selected address and # bytes exceed "
378378 "range for %s memory\n",
379379 progname, memtype);
380380 return -1;
@@ -382,7 +382,7 @@
382382
383383 buf = malloc(len);
384384 if (buf == NULL) {
385- avrdude_message("%s (write): out of memory\n", progname);
385+ avrdude_message(MSG_INFO, "%s (write): out of memory\n", progname);
386386 return -1;
387387 }
388388
@@ -389,7 +389,7 @@
389389 for (i=3; i<argc; i++) {
390390 buf[i-3] = strtoul(argv[i], &e, 0);
391391 if (*e || (e == argv[i])) {
392- avrdude_message("%s (write): can't parse byte \"%s\"\n",
392+ avrdude_message(MSG_INFO, "%s (write): can't parse byte \"%s\"\n",
393393 progname, argv[i]);
394394 free(buf);
395395 return -1;
@@ -401,10 +401,10 @@
401401
402402 rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]);
403403 if (rc) {
404- avrdude_message("%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n",
404+ avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n",
405405 progname, buf[i], addr+i, rc);
406406 if (rc == -1)
407- avrdude_message("write operation not supported on memory type \"%s\"\n",
407+ avrdude_message(MSG_INFO, "write operation not supported on memory type \"%s\"\n",
408408 mem->desc);
409409 werror = 1;
410410 }
@@ -411,7 +411,7 @@
411411
412412 rc = pgm->read_byte(pgm, p, mem, addr+i, &b);
413413 if (b != buf[i]) {
414- avrdude_message("%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n",
414+ avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n",
415415 progname, buf[i], addr+i, b);
416416 werror = 1;
417417 }
@@ -438,13 +438,13 @@
438438 int len;
439439
440440 if (pgm->cmd == NULL) {
441- avrdude_message("The %s programmer does not support direct ISP commands.\n",
441+ avrdude_message(MSG_INFO, "The %s programmer does not support direct ISP commands.\n",
442442 pgm->type);
443443 return -1;
444444 }
445445
446446 if (spi_mode && (pgm->spi == NULL)) {
447- avrdude_message("The %s programmer does not support direct SPI transfers.\n",
447+ avrdude_message(MSG_INFO, "The %s programmer does not support direct SPI transfers.\n",
448448 pgm->type);
449449 return -1;
450450 }
@@ -451,7 +451,7 @@
451451
452452
453453 if ((argc > 5) || ((argc < 5) && (!spi_mode))) {
454- avrdude_message(spi_mode?
454+ avrdude_message(MSG_INFO, spi_mode?
455455 "Usage: send <byte1> [<byte2> [<byte3> [<byte4>]]]\n":
456456 "Usage: send <byte1> <byte2> <byte3> <byte4>\n");
457457 return -1;
@@ -464,7 +464,7 @@
464464 for (i=1; i<argc; i++) {
465465 cmd[i-1] = strtoul(argv[i], &e, 0);
466466 if (*e || (e == argv[i])) {
467- avrdude_message("%s (send): can't parse byte \"%s\"\n",
467+ avrdude_message(MSG_INFO, "%s (send): can't parse byte \"%s\"\n",
468468 progname, argv[i]);
469469 return -1;
470470 }
@@ -480,10 +480,10 @@
480480 /*
481481 * display results
482482 */
483- avrdude_message("results:");
483+ avrdude_message(MSG_INFO, "results:");
484484 for (i=0; i<len; i++)
485- avrdude_message(" %02x", res[i]);
486- avrdude_message("\n");
485+ avrdude_message(MSG_INFO, " %02x", res[i]);
486+ avrdude_message(MSG_INFO, "\n");
487487
488488 fprintf(stdout, "\n");
489489
@@ -494,7 +494,7 @@
494494 static int cmd_erase(PROGRAMMER * pgm, struct avrpart * p,
495495 int argc, char * argv[])
496496 {
497- avrdude_message("%s: erasing chip\n", progname);
497+ avrdude_message(MSG_INFO, "%s: erasing chip\n", progname);
498498 pgm->chip_erase(pgm, p);
499499 return 0;
500500 }
@@ -520,13 +520,13 @@
520520
521521 rc = avr_signature(pgm, p);
522522 if (rc != 0) {
523- avrdude_message("error reading signature data, rc=%d\n",
523+ avrdude_message(MSG_INFO, "error reading signature data, rc=%d\n",
524524 rc);
525525 }
526526
527527 m = avr_locate_mem(p, "signature");
528528 if (m == NULL) {
529- avrdude_message("signature data not defined for device \"%s\"\n",
529+ avrdude_message(MSG_INFO, "signature data not defined for device \"%s\"\n",
530530 p->desc);
531531 }
532532 else {
@@ -551,7 +551,7 @@
551551 int argc, char * argv[])
552552 {
553553 if (pgm->print_parms == NULL) {
554- avrdude_message("%s (parms): the %s programmer does not support "
554+ avrdude_message(MSG_INFO, "%s (parms): the %s programmer does not support "
555555 "adjustable parameters\n",
556556 progname, pgm->type);
557557 return -1;
@@ -570,22 +570,22 @@
570570 char *endp;
571571
572572 if (argc != 2) {
573- avrdude_message("Usage: vtarg <value>\n");
573+ avrdude_message(MSG_INFO, "Usage: vtarg <value>\n");
574574 return -1;
575575 }
576576 v = strtod(argv[1], &endp);
577577 if (endp == argv[1]) {
578- avrdude_message("%s (vtarg): can't parse voltage \"%s\"\n",
578+ avrdude_message(MSG_INFO, "%s (vtarg): can't parse voltage \"%s\"\n",
579579 progname, argv[1]);
580580 return -1;
581581 }
582582 if (pgm->set_vtarget == NULL) {
583- avrdude_message("%s (vtarg): the %s programmer cannot set V[target]\n",
583+ avrdude_message(MSG_INFO, "%s (vtarg): the %s programmer cannot set V[target]\n",
584584 progname, pgm->type);
585585 return -2;
586586 }
587587 if ((rc = pgm->set_vtarget(pgm, v)) != 0) {
588- avrdude_message("%s (vtarg): failed to set V[target] (rc = %d)\n",
588+ avrdude_message(MSG_INFO, "%s (vtarg): failed to set V[target] (rc = %d)\n",
589589 progname, rc);
590590 return -3;
591591 }
@@ -601,7 +601,7 @@
601601 char *endp;
602602
603603 if (argc != 2) {
604- avrdude_message("Usage: fosc <value>[M|k] | off\n");
604+ avrdude_message(MSG_INFO, "Usage: fosc <value>[M|k] | off\n");
605605 return -1;
606606 }
607607 v = strtod(argv[1], &endp);
@@ -609,7 +609,7 @@
609609 if (strcmp(argv[1], "off") == 0)
610610 v = 0.0;
611611 else {
612- avrdude_message("%s (fosc): can't parse frequency \"%s\"\n",
612+ avrdude_message(MSG_INFO, "%s (fosc): can't parse frequency \"%s\"\n",
613613 progname, argv[1]);
614614 return -1;
615615 }
@@ -619,12 +619,12 @@
619619 else if (*endp == 'k' || *endp == 'K')
620620 v *= 1e3;
621621 if (pgm->set_fosc == NULL) {
622- avrdude_message("%s (fosc): the %s programmer cannot set oscillator frequency\n",
622+ avrdude_message(MSG_INFO, "%s (fosc): the %s programmer cannot set oscillator frequency\n",
623623 progname, pgm->type);
624624 return -2;
625625 }
626626 if ((rc = pgm->set_fosc(pgm, v)) != 0) {
627- avrdude_message("%s (fosc): failed to set oscillator_frequency (rc = %d)\n",
627+ avrdude_message(MSG_INFO, "%s (fosc): failed to set oscillator_frequency (rc = %d)\n",
628628 progname, rc);
629629 return -3;
630630 }
@@ -640,23 +640,23 @@
640640 char *endp;
641641
642642 if (argc != 2) {
643- avrdude_message("Usage: sck <value>\n");
643+ avrdude_message(MSG_INFO, "Usage: sck <value>\n");
644644 return -1;
645645 }
646646 v = strtod(argv[1], &endp);
647647 if (endp == argv[1]) {
648- avrdude_message("%s (sck): can't parse period \"%s\"\n",
648+ avrdude_message(MSG_INFO, "%s (sck): can't parse period \"%s\"\n",
649649 progname, argv[1]);
650650 return -1;
651651 }
652652 v *= 1e-6; /* Convert from microseconds to seconds. */
653653 if (pgm->set_sck_period == NULL) {
654- avrdude_message("%s (sck): the %s programmer cannot set SCK period\n",
654+ avrdude_message(MSG_INFO, "%s (sck): the %s programmer cannot set SCK period\n",
655655 progname, pgm->type);
656656 return -2;
657657 }
658658 if ((rc = pgm->set_sck_period(pgm, v)) != 0) {
659- avrdude_message("%s (sck): failed to set SCK period (rc = %d)\n",
659+ avrdude_message(MSG_INFO, "%s (sck): failed to set SCK period (rc = %d)\n",
660660 progname, rc);
661661 return -3;
662662 }
@@ -673,7 +673,7 @@
673673 char *endp;
674674
675675 if (argc != 2 && argc != 3) {
676- avrdude_message("Usage: varef [channel] <value>\n");
676+ avrdude_message(MSG_INFO, "Usage: varef [channel] <value>\n");
677677 return -1;
678678 }
679679 if (argc == 2) {
@@ -680,7 +680,7 @@
680680 chan = 0;
681681 v = strtod(argv[1], &endp);
682682 if (endp == argv[1]) {
683- avrdude_message("%s (varef): can't parse voltage \"%s\"\n",
683+ avrdude_message(MSG_INFO, "%s (varef): can't parse voltage \"%s\"\n",
684684 progname, argv[1]);
685685 return -1;
686686 }
@@ -687,24 +687,24 @@
687687 } else {
688688 chan = strtoul(argv[1], &endp, 10);
689689 if (endp == argv[1]) {
690- avrdude_message("%s (varef): can't parse channel \"%s\"\n",
690+ avrdude_message(MSG_INFO, "%s (varef): can't parse channel \"%s\"\n",
691691 progname, argv[1]);
692692 return -1;
693693 }
694694 v = strtod(argv[2], &endp);
695695 if (endp == argv[2]) {
696- avrdude_message("%s (varef): can't parse voltage \"%s\"\n",
696+ avrdude_message(MSG_INFO, "%s (varef): can't parse voltage \"%s\"\n",
697697 progname, argv[2]);
698698 return -1;
699699 }
700700 }
701701 if (pgm->set_varef == NULL) {
702- avrdude_message("%s (varef): the %s programmer cannot set V[aref]\n",
702+ avrdude_message(MSG_INFO, "%s (varef): the %s programmer cannot set V[aref]\n",
703703 progname, pgm->type);
704704 return -2;
705705 }
706706 if ((rc = pgm->set_varef(pgm, chan, v)) != 0) {
707- avrdude_message("%s (varef): failed to set V[aref] (rc = %d)\n",
707+ avrdude_message(MSG_INFO, "%s (varef): failed to set V[aref] (rc = %d)\n",
708708 progname, rc);
709709 return -3;
710710 }
@@ -754,26 +754,26 @@
754754 char *endp;
755755
756756 if (argc != 1 && argc != 2) {
757- avrdude_message("Usage: verbose [<value>]\n");
757+ avrdude_message(MSG_INFO, "Usage: verbose [<value>]\n");
758758 return -1;
759759 }
760760 if (argc == 1) {
761- avrdude_message("Verbosity level: %d\n", verbose);
761+ avrdude_message(MSG_INFO, "Verbosity level: %d\n", verbose);
762762 return 0;
763763 }
764764 nverb = strtol(argv[1], &endp, 0);
765765 if (endp == argv[2]) {
766- avrdude_message("%s: can't parse verbosity level \"%s\"\n",
766+ avrdude_message(MSG_INFO, "%s: can't parse verbosity level \"%s\"\n",
767767 progname, argv[2]);
768768 return -1;
769769 }
770770 if (nverb < 0) {
771- avrdude_message("%s: verbosity level must be positive: %d\n",
771+ avrdude_message(MSG_INFO, "%s: verbosity level must be positive: %d\n",
772772 progname, nverb);
773773 return -1;
774774 }
775775 verbose = nverb;
776- avrdude_message("New verbosity level: %d\n", verbose);
776+ avrdude_message(MSG_INFO, "New verbosity level: %d\n", verbose);
777777
778778 return 0;
779779 }
@@ -870,7 +870,7 @@
870870 }
871871 else if (strncasecmp(argv[0], cmd[i].name, len)==0) {
872872 if (hold != -1) {
873- avrdude_message("%s: command \"%s\" is ambiguous\n",
873+ avrdude_message(MSG_INFO, "%s: command \"%s\" is ambiguous\n",
874874 progname, argv[0]);
875875 return -1;
876876 }
@@ -881,7 +881,7 @@
881881 if (hold != -1)
882882 return cmd[hold].func(pgm, p, argc, argv);
883883
884- avrdude_message("%s: invalid command \"%s\"\n",
884+ avrdude_message(MSG_INFO, "%s: invalid command \"%s\"\n",
885885 progname, argv[0]);
886886
887887 return -1;
--- trunk/avrdude/update.c (revision 1320)
+++ trunk/avrdude/update.c (revision 1321)
@@ -38,7 +38,7 @@
3838
3939 upd = (UPDATE *)malloc(sizeof(UPDATE));
4040 if (upd == NULL) {
41- avrdude_message("%s: out of memory\n", progname);
41+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
4242 exit(1);
4343 }
4444
@@ -53,7 +53,7 @@
5353 upd->op = DEVICE_WRITE;
5454 upd->filename = (char *)malloc(strlen(buf) + 1);
5555 if (upd->filename == NULL) {
56- avrdude_message("%s: out of memory\n", progname);
56+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
5757 exit(1);
5858 }
5959 strcpy(upd->filename, buf);
@@ -63,7 +63,7 @@
6363
6464 upd->memtype = (char *)malloc(strlen(buf)+1);
6565 if (upd->memtype == NULL) {
66- avrdude_message("%s: out of memory\n", progname);
66+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
6767 exit(1);
6868 }
6969 strcpy(upd->memtype, buf);
@@ -79,9 +79,9 @@
7979 upd->op = DEVICE_VERIFY;
8080 }
8181 else {
82- avrdude_message("%s: invalid I/O mode '%c' in update specification\n",
82+ avrdude_message(MSG_INFO, "%s: invalid I/O mode '%c' in update specification\n",
8383 progname, *p);
84- avrdude_message(" allowed values are:\n"
84+ avrdude_message(MSG_INFO, " allowed values are:\n"
8585 " r = read device\n"
8686 " w = write device\n"
8787 " v = verify device\n");
@@ -93,7 +93,7 @@
9393 p++;
9494
9595 if (*p != ':') {
96- avrdude_message("%s: invalid update specification\n", progname);
96+ avrdude_message(MSG_INFO, "%s: invalid update specification\n", progname);
9797 free(upd->memtype);
9898 free(upd);
9999 return NULL;
@@ -135,7 +135,7 @@
135135 case 'h': upd->format = FMT_HEX; break;
136136 case 'o': upd->format = FMT_OCT; break;
137137 default:
138- avrdude_message("%s: invalid file format '%s' in update specifier\n",
138+ avrdude_message(MSG_INFO, "%s: invalid file format '%s' in update specifier\n",
139139 progname, p);
140140 free(upd->memtype);
141141 free(upd);
@@ -144,7 +144,7 @@
144144 }
145145
146146 if (upd->filename == NULL) {
147- avrdude_message("%s: out of memory\n", progname);
147+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
148148 free(upd->memtype);
149149 free(upd);
150150 return NULL;
@@ -161,7 +161,7 @@
161161
162162 u = (UPDATE *)malloc(sizeof(UPDATE));
163163 if (u == NULL) {
164- avrdude_message("%s: out of memory\n", progname);
164+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
165165 exit(1);
166166 }
167167
@@ -182,7 +182,7 @@
182182
183183 u = (UPDATE *)malloc(sizeof(UPDATE));
184184 if (u == NULL) {
185- avrdude_message("%s: out of memory\n", progname);
185+ avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
186186 exit(1);
187187 }
188188
@@ -219,7 +219,7 @@
219219
220220 mem = avr_locate_mem(p, upd->memtype);
221221 if (mem == NULL) {
222- avrdude_message("\"%s\" memory type not defined for part \"%s\"\n",
222+ avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n",
223223 upd->memtype, p->desc);
224224 return -1;
225225 }
@@ -229,13 +229,13 @@
229229 * read out the specified device memory and write it to a file
230230 */
231231 if (quell_progress < 2) {
232- avrdude_message("%s: reading %s memory:\n",
232+ avrdude_message(MSG_INFO, "%s: reading %s memory:\n",
233233 progname, mem->desc);
234234 }
235235 report_progress(0,1,"Reading");
236236 rc = avr_read(pgm, p, upd->memtype, 0);
237237 if (rc < 0) {
238- avrdude_message("%s: failed to read all of %s memory, rc=%d\n",
238+ avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n",
239239 progname, mem->desc, rc);
240240 return -1;
241241 }
@@ -243,13 +243,13 @@
243243 size = rc;
244244
245245 if (quell_progress < 2) {
246- avrdude_message("%s: writing output file \"%s\"\n",
246+ avrdude_message(MSG_INFO, "%s: writing output file \"%s\"\n",
247247 progname,
248248 strcmp(upd->filename, "-")==0 ? "<stdout>" : upd->filename);
249249 }
250250 rc = fileio(FIO_WRITE, upd->filename, upd->format, p, upd->memtype, size);
251251 if (rc < 0) {
252- avrdude_message("%s: write to file '%s' failed\n",
252+ avrdude_message(MSG_INFO, "%s: write to file '%s' failed\n",
253253 progname, upd->filename);
254254 return -1;
255255 }
@@ -260,13 +260,13 @@
260260 * read the data from the specified file
261261 */
262262 if (quell_progress < 2) {
263- avrdude_message("%s: reading input file \"%s\"\n",
263+ avrdude_message(MSG_INFO, "%s: reading input file \"%s\"\n",
264264 progname,
265265 strcmp(upd->filename, "-")==0 ? "<stdin>" : upd->filename);
266266 }
267267 rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1);
268268 if (rc < 0) {
269- avrdude_message("%s: read from file '%s' failed\n",
269+ avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n",
270270 progname, upd->filename);
271271 return -1;
272272 }
@@ -276,7 +276,7 @@
276276 * write the buffer contents to the selected memory type
277277 */
278278 if (quell_progress < 2) {
279- avrdude_message("%s: writing %s (%d bytes):\n",
279+ avrdude_message(MSG_INFO, "%s: writing %s (%d bytes):\n",
280280 progname, mem->desc, size);
281281 }
282282
@@ -294,7 +294,7 @@
294294 }
295295
296296 if (rc < 0) {
297- avrdude_message("%s: failed to write %s memory, rc=%d\n",
297+ avrdude_message(MSG_INFO, "%s: failed to write %s memory, rc=%d\n",
298298 progname, mem->desc, rc);
299299 return -1;
300300 }
@@ -302,7 +302,7 @@
302302 vsize = rc;
303303
304304 if (quell_progress < 2) {
305- avrdude_message("%s: %d bytes of %s written\n", progname,
305+ avrdude_message(MSG_INFO, "%s: %d bytes of %s written\n", progname,
306306 vsize, mem->desc);
307307 }
308308
@@ -315,16 +315,16 @@
315315 pgm->vfy_led(pgm, ON);
316316
317317 if (quell_progress < 2) {
318- avrdude_message("%s: verifying %s memory against %s:\n",
318+ avrdude_message(MSG_INFO, "%s: verifying %s memory against %s:\n",
319319 progname, mem->desc, upd->filename);
320320
321- avrdude_message("%s: load data %s data from input file %s:\n",
321+ avrdude_message(MSG_INFO, "%s: load data %s data from input file %s:\n",
322322 progname, mem->desc, upd->filename);
323323 }
324324
325325 rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1);
326326 if (rc < 0) {
327- avrdude_message("%s: read from file '%s' failed\n",
327+ avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n",
328328 progname, upd->filename);
329329 return -1;
330330 }
@@ -331,9 +331,9 @@
331331 v = avr_dup_part(p);
332332 size = rc;
333333 if (quell_progress < 2) {
334- avrdude_message("%s: input file %s contains %d bytes\n",
334+ avrdude_message(MSG_INFO, "%s: input file %s contains %d bytes\n",
335335 progname, upd->filename, size);
336- avrdude_message("%s: reading on-chip %s data:\n",
336+ avrdude_message(MSG_INFO, "%s: reading on-chip %s data:\n",
337337 progname, mem->desc);
338338 }
339339
@@ -340,7 +340,7 @@
340340 report_progress (0,1,"Reading");
341341 rc = avr_read(pgm, p, upd->memtype, v);
342342 if (rc < 0) {
343- avrdude_message("%s: failed to read all of %s memory, rc=%d\n",
343+ avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n",
344344 progname, mem->desc, rc);
345345 pgm->err_led(pgm, ON);
346346 return -1;
@@ -350,11 +350,11 @@
350350
351351
352352 if (quell_progress < 2) {
353- avrdude_message("%s: verifying ...\n", progname);
353+ avrdude_message(MSG_INFO, "%s: verifying ...\n", progname);
354354 }
355355 rc = avr_verify(p, v, upd->memtype, size);
356356 if (rc < 0) {
357- avrdude_message("%s: verification error; content mismatch\n",
357+ avrdude_message(MSG_INFO, "%s: verification error; content mismatch\n",
358358 progname);
359359 pgm->err_led(pgm, ON);
360360 return -1;
@@ -361,7 +361,7 @@
361361 }
362362
363363 if (quell_progress < 2) {
364- avrdude_message("%s: %d bytes of %s verified\n",
364+ avrdude_message(MSG_INFO, "%s: %d bytes of %s verified\n",
365365 progname, rc, mem->desc);
366366 }
367367
@@ -368,7 +368,7 @@
368368 pgm->vfy_led(pgm, OFF);
369369 }
370370 else {
371- avrdude_message("%s: invalid update operation (%d) requested\n",
371+ avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n",
372372 progname, upd->op);
373373 return -1;
374374 }
--- trunk/avrdude/usb_libusb.c (revision 1320)
+++ trunk/avrdude/usb_libusb.c (revision 1321)
@@ -98,7 +98,7 @@
9898
9999 if (strlen(serno) > 12)
100100 {
101- avrdude_message("%s: usbdev_open(): invalid serial number \"%s\"\n",
101+ avrdude_message(MSG_INFO, "%s: usbdev_open(): invalid serial number \"%s\"\n",
102102 progname, serno);
103103 return -1;
104104 }
@@ -127,7 +127,7 @@
127127 dev->descriptor.iSerialNumber,
128128 string, sizeof(string)) < 0)
129129 {
130- avrdude_message("%s: usb_open(): cannot read serial number \"%s\"\n",
130+ avrdude_message(MSG_INFO, "%s: usb_open(): cannot read serial number \"%s\"\n",
131131 progname, usb_strerror());
132132 /*
133133 * On some systems, libusb appears to have
@@ -146,7 +146,7 @@
146146 dev->descriptor.iProduct,
147147 product, sizeof(product)) < 0)
148148 {
149- avrdude_message("%s: usb_open(): cannot read product name \"%s\"\n",
149+ avrdude_message(MSG_INFO, "%s: usb_open(): cannot read product name \"%s\"\n",
150150 progname, usb_strerror());
151151 strcpy(product, "[unnamed product]");
152152 }
@@ -166,8 +166,7 @@
166166 fd->usb.eep = 0;
167167 }
168168
169- if (verbose)
170- avrdude_message("%s: usbdev_open(): Found %s, serno: %s\n",
169+ avrdude_message(MSG_NOTICE, "%s: usbdev_open(): Found %s, serno: %s\n",
171170 progname, product, string);
172171 if (serno != NULL)
173172 {
@@ -179,8 +178,7 @@
179178 x = strlen(string) - strlen(serno);
180179 if (strcasecmp(string + x, serno) != 0)
181180 {
182- if (verbose > 2)
183- avrdude_message("%s: usbdev_open(): serial number doesn't match\n",
181+ avrdude_message(MSG_DEBUG, "%s: usbdev_open(): serial number doesn't match\n",
184182 progname);
185183 usb_close(udev);
186184 continue;
@@ -189,7 +187,7 @@
189187
190188 if (dev->config == NULL)
191189 {
192- avrdude_message("%s: usbdev_open(): USB device has no configuration\n",
190+ avrdude_message(MSG_INFO, "%s: usbdev_open(): USB device has no configuration\n",
193191 progname);
194192 goto trynext;
195193 }
@@ -196,7 +194,7 @@
196194
197195 if (usb_set_configuration(udev, dev->config[0].bConfigurationValue))
198196 {
199- avrdude_message("%s: usbdev_open(): WARNING: failed to set configuration %d: %s\n",
197+ avrdude_message(MSG_INFO, "%s: usbdev_open(): WARNING: failed to set configuration %d: %s\n",
200198 progname, dev->config[0].bConfigurationValue,
201199 usb_strerror());
202200 /* let's hope it has already been configured */
@@ -217,7 +215,7 @@
217215 #endif
218216 if (usb_claim_interface(udev, usb_interface))
219217 {
220- avrdude_message("%s: usbdev_open(): error claiming interface %d: %s\n",
218+ avrdude_message(MSG_INFO, "%s: usbdev_open(): error claiming interface %d: %s\n",
221219 progname, usb_interface, usb_strerror());
222220 }
223221 else
@@ -235,7 +233,7 @@
235233 }
236234 if (iface == dev->config[0].bNumInterfaces)
237235 {
238- avrdude_message("%s: usbdev_open(): no usable interface found\n",
236+ avrdude_message(MSG_INFO, "%s: usbdev_open(): no usable interface found\n",
239237 progname);
240238 goto trynext;
241239 }
@@ -251,11 +249,8 @@
251249
252250 if ((possible_ep & USB_ENDPOINT_DIR_MASK) != 0)
253251 {
254- if (verbose > 1)
255- {
256- avrdude_message("%s: usbdev_open(): using read endpoint 0x%02x\n",
252+ avrdude_message(MSG_NOTICE2, "%s: usbdev_open(): using read endpoint 0x%02x\n",
257253 progname, possible_ep);
258- }
259254 fd->usb.rep = possible_ep;
260255 break;
261256 }
@@ -262,7 +257,7 @@
262257 }
263258 if (fd->usb.rep == 0)
264259 {
265- avrdude_message("%s: usbdev_open(): cannot find a read endpoint, using 0x%02x\n",
260+ avrdude_message(MSG_INFO, "%s: usbdev_open(): cannot find a read endpoint, using 0x%02x\n",
266261 progname, USBDEV_BULK_EP_READ_MKII);
267262 fd->usb.rep = USBDEV_BULK_EP_READ_MKII;
268263 }
@@ -273,8 +268,7 @@
273268 dev->config[0].interface[iface].altsetting[0].endpoint[i].bEndpointAddress == fd->usb.wep) &&
274269 dev->config[0].interface[iface].altsetting[0].endpoint[i].wMaxPacketSize < fd->usb.max_xfer)
275270 {
276- if (verbose != 0)
277- avrdude_message("%s: max packet size expected %d, but found %d due to EP 0x%02x's wMaxPacketSize\n",
271+ avrdude_message(MSG_NOTICE, "%s: max packet size expected %d, but found %d due to EP 0x%02x's wMaxPacketSize\n",
278272 progname,
279273 fd->usb.max_xfer,
280274 dev->config[0].interface[iface].altsetting[0].endpoint[i].wMaxPacketSize,
@@ -285,7 +279,7 @@
285279 if (pinfo.usbinfo.flags & PINFO_FL_USEHID)
286280 {
287281 if (usb_control_msg(udev, 0x21, 0x0a /* SET_IDLE */, 0, 0, NULL, 0, 100) < 0)
288- avrdude_message("%s: usbdev_open(): SET_IDLE failed\n", progname);
282+ avrdude_message(MSG_INFO, "%s: usbdev_open(): SET_IDLE failed\n", progname);
289283 }
290284 return 0;
291285 trynext:
@@ -292,14 +286,14 @@
292286 usb_close(udev);
293287 }
294288 else
295- avrdude_message("%s: usbdev_open(): cannot open device: %s\n",
289+ avrdude_message(MSG_INFO, "%s: usbdev_open(): cannot open device: %s\n",
296290 progname, usb_strerror());
297291 }
298292 }
299293 }
300294
301- if ((pinfo.usbinfo.flags & PINFO_FL_SILENT) == 0 || verbose > 0)
302- avrdude_message("%s: usbdev_open(): did not find any%s USB device \"%s\" (0x%04x:0x%04x)\n",
295+ if ((pinfo.usbinfo.flags & PINFO_FL_SILENT) == 0)
296+ avrdude_message(MSG_NOTICE, "%s: usbdev_open(): did not find any%s USB device \"%s\" (0x%04x:0x%04x)\n",
303297 progname, serno? " (matching)": "", port,
304298 (unsigned)pinfo.usbinfo.vid, (unsigned)pinfo.usbinfo.pid);
305299 return -1;
@@ -353,7 +347,7 @@
353347 rv = usb_bulk_write(udev, fd->usb.wep, (char *)bp, tx_size, 10000);
354348 if (rv != tx_size)
355349 {
356- avrdude_message("%s: usbdev_send(): wrote %d out of %d bytes, err = %s\n",
350+ avrdude_message(MSG_INFO, "%s: usbdev_send(): wrote %d out of %d bytes, err = %s\n",
357351 progname, rv, tx_size, usb_strerror());
358352 return -1;
359353 }
@@ -363,22 +357,22 @@
363357
364358 if (verbose > 3)
365359 {
366- avrdude_message("%s: Sent: ", progname);
360+ avrdude_message(MSG_TRACE, "%s: Sent: ", progname);
367361
368362 while (i) {
369363 unsigned char c = *p;
370364 if (isprint(c)) {
371- avrdude_message("%c ", c);
365+ avrdude_message(MSG_TRACE, "%c ", c);
372366 }
373367 else {
374- avrdude_message(". ");
368+ avrdude_message(MSG_TRACE, ". ");
375369 }
376- avrdude_message("[%02x] ", c);
370+ avrdude_message(MSG_TRACE, "[%02x] ", c);
377371
378372 p++;
379373 i--;
380374 }
381- avrdude_message("\n");
375+ avrdude_message(MSG_TRACE, "\n");
382376 }
383377 return 0;
384378 }
@@ -402,8 +396,7 @@
402396 rv = usb_bulk_read(udev, ep, usbbuf, maxsize, 10000);
403397 if (rv < 0)
404398 {
405- if (verbose > 1)
406- avrdude_message("%s: usb_fill_buf(): usb_%s_read() error %s\n",
399+ avrdude_message(MSG_NOTICE2, "%s: usb_fill_buf(): usb_%s_read() error %s\n",
407400 progname, (use_interrupt_xfer? "interrupt": "bulk"),
408401 usb_strerror());
409402 return -1;
@@ -440,22 +433,22 @@
440433
441434 if (verbose > 4)
442435 {
443- avrdude_message("%s: Recv: ", progname);
436+ avrdude_message(MSG_TRACE2, "%s: Recv: ", progname);
444437
445438 while (i) {
446439 unsigned char c = *p;
447440 if (isprint(c)) {
448- avrdude_message("%c ", c);
441+ avrdude_message(MSG_TRACE2, "%c ", c);
449442 }
450443 else {
451- avrdude_message(". ");
444+ avrdude_message(MSG_TRACE2, ". ");
452445 }
453- avrdude_message("[%02x] ", c);
446+ avrdude_message(MSG_TRACE2, "[%02x] ", c);
454447
455448 p++;
456449 i--;
457450 }
458- avrdude_message("\n");
451+ avrdude_message(MSG_TRACE2, "\n");
459452 }
460453
461454 return 0;
@@ -494,7 +487,7 @@
494487 }
495488 else if (rv > 0)
496489 {
497- avrdude_message("Short event len = %d, ignored.\n", rv);
490+ avrdude_message(MSG_INFO, "Short event len = %d, ignored.\n", rv);
498491 /* fallthrough */
499492 }
500493 }
@@ -510,8 +503,7 @@
510503 fd->usb.max_xfer, 10000);
511504 if (rv < 0)
512505 {
513- if (verbose > 1)
514- avrdude_message("%s: usbdev_recv_frame(): usb_%s_read(): %s\n",
506+ avrdude_message(MSG_NOTICE2, "%s: usbdev_recv_frame(): usb_%s_read(): %s\n",
515507 progname, (fd->usb.use_interrupt_xfer? "interrupt": "bulk"),
516508 usb_strerror());
517509 return -1;
@@ -535,22 +527,22 @@
535527 if (verbose > 3)
536528 {
537529 i = n & USB_RECV_LENGTH_MASK;
538- avrdude_message("%s: Recv: ", progname);
530+ avrdude_message(MSG_TRACE, "%s: Recv: ", progname);
539531
540532 while (i) {
541533 unsigned char c = *p;
542534 if (isprint(c)) {
543- avrdude_message("%c ", c);
535+ avrdude_message(MSG_TRACE, "%c ", c);
544536 }
545537 else {
546- avrdude_message(". ");
538+ avrdude_message(MSG_TRACE, ". ");
547539 }
548- avrdude_message("[%02x] ", c);
540+ avrdude_message(MSG_TRACE, "[%02x] ", c);
549541
550542 p++;
551543 i--;
552544 }
553- avrdude_message("\n");
545+ avrdude_message(MSG_TRACE, "\n");
554546 }
555547 return n;
556548 }
@@ -568,8 +560,8 @@
568560 rv = usb_interrupt_read(udev, fd->usb.rep, usbbuf, fd->usb.max_xfer, 100);
569561 else
570562 rv = usb_bulk_read(udev, fd->usb.rep, usbbuf, fd->usb.max_xfer, 100);
571- if (rv > 0 && verbose >= 4)
572- avrdude_message("%s: usbdev_drain(): flushed %d characters\n",
563+ if (rv > 0)
564+ avrdude_message(MSG_TRACE, "%s: usbdev_drain(): flushed %d characters\n",
573565 progname, rv);
574566 } while (rv > 0);
575567
--- trunk/avrdude/usbasp.c (revision 1320)
+++ trunk/avrdude/usbasp.c (revision 1321)
@@ -180,7 +180,7 @@
180180 static void usbasp_setup(PROGRAMMER * pgm)
181181 {
182182 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
183- avrdude_message("%s: usbasp_setup(): Out of memory allocating private data\n",
183+ avrdude_message(MSG_INFO, "%s: usbasp_setup(): Out of memory allocating private data\n",
184184 progname);
185185 exit(1);
186186 }
@@ -229,15 +229,15 @@
229229 int nbytes;
230230
231231 if (verbose > 3) {
232- avrdude_message("%s: usbasp_transmit(\"%s\", 0x%02x, 0x%02x, 0x%02x, 0x%02x)\n",
232+ avrdude_message(MSG_TRACE, "%s: usbasp_transmit(\"%s\", 0x%02x, 0x%02x, 0x%02x, 0x%02x)\n",
233233 progname,
234234 usbasp_get_funcname(functionid), send[0], send[1], send[2], send[3]);
235235 if (!receive && buffersize > 0) {
236236 int i;
237- avrdude_message("%s => ", progbuf);
237+ avrdude_message(MSG_TRACE, "%s => ", progbuf);
238238 for (i = 0; i < buffersize; i++)
239- avrdude_message("[%02x] ", buffer[i]);
240- avrdude_message("\n");
239+ avrdude_message(MSG_TRACE, "[%02x] ", buffer[i]);
240+ avrdude_message(MSG_TRACE, "\n");
241241 }
242242 }
243243
@@ -251,7 +251,7 @@
251251 buffersize & 0xffff,
252252 5000);
253253 if(nbytes < 0){
254- avrdude_message("%s: error: usbasp_transmit: %s\n", progname, strerror(libusb_to_errno(nbytes)));
254+ avrdude_message(MSG_INFO, "%s: error: usbasp_transmit: %s\n", progname, strerror(libusb_to_errno(nbytes)));
255255 return -1;
256256 }
257257 #else
@@ -263,7 +263,7 @@
263263 (char *)buffer, buffersize,
264264 5000);
265265 if(nbytes < 0){
266- avrdude_message("%s: error: usbasp_transmit: %s\n", progname, usb_strerror());
266+ avrdude_message(MSG_INFO, "%s: error: usbasp_transmit: %s\n", progname, usb_strerror());
267267 return -1;
268268 }
269269 #endif
@@ -270,10 +270,10 @@
270270
271271 if (verbose > 3 && receive && nbytes > 0) {
272272 int i;
273- avrdude_message("%s<= ", progbuf);
273+ avrdude_message(MSG_TRACE, "%s<= ", progbuf);
274274 for (i = 0; i < nbytes; i++)
275- avrdude_message("[%02x] ", buffer[i]);
276- avrdude_message("\n");
275+ avrdude_message(MSG_TRACE, "[%02x] ", buffer[i]);
276+ avrdude_message(MSG_TRACE, "\n");
277277 }
278278
279279 return nbytes;
@@ -314,7 +314,7 @@
314314 r = libusb_open(dev, &handle);
315315 if (!handle) {
316316 errorCode = USB_ERROR_ACCESS;
317- avrdude_message("%s: Warning: cannot open USB device: %s\n",
317+ avrdude_message(MSG_INFO, "%s: Warning: cannot open USB device: %s\n",
318318 progname, strerror(libusb_to_errno(r)));
319319 continue;
320320 }
@@ -325,12 +325,11 @@
325325 if (r < 0) {
326326 if ((vendorName != NULL) && (vendorName[0] != 0)) {
327327 errorCode = USB_ERROR_IO;
328- avrdude_message("%s: Warning: cannot query manufacturer for device: %s\n",
328+ avrdude_message(MSG_INFO, "%s: Warning: cannot query manufacturer for device: %s\n",
329329 progname, strerror(libusb_to_errno(r)));
330330 }
331331 } else {
332- if (verbose > 1)
333- avrdude_message("%s: seen device from vendor ->%s<-\n",
332+ avrdude_message(MSG_NOTICE2, "%s: seen device from vendor ->%s<-\n",
334333 progname, string);
335334 if ((vendorName != NULL) && (vendorName[0] != 0) && (strcmp(string, vendorName) != 0))
336335 errorCode = USB_ERROR_NOTFOUND;
@@ -340,12 +339,11 @@
340339 if (r < 0) {
341340 if ((productName != NULL) && (productName[0] != 0)) {
342341 errorCode = USB_ERROR_IO;
343- avrdude_message("%s: Warning: cannot query product for device: %s\n",
342+ avrdude_message(MSG_INFO, "%s: Warning: cannot query product for device: %s\n",
344343 progname, strerror(libusb_to_errno(r)));
345344 }
346345 } else {
347- if (verbose > 1)
348- avrdude_message("%s: seen product ->%s<-\n",
346+ avrdude_message(MSG_NOTICE2, "%s: seen product ->%s<-\n",
349347 progname, string);
350348 if((productName != NULL) && (productName[0] != 0) && (strcmp(string, productName) != 0))
351349 errorCode = USB_ERROR_NOTFOUND;
@@ -389,7 +387,7 @@
389387 handle = usb_open(dev);
390388 if(!handle){
391389 errorCode = USB_ERROR_ACCESS;
392- avrdude_message("%s: Warning: cannot open USB device: %s\n",
390+ avrdude_message(MSG_INFO, "%s: Warning: cannot open USB device: %s\n",
393391 progname, usb_strerror());
394392 continue;
395393 }
@@ -401,12 +399,11 @@
401399 if(len < 0){
402400 if ((vendorName != NULL) && (vendorName[0] != 0)) {
403401 errorCode = USB_ERROR_IO;
404- avrdude_message("%s: Warning: cannot query manufacturer for device: %s\n",
402+ avrdude_message(MSG_INFO, "%s: Warning: cannot query manufacturer for device: %s\n",
405403 progname, usb_strerror());
406404 }
407405 } else {
408- if (verbose > 1)
409- avrdude_message("%s: seen device from vendor ->%s<-\n",
406+ avrdude_message(MSG_NOTICE2, "%s: seen device from vendor ->%s<-\n",
410407 progname, string);
411408 if((vendorName != NULL) && (vendorName[0] != 0) && (strcmp(string, vendorName) != 0))
412409 errorCode = USB_ERROR_NOTFOUND;
@@ -417,12 +414,11 @@
417414 if(len < 0){
418415 if ((productName != NULL) && (productName[0] != 0)) {
419416 errorCode = USB_ERROR_IO;
420- avrdude_message("%s: Warning: cannot query product for device: %s\n",
417+ avrdude_message(MSG_INFO, "%s: Warning: cannot query product for device: %s\n",
421418 progname, usb_strerror());
422419 }
423420 } else {
424- if (verbose > 1)
425- avrdude_message("%s: seen product ->%s<-\n",
421+ avrdude_message(MSG_NOTICE2, "%s: seen product ->%s<-\n",
426422 progname, string);
427423 if((productName != NULL) && (productName[0] != 0) && (strcmp(string, productName) != 0))
428424 errorCode = USB_ERROR_NOTFOUND;
@@ -448,8 +444,7 @@
448444 /* Interface - prog. */
449445 static int usbasp_open(PROGRAMMER * pgm, char * port)
450446 {
451- if (verbose > 2)
452- avrdude_message("%s: usbasp_open(\"%s\")\n",
447+ avrdude_message(MSG_DEBUG, "%s: usbasp_open(\"%s\")\n",
453448 progname, port);
454449
455450 /* usb_init will be done in usbOpenDevice */
@@ -458,7 +453,7 @@
458453 if (usbpid) {
459454 pid = *(int *)(ldata(usbpid));
460455 if (lnext(usbpid))
461- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
456+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
462457 progname, pid);
463458 } else {
464459 pid = USBASP_SHARED_PID;
@@ -469,12 +464,12 @@
469464 if(strcasecmp(ldata(lfirst(pgm->id)), "usbasp") == 0) {
470465 /* for id usbasp autodetect some variants */
471466 if(strcasecmp(port, "nibobee") == 0) {
472- avrdude_message("%s: warning: Using \"-C usbasp -P nibobee\" is deprecated,"
467+ avrdude_message(MSG_INFO, "%s: warning: Using \"-C usbasp -P nibobee\" is deprecated,"
473468 "use \"-C nibobee\" instead.\n",
474469 progname);
475470 if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_NIBOBEE_VID, "www.nicai-systems.com",
476471 USBASP_NIBOBEE_PID, "NIBObee") != 0) {
477- avrdude_message("%s: error: could not find USB device "
472+ avrdude_message(MSG_INFO, "%s: error: could not find USB device "
478473 "\"NIBObee\" with vid=0x%x pid=0x%x\n",
479474 progname, USBASP_NIBOBEE_VID, USBASP_NIBOBEE_PID);
480475 return -1;
@@ -485,7 +480,7 @@
485480 if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_OLD_VID, "www.fischl.de",
486481 USBASP_OLD_PID, "USBasp") == 0) {
487482 /* found USBasp with old IDs */
488- avrdude_message("%s: Warning: Found USB device \"USBasp\" with "
483+ avrdude_message(MSG_INFO, "%s: Warning: Found USB device \"USBasp\" with "
489484 "old VID/PID! Please update firmware of USBasp!\n",
490485 progname);
491486 return 0;
@@ -494,15 +489,15 @@
494489 /* no alternative found => fall through to generic error message */
495490 }
496491
497- avrdude_message("%s: error: could not find USB device with vid=0x%x pid=0x%x",
492+ avrdude_message(MSG_INFO, "%s: error: could not find USB device with vid=0x%x pid=0x%x",
498493 progname, vid, pid);
499494 if (pgm->usbvendor[0] != 0) {
500- avrdude_message(" vendor='%s'", pgm->usbvendor);
495+ avrdude_message(MSG_INFO, " vendor='%s'", pgm->usbvendor);
501496 }
502497 if (pgm->usbproduct[0] != 0) {
503- avrdude_message(" product='%s'", pgm->usbproduct);
498+ avrdude_message(MSG_INFO, " product='%s'", pgm->usbproduct);
504499 }
505- avrdude_message("\n");
500+ avrdude_message(MSG_INFO, "\n");
506501 return -1;
507502 }
508503
@@ -511,8 +506,7 @@
511506
512507 static void usbasp_close(PROGRAMMER * pgm)
513508 {
514- if (verbose > 2)
515- avrdude_message("%s: usbasp_close()\n", progname);
509+ avrdude_message(MSG_DEBUG, "%s: usbasp_close()\n", progname);
516510
517511 if (PDATA(pgm)->usbhandle!=NULL) {
518512 unsigned char temp[4];
@@ -566,8 +560,7 @@
566560 unsigned char res[4];
567561 IMPORT_PDATA(pgm);
568562
569- if (verbose > 2)
570- avrdude_message("%s: usbasp_initialize()\n", progname);
563+ avrdude_message(MSG_DEBUG, "%s: usbasp_initialize()\n", progname);
571564
572565 /* get capabilities */
573566 memset(temp, 0, sizeof(temp));
@@ -631,8 +624,7 @@
631624 static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
632625 unsigned char *res)
633626 {
634- if (verbose > 2)
635- avrdude_message("%s: usbasp_cpi_cmd(0x%02x, 0x%02x, 0x%02x, 0x%02x)%s",
627+ avrdude_message(MSG_DEBUG, "%s: usbasp_cpi_cmd(0x%02x, 0x%02x, 0x%02x, 0x%02x)%s",
636628 progname, cmd[0], cmd[1], cmd[2], cmd[3],
637629 verbose > 3? "...\n": "");
638630
@@ -643,16 +635,13 @@
643635 if (verbose == 3)
644636 putc('\n', stderr);
645637
646- avrdude_message("%s: error: wrong responds size\n",
638+ avrdude_message(MSG_INFO, "%s: error: wrong responds size\n",
647639 progname);
648640 return -1;
649641 }
650- if (verbose > 2) {
651- if (verbose > 3)
652- avrdude_message("%s: usbasp_cpi_cmd()", progname);
653- avrdude_message(" => 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
654- res[0], res[1], res[2], res[3]);
655- }
642+ avrdude_message(MSG_TRACE, "%s: usbasp_cpi_cmd()", progname);
643+ avrdude_message(MSG_DEBUG, " => 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
644+ res[0], res[1], res[2], res[3]);
656645
657646 return 0;
658647 }
@@ -666,8 +655,7 @@
666655
667656 cmd[0] = 0;
668657
669- if (verbose > 2)
670- avrdude_message("%s: usbasp_program_enable()\n",
658+ avrdude_message(MSG_DEBUG, "%s: usbasp_program_enable()\n",
671659 progname);
672660
673661 int nbytes =
@@ -674,7 +662,7 @@
674662 usbasp_transmit(pgm, 1, USBASP_FUNC_ENABLEPROG, cmd, res, sizeof(res));
675663
676664 if ((nbytes != 1) | (res[0] != 0)) {
677- avrdude_message("%s: error: program enable: target doesn't answer. %x \n",
665+ avrdude_message(MSG_INFO, "%s: error: program enable: target doesn't answer. %x \n",
678666 progname, res[0]);
679667 return -1;
680668 }
@@ -687,12 +675,11 @@
687675 unsigned char cmd[4];
688676 unsigned char res[4];
689677
690- if (verbose > 2)
691- avrdude_message("%s: usbasp_chip_erase()\n",
678+ avrdude_message(MSG_DEBUG, "%s: usbasp_chip_erase()\n",
692679 progname);
693680
694681 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
695- avrdude_message("chip erase instruction not defined for part \"%s\"\n",
682+ avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
696683 p->desc);
697684 return -1;
698685 }
@@ -718,8 +705,7 @@
718705 unsigned char *buffer = m->buf + address;
719706 int function;
720707
721- if (verbose > 2)
722- avrdude_message("%s: usbasp_program_paged_load(\"%s\", 0x%x, %d)\n",
708+ avrdude_message(MSG_DEBUG, "%s: usbasp_program_paged_load(\"%s\", 0x%x, %d)\n",
723709 progname, m->desc, address, n_bytes);
724710
725711 if (strcmp(m->desc, "flash") == 0) {
@@ -763,7 +749,7 @@
763749 n = usbasp_transmit(pgm, 1, function, cmd, buffer, blocksize);
764750
765751 if (n != blocksize) {
766- avrdude_message("%s: error: wrong reading bytes %x\n",
752+ avrdude_message(MSG_INFO, "%s: error: wrong reading bytes %x\n",
767753 progname, n);
768754 return -3;
769755 }
@@ -787,8 +773,7 @@
787773 unsigned char blockflags = USBASP_BLOCKFLAG_FIRST;
788774 int function;
789775
790- if (verbose > 2)
791- avrdude_message("%s: usbasp_program_paged_write(\"%s\", 0x%x, %d)\n",
776+ avrdude_message(MSG_DEBUG, "%s: usbasp_program_paged_write(\"%s\", 0x%x, %d)\n",
792777 progname, m->desc, address, n_bytes);
793778
794779 if (strcmp(m->desc, "flash") == 0) {
@@ -837,7 +822,7 @@
837822 n = usbasp_transmit(pgm, 0, function, cmd, buffer, blocksize);
838823
839824 if (n != blocksize) {
840- avrdude_message("%s: error: wrong count at writing %x\n",
825+ avrdude_message(MSG_INFO, "%s: error: wrong count at writing %x\n",
841826 progname, n);
842827 return -3;
843828 }
@@ -876,8 +861,7 @@
876861 unsigned char res[4];
877862 unsigned char cmd[4];
878863
879- if (verbose > 2)
880- avrdude_message("%s: usbasp_spi_set_sck_period(%g)\n",
864+ avrdude_message(MSG_DEBUG, "%s: usbasp_spi_set_sck_period(%g)\n",
881865 progname, sckperiod);
882866
883867 memset(cmd, 0, sizeof(cmd));
@@ -889,8 +873,7 @@
889873 if (sckperiod == 0) {
890874 /* auto sck set */
891875
892- if (verbose >= 1)
893- avrdude_message("%s: auto set sck period (because given equals null)\n", progname);
876+ avrdude_message(MSG_NOTICE, "%s: auto set sck period (because given equals null)\n", progname);
894877
895878 } else {
896879
@@ -897,8 +880,7 @@
897880 int sckfreq = 1 / sckperiod; /* sck in Hz */
898881 int usefreq = 0;
899882
900- if (verbose >= 2)
901- avrdude_message("%s: try to set SCK period to %g s (= %i Hz)\n", progname, sckperiod, sckfreq);
883+ avrdude_message(MSG_NOTICE2, "%s: try to set SCK period to %g s (= %i Hz)\n", progname, sckperiod, sckfreq);
902884
903885 if (sckfreq >= usbaspSCKoptions[0].frequency) {
904886 clockoption = usbaspSCKoptions[0].id;
@@ -919,7 +901,7 @@
919901 /* save used sck frequency */
920902 PDATA(pgm)->sckfreq_hz = usefreq;
921903
922- avrdude_message("%s: set SCK frequency to %i Hz\n", progname, usefreq);
904+ avrdude_message(MSG_INFO, "%s: set SCK frequency to %i Hz\n", progname, usefreq);
923905 }
924906
925907 cmd[0] = clockoption;
@@ -928,7 +910,7 @@
928910 usbasp_transmit(pgm, 1, USBASP_FUNC_SETISPSCK, cmd, res, sizeof(res));
929911
930912 if ((nbytes != 1) | (res[0] != 0)) {
931- avrdude_message("%s: warning: cannot set sck period. please check for usbasp firmware update.\n",
913+ avrdude_message(MSG_INFO, "%s: warning: cannot set sck period. please check for usbasp firmware update.\n",
932914 progname);
933915 return -1;
934916 }
@@ -955,7 +937,7 @@
955937
956938 if(usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_RAWREAD, temp, temp, sizeof(temp)) != 1)
957939 {
958- avrdude_message("%s: error: wrong responds size\n", progname);
940+ avrdude_message(MSG_INFO, "%s: error: wrong responds size\n", progname);
959941 return -1;
960942 }
961943
@@ -967,8 +949,7 @@
967949 {
968950 int retry;
969951
970- if (verbose > 2)
971- avrdude_message("%s: usbasp_tpi_nvm_waitbusy() ...", progname);
952+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_nvm_waitbusy() ...", progname);
972953
973954 for(retry=50; retry>0; retry--)
974955 {
@@ -976,14 +957,12 @@
976957 if(usbasp_tpi_recv_byte(pgm) & NVMCSR_BSY)
977958 continue;
978959
979- if (verbose > 2)
980- avrdude_message(" ready\n");
960+ avrdude_message(MSG_DEBUG, " ready\n");
981961
982962 return 0;
983963 }
984964
985- if (verbose > 2)
986- avrdude_message(" failure\n");
965+ avrdude_message(MSG_DEBUG, " failure\n");
987966
988967 return -1;
989968 }
@@ -990,7 +969,7 @@
990969
991970 static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res)
992971 {
993- avrdude_message("%s: error: spi_cmd used in TPI mode: not allowed\n", progname);
972+ avrdude_message(MSG_INFO, "%s: error: spi_cmd used in TPI mode: not allowed\n", progname);
994973 return -1;
995974 }
996975
@@ -998,8 +977,7 @@
998977 {
999978 int retry;
1000979
1001- if (verbose > 2)
1002- avrdude_message("%s: usbasp_tpi_program_enable()\n", progname);
980+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_program_enable()\n", progname);
1003981
1004982 /* change guard time */
1005983 usbasp_tpi_send_byte(pgm, TPI_OP_SSTCS(TPIPCR));
@@ -1029,7 +1007,7 @@
10291007 }
10301008 if(retry >= 10)
10311009 {
1032- avrdude_message("%s: error: program enable: target doesn't answer.\n", progname);
1010+ avrdude_message(MSG_INFO, "%s: error: program enable: target doesn't answer.\n", progname);
10331011 return -1;
10341012 }
10351013
@@ -1038,8 +1016,7 @@
10381016
10391017 static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
10401018 {
1041- if (verbose > 2)
1042- avrdude_message("%s: usbasp_tpi_chip_erase()\n", progname);
1019+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_chip_erase()\n", progname);
10431020
10441021 /* Set PR to flash */
10451022 usbasp_tpi_send_byte(pgm, TPI_OP_SSTPR(0));
@@ -1070,8 +1047,7 @@
10701047 uint16_t pr;
10711048
10721049
1073- if (verbose > 2)
1074- avrdude_message("%s: usbasp_tpi_paged_load(\"%s\", 0x%0x, %d)\n",
1050+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_paged_load(\"%s\", 0x%0x, %d)\n",
10751051 progname, m->desc, addr, n_bytes);
10761052
10771053 dptr = addr + m->buf;
@@ -1092,7 +1068,7 @@
10921068 n = usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_READBLOCK, cmd, dptr, clen);
10931069 if(n != clen)
10941070 {
1095- avrdude_message("%s: error: wrong reading bytes %x\n", progname, n);
1071+ avrdude_message(MSG_INFO, "%s: error: wrong reading bytes %x\n", progname, n);
10961072 return -3;
10971073 }
10981074
@@ -1114,8 +1090,7 @@
11141090 uint16_t pr;
11151091
11161092
1117- if (verbose > 2)
1118- avrdude_message("%s: usbasp_tpi_paged_write(\"%s\", 0x%0x, %d)\n",
1093+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_paged_write(\"%s\", 0x%0x, %d)\n",
11191094 progname, m->desc, addr, n_bytes);
11201095
11211096 sptr = addr + m->buf;
@@ -1142,7 +1117,7 @@
11421117 n = usbasp_transmit(pgm, 0, USBASP_FUNC_TPI_WRITEBLOCK, cmd, sptr, clen);
11431118 if(n != clen)
11441119 {
1145- avrdude_message("%s: error: wrong count at writing %x\n", progname, n);
1120+ avrdude_message(MSG_INFO, "%s: error: wrong count at writing %x\n", progname, n);
11461121 return -3;
11471122 }
11481123
@@ -1165,8 +1140,7 @@
11651140 uint16_t pr;
11661141
11671142
1168- if (verbose > 2)
1169- avrdude_message("%s: usbasp_tpi_read_byte(\"%s\", 0x%0lx)\n",
1143+ avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_read_byte(\"%s\", 0x%0lx)\n",
11701144 progname, m->desc, addr);
11711145
11721146 pr = m->offset + addr;
@@ -1179,7 +1153,7 @@
11791153 n = usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_READBLOCK, cmd, value, 1);
11801154 if(n != 1)
11811155 {
1182- avrdude_message("%s: error: wrong reading bytes %x\n", progname, n);
1156+ avrdude_message(MSG_INFO, "%s: error: wrong reading bytes %x\n", progname, n);
11831157 return -3;
11841158 }
11851159 return 0;
@@ -1187,7 +1161,7 @@
11871161
11881162 static int usbasp_tpi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char data)
11891163 {
1190- avrdude_message("%s: error: usbasp_write_byte in TPI mode: all writes have to be done at page level\n", progname);
1164+ avrdude_message(MSG_INFO, "%s: error: usbasp_write_byte in TPI mode: all writes have to be done at page level\n", progname);
11911165 return -1;
11921166 }
11931167
@@ -1229,7 +1203,7 @@
12291203
12301204 static int usbasp_nousb_open (struct programmer_t *pgm, char * name)
12311205 {
1232- avrdude_message("%s: error: no usb support. please compile again with libusb installed.\n",
1206+ avrdude_message(MSG_INFO, "%s: error: no usb support. please compile again with libusb installed.\n",
12331207 progname);
12341208
12351209 return -1;
--- trunk/avrdude/usbtiny.c (revision 1320)
+++ trunk/avrdude/usbtiny.c (revision 1321)
@@ -75,7 +75,7 @@
7575 static void usbtiny_setup(PROGRAMMER * pgm)
7676 {
7777 if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
78- avrdude_message("%s: usbtiny_setup(): Out of memory allocating private data\n",
78+ avrdude_message(MSG_INFO, "%s: usbtiny_setup(): Out of memory allocating private data\n",
7979 progname);
8080 exit(1);
8181 }
@@ -99,7 +99,7 @@
9999 NULL, 0, // no data buffer in control messge
100100 USB_TIMEOUT ); // default timeout
101101 if(nbytes < 0){
102- avrdude_message("\n%s: error: usbtiny_transmit: %s\n", progname, usb_strerror());
102+ avrdude_message(MSG_INFO, "\n%s: error: usbtiny_transmit: %s\n", progname, usb_strerror());
103103 return -1;
104104 }
105105
@@ -131,7 +131,7 @@
131131 }
132132 PDATA(pgm)->retries++;
133133 }
134- avrdude_message("\n%s: error: usbtiny_receive: %s (expected %d, got %d)\n",
134+ avrdude_message(MSG_INFO, "\n%s: error: usbtiny_receive: %s (expected %d, got %d)\n",
135135 progname, usb_strerror(), buflen, nbytes);
136136 return -1;
137137 }
@@ -140,7 +140,7 @@
140140 static void check_retries (PROGRAMMER * pgm, const char* operation)
141141 {
142142 if (PDATA(pgm)->retries > 0 && quell_progress < 2) {
143- avrdude_message("%s: %d retries during %s\n", progname,
143+ avrdude_message(MSG_INFO, "%s: %d retries during %s\n", progname,
144144 PDATA(pgm)->retries, operation);
145145 }
146146 PDATA(pgm)->retries = 0;
@@ -165,7 +165,7 @@
165165 (char *)buffer, buflen,
166166 timeout);
167167 if (nbytes != buflen) {
168- avrdude_message("\n%s: error: usbtiny_send: %s (expected %d, got %d)\n",
168+ avrdude_message(MSG_INFO, "\n%s: error: usbtiny_send: %s (expected %d, got %d)\n",
169169 progname, usb_strerror(), buflen, nbytes);
170170 return -1;
171171 }
@@ -184,7 +184,7 @@
184184 unsigned char cmd[4];
185185
186186 if (p->op[op] == NULL) {
187- avrdude_message("Operation %d not defined for this chip!\n", op );
187+ avrdude_message(MSG_INFO, "Operation %d not defined for this chip!\n", op );
188188 return -1;
189189 }
190190 memset(cmd, 0, sizeof(cmd));
@@ -234,7 +234,7 @@
234234 if (usbpid) {
235235 pid = *(int *)(ldata(usbpid));
236236 if (lnext(usbpid))
237- avrdude_message("%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
237+ avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
238238 progname, pid);
239239 } else {
240240 pid = USBTINY_PRODUCT_DEFAULT;
@@ -246,8 +246,7 @@
246246 for ( dev = bus->devices; dev; dev = dev->next ) {
247247 if (dev->descriptor.idVendor == vid
248248 && dev->descriptor.idProduct == pid ) { // found match?
249- if(verbose)
250- avrdude_message("%s: usbdev_open(): Found USBtinyISP, bus:device: %s:%s\n",
249+ avrdude_message(MSG_NOTICE, "%s: usbdev_open(): Found USBtinyISP, bus:device: %s:%s\n",
251250 progname, bus->dirname, dev->filename);
252251 // if -P was given, match device by device name and bus name
253252 if(name != NULL &&
@@ -259,7 +258,7 @@
259258
260259 // wrong permissions or something?
261260 if (!PDATA(pgm)->usb_handle) {
262- avrdude_message("%s: Warning: cannot open USB device: %s\n",
261+ avrdude_message(MSG_INFO, "%s: Warning: cannot open USB device: %s\n",
263262 progname, usb_strerror());
264263 continue;
265264 }
@@ -268,12 +267,12 @@
268267 }
269268
270269 if(NULL != name && NULL == dev_name) {
271- avrdude_message("%s: Error: Invalid -P value: '%s'\n", progname, name);
272- avrdude_message("%sUse -P usb:bus:device\n", progbuf);
270+ avrdude_message(MSG_INFO, "%s: Error: Invalid -P value: '%s'\n", progname, name);
271+ avrdude_message(MSG_INFO, "%sUse -P usb:bus:device\n", progbuf);
273272 return -1;
274273 }
275274 if (!PDATA(pgm)->usb_handle) {
276- avrdude_message("%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
275+ avrdude_message(MSG_INFO, "%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
277276 progname, vid, pid );
278277 return -1;
279278 }
@@ -318,10 +317,8 @@
318317 if (PDATA(pgm)->sck_period > SCK_MAX)
319318 PDATA(pgm)->sck_period = SCK_MAX;
320319
321- if (verbose) {
322- avrdude_message("%s: Setting SCK period to %d usec\n", progname,
320+ avrdude_message(MSG_NOTICE, "%s: Setting SCK period to %d usec\n", progname,
323321 PDATA(pgm)->sck_period );
324- }
325322
326323 // send the command to the usbtiny device.
327324 // MEME: for at90's fix resetstate?
@@ -345,10 +342,8 @@
345342 } else {
346343 // -B option not specified: use default
347344 PDATA(pgm)->sck_period = SCK_DEFAULT;
348- if (verbose) {
349- avrdude_message("%s: Using SCK period of %d usec\n",
345+ avrdude_message(MSG_NOTICE, "%s: Using SCK period of %d usec\n",
350346 progname, PDATA(pgm)->sck_period );
351- }
352347 if (usb_control(pgm, USBTINY_POWERUP,
353348 PDATA(pgm)->sck_period, RESET_LOW ) < 0)
354349 return -1;
@@ -400,12 +395,10 @@
400395 if (nbytes < 0)
401396 return -1;
402397 check_retries(pgm, "SPI command");
403- if (verbose > 1) {
404- // print out the data we sent and received
405- avrdude_message("CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
398+ // print out the data we sent and received
399+ avrdude_message(MSG_NOTICE2, "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
406400 cmd[0], cmd[1], cmd[2], cmd[3],
407401 res[0], res[1], res[2], res[3] );
408- }
409402 return ((nbytes == 4) && // should have read 4 bytes
410403 res[2] == cmd[1]); // AVR's do a delayed-echo thing
411404 }
@@ -416,7 +409,7 @@
416409 unsigned char res[4];
417410
418411 if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
419- avrdude_message("Chip erase instruction not defined for part \"%s\"\n",
412+ avrdude_message(MSG_INFO, "Chip erase instruction not defined for part \"%s\"\n",
420413 p->desc);
421414 return -1;
422415 }
@@ -577,7 +570,7 @@
577570
578571 static int usbtiny_nousb_open(struct programmer_t *pgm, char * name)
579572 {
580- avrdude_message("%s: error: no usb support. Please compile again with libusb installed.\n",
573+ avrdude_message(MSG_INFO, "%s: error: no usb support. Please compile again with libusb installed.\n",
581574 progname);
582575
583576 return -1;
--- trunk/avrdude/wiring.c (revision 1320)
+++ trunk/avrdude/wiring.c (revision 1321)
@@ -85,7 +85,7 @@
8585 * Now prepare our data
8686 */
8787 if ((mycookie = malloc(sizeof(struct wiringpdata))) == 0) {
88- avrdude_message("%s: wiring_setup(): Out of memory allocating private data\n",
88+ avrdude_message(MSG_INFO, "%s: wiring_setup(): Out of memory allocating private data\n",
8989 progname);
9090 exit(1);
9191 }
@@ -123,21 +123,19 @@
123123 int newsnooze;
124124 if (sscanf(extended_param, "snooze=%i", &newsnooze) != 1 ||
125125 newsnooze < 0) {
126- avrdude_message("%s: wiring_parseextparms(): invalid snooze time '%s'\n",
126+ avrdude_message(MSG_INFO, "%s: wiring_parseextparms(): invalid snooze time '%s'\n",
127127 progname, extended_param);
128128 rv = -1;
129129 continue;
130130 }
131- if (verbose >= 2) {
132- avrdude_message("%s: wiring_parseextparms(): snooze time set to %d ms\n",
133- progname, newsnooze);
134- }
131+ avrdude_message(MSG_NOTICE2, "%s: wiring_parseextparms(): snooze time set to %d ms\n",
132+ progname, newsnooze);
135133 WIRINGPDATA(mycookie)->snoozetime = newsnooze;
136134
137135 continue;
138136 }
139137
140- avrdude_message("%s: wiring_parseextparms(): invalid extended parameter '%s'\n",
138+ avrdude_message(MSG_INFO, "%s: wiring_parseextparms(): invalid extended parameter '%s'\n",
141139 progname, extended_param);
142140 rv = -1;
143141 }
@@ -160,17 +158,12 @@
160158 if (WIRINGPDATA(mycookie)->snoozetime > 0) {
161159 timetosnooze = WIRINGPDATA(mycookie)->snoozetime;
162160
163- if (verbose >= 2) {
164- avrdude_message("%s: wiring_open(): snoozing for %d ms\n",
165- progname, timetosnooze);
166- }
161+ avrdude_message(MSG_NOTICE2, "%s: wiring_open(): snoozing for %d ms\n",
162+ progname, timetosnooze);
167163 while (timetosnooze--)
168164 usleep(1000);
169- if (verbose >= 2) {
170- avrdude_message("%s: wiring_open(): done snoozing\n",
171- progname);
172- }
173-
165+ avrdude_message(MSG_NOTICE2, "%s: wiring_open(): done snoozing\n",
166+ progname);
174167 } else {
175168 /* Perform Wiring programming mode RESET. */
176169 /* This effectively *releases* both DTR and RTS. */
@@ -177,10 +170,8 @@
177170 /* i.e. both DTR and RTS rise to a HIGH logic level */
178171 /* since they are active LOW signals. */
179172
180- if (verbose >= 2) {
181- avrdude_message("%s: wiring_open(): releasing DTR/RTS\n",
182- progname);
183- }
173+ avrdude_message(MSG_NOTICE2, "%s: wiring_open(): releasing DTR/RTS\n",
174+ progname);
184175
185176 serial_set_dtr_rts(&pgm->fd, 0);
186177 usleep(50*1000);
@@ -188,10 +179,8 @@
188179 /* After releasing for 50 milliseconds, DTR and RTS */
189180 /* are asserted (i.e. logic LOW) again. */
190181
191- if (verbose >= 2) {
192- avrdude_message("%s: wiring_open(): asserting DTR/RTS\n",
193- progname);
194- }
182+ avrdude_message(MSG_NOTICE2, "%s: wiring_open(): asserting DTR/RTS\n",
183+ progname);
195184
196185 serial_set_dtr_rts(&pgm->fd, 1);
197186 usleep(50*1000);
Show on old repository browser