Revision | 1321 (tree) |
---|---|
Time | 2014-06-14 05:07:40 |
Author | awachtler |
added verbose level in avrdude_message()
@@ -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 | + | |
1 | 49 | 2014-06-11 Rene Liebscher <R.Liebscher@gmx.de> |
2 | 50 | |
3 | 51 | bug #42516 spelling-error-in-binary |
@@ -45,7 +45,7 @@ | ||
45 | 45 | /* Signature byte reads are always 3 bytes. */ |
46 | 46 | |
47 | 47 | 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); | |
49 | 49 | return -1; |
50 | 50 | } |
51 | 51 |
@@ -57,17 +57,17 @@ | ||
57 | 57 | if (serial_recv(&pgm->fd, buf, 5) < 0) |
58 | 58 | return -1; |
59 | 59 | 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", | |
61 | 61 | progname); |
62 | 62 | return -1; |
63 | 63 | } 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, " | |
65 | 65 | "expect=0x%02x, resp=0x%02x\n", |
66 | 66 | progname, Resp_STK_INSYNC, buf[0]); |
67 | 67 | return -2; |
68 | 68 | } |
69 | 69 | 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, " | |
71 | 71 | "expect=0x%02x, resp=0x%02x\n", |
72 | 72 | progname, Resp_STK_OK, buf[4]); |
73 | 73 | return -3; |
@@ -60,7 +60,7 @@ | ||
60 | 60 | /* Set Pointer Register */ |
61 | 61 | mem = avr_locate_mem(p, "flash"); |
62 | 62 | 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", | |
64 | 64 | p->desc); |
65 | 65 | return -1; |
66 | 66 | } |
@@ -92,7 +92,7 @@ | ||
92 | 92 | |
93 | 93 | return 0; |
94 | 94 | } 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__); | |
96 | 96 | return -1; |
97 | 97 | } |
98 | 98 | } |
@@ -117,7 +117,7 @@ | ||
117 | 117 | cmd[0] = (TPI_CMD_SLDCS | TPI_REG_TPIIR); |
118 | 118 | err = pgm->cmd_tpi(pgm, cmd, 1, &response, sizeof(response)); |
119 | 119 | if (err || response != TPI_IDENT_CODE) { |
120 | - avrdude_message("TPIIR not correct\n"); | |
120 | + avrdude_message(MSG_INFO, "TPIIR not correct\n"); | |
121 | 121 | return -1; |
122 | 122 | } |
123 | 123 |
@@ -137,12 +137,12 @@ | ||
137 | 137 | return 0; |
138 | 138 | } |
139 | 139 | |
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"); | |
142 | 142 | return -1; |
143 | 143 | |
144 | 144 | } 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__); | |
146 | 146 | return -1; |
147 | 147 | } |
148 | 148 | } |
@@ -187,7 +187,7 @@ | ||
187 | 187 | OPCODE * readop, * lext; |
188 | 188 | |
189 | 189 | 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" | |
191 | 191 | "provide a cmd() method.\n", |
192 | 192 | progname, pgm->type); |
193 | 193 | return -1; |
@@ -198,7 +198,7 @@ | ||
198 | 198 | |
199 | 199 | if (p->flags & AVRPART_HAS_TPI) { |
200 | 200 | 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", | |
202 | 202 | progname, pgm->type); |
203 | 203 | return -1; |
204 | 204 | } |
@@ -233,7 +233,7 @@ | ||
233 | 233 | |
234 | 234 | if (readop == NULL) { |
235 | 235 | #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", | |
237 | 237 | mem->desc); |
238 | 238 | #endif |
239 | 239 | return -1; |
@@ -318,7 +318,7 @@ | ||
318 | 318 | if (v != NULL) |
319 | 319 | vmem = avr_locate_mem(v, memtype); |
320 | 320 | 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", | |
322 | 322 | memtype, p->desc); |
323 | 323 | return -1; |
324 | 324 | } |
@@ -351,7 +351,7 @@ | ||
351 | 351 | rc = pgm->cmd_tpi(pgm, cmd, 1, mem->buf + i, 1); |
352 | 352 | lastaddr++; |
353 | 353 | 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); | |
355 | 355 | return -1; |
356 | 356 | } |
357 | 357 | } |
@@ -407,8 +407,8 @@ | ||
407 | 407 | if (rc < 0) |
408 | 408 | /* paged load failed, fall back to byte-at-a-time read below */ |
409 | 409 | 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", | |
412 | 412 | progname, pageaddr / mem->page_size); |
413 | 413 | } |
414 | 414 | nread++; |
@@ -438,9 +438,9 @@ | ||
438 | 438 | { |
439 | 439 | rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i); |
440 | 440 | 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); | |
442 | 442 | 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", | |
444 | 444 | memtype); |
445 | 445 | return -2; |
446 | 446 | } |
@@ -469,7 +469,7 @@ | ||
469 | 469 | OPCODE * wp, * lext; |
470 | 470 | |
471 | 471 | 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" | |
473 | 473 | "provide a cmd() method.\n", |
474 | 474 | progname, pgm->type); |
475 | 475 | return -1; |
@@ -477,7 +477,7 @@ | ||
477 | 477 | |
478 | 478 | wp = mem->op[AVR_OP_WRITEPAGE]; |
479 | 479 | 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", | |
481 | 481 | mem->desc); |
482 | 482 | return -1; |
483 | 483 | } |
@@ -539,7 +539,7 @@ | ||
539 | 539 | struct timeval tv; |
540 | 540 | |
541 | 541 | 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" | |
543 | 543 | "provide a cmd() method.\n", |
544 | 544 | progname, pgm->type); |
545 | 545 | return -1; |
@@ -547,16 +547,16 @@ | ||
547 | 547 | |
548 | 548 | if (p->flags & AVRPART_HAS_TPI) { |
549 | 549 | 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", | |
551 | 551 | progname, pgm->type); |
552 | 552 | return -1; |
553 | 553 | } |
554 | 554 | |
555 | 555 | 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); | |
557 | 557 | return -1; |
558 | 558 | } 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); | |
560 | 560 | return -1; |
561 | 561 | } |
562 | 562 |
@@ -644,7 +644,7 @@ | ||
644 | 644 | |
645 | 645 | if (writeop == NULL) { |
646 | 646 | #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", | |
648 | 648 | mem->desc); |
649 | 649 | #endif |
650 | 650 | return -1; |
@@ -737,24 +737,24 @@ | ||
737 | 737 | * device if the data read back does not match what we wrote. |
738 | 738 | */ |
739 | 739 | 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", | |
741 | 741 | progname); |
742 | 742 | 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); | |
744 | 744 | pgm->powerdown(pgm); |
745 | 745 | usleep(250000); |
746 | 746 | rc = pgm->initialize(pgm, p); |
747 | 747 | 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 " | |
750 | 750 | "%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" | |
752 | 752 | "%s: %s to continue.\n", |
753 | 753 | progname, progname, progname); |
754 | 754 | return -3; |
755 | 755 | } |
756 | 756 | |
757 | - avrdude_message("%s: device was successfully re-initialized\n", | |
757 | + avrdude_message(MSG_INFO, "%s: device was successfully re-initialized\n", | |
758 | 758 | progname); |
759 | 759 | return 0; |
760 | 760 | } |
@@ -836,7 +836,7 @@ | ||
836 | 836 | |
837 | 837 | m = avr_locate_mem(p, memtype); |
838 | 838 | 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", | |
840 | 840 | memtype, p->desc); |
841 | 841 | return -1; |
842 | 842 | } |
@@ -850,7 +850,7 @@ | ||
850 | 850 | wsize = size; |
851 | 851 | } |
852 | 852 | 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" | |
854 | 854 | "bytes\n" |
855 | 855 | "%sOnly %d bytes will actually be written\n", |
856 | 856 | progname, size, wsize, |
@@ -940,8 +940,8 @@ | ||
940 | 940 | if (rc < 0) |
941 | 941 | /* paged write failed, fall back to byte-at-a-time write below */ |
942 | 942 | 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", | |
945 | 945 | progname, pageaddr / m->page_size); |
946 | 946 | } |
947 | 947 | nwritten++; |
@@ -1001,8 +1001,8 @@ | ||
1001 | 1001 | if (do_write) { |
1002 | 1002 | rc = avr_write_byte(pgm, p, m, i, data); |
1003 | 1003 | if (rc) { |
1004 | - avrdude_message(" ***failed; "); | |
1005 | - avrdude_message("\n"); | |
1004 | + avrdude_message(MSG_INFO, " ***failed; "); | |
1005 | + avrdude_message(MSG_INFO, "\n"); | |
1006 | 1006 | pgm->err_led(pgm, ON); |
1007 | 1007 | werror = 1; |
1008 | 1008 | } |
@@ -1015,11 +1015,11 @@ | ||
1015 | 1015 | if (flush_page) { |
1016 | 1016 | rc = avr_write_page(pgm, p, m, i); |
1017 | 1017 | 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 " | |
1019 | 1019 | "to write\n", |
1020 | 1020 | i % m->page_size, |
1021 | 1021 | i - m->page_size + 1, i); |
1022 | - avrdude_message("\n"); | |
1022 | + avrdude_message(MSG_INFO, "\n"); | |
1023 | 1023 | pgm->err_led(pgm, ON); |
1024 | 1024 | werror = 1; |
1025 | 1025 | } |
@@ -1049,7 +1049,7 @@ | ||
1049 | 1049 | report_progress (0,1,"Reading"); |
1050 | 1050 | rc = avr_read(pgm, p, "signature", 0); |
1051 | 1051 | 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", | |
1053 | 1053 | progname, p->desc, rc); |
1054 | 1054 | return -1; |
1055 | 1055 | } |
@@ -1075,7 +1075,7 @@ | ||
1075 | 1075 | |
1076 | 1076 | a = avr_locate_mem(p, memtype); |
1077 | 1077 | 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", | |
1079 | 1079 | memtype, p->desc); |
1080 | 1080 | return -1; |
1081 | 1081 | } |
@@ -1082,7 +1082,7 @@ | ||
1082 | 1082 | |
1083 | 1083 | b = avr_locate_mem(v, memtype); |
1084 | 1084 | 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", | |
1086 | 1086 | memtype, v->desc); |
1087 | 1087 | return -1; |
1088 | 1088 | } |
@@ -1092,7 +1092,7 @@ | ||
1092 | 1092 | vsize = a->size; |
1093 | 1093 | |
1094 | 1094 | 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" | |
1096 | 1096 | "%s%s memory region only contains %d bytes\n" |
1097 | 1097 | "%sOnly %d bytes will be verified.\n", |
1098 | 1098 | progname, size, |
@@ -1104,7 +1104,7 @@ | ||
1104 | 1104 | for (i=0; i<size; i++) { |
1105 | 1105 | if ((b->tags[i] & TAG_ALLOCATED) != 0 && |
1106 | 1106 | 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" | |
1108 | 1108 | "%s0x%02x != 0x%02x\n", |
1109 | 1109 | progname, i, |
1110 | 1110 | progbuf, buf1[i], buf2[i]); |
@@ -1132,7 +1132,7 @@ | ||
1132 | 1132 | for (i=4; i>0; i--) { |
1133 | 1133 | rc = pgm->read_byte(pgm, p, a, a->size-i, &v1); |
1134 | 1134 | 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", | |
1136 | 1136 | progname, rc); |
1137 | 1137 | return -1; |
1138 | 1138 | } |
@@ -1173,7 +1173,7 @@ | ||
1173 | 1173 | |
1174 | 1174 | rc = avr_write_byte(pgm, p, a, a->size-i, v1); |
1175 | 1175 | 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", | |
1177 | 1177 | progname, rc); |
1178 | 1178 | return -1; |
1179 | 1179 | } |
@@ -57,7 +57,7 @@ | ||
57 | 57 | static void avr910_setup(PROGRAMMER * pgm) |
58 | 58 | { |
59 | 59 | 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", | |
61 | 61 | progname); |
62 | 62 | exit(1); |
63 | 63 | } |
@@ -83,7 +83,7 @@ | ||
83 | 83 | |
84 | 84 | rv = serial_recv(&pgm->fd, (unsigned char *)buf, len); |
85 | 85 | 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", | |
87 | 87 | progname); |
88 | 88 | return 1; |
89 | 89 | } |
@@ -103,7 +103,7 @@ | ||
103 | 103 | |
104 | 104 | avr910_recv(pgm, &c, 1); |
105 | 105 | 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", | |
107 | 107 | progname, errmsg); |
108 | 108 | return 1; |
109 | 109 | } |
@@ -185,9 +185,9 @@ | ||
185 | 185 | avr910_send(pgm, "p", 1); |
186 | 186 | avr910_recv(pgm, &type, 1); |
187 | 187 | |
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]); | |
191 | 191 | |
192 | 192 | /* See if programmer supports autoincrement of address. */ |
193 | 193 |
@@ -194,7 +194,7 @@ | ||
194 | 194 | avr910_send(pgm, "a", 1); |
195 | 195 | avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1); |
196 | 196 | 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"); | |
198 | 198 | |
199 | 199 | /* Check support for buffered memory access, ignore if not available */ |
200 | 200 |
@@ -206,7 +206,7 @@ | ||
206 | 206 | PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8; |
207 | 207 | avr910_recv(pgm, &c, 1); |
208 | 208 | 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 " | |
210 | 210 | "buffersize = %u bytes.\n", |
211 | 211 | PDATA(pgm)->buffersize); |
212 | 212 | PDATA(pgm)->use_blockmode = 1; |
@@ -224,7 +224,7 @@ | ||
224 | 224 | /* Get list of devices that the programmer supports. */ |
225 | 225 | |
226 | 226 | 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"); | |
228 | 228 | devtype_1st = 0; |
229 | 229 | while (1) { |
230 | 230 | avr910_recv(pgm, &c, 1); |
@@ -234,7 +234,7 @@ | ||
234 | 234 | break; |
235 | 235 | part = locate_part_by_avr910_devcode(part_list, c); |
236 | 236 | |
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)"); | |
238 | 238 | |
239 | 239 | /* FIXME: Need to lookup devcode and report the device. */ |
240 | 240 |
@@ -241,10 +241,10 @@ | ||
241 | 241 | if (p->avr910_devcode == c) |
242 | 242 | dev_supported = 1; |
243 | 243 | }; |
244 | - avrdude_message("\n"); | |
244 | + avrdude_message(MSG_INFO, "\n"); | |
245 | 245 | |
246 | 246 | 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", | |
248 | 248 | progname, ovsigck? "warning": "error", p->id); |
249 | 249 | if (!ovsigck) |
250 | 250 | return -1; |
@@ -264,9 +264,8 @@ | ||
264 | 264 | avr910_send(pgm, buf, 2); |
265 | 265 | avr910_vfy_cmd_sent(pgm, "select device"); |
266 | 266 | |
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]); | |
270 | 269 | |
271 | 270 | avr910_enter_prog_mode(pgm); |
272 | 271 |
@@ -332,30 +331,26 @@ | ||
332 | 331 | int devcode; |
333 | 332 | if (sscanf(extended_param, "devcode=%i", &devcode) != 1 || |
334 | 333 | 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", | |
336 | 335 | progname, extended_param); |
337 | 336 | rv = -1; |
338 | 337 | continue; |
339 | 338 | } |
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); | |
344 | 341 | PDATA(pgm)->devcode = devcode; |
345 | 342 | |
346 | 343 | continue; |
347 | 344 | } |
348 | 345 | 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); | |
353 | 348 | PDATA(pgm)->test_blockmode = 0; |
354 | 349 | |
355 | 350 | continue; |
356 | 351 | } |
357 | 352 | |
358 | - avrdude_message("%s: avr910_parseextparms(): invalid extended parameter '%s'\n", | |
353 | + avrdude_message(MSG_INFO, "%s: avr910_parseextparms(): invalid extended parameter '%s'\n", | |
359 | 354 | progname, extended_param); |
360 | 355 | rv = -1; |
361 | 356 | } |
@@ -728,7 +723,7 @@ | ||
728 | 723 | unsigned char tmp; |
729 | 724 | |
730 | 725 | 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); | |
732 | 727 | return -1; |
733 | 728 | } |
734 | 729 |
@@ -28,8 +28,15 @@ | ||
28 | 28 | extern int verbose; /* verbosity level (-v, -vv, ...) */ |
29 | 29 | extern int quell_progress; /* quiteness level (-q, -qq) */ |
30 | 30 | |
31 | -int avrdude_message(const char *format, ...); | |
31 | +int avrdude_message(const int msglvl, const char *format, ...); | |
32 | 32 | |
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 | + | |
33 | 40 | #if defined(WIN32NATIVE) |
34 | 41 | |
35 | 42 | #include "ac_cfg.h" |
@@ -52,7 +52,7 @@ | ||
52 | 52 | |
53 | 53 | static int avrftdi_noftdi_open (struct programmer_t *pgm, char * name) |
54 | 54 | { |
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", | |
56 | 56 | progname); |
57 | 57 | |
58 | 58 | return -1; |
@@ -142,17 +142,17 @@ | ||
142 | 142 | if(!skip_prefix) |
143 | 143 | { |
144 | 144 | 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, " "); | |
151 | 151 | } |
152 | - avrdude_message("%s(%d): ", func, line); | |
152 | + avrdude_message(MSG_INFO, "%s(%d): ", func, line); | |
153 | 153 | } |
154 | 154 | va_start(ap, fmt); |
155 | - avrdude_message(fmt, ap); | |
155 | + avrdude_message(MSG_INFO, fmt, ap); | |
156 | 156 | va_end(ap); |
157 | 157 | } |
158 | 158 |
@@ -172,16 +172,16 @@ | ||
172 | 172 | int offset, int width) |
173 | 173 | { |
174 | 174 | int i; |
175 | - avrdude_message("%s begin:\n", desc); | |
175 | + avrdude_message(MSG_INFO, "%s begin:\n", desc); | |
176 | 176 | 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"); | |
179 | 179 | for (i++; i <= len; i++) { |
180 | - avrdude_message("%02x ", buf[i-1]); | |
180 | + avrdude_message(MSG_INFO, "%02x ", buf[i-1]); | |
181 | 181 | if((i-offset) != 0 && (i-offset)%width == 0) |
182 | - avrdude_message("\n"); | |
182 | + avrdude_message(MSG_INFO, "\n"); | |
183 | 183 | } |
184 | - avrdude_message("%s end\n", desc); | |
184 | + avrdude_message(MSG_INFO, "%s end\n", desc); | |
185 | 185 | } |
186 | 186 | |
187 | 187 | /* |
@@ -354,7 +354,7 @@ | ||
354 | 354 | size_t max_size = MIN(pdata->ftdic->max_packet_size,pdata->tx_buffer_size); |
355 | 355 | // select block size so that resulting commands does not exceed max_size if possible |
356 | 356 | 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); | |
358 | 358 | |
359 | 359 | while(remaining) |
360 | 360 | { |
@@ -670,7 +670,7 @@ | ||
670 | 670 | if (usbpid) { |
671 | 671 | pid = *(int *)(ldata(usbpid)); |
672 | 672 | 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", | |
674 | 674 | progname, pid); |
675 | 675 | } else |
676 | 676 | pid = USB_DEVICE_FT2232; |
@@ -36,7 +36,7 @@ | ||
36 | 36 | |
37 | 37 | m = (OPCODE *)malloc(sizeof(*m)); |
38 | 38 | 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"); | |
40 | 40 | exit(1); |
41 | 41 | } |
42 | 42 |
@@ -56,7 +56,7 @@ | ||
56 | 56 | |
57 | 57 | m = (OPCODE *)malloc(sizeof(*m)); |
58 | 58 | 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"); | |
60 | 60 | exit(1); |
61 | 61 | } |
62 | 62 |
@@ -249,7 +249,7 @@ | ||
249 | 249 | |
250 | 250 | m = (AVRMEM *)malloc(sizeof(*m)); |
251 | 251 | 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"); | |
253 | 253 | exit(1); |
254 | 254 | } |
255 | 255 |
@@ -272,13 +272,13 @@ | ||
272 | 272 | m = ldata(ln); |
273 | 273 | m->buf = (unsigned char *) malloc(m->size); |
274 | 274 | 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", | |
276 | 276 | progname, m->desc, m->size); |
277 | 277 | return -1; |
278 | 278 | } |
279 | 279 | m->tags = (unsigned char *) malloc(m->size); |
280 | 280 | 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", | |
282 | 282 | progname, m->desc, m->size); |
283 | 283 | return -1; |
284 | 284 | } |
@@ -300,7 +300,7 @@ | ||
300 | 300 | if (m->buf != NULL) { |
301 | 301 | n->buf = (unsigned char *)malloc(n->size); |
302 | 302 | 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", | |
304 | 304 | n->size); |
305 | 305 | exit(1); |
306 | 306 | } |
@@ -310,7 +310,7 @@ | ||
310 | 310 | if (m->tags != NULL) { |
311 | 311 | n->tags = (unsigned char *)malloc(n->size); |
312 | 312 | 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", | |
314 | 314 | n->size); |
315 | 315 | exit(1); |
316 | 316 | } |
@@ -404,7 +404,7 @@ | ||
404 | 404 | m->readback[0], |
405 | 405 | m->readback[1]); |
406 | 406 | if (verbose > 4) { |
407 | - avrdude_message("%s Memory Ops:\n" | |
407 | + avrdude_message(MSG_TRACE2, "%s Memory Ops:\n" | |
408 | 408 | "%s Oeration Inst Bit Bit Type Bitno Value\n" |
409 | 409 | "%s ----------- -------- -------- ----- -----\n", |
410 | 410 | prefix, prefix, prefix); |
@@ -441,7 +441,7 @@ | ||
441 | 441 | |
442 | 442 | p = (AVRPART *)malloc(sizeof(AVRPART)); |
443 | 443 | if (p == NULL) { |
444 | - avrdude_message("new_part(): out of memory\n"); | |
444 | + avrdude_message(MSG_INFO, "new_part(): out of memory\n"); | |
445 | 445 | exit(1); |
446 | 446 | } |
447 | 447 |
@@ -73,9 +73,8 @@ | ||
73 | 73 | if (QueryPerformanceFrequency(&freq)) |
74 | 74 | { |
75 | 75 | 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); | |
79 | 78 | } |
80 | 79 | else |
81 | 80 | { |
@@ -88,9 +87,8 @@ | ||
88 | 87 | * auto-calibration figures seen on various Unix systems on |
89 | 88 | * comparable hardware. |
90 | 89 | */ |
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); | |
94 | 92 | delay_decrement = 100; |
95 | 93 | } |
96 | 94 | #else /* !WIN32NATIVE */ |
@@ -97,9 +95,8 @@ | ||
97 | 95 | struct itimerval itv; |
98 | 96 | volatile int i; |
99 | 97 | |
100 | - if (verbose >= 2) | |
101 | - avrdude_message("%s: Calibrating delay loop...", | |
102 | - progname); | |
98 | + avrdude_message(MSG_NOTICE2, "%s: Calibrating delay loop...", | |
99 | + progname); | |
103 | 100 | i = 0; |
104 | 101 | done = 0; |
105 | 102 | saved_alarmhandler = signal(SIGALRM, alarmhandler); |
@@ -125,9 +122,8 @@ | ||
125 | 122 | * Calculate back from 100 ms to 1 us. |
126 | 123 | */ |
127 | 124 | 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); | |
131 | 127 | #endif /* WIN32NATIVE */ |
132 | 128 | } |
133 | 129 |
@@ -266,7 +262,7 @@ | ||
266 | 262 | break; |
267 | 263 | } |
268 | 264 | 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"); | |
270 | 266 | return -1; |
271 | 267 | } |
272 | 268 |
@@ -281,7 +277,7 @@ | ||
281 | 277 | |
282 | 278 | /* parity bit */ |
283 | 279 | 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"); | |
285 | 281 | return -1; |
286 | 282 | } |
287 | 283 |
@@ -290,7 +286,7 @@ | ||
290 | 286 | b &= bitbang_tpi_clk(pgm); |
291 | 287 | b &= bitbang_tpi_clk(pgm); |
292 | 288 | 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"); | |
294 | 290 | return -1; |
295 | 291 | } |
296 | 292 |
@@ -337,15 +333,15 @@ | ||
337 | 333 | |
338 | 334 | if(verbose >= 2) |
339 | 335 | { |
340 | - avrdude_message("bitbang_cmd(): [ "); | |
336 | + avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ "); | |
341 | 337 | 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, "] [ "); | |
344 | 340 | for(i = 0; i < 4; i++) |
345 | 341 | { |
346 | - avrdude_message("%02X ", res[i]); | |
342 | + avrdude_message(MSG_NOTICE2, "%02X ", res[i]); | |
347 | 343 | } |
348 | - avrdude_message("]\n"); | |
344 | + avrdude_message(MSG_NOTICE2, "]\n"); | |
349 | 345 | } |
350 | 346 | |
351 | 347 | return 0; |
@@ -372,15 +368,15 @@ | ||
372 | 368 | |
373 | 369 | if(verbose >= 2) |
374 | 370 | { |
375 | - avrdude_message("bitbang_cmd_tpi(): [ "); | |
371 | + avrdude_message(MSG_NOTICE2, "bitbang_cmd_tpi(): [ "); | |
376 | 372 | 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, "] [ "); | |
379 | 375 | for(i = 0; i < res_len; i++) |
380 | 376 | { |
381 | - avrdude_message("%02X ", res[i]); | |
377 | + avrdude_message(MSG_NOTICE2, "%02X ", res[i]); | |
382 | 378 | } |
383 | - avrdude_message("]\n"); | |
379 | + avrdude_message(MSG_NOTICE2, "]\n"); | |
384 | 380 | } |
385 | 381 | |
386 | 382 | pgm->pgm_led(pgm, OFF); |
@@ -408,15 +404,15 @@ | ||
408 | 404 | |
409 | 405 | if(verbose >= 2) |
410 | 406 | { |
411 | - avrdude_message("bitbang_cmd(): [ "); | |
407 | + avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ "); | |
412 | 408 | 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, "] [ "); | |
415 | 411 | for(i = 0; i < count; i++) |
416 | 412 | { |
417 | - avrdude_message("%02X ", res[i]); | |
413 | + avrdude_message(MSG_NOTICE2, "%02X ", res[i]); | |
418 | 414 | } |
419 | - avrdude_message("]\n"); | |
415 | + avrdude_message(MSG_NOTICE2, "]\n"); | |
420 | 416 | } |
421 | 417 | |
422 | 418 | return 0; |
@@ -444,7 +440,7 @@ | ||
444 | 440 | /* Set Pointer Register */ |
445 | 441 | mem = avr_locate_mem(p, "flash"); |
446 | 442 | 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", | |
448 | 444 | p->desc); |
449 | 445 | return -1; |
450 | 446 | } |
@@ -465,7 +461,7 @@ | ||
465 | 461 | } |
466 | 462 | |
467 | 463 | 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", | |
469 | 465 | p->desc); |
470 | 466 | return -1; |
471 | 467 | } |
@@ -506,7 +502,7 @@ | ||
506 | 502 | } |
507 | 503 | |
508 | 504 | 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", | |
510 | 506 | p->desc); |
511 | 507 | return -1; |
512 | 508 | } |
@@ -539,7 +535,7 @@ | ||
539 | 535 | if (p->flags & AVRPART_HAS_TPI) { |
540 | 536 | /* make sure cmd_tpi() is defined */ |
541 | 537 | 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", | |
543 | 539 | progname, pgm->type); |
544 | 540 | return -1; |
545 | 541 | } |
@@ -548,22 +544,20 @@ | ||
548 | 544 | pgm->setpin(pgm, PIN_AVR_RESET, 1); |
549 | 545 | usleep(1000); |
550 | 546 | |
551 | - if (verbose >= 2) | |
552 | - avrdude_message("doing MOSI-MISO link check\n"); | |
547 | + avrdude_message(MSG_NOTICE2, "doing MOSI-MISO link check\n"); | |
553 | 548 | |
554 | 549 | pgm->setpin(pgm, PIN_AVR_MOSI, 0); |
555 | 550 | 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"); | |
557 | 552 | return -1; |
558 | 553 | } |
559 | 554 | pgm->setpin(pgm, PIN_AVR_MOSI, 1); |
560 | 555 | 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"); | |
562 | 557 | return -1; |
563 | 558 | } |
564 | 559 | |
565 | - if (verbose >= 2) | |
566 | - avrdude_message("MOSI-MISO link present\n"); | |
560 | + avrdude_message(MSG_NOTICE2, "MOSI-MISO link present\n"); | |
567 | 561 | } |
568 | 562 | |
569 | 563 | pgm->setpin(pgm, PIN_AVR_SCK, 0); |
@@ -584,7 +578,7 @@ | ||
584 | 578 | bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR); |
585 | 579 | rc = bitbang_tpi_rx(pgm); |
586 | 580 | if (rc != 0x80) { |
587 | - avrdude_message("TPIIR not correct\n"); | |
581 | + avrdude_message(MSG_INFO, "TPIIR not correct\n"); | |
588 | 582 | return -1; |
589 | 583 | } |
590 | 584 | } else { |
@@ -618,7 +612,7 @@ | ||
618 | 612 | * can't sync with the device, maybe it's not attached? |
619 | 613 | */ |
620 | 614 | if (rc) { |
621 | - avrdude_message("%s: AVR device not responding\n", progname); | |
615 | + avrdude_message(MSG_INFO, "%s: AVR device not responding\n", progname); | |
622 | 616 | return -1; |
623 | 617 | } |
624 | 618 | } |
@@ -629,7 +623,7 @@ | ||
629 | 623 | static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc) |
630 | 624 | { |
631 | 625 | 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", | |
633 | 627 | progname, desc); |
634 | 628 | return -1; |
635 | 629 | } |
@@ -653,7 +647,7 @@ | ||
653 | 647 | return -1; |
654 | 648 | |
655 | 649 | 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", | |
657 | 651 | progname); |
658 | 652 | return -1; |
659 | 653 | } |
@@ -97,15 +97,15 @@ | ||
97 | 97 | |
98 | 98 | for (i = 0; i<len; i++) { |
99 | 99 | 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); | |
102 | 102 | if (i % 8 == 3) |
103 | - avrdude_message(" "); | |
103 | + avrdude_message(MSG_INFO, " "); | |
104 | 104 | else if (i % 8 == 7) |
105 | - avrdude_message("\n"); | |
105 | + avrdude_message(MSG_INFO, "\n"); | |
106 | 106 | } |
107 | 107 | if (i % 8 != 7) |
108 | - avrdude_message("\n"); | |
108 | + avrdude_message(MSG_INFO, "\n"); | |
109 | 109 | } |
110 | 110 | |
111 | 111 | static int buspirate_send_bin(struct programmer_t *pgm, char *data, size_t len) |
@@ -113,7 +113,7 @@ | ||
113 | 113 | int rc; |
114 | 114 | |
115 | 115 | if (verbose > 1) { |
116 | - avrdude_message("%s: buspirate_send_bin():\n", progname); | |
116 | + avrdude_message(MSG_INFO, "%s: buspirate_send_bin():\n", progname); | |
117 | 117 | dump_mem(data, len); |
118 | 118 | } |
119 | 119 |
@@ -130,7 +130,7 @@ | ||
130 | 130 | if (rc < 0) |
131 | 131 | return EOF; |
132 | 132 | if (verbose > 1) { |
133 | - avrdude_message("%s: buspirate_recv_bin():\n", progname); | |
133 | + avrdude_message(MSG_INFO, "%s: buspirate_recv_bin():\n", progname); | |
134 | 134 | dump_mem(buf, len); |
135 | 135 | } |
136 | 136 |
@@ -143,7 +143,7 @@ | ||
143 | 143 | { |
144 | 144 | char *recv_buf = alloca(expect_len); |
145 | 145 | 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"); | |
147 | 147 | return -1; |
148 | 148 | } |
149 | 149 |
@@ -168,7 +168,7 @@ | ||
168 | 168 | unsigned char ch = 0; |
169 | 169 | |
170 | 170 | 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"); | |
172 | 172 | return EOF; |
173 | 173 | } |
174 | 174 |
@@ -206,10 +206,9 @@ | ||
206 | 206 | serial_recv_timeout = PDATA(pgm)->serial_recv_timeout; |
207 | 207 | } |
208 | 208 | 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"); | |
213 | 212 | if (! buf[0]) |
214 | 213 | return NULL; |
215 | 214 |
@@ -222,7 +221,7 @@ | ||
222 | 221 | |
223 | 222 | ret = buspirate_readline_noexit(pgm, buf, len); |
224 | 223 | 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", | |
226 | 225 | progname); |
227 | 226 | return NULL; |
228 | 227 | } |
@@ -232,11 +231,10 @@ | ||
232 | 231 | { |
233 | 232 | int rc; |
234 | 233 | |
235 | - if (verbose) | |
236 | - avrdude_message("%s: buspirate_send(): %s", progname, str); | |
234 | + avrdude_message(MSG_NOTICE, "%s: buspirate_send(): %s", progname, str); | |
237 | 235 | |
238 | 236 | 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"); | |
240 | 238 | return -1; |
241 | 239 | } |
242 | 240 |
@@ -309,8 +307,8 @@ | ||
309 | 307 | } |
310 | 308 | if (sscanf(extended_param, "spifreq=%d", &spifreq) == 1) { |
311 | 309 | 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"); | |
314 | 312 | return -1; |
315 | 313 | } |
316 | 314 | pgm->flag = (pgm->flag & ~BP_FLAG_XPARM_RAWFREQ) | |
@@ -322,7 +320,7 @@ | ||
322 | 320 | unsigned rawfreq; |
323 | 321 | if (sscanf(extended_param, "rawfreq=%u", &rawfreq) == 1) { |
324 | 322 | if (rawfreq >= 4) { |
325 | - avrdude_message("BusPirate: rawfreq must be " | |
323 | + avrdude_message(MSG_INFO, "BusPirate: rawfreq must be " | |
326 | 324 | "between 0 and 3.\n"); |
327 | 325 | return -1; |
328 | 326 | } |
@@ -335,8 +333,8 @@ | ||
335 | 333 | if (sscanf(extended_param, "cpufreq=%d", &cpufreq) == 1) { |
336 | 334 | /* lower limit comes from 'cpufreq > 4 * spifreq', spifreq in ascii mode is 30kHz. */ |
337 | 335 | 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"); | |
340 | 338 | return -1; |
341 | 339 | } |
342 | 340 | PDATA(pgm)->cpufreq = cpufreq; |
@@ -355,7 +353,7 @@ | ||
355 | 353 | else if (strcasecmp(resetpin, "aux2") == 0) |
356 | 354 | PDATA(pgm)->reset |= BP_RESET_AUX2; |
357 | 355 | 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"); | |
359 | 357 | return -1; |
360 | 358 | } |
361 | 359 | } |
@@ -374,7 +372,7 @@ | ||
374 | 372 | } |
375 | 373 | if (sscanf(extended_param, "serial_recv_timeout=%d", &serial_recv_timeout) == 1) { |
376 | 374 | 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"); | |
378 | 376 | return -1; |
379 | 377 | } |
380 | 378 | PDATA(pgm)->serial_recv_timeout = serial_recv_timeout; |
@@ -393,18 +391,18 @@ | ||
393 | 391 | PDATA(pgm)->reset |= BP_RESET_CS; |
394 | 392 | |
395 | 393 | 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"); | |
397 | 395 | return -1; |
398 | 396 | } |
399 | 397 | |
400 | 398 | if (( (pgm->flag & BP_FLAG_XPARM_SPIFREQ) || |
401 | 399 | (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"); | |
403 | 401 | return -1; |
404 | 402 | } |
405 | 403 | |
406 | 404 | 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"); | |
408 | 406 | return -1; |
409 | 407 | } |
410 | 408 |
@@ -463,12 +461,11 @@ | ||
463 | 461 | } |
464 | 462 | |
465 | 463 | 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"); | |
467 | 465 | return; |
468 | 466 | } |
469 | 467 | |
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"); | |
472 | 469 | } |
473 | 470 | |
474 | 471 | static int buspirate_start_mode_bin(struct programmer_t *pgm) |
@@ -513,13 +510,12 @@ | ||
513 | 510 | memset(buf, 0, sizeof(buf)); |
514 | 511 | buspirate_recv_bin(pgm, buf, 5); |
515 | 512 | 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); | |
517 | 514 | buspirate_reset_from_binmode(pgm); |
518 | 515 | return -1; |
519 | 516 | } |
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); | |
523 | 519 | |
524 | 520 | pgm->flag |= BP_FLAG_IN_BINMODE; |
525 | 521 |
@@ -530,18 +526,16 @@ | ||
530 | 526 | buspirate_recv_bin(pgm, buf, 4); |
531 | 527 | if (sscanf(buf, submode->entered_format, |
532 | 528 | &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", | |
534 | 530 | submode->name, buf); |
535 | 531 | buspirate_reset_from_binmode(pgm); |
536 | 532 | return -1; |
537 | 533 | } |
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); | |
541 | 536 | |
542 | 537 | 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); | |
545 | 539 | pgm->paged_write = NULL; |
546 | 540 | } else { |
547 | 541 | /* Check for write-then-read without !CS/CS and disable paged_write if absent: */ |
@@ -558,14 +552,12 @@ | ||
558 | 552 | buf[0] = 0x1; |
559 | 553 | buspirate_send_bin(pgm, buf, 1); |
560 | 554 | |
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); | |
563 | 556 | |
564 | 557 | /* Flush serial buffer: */ |
565 | 558 | serial_drain(&pgm->fd, 0); |
566 | 559 | } 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); | |
569 | 561 | } |
570 | 562 | } |
571 | 563 |
@@ -586,8 +578,7 @@ | ||
586 | 578 | |
587 | 579 | /* AVR Extended Commands - test for existence */ |
588 | 580 | 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); | |
591 | 582 | pgm->paged_load = NULL; |
592 | 583 | } else { |
593 | 584 | int rv = buspirate_expect_bin_byte(pgm, 0x06, 0x01); |
@@ -598,9 +589,9 @@ | ||
598 | 589 | buspirate_send_bin(pgm, buf, 1); |
599 | 590 | buspirate_recv_bin(pgm, buf, 3); |
600 | 591 | 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); | |
602 | 593 | } else { |
603 | - if (verbose) avrdude_message("AVR Extended Commands not found.\n"); | |
594 | + avrdude_message(MSG_NOTICE, "AVR Extended Commands not found.\n"); | |
604 | 595 | pgm->flag |= BP_FLAG_NOPAGEDREAD; |
605 | 596 | pgm->paged_load = NULL; |
606 | 597 | } |
@@ -626,9 +617,9 @@ | ||
626 | 617 | break; |
627 | 618 | } |
628 | 619 | 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", | |
630 | 621 | 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", | |
632 | 623 | progname); |
633 | 624 | return -1; |
634 | 625 | } |
@@ -646,7 +637,7 @@ | ||
646 | 637 | } |
647 | 638 | if (buspirate_is_prompt(rcvd)) { |
648 | 639 | 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"); | |
650 | 641 | break; |
651 | 642 | } |
652 | 643 | /* Not yet 'SPI>' prompt */ |
@@ -673,7 +664,7 @@ | ||
673 | 664 | |
674 | 665 | /* Attempt to start binary SPI mode unless explicitly told otherwise: */ |
675 | 666 | 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"); | |
677 | 668 | |
678 | 669 | /* Send two CRs to ensure we're not in a sub-menu of the UI if we're in ASCII mode: */ |
679 | 670 | buspirate_send_bin(pgm, "\n\n", 2); |
@@ -685,16 +676,16 @@ | ||
685 | 676 | if (buspirate_start_mode_bin(pgm) >= 0) |
686 | 677 | return; |
687 | 678 | 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); | |
689 | 680 | } |
690 | 681 | |
691 | - avrdude_message("Attempting to initiate BusPirate ASCII mode...\n"); | |
682 | + avrdude_message(MSG_INFO, "Attempting to initiate BusPirate ASCII mode...\n"); | |
692 | 683 | |
693 | 684 | /* Call buspirate_send_bin() instead of buspirate_send() |
694 | 685 | * because we don't know if BP is in text or bin mode */ |
695 | 686 | rc = buspirate_send_bin(pgm, reset_str, strlen(reset_str)); |
696 | 687 | 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); | |
698 | 689 | return; |
699 | 690 | } |
700 | 691 |
@@ -701,7 +692,7 @@ | ||
701 | 692 | while(1) { |
702 | 693 | rcvd = buspirate_readline_noexit(pgm, NULL, 0); |
703 | 694 | 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); | |
705 | 696 | return; |
706 | 697 | } |
707 | 698 | if (strncmp(rcvd, "Are you sure?", 13) == 0) { |
@@ -716,13 +707,13 @@ | ||
716 | 707 | break; |
717 | 708 | } |
718 | 709 | if (print_banner) |
719 | - avrdude_message("** %s", rcvd); | |
710 | + avrdude_message(MSG_INFO, "** %s", rcvd); | |
720 | 711 | } |
721 | 712 | |
722 | 713 | 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"); | |
724 | 715 | 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); | |
726 | 717 | return; |
727 | 718 | } |
728 | 719 | } |
@@ -763,7 +754,7 @@ | ||
763 | 754 | } |
764 | 755 | } |
765 | 756 | 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); | |
767 | 758 | } |
768 | 759 | } |
769 | 760 | return; |
@@ -770,8 +761,8 @@ | ||
770 | 761 | } |
771 | 762 | } |
772 | 763 | |
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); | |
775 | 766 | } |
776 | 767 | |
777 | 768 | static void buspirate_powerdown(struct programmer_t *pgm) |
@@ -784,7 +775,7 @@ | ||
784 | 775 | } else { |
785 | 776 | if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) { |
786 | 777 | 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); | |
788 | 779 | } |
789 | 780 | } |
790 | 781 | if (buspirate_expect(pgm, "w\n", "Power supplies OFF", 1)) |
@@ -791,7 +782,7 @@ | ||
791 | 782 | return; |
792 | 783 | } |
793 | 784 | |
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); | |
795 | 786 | } |
796 | 787 | |
797 | 788 | static int buspirate_cmd_bin(struct programmer_t *pgm, |
@@ -834,7 +825,7 @@ | ||
834 | 825 | } |
835 | 826 | |
836 | 827 | 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); | |
838 | 829 | return -1; |
839 | 830 | } |
840 | 831 |
@@ -868,11 +859,11 @@ | ||
868 | 859 | unsigned char buf[275]; |
869 | 860 | unsigned int addr = 0; |
870 | 861 | |
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); | |
872 | 863 | |
873 | 864 | // This should never happen, but still... |
874 | 865 | 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"); | |
876 | 867 | return -1; |
877 | 868 | } |
878 | 869 |
@@ -901,7 +892,7 @@ | ||
901 | 892 | buspirate_recv_bin(pgm, buf, 1); |
902 | 893 | |
903 | 894 | 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"); | |
905 | 896 | return -1; |
906 | 897 | } |
907 | 898 |
@@ -948,12 +939,12 @@ | ||
948 | 939 | |
949 | 940 | /* pre-check opcodes */ |
950 | 941 | 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", | |
952 | 943 | progname, "AVR_OP_LOADPAGE_LO", p->desc); |
953 | 944 | return -1; |
954 | 945 | } |
955 | 946 | 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", | |
957 | 948 | progname, "AVR_OP_LOADPAGE_HI", p->desc); |
958 | 949 | return -1; |
959 | 950 | } |
@@ -1014,7 +1005,7 @@ | ||
1014 | 1005 | |
1015 | 1006 | /* Check for write failure: */ |
1016 | 1007 | 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"); | |
1018 | 1009 | pgm->pgm_led(pgm, OFF); |
1019 | 1010 | pgm->err_led(pgm, ON); |
1020 | 1011 | return -1; |
@@ -1045,7 +1036,7 @@ | ||
1045 | 1036 | buspirate_expect(pgm, "{\n", "CS ENABLED", 1); |
1046 | 1037 | |
1047 | 1038 | 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", | |
1049 | 1040 | p->desc); |
1050 | 1041 | return -1; |
1051 | 1042 | } |
@@ -1066,7 +1057,7 @@ | ||
1066 | 1057 | unsigned char res[4]; |
1067 | 1058 | |
1068 | 1059 | 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", | |
1070 | 1061 | p->desc); |
1071 | 1062 | return -1; |
1072 | 1063 | } |
@@ -1090,7 +1081,7 @@ | ||
1090 | 1081 | { |
1091 | 1082 | /* Allocate private data */ |
1092 | 1083 | 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", | |
1094 | 1085 | progname); |
1095 | 1086 | exit(1); |
1096 | 1087 | } |
@@ -1144,7 +1135,7 @@ | ||
1144 | 1135 | if (bitbang_check_prerequisites(pgm) < 0) |
1145 | 1136 | return; /* XXX should treat as error */ |
1146 | 1137 | |
1147 | - avrdude_message("Attempting to initiate BusPirate bitbang binary mode...\n"); | |
1138 | + avrdude_message(MSG_INFO, "Attempting to initiate BusPirate bitbang binary mode...\n"); | |
1148 | 1139 | |
1149 | 1140 | /* Send two CRs to ensure we're not in a sub-menu of the UI if we're in ASCII mode: */ |
1150 | 1141 | buspirate_send_bin(pgm, "\n\n", 2); |
@@ -1159,11 +1150,11 @@ | ||
1159 | 1150 | memset(buf, 0, sizeof(buf)); |
1160 | 1151 | buspirate_recv_bin(pgm, buf, 5); |
1161 | 1152 | 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); | |
1163 | 1154 | buspirate_reset_from_binmode(pgm); |
1164 | 1155 | return; |
1165 | 1156 | } |
1166 | - avrdude_message("BusPirate binmode version: %d\n", | |
1157 | + avrdude_message(MSG_INFO, "BusPirate binmode version: %d\n", | |
1167 | 1158 | PDATA(pgm)->binmode_version); |
1168 | 1159 | |
1169 | 1160 | pgm->flag |= BP_FLAG_IN_BINMODE; |
@@ -63,7 +63,7 @@ | ||
63 | 63 | static void butterfly_setup(PROGRAMMER * pgm) |
64 | 64 | { |
65 | 65 | 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", | |
67 | 67 | progname); |
68 | 68 | exit(1); |
69 | 69 | } |
@@ -87,7 +87,7 @@ | ||
87 | 87 | |
88 | 88 | rv = serial_recv(&pgm->fd, (unsigned char *)buf, len); |
89 | 89 | 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", | |
91 | 91 | progname); |
92 | 92 | return -1; |
93 | 93 | } |
@@ -107,7 +107,7 @@ | ||
107 | 107 | |
108 | 108 | butterfly_recv(pgm, &c, 1); |
109 | 109 | 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", | |
111 | 111 | progname, errmsg); |
112 | 112 | return -1; |
113 | 113 | } |
@@ -222,7 +222,7 @@ | ||
222 | 222 | * Send some ESC to activate butterfly bootloader. This is not needed |
223 | 223 | * for plain avr109 bootloaders but does not harm there either. |
224 | 224 | */ |
225 | - avrdude_message("Connecting to programmer: "); | |
225 | + avrdude_message(MSG_INFO, "Connecting to programmer: "); | |
226 | 226 | if (pgm->flag & IS_BUTTERFLY_MK) |
227 | 227 | { |
228 | 228 | char mk_reset_cmd[6] = {"#aR@S\r"}; |
@@ -246,7 +246,7 @@ | ||
246 | 246 | butterfly_recv(pgm, &c, 1); |
247 | 247 | if ( c != 'M' && c != '?') |
248 | 248 | { |
249 | - avrdude_message("\nConnection FAILED."); | |
249 | + avrdude_message(MSG_INFO, "\nConnection FAILED."); | |
250 | 250 | return -1; |
251 | 251 | } |
252 | 252 | else |
@@ -293,12 +293,12 @@ | ||
293 | 293 | butterfly_send(pgm, "p", 1); |
294 | 294 | butterfly_recv(pgm, &type, 1); |
295 | 295 | |
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]); | |
298 | 298 | if (hw[0]=='?') { |
299 | - avrdude_message("No Hardware Version given.\n"); | |
299 | + avrdude_message(MSG_INFO, "No Hardware Version given.\n"); | |
300 | 300 | } 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]); | |
302 | 302 | }; |
303 | 303 | |
304 | 304 | /* See if programmer supports autoincrement of address. */ |
@@ -306,7 +306,7 @@ | ||
306 | 306 | butterfly_send(pgm, "a", 1); |
307 | 307 | butterfly_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1); |
308 | 308 | 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"); | |
310 | 310 | |
311 | 311 | /* Check support for buffered memory access, abort if not available */ |
312 | 312 |
@@ -313,7 +313,7 @@ | ||
313 | 313 | butterfly_send(pgm, "b", 1); |
314 | 314 | butterfly_recv(pgm, &c, 1); |
315 | 315 | 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"\ | |
317 | 317 | "a butterfly/AVR109 but a AVR910 device?\n", progname); |
318 | 318 | return -1; |
319 | 319 | }; |
@@ -321,13 +321,13 @@ | ||
321 | 321 | PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8; |
322 | 322 | butterfly_recv(pgm, &c, 1); |
323 | 323 | 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", | |
325 | 325 | PDATA(pgm)->buffersize); |
326 | 326 | |
327 | 327 | /* Get list of devices that the programmer supports. */ |
328 | 328 | |
329 | 329 | 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"); | |
331 | 331 | devtype_1st = 0; |
332 | 332 | while (1) { |
333 | 333 | butterfly_recv(pgm, &c, 1); |
@@ -336,9 +336,9 @@ | ||
336 | 336 | |
337 | 337 | if (c == 0) |
338 | 338 | 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); | |
340 | 340 | }; |
341 | - avrdude_message("\n"); | |
341 | + avrdude_message(MSG_INFO, "\n"); | |
342 | 342 | |
343 | 343 | /* Tell the programmer which part we selected. |
344 | 344 | According to the AVR109 code, this is ignored by the bootloader. As |
@@ -356,7 +356,7 @@ | ||
356 | 356 | return -1; |
357 | 357 | |
358 | 358 | if (verbose) |
359 | - avrdude_message("%s: devcode selected: 0x%02x\n", | |
359 | + avrdude_message(MSG_INFO, "%s: devcode selected: 0x%02x\n", | |
360 | 360 | progname, (unsigned)buf[1]); |
361 | 361 | |
362 | 362 | butterfly_enter_prog_mode(pgm); |
@@ -550,7 +550,7 @@ | ||
550 | 550 | return -1; /* not supported */ |
551 | 551 | if (strcmp(m->desc, "eeprom") == 0) |
552 | 552 | 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", | |
554 | 554 | progname, m->desc); |
555 | 555 | return -1; |
556 | 556 | } |
@@ -697,7 +697,7 @@ | ||
697 | 697 | unsigned char tmp; |
698 | 698 | |
699 | 699 | 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); | |
701 | 701 | return -1; |
702 | 702 | } |
703 | 703 |
@@ -93,7 +93,7 @@ | ||
93 | 93 | |
94 | 94 | tkn = (TOKEN *)malloc(sizeof(TOKEN)); |
95 | 95 | if (tkn == NULL) { |
96 | - avrdude_message("new_token(): out of memory\n"); | |
96 | + avrdude_message(MSG_INFO, "new_token(): out of memory\n"); | |
97 | 97 | exit(1); |
98 | 98 | } |
99 | 99 |
@@ -145,7 +145,7 @@ | ||
145 | 145 | tkn->value.number = atoi(text); |
146 | 146 | |
147 | 147 | #if DEBUG |
148 | - avrdude_message("NUMBER(%d)\n", tkn->value.number); | |
148 | + avrdude_message(MSG_INFO, "NUMBER(%d)\n", tkn->value.number); | |
149 | 149 | #endif |
150 | 150 | |
151 | 151 | return tkn; |
@@ -160,7 +160,7 @@ | ||
160 | 160 | tkn->value.number_real = atof(text); |
161 | 161 | |
162 | 162 | #if DEBUG |
163 | - avrdude_message("NUMBER(%g)\n", tkn->value.number_real); | |
163 | + avrdude_message(MSG_INFO, "NUMBER(%g)\n", tkn->value.number_real); | |
164 | 164 | #endif |
165 | 165 | |
166 | 166 | return tkn; |
@@ -175,12 +175,12 @@ | ||
175 | 175 | tkn->value.type = V_NUM; |
176 | 176 | tkn->value.number = strtoul(text, &e, 16); |
177 | 177 | 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", | |
179 | 179 | infile, lineno, text); |
180 | 180 | } |
181 | 181 | |
182 | 182 | #if DEBUG |
183 | - avrdude_message("HEXNUMBER(%g)\n", tkn->value.number); | |
183 | + avrdude_message(MSG_INFO, "HEXNUMBER(%g)\n", tkn->value.number); | |
184 | 184 | #endif |
185 | 185 | |
186 | 186 | return tkn; |
@@ -199,13 +199,13 @@ | ||
199 | 199 | tkn->value.type = V_STR; |
200 | 200 | tkn->value.string = (char *) malloc(len+1); |
201 | 201 | if (tkn->value.string == NULL) { |
202 | - avrdude_message("id(): out of memory\n"); | |
202 | + avrdude_message(MSG_INFO, "id(): out of memory\n"); | |
203 | 203 | exit(1); |
204 | 204 | } |
205 | 205 | strcpy(tkn->value.string, text); |
206 | 206 | |
207 | 207 | #if DEBUG |
208 | - avrdude_message("STRING(%s)\n", tkn->value.string); | |
208 | + avrdude_message(MSG_INFO, "STRING(%s)\n", tkn->value.string); | |
209 | 209 | #endif |
210 | 210 | |
211 | 211 | return tkn; |
@@ -227,26 +227,26 @@ | ||
227 | 227 | if (!tkn) |
228 | 228 | return; |
229 | 229 | |
230 | - avrdude_message("token = %d = ", tkn->primary); | |
230 | + avrdude_message(MSG_INFO, "token = %d = ", tkn->primary); | |
231 | 231 | switch (tkn->value.type) { |
232 | 232 | case V_NUM: |
233 | - avrdude_message("NUMBER, value=%d", tkn->value.number); | |
233 | + avrdude_message(MSG_INFO, "NUMBER, value=%d", tkn->value.number); | |
234 | 234 | break; |
235 | 235 | |
236 | 236 | 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); | |
238 | 238 | break; |
239 | 239 | |
240 | 240 | case V_STR: |
241 | - avrdude_message("STRING, value=%s", tkn->value.string); | |
241 | + avrdude_message(MSG_INFO, "STRING, value=%s", tkn->value.string); | |
242 | 242 | break; |
243 | 243 | |
244 | 244 | default: |
245 | - avrdude_message("<other>"); | |
245 | + avrdude_message(MSG_INFO, "<other>"); | |
246 | 246 | break; |
247 | 247 | } |
248 | 248 | |
249 | - avrdude_message("\n"); | |
249 | + avrdude_message(MSG_INFO, "\n"); | |
250 | 250 | } |
251 | 251 | |
252 | 252 |
@@ -253,7 +253,7 @@ | ||
253 | 253 | void pyytext(void) |
254 | 254 | { |
255 | 255 | #if DEBUG |
256 | - avrdude_message("TOKEN: \"%s\"\n", yytext); | |
256 | + avrdude_message(MSG_INFO, "TOKEN: \"%s\"\n", yytext); | |
257 | 257 | #endif |
258 | 258 | } |
259 | 259 |
@@ -264,7 +264,7 @@ | ||
264 | 264 | |
265 | 265 | s = strdup(str); |
266 | 266 | if (s == NULL) { |
267 | - avrdude_message("dup_string(): out of memory\n"); | |
267 | + avrdude_message(MSG_INFO, "dup_string(): out of memory\n"); | |
268 | 268 | exit(1); |
269 | 269 | } |
270 | 270 |
@@ -282,7 +282,7 @@ | ||
282 | 282 | |
283 | 283 | f = fopen(file, "r"); |
284 | 284 | 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", | |
286 | 286 | progname, file, strerror(errno)); |
287 | 287 | return -1; |
288 | 288 | } |
@@ -271,12 +271,12 @@ | ||
271 | 271 | PROGRAMMER * existing_prog; |
272 | 272 | char * id; |
273 | 273 | 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", | |
275 | 275 | progname, infile, lineno); |
276 | 276 | exit(1); |
277 | 277 | } |
278 | 278 | 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", | |
280 | 280 | progname, infile, lineno); |
281 | 281 | exit(1); |
282 | 282 | } |
@@ -283,7 +283,7 @@ | ||
283 | 283 | id = ldata(lfirst(current_prog->id)); |
284 | 284 | existing_prog = locate_programmer(programmers, id); |
285 | 285 | 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 " | |
287 | 287 | "previous definition %s:%d.\n", |
288 | 288 | progname, infile, current_prog->lineno, |
289 | 289 | id, existing_prog->config_file, existing_prog->lineno); |
@@ -309,7 +309,7 @@ | ||
309 | 309 | { |
310 | 310 | struct programmer_t * pgm = locate_programmer(programmers, $3->value.string); |
311 | 311 | 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", | |
313 | 313 | progname, infile, lineno, $3->value.string); |
314 | 314 | exit(1); |
315 | 315 | } |
@@ -329,7 +329,7 @@ | ||
329 | 329 | AVRPART * existing_part; |
330 | 330 | |
331 | 331 | 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", | |
333 | 333 | progname, infile, lineno); |
334 | 334 | exit(1); |
335 | 335 | } |
@@ -343,19 +343,19 @@ | ||
343 | 343 | m = ldata(ln); |
344 | 344 | if (m->paged) { |
345 | 345 | 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 " | |
347 | 347 | "memory\n", |
348 | 348 | progname, infile, lineno); |
349 | 349 | exit(1); |
350 | 350 | } |
351 | 351 | 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 " | |
353 | 353 | "memory\n", |
354 | 354 | progname, infile, lineno); |
355 | 355 | exit(1); |
356 | 356 | } |
357 | 357 | 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) = " | |
359 | 359 | "%u does not match memory size (%u)\n", |
360 | 360 | progname, infile, lineno, |
361 | 361 | m->page_size, |
@@ -370,7 +370,7 @@ | ||
370 | 370 | |
371 | 371 | existing_part = locate_part(part_list, current_part->id); |
372 | 372 | 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 " | |
374 | 374 | "previous definition %s:%d.\n", |
375 | 375 | progname, infile, current_part->lineno, current_part->id, |
376 | 376 | existing_part->config_file, existing_part->lineno); |
@@ -393,7 +393,7 @@ | ||
393 | 393 | { |
394 | 394 | AVRPART * parent_part = locate_part(part_list, $3->value.string); |
395 | 395 | 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", | |
397 | 397 | progname, infile, lineno); |
398 | 398 | exit(1); |
399 | 399 | } |
@@ -462,7 +462,7 @@ | ||
462 | 462 | TKN_STRING { |
463 | 463 | const struct programmer_type_t * pgm_type = locate_programmer_type($1->value.string); |
464 | 464 | 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", | |
466 | 466 | progname, infile, lineno, $1->value.string); |
467 | 467 | exit(1); |
468 | 468 | } |
@@ -471,7 +471,7 @@ | ||
471 | 471 | } |
472 | 472 | | error |
473 | 473 | { |
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", | |
475 | 475 | progname, infile, lineno); |
476 | 476 | exit(1); |
477 | 477 | } |
@@ -643,7 +643,7 @@ | ||
643 | 643 | |
644 | 644 | K_DEVICECODE TKN_EQUAL TKN_NUMBER { |
645 | 645 | { |
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 " | |
647 | 647 | "stk500_devcode instead\n", |
648 | 648 | progname, infile, lineno); |
649 | 649 | exit(1); |
@@ -708,7 +708,7 @@ | ||
708 | 708 | } |
709 | 709 | if (!ok) |
710 | 710 | { |
711 | - avrdude_message("%s: Warning: line %d of %s: " | |
711 | + avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: " | |
712 | 712 | "too many bytes in control stack\n", |
713 | 713 | progname, lineno, infile); |
714 | 714 | } |
@@ -741,7 +741,7 @@ | ||
741 | 741 | } |
742 | 742 | if (!ok) |
743 | 743 | { |
744 | - avrdude_message("%s: Warning: line %d of %s: " | |
744 | + avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: " | |
745 | 745 | "too many bytes in control stack\n", |
746 | 746 | progname, lineno, infile); |
747 | 747 | } |
@@ -773,7 +773,7 @@ | ||
773 | 773 | } |
774 | 774 | if (!ok) |
775 | 775 | { |
776 | - avrdude_message("%s: Warning: line %d of %s: " | |
776 | + avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: " | |
777 | 777 | "too many bytes in flash instructions\n", |
778 | 778 | progname, lineno, infile); |
779 | 779 | } |
@@ -805,7 +805,7 @@ | ||
805 | 805 | } |
806 | 806 | if (!ok) |
807 | 807 | { |
808 | - avrdude_message("%s: Warning: line %d of %s: " | |
808 | + avrdude_message(MSG_INFO, "%s: Warning: line %d of %s: " | |
809 | 809 | "too many bytes in EEPROM instructions\n", |
810 | 810 | progname, lineno, infile); |
811 | 811 | } |
@@ -1211,7 +1211,7 @@ | ||
1211 | 1211 | op = avr_new_opcode(); |
1212 | 1212 | parse_cmdbits(op); |
1213 | 1213 | 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", | |
1215 | 1215 | progname, infile, lineno);*/ |
1216 | 1216 | avr_free_opcode(current_part->op[opnum]); |
1217 | 1217 | } |
@@ -1337,7 +1337,7 @@ | ||
1337 | 1337 | op = avr_new_opcode(); |
1338 | 1338 | parse_cmdbits(op); |
1339 | 1339 | 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", | |
1341 | 1341 | progname, infile, lineno);*/ |
1342 | 1342 | avr_free_opcode(current_mem->op[opnum]); |
1343 | 1343 | } |
@@ -1373,7 +1373,7 @@ | ||
1373 | 1373 | free_token(v); |
1374 | 1374 | |
1375 | 1375 | 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 " | |
1377 | 1377 | "range %d-%d\n", |
1378 | 1378 | progname, lineno, infile, PIN_MIN, PIN_MAX); |
1379 | 1379 | exit(1); |
@@ -1394,7 +1394,7 @@ | ||
1394 | 1394 | t = lrmv_n(number_list, 1); |
1395 | 1395 | pin = t->value.number; |
1396 | 1396 | 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 " | |
1398 | 1398 | "range %d-%d\n", |
1399 | 1399 | progname, lineno, infile, PIN_MIN, PIN_MAX); |
1400 | 1400 | exit(1); |
@@ -1423,7 +1423,7 @@ | ||
1423 | 1423 | case K_CHIP_ERASE : return AVR_OP_CHIP_ERASE; break; |
1424 | 1424 | case K_PGM_ENABLE : return AVR_OP_PGM_ENABLE; break; |
1425 | 1425 | 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", | |
1427 | 1427 | progname, infile, lineno); |
1428 | 1428 | exit(1); |
1429 | 1429 | break; |
@@ -1451,7 +1451,7 @@ | ||
1451 | 1451 | |
1452 | 1452 | bitno--; |
1453 | 1453 | 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", | |
1455 | 1455 | progname, infile, lineno); |
1456 | 1456 | exit(1); |
1457 | 1457 | } |
@@ -1459,7 +1459,7 @@ | ||
1459 | 1459 | len = strlen(s); |
1460 | 1460 | |
1461 | 1461 | 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", | |
1463 | 1463 | progname, infile, lineno); |
1464 | 1464 | exit(1); |
1465 | 1465 | } |
@@ -1499,7 +1499,7 @@ | ||
1499 | 1499 | op->bit[bitno].bitno = bitno % 8; |
1500 | 1500 | break; |
1501 | 1501 | 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", | |
1503 | 1503 | progname, infile, lineno, ch); |
1504 | 1504 | exit(1); |
1505 | 1505 | break; |
@@ -1510,7 +1510,7 @@ | ||
1510 | 1510 | q = &s[1]; |
1511 | 1511 | op->bit[bitno].bitno = strtol(q, &e, 0); |
1512 | 1512 | 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", | |
1514 | 1514 | progname, infile, lineno, q); |
1515 | 1515 | exit(1); |
1516 | 1516 | } |
@@ -1518,7 +1518,7 @@ | ||
1518 | 1518 | op->bit[bitno].value = 0; |
1519 | 1519 | } |
1520 | 1520 | 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", | |
1522 | 1522 | progname, infile, lineno, s); |
1523 | 1523 | exit(1); |
1524 | 1524 | } |
@@ -39,7 +39,7 @@ | ||
39 | 39 | #ifndef HAVE_LIBUSB |
40 | 40 | |
41 | 41 | 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", | |
43 | 43 | progname); |
44 | 44 | return NULL; |
45 | 45 | } |
@@ -112,7 +112,7 @@ | ||
112 | 112 | */ |
113 | 113 | |
114 | 114 | if (strncmp(port_spec, "usb", 3) != 0) { |
115 | - avrdude_message("%s: Error: " | |
115 | + avrdude_message(MSG_INFO, "%s: Error: " | |
116 | 116 | "Invalid port specification \"%s\" for USB device\n", |
117 | 117 | progname, port_spec); |
118 | 118 | return NULL; |
@@ -121,7 +121,7 @@ | ||
121 | 121 | if(':' == port_spec[3]) { |
122 | 122 | bus_name = strdup(port_spec + 3 + 1); |
123 | 123 | 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); | |
125 | 125 | return NULL; |
126 | 126 | } |
127 | 127 |
@@ -138,7 +138,7 @@ | ||
138 | 138 | |
139 | 139 | if (dfu == NULL) |
140 | 140 | { |
141 | - avrdude_message("%s: out of memory\n", progname); | |
141 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
142 | 142 | return 0; |
143 | 143 | } |
144 | 144 |
@@ -171,7 +171,7 @@ | ||
171 | 171 | */ |
172 | 172 | |
173 | 173 | 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; " | |
175 | 175 | "specify PID in config or USB address (via -P) to override.\n", |
176 | 176 | progname); |
177 | 177 | return -1; |
@@ -208,12 +208,12 @@ | ||
208 | 208 | * why the match failed, and if we came across another DFU-capable part. |
209 | 209 | */ |
210 | 210 | |
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); | |
212 | 212 | return -1; |
213 | 213 | } |
214 | 214 | |
215 | 215 | 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", | |
217 | 217 | progname, found->descriptor.idVendor, found->descriptor.idProduct, |
218 | 218 | found->bus->dirname, found->filename); |
219 | 219 |
@@ -220,7 +220,7 @@ | ||
220 | 220 | dfu->dev_handle = usb_open(found); |
221 | 221 | |
222 | 222 | 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", | |
224 | 224 | progname, found->bus->dirname, found->filename, usb_strerror()); |
225 | 225 | return -1; |
226 | 226 | } |
@@ -271,8 +271,7 @@ | ||
271 | 271 | { |
272 | 272 | int result; |
273 | 273 | |
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", | |
276 | 275 | progname); |
277 | 276 | |
278 | 277 | result = usb_control_msg(dfu->dev_handle, |
@@ -280,30 +279,29 @@ | ||
280 | 279 | (char*) status, sizeof(struct dfu_status), dfu->timeout); |
281 | 280 | |
282 | 281 | 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", | |
284 | 283 | progname, usb_strerror()); |
285 | 284 | return -1; |
286 | 285 | } |
287 | 286 | |
288 | 287 | 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", | |
290 | 289 | progname, "short read"); |
291 | 290 | return -1; |
292 | 291 | } |
293 | 292 | |
294 | 293 | 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); " | |
296 | 295 | "exiting\n", progname); |
297 | 296 | exit(1); |
298 | 297 | } |
299 | 298 | |
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); | |
307 | 305 | |
308 | 306 | return 0; |
309 | 307 | } |
@@ -312,9 +310,8 @@ | ||
312 | 310 | { |
313 | 311 | int result; |
314 | 312 | |
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); | |
318 | 315 | |
319 | 316 | result = usb_control_msg(dfu->dev_handle, |
320 | 317 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_CLRSTATUS, 0, 0, |
@@ -321,7 +318,7 @@ | ||
321 | 318 | NULL, 0, dfu->timeout); |
322 | 319 | |
323 | 320 | 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", | |
325 | 322 | progname, usb_strerror()); |
326 | 323 | return -1; |
327 | 324 | } |
@@ -333,9 +330,8 @@ | ||
333 | 330 | { |
334 | 331 | int result; |
335 | 332 | |
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); | |
339 | 335 | |
340 | 336 | result = usb_control_msg(dfu->dev_handle, |
341 | 337 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_ABORT, 0, 0, |
@@ -342,7 +338,7 @@ | ||
342 | 338 | NULL, 0, dfu->timeout); |
343 | 339 | |
344 | 340 | 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", | |
346 | 342 | progname, usb_strerror()); |
347 | 343 | return -1; |
348 | 344 | } |
@@ -355,9 +351,8 @@ | ||
355 | 351 | { |
356 | 352 | int result; |
357 | 353 | |
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); | |
361 | 356 | |
362 | 357 | result = usb_control_msg(dfu->dev_handle, |
363 | 358 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0, |
@@ -364,19 +359,19 @@ | ||
364 | 359 | ptr, size, dfu->timeout); |
365 | 360 | |
366 | 361 | 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", | |
368 | 363 | progname, usb_strerror()); |
369 | 364 | return -1; |
370 | 365 | } |
371 | 366 | |
372 | 367 | 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", | |
374 | 369 | progname, "short write"); |
375 | 370 | return -1; |
376 | 371 | } |
377 | 372 | |
378 | 373 | 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); " \ | |
380 | 375 | "exiting\n", progname); |
381 | 376 | exit(1); |
382 | 377 | } |
@@ -388,9 +383,8 @@ | ||
388 | 383 | { |
389 | 384 | int result; |
390 | 385 | |
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); | |
394 | 388 | |
395 | 389 | result = usb_control_msg(dfu->dev_handle, |
396 | 390 | 0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0, |
@@ -397,19 +391,19 @@ | ||
397 | 391 | ptr, size, dfu->timeout); |
398 | 392 | |
399 | 393 | 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", | |
401 | 395 | progname, usb_strerror()); |
402 | 396 | return -1; |
403 | 397 | } |
404 | 398 | |
405 | 399 | 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", | |
407 | 401 | progname, "short read"); |
408 | 402 | return -1; |
409 | 403 | } |
410 | 404 | |
411 | 405 | 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); " | |
413 | 407 | "exiting\n", progname); |
414 | 408 | exit(1); |
415 | 409 | } |
@@ -420,26 +414,26 @@ | ||
420 | 414 | void dfu_show_info(struct dfu_dev *dfu) |
421 | 415 | { |
422 | 416 | 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", | |
424 | 418 | dfu->manf_str, (unsigned short) dfu->dev_desc.idVendor); |
425 | 419 | else |
426 | - avrdude_message(" USB Vendor : 0x%04hX\n", | |
420 | + avrdude_message(MSG_INFO, " USB Vendor : 0x%04hX\n", | |
427 | 421 | (unsigned short) dfu->dev_desc.idVendor); |
428 | 422 | |
429 | 423 | 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", | |
431 | 425 | dfu->prod_str, (unsigned short) dfu->dev_desc.idProduct); |
432 | 426 | else |
433 | - avrdude_message(" USB Product : 0x%04hX\n", | |
427 | + avrdude_message(MSG_INFO, " USB Product : 0x%04hX\n", | |
434 | 428 | (unsigned short) dfu->dev_desc.idProduct); |
435 | 429 | |
436 | - avrdude_message(" USB Release : %hu.%hu.%hu\n", | |
430 | + avrdude_message(MSG_INFO, " USB Release : %hu.%hu.%hu\n", | |
437 | 431 | ((unsigned short) dfu->dev_desc.bcdDevice >> 8) & 0xFF, |
438 | 432 | ((unsigned short) dfu->dev_desc.bcdDevice >> 4) & 0xF, |
439 | 433 | ((unsigned short) dfu->dev_desc.bcdDevice >> 0) & 0xF); |
440 | 434 | |
441 | 435 | 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); | |
443 | 437 | } |
444 | 438 | |
445 | 439 | /* INTERNAL FUNCTION DEFINITIONS |
@@ -456,7 +450,7 @@ | ||
456 | 450 | result = usb_get_string_simple(dev_handle, index, buffer, sizeof(buffer)-1); |
457 | 451 | |
458 | 452 | 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", | |
460 | 454 | progname, index, usb_strerror()); |
461 | 455 | return NULL; |
462 | 456 | } |
@@ -464,7 +458,7 @@ | ||
464 | 458 | str = malloc(result+1); |
465 | 459 | |
466 | 460 | 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); | |
468 | 462 | return 0; |
469 | 463 | } |
470 | 464 |
@@ -125,7 +125,7 @@ | ||
125 | 125 | unsigned char cksum; |
126 | 126 | |
127 | 127 | 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", | |
129 | 129 | progname, recsize); |
130 | 130 | return -1; |
131 | 131 | } |
@@ -305,14 +305,14 @@ | ||
305 | 305 | continue; |
306 | 306 | rc = ihex_readrec(&ihex, buffer); |
307 | 307 | 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", | |
309 | 309 | progname, lineno, infile); |
310 | 310 | return -1; |
311 | 311 | } |
312 | 312 | 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", | |
314 | 314 | 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", | |
316 | 316 | progname, ihex.cksum, rc); |
317 | 317 | return -1; |
318 | 318 | } |
@@ -320,13 +320,13 @@ | ||
320 | 320 | switch (ihex.rectyp) { |
321 | 321 | case 0: /* data record */ |
322 | 322 | 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", | |
324 | 324 | progname, baseaddr, fileoffset, lineno, infile); |
325 | 325 | return -1; |
326 | 326 | } |
327 | 327 | nextaddr = ihex.loadofs + baseaddr - fileoffset; |
328 | 328 | 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", | |
330 | 330 | progname, nextaddr+ihex.reclen, lineno, infile); |
331 | 331 | return -1; |
332 | 332 | } |
@@ -359,7 +359,7 @@ | ||
359 | 359 | break; |
360 | 360 | |
361 | 361 | 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 " | |
363 | 363 | "at line %d of %s\n", |
364 | 364 | progname, ihex.rectyp, lineno, infile); |
365 | 365 | return -1; |
@@ -369,7 +369,7 @@ | ||
369 | 369 | } /* while */ |
370 | 370 | |
371 | 371 | 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 " | |
373 | 373 | "file \"%s\"\n", |
374 | 374 | progname, infile); |
375 | 375 |
@@ -376,7 +376,7 @@ | ||
376 | 376 | return -1; |
377 | 377 | } |
378 | 378 | 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 " | |
380 | 380 | "file \"%s\"\n", |
381 | 381 | progname, infile); |
382 | 382 |
@@ -397,7 +397,7 @@ | ||
397 | 397 | char * tmpl=0; |
398 | 398 | |
399 | 399 | 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", | |
401 | 401 | progname, recsize); |
402 | 402 | return -1; |
403 | 403 | } |
@@ -430,7 +430,7 @@ | ||
430 | 430 | tmpl="S3%02X%08X"; |
431 | 431 | } |
432 | 432 | 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", | |
434 | 434 | progname, nextaddr); |
435 | 435 | return -1; |
436 | 436 | } |
@@ -595,14 +595,14 @@ | ||
595 | 595 | rc = srec_readrec(&srec, buffer); |
596 | 596 | |
597 | 597 | 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", | |
599 | 599 | progname, lineno, infile); |
600 | 600 | return -1; |
601 | 601 | } |
602 | 602 | 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", | |
604 | 604 | 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", | |
606 | 606 | progname, srec.cksum, rc); |
607 | 607 | return -1; |
608 | 608 | } |
@@ -629,16 +629,16 @@ | ||
629 | 629 | break; |
630 | 630 | |
631 | 631 | 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", | |
633 | 633 | progname, lineno, infile); |
634 | 634 | return -1; |
635 | 635 | |
636 | 636 | case 0x35: /* S5 - count of S1,S2 and S3 records previously tx'd */ |
637 | 637 | 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 " | |
639 | 639 | "at line %d of \"%s\"\n", |
640 | 640 | progname, lineno, infile); |
641 | - avrdude_message("%s: transmitted data records= %d, expected " | |
641 | + avrdude_message(MSG_INFO, "%s: transmitted data records= %d, expected " | |
642 | 642 | "value= %d\n", |
643 | 643 | progname, reccount, srec.loadofs); |
644 | 644 | return -1; |
@@ -651,7 +651,7 @@ | ||
651 | 651 | return maxaddr; |
652 | 652 | |
653 | 653 | 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 " | |
655 | 655 | "at line %d of %s\n", |
656 | 656 | progname, srec.rectyp, lineno, infile); |
657 | 657 | return -1; |
@@ -660,7 +660,7 @@ | ||
660 | 660 | if (datarec == 1) { |
661 | 661 | nextaddr = srec.loadofs; |
662 | 662 | if (nextaddr < fileoffset) { |
663 | - avrdude_message(msg, progname, nextaddr, | |
663 | + avrdude_message(MSG_INFO, msg, progname, nextaddr, | |
664 | 664 | "(below fileoffset) ", |
665 | 665 | lineno, infile); |
666 | 666 | return -1; |
@@ -667,7 +667,7 @@ | ||
667 | 667 | } |
668 | 668 | nextaddr -= fileoffset; |
669 | 669 | if (nextaddr + srec.reclen > bufsize) { |
670 | - avrdude_message(msg, progname, nextaddr+srec.reclen, "", | |
670 | + avrdude_message(MSG_INFO, msg, progname, nextaddr+srec.reclen, "", | |
671 | 671 | lineno, infile); |
672 | 672 | return -1; |
673 | 673 | } |
@@ -682,7 +682,7 @@ | ||
682 | 682 | |
683 | 683 | } |
684 | 684 | |
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 " | |
686 | 686 | "file \"%s\"\n", |
687 | 687 | progname, infile); |
688 | 688 |
@@ -727,7 +727,7 @@ | ||
727 | 727 | Elf32_Shdr *sh; |
728 | 728 | size_t ndx = elf_ndxscn(s); |
729 | 729 | 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", | |
731 | 731 | progname, (unsigned int)ndx, elf_errmsg(-1)); |
732 | 732 | continue; |
733 | 733 | } |
@@ -745,7 +745,7 @@ | ||
745 | 745 | } |
746 | 746 | } |
747 | 747 | |
748 | - avrdude_message("%s: ERROR: Cannot find a matching section for " | |
748 | + avrdude_message(MSG_INFO, "%s: ERROR: Cannot find a matching section for " | |
749 | 749 | "program header entry @p_vaddr 0x%x\n", |
750 | 750 | progname, ph->p_vaddr); |
751 | 751 | return NULL; |
@@ -818,7 +818,7 @@ | ||
818 | 818 | unsigned int low, high, foff; |
819 | 819 | |
820 | 820 | 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", | |
822 | 822 | progname, mem->desc); |
823 | 823 | return -1; |
824 | 824 | } |
@@ -836,7 +836,7 @@ | ||
836 | 836 | strcmp(mem->desc, "apptable") == 0)) { |
837 | 837 | AVRMEM *flashmem = avr_locate_mem(p, "flash"); |
838 | 838 | 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, " | |
840 | 840 | "cannot compute bounds of \"%s\" sub-region.\n", |
841 | 841 | progname, mem->desc); |
842 | 842 | return -1; |
@@ -847,17 +847,17 @@ | ||
847 | 847 | } |
848 | 848 | |
849 | 849 | 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", | |
851 | 851 | progname, elf_errmsg(-1)); |
852 | 852 | return -1; |
853 | 853 | } |
854 | 854 | 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", | |
856 | 856 | progname, infile, elf_errmsg(-1)); |
857 | 857 | return -1; |
858 | 858 | } |
859 | 859 | 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", | |
861 | 861 | progname, infile); |
862 | 862 | goto done; |
863 | 863 | } |
@@ -866,7 +866,7 @@ | ||
866 | 866 | const char *id = elf_getident(e, &isize); |
867 | 867 | |
868 | 868 | 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", | |
870 | 870 | progname, infile, elf_errmsg(-1)); |
871 | 871 | goto done; |
872 | 872 | } |
@@ -882,7 +882,7 @@ | ||
882 | 882 | } |
883 | 883 | if (id[EI_CLASS] != ELFCLASS32 || |
884 | 884 | 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 " | |
886 | 886 | "32-bit, %s-endian file that was expected\n", |
887 | 887 | progname, infile, endianname); |
888 | 888 | goto done; |
@@ -890,13 +890,13 @@ | ||
890 | 890 | |
891 | 891 | Elf32_Ehdr *eh; |
892 | 892 | 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", | |
894 | 894 | progname, infile, elf_errmsg(-1)); |
895 | 895 | goto done; |
896 | 896 | } |
897 | 897 | |
898 | 898 | 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", | |
900 | 900 | progname, infile); |
901 | 901 | goto done; |
902 | 902 | } |
@@ -911,12 +911,12 @@ | ||
911 | 911 | mname = "AVR"; |
912 | 912 | } |
913 | 913 | 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", | |
915 | 915 | progname, infile, mname); |
916 | 916 | goto done; |
917 | 917 | } |
918 | 918 | 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 " | |
920 | 920 | "program header numbers which are not expected\n", |
921 | 921 | progname, infile); |
922 | 922 | goto done; |
@@ -924,7 +924,7 @@ | ||
924 | 924 | |
925 | 925 | Elf32_Phdr *ph; |
926 | 926 | 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", | |
928 | 928 | progname, infile, elf_errmsg(-1)); |
929 | 929 | goto done; |
930 | 930 | } |
@@ -931,7 +931,7 @@ | ||
931 | 931 | |
932 | 932 | size_t sndx; |
933 | 933 | 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", | |
935 | 935 | progname, elf_errmsg(-1)); |
936 | 936 | sndx = 0; |
937 | 937 | } |
@@ -945,11 +945,9 @@ | ||
945 | 945 | ph[i].p_filesz == 0) |
946 | 946 | continue; |
947 | 947 | |
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); | |
953 | 951 | |
954 | 952 | Elf32_Shdr *sh; |
955 | 953 | Elf_Scn *s = elf_get_scn(e, ph + i, &sh); |
@@ -968,19 +966,15 @@ | ||
968 | 966 | unsigned int lma; |
969 | 967 | lma = ph[i].p_paddr + sh->sh_offset - ph[i].p_offset; |
970 | 968 | |
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); | |
975 | 971 | |
976 | 972 | if (lma >= low && |
977 | 973 | lma + sh->sh_size < high) { |
978 | 974 | /* OK */ |
979 | 975 | } 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); | |
984 | 978 | continue; |
985 | 979 | } |
986 | 980 | /* |
@@ -993,7 +987,7 @@ | ||
993 | 987 | */ |
994 | 988 | if (mem->size != 1 && |
995 | 989 | 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" | |
997 | 991 | " 0x%x + %u > %u\n", |
998 | 992 | progname, sname, mem->desc, |
999 | 993 | lma, sh->sh_size, mem->size); |
@@ -1002,22 +996,18 @@ | ||
1002 | 996 | |
1003 | 997 | Elf_Data *d = NULL; |
1004 | 998 | 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); | |
1009 | 1001 | if (mem->size == 1) { |
1010 | 1002 | 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", | |
1012 | 1004 | progname); |
1013 | 1005 | } 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", | |
1015 | 1007 | progname, foff); |
1016 | 1008 | } 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); | |
1021 | 1011 | mem->buf[0] = ((unsigned char *)d->d_buf)[foff]; |
1022 | 1012 | mem->tags[0] = TAG_ALLOCATED; |
1023 | 1013 | rv = 1; |
@@ -1028,10 +1018,8 @@ | ||
1028 | 1018 | idx = lma - low + d->d_off; |
1029 | 1019 | if ((int)(idx + d->d_size) > rv) |
1030 | 1020 | 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); | |
1035 | 1023 | memcpy(mem->buf + idx, d->d_buf, d->d_size); |
1036 | 1024 | memset(mem->tags + idx, TAG_ALLOCATED, d->d_size); |
1037 | 1025 | } |
@@ -1100,13 +1088,13 @@ | ||
1100 | 1088 | rc = fwrite(buf, 1, size, f); |
1101 | 1089 | break; |
1102 | 1090 | default: |
1103 | - avrdude_message("%s: fileio: invalid operation=%d\n", | |
1091 | + avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n", | |
1104 | 1092 | progname, fio->op); |
1105 | 1093 | return -1; |
1106 | 1094 | } |
1107 | 1095 | |
1108 | 1096 | 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", | |
1110 | 1098 | progname, fio->iodesc, fio->dir, filename, strerror(errno), |
1111 | 1099 | fio->rw, rc, size); |
1112 | 1100 | return -1; |
@@ -1135,7 +1123,7 @@ | ||
1135 | 1123 | strtoul (p, &e, 0): |
1136 | 1124 | strtoul (p + 2, &e, 2); |
1137 | 1125 | 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", | |
1139 | 1127 | progname, p); |
1140 | 1128 | return -1; |
1141 | 1129 | } |
@@ -1146,13 +1134,13 @@ | ||
1146 | 1134 | } |
1147 | 1135 | break; |
1148 | 1136 | default: |
1149 | - avrdude_message("%s: fileio: invalid operation=%d\n", | |
1137 | + avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n", | |
1150 | 1138 | progname, fio->op); |
1151 | 1139 | return -1; |
1152 | 1140 | } |
1153 | 1141 | |
1154 | 1142 | 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", | |
1156 | 1144 | progname, fio->iodesc, fio->dir, filename, strerror(errno), |
1157 | 1145 | fio->rw, rc, size); |
1158 | 1146 | return -1; |
@@ -1182,7 +1170,7 @@ | ||
1182 | 1170 | break; |
1183 | 1171 | |
1184 | 1172 | 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", | |
1186 | 1174 | progname, fio->op); |
1187 | 1175 | return -1; |
1188 | 1176 | break; |
@@ -1212,7 +1200,7 @@ | ||
1212 | 1200 | break; |
1213 | 1201 | |
1214 | 1202 | 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 " | |
1216 | 1204 | "operation=%d\n", |
1217 | 1205 | progname, fio->op); |
1218 | 1206 | return -1; |
@@ -1232,7 +1220,7 @@ | ||
1232 | 1220 | |
1233 | 1221 | switch (fio->op) { |
1234 | 1222 | case FIO_WRITE: |
1235 | - avrdude_message("%s: ERROR: write operation not (yet) " | |
1223 | + avrdude_message(MSG_INFO, "%s: ERROR: write operation not (yet) " | |
1236 | 1224 | "supported for ELF\n", |
1237 | 1225 | progname); |
1238 | 1226 | return -1; |
@@ -1243,7 +1231,7 @@ | ||
1243 | 1231 | return rc; |
1244 | 1232 | |
1245 | 1233 | default: |
1246 | - avrdude_message("%s: ERROR: invalid ELF file I/O " | |
1234 | + avrdude_message(MSG_INFO, "%s: ERROR: invalid ELF file I/O " | |
1247 | 1235 | "operation=%d\n", |
1248 | 1236 | progname, fio->op); |
1249 | 1237 | return -1; |
@@ -1289,7 +1277,7 @@ | ||
1289 | 1277 | case FIO_WRITE: |
1290 | 1278 | break; |
1291 | 1279 | default: |
1292 | - avrdude_message("%s: fileio: invalid operation=%d\n", | |
1280 | + avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n", | |
1293 | 1281 | progname, fio->op); |
1294 | 1282 | return -1; |
1295 | 1283 | } |
@@ -1319,7 +1307,7 @@ | ||
1319 | 1307 | return 0; |
1320 | 1308 | |
1321 | 1309 | writeerr: |
1322 | - avrdude_message("%s: error writing to %s: %s\n", | |
1310 | + avrdude_message(MSG_INFO, "%s: error writing to %s: %s\n", | |
1323 | 1311 | progname, filename, strerror(errno)); |
1324 | 1312 | return -1; |
1325 | 1313 | } |
@@ -1346,7 +1334,7 @@ | ||
1346 | 1334 | break; |
1347 | 1335 | |
1348 | 1336 | default: |
1349 | - avrdude_message("%s: invalid I/O operation %d\n", | |
1337 | + avrdude_message(MSG_INFO, "%s: invalid I/O operation %d\n", | |
1350 | 1338 | progname, op); |
1351 | 1339 | return -1; |
1352 | 1340 | break; |
@@ -1385,7 +1373,7 @@ | ||
1385 | 1373 | f = fopen(fname, "rb"); |
1386 | 1374 | #endif |
1387 | 1375 | if (f == NULL) { |
1388 | - avrdude_message("%s: error opening %s: %s\n", | |
1376 | + avrdude_message(MSG_INFO, "%s: error opening %s: %s\n", | |
1389 | 1377 | progname, fname, strerror(errno)); |
1390 | 1378 | return -1; |
1391 | 1379 | } |
@@ -1468,7 +1456,7 @@ | ||
1468 | 1456 | |
1469 | 1457 | mem = avr_locate_mem(p, memtype); |
1470 | 1458 | 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", | |
1472 | 1460 | memtype, p->desc); |
1473 | 1461 | return -1; |
1474 | 1462 | } |
@@ -1506,7 +1494,7 @@ | ||
1506 | 1494 | |
1507 | 1495 | if (format == FMT_AUTO) { |
1508 | 1496 | 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" | |
1510 | 1498 | "%s Please specify a file format and try again.\n", |
1511 | 1499 | progname, progbuf); |
1512 | 1500 | return -1; |
@@ -1514,13 +1502,13 @@ | ||
1514 | 1502 | |
1515 | 1503 | format = fmt_autodetect(fname); |
1516 | 1504 | 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", | |
1518 | 1506 | progname, fname); |
1519 | 1507 | return -1; |
1520 | 1508 | } |
1521 | 1509 | |
1522 | 1510 | 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", | |
1524 | 1512 | progname, fio.iodesc, fname, fmtstr(format)); |
1525 | 1513 | } |
1526 | 1514 | } |
@@ -1544,7 +1532,7 @@ | ||
1544 | 1532 | if (!using_stdio) { |
1545 | 1533 | f = fopen(fname, fio.mode); |
1546 | 1534 | 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", | |
1548 | 1536 | progname, fio.iodesc, fname, strerror(errno)); |
1549 | 1537 | return -1; |
1550 | 1538 | } |
@@ -1568,7 +1556,7 @@ | ||
1568 | 1556 | #ifdef HAVE_LIBELF |
1569 | 1557 | rc = fileio_elf(&fio, fname, f, mem, p, size); |
1570 | 1558 | #else |
1571 | - avrdude_message("%s: can't handle ELF file %s, " | |
1559 | + avrdude_message(MSG_INFO, "%s: can't handle ELF file %s, " | |
1572 | 1560 | "ELF file support was not compiled in\n", |
1573 | 1561 | progname, fname); |
1574 | 1562 | rc = -1; |
@@ -1587,7 +1575,7 @@ | ||
1587 | 1575 | break; |
1588 | 1576 | |
1589 | 1577 | default: |
1590 | - avrdude_message("%s: invalid %s file format: %d\n", | |
1578 | + avrdude_message(MSG_INFO, "%s: invalid %s file format: %d\n", | |
1591 | 1579 | progname, fio.iodesc, format); |
1592 | 1580 | return -1; |
1593 | 1581 | } |
@@ -243,13 +243,13 @@ | ||
243 | 243 | if (usbpid) { |
244 | 244 | pid = *(int *)(ldata(usbpid)); |
245 | 245 | 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", | |
247 | 247 | progname, pid); |
248 | 248 | } else { |
249 | 249 | pid = part->usbpid; |
250 | 250 | } |
251 | 251 | 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" | |
253 | 253 | "%s For Xmega devices, use \"flip2\".\n" |
254 | 254 | "%s (Use -F to bypass this check.)\n", |
255 | 255 | progname, progbuf, progbuf); |
@@ -264,31 +264,31 @@ | ||
264 | 264 | /* Check if descriptor values are what we expect. */ |
265 | 265 | |
266 | 266 | 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", | |
268 | 268 | progname, dfu->dev_desc.idVendor, vid); |
269 | 269 | |
270 | 270 | 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", | |
272 | 272 | progname, dfu->dev_desc.idProduct, pid); |
273 | 273 | |
274 | 274 | 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", | |
276 | 276 | progname, (int) dfu->dev_desc.bNumConfigurations); |
277 | 277 | |
278 | 278 | 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", | |
280 | 280 | progname, (int) dfu->conf_desc.bNumInterfaces); |
281 | 281 | |
282 | 282 | 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", | |
284 | 284 | progname, (int) dfu->dev_desc.bDeviceClass); |
285 | 285 | |
286 | 286 | 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", | |
288 | 288 | progname, (int) dfu->dev_desc.bDeviceSubClass); |
289 | 289 | |
290 | 290 | 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", | |
292 | 292 | progname, (int) dfu->dev_desc.bDeviceProtocol); |
293 | 293 | |
294 | 294 | /* |
@@ -299,20 +299,20 @@ | ||
299 | 299 | */ |
300 | 300 | if (0) { |
301 | 301 | 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", | |
303 | 303 | progname, (int) dfu->intf_desc.bInterfaceClass); |
304 | 304 | |
305 | 305 | 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", | |
307 | 307 | progname, (int) dfu->intf_desc.bInterfaceSubClass); |
308 | 308 | |
309 | 309 | 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", | |
311 | 311 | progname, (int) dfu->intf_desc.bInterfaceProtocol); |
312 | 312 | } |
313 | 313 | |
314 | 314 | 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", | |
316 | 316 | progname, dfu->dev_desc.bMaxPacketSize0); |
317 | 317 | |
318 | 318 | if (verbose) |
@@ -368,8 +368,7 @@ | ||
368 | 368 | int aux_result; |
369 | 369 | unsigned int default_timeout = FLIP1(pgm)->dfu->timeout; |
370 | 370 | |
371 | - if (verbose > 1) | |
372 | - avrdude_message("%s: flip_chip_erase()\n", progname); | |
371 | + avrdude_message(MSG_NOTICE2, "%s: flip_chip_erase()\n", progname); | |
373 | 372 | |
374 | 373 | struct flip1_cmd cmd = { |
375 | 374 | FLIP1_CMD_WRITE_COMMAND, { 0, 0xff } |
@@ -384,7 +383,7 @@ | ||
384 | 383 | return -1; |
385 | 384 | |
386 | 385 | 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", | |
388 | 387 | progname, flip1_status_str(&status)); |
389 | 388 | if (status.bState == STATE_dfuERROR) |
390 | 389 | dfu_clrstatus(FLIP1(pgm)->dfu); |
@@ -406,7 +405,7 @@ | ||
406 | 405 | if (flip1_read_sig_bytes(pgm, part, mem) < 0) |
407 | 406 | return -1; |
408 | 407 | 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", | |
410 | 409 | progname, addr); |
411 | 410 | return -1; |
412 | 411 | } |
@@ -417,10 +416,10 @@ | ||
417 | 416 | mem_unit = flip1_mem_unit(mem->desc); |
418 | 417 | |
419 | 418 | if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) { |
420 | - avrdude_message("%s: Error: " | |
419 | + avrdude_message(MSG_INFO, "%s: Error: " | |
421 | 420 | "\"%s\" memory not accessible using FLIP", |
422 | 421 | progname, mem->desc); |
423 | - avrdude_message("\n"); | |
422 | + avrdude_message(MSG_INFO, "\n"); | |
424 | 423 | return -1; |
425 | 424 | } |
426 | 425 |
@@ -442,10 +441,10 @@ | ||
442 | 441 | mem_unit = flip1_mem_unit(mem->desc); |
443 | 442 | |
444 | 443 | if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) { |
445 | - avrdude_message("%s: Error: " | |
444 | + avrdude_message(MSG_INFO, "%s: Error: " | |
446 | 445 | "\"%s\" memory not accessible using FLIP", |
447 | 446 | progname, mem->desc); |
448 | - avrdude_message("\n"); | |
447 | + avrdude_message(MSG_INFO, "\n"); | |
449 | 448 | return -1; |
450 | 449 | } |
451 | 450 |
@@ -463,10 +462,10 @@ | ||
463 | 462 | mem_unit = flip1_mem_unit(mem->desc); |
464 | 463 | |
465 | 464 | if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) { |
466 | - avrdude_message("%s: Error: " | |
465 | + avrdude_message(MSG_INFO, "%s: Error: " | |
467 | 466 | "\"%s\" memory not accessible using FLIP", |
468 | 467 | progname, mem->desc); |
469 | - avrdude_message("\n"); | |
468 | + avrdude_message(MSG_INFO, "\n"); | |
470 | 469 | return -1; |
471 | 470 | } |
472 | 471 |
@@ -489,16 +488,16 @@ | ||
489 | 488 | mem_unit = flip1_mem_unit(mem->desc); |
490 | 489 | |
491 | 490 | if (mem_unit == FLIP1_MEM_UNIT_UNKNOWN) { |
492 | - avrdude_message("%s: Error: " | |
491 | + avrdude_message(MSG_INFO, "%s: Error: " | |
493 | 492 | "\"%s\" memory not accessible using FLIP", |
494 | 493 | progname, mem->desc); |
495 | - avrdude_message("\n"); | |
494 | + avrdude_message(MSG_INFO, "\n"); | |
496 | 495 | return -1; |
497 | 496 | } |
498 | 497 | |
499 | 498 | if (n_bytes > INT_MAX) { |
500 | 499 | /* 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", | |
502 | 501 | progname, INT_MAX); |
503 | 502 | exit(1); |
504 | 503 | } |
@@ -511,14 +510,13 @@ | ||
511 | 510 | |
512 | 511 | int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem) |
513 | 512 | { |
514 | - if (verbose > 1) | |
515 | - avrdude_message("%s: flip1_read_sig_bytes(): ", progname); | |
513 | + avrdude_message(MSG_NOTICE2, "%s: flip1_read_sig_bytes(): ", progname); | |
516 | 514 | |
517 | 515 | if (FLIP1(pgm)->dfu == NULL) |
518 | 516 | return -1; |
519 | 517 | |
520 | 518 | 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", | |
522 | 520 | progname, (unsigned int) sizeof(FLIP1(pgm)->part_sig)); |
523 | 521 | return -1; |
524 | 522 | } |
@@ -536,8 +534,7 @@ | ||
536 | 534 | FLIP1_CMD_READ_COMMAND, FLIP1_READ_FAMILY_CODE |
537 | 535 | }; |
538 | 536 | |
539 | - if (verbose > 1) | |
540 | - avrdude_message("from device\n"); | |
537 | + avrdude_message(MSG_NOTICE2, "from device\n"); | |
541 | 538 | |
542 | 539 | for (i = 0; i < 3; i++) |
543 | 540 | { |
@@ -554,7 +551,7 @@ | ||
554 | 551 | |
555 | 552 | if (status.bStatus != DFU_STATUS_OK) |
556 | 553 | { |
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", | |
558 | 555 | progname, i, flip1_status_str(&status)); |
559 | 556 | if (status.bState == STATE_dfuERROR) |
560 | 557 | dfu_clrstatus(FLIP1(pgm)->dfu); |
@@ -569,7 +566,7 @@ | ||
569 | 566 | |
570 | 567 | if (status.bStatus != DFU_STATUS_OK) |
571 | 568 | { |
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", | |
573 | 570 | progname, i, flip1_status_str(&status)); |
574 | 571 | if (status.bState == STATE_dfuERROR) |
575 | 572 | dfu_clrstatus(FLIP1(pgm)->dfu); |
@@ -579,8 +576,7 @@ | ||
579 | 576 | } |
580 | 577 | else |
581 | 578 | { |
582 | - if (verbose > 1) | |
583 | - avrdude_message("cached\n"); | |
579 | + avrdude_message(MSG_NOTICE2, "cached\n"); | |
584 | 580 | } |
585 | 581 | |
586 | 582 | memcpy(mem->buf, FLIP1(pgm)->part_sig, sizeof(FLIP1(pgm)->part_sig)); |
@@ -593,7 +589,7 @@ | ||
593 | 589 | pgm->cookie = calloc(1, sizeof(struct flip1)); |
594 | 590 | |
595 | 591 | 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", | |
597 | 593 | progname); |
598 | 594 | exit(1); |
599 | 595 | } |
@@ -611,7 +607,7 @@ | ||
611 | 607 | void flip1_show_info(struct flip1 *flip1) |
612 | 608 | { |
613 | 609 | 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", | |
615 | 611 | (unsigned short) flip1->dfu->dev_desc.bMaxPacketSize0); |
616 | 612 | } |
617 | 613 |
@@ -629,9 +625,8 @@ | ||
629 | 625 | unsigned int default_timeout = dfu->timeout; |
630 | 626 | |
631 | 627 | |
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); | |
635 | 630 | |
636 | 631 | /* |
637 | 632 | * As this function is called once per page, no need to handle 64 |
@@ -661,7 +656,7 @@ | ||
661 | 656 | |
662 | 657 | if (status.bStatus != DFU_STATUS_OK) |
663 | 658 | { |
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", | |
665 | 660 | progname, size, flip1_mem_unit_str(mem_unit), addr, |
666 | 661 | flip1_status_str(&status)); |
667 | 662 | if (status.bState == STATE_dfuERROR) |
@@ -675,7 +670,7 @@ | ||
675 | 670 | if (cmd_result < 0 && aux_result == 0 && |
676 | 671 | status.bStatus == DFU_STATUS_ERR_WRITE) { |
677 | 672 | if (FLIP1(pgm)->security_mode_flag == 0) |
678 | - avrdude_message("\n%s:\n" | |
673 | + avrdude_message(MSG_INFO, "\n%s:\n" | |
679 | 674 | "%s***********************************************************************\n" |
680 | 675 | "%sMaybe the device is in ``security mode´´, and needs a chip erase first?\n" |
681 | 676 | "%s***********************************************************************\n" |
@@ -689,7 +684,7 @@ | ||
689 | 684 | |
690 | 685 | if (status.bStatus != DFU_STATUS_OK) |
691 | 686 | { |
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", | |
693 | 688 | progname, size, flip1_mem_unit_str(mem_unit), addr, |
694 | 689 | flip1_status_str(&status)); |
695 | 690 | if (status.bState == STATE_dfuERROR) |
@@ -723,14 +718,13 @@ | ||
723 | 718 | unsigned int default_timeout = dfu->timeout; |
724 | 719 | unsigned char *buf; |
725 | 720 | |
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); | |
729 | 723 | |
730 | 724 | if (size < 32) { |
731 | 725 | /* presumably single-byte updates; must be padded to USB endpoint size */ |
732 | 726 | 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", | |
734 | 728 | progname, addr, addr + size - 1); |
735 | 729 | return -1; |
736 | 730 | } |
@@ -742,7 +736,7 @@ | ||
742 | 736 | if ((buf = malloc(sizeof(struct flip1_cmd_header) + |
743 | 737 | write_size + |
744 | 738 | 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); | |
746 | 740 | return -1; |
747 | 741 | } |
748 | 742 |
@@ -791,7 +785,7 @@ | ||
791 | 785 | |
792 | 786 | if (status.bStatus != DFU_STATUS_OK) |
793 | 787 | { |
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", | |
795 | 789 | progname, size, flip1_mem_unit_str(mem_unit), addr, |
796 | 790 | flip1_status_str(&status)); |
797 | 791 | if (status.bState == STATE_dfuERROR) |
@@ -822,7 +816,7 @@ | ||
822 | 816 | |
823 | 817 | if (status.bStatus != DFU_STATUS_OK) |
824 | 818 | { |
825 | - avrdude_message("%s: failed to set memory page: %s\n", | |
819 | + avrdude_message(MSG_INFO, "%s: failed to set memory page: %s\n", | |
826 | 820 | progname, flip1_status_str(&status)); |
827 | 821 | if (status.bState == STATE_dfuERROR) |
828 | 822 | dfu_clrstatus(dfu); |
@@ -236,7 +236,7 @@ | ||
236 | 236 | if (usbpid) { |
237 | 237 | pid = *(int *)(ldata(usbpid)); |
238 | 238 | 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", | |
240 | 240 | progname, pid); |
241 | 241 | } else { |
242 | 242 | pid = part->usbpid; |
@@ -243,7 +243,7 @@ | ||
243 | 243 | } |
244 | 244 | |
245 | 245 | 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" | |
247 | 247 | "%s For AT90USB* or ATmega*U* devices, use \"flip1\".\n" |
248 | 248 | "%s (Use -F to bypass this check.)\n", |
249 | 249 | progname, progbuf, progbuf); |
@@ -258,43 +258,43 @@ | ||
258 | 258 | /* Check if descriptor values are what we expect. */ |
259 | 259 | |
260 | 260 | 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", | |
262 | 262 | progname, dfu->dev_desc.idVendor, vid); |
263 | 263 | |
264 | 264 | 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", | |
266 | 266 | progname, dfu->dev_desc.idProduct, pid); |
267 | 267 | |
268 | 268 | 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", | |
270 | 270 | progname, (int) dfu->dev_desc.bNumConfigurations); |
271 | 271 | |
272 | 272 | 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", | |
274 | 274 | progname, (int) dfu->conf_desc.bNumInterfaces); |
275 | 275 | |
276 | 276 | 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", | |
278 | 278 | progname, (int) dfu->dev_desc.bDeviceClass); |
279 | 279 | |
280 | 280 | 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", | |
282 | 282 | progname, (int) dfu->dev_desc.bDeviceSubClass); |
283 | 283 | |
284 | 284 | 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", | |
286 | 286 | progname, (int) dfu->dev_desc.bDeviceProtocol); |
287 | 287 | |
288 | 288 | 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", | |
290 | 290 | progname, (int) dfu->intf_desc.bInterfaceClass); |
291 | 291 | |
292 | 292 | 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", | |
294 | 294 | progname, (int) dfu->intf_desc.bInterfaceSubClass); |
295 | 295 | |
296 | 296 | 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", | |
298 | 298 | progname, (int) dfu->intf_desc.bInterfaceProtocol); |
299 | 299 | |
300 | 300 | result = flip2_read_memory(FLIP2(pgm)->dfu, |
@@ -359,8 +359,7 @@ | ||
359 | 359 | int cmd_result = 0; |
360 | 360 | int aux_result; |
361 | 361 | |
362 | - if (verbose > 1) | |
363 | - avrdude_message("%s: flip_chip_erase()\n", progname); | |
362 | + avrdude_message(MSG_NOTICE2, "%s: flip_chip_erase()\n", progname); | |
364 | 363 | |
365 | 364 | struct flip2_cmd cmd = { |
366 | 365 | FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_CHIP_ERASE, { 0xFF, 0, 0, 0 } |
@@ -379,7 +378,7 @@ | ||
379 | 378 | { |
380 | 379 | continue; |
381 | 380 | } else |
382 | - avrdude_message("%s: Error: DFU status %s\n", progname, | |
381 | + avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname, | |
383 | 382 | flip2_status_str(&status)); |
384 | 383 | dfu_clrstatus(FLIP2(pgm)->dfu); |
385 | 384 | } else |
@@ -400,12 +399,12 @@ | ||
400 | 399 | mem_unit = flip2_mem_unit(mem->desc); |
401 | 400 | |
402 | 401 | if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) { |
403 | - avrdude_message("%s: Error: " | |
402 | + avrdude_message(MSG_INFO, "%s: Error: " | |
404 | 403 | "\"%s\" memory not accessible using FLIP", |
405 | 404 | progname, mem->desc); |
406 | 405 | 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"); | |
409 | 408 | return -1; |
410 | 409 | } |
411 | 410 |
@@ -423,12 +422,12 @@ | ||
423 | 422 | mem_unit = flip2_mem_unit(mem->desc); |
424 | 423 | |
425 | 424 | if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) { |
426 | - avrdude_message("%s: Error: " | |
425 | + avrdude_message(MSG_INFO, "%s: Error: " | |
427 | 426 | "\"%s\" memory not accessible using FLIP", |
428 | 427 | progname, mem->desc); |
429 | 428 | 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"); | |
432 | 431 | return -1; |
433 | 432 | } |
434 | 433 |
@@ -447,18 +446,18 @@ | ||
447 | 446 | mem_unit = flip2_mem_unit(mem->desc); |
448 | 447 | |
449 | 448 | if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) { |
450 | - avrdude_message("%s: Error: " | |
449 | + avrdude_message(MSG_INFO, "%s: Error: " | |
451 | 450 | "\"%s\" memory not accessible using FLIP", |
452 | 451 | progname, mem->desc); |
453 | 452 | 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"); | |
456 | 455 | return -1; |
457 | 456 | } |
458 | 457 | |
459 | 458 | if (n_bytes > INT_MAX) { |
460 | 459 | /* 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", | |
462 | 461 | progname, INT_MAX); |
463 | 462 | exit(1); |
464 | 463 | } |
@@ -481,18 +480,18 @@ | ||
481 | 480 | mem_unit = flip2_mem_unit(mem->desc); |
482 | 481 | |
483 | 482 | if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) { |
484 | - avrdude_message("%s: Error: " | |
483 | + avrdude_message(MSG_INFO, "%s: Error: " | |
485 | 484 | "\"%s\" memory not accessible using FLIP", |
486 | 485 | progname, mem->desc); |
487 | 486 | 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"); | |
490 | 489 | return -1; |
491 | 490 | } |
492 | 491 | |
493 | 492 | if (n_bytes > INT_MAX) { |
494 | 493 | /* 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", | |
496 | 495 | progname, INT_MAX); |
497 | 496 | exit(1); |
498 | 497 | } |
@@ -509,7 +508,7 @@ | ||
509 | 508 | return -1; |
510 | 509 | |
511 | 510 | 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", | |
513 | 512 | progname, (unsigned int) sizeof(FLIP2(pgm)->part_sig)); |
514 | 513 | return -1; |
515 | 514 | } |
@@ -523,7 +522,7 @@ | ||
523 | 522 | pgm->cookie = calloc(1, sizeof(struct flip2)); |
524 | 523 | |
525 | 524 | 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", | |
527 | 526 | progname); |
528 | 527 | exit(1); |
529 | 528 | } |
@@ -542,24 +541,24 @@ | ||
542 | 541 | { |
543 | 542 | dfu_show_info(flip2->dfu); |
544 | 543 | |
545 | - avrdude_message(" Part signature : 0x%02X%02X%02X\n", | |
544 | + avrdude_message(MSG_INFO, " Part signature : 0x%02X%02X%02X\n", | |
546 | 545 | (int) flip2->part_sig[0], |
547 | 546 | (int) flip2->part_sig[1], |
548 | 547 | (int) flip2->part_sig[2]); |
549 | 548 | |
550 | 549 | if (flip2->part_rev < 26) |
551 | - avrdude_message(" Part revision : %c\n", | |
550 | + avrdude_message(MSG_INFO, " Part revision : %c\n", | |
552 | 551 | (char) (flip2->part_rev + 'A')); |
553 | 552 | else |
554 | - avrdude_message(" Part revision : %c%c\n", | |
553 | + avrdude_message(MSG_INFO, " Part revision : %c%c\n", | |
555 | 554 | (char) (flip2->part_rev / 26 - 1 + 'A'), |
556 | 555 | (char) (flip2->part_rev % 26 + 'A')); |
557 | 556 | |
558 | - avrdude_message(" Bootloader version : 2.%hu.%hu\n", | |
557 | + avrdude_message(MSG_INFO, " Bootloader version : 2.%hu.%hu\n", | |
559 | 558 | ((unsigned short) flip2->boot_ver >> 4) & 0xF, |
560 | 559 | ((unsigned short) flip2->boot_ver >> 0) & 0xF); |
561 | 560 | |
562 | - avrdude_message(" USB max packet size : %hu\n", | |
561 | + avrdude_message(MSG_INFO, " USB max packet size : %hu\n", | |
563 | 562 | (unsigned short) flip2->dfu->dev_desc.bMaxPacketSize0); |
564 | 563 | } |
565 | 564 |
@@ -572,18 +571,17 @@ | ||
572 | 571 | int read_size; |
573 | 572 | int result; |
574 | 573 | |
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); | |
578 | 576 | |
579 | 577 | result = flip2_set_mem_unit(dfu, mem_unit); |
580 | 578 | |
581 | 579 | if (result != 0) { |
582 | 580 | 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", | |
584 | 582 | progname, (int) mem_unit, mem_name); |
585 | 583 | 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", | |
587 | 585 | progname, (int) mem_unit); |
588 | 586 | return -1; |
589 | 587 | } |
@@ -592,7 +590,7 @@ | ||
592 | 590 | result = flip2_set_mem_page(dfu, page_addr); |
593 | 591 | |
594 | 592 | 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", | |
596 | 594 | progname, page_addr); |
597 | 595 | return -1; |
598 | 596 | } |
@@ -604,7 +602,7 @@ | ||
604 | 602 | if (page_addr != prev_page_addr) { |
605 | 603 | result = flip2_set_mem_page(dfu, page_addr); |
606 | 604 | 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", | |
608 | 606 | progname, page_addr); |
609 | 607 | return -1; |
610 | 608 | } |
@@ -614,7 +612,7 @@ | ||
614 | 612 | result = flip2_read_max1k(dfu, addr & 0xFFFF, ptr, read_size); |
615 | 613 | |
616 | 614 | 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", | |
618 | 616 | progname, read_size, (unsigned long) addr); |
619 | 617 | return -1; |
620 | 618 | } |
@@ -636,18 +634,17 @@ | ||
636 | 634 | int write_size; |
637 | 635 | int result; |
638 | 636 | |
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); | |
642 | 639 | |
643 | 640 | result = flip2_set_mem_unit(dfu, mem_unit); |
644 | 641 | |
645 | 642 | if (result != 0) { |
646 | 643 | 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", | |
648 | 645 | progname, (int) mem_unit, mem_name); |
649 | 646 | 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", | |
651 | 648 | progname, (int) mem_unit); |
652 | 649 | return -1; |
653 | 650 | } |
@@ -656,7 +653,7 @@ | ||
656 | 653 | result = flip2_set_mem_page(dfu, page_addr); |
657 | 654 | |
658 | 655 | 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", | |
660 | 657 | progname, page_addr); |
661 | 658 | return -1; |
662 | 659 | } |
@@ -668,7 +665,7 @@ | ||
668 | 665 | if (page_addr != prev_page_addr) { |
669 | 666 | result = flip2_set_mem_page(dfu, page_addr); |
670 | 667 | 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", | |
672 | 669 | progname, page_addr); |
673 | 670 | return -1; |
674 | 671 | } |
@@ -678,7 +675,7 @@ | ||
678 | 675 | result = flip2_write_max1k(dfu, addr & 0xFFFF, ptr, write_size); |
679 | 676 | |
680 | 677 | 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", | |
682 | 679 | progname, write_size, (unsigned long) addr); |
683 | 680 | return -1; |
684 | 681 | } |
@@ -715,10 +712,10 @@ | ||
715 | 712 | if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) && |
716 | 713 | status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF)) |
717 | 714 | { |
718 | - avrdude_message("%s: Error: Unknown memory unit (0x%02x)\n", | |
715 | + avrdude_message(MSG_INFO, "%s: Error: Unknown memory unit (0x%02x)\n", | |
719 | 716 | progname, (unsigned int) mem_unit); |
720 | 717 | } else |
721 | - avrdude_message("%s: Error: DFU status %s\n", progname, | |
718 | + avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname, | |
722 | 719 | flip2_status_str(&status)); |
723 | 720 | dfu_clrstatus(dfu); |
724 | 721 | } |
@@ -752,10 +749,10 @@ | ||
752 | 749 | if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) && |
753 | 750 | status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF)) |
754 | 751 | { |
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", | |
756 | 753 | progname, page_addr); |
757 | 754 | } else |
758 | - avrdude_message("%s: Error: DFU status %s\n", progname, | |
755 | + avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname, | |
759 | 756 | flip2_status_str(&status)); |
760 | 757 | dfu_clrstatus(dfu); |
761 | 758 | } |
@@ -797,10 +794,10 @@ | ||
797 | 794 | if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) && |
798 | 795 | status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF)) |
799 | 796 | { |
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", | |
801 | 798 | progname, offset, offset+size-1); |
802 | 799 | } else |
803 | - avrdude_message("%s: Error: DFU status %s\n", progname, | |
800 | + avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname, | |
804 | 801 | flip2_status_str(&status)); |
805 | 802 | dfu_clrstatus(dfu); |
806 | 803 | } |
@@ -827,7 +824,7 @@ | ||
827 | 824 | cmd.args[3] = ((offset+size-1) >> 0) & 0xFF; |
828 | 825 | |
829 | 826 | 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", | |
831 | 828 | progname, size); |
832 | 829 | return -1; |
833 | 830 | } |
@@ -858,10 +855,10 @@ | ||
858 | 855 | if (status.bStatus == ((FLIP2_STATUS_OUTOFRANGE >> 8) & 0xFF) && |
859 | 856 | status.bState == ((FLIP2_STATUS_OUTOFRANGE >> 0) & 0xFF)) |
860 | 857 | { |
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", | |
862 | 859 | progname, offset, offset+size-1); |
863 | 860 | } else |
864 | - avrdude_message("%s: Error: DFU status %s\n", progname, | |
861 | + avrdude_message(MSG_INFO, "%s: Error: DFU status %s\n", progname, | |
865 | 862 | flip2_status_str(&status)); |
866 | 863 | dfu_clrstatus(dfu); |
867 | 864 | } |
@@ -89,7 +89,7 @@ | ||
89 | 89 | #ifndef HAVE_PTHREAD_H |
90 | 90 | |
91 | 91 | 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." | |
93 | 93 | #if defined(_WIN32) |
94 | 94 | " See http://sourceware.org/pthreads-win32/." |
95 | 95 | #endif |
@@ -107,7 +107,7 @@ | ||
107 | 107 | #elif defined(DO_NOT_BUILD_FT245R) |
108 | 108 | |
109 | 109 | 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", | |
111 | 111 | progname); |
112 | 112 | |
113 | 113 | return -1; |
@@ -165,7 +165,7 @@ | ||
165 | 165 | else nh = head + 1; |
166 | 166 | |
167 | 167 | if (nh == tail) { |
168 | - avrdude_message("buffer overflow. Cannot happen!\n"); | |
168 | + avrdude_message(MSG_INFO, "buffer overflow. Cannot happen!\n"); | |
169 | 169 | } |
170 | 170 | buffer[head] = c; |
171 | 171 | head = nh; |
@@ -235,7 +235,7 @@ | ||
235 | 235 | unsigned char res[4]; |
236 | 236 | |
237 | 237 | 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", | |
239 | 239 | p->desc); |
240 | 240 | return -1; |
241 | 241 | } |
@@ -260,13 +260,13 @@ | ||
260 | 260 | rate = 150000; /* should work for all ftdi chips and the avr default internal clock of 1MHz */ |
261 | 261 | } |
262 | 262 | |
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", | |
265 | 265 | rate / 2, rate); |
266 | 266 | } |
267 | 267 | r = ftdi_set_baudrate(handle, rate); |
268 | 268 | 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", | |
270 | 270 | rate, ftdi_get_error_string (handle)); |
271 | 271 | return -1; |
272 | 272 | } |
@@ -373,7 +373,7 @@ | ||
373 | 373 | int i; |
374 | 374 | |
375 | 375 | 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", | |
377 | 377 | progname, p->desc); |
378 | 378 | fflush(stderr); |
379 | 379 | return -1; |
@@ -386,8 +386,8 @@ | ||
386 | 386 | |
387 | 387 | if (res[p->pollindex-1] == p->pollvalue) return 0; |
388 | 388 | |
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", | |
391 | 391 | progname); |
392 | 392 | fflush(stderr); |
393 | 393 | } |
@@ -401,7 +401,7 @@ | ||
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
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", | |
405 | 405 | progname); |
406 | 406 | fflush(stderr); |
407 | 407 |
@@ -541,7 +541,7 @@ | ||
541 | 541 | } |
542 | 542 | } |
543 | 543 | 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", | |
545 | 545 | progname,port); |
546 | 546 | return -1; |
547 | 547 | } |
@@ -556,7 +556,7 @@ | ||
556 | 556 | if (usbpid) { |
557 | 557 | pid = *(int *)(ldata(usbpid)); |
558 | 558 | 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", | |
560 | 560 | progname, pid); |
561 | 561 | } else { |
562 | 562 | pid = USB_DEVICE_FT245; |
@@ -568,7 +568,7 @@ | ||
568 | 568 | pgm->usbsn[0]?pgm->usbsn:NULL, |
569 | 569 | devnum); |
570 | 570 | 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)); | |
572 | 572 | goto cleanup_no_usb; |
573 | 573 | } |
574 | 574 |
@@ -598,7 +598,7 @@ | ||
598 | 598 | |
599 | 599 | rv = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronous BitBang |
600 | 600 | 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", | |
602 | 602 | progname, ftdi_get_error_string(handle)); |
603 | 603 | goto cleanup; |
604 | 604 | } |
@@ -652,7 +652,7 @@ | ||
652 | 652 | } |
653 | 653 | |
654 | 654 | 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);*/ | |
656 | 656 | pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS); |
657 | 657 | } |
658 | 658 |
@@ -705,7 +705,7 @@ | ||
705 | 705 | } else { |
706 | 706 | p = malloc(sizeof(struct ft245r_request)); |
707 | 707 | if (!p) { |
708 | - avrdude_message("can't alloc memory\n"); | |
708 | + avrdude_message(MSG_INFO, "can't alloc memory\n"); | |
709 | 709 | exit(1); |
710 | 710 | } |
711 | 711 | } |
@@ -799,7 +799,7 @@ | ||
799 | 799 | put_request(addr_save, buf_pos, 0); |
800 | 800 | //ft245r_sync(pgm); |
801 | 801 | #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", | |
803 | 803 | addr_save,buf_pos, |
804 | 804 | extract_data_out(pgm, buf , (0*4 + 3) ), |
805 | 805 | extract_data_out(pgm, buf , (1*4 + 3) ), |
@@ -109,7 +109,7 @@ | ||
109 | 109 | void jtag3_setup(PROGRAMMER * pgm) |
110 | 110 | { |
111 | 111 | 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", | |
113 | 113 | progname); |
114 | 114 | exit(1); |
115 | 115 | } |
@@ -168,7 +168,7 @@ | ||
168 | 168 | return; |
169 | 169 | |
170 | 170 | for (i = 0; i < s; i++) { |
171 | - avrdude_message("0x%02x", b[i]); | |
171 | + avrdude_message(MSG_INFO, "0x%02x", b[i]); | |
172 | 172 | if (i % 16 == 15) |
173 | 173 | putc('\n', stderr); |
174 | 174 | else |
@@ -183,10 +183,10 @@ | ||
183 | 183 | int i; |
184 | 184 | |
185 | 185 | if (verbose >= 4) { |
186 | - avrdude_message("Raw message:\n"); | |
186 | + avrdude_message(MSG_TRACE, "Raw message:\n"); | |
187 | 187 | |
188 | 188 | for (i = 0; i < len; i++) { |
189 | - avrdude_message("%02x ", data[i]); | |
189 | + avrdude_message(MSG_TRACE, "%02x ", data[i]); | |
190 | 190 | if (i % 16 == 15) |
191 | 191 | putc('\n', stderr); |
192 | 192 | else |
@@ -198,34 +198,34 @@ | ||
198 | 198 | |
199 | 199 | switch (data[0]) { |
200 | 200 | case SCOPE_INFO: |
201 | - avrdude_message("[info] "); | |
201 | + avrdude_message(MSG_INFO, "[info] "); | |
202 | 202 | break; |
203 | 203 | |
204 | 204 | case SCOPE_GENERAL: |
205 | - avrdude_message("[general] "); | |
205 | + avrdude_message(MSG_INFO, "[general] "); | |
206 | 206 | break; |
207 | 207 | |
208 | 208 | case SCOPE_AVR_ISP: |
209 | - avrdude_message("[AVRISP] "); | |
209 | + avrdude_message(MSG_INFO, "[AVRISP] "); | |
210 | 210 | jtag3_print_data(data + 1, len - 1); |
211 | 211 | return; |
212 | 212 | |
213 | 213 | case SCOPE_AVR: |
214 | - avrdude_message("[AVR] "); | |
214 | + avrdude_message(MSG_INFO, "[AVR] "); | |
215 | 215 | break; |
216 | 216 | |
217 | 217 | default: |
218 | - avrdude_message("[scope 0x%02x] ", data[0]); | |
218 | + avrdude_message(MSG_INFO, "[scope 0x%02x] ", data[0]); | |
219 | 219 | break; |
220 | 220 | } |
221 | 221 | |
222 | 222 | switch (data[1]) { |
223 | 223 | case RSP3_OK: |
224 | - avrdude_message("OK\n"); | |
224 | + avrdude_message(MSG_INFO, "OK\n"); | |
225 | 225 | break; |
226 | 226 | |
227 | 227 | case RSP3_FAILED: |
228 | - avrdude_message("FAILED"); | |
228 | + avrdude_message(MSG_INFO, "FAILED"); | |
229 | 229 | if (len > 3) |
230 | 230 | { |
231 | 231 | char reason[50]; |
@@ -264,26 +264,26 @@ | ||
264 | 264 | strcpy(reason, "debugWIRE communication failed"); |
265 | 265 | break; |
266 | 266 | } |
267 | - avrdude_message(", reason: %s\n", reason); | |
267 | + avrdude_message(MSG_INFO, ", reason: %s\n", reason); | |
268 | 268 | } |
269 | 269 | else |
270 | 270 | { |
271 | - avrdude_message(", unspecified reason\n"); | |
271 | + avrdude_message(MSG_INFO, ", unspecified reason\n"); | |
272 | 272 | } |
273 | 273 | break; |
274 | 274 | |
275 | 275 | case RSP3_DATA: |
276 | - avrdude_message("Data returned:\n"); | |
276 | + avrdude_message(MSG_INFO, "Data returned:\n"); | |
277 | 277 | jtag3_print_data(data + 2, len - 2); |
278 | 278 | break; |
279 | 279 | |
280 | 280 | case RSP3_INFO: |
281 | - avrdude_message("Info returned:\n"); | |
281 | + avrdude_message(MSG_INFO, "Info returned:\n"); | |
282 | 282 | for (i = 2; i < len; i++) { |
283 | 283 | if (isprint(data[i])) |
284 | 284 | putc(data[i], stderr); |
285 | 285 | else |
286 | - avrdude_message("\\%03o", data[i]); | |
286 | + avrdude_message(MSG_INFO, "\\%03o", data[i]); | |
287 | 287 | } |
288 | 288 | putc('\n', stderr); |
289 | 289 | break; |
@@ -291,18 +291,18 @@ | ||
291 | 291 | case RSP3_PC: |
292 | 292 | if (len < 7) |
293 | 293 | { |
294 | - avrdude_message("PC reply too short\n"); | |
294 | + avrdude_message(MSG_INFO, "PC reply too short\n"); | |
295 | 295 | } |
296 | 296 | else |
297 | 297 | { |
298 | 298 | unsigned long pc = (data[6] << 24) | (data[5] << 16) |
299 | 299 | | (data[4] << 8) | data[3]; |
300 | - avrdude_message("PC 0x%0lx\n", pc); | |
300 | + avrdude_message(MSG_INFO, "PC 0x%0lx\n", pc); | |
301 | 301 | } |
302 | 302 | break; |
303 | 303 | |
304 | 304 | default: |
305 | - avrdude_message("unknown message 0x%02x\n", data[1]); | |
305 | + avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[1]); | |
306 | 306 | } |
307 | 307 | } |
308 | 308 |
@@ -311,10 +311,10 @@ | ||
311 | 311 | int i; |
312 | 312 | |
313 | 313 | if (verbose >= 4) { |
314 | - avrdude_message("Raw event:\n"); | |
314 | + avrdude_message(MSG_TRACE, "Raw event:\n"); | |
315 | 315 | |
316 | 316 | for (i = 0; i < len; i++) { |
317 | - avrdude_message("%02x ", data[i]); | |
317 | + avrdude_message(MSG_TRACE, "%02x ", data[i]); | |
318 | 318 | if (i % 16 == 15) |
319 | 319 | putc('\n', stderr); |
320 | 320 | else |
@@ -324,47 +324,47 @@ | ||
324 | 324 | putc('\n', stderr); |
325 | 325 | } |
326 | 326 | |
327 | - avrdude_message("Event serial 0x%04x, ", | |
327 | + avrdude_message(MSG_INFO, "Event serial 0x%04x, ", | |
328 | 328 | (data[3] << 8) | data[2]); |
329 | 329 | |
330 | 330 | switch (data[4]) { |
331 | 331 | case SCOPE_INFO: |
332 | - avrdude_message("[info] "); | |
332 | + avrdude_message(MSG_INFO, "[info] "); | |
333 | 333 | break; |
334 | 334 | |
335 | 335 | case SCOPE_GENERAL: |
336 | - avrdude_message("[general] "); | |
336 | + avrdude_message(MSG_INFO, "[general] "); | |
337 | 337 | break; |
338 | 338 | |
339 | 339 | case SCOPE_AVR: |
340 | - avrdude_message("[AVR] "); | |
340 | + avrdude_message(MSG_INFO, "[AVR] "); | |
341 | 341 | break; |
342 | 342 | |
343 | 343 | default: |
344 | - avrdude_message("[scope 0x%02x] ", data[0]); | |
344 | + avrdude_message(MSG_INFO, "[scope 0x%02x] ", data[0]); | |
345 | 345 | break; |
346 | 346 | } |
347 | 347 | |
348 | 348 | switch (data[5]) { |
349 | 349 | case EVT3_BREAK: |
350 | - avrdude_message("BREAK"); | |
350 | + avrdude_message(MSG_INFO, "BREAK"); | |
351 | 351 | 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)); | |
353 | 353 | switch (data[10]) { |
354 | 354 | case 0x00: |
355 | - avrdude_message("unspecified"); | |
355 | + avrdude_message(MSG_INFO, "unspecified"); | |
356 | 356 | break; |
357 | 357 | case 0x01: |
358 | - avrdude_message("program break"); | |
358 | + avrdude_message(MSG_INFO, "program break"); | |
359 | 359 | break; |
360 | 360 | case 0x02: |
361 | - avrdude_message("data break PDSB"); | |
361 | + avrdude_message(MSG_INFO, "data break PDSB"); | |
362 | 362 | break; |
363 | 363 | case 0x03: |
364 | - avrdude_message("data break PDMSB"); | |
364 | + avrdude_message(MSG_INFO, "data break PDMSB"); | |
365 | 365 | break; |
366 | 366 | default: |
367 | - avrdude_message("unknown: 0x%02x", data[10]); | |
367 | + avrdude_message(MSG_INFO, "unknown: 0x%02x", data[10]); | |
368 | 368 | } |
369 | 369 | /* There are two more bytes of data which always appear to be |
370 | 370 | * 0x01, 0x00. Purpose unknown. */ |
@@ -373,24 +373,24 @@ | ||
373 | 373 | |
374 | 374 | case EVT3_SLEEP: |
375 | 375 | if (len >= 8 && data[7] == 0) |
376 | - avrdude_message("sleeping"); | |
376 | + avrdude_message(MSG_INFO, "sleeping"); | |
377 | 377 | else if (len >= 8 && data[7] == 1) |
378 | - avrdude_message("wakeup"); | |
378 | + avrdude_message(MSG_INFO, "wakeup"); | |
379 | 379 | else |
380 | - avrdude_message("unknown SLEEP event"); | |
380 | + avrdude_message(MSG_INFO, "unknown SLEEP event"); | |
381 | 381 | break; |
382 | 382 | |
383 | 383 | case EVT3_POWER: |
384 | 384 | if (len >= 8 && data[7] == 0) |
385 | - avrdude_message("power-down"); | |
385 | + avrdude_message(MSG_INFO, "power-down"); | |
386 | 386 | else if (len >= 8 && data[7] == 1) |
387 | - avrdude_message("power-up"); | |
387 | + avrdude_message(MSG_INFO, "power-up"); | |
388 | 388 | else |
389 | - avrdude_message("unknown POWER event"); | |
389 | + avrdude_message(MSG_INFO, "unknown POWER event"); | |
390 | 390 | break; |
391 | 391 | |
392 | 392 | default: |
393 | - avrdude_message("UNKNOWN 0x%02x", data[5]); | |
393 | + avrdude_message(MSG_INFO, "UNKNOWN 0x%02x", data[5]); | |
394 | 394 | break; |
395 | 395 | } |
396 | 396 | putc('\n', stderr); |
@@ -405,13 +405,12 @@ | ||
405 | 405 | if (pgm->flag & PGM_FL_IS_EDBG) |
406 | 406 | return jtag3_edbg_send(pgm, data, len); |
407 | 407 | |
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", | |
410 | 409 | progname, (unsigned long)len); |
411 | 410 | |
412 | 411 | if ((buf = malloc(len + 4)) == NULL) |
413 | 412 | { |
414 | - avrdude_message("%s: jtag3_send(): out of memory", | |
413 | + avrdude_message(MSG_INFO, "%s: jtag3_send(): out of memory", | |
415 | 414 | progname); |
416 | 415 | return -1; |
417 | 416 | } |
@@ -422,7 +421,7 @@ | ||
422 | 421 | memcpy(buf + 4, data, len); |
423 | 422 | |
424 | 423 | 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", | |
426 | 425 | progname); |
427 | 426 | return -1; |
428 | 427 | } |
@@ -444,13 +443,12 @@ | ||
444 | 443 | memset(status, 0, USBDEV_MAX_XFER_3); |
445 | 444 | } |
446 | 445 | |
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", | |
449 | 447 | progname, (unsigned long)len); |
450 | 448 | |
451 | 449 | if (len + 8 > USBDEV_MAX_XFER_3) |
452 | 450 | { |
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", | |
454 | 452 | progname); |
455 | 453 | return -1; |
456 | 454 | } |
@@ -464,7 +462,7 @@ | ||
464 | 462 | memcpy(buf + 8, data, len); |
465 | 463 | |
466 | 464 | 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", | |
468 | 466 | progname); |
469 | 467 | return -1; |
470 | 468 | } |
@@ -472,8 +470,7 @@ | ||
472 | 470 | |
473 | 471 | if (rv < 0) { |
474 | 472 | /* 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", | |
477 | 474 | progname); |
478 | 475 | return -1; |
479 | 476 | } |
@@ -480,7 +477,7 @@ | ||
480 | 477 | if (status[0] != EDBG_VENDOR_AVR_CMD || status[1] != 0x01) |
481 | 478 | { |
482 | 479 | /* 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", | |
484 | 481 | progname, status[0], status[1]); |
485 | 482 | } |
486 | 483 |
@@ -496,8 +493,7 @@ | ||
496 | 493 | unsigned char status[USBDEV_MAX_XFER_3]; |
497 | 494 | int rv; |
498 | 495 | |
499 | - if (verbose >= 3) | |
500 | - avrdude_message("\n%s: jtag3_edbg_prepare()\n", | |
496 | + avrdude_message(MSG_DEBUG, "\n%s: jtag3_edbg_prepare()\n", | |
501 | 497 | progname); |
502 | 498 | |
503 | 499 | if (verbose >= 4) |
@@ -506,22 +502,21 @@ | ||
506 | 502 | buf[0] = CMSISDAP_CMD_CONNECT; |
507 | 503 | buf[1] = CMSISDAP_CONN_SWD; |
508 | 504 | 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", | |
510 | 506 | progname); |
511 | 507 | return -1; |
512 | 508 | } |
513 | 509 | rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3); |
514 | 510 | 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", | |
516 | 512 | progname, rv); |
517 | 513 | return -1; |
518 | 514 | } |
519 | 515 | if (status[0] != CMSISDAP_CMD_CONNECT || |
520 | 516 | 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", | |
522 | 518 | 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", | |
525 | 520 | progname, status[1]); |
526 | 521 | |
527 | 522 | buf[0] = CMSISDAP_CMD_LED; |
@@ -528,19 +523,19 @@ | ||
528 | 523 | buf[1] = CMSISDAP_LED_CONNECT; |
529 | 524 | buf[2] = 1; |
530 | 525 | 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", | |
532 | 527 | progname); |
533 | 528 | return -1; |
534 | 529 | } |
535 | 530 | rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3); |
536 | 531 | 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", | |
538 | 533 | progname, rv); |
539 | 534 | return -1; |
540 | 535 | } |
541 | 536 | if (status[0] != CMSISDAP_CMD_LED || |
542 | 537 | 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", | |
544 | 539 | progname, status[0], status[1]); |
545 | 540 | |
546 | 541 | return 0; |
@@ -556,8 +551,7 @@ | ||
556 | 551 | unsigned char status[USBDEV_MAX_XFER_3]; |
557 | 552 | int rv; |
558 | 553 | |
559 | - if (verbose >= 3) | |
560 | - avrdude_message("\n%s: jtag3_edbg_signoff()\n", | |
554 | + avrdude_message(MSG_DEBUG, "\n%s: jtag3_edbg_signoff()\n", | |
561 | 555 | progname); |
562 | 556 | |
563 | 557 | if (verbose >= 4) |
@@ -567,36 +561,36 @@ | ||
567 | 561 | buf[1] = CMSISDAP_LED_CONNECT; |
568 | 562 | buf[2] = 0; |
569 | 563 | 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", | |
571 | 565 | progname); |
572 | 566 | return -1; |
573 | 567 | } |
574 | 568 | rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3); |
575 | 569 | 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", | |
577 | 571 | progname, rv); |
578 | 572 | return -1; |
579 | 573 | } |
580 | 574 | if (status[0] != CMSISDAP_CMD_LED || |
581 | 575 | 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", | |
583 | 577 | progname, status[0], status[1]); |
584 | 578 | |
585 | 579 | buf[0] = CMSISDAP_CMD_DISCONNECT; |
586 | 580 | 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", | |
588 | 582 | progname); |
589 | 583 | return -1; |
590 | 584 | } |
591 | 585 | rv = serial_recv(&pgm->fd, status, USBDEV_MAX_XFER_3); |
592 | 586 | 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", | |
594 | 588 | progname, rv); |
595 | 589 | return -1; |
596 | 590 | } |
597 | 591 | if (status[0] != CMSISDAP_CMD_DISCONNECT || |
598 | 592 | 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", | |
600 | 594 | progname, status[0], status[1]); |
601 | 595 | |
602 | 596 | return 0; |
@@ -624,11 +618,10 @@ | ||
624 | 618 | if (pgm->flag & PGM_FL_IS_EDBG) |
625 | 619 | return jtag3_edbg_recv_frame(pgm, msg); |
626 | 620 | |
627 | - if (verbose >= 4) | |
628 | - avrdude_message("%s: jtag3_recv():\n", progname); | |
621 | + avrdude_message(MSG_TRACE, "%s: jtag3_recv():\n", progname); | |
629 | 622 | |
630 | 623 | 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", | |
632 | 625 | progname); |
633 | 626 | return -1; |
634 | 627 | } |
@@ -639,8 +632,7 @@ | ||
639 | 632 | |
640 | 633 | if (rv < 0) { |
641 | 634 | /* 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", | |
644 | 636 | progname); |
645 | 637 | free(buf); |
646 | 638 | return -1; |
@@ -655,11 +647,10 @@ | ||
655 | 647 | int rv, len; |
656 | 648 | unsigned char *buf = NULL; |
657 | 649 | |
658 | - if (verbose >= 4) | |
659 | - avrdude_message("%s: jtag3_edbg_recv():\n", progname); | |
650 | + avrdude_message(MSG_TRACE, "%s: jtag3_edbg_recv():\n", progname); | |
660 | 651 | |
661 | 652 | 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", | |
663 | 654 | progname); |
664 | 655 | return -1; |
665 | 656 | } |
@@ -667,7 +658,7 @@ | ||
667 | 658 | buf[0] = EDBG_VENDOR_AVR_RSP; |
668 | 659 | |
669 | 660 | 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", | |
671 | 662 | progname); |
672 | 663 | return -1; |
673 | 664 | } |
@@ -676,8 +667,7 @@ | ||
676 | 667 | |
677 | 668 | if (rv < 0) { |
678 | 669 | /* 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", | |
681 | 671 | progname); |
682 | 672 | free(buf); |
683 | 673 | return -1; |
@@ -685,7 +675,7 @@ | ||
685 | 675 | |
686 | 676 | if (buf[0] != EDBG_VENDOR_AVR_RSP || |
687 | 677 | 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", | |
689 | 679 | progname, buf[0], buf[1]); |
690 | 680 | return -1; |
691 | 681 | } |
@@ -692,7 +682,7 @@ | ||
692 | 682 | /* calculate length from response; CMSIS-DAP response might be larger */ |
693 | 683 | len = (buf[2] << 8) | buf[3]; |
694 | 684 | 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", | |
696 | 686 | progname, len, rv + 4); |
697 | 687 | len = rv + 4; |
698 | 688 | } |
@@ -721,8 +711,7 @@ | ||
721 | 711 | |
722 | 712 | rv &= USB_RECV_LENGTH_MASK; |
723 | 713 | 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(): " | |
726 | 715 | "Got message seqno %d (command_sequence == %d)\n", |
727 | 716 | progname, r_seqno, PDATA(pgm)->command_sequence); |
728 | 717 | if (r_seqno == PDATA(pgm)->command_sequence) { |
@@ -738,8 +727,7 @@ | ||
738 | 727 | |
739 | 728 | return rv; |
740 | 729 | } |
741 | - if (verbose >= 2) | |
742 | - avrdude_message("%s: jtag3_recv(): " | |
730 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_recv(): " | |
743 | 731 | "got wrong sequence number, %u != %u\n", |
744 | 732 | progname, r_seqno, PDATA(pgm)->command_sequence); |
745 | 733 |
@@ -753,8 +741,7 @@ | ||
753 | 741 | int status; |
754 | 742 | unsigned char c; |
755 | 743 | |
756 | - if (verbose >= 2) | |
757 | - avrdude_message("%s: Sending %s command: ", | |
744 | + avrdude_message(MSG_NOTICE2, "%s: Sending %s command: ", | |
758 | 745 | progname, descr); |
759 | 746 | jtag3_send(pgm, cmd, cmdlen); |
760 | 747 |
@@ -762,18 +749,19 @@ | ||
762 | 749 | if (status <= 0) { |
763 | 750 | if (verbose >= 2) |
764 | 751 | 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", | |
766 | 753 | progname, descr, status); |
767 | 754 | return -1; |
768 | 755 | } else if (verbose >= 3) { |
769 | 756 | putc('\n', stderr); |
770 | 757 | 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 | + } | |
773 | 761 | |
774 | 762 | c = (*resp)[1]; |
775 | 763 | 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", | |
777 | 765 | progname, descr, c); |
778 | 766 | free(*resp); |
779 | 767 | resp = 0; |
@@ -788,8 +776,7 @@ | ||
788 | 776 | |
789 | 777 | unsigned char buf[3], *resp; |
790 | 778 | |
791 | - if (verbose >= 3) | |
792 | - avrdude_message("%s: jtag3_getsync()\n", progname); | |
779 | + avrdude_message(MSG_DEBUG, "%s: jtag3_getsync()\n", progname); | |
793 | 780 | |
794 | 781 | if (pgm->flag & PGM_FL_IS_EDBG) { |
795 | 782 | if (jtag3_edbg_prepare(pgm) < 0) |
@@ -835,7 +822,7 @@ | ||
835 | 822 | static int jtag3_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) |
836 | 823 | { |
837 | 824 | |
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", | |
839 | 826 | progname); |
840 | 827 | |
841 | 828 | return 0; |
@@ -865,8 +852,7 @@ | ||
865 | 852 | } |
866 | 853 | |
867 | 854 | /* 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", | |
870 | 856 | progname); |
871 | 857 | } |
872 | 858 |
@@ -939,10 +925,10 @@ | ||
939 | 925 | if (jtag3_getparm(pgm, SCOPE_GENERAL, 0, PARM3_FW_MAJOR, parm, 2) < 0) |
940 | 926 | return -1; |
941 | 927 | 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", | |
943 | 929 | progname, parm[0], parm[1]); |
944 | 930 | 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", | |
946 | 932 | progname); |
947 | 933 | } else { |
948 | 934 | return -1; |
@@ -964,7 +950,7 @@ | ||
964 | 950 | } |
965 | 951 | |
966 | 952 | 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", | |
968 | 954 | progname, p->desc, ifname); |
969 | 955 | return -1; |
970 | 956 | } |
@@ -997,8 +983,7 @@ | ||
997 | 983 | if (pgm->bitclock != 0.0 && PDATA(pgm)->set_sck != NULL) |
998 | 984 | { |
999 | 985 | 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(): " | |
1002 | 987 | "trying to set JTAG clock to %u kHz\n", |
1003 | 988 | progname, clock); |
1004 | 989 | parm[0] = clock & 0xff; |
@@ -1009,8 +994,7 @@ | ||
1009 | 994 | |
1010 | 995 | if (conn == PARM3_CONN_JTAG) |
1011 | 996 | { |
1012 | - if (verbose >= 2) | |
1013 | - avrdude_message("%s: jtag3_initialize(): " | |
997 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_initialize(): " | |
1014 | 998 | "trying to set JTAG daisy-chain info to %d,%d,%d,%d\n", |
1015 | 999 | progname, |
1016 | 1000 | PDATA(pgm)->jtagchain[0], PDATA(pgm)->jtagchain[1], |
@@ -1102,7 +1086,7 @@ | ||
1102 | 1086 | ocdrev = 4; |
1103 | 1087 | else |
1104 | 1088 | 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", | |
1106 | 1090 | progname, p->desc, ocdrev); |
1107 | 1091 | md.ocd_revision = ocdrev; |
1108 | 1092 | } else { |
@@ -1141,9 +1125,9 @@ | ||
1141 | 1125 | * (except ISP which is handled completely differently, but that |
1142 | 1126 | * doesn't apply here anyway), the response is just RSP_OK. |
1143 | 1127 | */ |
1144 | - if (resp[1] == RSP3_DATA && status >= 7 && verbose >= 1) | |
1128 | + if (resp[1] == RSP3_DATA && status >= 7) | |
1145 | 1129 | /* 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", | |
1147 | 1131 | progname, resp[3], resp[4], resp[5], resp[6]); |
1148 | 1132 | |
1149 | 1133 | free(resp); |
@@ -1157,7 +1141,7 @@ | ||
1157 | 1141 | AVRMEM *bootmem = avr_locate_mem(p, "boot"); |
1158 | 1142 | AVRMEM *flashmem = avr_locate_mem(p, "flash"); |
1159 | 1143 | 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", | |
1161 | 1145 | progname); |
1162 | 1146 | } else { |
1163 | 1147 | PDATA(pgm)->boot_start = bootmem->offset - flashmem->offset; |
@@ -1167,12 +1151,12 @@ | ||
1167 | 1151 | free(PDATA(pgm)->flash_pagecache); |
1168 | 1152 | free(PDATA(pgm)->eeprom_pagecache); |
1169 | 1153 | 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", | |
1171 | 1155 | progname); |
1172 | 1156 | return -1; |
1173 | 1157 | } |
1174 | 1158 | 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", | |
1176 | 1160 | progname); |
1177 | 1161 | free(PDATA(pgm)->flash_pagecache); |
1178 | 1162 | return -1; |
@@ -1216,17 +1200,15 @@ | ||
1216 | 1200 | unsigned int ub, ua, bb, ba; |
1217 | 1201 | if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba) |
1218 | 1202 | != 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", | |
1220 | 1204 | progname, extended_param); |
1221 | 1205 | rv = -1; |
1222 | 1206 | continue; |
1223 | 1207 | } |
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" | |
1226 | 1209 | "%s %u units before, %u units after, %u bits before, %u bits after\n", |
1227 | 1210 | progname, |
1228 | 1211 | progbuf, ub, ua, bb, ba); |
1229 | - } | |
1230 | 1212 | PDATA(pgm)->jtagchain[0] = ub; |
1231 | 1213 | PDATA(pgm)->jtagchain[1] = ua; |
1232 | 1214 | PDATA(pgm)->jtagchain[2] = bb; |
@@ -1235,7 +1217,7 @@ | ||
1235 | 1217 | continue; |
1236 | 1218 | } |
1237 | 1219 | |
1238 | - avrdude_message("%s: jtag3_parseextparms(): invalid extended parameter '%s'\n", | |
1220 | + avrdude_message(MSG_INFO, "%s: jtag3_parseextparms(): invalid extended parameter '%s'\n", | |
1239 | 1221 | progname, extended_param); |
1240 | 1222 | rv = -1; |
1241 | 1223 | } |
@@ -1250,12 +1232,12 @@ | ||
1250 | 1232 | int rv = -1; |
1251 | 1233 | |
1252 | 1234 | #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"); | |
1254 | 1236 | return -1; |
1255 | 1237 | #endif |
1256 | 1238 | |
1257 | 1239 | 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", | |
1259 | 1241 | progname); |
1260 | 1242 | return -1; |
1261 | 1243 | } |
@@ -1282,13 +1264,13 @@ | ||
1282 | 1264 | rv = serial_open(port, pinfo, &pgm->fd); |
1283 | 1265 | } |
1284 | 1266 | 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: ", | |
1286 | 1268 | progname, (unsigned)pinfo.usbinfo.vid); |
1287 | 1269 | int notfirst = 0; |
1288 | 1270 | for (usbpid = lfirst(pgm->usbpid); usbpid != NULL; usbpid = lnext(usbpid)) { |
1289 | 1271 | 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)))); | |
1292 | 1274 | notfirst = 1; |
1293 | 1275 | } |
1294 | 1276 | fputc('\n', stderr); |
@@ -1301,8 +1283,7 @@ | ||
1301 | 1283 | /* The event EP has been deleted by usb_open(), so we are |
1302 | 1284 | running on a CMSIS-DAP device, using EDBG protocol */ |
1303 | 1285 | 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", | |
1306 | 1287 | progname); |
1307 | 1288 | } |
1308 | 1289 |
@@ -1318,8 +1299,7 @@ | ||
1318 | 1299 | |
1319 | 1300 | static int jtag3_open(PROGRAMMER * pgm, char * port) |
1320 | 1301 | { |
1321 | - if (verbose >= 2) | |
1322 | - avrdude_message("%s: jtag3_open()\n", progname); | |
1302 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_open()\n", progname); | |
1323 | 1303 | |
1324 | 1304 | if (jtag3_open_common(pgm, port) < 0) |
1325 | 1305 | return -1; |
@@ -1332,8 +1312,7 @@ | ||
1332 | 1312 | |
1333 | 1313 | static int jtag3_open_dw(PROGRAMMER * pgm, char * port) |
1334 | 1314 | { |
1335 | - if (verbose >= 2) | |
1336 | - avrdude_message("%s: jtag3_open_dw()\n", progname); | |
1315 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_open_dw()\n", progname); | |
1337 | 1316 | |
1338 | 1317 | if (jtag3_open_common(pgm, port) < 0) |
1339 | 1318 | return -1; |
@@ -1346,8 +1325,7 @@ | ||
1346 | 1325 | |
1347 | 1326 | static int jtag3_open_pdi(PROGRAMMER * pgm, char * port) |
1348 | 1327 | { |
1349 | - if (verbose >= 2) | |
1350 | - avrdude_message("%s: jtag3_open_pdi()\n", progname); | |
1328 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_open_pdi()\n", progname); | |
1351 | 1329 | |
1352 | 1330 | if (jtag3_open_common(pgm, port) < 0) |
1353 | 1331 | return -1; |
@@ -1363,8 +1341,7 @@ | ||
1363 | 1341 | { |
1364 | 1342 | unsigned char buf[4], *resp; |
1365 | 1343 | |
1366 | - if (verbose >= 2) | |
1367 | - avrdude_message("%s: jtag3_close()\n", progname); | |
1344 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_close()\n", progname); | |
1368 | 1345 | |
1369 | 1346 | buf[0] = SCOPE_AVR; |
1370 | 1347 | buf[1] = CMD3_SIGN_OFF; |
@@ -1391,12 +1368,11 @@ | ||
1391 | 1368 | { |
1392 | 1369 | unsigned char cmd[8], *resp; |
1393 | 1370 | |
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", | |
1396 | 1372 | progname, m->desc, addr); |
1397 | 1373 | |
1398 | 1374 | 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", | |
1400 | 1376 | progname); |
1401 | 1377 | return -1; |
1402 | 1378 | } |
@@ -1443,8 +1419,7 @@ | ||
1443 | 1419 | int status, dynamic_memtype = 0; |
1444 | 1420 | long otimeout = serial_recv_timeout; |
1445 | 1421 | |
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", | |
1448 | 1423 | progname, m->desc, page_size, n_bytes); |
1449 | 1424 | |
1450 | 1425 | if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0) |
@@ -1453,7 +1428,7 @@ | ||
1453 | 1428 | if (page_size == 0) page_size = 256; |
1454 | 1429 | |
1455 | 1430 | 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", | |
1457 | 1432 | progname); |
1458 | 1433 | return -1; |
1459 | 1434 | } |
@@ -1500,8 +1475,7 @@ | ||
1500 | 1475 | block_size = maxaddr - addr; |
1501 | 1476 | else |
1502 | 1477 | block_size = page_size; |
1503 | - if (verbose >= 3) | |
1504 | - avrdude_message("%s: jtag3_paged_write(): " | |
1478 | + avrdude_message(MSG_DEBUG, "%s: jtag3_paged_write(): " | |
1505 | 1479 | "block_size at addr %d is %d\n", |
1506 | 1480 | progname, addr, block_size); |
1507 | 1481 |
@@ -1549,8 +1523,7 @@ | ||
1549 | 1523 | int status, dynamic_memtype = 0; |
1550 | 1524 | long otimeout = serial_recv_timeout; |
1551 | 1525 | |
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", | |
1554 | 1527 | progname, m->desc, page_size, n_bytes); |
1555 | 1528 | |
1556 | 1529 | if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0) |
@@ -1588,8 +1561,7 @@ | ||
1588 | 1561 | block_size = maxaddr - addr; |
1589 | 1562 | else |
1590 | 1563 | block_size = page_size; |
1591 | - if (verbose >= 3) | |
1592 | - avrdude_message("%s: jtag3_paged_load(): " | |
1564 | + avrdude_message(MSG_DEBUG, "%s: jtag3_paged_load(): " | |
1593 | 1565 | "block_size at addr %d is %d\n", |
1594 | 1566 | progname, addr, block_size); |
1595 | 1567 |
@@ -1604,7 +1576,7 @@ | ||
1604 | 1576 | |
1605 | 1577 | if (resp[1] != RSP3_DATA || |
1606 | 1578 | 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", | |
1608 | 1580 | progname); |
1609 | 1581 | serial_recv_timeout = otimeout; |
1610 | 1582 | free(resp); |
@@ -1627,8 +1599,7 @@ | ||
1627 | 1599 | unsigned long paddr = 0UL, *paddr_ptr = NULL; |
1628 | 1600 | unsigned int pagesize = 0; |
1629 | 1601 | |
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", | |
1632 | 1603 | progname, mem->desc, addr); |
1633 | 1604 | |
1634 | 1605 | if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0) |
@@ -1716,7 +1687,7 @@ | ||
1716 | 1687 | return 0; |
1717 | 1688 | } else { |
1718 | 1689 | /* 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); | |
1720 | 1691 | return -1; |
1721 | 1692 | } |
1722 | 1693 | } |
@@ -1757,7 +1728,7 @@ | ||
1757 | 1728 | |
1758 | 1729 | if (resp[1] != RSP3_DATA || |
1759 | 1730 | 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", | |
1761 | 1732 | progname); |
1762 | 1733 | free(resp); |
1763 | 1734 | return -1; |
@@ -1783,8 +1754,7 @@ | ||
1783 | 1754 | int status, unsupp = 0; |
1784 | 1755 | unsigned int pagesize = 0; |
1785 | 1756 | |
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", | |
1788 | 1758 | progname, mem->desc, addr); |
1789 | 1759 | |
1790 | 1760 | cmd[0] = SCOPE_AVR; |
@@ -1901,7 +1871,7 @@ | ||
1901 | 1871 | parm[1] = (clock >> 8) & 0xff; |
1902 | 1872 | |
1903 | 1873 | 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", | |
1905 | 1875 | progname); |
1906 | 1876 | return -1; |
1907 | 1877 | } |
@@ -1921,8 +1891,7 @@ | ||
1921 | 1891 | unsigned char buf[6], *resp, c; |
1922 | 1892 | char descr[60]; |
1923 | 1893 | |
1924 | - if (verbose >= 2) | |
1925 | - avrdude_message("%s: jtag3_getparm()\n", progname); | |
1894 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_getparm()\n", progname); | |
1926 | 1895 | |
1927 | 1896 | buf[0] = scope; |
1928 | 1897 | buf[1] = CMD3_GET_PARAMETER; |
@@ -1939,7 +1908,7 @@ | ||
1939 | 1908 | |
1940 | 1909 | c = resp[1]; |
1941 | 1910 | if (c != RSP3_DATA || status < 3) { |
1942 | - avrdude_message("%s: jtag3_getparm(): " | |
1911 | + avrdude_message(MSG_INFO, "%s: jtag3_getparm(): " | |
1943 | 1912 | "bad response to %s\n", |
1944 | 1913 | progname, descr); |
1945 | 1914 | free(resp); |
@@ -1964,8 +1933,7 @@ | ||
1964 | 1933 | unsigned char *buf, *resp; |
1965 | 1934 | char descr[60]; |
1966 | 1935 | |
1967 | - if (verbose >= 2) | |
1968 | - avrdude_message("%s: jtag3_setparm()\n", progname); | |
1936 | + avrdude_message(MSG_NOTICE2, "%s: jtag3_setparm()\n", progname); | |
1969 | 1937 | |
1970 | 1938 | sprintf(descr, "set parameter (scope 0x%02x, section %d, parm %d)", |
1971 | 1939 | scope, section, parm); |
@@ -1972,7 +1940,7 @@ | ||
1972 | 1940 | |
1973 | 1941 | if ((buf = malloc(6 + length)) == NULL) |
1974 | 1942 | { |
1975 | - avrdude_message("%s: jtag3_setparm(): Out of memory\n", | |
1943 | + avrdude_message(MSG_INFO, "%s: jtag3_setparm(): Out of memory\n", | |
1976 | 1944 | progname); |
1977 | 1945 | return -1; |
1978 | 1946 | } |
@@ -2021,7 +1989,7 @@ | ||
2021 | 1989 | |
2022 | 1990 | c = resp[1]; |
2023 | 1991 | 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", | |
2025 | 1993 | progname); |
2026 | 1994 | free(resp); |
2027 | 1995 | return; |
@@ -2029,11 +1997,11 @@ | ||
2029 | 1997 | memmove(resp, resp + 3, status - 3); |
2030 | 1998 | resp[status - 3] = 0; |
2031 | 1999 | |
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, | |
2034 | 2002 | parms[1], parms[2], |
2035 | 2003 | (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); | |
2037 | 2005 | free(resp); |
2038 | 2006 | |
2039 | 2007 | jtag3_print_parms1(pgm, p); |
@@ -2047,27 +2015,27 @@ | ||
2047 | 2015 | if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, buf, 2) < 0) |
2048 | 2016 | return; |
2049 | 2017 | |
2050 | - avrdude_message("%sVtarget : %.2f V\n", p, | |
2018 | + avrdude_message(MSG_INFO, "%sVtarget : %.2f V\n", p, | |
2051 | 2019 | b2_to_u16(buf) / 1000.0); |
2052 | 2020 | |
2053 | 2021 | if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, buf, 2) < 0) |
2054 | 2022 | 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, | |
2056 | 2024 | b2_to_u16(buf)); |
2057 | 2025 | |
2058 | 2026 | if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_DEBUG, buf, 2) < 0) |
2059 | 2027 | 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, | |
2061 | 2029 | b2_to_u16(buf)); |
2062 | 2030 | |
2063 | 2031 | if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_JTAG, buf, 2) < 0) |
2064 | 2032 | return; |
2065 | - avrdude_message("%sJTAG clock Xmega: %u kHz\n", p, | |
2033 | + avrdude_message(MSG_INFO, "%sJTAG clock Xmega: %u kHz\n", p, | |
2066 | 2034 | b2_to_u16(buf)); |
2067 | 2035 | |
2068 | 2036 | if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_PDI, buf, 2) < 0) |
2069 | 2037 | return; |
2070 | - avrdude_message("%sPDI clock Xmega : %u kHz\n", p, | |
2038 | + avrdude_message(MSG_INFO, "%sPDI clock Xmega : %u kHz\n", p, | |
2071 | 2039 | b2_to_u16(buf)); |
2072 | 2040 | } |
2073 | 2041 |
@@ -111,7 +111,7 @@ | ||
111 | 111 | static void jtagmkI_setup(PROGRAMMER * pgm) |
112 | 112 | { |
113 | 113 | 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", | |
115 | 115 | progname); |
116 | 116 | exit(1); |
117 | 117 | } |
@@ -144,10 +144,10 @@ | ||
144 | 144 | int i; |
145 | 145 | |
146 | 146 | if (verbose >= 4) { |
147 | - avrdude_message("Raw message:\n"); | |
147 | + avrdude_message(MSG_TRACE, "Raw message:\n"); | |
148 | 148 | |
149 | 149 | for (i = 0; i < len; i++) { |
150 | - avrdude_message("0x%02x ", data[i]); | |
150 | + avrdude_message(MSG_TRACE, "0x%02x ", data[i]); | |
151 | 151 | if (i % 16 == 15) |
152 | 152 | putc('\n', stderr); |
153 | 153 | else |
@@ -159,34 +159,34 @@ | ||
159 | 159 | |
160 | 160 | switch (data[0]) { |
161 | 161 | case RESP_OK: |
162 | - avrdude_message("OK\n"); | |
162 | + avrdude_message(MSG_INFO, "OK\n"); | |
163 | 163 | break; |
164 | 164 | |
165 | 165 | case RESP_FAILED: |
166 | - avrdude_message("FAILED\n"); | |
166 | + avrdude_message(MSG_INFO, "FAILED\n"); | |
167 | 167 | break; |
168 | 168 | |
169 | 169 | case RESP_BREAK: |
170 | - avrdude_message("breakpoint hit\n"); | |
170 | + avrdude_message(MSG_INFO, "breakpoint hit\n"); | |
171 | 171 | break; |
172 | 172 | |
173 | 173 | case RESP_INFO: |
174 | - avrdude_message("IDR dirty\n"); | |
174 | + avrdude_message(MSG_INFO, "IDR dirty\n"); | |
175 | 175 | break; |
176 | 176 | |
177 | 177 | case RESP_SYNC_ERROR: |
178 | - avrdude_message("Synchronization lost\n"); | |
178 | + avrdude_message(MSG_INFO, "Synchronization lost\n"); | |
179 | 179 | break; |
180 | 180 | |
181 | 181 | case RESP_SLEEP: |
182 | - avrdude_message("sleep instruction hit\n"); | |
182 | + avrdude_message(MSG_INFO, "sleep instruction hit\n"); | |
183 | 183 | break; |
184 | 184 | |
185 | 185 | case RESP_POWER: |
186 | - avrdude_message("target power lost\n"); | |
186 | + avrdude_message(MSG_INFO, "target power lost\n"); | |
187 | 187 | |
188 | 188 | default: |
189 | - avrdude_message("unknown message 0x%02x\n", data[0]); | |
189 | + avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[0]); | |
190 | 190 | } |
191 | 191 | |
192 | 192 | putc('\n', stderr); |
@@ -197,13 +197,12 @@ | ||
197 | 197 | { |
198 | 198 | unsigned char *buf; |
199 | 199 | |
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", | |
202 | 201 | progname, (unsigned int)len); |
203 | 202 | |
204 | 203 | if ((buf = malloc(len + 2)) == NULL) |
205 | 204 | { |
206 | - avrdude_message("%s: jtagmkI_send(): out of memory", | |
205 | + avrdude_message(MSG_INFO, "%s: jtagmkI_send(): out of memory", | |
207 | 206 | progname); |
208 | 207 | exit(1); |
209 | 208 | } |
@@ -213,7 +212,7 @@ | ||
213 | 212 | buf[len + 1] = ' '; /* EOP */ |
214 | 213 | |
215 | 214 | 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", | |
217 | 216 | progname); |
218 | 217 | return -1; |
219 | 218 | } |
@@ -226,7 +225,7 @@ | ||
226 | 225 | static int jtagmkI_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) |
227 | 226 | { |
228 | 227 | 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", | |
230 | 229 | progname); |
231 | 230 | return -1; |
232 | 231 | } |
@@ -252,8 +251,7 @@ | ||
252 | 251 | |
253 | 252 | serial_recv_timeout = 200; |
254 | 253 | |
255 | - if (verbose >= 3) | |
256 | - avrdude_message("%s: jtagmkI_resync()\n", progname); | |
254 | + avrdude_message(MSG_TRACE, "%s: jtagmkI_resync()\n", progname); | |
257 | 255 | |
258 | 256 | jtagmkI_drain(pgm, 0); |
259 | 257 |
@@ -261,19 +259,17 @@ | ||
261 | 259 | |
262 | 260 | /* Get the sign-on information. */ |
263 | 261 | 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: ", | |
266 | 263 | progname); |
267 | 264 | |
268 | 265 | 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", | |
270 | 267 | progname); |
271 | 268 | serial_recv_timeout = otimeout; |
272 | 269 | return -1; |
273 | 270 | } |
274 | 271 | 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"); | |
277 | 273 | break; |
278 | 274 | } |
279 | 275 |
@@ -292,26 +288,23 @@ | ||
292 | 288 | buf[1] = 'E'; |
293 | 289 | buf[2] = ' '; |
294 | 290 | 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: ", | |
297 | 292 | progname); |
298 | 293 | |
299 | 294 | 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", | |
301 | 296 | progname); |
302 | 297 | serial_recv_timeout = otimeout; |
303 | 298 | return -1; |
304 | 299 | } |
305 | 300 | 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"); | |
308 | 302 | break; |
309 | 303 | } |
310 | 304 | } |
311 | 305 | } |
312 | 306 | if (tries >= maxtries) { |
313 | - if (verbose >= 2) | |
314 | - avrdude_message("%s: jtagmkI_resync(): " | |
307 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_resync(): " | |
315 | 308 | "timeout/error communicating with programmer\n", |
316 | 309 | progname); |
317 | 310 | serial_recv_timeout = otimeout; |
@@ -333,8 +326,7 @@ | ||
333 | 326 | |
334 | 327 | jtagmkI_drain(pgm, 0); |
335 | 328 | |
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: ", | |
338 | 330 | progname); |
339 | 331 | |
340 | 332 | buf[0] = CMD_GET_SIGNON; |
@@ -343,7 +335,7 @@ | ||
343 | 335 | return -1; |
344 | 336 | if (verbose >= 2) { |
345 | 337 | resp[8] = '\0'; |
346 | - avrdude_message("got %s\n", resp + 1); | |
338 | + avrdude_message(MSG_NOTICE2, "got %s\n", resp + 1); | |
347 | 339 | } |
348 | 340 | |
349 | 341 | return 0; |
@@ -357,8 +349,7 @@ | ||
357 | 349 | unsigned char buf[1], resp[2]; |
358 | 350 | |
359 | 351 | 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: ", | |
362 | 353 | progname); |
363 | 354 | jtagmkI_send(pgm, buf, 1); |
364 | 355 | if (jtagmkI_recv(pgm, resp, 2) < 0) |
@@ -366,13 +357,13 @@ | ||
366 | 357 | if (resp[0] != RESP_OK) { |
367 | 358 | if (verbose >= 2) |
368 | 359 | putc('\n', stderr); |
369 | - avrdude_message("%s: jtagmkI_chip_erase(): " | |
360 | + avrdude_message(MSG_INFO, "%s: jtagmkI_chip_erase(): " | |
370 | 361 | "timeout/error communicating with programmer (resp %c)\n", |
371 | 362 | progname, resp[0]); |
372 | 363 | return -1; |
373 | 364 | } else { |
374 | 365 | if (verbose == 2) |
375 | - avrdude_message("OK\n"); | |
366 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
376 | 367 | } |
377 | 368 | |
378 | 369 | pgm->initialize(pgm, p); |
@@ -405,8 +396,7 @@ | ||
405 | 396 | } |
406 | 397 | } |
407 | 398 | |
408 | - if (verbose >= 2) | |
409 | - avrdude_message("%s: jtagmkI_set_devdescr(): " | |
399 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_set_devdescr(): " | |
410 | 400 | "Sending set device descriptor command: ", |
411 | 401 | progname); |
412 | 402 | jtagmkI_send(pgm, (unsigned char *)&sendbuf, sizeof(sendbuf)); |
@@ -416,12 +406,12 @@ | ||
416 | 406 | if (resp[0] != RESP_OK) { |
417 | 407 | if (verbose >= 2) |
418 | 408 | putc('\n', stderr); |
419 | - avrdude_message("%s: jtagmkI_set_devdescr(): " | |
409 | + avrdude_message(MSG_INFO, "%s: jtagmkI_set_devdescr(): " | |
420 | 410 | "timeout/error communicating with programmer (resp %c)\n", |
421 | 411 | progname, resp[0]); |
422 | 412 | } else { |
423 | 413 | if (verbose == 2) |
424 | - avrdude_message("OK\n"); | |
414 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
425 | 415 | } |
426 | 416 | } |
427 | 417 |
@@ -433,8 +423,7 @@ | ||
433 | 423 | unsigned char buf[1], resp[2]; |
434 | 424 | |
435 | 425 | 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: ", | |
438 | 427 | progname); |
439 | 428 | jtagmkI_send(pgm, buf, 1); |
440 | 429 |
@@ -443,13 +432,13 @@ | ||
443 | 432 | if (resp[0] != RESP_OK) { |
444 | 433 | if (verbose >= 2) |
445 | 434 | putc('\n', stderr); |
446 | - avrdude_message("%s: jtagmkI_reset(): " | |
435 | + avrdude_message(MSG_INFO, "%s: jtagmkI_reset(): " | |
447 | 436 | "timeout/error communicating with programmer (resp %c)\n", |
448 | 437 | progname, resp[0]); |
449 | 438 | return -1; |
450 | 439 | } else { |
451 | 440 | if (verbose == 2) |
452 | - avrdude_message("OK\n"); | |
441 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
453 | 442 | } |
454 | 443 | |
455 | 444 | return 0; |
@@ -469,8 +458,7 @@ | ||
469 | 458 | return 0; |
470 | 459 | |
471 | 460 | 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(): " | |
474 | 462 | "Sending enter progmode command: ", |
475 | 463 | progname); |
476 | 464 | jtagmkI_send(pgm, buf, 1); |
@@ -480,13 +468,13 @@ | ||
480 | 468 | if (resp[0] != RESP_OK) { |
481 | 469 | if (verbose >= 2) |
482 | 470 | putc('\n', stderr); |
483 | - avrdude_message("%s: jtagmkI_program_enable(): " | |
471 | + avrdude_message(MSG_INFO, "%s: jtagmkI_program_enable(): " | |
484 | 472 | "timeout/error communicating with programmer (resp %c)\n", |
485 | 473 | progname, resp[0]); |
486 | 474 | return -1; |
487 | 475 | } else { |
488 | 476 | if (verbose == 2) |
489 | - avrdude_message("OK\n"); | |
477 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
490 | 478 | } |
491 | 479 | |
492 | 480 | PDATA(pgm)->prog_enabled = 1; |
@@ -503,8 +491,7 @@ | ||
503 | 491 | |
504 | 492 | if (pgm->fd.ifd != -1) { |
505 | 493 | 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(): " | |
508 | 495 | "Sending leave progmode command: ", |
509 | 496 | progname); |
510 | 497 | jtagmkI_send(pgm, buf, 1); |
@@ -514,13 +501,13 @@ | ||
514 | 501 | if (resp[0] != RESP_OK) { |
515 | 502 | if (verbose >= 2) |
516 | 503 | putc('\n', stderr); |
517 | - avrdude_message("%s: jtagmkI_program_disable(): " | |
504 | + avrdude_message(MSG_INFO, "%s: jtagmkI_program_disable(): " | |
518 | 505 | "timeout/error communicating with programmer (resp %c)\n", |
519 | 506 | progname, resp[0]); |
520 | 507 | return -1; |
521 | 508 | } else { |
522 | 509 | if (verbose == 2) |
523 | - avrdude_message("OK\n"); | |
510 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
524 | 511 | } |
525 | 512 | } |
526 | 513 | PDATA(pgm)->prog_enabled = 0; |
@@ -549,7 +536,7 @@ | ||
549 | 536 | unsigned char b; |
550 | 537 | |
551 | 538 | 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", | |
553 | 540 | progname, p->desc); |
554 | 541 | return -1; |
555 | 542 | } |
@@ -558,11 +545,10 @@ | ||
558 | 545 | |
559 | 546 | if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) { |
560 | 547 | 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", | |
562 | 549 | progname, pgm->baudrate); |
563 | 550 | } else { |
564 | - if (verbose >= 2) | |
565 | - avrdude_message("%s: jtagmkI_initialize(): " | |
551 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_initialize(): " | |
566 | 552 | "trying to set baudrate to %d\n", |
567 | 553 | progname, pgm->baudrate); |
568 | 554 | if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) { |
@@ -573,8 +559,7 @@ | ||
573 | 559 | } |
574 | 560 | |
575 | 561 | if (pgm->bitclock != 0.0) { |
576 | - if (verbose >= 2) | |
577 | - avrdude_message("%s: jtagmkI_initialize(): " | |
562 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_initialize(): " | |
578 | 563 | "trying to set JTAG clock period to %.1f us\n", |
579 | 564 | progname, pgm->bitclock); |
580 | 565 | if (jtagmkI_set_sck_period(pgm, pgm->bitclock) != 0) |
@@ -588,12 +573,12 @@ | ||
588 | 573 | if (resp[0] != RESP_OK) { |
589 | 574 | if (verbose >= 2) |
590 | 575 | putc('\n', stderr); |
591 | - avrdude_message("%s: jtagmkI_initialize(): " | |
576 | + avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): " | |
592 | 577 | "timeout/error communicating with programmer (resp %c)\n", |
593 | 578 | progname, resp[0]); |
594 | 579 | } else { |
595 | 580 | if (verbose == 2) |
596 | - avrdude_message("OK\n"); | |
581 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
597 | 582 | } |
598 | 583 | |
599 | 584 | /* |
@@ -608,12 +593,12 @@ | ||
608 | 593 | free(PDATA(pgm)->flash_pagecache); |
609 | 594 | free(PDATA(pgm)->eeprom_pagecache); |
610 | 595 | 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", | |
612 | 597 | progname); |
613 | 598 | return -1; |
614 | 599 | } |
615 | 600 | 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", | |
617 | 602 | progname); |
618 | 603 | free(PDATA(pgm)->flash_pagecache); |
619 | 604 | return -1; |
@@ -627,7 +612,7 @@ | ||
627 | 612 | if (jtagmkI_read_byte(pgm, p, &hfuse, 1, &b) < 0) |
628 | 613 | return -1; |
629 | 614 | 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, " | |
631 | 616 | "single-byte EEPROM updates not possible\n", |
632 | 617 | progname); |
633 | 618 |
@@ -656,8 +641,7 @@ | ||
656 | 641 | { |
657 | 642 | size_t i; |
658 | 643 | |
659 | - if (verbose >= 2) | |
660 | - avrdude_message("%s: jtagmkI_open()\n", progname); | |
644 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_open()\n", progname); | |
661 | 645 | |
662 | 646 | strcpy(pgm->port, port); |
663 | 647 | PDATA(pgm)->initial_baudrate = -1L; |
@@ -665,8 +649,7 @@ | ||
665 | 649 | for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) { |
666 | 650 | union pinfo pinfo; |
667 | 651 | 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", | |
670 | 653 | progname, pinfo.baud); |
671 | 654 | if (serial_open(port, pinfo, &pgm->fd)==-1) { |
672 | 655 | return -1; |
@@ -679,8 +662,7 @@ | ||
679 | 662 | |
680 | 663 | if (jtagmkI_getsync(pgm) == 0) { |
681 | 664 | 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); | |
684 | 666 | return 0; |
685 | 667 | } |
686 | 668 |
@@ -687,7 +669,7 @@ | ||
687 | 669 | serial_close(&pgm->fd); |
688 | 670 | } |
689 | 671 | |
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", | |
691 | 673 | progname); |
692 | 674 | pgm->fd.ifd = -1; |
693 | 675 |
@@ -699,8 +681,7 @@ | ||
699 | 681 | { |
700 | 682 | unsigned char b; |
701 | 683 | |
702 | - if (verbose >= 2) | |
703 | - avrdude_message("%s: jtagmkI_close()\n", progname); | |
684 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_close()\n", progname); | |
704 | 685 | |
705 | 686 | /* |
706 | 687 | * Revert baud rate to what it used to be when we started. This |
@@ -709,11 +690,10 @@ | ||
709 | 690 | */ |
710 | 691 | if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) { |
711 | 692 | 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", | |
713 | 694 | progname, PDATA(pgm)->initial_baudrate); |
714 | 695 | } else { |
715 | - if (verbose >= 2) | |
716 | - avrdude_message("%s: jtagmkI_close(): " | |
696 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_close(): " | |
717 | 697 | "trying to set baudrate to %d\n", |
718 | 698 | progname, PDATA(pgm)->initial_baudrate); |
719 | 699 | if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) { |
@@ -742,8 +722,7 @@ | ||
742 | 722 | long otimeout = serial_recv_timeout; |
743 | 723 | #define MAXTRIES 3 |
744 | 724 | |
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", | |
747 | 726 | progname, m->desc, page_size, n_bytes); |
748 | 727 | |
749 | 728 | if (jtagmkI_program_enable(pgm) < 0) |
@@ -752,13 +731,13 @@ | ||
752 | 731 | if (page_size == 0) page_size = 256; |
753 | 732 | |
754 | 733 | 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", | |
756 | 735 | progname, page_size); |
757 | 736 | return -1; |
758 | 737 | } |
759 | 738 | |
760 | 739 | 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", | |
762 | 741 | progname); |
763 | 742 | return -1; |
764 | 743 | } |
@@ -782,7 +761,7 @@ | ||
782 | 761 | again: |
783 | 762 | |
784 | 763 | 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", | |
786 | 765 | progname); |
787 | 766 | return -1; |
788 | 767 | } |
@@ -791,8 +770,7 @@ | ||
791 | 770 | block_size = n_bytes - addr; |
792 | 771 | else |
793 | 772 | block_size = page_size; |
794 | - if (verbose >= 3) | |
795 | - avrdude_message("%s: jtagmkI_paged_write(): " | |
773 | + avrdude_message(MSG_DEBUG, "%s: jtagmkI_paged_write(): " | |
796 | 774 | "block_size at addr %d is %d\n", |
797 | 775 | progname, addr, block_size); |
798 | 776 |
@@ -806,8 +784,7 @@ | ||
806 | 784 | u32_to_b3(cmd + 3, addr); |
807 | 785 | } |
808 | 786 | |
809 | - if (verbose >= 2) | |
810 | - avrdude_message("%s: jtagmkI_paged_write(): " | |
787 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_paged_write(): " | |
811 | 788 | "Sending write memory command: ", |
812 | 789 | progname); |
813 | 790 |
@@ -818,7 +795,7 @@ | ||
818 | 795 | if (resp[0] != RESP_OK) { |
819 | 796 | if (verbose >= 2) |
820 | 797 | putc('\n', stderr); |
821 | - avrdude_message("%s: jtagmkI_paged_write(): " | |
798 | + avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): " | |
822 | 799 | "timeout/error communicating with programmer (resp %c)\n", |
823 | 800 | progname, resp[0]); |
824 | 801 | if (tries++ < MAXTRIES) |
@@ -827,7 +804,7 @@ | ||
827 | 804 | return -1; |
828 | 805 | } else { |
829 | 806 | if (verbose == 2) |
830 | - avrdude_message("OK\n"); | |
807 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
831 | 808 | } |
832 | 809 | |
833 | 810 | /* |
@@ -847,7 +824,7 @@ | ||
847 | 824 | if (resp[1] != RESP_OK) { |
848 | 825 | if (verbose >= 2) |
849 | 826 | putc('\n', stderr); |
850 | - avrdude_message("%s: jtagmkI_paged_write(): " | |
827 | + avrdude_message(MSG_INFO, "%s: jtagmkI_paged_write(): " | |
851 | 828 | "timeout/error communicating with programmer (resp %c)\n", |
852 | 829 | progname, resp[0]); |
853 | 830 | if (tries++ < MAXTRIES) |
@@ -856,7 +833,7 @@ | ||
856 | 833 | return -1; |
857 | 834 | } else { |
858 | 835 | if (verbose == 2) |
859 | - avrdude_message("OK\n"); | |
836 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
860 | 837 | } |
861 | 838 | } |
862 | 839 |
@@ -877,8 +854,7 @@ | ||
877 | 854 | long otimeout = serial_recv_timeout; |
878 | 855 | #define MAXTRIES 3 |
879 | 856 | |
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", | |
882 | 858 | progname, m->desc, page_size, n_bytes); |
883 | 859 | |
884 | 860 | if (jtagmkI_program_enable(pgm) < 0) |
@@ -895,7 +871,7 @@ | ||
895 | 871 | } |
896 | 872 | |
897 | 873 | 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", | |
899 | 875 | progname, page_size); |
900 | 876 | return -1; |
901 | 877 | } |
@@ -905,7 +881,7 @@ | ||
905 | 881 | tries = 0; |
906 | 882 | again: |
907 | 883 | 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", | |
909 | 885 | progname); |
910 | 886 | return -1; |
911 | 887 | } |
@@ -914,8 +890,7 @@ | ||
914 | 890 | block_size = n_bytes - addr; |
915 | 891 | else |
916 | 892 | block_size = page_size; |
917 | - if (verbose >= 3) | |
918 | - avrdude_message("%s: jtagmkI_paged_load(): " | |
893 | + avrdude_message(MSG_DEBUG, "%s: jtagmkI_paged_load(): " | |
919 | 894 | "block_size at addr %d is %d\n", |
920 | 895 | progname, addr, block_size); |
921 | 896 |
@@ -929,8 +904,7 @@ | ||
929 | 904 | u32_to_b3(cmd + 3, addr); |
930 | 905 | } |
931 | 906 | |
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: ", | |
934 | 908 | progname); |
935 | 909 | |
936 | 910 | jtagmkI_send(pgm, cmd, 6); |
@@ -940,7 +914,7 @@ | ||
940 | 914 | if (resp[read_size + 3 - 1] != RESP_OK) { |
941 | 915 | if (verbose >= 2) |
942 | 916 | putc('\n', stderr); |
943 | - avrdude_message("%s: jtagmkI_paged_load(): " | |
917 | + avrdude_message(MSG_INFO, "%s: jtagmkI_paged_load(): " | |
944 | 918 | "timeout/error communicating with programmer (resp %c)\n", |
945 | 919 | progname, resp[read_size + 3 - 1]); |
946 | 920 | if (tries++ < MAXTRIES) |
@@ -950,7 +924,7 @@ | ||
950 | 924 | return -1; |
951 | 925 | } else { |
952 | 926 | if (verbose == 2) |
953 | - avrdude_message("OK\n"); | |
927 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
954 | 928 | } |
955 | 929 | |
956 | 930 | memcpy(m->buf + addr, resp + 1, block_size); |
@@ -971,8 +945,7 @@ | ||
971 | 945 | int respsize = 3 + 1; |
972 | 946 | int is_flash = 0; |
973 | 947 | |
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", | |
976 | 949 | progname, mem->desc, addr); |
977 | 950 | |
978 | 951 | if (jtagmkI_program_enable(pgm) < 0) |
@@ -1056,13 +1029,13 @@ | ||
1056 | 1029 | if (resp[respsize - 1] != RESP_OK) { |
1057 | 1030 | if (verbose >= 2) |
1058 | 1031 | putc('\n', stderr); |
1059 | - avrdude_message("%s: jtagmkI_read_byte(): " | |
1032 | + avrdude_message(MSG_INFO, "%s: jtagmkI_read_byte(): " | |
1060 | 1033 | "timeout/error communicating with programmer (resp %c)\n", |
1061 | 1034 | progname, resp[respsize - 1]); |
1062 | 1035 | return -1; |
1063 | 1036 | } else { |
1064 | 1037 | if (verbose == 2) |
1065 | - avrdude_message("OK\n"); | |
1038 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
1066 | 1039 | } |
1067 | 1040 | |
1068 | 1041 | if (pagesize) { |
@@ -1085,8 +1058,7 @@ | ||
1085 | 1058 | unsigned char resp[1], writedata; |
1086 | 1059 | int len, need_progmode = 1; |
1087 | 1060 | |
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", | |
1090 | 1062 | progname, mem->desc, addr); |
1091 | 1063 | |
1092 | 1064 | writedata = data; |
@@ -1141,13 +1113,13 @@ | ||
1141 | 1113 | if (resp[0] != RESP_OK) { |
1142 | 1114 | if (verbose >= 2) |
1143 | 1115 | putc('\n', stderr); |
1144 | - avrdude_message("%s: jtagmkI_write_byte(): " | |
1116 | + avrdude_message(MSG_INFO, "%s: jtagmkI_write_byte(): " | |
1145 | 1117 | "timeout/error communicating with programmer (resp %c)\n", |
1146 | 1118 | progname, resp[0]); |
1147 | 1119 | return -1; |
1148 | 1120 | } else { |
1149 | 1121 | if (verbose == 2) |
1150 | - avrdude_message("OK\n"); | |
1122 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
1151 | 1123 | } |
1152 | 1124 | |
1153 | 1125 | /* Now, send the data buffer. */ |
@@ -1171,13 +1143,13 @@ | ||
1171 | 1143 | if (resp[0] != RESP_OK) { |
1172 | 1144 | if (verbose >= 2) |
1173 | 1145 | putc('\n', stderr); |
1174 | - avrdude_message("%s: jtagmkI_write_byte(): " | |
1146 | + avrdude_message(MSG_INFO, "%s: jtagmkI_write_byte(): " | |
1175 | 1147 | "timeout/error communicating with programmer (resp %c)\n", |
1176 | 1148 | progname, resp[0]); |
1177 | 1149 | return -1; |
1178 | 1150 | } else { |
1179 | 1151 | if (verbose == 2) |
1180 | - avrdude_message("OK\n"); | |
1152 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
1181 | 1153 | } |
1182 | 1154 | |
1183 | 1155 | return 0; |
@@ -1221,13 +1193,12 @@ | ||
1221 | 1193 | { |
1222 | 1194 | unsigned char buf[2], resp[3]; |
1223 | 1195 | |
1224 | - if (verbose >= 2) | |
1225 | - avrdude_message("%s: jtagmkI_getparm()\n", progname); | |
1196 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_getparm()\n", progname); | |
1226 | 1197 | |
1227 | 1198 | buf[0] = CMD_GET_PARAM; |
1228 | 1199 | buf[1] = parm; |
1229 | 1200 | if (verbose >= 2) |
1230 | - avrdude_message("%s: jtagmkI_getparm(): " | |
1201 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_getparm(): " | |
1231 | 1202 | "Sending get parameter command (parm 0x%02x): ", |
1232 | 1203 | progname, parm); |
1233 | 1204 | jtagmkI_send(pgm, buf, 2); |
@@ -1237,7 +1208,7 @@ | ||
1237 | 1208 | if (resp[0] != RESP_OK) { |
1238 | 1209 | if (verbose >= 2) |
1239 | 1210 | putc('\n', stderr); |
1240 | - avrdude_message("%s: jtagmkI_getparm(): " | |
1211 | + avrdude_message(MSG_INFO, "%s: jtagmkI_getparm(): " | |
1241 | 1212 | "timeout/error communicating with programmer (resp %c)\n", |
1242 | 1213 | progname, resp[0]); |
1243 | 1214 | return -1; |
@@ -1244,13 +1215,13 @@ | ||
1244 | 1215 | } else if (resp[2] != RESP_OK) { |
1245 | 1216 | if (verbose >= 2) |
1246 | 1217 | putc('\n', stderr); |
1247 | - avrdude_message("%s: jtagmkI_getparm(): " | |
1218 | + avrdude_message(MSG_INFO, "%s: jtagmkI_getparm(): " | |
1248 | 1219 | "unknown parameter 0x%02x\n", |
1249 | 1220 | progname, parm); |
1250 | 1221 | return -1; |
1251 | 1222 | } else { |
1252 | 1223 | 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]); | |
1254 | 1225 | } |
1255 | 1226 | |
1256 | 1227 | *value = resp[1]; |
@@ -1266,14 +1237,12 @@ | ||
1266 | 1237 | { |
1267 | 1238 | unsigned char buf[3], resp[2]; |
1268 | 1239 | |
1269 | - if (verbose >= 2) | |
1270 | - avrdude_message("%s: jtagmkI_setparm()\n", progname); | |
1240 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_setparm()\n", progname); | |
1271 | 1241 | |
1272 | 1242 | buf[0] = CMD_SET_PARAM; |
1273 | 1243 | buf[1] = parm; |
1274 | 1244 | buf[2] = value; |
1275 | - if (verbose >= 2) | |
1276 | - avrdude_message("%s: jtagmkI_setparm(): " | |
1245 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkI_setparm(): " | |
1277 | 1246 | "Sending set parameter command (parm 0x%02x): ", |
1278 | 1247 | progname, parm); |
1279 | 1248 | jtagmkI_send(pgm, buf, 3); |
@@ -1282,13 +1251,13 @@ | ||
1282 | 1251 | if (resp[0] != RESP_OK) { |
1283 | 1252 | if (verbose >= 2) |
1284 | 1253 | putc('\n', stderr); |
1285 | - avrdude_message("%s: jtagmkI_setparm(): " | |
1254 | + avrdude_message(MSG_INFO, "%s: jtagmkI_setparm(): " | |
1286 | 1255 | "timeout/error communicating with programmer (resp %c)\n", |
1287 | 1256 | progname, resp[0]); |
1288 | 1257 | return -1; |
1289 | 1258 | } else { |
1290 | 1259 | if (verbose == 2) |
1291 | - avrdude_message("OK\n"); | |
1260 | + avrdude_message(MSG_NOTICE2, "OK\n"); | |
1292 | 1261 | } |
1293 | 1262 | |
1294 | 1263 | return 0; |
@@ -1304,8 +1273,8 @@ | ||
1304 | 1273 | jtagmkI_getparm(pgm, PARM_SW_VERSION, &fw) < 0) |
1305 | 1274 | return; |
1306 | 1275 | |
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); | |
1309 | 1278 | |
1310 | 1279 | jtagmkI_print_parms1(pgm, p); |
1311 | 1280 |
@@ -1349,9 +1318,9 @@ | ||
1349 | 1318 | clk = 1e6; |
1350 | 1319 | } |
1351 | 1320 | |
1352 | - avrdude_message("%sVtarget : %.1f V\n", p, | |
1321 | + avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, | |
1353 | 1322 | 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, | |
1355 | 1324 | 1.0e6 / clk); |
1356 | 1325 | |
1357 | 1326 | return; |
@@ -176,7 +176,7 @@ | ||
176 | 176 | void jtagmkII_setup(PROGRAMMER * pgm) |
177 | 177 | { |
178 | 178 | 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", | |
180 | 180 | progname); |
181 | 181 | exit(1); |
182 | 182 | } |
@@ -269,7 +269,7 @@ | ||
269 | 269 | return; |
270 | 270 | |
271 | 271 | 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]); | |
273 | 273 | if (i % 16 == 15) |
274 | 274 | putc('\n', stderr); |
275 | 275 | else |
@@ -284,10 +284,10 @@ | ||
284 | 284 | int i; |
285 | 285 | |
286 | 286 | if (verbose >= 4) { |
287 | - avrdude_message("Raw message:\n"); | |
287 | + avrdude_message(MSG_TRACE, "Raw message:\n"); | |
288 | 288 | |
289 | 289 | for (i = 0; i < len; i++) { |
290 | - avrdude_message("0x%02x", data[i]); | |
290 | + avrdude_message(MSG_TRACE, "0x%02x", data[i]); | |
291 | 291 | if (i % 16 == 15) |
292 | 292 | putc('\n', stderr); |
293 | 293 | else |
@@ -299,114 +299,114 @@ | ||
299 | 299 | |
300 | 300 | switch (data[0]) { |
301 | 301 | case RSP_OK: |
302 | - avrdude_message("OK\n"); | |
302 | + avrdude_message(MSG_INFO, "OK\n"); | |
303 | 303 | break; |
304 | 304 | |
305 | 305 | case RSP_FAILED: |
306 | - avrdude_message("FAILED\n"); | |
306 | + avrdude_message(MSG_INFO, "FAILED\n"); | |
307 | 307 | break; |
308 | 308 | |
309 | 309 | case RSP_ILLEGAL_BREAKPOINT: |
310 | - avrdude_message("Illegal breakpoint\n"); | |
310 | + avrdude_message(MSG_INFO, "Illegal breakpoint\n"); | |
311 | 311 | break; |
312 | 312 | |
313 | 313 | case RSP_ILLEGAL_COMMAND: |
314 | - avrdude_message("Illegal command\n"); | |
314 | + avrdude_message(MSG_INFO, "Illegal command\n"); | |
315 | 315 | break; |
316 | 316 | |
317 | 317 | case RSP_ILLEGAL_EMULATOR_MODE: |
318 | - avrdude_message("Illegal emulator mode"); | |
318 | + avrdude_message(MSG_INFO, "Illegal emulator mode"); | |
319 | 319 | if (len > 1) |
320 | 320 | 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; | |
326 | 326 | } |
327 | 327 | putc('\n', stderr); |
328 | 328 | break; |
329 | 329 | |
330 | 330 | case RSP_ILLEGAL_JTAG_ID: |
331 | - avrdude_message("Illegal JTAG ID\n"); | |
331 | + avrdude_message(MSG_INFO, "Illegal JTAG ID\n"); | |
332 | 332 | break; |
333 | 333 | |
334 | 334 | case RSP_ILLEGAL_MCU_STATE: |
335 | - avrdude_message("Illegal MCU state"); | |
335 | + avrdude_message(MSG_INFO, "Illegal MCU state"); | |
336 | 336 | if (len > 1) |
337 | 337 | 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; | |
341 | 341 | } |
342 | 342 | putc('\n', stderr); |
343 | 343 | break; |
344 | 344 | |
345 | 345 | case RSP_ILLEGAL_MEMORY_TYPE: |
346 | - avrdude_message("Illegal memory type\n"); | |
346 | + avrdude_message(MSG_INFO, "Illegal memory type\n"); | |
347 | 347 | break; |
348 | 348 | |
349 | 349 | case RSP_ILLEGAL_MEMORY_RANGE: |
350 | - avrdude_message("Illegal memory range\n"); | |
350 | + avrdude_message(MSG_INFO, "Illegal memory range\n"); | |
351 | 351 | break; |
352 | 352 | |
353 | 353 | case RSP_ILLEGAL_PARAMETER: |
354 | - avrdude_message("Illegal parameter\n"); | |
354 | + avrdude_message(MSG_INFO, "Illegal parameter\n"); | |
355 | 355 | break; |
356 | 356 | |
357 | 357 | case RSP_ILLEGAL_POWER_STATE: |
358 | - avrdude_message("Illegal power state\n"); | |
358 | + avrdude_message(MSG_INFO, "Illegal power state\n"); | |
359 | 359 | break; |
360 | 360 | |
361 | 361 | case RSP_ILLEGAL_VALUE: |
362 | - avrdude_message("Illegal value\n"); | |
362 | + avrdude_message(MSG_INFO, "Illegal value\n"); | |
363 | 363 | break; |
364 | 364 | |
365 | 365 | case RSP_NO_TARGET_POWER: |
366 | - avrdude_message("No target power\n"); | |
366 | + avrdude_message(MSG_INFO, "No target power\n"); | |
367 | 367 | break; |
368 | 368 | |
369 | 369 | case RSP_SIGN_ON: |
370 | - avrdude_message("Sign-on succeeded\n"); | |
370 | + avrdude_message(MSG_INFO, "Sign-on succeeded\n"); | |
371 | 371 | /* Sign-on data will be printed below anyway. */ |
372 | 372 | break; |
373 | 373 | |
374 | 374 | case RSP_MEMORY: |
375 | - avrdude_message("memory contents:\n"); | |
375 | + avrdude_message(MSG_INFO, "memory contents:\n"); | |
376 | 376 | jtagmkII_print_memory(data, len); |
377 | 377 | break; |
378 | 378 | |
379 | 379 | case RSP_PARAMETER: |
380 | - avrdude_message("parameter values:\n"); | |
380 | + avrdude_message(MSG_INFO, "parameter values:\n"); | |
381 | 381 | jtagmkII_print_memory(data, len); |
382 | 382 | break; |
383 | 383 | |
384 | 384 | case RSP_SPI_DATA: |
385 | - avrdude_message("SPI data returned:\n"); | |
385 | + avrdude_message(MSG_INFO, "SPI data returned:\n"); | |
386 | 386 | for (i = 1; i < len; i++) |
387 | - avrdude_message("0x%02x ", data[i]); | |
387 | + avrdude_message(MSG_INFO, "0x%02x ", data[i]); | |
388 | 388 | putc('\n', stderr); |
389 | 389 | break; |
390 | 390 | |
391 | 391 | case EVT_BREAK: |
392 | - avrdude_message("BREAK event"); | |
392 | + avrdude_message(MSG_INFO, "BREAK event"); | |
393 | 393 | 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)); | |
395 | 395 | switch (data[5]) { |
396 | 396 | case 0x00: |
397 | - avrdude_message("unspecified"); | |
397 | + avrdude_message(MSG_INFO, "unspecified"); | |
398 | 398 | break; |
399 | 399 | case 0x01: |
400 | - avrdude_message("program break"); | |
400 | + avrdude_message(MSG_INFO, "program break"); | |
401 | 401 | break; |
402 | 402 | case 0x02: |
403 | - avrdude_message("data break PDSB"); | |
403 | + avrdude_message(MSG_INFO, "data break PDSB"); | |
404 | 404 | break; |
405 | 405 | case 0x03: |
406 | - avrdude_message("data break PDMSB"); | |
406 | + avrdude_message(MSG_INFO, "data break PDMSB"); | |
407 | 407 | break; |
408 | 408 | default: |
409 | - avrdude_message("unknown: 0x%02x", data[5]); | |
409 | + avrdude_message(MSG_INFO, "unknown: 0x%02x", data[5]); | |
410 | 410 | } |
411 | 411 | } |
412 | 412 | putc('\n', stderr); |
@@ -413,7 +413,7 @@ | ||
413 | 413 | break; |
414 | 414 | |
415 | 415 | default: |
416 | - avrdude_message("unknown message 0x%02x\n", data[0]); | |
416 | + avrdude_message(MSG_INFO, "unknown message 0x%02x\n", data[0]); | |
417 | 417 | } |
418 | 418 | |
419 | 419 | putc('\n', stderr); |
@@ -424,13 +424,12 @@ | ||
424 | 424 | { |
425 | 425 | unsigned char *buf; |
426 | 426 | |
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", | |
429 | 428 | progname, (unsigned long)len); |
430 | 429 | |
431 | 430 | if ((buf = malloc(len + 10)) == NULL) |
432 | 431 | { |
433 | - avrdude_message("%s: jtagmkII_send(): out of memory", | |
432 | + avrdude_message(MSG_INFO, "%s: jtagmkII_send(): out of memory", | |
434 | 433 | progname); |
435 | 434 | return -1; |
436 | 435 | } |
@@ -444,7 +443,7 @@ | ||
444 | 443 | crcappend(buf, len + 8); |
445 | 444 | |
446 | 445 | 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", | |
448 | 447 | progname); |
449 | 448 | return -1; |
450 | 449 | } |
@@ -494,8 +493,7 @@ | ||
494 | 493 | double timeoutval = 100; /* seconds */ |
495 | 494 | double tstart, tnow; |
496 | 495 | |
497 | - if (verbose >= 4) | |
498 | - avrdude_message("%s: jtagmkII_recv():\n", progname); | |
496 | + avrdude_message(MSG_TRACE, "%s: jtagmkII_recv():\n", progname); | |
499 | 497 | |
500 | 498 | gettimeofday(&tv, NULL); |
501 | 499 | tstart = tv.tv_sec; |
@@ -513,8 +511,7 @@ | ||
513 | 511 | if (rv != 0) { |
514 | 512 | timedout: |
515 | 513 | /* 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", | |
518 | 515 | progname); |
519 | 516 | free(buf); |
520 | 517 | return -1; |
@@ -554,13 +551,13 @@ | ||
554 | 551 | if (c == TOKEN) { |
555 | 552 | state = sDATA; |
556 | 553 | 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 " | |
558 | 555 | "size %u, ignoring message\n", |
559 | 556 | progname, msglen, MAX_MESSAGE); |
560 | 557 | state = sSTART; |
561 | 558 | headeridx = 0; |
562 | 559 | } 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", | |
564 | 561 | progname); |
565 | 562 | ignorpkt++; |
566 | 563 | } else { |
@@ -582,11 +579,11 @@ | ||
582 | 579 | if (state == sCSUM2) { |
583 | 580 | if (crcverify(buf, msglen + 10)) { |
584 | 581 | if (verbose >= 9) |
585 | - avrdude_message("%s: jtagmkII_recv(): CRC OK", | |
582 | + avrdude_message(MSG_TRACE2, "%s: jtagmkII_recv(): CRC OK", | |
586 | 583 | progname); |
587 | 584 | state = sDONE; |
588 | 585 | } else { |
589 | - avrdude_message("%s: jtagmkII_recv(): checksum error\n", | |
586 | + avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): checksum error\n", | |
590 | 587 | progname); |
591 | 588 | free(buf); |
592 | 589 | return -4; |
@@ -595,7 +592,7 @@ | ||
595 | 592 | state++; |
596 | 593 | break; |
597 | 594 | default: |
598 | - avrdude_message("%s: jtagmkII_recv(): unknown state\n", | |
595 | + avrdude_message(MSG_INFO, "%s: jtagmkII_recv(): unknown state\n", | |
599 | 596 | progname); |
600 | 597 | free(buf); |
601 | 598 | return -5; |
@@ -604,14 +601,13 @@ | ||
604 | 601 | gettimeofday(&tv, NULL); |
605 | 602 | tnow = tv.tv_sec; |
606 | 603 | if (tnow - tstart > timeoutval) { |
607 | - avrdude_message("%s: jtagmkII_recv_frame(): timeout\n", | |
604 | + avrdude_message(MSG_INFO, "%s: jtagmkII_recv_frame(): timeout\n", | |
608 | 605 | progname); |
609 | 606 | return -1; |
610 | 607 | } |
611 | 608 | |
612 | 609 | } |
613 | - if (verbose >= 3) | |
614 | - avrdude_message("\n"); | |
610 | + avrdude_message(MSG_DEBUG, "\n"); | |
615 | 611 | |
616 | 612 | *seqno = r_seqno; |
617 | 613 | *msg = buf; |
@@ -626,8 +622,7 @@ | ||
626 | 622 | for (;;) { |
627 | 623 | if ((rv = jtagmkII_recv_frame(pgm, msg, &r_seqno)) <= 0) |
628 | 624 | return rv; |
629 | - if (verbose >= 3) | |
630 | - avrdude_message("%s: jtagmkII_recv(): " | |
625 | + avrdude_message(MSG_DEBUG, "%s: jtagmkII_recv(): " | |
631 | 626 | "Got message seqno %d (command_sequence == %d)\n", |
632 | 627 | progname, r_seqno, PDATA(pgm)->command_sequence); |
633 | 628 | if (r_seqno == PDATA(pgm)->command_sequence) { |
@@ -644,32 +639,30 @@ | ||
644 | 639 | { |
645 | 640 | int i = rv; |
646 | 641 | unsigned char *p = *msg; |
647 | - avrdude_message("%s: Recv: ", progname); | |
642 | + avrdude_message(MSG_TRACE, "%s: Recv: ", progname); | |
648 | 643 | |
649 | 644 | while (i) { |
650 | 645 | unsigned char c = *p; |
651 | 646 | if (isprint(c)) { |
652 | - avrdude_message("%c ", c); | |
647 | + avrdude_message(MSG_TRACE, "%c ", c); | |
653 | 648 | } |
654 | 649 | else { |
655 | - avrdude_message(". "); | |
650 | + avrdude_message(MSG_TRACE, ". "); | |
656 | 651 | } |
657 | - avrdude_message("[%02x] ", c); | |
652 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
658 | 653 | |
659 | 654 | p++; |
660 | 655 | i--; |
661 | 656 | } |
662 | - avrdude_message("\n"); | |
657 | + avrdude_message(MSG_TRACE, "\n"); | |
663 | 658 | } |
664 | 659 | return rv; |
665 | 660 | } |
666 | 661 | 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", | |
669 | 663 | progname); |
670 | 664 | } else { |
671 | - if (verbose >= 2) | |
672 | - avrdude_message("%s: jtagmkII_recv(): " | |
665 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_recv(): " | |
673 | 666 | "got wrong sequence number, %u != %u\n", |
674 | 667 | progname, r_seqno, PDATA(pgm)->command_sequence); |
675 | 668 | } |
@@ -686,8 +679,7 @@ | ||
686 | 679 | unsigned int fwver, hwver; |
687 | 680 | int is_dragon; |
688 | 681 | |
689 | - if (verbose >= 3) | |
690 | - avrdude_message("%s: jtagmkII_getsync()\n", progname); | |
682 | + avrdude_message(MSG_DEBUG, "%s: jtagmkII_getsync()\n", progname); | |
691 | 683 | |
692 | 684 | if (strncmp(pgm->type, "JTAG", strlen("JTAG")) == 0) { |
693 | 685 | is_dragon = 0; |
@@ -694,7 +686,7 @@ | ||
694 | 686 | } else if (strncmp(pgm->type, "DRAGON", strlen("DRAGON")) == 0) { |
695 | 687 | is_dragon = 1; |
696 | 688 | } 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", | |
698 | 690 | progname); |
699 | 691 | return -1; |
700 | 692 | } |
@@ -702,14 +694,13 @@ | ||
702 | 694 | |
703 | 695 | /* Get the sign-on information. */ |
704 | 696 | 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: ", | |
707 | 698 | progname); |
708 | 699 | jtagmkII_send(pgm, buf, 1); |
709 | 700 | |
710 | 701 | status = jtagmkII_recv(pgm, &resp); |
711 | 702 | if (status <= 0) { |
712 | - avrdude_message("%s: jtagmkII_getsync(): sign-on command: " | |
703 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): sign-on command: " | |
713 | 704 | "status %d\n", |
714 | 705 | progname, status); |
715 | 706 | } else if (verbose >= 3) { |
@@ -716,7 +707,7 @@ | ||
716 | 707 | putc('\n', stderr); |
717 | 708 | jtagmkII_prmsg(pgm, resp, status); |
718 | 709 | } 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); | |
720 | 711 | |
721 | 712 | if (status > 0) { |
722 | 713 | if ((c = resp[0]) == RSP_SIGN_ON) { |
@@ -724,29 +715,29 @@ | ||
724 | 715 | PDATA(pgm)->fwver = fwver; |
725 | 716 | hwver = (unsigned)resp[9]; |
726 | 717 | 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", | |
730 | 721 | (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", | |
733 | 724 | (unsigned)resp[2]); |
734 | - avrdude_message(" firmware version: %u.%02u\n", | |
725 | + avrdude_message(MSG_NOTICE, " firmware version: %u.%02u\n", | |
735 | 726 | (unsigned)resp[4], (unsigned)resp[3]); |
736 | - avrdude_message(" hardware version: %u\n", | |
727 | + avrdude_message(MSG_NOTICE, " hardware version: %u\n", | |
737 | 728 | (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", | |
740 | 731 | (unsigned)resp[6]); |
741 | - avrdude_message(" firmware version: %u.%02u\n", | |
732 | + avrdude_message(MSG_NOTICE, " firmware version: %u.%02u\n", | |
742 | 733 | (unsigned)resp[8], (unsigned)resp[7]); |
743 | - avrdude_message(" hardware version: %u\n", | |
734 | + avrdude_message(MSG_NOTICE, " hardware version: %u\n", | |
744 | 735 | (unsigned)resp[9]); |
745 | - avrdude_message("Serial number: " | |
736 | + avrdude_message(MSG_NOTICE, "Serial number: " | |
746 | 737 | "%02x:%02x:%02x:%02x:%02x:%02x\n", |
747 | 738 | PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]); |
748 | 739 | resp[status - 1] = '\0'; |
749 | - avrdude_message("Device ID: %s\n", | |
740 | + avrdude_message(MSG_NOTICE, "Device ID: %s\n", | |
750 | 741 | resp + 16); |
751 | 742 | } |
752 | 743 | break; |
@@ -756,11 +747,11 @@ | ||
756 | 747 | } |
757 | 748 | if (tries >= MAXTRIES) { |
758 | 749 | if (status <= 0) |
759 | - avrdude_message("%s: jtagmkII_getsync(): " | |
750 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
760 | 751 | "timeout/error communicating with programmer (status %d)\n", |
761 | 752 | progname, status); |
762 | 753 | else |
763 | - avrdude_message("%s: jtagmkII_getsync(): " | |
754 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
764 | 755 | "bad response to sign-on command: %s\n", |
765 | 756 | progname, jtagmkII_get_rc(c)); |
766 | 757 | return -1; |
@@ -775,19 +766,19 @@ | ||
775 | 766 | #define FWVER(maj, min) ((maj << 8) | (min)) |
776 | 767 | if (!is_dragon && fwver < FWVER(3, 16)) { |
777 | 768 | PDATA(pgm)->device_descriptor_length -= 2; |
778 | - avrdude_message("%s: jtagmkII_getsync(): " | |
769 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
779 | 770 | "S_MCU firmware version might be too old to work correctly\n", |
780 | 771 | progname); |
781 | 772 | } else if (!is_dragon && fwver < FWVER(4, 0)) { |
782 | 773 | PDATA(pgm)->device_descriptor_length -= 2; |
783 | 774 | } |
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", | |
786 | 777 | progname, (unsigned)PDATA(pgm)->device_descriptor_length); |
787 | 778 | if (mode == EMULATOR_MODE_SPI) { |
788 | 779 | PDATA(pgm)->device_descriptor_length = 0; |
789 | 780 | 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 " | |
791 | 782 | "version >= 4.14\n", |
792 | 783 | progname); |
793 | 784 | return -1; |
@@ -795,19 +786,19 @@ | ||
795 | 786 | } |
796 | 787 | if (mode == EMULATOR_MODE_PDI || mode == EMULATOR_MODE_JTAG_XMEGA) { |
797 | 788 | 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 " | |
799 | 790 | "revision >= 1\n", |
800 | 791 | progname); |
801 | 792 | return -1; |
802 | 793 | } |
803 | 794 | 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 " | |
805 | 796 | "version >= 5.37\n", |
806 | 797 | progname); |
807 | 798 | return -1; |
808 | 799 | } |
809 | 800 | 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 " | |
811 | 802 | "version >= 6.11\n", |
812 | 803 | progname); |
813 | 804 | return -1; |
@@ -823,7 +814,7 @@ | ||
823 | 814 | buf[0] = mode; |
824 | 815 | if (jtagmkII_setparm(pgm, PAR_EMULATOR_MODE, buf) < 0) { |
825 | 816 | if (mode == EMULATOR_MODE_SPI) { |
826 | - avrdude_message("%s: jtagmkII_getsync(): " | |
817 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
827 | 818 | "ISP activation failed, trying debugWire\n", |
828 | 819 | progname); |
829 | 820 | buf[0] = EMULATOR_MODE_DEBUGWIRE; |
@@ -843,11 +834,11 @@ | ||
843 | 834 | */ |
844 | 835 | (void)jtagmkII_reset(pgm, 0x04); |
845 | 836 | 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", | |
847 | 838 | progname); |
848 | 839 | return -1; |
849 | 840 | } |
850 | - avrdude_message("%s: Target prepared for ISP, signed off.\n" | |
841 | + avrdude_message(MSG_INFO, "%s: Target prepared for ISP, signed off.\n" | |
851 | 842 | "%s: Now retrying without power-cycling the target.\n", |
852 | 843 | progname, progname); |
853 | 844 | goto retry; |
@@ -859,8 +850,7 @@ | ||
859 | 850 | |
860 | 851 | /* GET SYNC forces the target into STOPPED mode */ |
861 | 852 | 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: ", | |
864 | 854 | progname); |
865 | 855 | jtagmkII_send(pgm, buf, 1); |
866 | 856 |
@@ -868,7 +858,7 @@ | ||
868 | 858 | if (status <= 0) { |
869 | 859 | if (verbose >= 2) |
870 | 860 | putc('\n', stderr); |
871 | - avrdude_message("%s: jtagmkII_getsync(): " | |
861 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
872 | 862 | "timeout/error communicating with programmer (status %d)\n", |
873 | 863 | progname, status); |
874 | 864 | return -1; |
@@ -877,11 +867,11 @@ | ||
877 | 867 | putc('\n', stderr); |
878 | 868 | jtagmkII_prmsg(pgm, resp, status); |
879 | 869 | } 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); | |
881 | 871 | c = resp[0]; |
882 | 872 | free(resp); |
883 | 873 | if (c != RSP_OK) { |
884 | - avrdude_message("%s: jtagmkII_getsync(): " | |
874 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): " | |
885 | 875 | "bad response to set parameter command: %s\n", |
886 | 876 | progname, jtagmkII_get_rc(c)); |
887 | 877 | return -1; |
@@ -907,8 +897,7 @@ | ||
907 | 897 | buf[0] = CMND_CHIP_ERASE; |
908 | 898 | len = 1; |
909 | 899 | } |
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: ", | |
912 | 901 | progname, |
913 | 902 | (p->flags & AVRPART_HAS_PDI)? "Xmega ": ""); |
914 | 903 | jtagmkII_send(pgm, buf, len); |
@@ -917,7 +906,7 @@ | ||
917 | 906 | if (status <= 0) { |
918 | 907 | if (verbose >= 2) |
919 | 908 | putc('\n', stderr); |
920 | - avrdude_message("%s: jtagmkII_chip_erase(): " | |
909 | + avrdude_message(MSG_INFO, "%s: jtagmkII_chip_erase(): " | |
921 | 910 | "timeout/error communicating with programmer (status %d)\n", |
922 | 911 | progname, status); |
923 | 912 | return -1; |
@@ -926,11 +915,11 @@ | ||
926 | 915 | putc('\n', stderr); |
927 | 916 | jtagmkII_prmsg(pgm, resp, status); |
928 | 917 | } 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); | |
930 | 919 | c = resp[0]; |
931 | 920 | free(resp); |
932 | 921 | if (c != RSP_OK) { |
933 | - avrdude_message("%s: jtagmkII_chip_erase(): " | |
922 | + avrdude_message(MSG_INFO, "%s: jtagmkII_chip_erase(): " | |
934 | 923 | "bad response to chip erase command: %s\n", |
935 | 924 | progname, jtagmkII_get_rc(c)); |
936 | 925 | return -1; |
@@ -948,7 +937,7 @@ | ||
948 | 937 | static int jtagmkII_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) |
949 | 938 | { |
950 | 939 | |
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", | |
952 | 941 | progname); |
953 | 942 | |
954 | 943 | return 0; |
@@ -996,8 +985,7 @@ | ||
996 | 985 | sendbuf.dd.ucCacheType = |
997 | 986 | (p->flags & AVRPART_HAS_PDI)? 0x02 /* ATxmega */: 0x00; |
998 | 987 | |
999 | - if (verbose >= 2) | |
1000 | - avrdude_message("%s: jtagmkII_set_devdescr(): " | |
988 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_devdescr(): " | |
1001 | 989 | "Sending set device descriptor command: ", |
1002 | 990 | progname); |
1003 | 991 | jtagmkII_send(pgm, (unsigned char *)&sendbuf, |
@@ -1007,7 +995,7 @@ | ||
1007 | 995 | if (status <= 0) { |
1008 | 996 | if (verbose >= 2) |
1009 | 997 | putc('\n', stderr); |
1010 | - avrdude_message("%s: jtagmkII_set_devdescr(): " | |
998 | + avrdude_message(MSG_INFO, "%s: jtagmkII_set_devdescr(): " | |
1011 | 999 | "timeout/error communicating with programmer (status %d)\n", |
1012 | 1000 | progname, status); |
1013 | 1001 | return; |
@@ -1016,11 +1004,11 @@ | ||
1016 | 1004 | putc('\n', stderr); |
1017 | 1005 | jtagmkII_prmsg(pgm, resp, status); |
1018 | 1006 | } 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); | |
1020 | 1008 | c = resp[0]; |
1021 | 1009 | free(resp); |
1022 | 1010 | if (c != RSP_OK) { |
1023 | - avrdude_message("%s: jtagmkII_set_devdescr(): " | |
1011 | + avrdude_message(MSG_INFO, "%s: jtagmkII_set_devdescr(): " | |
1024 | 1012 | "bad response to set device descriptor command: %s\n", |
1025 | 1013 | progname, jtagmkII_get_rc(c)); |
1026 | 1014 | } |
@@ -1075,8 +1063,7 @@ | ||
1075 | 1063 | } |
1076 | 1064 | } |
1077 | 1065 | |
1078 | - if (verbose >= 2) | |
1079 | - avrdude_message("%s: jtagmkII_set_xmega_params(): " | |
1066 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_xmega_params(): " | |
1080 | 1067 | "Sending set Xmega params command: ", |
1081 | 1068 | progname); |
1082 | 1069 | jtagmkII_send(pgm, (unsigned char *)&sendbuf, sizeof sendbuf); |
@@ -1085,7 +1072,7 @@ | ||
1085 | 1072 | if (status <= 0) { |
1086 | 1073 | if (verbose >= 2) |
1087 | 1074 | putc('\n', stderr); |
1088 | - avrdude_message("%s: jtagmkII_set_xmega_params(): " | |
1075 | + avrdude_message(MSG_INFO, "%s: jtagmkII_set_xmega_params(): " | |
1089 | 1076 | "timeout/error communicating with programmer (status %d)\n", |
1090 | 1077 | progname, status); |
1091 | 1078 | return; |
@@ -1094,11 +1081,11 @@ | ||
1094 | 1081 | putc('\n', stderr); |
1095 | 1082 | jtagmkII_prmsg(pgm, resp, status); |
1096 | 1083 | } 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); | |
1098 | 1085 | c = resp[0]; |
1099 | 1086 | free(resp); |
1100 | 1087 | if (c != RSP_OK) { |
1101 | - avrdude_message("%s: jtagmkII_set_xmega_params(): " | |
1088 | + avrdude_message(MSG_INFO, "%s: jtagmkII_set_xmega_params(): " | |
1102 | 1089 | "bad response to set device descriptor command: %s\n", |
1103 | 1090 | progname, jtagmkII_get_rc(c)); |
1104 | 1091 | } |
@@ -1124,8 +1111,7 @@ | ||
1124 | 1111 | |
1125 | 1112 | buf[0] = (pgm->flag & PGM_FL_IS_DW)? CMND_FORCED_STOP: CMND_RESET; |
1126 | 1113 | 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: ", | |
1129 | 1115 | progname, (pgm->flag & PGM_FL_IS_DW)? "stop": "reset"); |
1130 | 1116 | jtagmkII_send(pgm, buf, 2); |
1131 | 1117 |
@@ -1133,7 +1119,7 @@ | ||
1133 | 1119 | if (status <= 0) { |
1134 | 1120 | if (verbose >= 2) |
1135 | 1121 | putc('\n', stderr); |
1136 | - avrdude_message("%s: jtagmkII_reset(): " | |
1122 | + avrdude_message(MSG_INFO, "%s: jtagmkII_reset(): " | |
1137 | 1123 | "timeout/error communicating with programmer (status %d)\n", |
1138 | 1124 | progname, status); |
1139 | 1125 | return -1; |
@@ -1142,11 +1128,11 @@ | ||
1142 | 1128 | putc('\n', stderr); |
1143 | 1129 | jtagmkII_prmsg(pgm, resp, status); |
1144 | 1130 | } 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); | |
1146 | 1132 | c = resp[0]; |
1147 | 1133 | free(resp); |
1148 | 1134 | if (c != RSP_OK) { |
1149 | - avrdude_message("%s: jtagmkII_reset(): " | |
1135 | + avrdude_message(MSG_INFO, "%s: jtagmkII_reset(): " | |
1150 | 1136 | "bad response to reset command: %s\n", |
1151 | 1137 | progname, jtagmkII_get_rc(c)); |
1152 | 1138 | return -1; |
@@ -1155,7 +1141,7 @@ | ||
1155 | 1141 | return 0; |
1156 | 1142 | } |
1157 | 1143 | |
1158 | -static int jtagmkII_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p) | |
1144 | +static int jtagmkII_program_enable_INFO(PROGRAMMER * pgm, AVRPART * p) | |
1159 | 1145 | { |
1160 | 1146 | return 0; |
1161 | 1147 | } |
@@ -1171,8 +1157,7 @@ | ||
1171 | 1157 | |
1172 | 1158 | for (use_ext_reset = 0; use_ext_reset <= 1; use_ext_reset++) { |
1173 | 1159 | 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(): " | |
1176 | 1161 | "Sending enter progmode command: ", |
1177 | 1162 | progname); |
1178 | 1163 | jtagmkII_send(pgm, buf, 1); |
@@ -1181,7 +1166,7 @@ | ||
1181 | 1166 | if (status <= 0) { |
1182 | 1167 | if (verbose >= 2) |
1183 | 1168 | putc('\n', stderr); |
1184 | - avrdude_message("%s: jtagmkII_program_enable(): " | |
1169 | + avrdude_message(MSG_INFO, "%s: jtagmkII_program_enable(): " | |
1185 | 1170 | "timeout/error communicating with programmer (status %d)\n", |
1186 | 1171 | progname, status); |
1187 | 1172 | return -1; |
@@ -1190,18 +1175,17 @@ | ||
1190 | 1175 | putc('\n', stderr); |
1191 | 1176 | jtagmkII_prmsg(pgm, resp, status); |
1192 | 1177 | } 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); | |
1194 | 1179 | c = resp[0]; |
1195 | 1180 | free(resp); |
1196 | 1181 | if (c != RSP_OK) { |
1197 | - avrdude_message("%s: jtagmkII_program_enable(): " | |
1182 | + avrdude_message(MSG_INFO, "%s: jtagmkII_program_enable(): " | |
1198 | 1183 | "bad response to enter progmode command: %s\n", |
1199 | 1184 | progname, jtagmkII_get_rc(c)); |
1200 | 1185 | if (c == RSP_ILLEGAL_JTAG_ID) { |
1201 | 1186 | if (use_ext_reset == 0) { |
1202 | 1187 | 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", | |
1205 | 1189 | progname); |
1206 | 1190 | |
1207 | 1191 | (void)jtagmkII_setparm(pgm, PAR_EXTERNAL_RESET, parm); |
@@ -1208,7 +1192,7 @@ | ||
1208 | 1192 | continue; |
1209 | 1193 | } |
1210 | 1194 | |
1211 | - avrdude_message("%s: JTAGEN fuse disabled?\n", progname); | |
1195 | + avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname); | |
1212 | 1196 | return -1; |
1213 | 1197 | } |
1214 | 1198 | } |
@@ -1227,8 +1211,7 @@ | ||
1227 | 1211 | return 0; |
1228 | 1212 | |
1229 | 1213 | 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(): " | |
1232 | 1215 | "Sending leave progmode command: ", |
1233 | 1216 | progname); |
1234 | 1217 | jtagmkII_send(pgm, buf, 1); |
@@ -1237,7 +1220,7 @@ | ||
1237 | 1220 | if (status <= 0) { |
1238 | 1221 | if (verbose >= 2) |
1239 | 1222 | putc('\n', stderr); |
1240 | - avrdude_message("%s: jtagmkII_program_disable(): " | |
1223 | + avrdude_message(MSG_INFO, "%s: jtagmkII_program_disable(): " | |
1241 | 1224 | "timeout/error communicating with programmer (status %d)\n", |
1242 | 1225 | progname, status); |
1243 | 1226 | return -1; |
@@ -1246,11 +1229,11 @@ | ||
1246 | 1229 | putc('\n', stderr); |
1247 | 1230 | jtagmkII_prmsg(pgm, resp, status); |
1248 | 1231 | } 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); | |
1250 | 1233 | c = resp[0]; |
1251 | 1234 | free(resp); |
1252 | 1235 | if (c != RSP_OK) { |
1253 | - avrdude_message("%s: jtagmkII_program_disable(): " | |
1236 | + avrdude_message(MSG_INFO, "%s: jtagmkII_program_disable(): " | |
1254 | 1237 | "bad response to leave progmode command: %s\n", |
1255 | 1238 | progname, jtagmkII_get_rc(c)); |
1256 | 1239 | return -1; |
@@ -1312,7 +1295,7 @@ | ||
1312 | 1295 | } |
1313 | 1296 | |
1314 | 1297 | 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", | |
1316 | 1299 | progname, p->desc, ifname); |
1317 | 1300 | return -1; |
1318 | 1301 | } |
@@ -1319,11 +1302,10 @@ | ||
1319 | 1302 | |
1320 | 1303 | if ((serdev->flags & SERDEV_FL_CANSETSPEED) && pgm->baudrate && pgm->baudrate != 19200) { |
1321 | 1304 | 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", | |
1323 | 1306 | progname, pgm->baudrate); |
1324 | 1307 | } else { |
1325 | - if (verbose >= 2) | |
1326 | - avrdude_message("%s: jtagmkII_initialize(): " | |
1308 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_initialize(): " | |
1327 | 1309 | "trying to set baudrate to %d\n", |
1328 | 1310 | progname, pgm->baudrate); |
1329 | 1311 | if (jtagmkII_setparm(pgm, PAR_BAUD_RATE, &b) == 0) |
@@ -1331,8 +1313,7 @@ | ||
1331 | 1313 | } |
1332 | 1314 | } |
1333 | 1315 | 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(): " | |
1336 | 1317 | "trying to set JTAG clock period to %.1f us\n", |
1337 | 1318 | progname, pgm->bitclock); |
1338 | 1319 | if (jtagmkII_set_sck_period(pgm, pgm->bitclock) != 0) |
@@ -1341,7 +1322,7 @@ | ||
1341 | 1322 | |
1342 | 1323 | if ((pgm->flag & PGM_FL_IS_JTAG) && |
1343 | 1324 | 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", | |
1345 | 1326 | progname); |
1346 | 1327 | return -1; |
1347 | 1328 | } |
@@ -1377,7 +1358,7 @@ | ||
1377 | 1358 | AVRMEM *bootmem = avr_locate_mem(p, "boot"); |
1378 | 1359 | AVRMEM *flashmem = avr_locate_mem(p, "flash"); |
1379 | 1360 | 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", | |
1381 | 1362 | progname); |
1382 | 1363 | } else { |
1383 | 1364 | if (PDATA(pgm)->fwver < 0x700) { |
@@ -1397,12 +1378,12 @@ | ||
1397 | 1378 | free(PDATA(pgm)->flash_pagecache); |
1398 | 1379 | free(PDATA(pgm)->eeprom_pagecache); |
1399 | 1380 | 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", | |
1401 | 1382 | progname); |
1402 | 1383 | return -1; |
1403 | 1384 | } |
1404 | 1385 | 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", | |
1406 | 1387 | progname); |
1407 | 1388 | free(PDATA(pgm)->flash_pagecache); |
1408 | 1389 | return -1; |
@@ -1431,7 +1412,7 @@ | ||
1431 | 1412 | if (jtagmkII_read_byte(pgm, p, &hfuse, 1, &b) < 0) |
1432 | 1413 | return -1; |
1433 | 1414 | 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, " | |
1435 | 1416 | "single-byte EEPROM updates not possible\n", |
1436 | 1417 | progname); |
1437 | 1418 | } |
@@ -1473,17 +1454,15 @@ | ||
1473 | 1454 | unsigned int ub, ua, bb, ba; |
1474 | 1455 | if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba) |
1475 | 1456 | != 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", | |
1477 | 1458 | progname, extended_param); |
1478 | 1459 | rv = -1; |
1479 | 1460 | continue; |
1480 | 1461 | } |
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" | |
1483 | 1463 | "%s %u units before, %u units after, %u bits before, %u bits after\n", |
1484 | 1464 | progname, |
1485 | 1465 | progbuf, ub, ua, bb, ba); |
1486 | - } | |
1487 | 1466 | PDATA(pgm)->jtagchain[0] = ub; |
1488 | 1467 | PDATA(pgm)->jtagchain[1] = ua; |
1489 | 1468 | PDATA(pgm)->jtagchain[2] = bb; |
@@ -1492,7 +1471,7 @@ | ||
1492 | 1471 | continue; |
1493 | 1472 | } |
1494 | 1473 | |
1495 | - avrdude_message("%s: jtagmkII_parseextparms(): invalid extended parameter '%s'\n", | |
1474 | + avrdude_message(MSG_INFO, "%s: jtagmkII_parseextparms(): invalid extended parameter '%s'\n", | |
1496 | 1475 | progname, extended_param); |
1497 | 1476 | rv = -1; |
1498 | 1477 | } |
@@ -1505,8 +1484,7 @@ | ||
1505 | 1484 | { |
1506 | 1485 | union pinfo pinfo; |
1507 | 1486 | |
1508 | - if (verbose >= 2) | |
1509 | - avrdude_message("%s: jtagmkII_open()\n", progname); | |
1487 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open()\n", progname); | |
1510 | 1488 | |
1511 | 1489 | /* |
1512 | 1490 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1533,7 +1511,7 @@ | ||
1533 | 1511 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1534 | 1512 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1535 | 1513 | #else |
1536 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1514 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1537 | 1515 | return -1; |
1538 | 1516 | #endif |
1539 | 1517 | } |
@@ -1558,8 +1536,7 @@ | ||
1558 | 1536 | { |
1559 | 1537 | union pinfo pinfo; |
1560 | 1538 | |
1561 | - if (verbose >= 2) | |
1562 | - avrdude_message("%s: jtagmkII_open_dw()\n", progname); | |
1539 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_dw()\n", progname); | |
1563 | 1540 | |
1564 | 1541 | /* |
1565 | 1542 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1586,7 +1563,7 @@ | ||
1586 | 1563 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1587 | 1564 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1588 | 1565 | #else |
1589 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1566 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1590 | 1567 | return -1; |
1591 | 1568 | #endif |
1592 | 1569 | } |
@@ -1611,8 +1588,7 @@ | ||
1611 | 1588 | { |
1612 | 1589 | union pinfo pinfo; |
1613 | 1590 | |
1614 | - if (verbose >= 2) | |
1615 | - avrdude_message("%s: jtagmkII_open_pdi()\n", progname); | |
1591 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_pdi()\n", progname); | |
1616 | 1592 | |
1617 | 1593 | /* |
1618 | 1594 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1639,7 +1615,7 @@ | ||
1639 | 1615 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1640 | 1616 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1641 | 1617 | #else |
1642 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1618 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1643 | 1619 | return -1; |
1644 | 1620 | #endif |
1645 | 1621 | } |
@@ -1665,8 +1641,7 @@ | ||
1665 | 1641 | { |
1666 | 1642 | union pinfo pinfo; |
1667 | 1643 | |
1668 | - if (verbose >= 2) | |
1669 | - avrdude_message("%s: jtagmkII_dragon_open()\n", progname); | |
1644 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open()\n", progname); | |
1670 | 1645 | |
1671 | 1646 | /* |
1672 | 1647 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1693,7 +1668,7 @@ | ||
1693 | 1668 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1694 | 1669 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1695 | 1670 | #else |
1696 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1671 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1697 | 1672 | return -1; |
1698 | 1673 | #endif |
1699 | 1674 | } |
@@ -1719,8 +1694,7 @@ | ||
1719 | 1694 | { |
1720 | 1695 | union pinfo pinfo; |
1721 | 1696 | |
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); | |
1724 | 1698 | |
1725 | 1699 | /* |
1726 | 1700 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1747,7 +1721,7 @@ | ||
1747 | 1721 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1748 | 1722 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1749 | 1723 | #else |
1750 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1724 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1751 | 1725 | return -1; |
1752 | 1726 | #endif |
1753 | 1727 | } |
@@ -1773,8 +1747,7 @@ | ||
1773 | 1747 | { |
1774 | 1748 | union pinfo pinfo; |
1775 | 1749 | |
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); | |
1778 | 1751 | |
1779 | 1752 | /* |
1780 | 1753 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -1801,7 +1774,7 @@ | ||
1801 | 1774 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1802 | 1775 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1803 | 1776 | #else |
1804 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1777 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1805 | 1778 | return -1; |
1806 | 1779 | #endif |
1807 | 1780 | } |
@@ -1828,14 +1801,12 @@ | ||
1828 | 1801 | int status; |
1829 | 1802 | unsigned char buf[1], *resp, c; |
1830 | 1803 | |
1831 | - if (verbose >= 2) | |
1832 | - avrdude_message("%s: jtagmkII_close()\n", progname); | |
1804 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close()\n", progname); | |
1833 | 1805 | |
1834 | 1806 | if (pgm->flag & PGM_FL_IS_PDI) { |
1835 | 1807 | /* When in PDI mode, restart target. */ |
1836 | 1808 | 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: ", | |
1839 | 1810 | progname); |
1840 | 1811 | jtagmkII_send(pgm, buf, 1); |
1841 | 1812 |
@@ -1843,7 +1814,7 @@ | ||
1843 | 1814 | if (status <= 0) { |
1844 | 1815 | if (verbose >= 2) |
1845 | 1816 | putc('\n', stderr); |
1846 | - avrdude_message("%s: jtagmkII_close(): " | |
1817 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
1847 | 1818 | "timeout/error communicating with programmer (status %d)\n", |
1848 | 1819 | progname, status); |
1849 | 1820 | } else { |
@@ -1851,11 +1822,11 @@ | ||
1851 | 1822 | putc('\n', stderr); |
1852 | 1823 | jtagmkII_prmsg(pgm, resp, status); |
1853 | 1824 | } 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); | |
1855 | 1826 | c = resp[0]; |
1856 | 1827 | free(resp); |
1857 | 1828 | if (c != RSP_OK) { |
1858 | - avrdude_message("%s: jtagmkII_close(): " | |
1829 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
1859 | 1830 | "bad response to GO command: %s\n", |
1860 | 1831 | progname, jtagmkII_get_rc(c)); |
1861 | 1832 | } |
@@ -1863,8 +1834,7 @@ | ||
1863 | 1834 | } |
1864 | 1835 | |
1865 | 1836 | 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: ", | |
1868 | 1838 | progname); |
1869 | 1839 | jtagmkII_send(pgm, buf, 1); |
1870 | 1840 |
@@ -1872,7 +1842,7 @@ | ||
1872 | 1842 | if (status <= 0) { |
1873 | 1843 | if (verbose >= 2) |
1874 | 1844 | putc('\n', stderr); |
1875 | - avrdude_message("%s: jtagmkII_close(): " | |
1845 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
1876 | 1846 | "timeout/error communicating with programmer (status %d)\n", |
1877 | 1847 | progname, status); |
1878 | 1848 | return; |
@@ -1881,11 +1851,11 @@ | ||
1881 | 1851 | putc('\n', stderr); |
1882 | 1852 | jtagmkII_prmsg(pgm, resp, status); |
1883 | 1853 | } 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); | |
1885 | 1855 | c = resp[0]; |
1886 | 1856 | free(resp); |
1887 | 1857 | if (c != RSP_OK) { |
1888 | - avrdude_message("%s: jtagmkII_close(): " | |
1858 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
1889 | 1859 | "bad response to sign-off command: %s\n", |
1890 | 1860 | progname, jtagmkII_get_rc(c)); |
1891 | 1861 | } |
@@ -1902,17 +1872,16 @@ | ||
1902 | 1872 | int status, tries; |
1903 | 1873 | long otimeout = serial_recv_timeout; |
1904 | 1874 | |
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", | |
1907 | 1876 | progname, m->desc, addr); |
1908 | 1877 | |
1909 | 1878 | 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", | |
1911 | 1880 | progname); |
1912 | 1881 | return -1; |
1913 | 1882 | } |
1914 | 1883 | 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", | |
1916 | 1885 | progname); |
1917 | 1886 | return -1; |
1918 | 1887 | } |
@@ -1948,8 +1917,7 @@ | ||
1948 | 1917 | tries = 0; |
1949 | 1918 | |
1950 | 1919 | retry: |
1951 | - if (verbose >= 2) | |
1952 | - avrdude_message("%s: jtagmkII_page_erase(): " | |
1920 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(): " | |
1953 | 1921 | "Sending xmega erase command: ", |
1954 | 1922 | progname); |
1955 | 1923 | jtagmkII_send(pgm, cmd, sizeof cmd); |
@@ -1958,8 +1926,7 @@ | ||
1958 | 1926 | if (status <= 0) { |
1959 | 1927 | if (verbose >= 2) |
1960 | 1928 | putc('\n', stderr); |
1961 | - if (verbose >= 1) | |
1962 | - avrdude_message("%s: jtagmkII_page_erase(): " | |
1929 | + avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): " | |
1963 | 1930 | "timeout/error communicating with programmer (status %d)\n", |
1964 | 1931 | progname, status); |
1965 | 1932 | if (tries++ < 4) { |
@@ -1966,7 +1933,7 @@ | ||
1966 | 1933 | serial_recv_timeout *= 2; |
1967 | 1934 | goto retry; |
1968 | 1935 | } |
1969 | - avrdude_message("%s: jtagmkII_page_erase(): fatal timeout/" | |
1936 | + avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): fatal timeout/" | |
1970 | 1937 | "error communicating with programmer (status %d)\n", |
1971 | 1938 | progname, status); |
1972 | 1939 | serial_recv_timeout = otimeout; |
@@ -1976,9 +1943,9 @@ | ||
1976 | 1943 | putc('\n', stderr); |
1977 | 1944 | jtagmkII_prmsg(pgm, resp, status); |
1978 | 1945 | } 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); | |
1980 | 1947 | if (resp[0] != RSP_OK) { |
1981 | - avrdude_message("%s: jtagmkII_page_erase(): " | |
1948 | + avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase(): " | |
1982 | 1949 | "bad response to xmega erase command: %s\n", |
1983 | 1950 | progname, jtagmkII_get_rc(resp[0])); |
1984 | 1951 | free(resp); |
@@ -2003,8 +1970,7 @@ | ||
2003 | 1970 | int status, tries, dynamic_memtype = 0; |
2004 | 1971 | long otimeout = serial_recv_timeout; |
2005 | 1972 | |
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", | |
2008 | 1974 | progname, m->desc, page_size, n_bytes); |
2009 | 1975 | |
2010 | 1976 | if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0) |
@@ -2014,7 +1980,7 @@ | ||
2014 | 1980 | else if (page_size > 256) page_size = 256; |
2015 | 1981 | |
2016 | 1982 | 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", | |
2018 | 1984 | progname); |
2019 | 1985 | return -1; |
2020 | 1986 | } |
@@ -2059,8 +2025,7 @@ | ||
2059 | 2025 | block_size = maxaddr - addr; |
2060 | 2026 | else |
2061 | 2027 | block_size = page_size; |
2062 | - if (verbose >= 3) | |
2063 | - avrdude_message("%s: jtagmkII_paged_write(): " | |
2028 | + avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_write(): " | |
2064 | 2029 | "block_size at addr %d is %d\n", |
2065 | 2030 | progname, addr, block_size); |
2066 | 2031 |
@@ -2083,8 +2048,7 @@ | ||
2083 | 2048 | tries = 0; |
2084 | 2049 | |
2085 | 2050 | retry: |
2086 | - if (verbose >= 2) | |
2087 | - avrdude_message("%s: jtagmkII_paged_write(): " | |
2051 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_paged_write(): " | |
2088 | 2052 | "Sending write memory command: ", |
2089 | 2053 | progname); |
2090 | 2054 | jtagmkII_send(pgm, cmd, page_size + 10); |
@@ -2093,8 +2057,7 @@ | ||
2093 | 2057 | if (status <= 0) { |
2094 | 2058 | if (verbose >= 2) |
2095 | 2059 | putc('\n', stderr); |
2096 | - if (verbose >= 1) | |
2097 | - avrdude_message("%s: jtagmkII_paged_write(): " | |
2060 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): " | |
2098 | 2061 | "timeout/error communicating with programmer (status %d)\n", |
2099 | 2062 | progname, status); |
2100 | 2063 | if (tries++ < 4) { |
@@ -2101,7 +2064,7 @@ | ||
2101 | 2064 | serial_recv_timeout *= 2; |
2102 | 2065 | goto retry; |
2103 | 2066 | } |
2104 | - avrdude_message("%s: jtagmkII_paged_write(): fatal timeout/" | |
2067 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): fatal timeout/" | |
2105 | 2068 | "error communicating with programmer (status %d)\n", |
2106 | 2069 | progname, status); |
2107 | 2070 | free(cmd); |
@@ -2112,9 +2075,9 @@ | ||
2112 | 2075 | putc('\n', stderr); |
2113 | 2076 | jtagmkII_prmsg(pgm, resp, status); |
2114 | 2077 | } 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); | |
2116 | 2079 | if (resp[0] != RSP_OK) { |
2117 | - avrdude_message("%s: jtagmkII_paged_write(): " | |
2080 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write(): " | |
2118 | 2081 | "bad response to write memory command: %s\n", |
2119 | 2082 | progname, jtagmkII_get_rc(resp[0])); |
2120 | 2083 | free(resp); |
@@ -2142,8 +2105,7 @@ | ||
2142 | 2105 | int status, tries, dynamic_memtype = 0; |
2143 | 2106 | long otimeout = serial_recv_timeout; |
2144 | 2107 | |
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", | |
2147 | 2109 | progname, m->desc, page_size, n_bytes); |
2148 | 2110 | |
2149 | 2111 | if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0) |
@@ -2178,8 +2140,7 @@ | ||
2178 | 2140 | block_size = maxaddr - addr; |
2179 | 2141 | else |
2180 | 2142 | block_size = page_size; |
2181 | - if (verbose >= 3) | |
2182 | - avrdude_message("%s: jtagmkII_paged_load(): " | |
2143 | + avrdude_message(MSG_DEBUG, "%s: jtagmkII_paged_load(): " | |
2183 | 2144 | "block_size at addr %d is %d\n", |
2184 | 2145 | progname, addr, block_size); |
2185 | 2146 |
@@ -2192,8 +2153,7 @@ | ||
2192 | 2153 | tries = 0; |
2193 | 2154 | |
2194 | 2155 | 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: ", | |
2197 | 2157 | progname); |
2198 | 2158 | jtagmkII_send(pgm, cmd, 10); |
2199 | 2159 |
@@ -2201,8 +2161,7 @@ | ||
2201 | 2161 | if (status <= 0) { |
2202 | 2162 | if (verbose >= 2) |
2203 | 2163 | putc('\n', stderr); |
2204 | - if (verbose >= 1) | |
2205 | - avrdude_message("%s: jtagmkII_paged_load(): " | |
2164 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): " | |
2206 | 2165 | "timeout/error communicating with programmer (status %d)\n", |
2207 | 2166 | progname, status); |
2208 | 2167 | if (tries++ < 4) { |
@@ -2209,7 +2168,7 @@ | ||
2209 | 2168 | serial_recv_timeout *= 2; |
2210 | 2169 | goto retry; |
2211 | 2170 | } |
2212 | - avrdude_message("%s: jtagmkII_paged_load(): fatal timeout/" | |
2171 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): fatal timeout/" | |
2213 | 2172 | "error communicating with programmer (status %d)\n", |
2214 | 2173 | progname, status); |
2215 | 2174 | serial_recv_timeout = otimeout; |
@@ -2219,9 +2178,9 @@ | ||
2219 | 2178 | putc('\n', stderr); |
2220 | 2179 | jtagmkII_prmsg(pgm, resp, status); |
2221 | 2180 | } 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); | |
2223 | 2182 | if (resp[0] != RSP_MEMORY) { |
2224 | - avrdude_message("%s: jtagmkII_paged_load(): " | |
2183 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load(): " | |
2225 | 2184 | "bad response to read memory command: %s\n", |
2226 | 2185 | progname, jtagmkII_get_rc(resp[0])); |
2227 | 2186 | free(resp); |
@@ -2245,8 +2204,7 @@ | ||
2245 | 2204 | unsigned long paddr = 0UL, *paddr_ptr = NULL; |
2246 | 2205 | unsigned int pagesize = 0; |
2247 | 2206 | |
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", | |
2250 | 2208 | progname, mem->desc, addr); |
2251 | 2209 | |
2252 | 2210 | if (!(pgm->flag & PGM_FL_IS_DW) && jtagmkII_program_enable(pgm) < 0) |
@@ -2329,7 +2287,7 @@ | ||
2329 | 2287 | break; |
2330 | 2288 | |
2331 | 2289 | 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", | |
2333 | 2291 | progname, addr); |
2334 | 2292 | return -1; |
2335 | 2293 | } |
@@ -2371,8 +2329,7 @@ | ||
2371 | 2329 | |
2372 | 2330 | tries = 0; |
2373 | 2331 | 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: ", | |
2376 | 2333 | progname); |
2377 | 2334 | jtagmkII_send(pgm, cmd, 10); |
2378 | 2335 |
@@ -2380,13 +2337,12 @@ | ||
2380 | 2337 | if (status <= 0) { |
2381 | 2338 | if (verbose >= 2) |
2382 | 2339 | putc('\n', stderr); |
2383 | - if (verbose >= 1) | |
2384 | - avrdude_message("%s: jtagmkII_read_byte(): " | |
2340 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): " | |
2385 | 2341 | "timeout/error communicating with programmer (status %d)\n", |
2386 | 2342 | progname, status); |
2387 | 2343 | if (tries++ < 3) |
2388 | 2344 | goto retry; |
2389 | - avrdude_message("%s: jtagmkII_read_byte(): " | |
2345 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): " | |
2390 | 2346 | "fatal timeout/error communicating with programmer (status %d)\n", |
2391 | 2347 | progname, status); |
2392 | 2348 | if (status < 0) |
@@ -2397,9 +2353,9 @@ | ||
2397 | 2353 | putc('\n', stderr); |
2398 | 2354 | jtagmkII_prmsg(pgm, resp, status); |
2399 | 2355 | } 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); | |
2401 | 2357 | if (resp[0] != RSP_MEMORY) { |
2402 | - avrdude_message("%s: jtagmkII_read_byte(): " | |
2358 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_byte(): " | |
2403 | 2359 | "bad response to read memory command: %s\n", |
2404 | 2360 | progname, jtagmkII_get_rc(resp[0])); |
2405 | 2361 | goto fail; |
@@ -2427,8 +2383,7 @@ | ||
2427 | 2383 | unsigned char *resp = NULL, writedata, writedata2 = 0xFF; |
2428 | 2384 | int status, tries, need_progmode = 1, unsupp = 0, writesize = 1; |
2429 | 2385 | |
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", | |
2432 | 2387 | progname, mem->desc, addr); |
2433 | 2388 | |
2434 | 2389 | addr += mem->offset; |
@@ -2505,8 +2460,7 @@ | ||
2505 | 2460 | |
2506 | 2461 | tries = 0; |
2507 | 2462 | 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: ", | |
2510 | 2464 | progname); |
2511 | 2465 | jtagmkII_send(pgm, cmd, 10 + writesize); |
2512 | 2466 |
@@ -2514,13 +2468,12 @@ | ||
2514 | 2468 | if (status <= 0) { |
2515 | 2469 | if (verbose >= 2) |
2516 | 2470 | putc('\n', stderr); |
2517 | - if (verbose > 1) | |
2518 | - avrdude_message("%s: jtagmkII_write_byte(): " | |
2471 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_write_byte(): " | |
2519 | 2472 | "timeout/error communicating with programmer (status %d)\n", |
2520 | 2473 | progname, status); |
2521 | 2474 | if (tries++ < 3) |
2522 | 2475 | goto retry; |
2523 | - avrdude_message("%s: jtagmkII_write_byte(): " | |
2476 | + avrdude_message(MSG_INFO, "%s: jtagmkII_write_byte(): " | |
2524 | 2477 | "fatal timeout/error communicating with programmer (status %d)\n", |
2525 | 2478 | progname, status); |
2526 | 2479 | goto fail; |
@@ -2529,9 +2482,9 @@ | ||
2529 | 2482 | putc('\n', stderr); |
2530 | 2483 | jtagmkII_prmsg(pgm, resp, status); |
2531 | 2484 | } 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); | |
2533 | 2486 | if (resp[0] != RSP_OK) { |
2534 | - avrdude_message("%s: jtagmkII_write_byte(): " | |
2487 | + avrdude_message(MSG_INFO, "%s: jtagmkII_write_byte(): " | |
2535 | 2488 | "bad response to write memory command: %s\n", |
2536 | 2489 | progname, jtagmkII_get_rc(resp[0])); |
2537 | 2490 | goto fail; |
@@ -2584,13 +2537,11 @@ | ||
2584 | 2537 | int status; |
2585 | 2538 | unsigned char buf[2], *resp, c; |
2586 | 2539 | |
2587 | - if (verbose >= 2) | |
2588 | - avrdude_message("%s: jtagmkII_getparm()\n", progname); | |
2540 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getparm()\n", progname); | |
2589 | 2541 | |
2590 | 2542 | buf[0] = CMND_GET_PARAMETER; |
2591 | 2543 | buf[1] = parm; |
2592 | - if (verbose >= 2) | |
2593 | - avrdude_message("%s: jtagmkII_getparm(): " | |
2544 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getparm(): " | |
2594 | 2545 | "Sending get parameter command (parm 0x%02x): ", |
2595 | 2546 | progname, parm); |
2596 | 2547 | jtagmkII_send(pgm, buf, 2); |
@@ -2599,7 +2550,7 @@ | ||
2599 | 2550 | if (status <= 0) { |
2600 | 2551 | if (verbose >= 2) |
2601 | 2552 | putc('\n', stderr); |
2602 | - avrdude_message("%s: jtagmkII_getparm(): " | |
2553 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getparm(): " | |
2603 | 2554 | "timeout/error communicating with programmer (status %d)\n", |
2604 | 2555 | progname, status); |
2605 | 2556 | return -1; |
@@ -2608,10 +2559,10 @@ | ||
2608 | 2559 | putc('\n', stderr); |
2609 | 2560 | jtagmkII_prmsg(pgm, resp, status); |
2610 | 2561 | } 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); | |
2612 | 2563 | c = resp[0]; |
2613 | 2564 | if (c != RSP_PARAMETER) { |
2614 | - avrdude_message("%s: jtagmkII_getparm(): " | |
2565 | + avrdude_message(MSG_INFO, "%s: jtagmkII_getparm(): " | |
2615 | 2566 | "bad response to get parameter command: %s\n", |
2616 | 2567 | progname, jtagmkII_get_rc(c)); |
2617 | 2568 | free(resp); |
@@ -2638,8 +2589,7 @@ | ||
2638 | 2589 | unsigned char buf[2 + 4], *resp, c; |
2639 | 2590 | size_t size; |
2640 | 2591 | |
2641 | - if (verbose >= 2) | |
2642 | - avrdude_message("%s: jtagmkII_setparm()\n", progname); | |
2592 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_setparm()\n", progname); | |
2643 | 2593 | |
2644 | 2594 | switch (parm) { |
2645 | 2595 | case PAR_HW_VERSION: size = 2; break; |
@@ -2654,7 +2604,7 @@ | ||
2654 | 2604 | case PAR_PDI_OFFSET_START: |
2655 | 2605 | case PAR_PDI_OFFSET_END: size = 4; break; |
2656 | 2606 | 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", | |
2658 | 2608 | progname, parm); |
2659 | 2609 | return -1; |
2660 | 2610 | } |
@@ -2662,8 +2612,7 @@ | ||
2662 | 2612 | buf[0] = CMND_SET_PARAMETER; |
2663 | 2613 | buf[1] = parm; |
2664 | 2614 | memcpy(buf + 2, value, size); |
2665 | - if (verbose >= 2) | |
2666 | - avrdude_message("%s: jtagmkII_setparm(): " | |
2615 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_setparm(): " | |
2667 | 2616 | "Sending set parameter command (parm 0x%02x, %u bytes): ", |
2668 | 2617 | progname, parm, (unsigned)size); |
2669 | 2618 | jtagmkII_send(pgm, buf, size + 2); |
@@ -2672,7 +2621,7 @@ | ||
2672 | 2621 | if (status <= 0) { |
2673 | 2622 | if (verbose >= 2) |
2674 | 2623 | putc('\n', stderr); |
2675 | - avrdude_message("%s: jtagmkII_setparm(): " | |
2624 | + avrdude_message(MSG_INFO, "%s: jtagmkII_setparm(): " | |
2676 | 2625 | "timeout/error communicating with programmer (status %d)\n", |
2677 | 2626 | progname, status); |
2678 | 2627 | return -1; |
@@ -2681,11 +2630,11 @@ | ||
2681 | 2630 | putc('\n', stderr); |
2682 | 2631 | jtagmkII_prmsg(pgm, resp, status); |
2683 | 2632 | } 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); | |
2685 | 2634 | c = resp[0]; |
2686 | 2635 | free(resp); |
2687 | 2636 | if (c != RSP_OK) { |
2688 | - avrdude_message("%s: jtagmkII_setparm(): " | |
2637 | + avrdude_message(MSG_INFO, "%s: jtagmkII_setparm(): " | |
2689 | 2638 | "bad response to set parameter command: %s\n", |
2690 | 2639 | progname, jtagmkII_get_rc(c)); |
2691 | 2640 | return -1; |
@@ -2703,11 +2652,11 @@ | ||
2703 | 2652 | jtagmkII_getparm(pgm, PAR_FW_VERSION, fw) < 0) |
2704 | 2653 | return; |
2705 | 2654 | |
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", | |
2711 | 2660 | 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]); |
2712 | 2661 | |
2713 | 2662 | jtagmkII_print_parms1(pgm, p); |
@@ -2725,7 +2674,7 @@ | ||
2725 | 2674 | if (jtagmkII_getparm(pgm, PAR_OCD_VTARGET, vtarget) < 0) |
2726 | 2675 | return; |
2727 | 2676 | |
2728 | - avrdude_message("%sVtarget : %.1f V\n", p, | |
2677 | + avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, | |
2729 | 2678 | b2_to_u16(vtarget) / 1000.0); |
2730 | 2679 | |
2731 | 2680 | if ((pgm->flag & PGM_FL_IS_JTAG)) { |
@@ -2745,7 +2694,7 @@ | ||
2745 | 2694 | sprintf(clkbuf, "%.1f kHz", 5.35e3 / (double)jtag_clock[0]); |
2746 | 2695 | clk = 5.35e6 / (double)jtag_clock[0]; |
2747 | 2696 | |
2748 | - avrdude_message("%sJTAG clock : %s (%.1f us)\n", p, clkbuf, | |
2697 | + avrdude_message(MSG_INFO, "%sJTAG clock : %s (%.1f us)\n", p, clkbuf, | |
2749 | 2698 | 1.0e6 / clk); |
2750 | 2699 | } |
2751 | 2700 | } |
@@ -2806,7 +2755,7 @@ | ||
2806 | 2755 | int status; |
2807 | 2756 | unsigned char buf[3], *resp; |
2808 | 2757 | |
2809 | - if(verbose) avrdude_message("%s: jtagmkII_avr32_reset(%2.2x)\n", | |
2758 | + avrdude_message(MSG_NOTICE, "%s: jtagmkII_avr32_reset(%2.2x)\n", | |
2810 | 2759 | progname, val); |
2811 | 2760 | |
2812 | 2761 | buf[0] = CMND_GET_IR; |
@@ -2816,7 +2765,7 @@ | ||
2816 | 2765 | |
2817 | 2766 | status = jtagmkII_recv(pgm, &resp); |
2818 | 2767 | 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(): " | |
2820 | 2769 | "Get_IR, expecting %2.2x but got %2.2x\n", |
2821 | 2770 | progname, ret1, resp[1]); |
2822 | 2771 |
@@ -2831,7 +2780,7 @@ | ||
2831 | 2780 | |
2832 | 2781 | status = jtagmkII_recv(pgm, &resp); |
2833 | 2782 | 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(): " | |
2835 | 2784 | "Get_XXX, expecting %2.2x but got %2.2x\n", |
2836 | 2785 | progname, ret2, resp[1]); |
2837 | 2786 | //return -1; |
@@ -2847,7 +2796,7 @@ | ||
2847 | 2796 | unsigned char *resp, buf[3]; |
2848 | 2797 | unsigned long val=0; |
2849 | 2798 | |
2850 | - if(verbose) avrdude_message("%s: jtagmkII_reset32(%2.2x)\n", | |
2799 | + avrdude_message(MSG_NOTICE, "%s: jtagmkII_reset32(%2.2x)\n", | |
2851 | 2800 | progname, flags); |
2852 | 2801 | |
2853 | 2802 | status = -1; |
@@ -3025,7 +2974,7 @@ | ||
3025 | 2974 | return 0; |
3026 | 2975 | |
3027 | 2976 | eRR: |
3028 | - avrdude_message("%s: jtagmkII_reset32(): " | |
2977 | + avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): " | |
3029 | 2978 | "failed at line %d (status=%x val=%lx)\n", |
3030 | 2979 | progname, lineno, status, val); |
3031 | 2980 | return -1; |
@@ -3124,7 +3073,7 @@ | ||
3124 | 3073 | return 0; |
3125 | 3074 | |
3126 | 3075 | eRR: |
3127 | - avrdude_message("%s: jtagmkII_smc_init32(): " | |
3076 | + avrdude_message(MSG_INFO, "%s: jtagmkII_smc_init32(): " | |
3128 | 3077 | "failed at line %d\n", |
3129 | 3078 | progname, lineno); |
3130 | 3079 | return -1; |
@@ -3140,7 +3089,7 @@ | ||
3140 | 3089 | unsigned char buf[6], *resp; |
3141 | 3090 | |
3142 | 3091 | 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", | |
3144 | 3093 | progname); |
3145 | 3094 | return -1; |
3146 | 3095 | } |
@@ -3148,12 +3097,12 @@ | ||
3148 | 3097 | free(PDATA(pgm)->flash_pagecache); |
3149 | 3098 | free(PDATA(pgm)->eeprom_pagecache); |
3150 | 3099 | 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", | |
3152 | 3101 | progname); |
3153 | 3102 | return -1; |
3154 | 3103 | } |
3155 | 3104 | 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", | |
3157 | 3106 | progname); |
3158 | 3107 | free(PDATA(pgm)->flash_pagecache); |
3159 | 3108 | return -1; |
@@ -3169,7 +3118,7 @@ | ||
3169 | 3118 | if(status <= 0 || resp[0] != 0x87) { |
3170 | 3119 | if (verbose >= 2) |
3171 | 3120 | putc('\n', stderr); |
3172 | - avrdude_message("%s: jtagmkII_initialize32(): " | |
3121 | + avrdude_message(MSG_INFO, "%s: jtagmkII_initialize32(): " | |
3173 | 3122 | "timeout/error communicating with programmer (status %d)\n", |
3174 | 3123 | progname, status); |
3175 | 3124 | return -1; |
@@ -3185,7 +3134,7 @@ | ||
3185 | 3134 | if(status <= 0 || resp[0] != 0x87) { |
3186 | 3135 | if (verbose >= 2) |
3187 | 3136 | putc('\n', stderr); |
3188 | - avrdude_message("%s: jtagmkII_initialize32(): " | |
3137 | + avrdude_message(MSG_INFO, "%s: jtagmkII_initialize32(): " | |
3189 | 3138 | "timeout/error communicating with programmer (status %d)\n", |
3190 | 3139 | progname, status); |
3191 | 3140 | return -1; |
@@ -3195,11 +3144,11 @@ | ||
3195 | 3144 | resp[2] != p->signature[0] || |
3196 | 3145 | resp[3] != p->signature[1] || |
3197 | 3146 | 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", | |
3199 | 3148 | progname, p->desc, |
3200 | 3149 | p->signature[0], p->signature[1], p->signature[2]); |
3201 | 3150 | if (!ovsigck) { |
3202 | - avrdude_message("%sDouble check chip, " | |
3151 | + avrdude_message(MSG_INFO, "%sDouble check chip, " | |
3203 | 3152 | "or use -F to override this check.\n", |
3204 | 3153 | progbuf); |
3205 | 3154 | return -1; |
@@ -3218,7 +3167,7 @@ | ||
3218 | 3167 | unsigned long val=0; |
3219 | 3168 | unsigned int lineno; |
3220 | 3169 | |
3221 | - if(verbose) avrdude_message("%s: jtagmkII_chip_erase32()\n", | |
3170 | + avrdude_message(MSG_NOTICE, "%s: jtagmkII_chip_erase32()\n", | |
3222 | 3171 | progname); |
3223 | 3172 | |
3224 | 3173 | status = jtagmkII_reset32(pgm, AVR32_RESET_CHIP_ERASE); |
@@ -3266,7 +3215,7 @@ | ||
3266 | 3215 | return 0; |
3267 | 3216 | |
3268 | 3217 | eRR: |
3269 | - avrdude_message("%s: jtagmkII_reset32(): " | |
3218 | + avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): " | |
3270 | 3219 | "failed at line %d (status=%x val=%lx)\n", |
3271 | 3220 | progname, lineno, status, val); |
3272 | 3221 | return -1; |
@@ -3293,7 +3242,7 @@ | ||
3293 | 3242 | if(status <= 0 || resp[0] != 0x87) { |
3294 | 3243 | if (verbose >= 2) |
3295 | 3244 | putc('\n', stderr); |
3296 | - avrdude_message("%s: jtagmkII_read_SABaddr(): " | |
3245 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): " | |
3297 | 3246 | "timeout/error communicating with programmer (status %d) resp=%x\n", |
3298 | 3247 | progname, status, resp[0]); |
3299 | 3248 | serial_recv_timeout = otimeout; |
@@ -3300,12 +3249,12 @@ | ||
3300 | 3249 | |
3301 | 3250 | if(status > 0) { |
3302 | 3251 | 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"); | |
3309 | 3258 | } |
3310 | 3259 | return ERROR_SAB; |
3311 | 3260 | } |
@@ -3313,7 +3262,7 @@ | ||
3313 | 3262 | if(status != 5) { |
3314 | 3263 | if (verbose >= 2) |
3315 | 3264 | putc('\n', stderr); |
3316 | - avrdude_message("%s: jtagmkII_read_SABaddr(): " | |
3265 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): " | |
3317 | 3266 | "wrong number of bytes (status %d)\n", |
3318 | 3267 | progname, status); |
3319 | 3268 | serial_recv_timeout = otimeout; |
@@ -3326,7 +3275,7 @@ | ||
3326 | 3275 | if (verbose) { |
3327 | 3276 | if (verbose >= 2) |
3328 | 3277 | putc('\n', stderr); |
3329 | - avrdude_message("%s: jtagmkII_read_SABaddr(): " | |
3278 | + avrdude_message(MSG_INFO, "%s: jtagmkII_read_SABaddr(): " | |
3330 | 3279 | "OCD Register %lx -> %4.4lx\n", |
3331 | 3280 | progname, addr, val); |
3332 | 3281 | } |
@@ -3352,7 +3301,7 @@ | ||
3352 | 3301 | if(status <= 0 || resp[0] != RSP_OK) { |
3353 | 3302 | if (verbose >= 2) |
3354 | 3303 | putc('\n', stderr); |
3355 | - avrdude_message("%s: jtagmkII_write_SABaddr(): " | |
3304 | + avrdude_message(MSG_INFO, "%s: jtagmkII_write_SABaddr(): " | |
3356 | 3305 | "timeout/error communicating with programmer (status %d)\n", |
3357 | 3306 | progname, status); |
3358 | 3307 | return -1; |
@@ -3362,7 +3311,7 @@ | ||
3362 | 3311 | if (verbose) { |
3363 | 3312 | if (verbose >= 2) |
3364 | 3313 | putc('\n', stderr); |
3365 | - avrdude_message("%s: jtagmkII_write_SABaddr(): " | |
3314 | + avrdude_message(MSG_INFO, "%s: jtagmkII_write_SABaddr(): " | |
3366 | 3315 | "OCD Register %lx -> %4.4lx\n", |
3367 | 3316 | progname, addr, val); |
3368 | 3317 | } |
@@ -3375,8 +3324,7 @@ | ||
3375 | 3324 | unsigned char buf[6], *resp; |
3376 | 3325 | union pinfo pinfo; |
3377 | 3326 | |
3378 | - if (verbose >= 2) | |
3379 | - avrdude_message("%s: jtagmkII_open32()\n", progname); | |
3327 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open32()\n", progname); | |
3380 | 3328 | |
3381 | 3329 | /* |
3382 | 3330 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -3403,7 +3351,7 @@ | ||
3403 | 3351 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
3404 | 3352 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
3405 | 3353 | #else |
3406 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
3354 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
3407 | 3355 | return -1; |
3408 | 3356 | #endif |
3409 | 3357 | } |
@@ -3456,8 +3404,7 @@ | ||
3456 | 3404 | unsigned char *resp, buf[3], c; |
3457 | 3405 | unsigned long val=0; |
3458 | 3406 | |
3459 | - if (verbose >= 2) | |
3460 | - avrdude_message("%s: jtagmkII_close32()\n", progname); | |
3407 | + avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close32()\n", progname); | |
3461 | 3408 | |
3462 | 3409 | // AVR32 "special" |
3463 | 3410 | buf[0] = CMND_SET_PARAMETER; |
@@ -3469,8 +3416,7 @@ | ||
3469 | 3416 | free(resp); |
3470 | 3417 | |
3471 | 3418 | 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: ", | |
3474 | 3420 | progname); |
3475 | 3421 | jtagmkII_send(pgm, buf, 1); |
3476 | 3422 |
@@ -3478,7 +3424,7 @@ | ||
3478 | 3424 | if (status <= 0) { |
3479 | 3425 | if (verbose >= 2) |
3480 | 3426 | putc('\n', stderr); |
3481 | - avrdude_message("%s: jtagmkII_close(): " | |
3427 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
3482 | 3428 | "timeout/error communicating with programmer (status %d)\n", |
3483 | 3429 | progname, status); |
3484 | 3430 | return; |
@@ -3487,11 +3433,11 @@ | ||
3487 | 3433 | putc('\n', stderr); |
3488 | 3434 | jtagmkII_prmsg(pgm, resp, status); |
3489 | 3435 | } 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); | |
3491 | 3437 | c = resp[0]; |
3492 | 3438 | free(resp); |
3493 | 3439 | if (c != RSP_OK) { |
3494 | - avrdude_message("%s: jtagmkII_close(): " | |
3440 | + avrdude_message(MSG_INFO, "%s: jtagmkII_close(): " | |
3495 | 3441 | "bad response to sign-off command: %s\n", |
3496 | 3442 | progname, jtagmkII_get_rc(c)); |
3497 | 3443 | } |
@@ -3502,7 +3448,7 @@ | ||
3502 | 3448 | return; |
3503 | 3449 | |
3504 | 3450 | eRR: |
3505 | - avrdude_message("%s: jtagmkII_reset32(): " | |
3451 | + avrdude_message(MSG_INFO, "%s: jtagmkII_reset32(): " | |
3506 | 3452 | "failed at line %d (status=%x val=%lx)\n", |
3507 | 3453 | progname, lineno, status, val); |
3508 | 3454 | goto ret; |
@@ -3520,8 +3466,7 @@ | ||
3520 | 3466 | unsigned long val=0; |
3521 | 3467 | long otimeout = serial_recv_timeout; |
3522 | 3468 | |
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", | |
3525 | 3470 | progname, m->desc, page_size, n_bytes); |
3526 | 3471 | |
3527 | 3472 | serial_recv_timeout = 256; |
@@ -3545,7 +3490,7 @@ | ||
3545 | 3490 | p->flags |= AVRPART_INIT_SMC; |
3546 | 3491 | } |
3547 | 3492 | |
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", | |
3549 | 3494 | // page_size, n_bytes, pages, m->offset, pgm->page_size); |
3550 | 3495 | |
3551 | 3496 | cmd[0] = CMND_READ_MEMORY32; |
@@ -3554,8 +3499,7 @@ | ||
3554 | 3499 | |
3555 | 3500 | for (; addr < maxaddr; addr += block_size) { |
3556 | 3501 | 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(): " | |
3559 | 3503 | "block_size at addr %d is %d\n", |
3560 | 3504 | progname, addr, block_size); |
3561 | 3505 |
@@ -3570,9 +3514,9 @@ | ||
3570 | 3514 | putc('\n', stderr); |
3571 | 3515 | jtagmkII_prmsg(pgm, resp, status); |
3572 | 3516 | } 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); | |
3574 | 3518 | if (resp[0] != 0x87) { |
3575 | - avrdude_message("%s: jtagmkII_paged_load32(): " | |
3519 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load32(): " | |
3576 | 3520 | "bad response to write memory command: %s\n", |
3577 | 3521 | progname, jtagmkII_get_rc(resp[0])); |
3578 | 3522 | free(resp); |
@@ -3592,7 +3536,7 @@ | ||
3592 | 3536 | |
3593 | 3537 | eRR: |
3594 | 3538 | serial_recv_timeout = otimeout; |
3595 | - avrdude_message("%s: jtagmkII_paged_load32(): " | |
3539 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_load32(): " | |
3596 | 3540 | "failed at line %d (status=%x val=%lx)\n", |
3597 | 3541 | progname, lineno, status, val); |
3598 | 3542 | return -1; |
@@ -3620,12 +3564,12 @@ | ||
3620 | 3564 | |
3621 | 3565 | pages = (n_bytes - addr - 1)/page_size + 1; |
3622 | 3566 | 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", | |
3624 | 3568 | // page_size, n_bytes, pages, m->offset, pgm->page_size); |
3625 | 3569 | |
3626 | 3570 | // Before any errors can happen |
3627 | 3571 | 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); | |
3629 | 3573 | return -1; |
3630 | 3574 | } |
3631 | 3575 |
@@ -3659,8 +3603,7 @@ | ||
3659 | 3603 | |
3660 | 3604 | for(blocks=0; blocks<2; ++blocks) { |
3661 | 3605 | 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(): " | |
3664 | 3607 | "block_size at addr %d is %d\n", |
3665 | 3608 | progname, addr, block_size); |
3666 | 3609 |
@@ -3677,9 +3620,9 @@ | ||
3677 | 3620 | putc('\n', stderr); |
3678 | 3621 | jtagmkII_prmsg(pgm, resp, status); |
3679 | 3622 | } 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); | |
3681 | 3624 | if (resp[0] != RSP_OK) { |
3682 | - avrdude_message("%s: jtagmkII_paged_write32(): " | |
3625 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write32(): " | |
3683 | 3626 | "bad response to write memory command: %s\n", |
3684 | 3627 | progname, jtagmkII_get_rc(resp[0])); |
3685 | 3628 | free(resp); |
@@ -3706,7 +3649,7 @@ | ||
3706 | 3649 | eRR: |
3707 | 3650 | serial_recv_timeout = otimeout; |
3708 | 3651 | free(cmd); |
3709 | - avrdude_message("%s: jtagmkII_paged_write32(): " | |
3652 | + avrdude_message(MSG_INFO, "%s: jtagmkII_paged_write32(): " | |
3710 | 3653 | "failed at line %d (status=%x val=%lx)\n", |
3711 | 3654 | progname, lineno, status, val); |
3712 | 3655 | return -1; |
@@ -3734,7 +3677,7 @@ | ||
3734 | 3677 | return 0; |
3735 | 3678 | |
3736 | 3679 | eRR: |
3737 | - avrdude_message("%s: jtagmkII_flash_lock32(): " | |
3680 | + avrdude_message(MSG_INFO, "%s: jtagmkII_flash_lock32(): " | |
3738 | 3681 | "failed at line %d page %d cmd %8.8lx\n", |
3739 | 3682 | progname, lineno, page, cmd); |
3740 | 3683 | return -1; |
@@ -3758,7 +3701,7 @@ | ||
3758 | 3701 | status = jtagmkII_write_SABaddr(pgm, AVR32_FLASHC_FCMD, 0x05, cmd); |
3759 | 3702 | if (status < 0) {lineno = __LINE__; goto eRR;} |
3760 | 3703 | |
3761 | -//avrdude_message("ERASE %x -> %x\n", cmd, AVR32_FLASHC_FCMD); | |
3704 | +//avrdude_message(MSG_INFO, "ERASE %x -> %x\n", cmd, AVR32_FLASHC_FCMD); | |
3762 | 3705 | |
3763 | 3706 | err = 0; |
3764 | 3707 | for(i=0; i<256; ++i) { |
@@ -3774,7 +3717,7 @@ | ||
3774 | 3717 | return 0; |
3775 | 3718 | |
3776 | 3719 | eRR: |
3777 | - avrdude_message("%s: jtagmkII_flash_erase32(): " | |
3720 | + avrdude_message(MSG_INFO, "%s: jtagmkII_flash_erase32(): " | |
3778 | 3721 | "failed at line %d page %d cmd %8.8lx val %lx\n", |
3779 | 3722 | progname, lineno, page, cmd, val); |
3780 | 3723 | return -1; |
@@ -3804,7 +3747,7 @@ | ||
3804 | 3747 | return 0; |
3805 | 3748 | |
3806 | 3749 | eRR: |
3807 | - avrdude_message("%s: jtagmkII_flash_write_page32(): " | |
3750 | + avrdude_message(MSG_INFO, "%s: jtagmkII_flash_write_page32(): " | |
3808 | 3751 | "failed at line %d page %d cmd %8.8lx val %lx\n", |
3809 | 3752 | progname, lineno, page, cmd, val); |
3810 | 3753 | return -1; |
@@ -3833,7 +3776,7 @@ | ||
3833 | 3776 | return 0; |
3834 | 3777 | |
3835 | 3778 | eRR: |
3836 | - avrdude_message("%s: jtagmkII_flash_clear_pagebuffer32(): " | |
3779 | + avrdude_message(MSG_INFO, "%s: jtagmkII_flash_clear_pagebuffer32(): " | |
3837 | 3780 | "failed at line %d cmd %8.8lx val %lx\n", |
3838 | 3781 | progname, lineno, cmd, val); |
3839 | 3782 | return -1; |
@@ -3856,7 +3799,7 @@ | ||
3856 | 3799 | pgm->display = jtagmkII_display; |
3857 | 3800 | pgm->enable = jtagmkII_enable; |
3858 | 3801 | pgm->disable = jtagmkII_disable; |
3859 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3802 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
3860 | 3803 | pgm->chip_erase = jtagmkII_chip_erase; |
3861 | 3804 | pgm->open = jtagmkII_open; |
3862 | 3805 | pgm->close = jtagmkII_close; |
@@ -3891,7 +3834,7 @@ | ||
3891 | 3834 | pgm->display = jtagmkII_display; |
3892 | 3835 | pgm->enable = jtagmkII_enable; |
3893 | 3836 | pgm->disable = jtagmkII_disable; |
3894 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3837 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
3895 | 3838 | pgm->chip_erase = jtagmkII_chip_erase_dw; |
3896 | 3839 | pgm->open = jtagmkII_open_dw; |
3897 | 3840 | pgm->close = jtagmkII_close; |
@@ -3923,7 +3866,7 @@ | ||
3923 | 3866 | pgm->display = jtagmkII_display; |
3924 | 3867 | pgm->enable = jtagmkII_enable; |
3925 | 3868 | pgm->disable = jtagmkII_disable; |
3926 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3869 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
3927 | 3870 | pgm->chip_erase = jtagmkII_chip_erase; |
3928 | 3871 | pgm->open = jtagmkII_open_pdi; |
3929 | 3872 | pgm->close = jtagmkII_close; |
@@ -3956,7 +3899,7 @@ | ||
3956 | 3899 | pgm->display = jtagmkII_display; |
3957 | 3900 | pgm->enable = jtagmkII_enable; |
3958 | 3901 | pgm->disable = jtagmkII_disable; |
3959 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3902 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
3960 | 3903 | pgm->chip_erase = jtagmkII_chip_erase; |
3961 | 3904 | pgm->open = jtagmkII_dragon_open; |
3962 | 3905 | pgm->close = jtagmkII_close; |
@@ -3991,7 +3934,7 @@ | ||
3991 | 3934 | pgm->display = jtagmkII_display; |
3992 | 3935 | pgm->enable = jtagmkII_enable; |
3993 | 3936 | pgm->disable = jtagmkII_disable; |
3994 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3937 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
3995 | 3938 | pgm->chip_erase = jtagmkII_chip_erase_dw; |
3996 | 3939 | pgm->open = jtagmkII_dragon_open_dw; |
3997 | 3940 | pgm->close = jtagmkII_close; |
@@ -4023,7 +3966,7 @@ | ||
4023 | 3966 | pgm->display = jtagmkII_display; |
4024 | 3967 | pgm->enable = jtagmkII_enable; |
4025 | 3968 | pgm->disable = jtagmkII_disable; |
4026 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
3969 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
4027 | 3970 | pgm->chip_erase = jtagmkII_chip_erase32; |
4028 | 3971 | pgm->open = jtagmkII_open32; |
4029 | 3972 | pgm->close = jtagmkII_close32; |
@@ -4057,7 +4000,7 @@ | ||
4057 | 4000 | pgm->display = jtagmkII_display; |
4058 | 4001 | pgm->enable = jtagmkII_enable; |
4059 | 4002 | pgm->disable = jtagmkII_disable; |
4060 | - pgm->program_enable = jtagmkII_program_enable_dummy; | |
4003 | + pgm->program_enable = jtagmkII_program_enable_INFO; | |
4061 | 4004 | pgm->chip_erase = jtagmkII_chip_erase; |
4062 | 4005 | pgm->open = jtagmkII_dragon_open_pdi; |
4063 | 4006 | pgm->close = jtagmkII_close; |
@@ -94,9 +94,9 @@ | ||
94 | 94 | } |
95 | 95 | |
96 | 96 | 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", | |
98 | 98 | infile, lineno); |
99 | - avrdude_message(" comment started on line %d\n", | |
99 | + avrdude_message(MSG_INFO, " comment started on line %d\n", | |
100 | 100 | comment_start); |
101 | 101 | exit(1); |
102 | 102 | break; |
@@ -115,7 +115,7 @@ | ||
115 | 115 | <strng>\\(.|\n) *(string_buf_ptr++) = yytext[1]; |
116 | 116 | <strng>[^\\\n\"]+ { char *yptr = yytext; while (*yptr) |
117 | 117 | *(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", | |
119 | 119 | lineno); |
120 | 120 | exit(1); } |
121 | 121 |
@@ -254,9 +254,9 @@ | ||
254 | 254 | "\n" { lineno++; } |
255 | 255 | [ \r\t]+ { /* ignore whitespace */ } |
256 | 256 | |
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", | |
258 | 258 | 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", | |
260 | 260 | CONFIG_DIR, "/avrdude.conf.sample"); |
261 | 261 | return YYERRCODE; } |
262 | 262 |
@@ -812,10 +812,10 @@ | ||
812 | 812 | |
813 | 813 | /* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or "efuse") and verifies it. Will try up to tries |
814 | 814 | 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); | |
816 | 816 | |
817 | 817 | /* 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); | |
819 | 819 | |
820 | 820 | /* This routine will store the current values pointed to by lfuse, hfuse, and efuse into an internal buffer in this routine |
821 | 821 | 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 |
@@ -218,7 +218,7 @@ | ||
218 | 218 | |
219 | 219 | static void linuxgpio_display(PROGRAMMER *pgm, const char *p) |
220 | 220 | { |
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); | |
222 | 222 | pgm_display_generic_mask(pgm, p, SHOW_AVR_PINS); |
223 | 223 | } |
224 | 224 |
@@ -268,7 +268,7 @@ | ||
268 | 268 | i == PIN_AVR_MISO ) { |
269 | 269 | pin = pgm->pinno[i] & PIN_MASK; |
270 | 270 | 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", | |
272 | 272 | pin, strerror(errno)); |
273 | 273 | return r; |
274 | 274 | } |
@@ -345,7 +345,7 @@ | ||
345 | 345 | |
346 | 346 | void linuxgpio_initpgm(PROGRAMMER * pgm) |
347 | 347 | { |
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", | |
349 | 349 | progname); |
350 | 350 | } |
351 | 351 |
@@ -59,19 +59,21 @@ | ||
59 | 59 | length as progname; used for lining up |
60 | 60 | multiline messages */ |
61 | 61 | |
62 | -int avrdude_message(const char *format, ...) | |
62 | +int avrdude_message(const int msglvl, const char *format, ...) | |
63 | 63 | { |
64 | - int rc; | |
64 | + int rc = 0; | |
65 | 65 | 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 | + } | |
69 | 71 | return rc; |
70 | 72 | } |
71 | 73 | |
72 | 74 | int yyerror(char * errmsg) |
73 | 75 | { |
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); | |
75 | 77 | exit(1); |
76 | 78 | } |
77 | 79 |
@@ -104,7 +106,7 @@ | ||
104 | 106 | */ |
105 | 107 | static void usage(void) |
106 | 108 | { |
107 | - avrdude_message( | |
109 | + avrdude_message(MSG_INFO, | |
108 | 110 | "Usage: %s [options]\n" |
109 | 111 | "Options:\n" |
110 | 112 | " -p <partno> Required. Specify AVR device.\n" |
@@ -158,18 +160,18 @@ | ||
158 | 160 | } |
159 | 161 | |
160 | 162 | if (hdr) { |
161 | - avrdude_message("\n"); | |
163 | + avrdude_message(MSG_INFO, "\n"); | |
162 | 164 | last = 0; |
163 | 165 | header = hdr; |
164 | 166 | } |
165 | 167 | |
166 | 168 | if (last == 0) { |
167 | - avrdude_message("\r%s | %s | %d%% %0.2fs", | |
169 | + avrdude_message(MSG_INFO, "\r%s | %s | %d%% %0.2fs", | |
168 | 170 | header, hashes, percent, etime); |
169 | 171 | } |
170 | 172 | |
171 | 173 | if (percent == 100) { |
172 | - if (!last) avrdude_message("\n\n"); | |
174 | + if (!last) avrdude_message(MSG_INFO, "\n\n"); | |
173 | 175 | last = 1; |
174 | 176 | } |
175 | 177 |
@@ -185,19 +187,19 @@ | ||
185 | 187 | setvbuf(stderr, (char*)NULL, _IONBF, 0); |
186 | 188 | |
187 | 189 | if (hdr) { |
188 | - avrdude_message("\n%s | ", hdr); | |
190 | + avrdude_message(MSG_INFO, "\n%s | ", hdr); | |
189 | 191 | last = 0; |
190 | 192 | done = 0; |
191 | 193 | } |
192 | 194 | else { |
193 | 195 | while ((cnt > last) && (done == 0)) { |
194 | - avrdude_message("#"); | |
196 | + avrdude_message(MSG_INFO, "#"); | |
195 | 197 | cnt -= 2; |
196 | 198 | } |
197 | 199 | } |
198 | 200 | |
199 | 201 | 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); | |
201 | 203 | last = 0; |
202 | 204 | done = 1; |
203 | 205 | } |
@@ -386,19 +388,19 @@ | ||
386 | 388 | |
387 | 389 | updates = lcreat(NULL, 0); |
388 | 390 | 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); | |
390 | 392 | exit(1); |
391 | 393 | } |
392 | 394 | |
393 | 395 | extended_params = lcreat(NULL, 0); |
394 | 396 | 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); | |
396 | 398 | exit(1); |
397 | 399 | } |
398 | 400 | |
399 | 401 | additional_config_files = lcreat(NULL, 0); |
400 | 402 | 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); | |
402 | 404 | exit(1); |
403 | 405 | } |
404 | 406 |
@@ -471,7 +473,7 @@ | ||
471 | 473 | case 'b': /* override default programmer baud rate */ |
472 | 474 | baudrate = strtol(optarg, &e, 0); |
473 | 475 | 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", | |
475 | 477 | progname, optarg); |
476 | 478 | exit(1); |
477 | 479 | } |
@@ -480,7 +482,7 @@ | ||
480 | 482 | case 'B': /* specify JTAG ICE bit clock period */ |
481 | 483 | bitclock = strtod(optarg, &e); |
482 | 484 | 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", | |
484 | 486 | progname, optarg); |
485 | 487 | exit(1); |
486 | 488 | } |
@@ -489,7 +491,7 @@ | ||
489 | 491 | case 'i': /* specify isp clock delay */ |
490 | 492 | ispdelay = strtol(optarg, &e,10); |
491 | 493 | 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", | |
493 | 495 | progname, optarg); |
494 | 496 | exit(1); |
495 | 497 | } |
@@ -565,7 +567,7 @@ | ||
565 | 567 | case 'U': |
566 | 568 | upd = parse_op(optarg); |
567 | 569 | 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", | |
569 | 571 | progname, optarg); |
570 | 572 | exit(1); |
571 | 573 | } |
@@ -591,12 +593,12 @@ | ||
591 | 593 | break; |
592 | 594 | |
593 | 595 | 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", | |
595 | 597 | progname); |
596 | 598 | break; |
597 | 599 | |
598 | 600 | 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", | |
600 | 602 | progname); |
601 | 603 | break; |
602 | 604 |
@@ -606,7 +608,7 @@ | ||
606 | 608 | break; |
607 | 609 | |
608 | 610 | 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); | |
610 | 612 | usage(); |
611 | 613 | exit(1); |
612 | 614 | break; |
@@ -637,47 +639,38 @@ | ||
637 | 639 | } |
638 | 640 | } |
639 | 641 | |
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" | |
646 | 647 | "%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n" |
647 | 648 | "%sCopyright (c) 2007-2014 Joerg Wunsch\n\n", |
648 | 649 | 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", | |
653 | 651 | progbuf, sys_config); |
654 | - } | |
655 | 652 | |
656 | 653 | rc = read_config(sys_config); |
657 | 654 | 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", | |
659 | 656 | progname, sys_config); |
660 | 657 | exit(1); |
661 | 658 | } |
662 | 659 | |
663 | 660 | 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", | |
666 | 662 | progbuf, usr_config); |
667 | - } | |
668 | 663 | |
669 | 664 | rc = stat(usr_config, &sb); |
670 | 665 | 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); | |
676 | 669 | } |
677 | 670 | else { |
678 | 671 | rc = read_config(usr_config); |
679 | 672 | 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", | |
681 | 674 | progname, usr_config); |
682 | 675 | exit(1); |
683 | 676 | } |
@@ -690,14 +683,12 @@ | ||
690 | 683 | |
691 | 684 | for (ln1=lfirst(additional_config_files); ln1; ln1=lnext(ln1)) { |
692 | 685 | 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); | |
697 | 688 | |
698 | 689 | rc = read_config(p); |
699 | 690 | 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", | |
701 | 692 | progname, p); |
702 | 693 | exit(1); |
703 | 694 | } |
@@ -709,16 +700,14 @@ | ||
709 | 700 | bitclock = default_bitclock; |
710 | 701 | } |
711 | 702 | |
712 | - if (verbose) { | |
713 | - avrdude_message("\n"); | |
714 | - } | |
703 | + avrdude_message(MSG_NOTICE, "\n"); | |
715 | 704 | |
716 | 705 | if (partdesc) { |
717 | 706 | 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"); | |
720 | 709 | list_parts(stderr, " ", part_list); |
721 | - avrdude_message("\n"); | |
710 | + avrdude_message(MSG_INFO, "\n"); | |
722 | 711 | exit(1); |
723 | 712 | } |
724 | 713 | } |
@@ -725,17 +714,17 @@ | ||
725 | 714 | |
726 | 715 | if (programmer) { |
727 | 716 | 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"); | |
730 | 719 | list_programmers(stderr, " ", programmers); |
731 | - avrdude_message("\n"); | |
720 | + avrdude_message(MSG_INFO, "\n"); | |
732 | 721 | exit(1); |
733 | 722 | } |
734 | 723 | 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"); | |
737 | 726 | list_programmer_types(stderr, " "); |
738 | - avrdude_message("\n"); | |
727 | + avrdude_message(MSG_INFO, "\n"); | |
739 | 728 | exit(1); |
740 | 729 | } |
741 | 730 | } |
@@ -742,10 +731,10 @@ | ||
742 | 731 | |
743 | 732 | |
744 | 733 | 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 " | |
746 | 735 | "or the config file\n", |
747 | 736 | 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", | |
749 | 738 | progbuf); |
750 | 739 | exit(1); |
751 | 740 | } |
@@ -752,12 +741,12 @@ | ||
752 | 741 | |
753 | 742 | pgm = locate_programmer(programmers, programmer); |
754 | 743 | 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", | |
757 | 746 | progname, programmer); |
758 | - avrdude_message("\nValid programmers are:\n"); | |
747 | + avrdude_message(MSG_INFO, "\nValid programmers are:\n"); | |
759 | 748 | list_programmers(stderr, " ", programmers); |
760 | - avrdude_message("\n"); | |
749 | + avrdude_message(MSG_INFO, "\n"); | |
761 | 750 | exit(1); |
762 | 751 | } |
763 | 752 |
@@ -764,7 +753,7 @@ | ||
764 | 753 | if (pgm->initpgm) { |
765 | 754 | pgm->initpgm(pgm); |
766 | 755 | } 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", | |
768 | 757 | progname); |
769 | 758 | exit(1); |
770 | 759 | } |
@@ -778,12 +767,12 @@ | ||
778 | 767 | |
779 | 768 | if (lsize(extended_params) > 0) { |
780 | 769 | 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," | |
782 | 771 | " -x option(s) ignored\n", |
783 | 772 | progname); |
784 | 773 | } else { |
785 | 774 | 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", | |
787 | 776 | progname); |
788 | 777 | exit(1); |
789 | 778 | } |
@@ -808,11 +797,11 @@ | ||
808 | 797 | } |
809 | 798 | |
810 | 799 | 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", | |
812 | 801 | progname); |
813 | - avrdude_message("Valid parts are:\n"); | |
802 | + avrdude_message(MSG_INFO, "Valid parts are:\n"); | |
814 | 803 | list_parts(stderr, " ", part_list); |
815 | - avrdude_message("\n"); | |
804 | + avrdude_message(MSG_INFO, "\n"); | |
816 | 805 | exit(1); |
817 | 806 | } |
818 | 807 |
@@ -819,11 +808,11 @@ | ||
819 | 808 | |
820 | 809 | p = locate_part(part_list, partdesc); |
821 | 810 | 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", | |
823 | 812 | progname, partdesc); |
824 | - avrdude_message("Valid parts are:\n"); | |
813 | + avrdude_message(MSG_INFO, "Valid parts are:\n"); | |
825 | 814 | list_parts(stderr, " ", part_list); |
826 | - avrdude_message("\n"); | |
815 | + avrdude_message(MSG_INFO, "\n"); | |
827 | 816 | exit(1); |
828 | 817 | } |
829 | 818 |
@@ -830,7 +819,7 @@ | ||
830 | 819 | |
831 | 820 | if (exitspecs != NULL) { |
832 | 821 | 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", | |
834 | 823 | progname); |
835 | 824 | exitspecs = NULL; |
836 | 825 | } |
@@ -865,7 +854,7 @@ | ||
865 | 854 | |
866 | 855 | if (avr_initmem(p) != 0) |
867 | 856 | { |
868 | - avrdude_message("\n%s: failed to initialize memories\n", | |
857 | + avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n", | |
869 | 858 | progname); |
870 | 859 | exit(1); |
871 | 860 | } |
@@ -880,14 +869,12 @@ | ||
880 | 869 | upd = ldata(ln); |
881 | 870 | if (upd->memtype == NULL) { |
882 | 871 | 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); | |
889 | 876 | 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); | |
891 | 878 | exit(1); |
892 | 879 | } |
893 | 880 | } |
@@ -897,42 +884,36 @@ | ||
897 | 884 | * open the programmer |
898 | 885 | */ |
899 | 886 | 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 " | |
901 | 888 | "or the config file\n", |
902 | 889 | 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", | |
904 | 891 | progbuf); |
905 | 892 | exit(1); |
906 | 893 | } |
907 | 894 | |
908 | 895 | 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); | |
911 | 898 | 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"); | |
915 | 902 | } |
916 | 903 | } |
917 | 904 | |
918 | 905 | 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); | |
922 | 907 | pgm->baudrate = baudrate; |
923 | 908 | } |
924 | 909 | |
925 | 910 | 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); | |
929 | 912 | pgm->bitclock = bitclock * 1e-6; |
930 | 913 | } |
931 | 914 | |
932 | 915 | 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); | |
936 | 917 | pgm->ispdelay = ispdelay; |
937 | 918 | } |
938 | 919 |
@@ -950,15 +931,15 @@ | ||
950 | 931 | * as outlined in appnote AVR053 |
951 | 932 | */ |
952 | 933 | 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", | |
954 | 935 | progname); |
955 | 936 | exitrc = 1; |
956 | 937 | } else { |
957 | - avrdude_message("%s: performing RC oscillator calibration\n", progname); | |
938 | + avrdude_message(MSG_INFO, "%s: performing RC oscillator calibration\n", progname); | |
958 | 939 | exitrc = pgm->perform_osccal(pgm); |
959 | 940 | } |
960 | 941 | 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", | |
962 | 943 | progname); |
963 | 944 | } |
964 | 945 | goto main_exit; |
@@ -966,12 +947,12 @@ | ||
966 | 947 | |
967 | 948 | if (verbose) { |
968 | 949 | avr_display(stderr, p, progbuf, verbose); |
969 | - avrdude_message("\n"); | |
950 | + avrdude_message(MSG_NOTICE, "\n"); | |
970 | 951 | programmer_display(pgm, progbuf); |
971 | 952 | } |
972 | 953 | |
973 | 954 | if (quell_progress < 2) { |
974 | - avrdude_message("\n"); | |
955 | + avrdude_message(MSG_INFO, "\n"); | |
975 | 956 | } |
976 | 957 | |
977 | 958 | exitrc = 0; |
@@ -994,9 +975,9 @@ | ||
994 | 975 | */ |
995 | 976 | init_ok = (rc = pgm->initialize(pgm, p)) >= 0; |
996 | 977 | 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); | |
998 | 979 | if (!ovsigck) { |
999 | - avrdude_message("%sDouble check connections and try again, " | |
980 | + avrdude_message(MSG_INFO, "%sDouble check connections and try again, " | |
1000 | 981 | "or use -F to override\n" |
1001 | 982 | "%sthis check.\n\n", |
1002 | 983 | progbuf, progbuf); |
@@ -1009,7 +990,7 @@ | ||
1009 | 990 | pgm->rdy_led(pgm, ON); |
1010 | 991 | |
1011 | 992 | 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", | |
1013 | 994 | progname); |
1014 | 995 | } |
1015 | 996 |
@@ -1028,7 +1009,7 @@ | ||
1028 | 1009 | if (init_ok) { |
1029 | 1010 | rc = avr_signature(pgm, p); |
1030 | 1011 | 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", | |
1032 | 1013 | progname, rc); |
1033 | 1014 | exitrc = 1; |
1034 | 1015 | goto main_exit; |
@@ -1037,7 +1018,7 @@ | ||
1037 | 1018 | |
1038 | 1019 | sig = avr_locate_mem(p, "signature"); |
1039 | 1020 | 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", | |
1041 | 1022 | progname, p->desc); |
1042 | 1023 | } |
1043 | 1024 |
@@ -1045,12 +1026,12 @@ | ||
1045 | 1026 | int ff, zz; |
1046 | 1027 | |
1047 | 1028 | if (quell_progress < 2) { |
1048 | - avrdude_message("%s: Device signature = 0x", progname); | |
1029 | + avrdude_message(MSG_INFO, "%s: Device signature = 0x", progname); | |
1049 | 1030 | } |
1050 | 1031 | ff = zz = 1; |
1051 | 1032 | for (i=0; i<sig->size; i++) { |
1052 | 1033 | if (quell_progress < 2) { |
1053 | - avrdude_message("%02x", sig->buf[i]); | |
1034 | + avrdude_message(MSG_INFO, "%02x", sig->buf[i]); | |
1054 | 1035 | } |
1055 | 1036 | if (sig->buf[i] != 0xff) |
1056 | 1037 | ff = 0; |
@@ -1061,16 +1042,16 @@ | ||
1061 | 1042 | if (++attempt < 3) { |
1062 | 1043 | waittime *= 5; |
1063 | 1044 | if (quell_progress < 2) { |
1064 | - avrdude_message(" (retrying)\n"); | |
1045 | + avrdude_message(MSG_INFO, " (retrying)\n"); | |
1065 | 1046 | } |
1066 | 1047 | goto sig_again; |
1067 | 1048 | } |
1068 | 1049 | if (quell_progress < 2) { |
1069 | - avrdude_message("\n"); | |
1050 | + avrdude_message(MSG_INFO, "\n"); | |
1070 | 1051 | } |
1071 | - avrdude_message("%s: Yikes! Invalid device signature.\n", progname); | |
1052 | + avrdude_message(MSG_INFO, "%s: Yikes! Invalid device signature.\n", progname); | |
1072 | 1053 | if (!ovsigck) { |
1073 | - avrdude_message("%sDouble check connections and try again, " | |
1054 | + avrdude_message(MSG_INFO, "%sDouble check connections and try again, " | |
1074 | 1055 | "or use -F to override\n" |
1075 | 1056 | "%sthis check.\n\n", |
1076 | 1057 | progbuf, progbuf); |
@@ -1079,7 +1060,7 @@ | ||
1079 | 1060 | } |
1080 | 1061 | } else { |
1081 | 1062 | if (quell_progress < 2) { |
1082 | - avrdude_message("\n"); | |
1063 | + avrdude_message(MSG_INFO, "\n"); | |
1083 | 1064 | } |
1084 | 1065 | } |
1085 | 1066 |
@@ -1087,11 +1068,11 @@ | ||
1087 | 1068 | sig->buf[0] != p->signature[0] || |
1088 | 1069 | sig->buf[1] != p->signature[1] || |
1089 | 1070 | 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", | |
1091 | 1072 | progname, p->desc, |
1092 | 1073 | p->signature[0], p->signature[1], p->signature[2]); |
1093 | 1074 | if (!ovsigck) { |
1094 | - avrdude_message("%sDouble check chip, " | |
1075 | + avrdude_message(MSG_INFO, "%sDouble check chip, " | |
1095 | 1076 | "or use -F to override this check.\n", |
1096 | 1077 | progbuf); |
1097 | 1078 | exitrc = 1; |
@@ -1106,7 +1087,7 @@ | ||
1106 | 1087 | and extended fuse bytes as needed */ |
1107 | 1088 | |
1108 | 1089 | rc = safemode_readfuses(&safemode_lfuse, &safemode_hfuse, |
1109 | - &safemode_efuse, &safemode_fuse, pgm, p, verbose); | |
1090 | + &safemode_efuse, &safemode_fuse, pgm, p); | |
1110 | 1091 | |
1111 | 1092 | if (rc != 0) { |
1112 | 1093 |
@@ -1113,17 +1094,13 @@ | ||
1113 | 1094 | //Check if the programmer just doesn't support reading |
1114 | 1095 | if (rc == -5) |
1115 | 1096 | { |
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); | |
1122 | 1099 | } |
1123 | 1100 | else |
1124 | 1101 | { |
1125 | 1102 | |
1126 | - avrdude_message("%s: safemode: To protect your AVR the programming " | |
1103 | + avrdude_message(MSG_INFO, "%s: safemode: To protect your AVR the programming " | |
1127 | 1104 | "will be aborted\n", |
1128 | 1105 | progname); |
1129 | 1106 | exitrc = 1; |
@@ -1139,7 +1116,7 @@ | ||
1139 | 1116 | if ((p->flags & AVRPART_HAS_PDI) && pgm->page_erase != NULL && |
1140 | 1117 | lsize(updates) > 0) { |
1141 | 1118 | 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" | |
1143 | 1120 | "%sEach page will be erased before programming it, but no chip erase is performed.\n" |
1144 | 1121 | "%sTo disable page erases, specify the -D option; for a chip-erase, use the -e option.\n", |
1145 | 1122 | progname, progbuf, progbuf); |
@@ -1157,7 +1134,7 @@ | ||
1157 | 1134 | if ((strcasecmp(m->desc, memname) == 0) && (upd->op == DEVICE_WRITE)) { |
1158 | 1135 | erase = 1; |
1159 | 1136 | 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 " | |
1161 | 1138 | "will be performed\n" |
1162 | 1139 | "%sTo disable this feature, specify the -D option.\n", |
1163 | 1140 | progname, memname, progbuf); |
@@ -1174,11 +1151,11 @@ | ||
1174 | 1151 | * before the chip can accept new programming |
1175 | 1152 | */ |
1176 | 1153 | 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", | |
1178 | 1155 | progname); |
1179 | 1156 | } else { |
1180 | 1157 | if (quell_progress < 2) { |
1181 | - avrdude_message("%s: erasing chip\n", progname); | |
1158 | + avrdude_message(MSG_INFO, "%s: erasing chip\n", progname); | |
1182 | 1159 | } |
1183 | 1160 | exitrc = avr_chip_erase(pgm, p); |
1184 | 1161 | if(exitrc) goto main_exit; |
@@ -1223,7 +1200,7 @@ | ||
1223 | 1200 | char yes[1] = {'y'}; |
1224 | 1201 | |
1225 | 1202 | if (quell_progress < 2) { |
1226 | - avrdude_message("\n"); | |
1203 | + avrdude_message(MSG_INFO, "\n"); | |
1227 | 1204 | } |
1228 | 1205 | |
1229 | 1206 | //Restore the default fuse values |
@@ -1231,11 +1208,11 @@ | ||
1231 | 1208 | |
1232 | 1209 | /* Try reading back fuses, make sure they are reliable to read back */ |
1233 | 1210 | if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse, |
1234 | - &safemodeafter_efuse, &safemodeafter_fuse, pgm, p, verbose) != 0) { | |
1211 | + &safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) { | |
1235 | 1212 | /* Uh-oh.. try once more to read back fuses */ |
1236 | 1213 | 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. " | |
1239 | 1216 | "I have given up and exited programming mode\n", |
1240 | 1217 | progname); |
1241 | 1218 | exitrc = 1; |
@@ -1246,7 +1223,7 @@ | ||
1246 | 1223 | /* Now check what fuses are against what they should be */ |
1247 | 1224 | if (safemodeafter_fuse != safemode_fuse) { |
1248 | 1225 | 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", | |
1250 | 1227 | progname, safemode_fuse, safemodeafter_fuse); |
1251 | 1228 | |
1252 | 1229 |
@@ -1261,11 +1238,11 @@ | ||
1261 | 1238 | |
1262 | 1239 | /* Enough chit-chat, time to program some fuses and check them */ |
1263 | 1240 | 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); | |
1266 | 1243 | } |
1267 | 1244 | 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); | |
1269 | 1246 | failures++; |
1270 | 1247 | } |
1271 | 1248 | } |
@@ -1274,7 +1251,7 @@ | ||
1274 | 1251 | /* Now check what fuses are against what they should be */ |
1275 | 1252 | if (safemodeafter_lfuse != safemode_lfuse) { |
1276 | 1253 | 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", | |
1278 | 1255 | progname, safemode_lfuse, safemodeafter_lfuse); |
1279 | 1256 | |
1280 | 1257 |
@@ -1289,11 +1266,11 @@ | ||
1289 | 1266 | |
1290 | 1267 | /* Enough chit-chat, time to program some fuses and check them */ |
1291 | 1268 | 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); | |
1294 | 1271 | } |
1295 | 1272 | 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); | |
1297 | 1274 | failures++; |
1298 | 1275 | } |
1299 | 1276 | } |
@@ -1302,7 +1279,7 @@ | ||
1302 | 1279 | /* Now check what fuses are against what they should be */ |
1303 | 1280 | if (safemodeafter_hfuse != safemode_hfuse) { |
1304 | 1281 | 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", | |
1306 | 1283 | progname, safemode_hfuse, safemodeafter_hfuse); |
1307 | 1284 | |
1308 | 1285 | /* Ask user - should we change them */ |
@@ -1314,11 +1291,11 @@ | ||
1314 | 1291 | |
1315 | 1292 | /* Enough chit-chat, time to program some fuses and check them */ |
1316 | 1293 | 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); | |
1319 | 1296 | } |
1320 | 1297 | 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); | |
1322 | 1299 | failures++; |
1323 | 1300 | } |
1324 | 1301 | } |
@@ -1327,7 +1304,7 @@ | ||
1327 | 1304 | /* Now check what fuses are against what they should be */ |
1328 | 1305 | if (safemodeafter_efuse != safemode_efuse) { |
1329 | 1306 | 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", | |
1331 | 1308 | progname, safemode_efuse, safemodeafter_efuse); |
1332 | 1309 | |
1333 | 1310 | /* Ask user - should we change them */ |
@@ -1339,11 +1316,11 @@ | ||
1339 | 1316 | |
1340 | 1317 | /* Enough chit-chat, time to program some fuses and check them */ |
1341 | 1318 | 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); | |
1344 | 1321 | } |
1345 | 1322 | 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); | |
1347 | 1324 | failures++; |
1348 | 1325 | } |
1349 | 1326 | } |
@@ -1350,13 +1327,13 @@ | ||
1350 | 1327 | } |
1351 | 1328 | |
1352 | 1329 | if (quell_progress < 2) { |
1353 | - avrdude_message("%s: safemode: ", progname); | |
1330 | + avrdude_message(MSG_INFO, "%s: safemode: ", progname); | |
1354 | 1331 | 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", | |
1356 | 1333 | safemode_efuse, safemode_hfuse, safemode_lfuse); |
1357 | 1334 | } |
1358 | 1335 | else { |
1359 | - avrdude_message("Fuses not recovered, sorry\n"); | |
1336 | + avrdude_message(MSG_INFO, "Fuses not recovered, sorry\n"); | |
1360 | 1337 | } |
1361 | 1338 | } |
1362 | 1339 |
@@ -1384,7 +1361,7 @@ | ||
1384 | 1361 | } |
1385 | 1362 | |
1386 | 1363 | 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); | |
1388 | 1365 | } |
1389 | 1366 | |
1390 | 1367 | return exitrc; |
@@ -241,7 +241,7 @@ | ||
241 | 241 | |
242 | 242 | ppi_open(port, &pgm->fd); |
243 | 243 | 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", | |
245 | 245 | progname, port); |
246 | 246 | return -1; |
247 | 247 | } |
@@ -251,7 +251,7 @@ | ||
251 | 251 | */ |
252 | 252 | rc = ppi_getall(&pgm->fd, PPIDATA); |
253 | 253 | 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); | |
255 | 255 | return -1; |
256 | 256 | } |
257 | 257 | pgm->ppidata = rc; |
@@ -258,7 +258,7 @@ | ||
258 | 258 | |
259 | 259 | rc = ppi_getall(&pgm->fd, PPICTRL); |
260 | 260 | 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); | |
262 | 262 | return -1; |
263 | 263 | } |
264 | 264 | pgm->ppictrl = rc; |
@@ -402,7 +402,7 @@ | ||
402 | 402 | |
403 | 403 | void par_initpgm(PROGRAMMER * pgm) |
404 | 404 | { |
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", | |
406 | 406 | progname); |
407 | 407 | } |
408 | 408 |
@@ -39,7 +39,7 @@ | ||
39 | 39 | |
40 | 40 | static int pgm_default_open (struct programmer_t *pgm, char * name) |
41 | 41 | { |
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()", | |
43 | 43 | progname); |
44 | 44 | return -1; |
45 | 45 | } |
@@ -68,7 +68,7 @@ | ||
68 | 68 | |
69 | 69 | pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); |
70 | 70 | 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", | |
72 | 72 | progname); |
73 | 73 | exit(1); |
74 | 74 | } |
@@ -159,7 +159,7 @@ | ||
159 | 159 | |
160 | 160 | pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); |
161 | 161 | 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", | |
163 | 163 | progname); |
164 | 164 | exit(1); |
165 | 165 | } |
@@ -172,7 +172,7 @@ | ||
172 | 172 | for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { |
173 | 173 | int *ip = malloc(sizeof(int)); |
174 | 174 | 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", | |
176 | 176 | progname); |
177 | 177 | exit(1); |
178 | 178 | } |
@@ -186,7 +186,7 @@ | ||
186 | 186 | |
187 | 187 | static void pgm_default(void) |
188 | 188 | { |
189 | - avrdude_message("%s: programmer operation not supported\n", progname); | |
189 | + avrdude_message(MSG_INFO, "%s: programmer operation not supported\n", progname); | |
190 | 190 | } |
191 | 191 | |
192 | 192 |
@@ -223,8 +223,8 @@ | ||
223 | 223 | |
224 | 224 | void programmer_display(PROGRAMMER * pgm, const char * p) |
225 | 225 | { |
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); | |
228 | 228 | |
229 | 229 | pgm->display(pgm, p); |
230 | 230 | } |
@@ -233,25 +233,25 @@ | ||
233 | 233 | void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show) |
234 | 234 | { |
235 | 235 | 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])); | |
237 | 237 | 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])); | |
239 | 239 | 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])); | |
241 | 241 | 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])); | |
243 | 243 | 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])); | |
245 | 245 | 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])); | |
247 | 247 | 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])); | |
249 | 249 | 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])); | |
251 | 251 | 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])); | |
253 | 253 | 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])); | |
255 | 255 | } |
256 | 256 | |
257 | 257 | void pgm_display_generic(PROGRAMMER * pgm, const char * p) |
@@ -75,13 +75,13 @@ | ||
75 | 75 | #endif |
76 | 76 | |
77 | 77 | #if 0 |
78 | -#define DEBUG(...) do { avrdude_message(__VA_ARGS__); } while(0) | |
78 | +#define DEBUG(...) do { avrdude_message(MSG_INFO, __VA_ARGS__); } while(0) | |
79 | 79 | #else |
80 | 80 | #define DEBUG(...) ((void)0) |
81 | 81 | #endif |
82 | 82 | |
83 | 83 | #if 0 |
84 | -#define DEBUGRECV(...) do { avrdude_message(__VA_ARGS__); } while(0) | |
84 | +#define DEBUGRECV(...) do { avrdude_message(MSG_INFO, __VA_ARGS__); } while(0) | |
85 | 85 | #else |
86 | 86 | #define DEBUGRECV(...) ((void)0) |
87 | 87 | #endif |
@@ -168,7 +168,7 @@ | ||
168 | 168 | { |
169 | 169 | if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) |
170 | 170 | { |
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", | |
172 | 172 | progname); |
173 | 173 | exit(1); |
174 | 174 | } |
@@ -191,7 +191,7 @@ | ||
191 | 191 | if (PDATA(pgm)->usb_handle == INVALID_HANDLE_VALUE) |
192 | 192 | { |
193 | 193 | /* 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", | |
195 | 195 | progname, PICKIT2_VID, PICKIT2_PID); |
196 | 196 | return -1; |
197 | 197 | } |
@@ -212,7 +212,7 @@ | ||
212 | 212 | if (usb_open_device(&(PDATA(pgm)->usb_handle), PICKIT2_VID, PICKIT2_PID) < 0) |
213 | 213 | { |
214 | 214 | /* 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", | |
216 | 216 | progname, PICKIT2_VID, PICKIT2_PID); |
217 | 217 | return -1; |
218 | 218 | } |
@@ -261,10 +261,7 @@ | ||
261 | 261 | memset(report, 0, sizeof(report)); |
262 | 262 | if ((errorCode = pickit2_read_report(pgm, report)) >= 4) |
263 | 263 | { |
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]); | |
268 | 265 | |
269 | 266 | // set the pins, apply reset, |
270 | 267 | // TO DO: apply vtarget (if requested though -x option) |
@@ -299,19 +296,19 @@ | ||
299 | 296 | |
300 | 297 | if (pickit2_write_report(pgm, report) < 0) |
301 | 298 | { |
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()); | |
303 | 300 | return -1; |
304 | 301 | } |
305 | 302 | } |
306 | 303 | else |
307 | 304 | { |
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()); | |
309 | 306 | return -1; |
310 | 307 | } |
311 | 308 | } |
312 | 309 | else |
313 | 310 | { |
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()); | |
315 | 312 | return -1; |
316 | 313 | } |
317 | 314 |
@@ -424,7 +421,7 @@ | ||
424 | 421 | |
425 | 422 | if (p->op[AVR_OP_PGM_ENABLE] == NULL) |
426 | 423 | { |
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", | |
428 | 425 | p->desc); |
429 | 426 | return -1; |
430 | 427 | } |
@@ -436,13 +433,13 @@ | ||
436 | 433 | if (verbose) |
437 | 434 | { |
438 | 435 | int i; |
439 | - avrdude_message("program_enable(): sending command. Resp = "); | |
436 | + avrdude_message(MSG_NOTICE, "program_enable(): sending command. Resp = "); | |
440 | 437 | |
441 | 438 | for (i = 0; i < 4; i++) |
442 | 439 | { |
443 | - avrdude_message("%x ", (int)res[i]); | |
440 | + avrdude_message(MSG_NOTICE, "%x ", (int)res[i]); | |
444 | 441 | } |
445 | - avrdude_message("\n"); | |
442 | + avrdude_message(MSG_NOTICE, "\n"); | |
446 | 443 | } |
447 | 444 | |
448 | 445 | // check for sync character |
@@ -459,7 +456,7 @@ | ||
459 | 456 | |
460 | 457 | if (p->op[AVR_OP_CHIP_ERASE] == NULL) |
461 | 458 | { |
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", | |
463 | 460 | p->desc); |
464 | 461 | return -1; |
465 | 462 | } |
@@ -536,7 +533,7 @@ | ||
536 | 533 | } |
537 | 534 | else |
538 | 535 | { |
539 | - avrdude_message("no read command specified\n"); | |
536 | + avrdude_message(MSG_INFO, "no read command specified\n"); | |
540 | 537 | return -1; |
541 | 538 | } |
542 | 539 |
@@ -548,7 +545,7 @@ | ||
548 | 545 | |
549 | 546 | if (bytes_read < 0) |
550 | 547 | { |
551 | - avrdude_message("Failed @ pgm->spi()\n"); | |
548 | + avrdude_message(MSG_INFO, "Failed @ pgm->spi()\n"); | |
552 | 549 | pgm->err_led(pgm, ON); |
553 | 550 | return -1; |
554 | 551 | } |
@@ -582,7 +579,7 @@ | ||
582 | 579 | wp = mem->op[AVR_OP_WRITEPAGE]; |
583 | 580 | if (wp == NULL) |
584 | 581 | { |
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", | |
586 | 583 | mem->desc); |
587 | 584 | return -1; |
588 | 585 | } |
@@ -630,7 +627,7 @@ | ||
630 | 627 | // only paged write for flash implemented |
631 | 628 | if (strcmp(mem->desc, "flash") != 0 && strcmp(mem->desc, "eeprom") != 0) |
632 | 629 | { |
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); | |
634 | 631 | return -1; |
635 | 632 | } |
636 | 633 |
@@ -687,7 +684,7 @@ | ||
687 | 684 | writeop = mem->op[AVR_OP_WRITE_LO]; |
688 | 685 | caddr = addr; // maybe this should divide by 2 & use the write_high opcode also |
689 | 686 | |
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"); | |
691 | 688 | return -1; |
692 | 689 | } |
693 | 690 | else |
@@ -712,7 +709,7 @@ | ||
712 | 709 | |
713 | 710 | if (bytes_read < 0) |
714 | 711 | { |
715 | - avrdude_message("Failed @ pgm->spi()\n"); | |
712 | + avrdude_message(MSG_INFO, "Failed @ pgm->spi()\n"); | |
716 | 713 | pgm->err_led(pgm, ON); |
717 | 714 | return -1; |
718 | 715 | } |
@@ -1154,7 +1151,7 @@ | ||
1154 | 1151 | if (handle == NULL) |
1155 | 1152 | { |
1156 | 1153 | 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()); | |
1158 | 1155 | continue; |
1159 | 1156 | } |
1160 | 1157 |
@@ -1161,20 +1158,17 @@ | ||
1161 | 1158 | // return with opened device handle |
1162 | 1159 | else |
1163 | 1160 | { |
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); | |
1168 | 1162 | |
1169 | 1163 | if ((errorCode = usb_set_configuration(handle, 1)) < 0) |
1170 | 1164 | { |
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" | |
1172 | 1166 | "You may need to run avrdude as root or set up correct usb port permissions.", errorCode, usb_strerror()); |
1173 | 1167 | } |
1174 | 1168 | |
1175 | 1169 | if ((errorCode = usb_claim_interface(handle, 0)) < 0) |
1176 | 1170 | { |
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" | |
1178 | 1172 | "You may need to run avrdude as root or set up correct usb port permissions.", errorCode, usb_strerror()); |
1179 | 1173 | } |
1180 | 1174 |
@@ -1217,7 +1211,7 @@ | ||
1217 | 1211 | int clock_rate; |
1218 | 1212 | if (sscanf(extended_param, "clockrate=%i", &clock_rate) != 1 || clock_rate <= 0) |
1219 | 1213 | { |
1220 | - avrdude_message("%s: pickit2_parseextparms(): invalid clockrate '%s'\n", | |
1214 | + avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid clockrate '%s'\n", | |
1221 | 1215 | progname, extended_param); |
1222 | 1216 | rv = -1; |
1223 | 1217 | continue; |
@@ -1226,11 +1220,8 @@ | ||
1226 | 1220 | int clock_period = MIN(1000000 / clock_rate, 255); // max period is 255 |
1227 | 1221 | clock_rate = (int)(1000000 / (clock_period + 5e-7)); // assume highest speed is 2MHz - should probably check this |
1228 | 1222 | |
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", | |
1232 | 1224 | progname, clock_rate); |
1233 | - } | |
1234 | 1225 | PDATA(pgm)->clock_period = clock_period; |
1235 | 1226 | |
1236 | 1227 | continue; |
@@ -1241,23 +1232,20 @@ | ||
1241 | 1232 | int timeout; |
1242 | 1233 | if (sscanf(extended_param, "timeout=%i", &timeout) != 1 || timeout <= 0) |
1243 | 1234 | { |
1244 | - avrdude_message("%s: pickit2_parseextparms(): invalid timeout '%s'\n", | |
1235 | + avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid timeout '%s'\n", | |
1245 | 1236 | progname, extended_param); |
1246 | 1237 | rv = -1; |
1247 | 1238 | continue; |
1248 | 1239 | } |
1249 | 1240 | |
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", | |
1253 | 1242 | progname, timeout); |
1254 | - } | |
1255 | 1243 | PDATA(pgm)->transaction_timeout = timeout; |
1256 | 1244 | |
1257 | 1245 | continue; |
1258 | 1246 | } |
1259 | 1247 | |
1260 | - avrdude_message("%s: pickit2_parseextparms(): invalid extended parameter '%s'\n", | |
1248 | + avrdude_message(MSG_INFO, "%s: pickit2_parseextparms(): invalid extended parameter '%s'\n", | |
1261 | 1249 | progname, extended_param); |
1262 | 1250 | rv = -1; |
1263 | 1251 | } |
@@ -1323,7 +1311,7 @@ | ||
1323 | 1311 | } |
1324 | 1312 | #else |
1325 | 1313 | static int pickit2_nousb_open (struct programmer_t *pgm, char * name) { |
1326 | - avrdude_message( | |
1314 | + avrdude_message(MSG_INFO, | |
1327 | 1315 | #ifdef WIN32NATIVE |
1328 | 1316 | "%s: error: no usb or hid support. Please compile again with libusb or HID support from Win32 DDK installed.\n", |
1329 | 1317 | #else |
@@ -63,7 +63,7 @@ | ||
63 | 63 | for(i = 0; i < PIN_MAX; i++) { |
64 | 64 | if(pindef->mask[i / PIN_FIELD_ELEMENT_SIZE] & (1 << (i % PIN_FIELD_ELEMENT_SIZE))) { |
65 | 65 | if(found) { |
66 | - avrdude_message("Multiple pins found\n"); //TODO | |
66 | + avrdude_message(MSG_INFO, "Multiple pins found\n"); //TODO | |
67 | 67 | return -1; |
68 | 68 | } |
69 | 69 | found = true; |
@@ -88,7 +88,7 @@ | ||
88 | 88 | for(i = 0; i < PIN_FIELD_SIZE; i++) { |
89 | 89 | if(i == 0) { |
90 | 90 | 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"); | |
92 | 92 | return -1; |
93 | 93 | } |
94 | 94 | if (pindef->mask[i] == 0) { |
@@ -100,11 +100,11 @@ | ||
100 | 100 | } else if(pindef->mask[i] == ((~pindef->inverse[i]) & pindef->mask[i])) { /* all set bits in mask are cleared in inverse */ |
101 | 101 | *pinno = pindef->mask[i]; |
102 | 102 | } else { |
103 | - avrdude_message("pins have different polarity set\n"); | |
103 | + avrdude_message(MSG_INFO, "pins have different polarity set\n"); | |
104 | 104 | return -1; |
105 | 105 | } |
106 | 106 | } 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"); | |
108 | 108 | return -1; |
109 | 109 | } |
110 | 110 | } |
@@ -270,29 +270,25 @@ | ||
270 | 270 | } |
271 | 271 | if(invalid) { |
272 | 272 | 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", | |
274 | 274 | 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", | |
277 | 276 | progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->mask)); |
278 | - } | |
279 | 277 | } |
280 | 278 | is_ok = false; |
281 | 279 | } |
282 | 280 | if(inverse) { |
283 | 281 | 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", | |
285 | 283 | 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", | |
288 | 285 | progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->inverse)); |
289 | - } | |
290 | 286 | } |
291 | 287 | is_ok = false; |
292 | 288 | } |
293 | 289 | if(used) { |
294 | 290 | 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", | |
296 | 292 | progname, avr_pin_name(pinname), pinmask_to_str(already_used)); |
297 | 293 | is_ok = false; |
298 | 294 | } |
@@ -299,7 +295,7 @@ | ||
299 | 295 | } |
300 | 296 | if(!mandatory_used && is_mandatory && !invalid) { |
301 | 297 | 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", | |
303 | 299 | progname, avr_pin_name(pinname)); |
304 | 300 | } |
305 | 301 | is_ok = false; |
@@ -306,8 +302,8 @@ | ||
306 | 302 | } |
307 | 303 | if(!is_ok) { |
308 | 304 | 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", | |
311 | 307 | progname, avr_pin_name(pinname)); |
312 | 308 | } |
313 | 309 | } |
@@ -68,7 +68,7 @@ | ||
68 | 68 | shadow_num = 2; |
69 | 69 | break; |
70 | 70 | default: |
71 | - avrdude_message("%s: avr_set(): invalid register=%d\n", | |
71 | + avrdude_message(MSG_INFO, "%s: avr_set(): invalid register=%d\n", | |
72 | 72 | progname, reg); |
73 | 73 | return -1; |
74 | 74 | break; |
@@ -205,7 +205,7 @@ | ||
205 | 205 | |
206 | 206 | fd = open(port, O_RDWR); |
207 | 207 | 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", | |
209 | 209 | progname, port, strerror(errno)); |
210 | 210 | fdp->ifd = -1; |
211 | 211 | return; |
@@ -92,7 +92,7 @@ | ||
92 | 92 | |
93 | 93 | if(fd < 0) |
94 | 94 | { |
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); | |
96 | 96 | fdp->ifd = -1; |
97 | 97 | return; |
98 | 98 | } |
@@ -120,7 +120,7 @@ | ||
120 | 120 | fd = strtol(port, &cp, 0); |
121 | 121 | if(*port == '\0' || *cp != '\0') |
122 | 122 | { |
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", | |
124 | 124 | progname, port); |
125 | 125 | fd = -1; |
126 | 126 | } |
@@ -127,7 +127,7 @@ | ||
127 | 127 | } |
128 | 128 | if(fd < 0) |
129 | 129 | { |
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); | |
131 | 131 | fdp->ifd = -1; |
132 | 132 | return; |
133 | 133 | } |
@@ -361,7 +361,7 @@ | ||
361 | 361 | unsigned long dt; \ |
362 | 362 | dt = (unsigned long)((stop.QuadPart - start.QuadPart) * 1000 * 1000 \ |
363 | 363 | / freq.QuadPart); \ |
364 | - avrdude_message(\ | |
364 | + avrdude_message(MSG_INFO, \ | |
365 | 365 | "hpt:%i usleep usec:%lu sleep msec:%lu timed usec:%lu\n", \ |
366 | 366 | has_highperf, us, ((us + 999) / 1000), dt); \ |
367 | 367 | } while (0) |
@@ -33,7 +33,7 @@ | ||
33 | 33 | * before giving up |
34 | 34 | */ |
35 | 35 | int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm, |
36 | - AVRPART * p, int tries, int verbose) | |
36 | + AVRPART * p, int tries) | |
37 | 37 | { |
38 | 38 | AVRMEM * m; |
39 | 39 | unsigned char fuseread; |
@@ -56,10 +56,8 @@ | ||
56 | 56 | } |
57 | 57 | |
58 | 58 | /* 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", | |
61 | 60 | progname, fusename, fuse, fuseread, tries-1); |
62 | - } | |
63 | 61 | |
64 | 62 | /* If fuse wrote OK, no need to keep going */ |
65 | 63 | if (fuse == fuseread) { |
@@ -78,7 +76,7 @@ | ||
78 | 76 | */ |
79 | 77 | int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, |
80 | 78 | unsigned char * efuse, unsigned char * fuse, |
81 | - PROGRAMMER * pgm, AVRPART * p, int verbose) | |
79 | + PROGRAMMER * pgm, AVRPART * p) | |
82 | 80 | { |
83 | 81 | |
84 | 82 | unsigned char value; |
@@ -106,27 +104,18 @@ | ||
106 | 104 | { |
107 | 105 | allowfuseread = 0; |
108 | 106 | } |
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); | |
113 | 108 | if(pgm->read_byte(pgm, p, m, 0, &value) != 0) |
114 | 109 | { |
115 | 110 | allowfuseread = 0; |
116 | 111 | } |
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); | |
121 | 113 | if (value == safemode_fuse) { |
122 | 114 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
123 | 115 | { |
124 | 116 | allowfuseread = 0; |
125 | 117 | } |
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); | |
130 | 119 | if (value == safemode_fuse) |
131 | 120 | { |
132 | 121 | fusegood = 1; /* Fuse read OK three times */ |
@@ -141,12 +130,12 @@ | ||
141 | 130 | } |
142 | 131 | |
143 | 132 | 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. " | |
145 | 134 | "Programmer may not be reliable.\n", progname); |
146 | 135 | return -1; |
147 | 136 | } |
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); | |
150 | 139 | } |
151 | 140 | |
152 | 141 |
@@ -160,27 +149,18 @@ | ||
160 | 149 | { |
161 | 150 | allowfuseread = 0; |
162 | 151 | } |
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); | |
167 | 153 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
168 | 154 | { |
169 | 155 | allowfuseread = 0; |
170 | 156 | } |
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); | |
175 | 158 | if (value == safemode_lfuse) { |
176 | 159 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
177 | 160 | { |
178 | 161 | allowfuseread = 0; |
179 | 162 | } |
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); | |
184 | 164 | if (value == safemode_lfuse){ |
185 | 165 | fusegood = 1; /* Fuse read OK three times */ |
186 | 166 | } |
@@ -195,12 +175,12 @@ | ||
195 | 175 | |
196 | 176 | |
197 | 177 | 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. " | |
199 | 179 | "Programmer may not be reliable.\n", progname); |
200 | 180 | return -1; |
201 | 181 | } |
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); | |
204 | 184 | } |
205 | 185 | |
206 | 186 | /* Read hfuse three times */ |
@@ -213,27 +193,18 @@ | ||
213 | 193 | { |
214 | 194 | allowfuseread = 0; |
215 | 195 | } |
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); | |
220 | 197 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
221 | 198 | { |
222 | 199 | allowfuseread = 0; |
223 | 200 | } |
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); | |
228 | 202 | if (value == safemode_hfuse) { |
229 | 203 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
230 | 204 | { |
231 | 205 | allowfuseread = 0; |
232 | 206 | } |
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); | |
237 | 208 | if (value == safemode_hfuse){ |
238 | 209 | fusegood = 1; /* Fuse read OK three times */ |
239 | 210 | } |
@@ -247,12 +218,12 @@ | ||
247 | 218 | } |
248 | 219 | |
249 | 220 | 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. " | |
251 | 222 | "Programmer may not be reliable.\n", progname); |
252 | 223 | return -2; |
253 | 224 | } |
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); | |
256 | 227 | } |
257 | 228 | |
258 | 229 | /* Read efuse three times */ |
@@ -265,27 +236,18 @@ | ||
265 | 236 | { |
266 | 237 | allowfuseread = 0; |
267 | 238 | } |
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); | |
272 | 240 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
273 | 241 | { |
274 | 242 | allowfuseread = 0; |
275 | 243 | } |
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); | |
280 | 245 | if (value == safemode_efuse) { |
281 | 246 | if (pgm->read_byte(pgm, p, m, 0, &value) != 0) |
282 | 247 | { |
283 | 248 | allowfuseread = 0; |
284 | 249 | } |
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); | |
289 | 251 | if (value == safemode_efuse){ |
290 | 252 | fusegood = 1; /* Fuse read OK three times */ |
291 | 253 | } |
@@ -299,12 +261,12 @@ | ||
299 | 261 | } |
300 | 262 | |
301 | 263 | 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. " | |
303 | 265 | "Programmer may not be reliable.\n", progname); |
304 | 266 | return -3; |
305 | 267 | } |
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); | |
308 | 270 | } |
309 | 271 | |
310 | 272 | *lfuse = safemode_lfuse; |
@@ -313,7 +313,7 @@ | ||
313 | 313 | handle = usb_open(dev); /* we need to open the device in order to query strings */ |
314 | 314 | if(!handle){ |
315 | 315 | 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", | |
317 | 317 | usb_strerror()); |
318 | 318 | continue; |
319 | 319 | } |
@@ -325,21 +325,21 @@ | ||
325 | 325 | 0x0409, string, sizeof(string)); |
326 | 326 | if(len < 0){ |
327 | 327 | 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", | |
329 | 329 | usb_strerror()); |
330 | 330 | }else{ |
331 | 331 | 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); */ | |
333 | 333 | if(strcmp(string, vendorName) == 0){ |
334 | 334 | len = usbGetStringAscii(handle, dev->descriptor.iProduct, |
335 | 335 | 0x0409, string, sizeof(string)); |
336 | 336 | if(len < 0){ |
337 | 337 | 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", | |
339 | 339 | usb_strerror()); |
340 | 340 | }else{ |
341 | 341 | errorCode = USB_ERROR_NOTFOUND; |
342 | - /* avrdude_message("seen product ->%s<-\n", string); */ | |
342 | + /* avrdude_message(MSG_INFO, "seen product ->%s<-\n", string); */ | |
343 | 343 | if(strcmp(string, productName) == 0) |
344 | 344 | break; |
345 | 345 | } |
@@ -355,7 +355,7 @@ | ||
355 | 355 | if(handle != NULL){ |
356 | 356 | int rval, retries = 3; |
357 | 357 | 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", | |
359 | 359 | usb_strerror()); |
360 | 360 | } |
361 | 361 | /* now try to claim the interface and detach the kernel HID driver on |
@@ -364,13 +364,13 @@ | ||
364 | 364 | while((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0){ |
365 | 365 | #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP |
366 | 366 | 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", | |
368 | 368 | usb_strerror()); |
369 | 369 | } |
370 | 370 | #endif |
371 | 371 | } |
372 | 372 | if(rval != 0) |
373 | - avrdude_message("Warning: could not claim interface\n"); | |
373 | + avrdude_message(MSG_INFO, "Warning: could not claim interface\n"); | |
374 | 374 | /* Continue anyway, even if we could not claim the interface. Control transfers |
375 | 375 | * should still work. |
376 | 376 | */ |
@@ -403,7 +403,7 @@ | ||
403 | 403 | reportType << 8 | buffer[0], 0, buffer, len, 5000); |
404 | 404 | if(bytesSent != len){ |
405 | 405 | 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()); | |
407 | 407 | return USB_ERROR_IO; |
408 | 408 | } |
409 | 409 | return 0; |
@@ -424,7 +424,7 @@ | ||
424 | 424 | USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, |
425 | 425 | reportType << 8 | reportNumber, 0, buffer, maxLen, 5000); |
426 | 426 | 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()); | |
428 | 428 | return USB_ERROR_IO; |
429 | 429 | } |
430 | 430 | *len = bytesReceived; |
@@ -448,11 +448,11 @@ | ||
448 | 448 | int i; |
449 | 449 | |
450 | 450 | 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); | |
452 | 452 | for(i = 0; i < len; i++){ |
453 | - avrdude_message("%02x ", buf[i]); | |
453 | + avrdude_message(MSG_INFO, "%02x ", buf[i]); | |
454 | 454 | } |
455 | - avrdude_message(" \""); | |
455 | + avrdude_message(MSG_INFO, " \""); | |
456 | 456 | for(i = 0; i < len; i++){ |
457 | 457 | if(buf[i] >= 0x20 && buf[i] < 0x7f){ |
458 | 458 | fputc(buf[i], stderr); |
@@ -460,20 +460,20 @@ | ||
460 | 460 | fputc('.', stderr); |
461 | 461 | } |
462 | 462 | } |
463 | - avrdude_message("\"\n"); | |
463 | + avrdude_message(MSG_INFO, "\"\n"); | |
464 | 464 | }else{ |
465 | - avrdude_message("%s: %d bytes:\n", prefix, len); | |
465 | + avrdude_message(MSG_INFO, "%s: %d bytes:\n", prefix, len); | |
466 | 466 | while(len > 0){ |
467 | 467 | for(i = 0; i < 16; i++){ |
468 | 468 | if(i < len){ |
469 | - avrdude_message("%02x ", buf[i]); | |
469 | + avrdude_message(MSG_INFO, "%02x ", buf[i]); | |
470 | 470 | }else{ |
471 | - avrdude_message(" "); | |
471 | + avrdude_message(MSG_INFO, " "); | |
472 | 472 | } |
473 | 473 | if(i == 7) |
474 | 474 | fputc(' ', stderr); |
475 | 475 | } |
476 | - avrdude_message(" \""); | |
476 | + avrdude_message(MSG_INFO, " \""); | |
477 | 477 | for(i = 0; i < 16; i++){ |
478 | 478 | if(i < len){ |
479 | 479 | if(buf[i] >= 0x20 && buf[i] < 0x7f){ |
@@ -483,7 +483,7 @@ | ||
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | - avrdude_message("\"\n"); | |
486 | + avrdude_message(MSG_INFO, "\"\n"); | |
487 | 487 | buf += 16; |
488 | 488 | len -= 16; |
489 | 489 | } |
@@ -516,7 +516,7 @@ | ||
516 | 516 | |
517 | 517 | rval = usbOpenDevice(fdp, USB_VENDOR_ID, vname, USB_PRODUCT_ID, devname, 1); |
518 | 518 | 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)); | |
520 | 520 | return -1; |
521 | 521 | } |
522 | 522 | return 0; |
@@ -554,12 +554,11 @@ | ||
554 | 554 | buffer[0] = lenIndex + 1; /* report ID */ |
555 | 555 | buffer[1] = thisLen; |
556 | 556 | 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); | |
559 | 558 | rval = usbSetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, (char *)buffer, |
560 | 559 | reportDataSizes[lenIndex] + 2); |
561 | 560 | 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)); | |
563 | 562 | return -1; |
564 | 563 | } |
565 | 564 | buflen -= thisLen; |
@@ -585,17 +584,16 @@ | ||
585 | 584 | usbErr = usbGetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, lenIndex + 1, |
586 | 585 | (char *)buffer, &len); |
587 | 586 | 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)); | |
589 | 588 | return -1; |
590 | 589 | } |
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]); | |
593 | 591 | len -= 2; /* compensate for report ID and length byte */ |
594 | 592 | bytesPending = buffer[1] - len; /* amount still buffered */ |
595 | 593 | if(len > buffer[1]) /* cut away padding */ |
596 | 594 | len = buffer[1]; |
597 | 595 | 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", | |
599 | 597 | progname); |
600 | 598 | return -1; |
601 | 599 | } |
@@ -643,7 +641,7 @@ | ||
643 | 641 | |
644 | 642 | static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on) |
645 | 643 | { |
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); | |
647 | 645 | return -1; |
648 | 646 | } |
649 | 647 |
@@ -90,8 +90,7 @@ | ||
90 | 90 | * If a non-standard BAUD rate is used, issue |
91 | 91 | * a warning (if we are verbose) and return the raw rate |
92 | 92 | */ |
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", | |
95 | 94 | progname, baud); |
96 | 95 | |
97 | 96 | return baud; |
@@ -111,7 +110,7 @@ | ||
111 | 110 | */ |
112 | 111 | rc = tcgetattr(fd->ifd, &termios); |
113 | 112 | if (rc < 0) { |
114 | - avrdude_message("%s: ser_setspeed(): tcgetattr() failed", | |
113 | + avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcgetattr() failed", | |
115 | 114 | progname); |
116 | 115 | return -errno; |
117 | 116 | } |
@@ -135,7 +134,7 @@ | ||
135 | 134 | |
136 | 135 | rc = tcsetattr(fd->ifd, TCSANOW, &termios); |
137 | 136 | if (rc < 0) { |
138 | - avrdude_message("%s: ser_setspeed(): tcsetattr() failed\n", | |
137 | + avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcsetattr() failed\n", | |
139 | 138 | progname); |
140 | 139 | return -errno; |
141 | 140 | } |
@@ -167,13 +166,13 @@ | ||
167 | 166 | struct hostent *hp; |
168 | 167 | |
169 | 168 | 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", | |
171 | 170 | progname); |
172 | 171 | return -1; |
173 | 172 | } |
174 | 173 | |
175 | 174 | 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", | |
177 | 176 | progname, hstr); |
178 | 177 | free(hstr); |
179 | 178 | return -1; |
@@ -187,7 +186,7 @@ | ||
187 | 186 | pnum = strtoul(pstr, &end, 10); |
188 | 187 | |
189 | 188 | 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", | |
191 | 190 | progname, pstr); |
192 | 191 | free(hstr); |
193 | 192 | return -1; |
@@ -194,7 +193,7 @@ | ||
194 | 193 | } |
195 | 194 | |
196 | 195 | 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", | |
198 | 197 | progname, hstr); |
199 | 198 | free(hstr); |
200 | 199 | return -1; |
@@ -203,7 +202,7 @@ | ||
203 | 202 | free(hstr); |
204 | 203 | |
205 | 204 | 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", | |
207 | 206 | progname, strerror(errno)); |
208 | 207 | return -1; |
209 | 208 | } |
@@ -214,7 +213,7 @@ | ||
214 | 213 | memcpy(&(sockaddr.sin_addr.s_addr), hp->h_addr, sizeof(struct in_addr)); |
215 | 214 | |
216 | 215 | 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", | |
218 | 217 | progname, strerror(errno)); |
219 | 218 | return -1; |
220 | 219 | } |
@@ -271,7 +270,7 @@ | ||
271 | 270 | */ |
272 | 271 | fd = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK); |
273 | 272 | 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", | |
275 | 274 | progname, port, strerror(errno)); |
276 | 275 | return -1; |
277 | 276 | } |
@@ -283,7 +282,7 @@ | ||
283 | 282 | */ |
284 | 283 | rc = ser_setspeed(fdp, pinfo.baud); |
285 | 284 | 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", | |
287 | 286 | progname, port, strerror(-rc)); |
288 | 287 | close(fd); |
289 | 288 | return -1; |
@@ -300,7 +299,7 @@ | ||
300 | 299 | if (saved_original_termios) { |
301 | 300 | int rc = tcsetattr(fd->ifd, TCSANOW | TCSADRAIN, &original_termios); |
302 | 301 | 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", | |
304 | 303 | progname, strerror(errno)); |
305 | 304 | } |
306 | 305 | saved_original_termios = 0; |
@@ -321,29 +320,29 @@ | ||
321 | 320 | |
322 | 321 | if (verbose > 3) |
323 | 322 | { |
324 | - avrdude_message("%s: Send: ", progname); | |
323 | + avrdude_message(MSG_TRACE, "%s: Send: ", progname); | |
325 | 324 | |
326 | 325 | while (buflen) { |
327 | 326 | unsigned char c = *buf; |
328 | 327 | if (isprint(c)) { |
329 | - avrdude_message("%c ", c); | |
328 | + avrdude_message(MSG_TRACE, "%c ", c); | |
330 | 329 | } |
331 | 330 | else { |
332 | - avrdude_message(". "); | |
331 | + avrdude_message(MSG_TRACE, ". "); | |
333 | 332 | } |
334 | - avrdude_message("[%02x] ", c); | |
333 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
335 | 334 | |
336 | 335 | buf++; |
337 | 336 | buflen--; |
338 | 337 | } |
339 | 338 | |
340 | - avrdude_message("\n"); | |
339 | + avrdude_message(MSG_TRACE, "\n"); | |
341 | 340 | } |
342 | 341 | |
343 | 342 | while (len) { |
344 | 343 | rc = write(fd->ifd, p, (len > 1024) ? 1024 : len); |
345 | 344 | 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", | |
347 | 346 | progname, strerror(errno)); |
348 | 347 | return -1; |
349 | 348 | } |
@@ -375,19 +374,18 @@ | ||
375 | 374 | |
376 | 375 | nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &to2); |
377 | 376 | 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", | |
380 | 378 | progname); |
381 | 379 | return -1; |
382 | 380 | } |
383 | 381 | else if (nfds == -1) { |
384 | 382 | 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", | |
386 | 384 | progname); |
387 | 385 | goto reselect; |
388 | 386 | } |
389 | 387 | else { |
390 | - avrdude_message("%s: ser_recv(): select(): %s\n", | |
388 | + avrdude_message(MSG_INFO, "%s: ser_recv(): select(): %s\n", | |
391 | 389 | progname, strerror(errno)); |
392 | 390 | return -1; |
393 | 391 | } |
@@ -395,7 +393,7 @@ | ||
395 | 393 | |
396 | 394 | rc = read(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len); |
397 | 395 | 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", | |
399 | 397 | progname, strerror(errno)); |
400 | 398 | return -1; |
401 | 399 | } |
@@ -407,22 +405,22 @@ | ||
407 | 405 | |
408 | 406 | if (verbose > 3) |
409 | 407 | { |
410 | - avrdude_message("%s: Recv: ", progname); | |
408 | + avrdude_message(MSG_TRACE, "%s: Recv: ", progname); | |
411 | 409 | |
412 | 410 | while (len) { |
413 | 411 | unsigned char c = *p; |
414 | 412 | if (isprint(c)) { |
415 | - avrdude_message("%c ", c); | |
413 | + avrdude_message(MSG_TRACE, "%c ", c); | |
416 | 414 | } |
417 | 415 | else { |
418 | - avrdude_message(". "); | |
416 | + avrdude_message(MSG_TRACE, ". "); | |
419 | 417 | } |
420 | - avrdude_message("[%02x] ", c); | |
418 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
421 | 419 | |
422 | 420 | p++; |
423 | 421 | len--; |
424 | 422 | } |
425 | - avrdude_message("\n"); | |
423 | + avrdude_message(MSG_TRACE, "\n"); | |
426 | 424 | } |
427 | 425 | |
428 | 426 | return 0; |
@@ -441,7 +439,7 @@ | ||
441 | 439 | timeout.tv_usec = 250000; |
442 | 440 | |
443 | 441 | if (display) { |
444 | - avrdude_message("drain>"); | |
442 | + avrdude_message(MSG_INFO, "drain>"); | |
445 | 443 | } |
446 | 444 | |
447 | 445 | while (1) { |
@@ -452,7 +450,7 @@ | ||
452 | 450 | nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &timeout); |
453 | 451 | if (nfds == 0) { |
454 | 452 | if (display) { |
455 | - avrdude_message("<drain\n"); | |
453 | + avrdude_message(MSG_INFO, "<drain\n"); | |
456 | 454 | } |
457 | 455 | |
458 | 456 | break; |
@@ -462,7 +460,7 @@ | ||
462 | 460 | goto reselect; |
463 | 461 | } |
464 | 462 | else { |
465 | - avrdude_message("%s: ser_drain(): select(): %s\n", | |
463 | + avrdude_message(MSG_INFO, "%s: ser_drain(): select(): %s\n", | |
466 | 464 | progname, strerror(errno)); |
467 | 465 | return -1; |
468 | 466 | } |
@@ -470,12 +468,12 @@ | ||
470 | 468 | |
471 | 469 | rc = read(fd->ifd, &buf, 1); |
472 | 470 | 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", | |
474 | 472 | progname, strerror(errno)); |
475 | 473 | return -1; |
476 | 474 | } |
477 | 475 | if (display) { |
478 | - avrdude_message("%02x ", buf); | |
476 | + avrdude_message(MSG_INFO, "%02x ", buf); | |
479 | 477 | } |
480 | 478 | } |
481 | 479 |
@@ -69,8 +69,7 @@ | ||
69 | 69 | * If a non-standard BAUD rate is used, issue |
70 | 70 | * a warning (if we are verbose) and return the raw rate |
71 | 71 | */ |
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", | |
74 | 73 | progname, baud); |
75 | 74 | |
76 | 75 | return baud; |
@@ -123,7 +122,7 @@ | ||
123 | 122 | * This is curently not implemented for Win32. |
124 | 123 | */ |
125 | 124 | 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" | |
127 | 126 | "implemented for Win32 environments\n", |
128 | 127 | progname); |
129 | 128 | return -1; |
@@ -135,7 +134,7 @@ | ||
135 | 134 | newname = malloc(strlen("\\\\.\\") + strlen(port) + 1); |
136 | 135 | |
137 | 136 | 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", | |
139 | 138 | progname); |
140 | 139 | exit(1); |
141 | 140 | } |
@@ -159,7 +158,7 @@ | ||
159 | 158 | (LPTSTR) &lpMsgBuf, |
160 | 159 | 0, |
161 | 160 | 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", | |
163 | 162 | progname, port, (char*)lpMsgBuf); |
164 | 163 | LocalFree( lpMsgBuf ); |
165 | 164 | return -1; |
@@ -168,7 +167,7 @@ | ||
168 | 167 | if (!SetupComm(hComPort, W32SERBUFSIZE, W32SERBUFSIZE)) |
169 | 168 | { |
170 | 169 | 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", | |
172 | 171 | progname, port); |
173 | 172 | return -1; |
174 | 173 | } |
@@ -177,7 +176,7 @@ | ||
177 | 176 | if (ser_setspeed(fdp, pinfo.baud) != 0) |
178 | 177 | { |
179 | 178 | 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", | |
181 | 180 | progname, port); |
182 | 181 | return -1; |
183 | 182 | } |
@@ -185,7 +184,7 @@ | ||
185 | 184 | if (!serial_w32SetTimeOut(hComPort,0)) |
186 | 185 | { |
187 | 186 | 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", | |
189 | 188 | progname, port); |
190 | 189 | return -1; |
191 | 190 | } |
@@ -231,7 +230,7 @@ | ||
231 | 230 | HANDLE hComPort=(HANDLE)fd->pfd; |
232 | 231 | |
233 | 232 | 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", | |
235 | 234 | progname); |
236 | 235 | return -1; |
237 | 236 | } |
@@ -241,33 +240,33 @@ | ||
241 | 240 | |
242 | 241 | if (verbose > 3) |
243 | 242 | { |
244 | - avrdude_message("%s: Send: ", progname); | |
243 | + avrdude_message(MSG_TRACE, "%s: Send: ", progname); | |
245 | 244 | |
246 | 245 | while (len) { |
247 | 246 | c = *b; |
248 | 247 | if (isprint(c)) { |
249 | - avrdude_message("%c ", c); | |
248 | + avrdude_message(MSG_TRACE, "%c ", c); | |
250 | 249 | } |
251 | 250 | else { |
252 | - avrdude_message(". "); | |
251 | + avrdude_message(MSG_TRACE, ". "); | |
253 | 252 | } |
254 | - avrdude_message("[%02x] ", c); | |
253 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
255 | 254 | b++; |
256 | 255 | len--; |
257 | 256 | } |
258 | - avrdude_message("\n"); | |
257 | + avrdude_message(MSG_INFO, "\n"); | |
259 | 258 | } |
260 | 259 | |
261 | 260 | serial_w32SetTimeOut(hComPort,500); |
262 | 261 | |
263 | 262 | 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", | |
265 | 264 | progname, "sorry no info avail"); // TODO |
266 | 265 | return -1; |
267 | 266 | } |
268 | 267 | |
269 | 268 | 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", | |
271 | 270 | progname); |
272 | 271 | return -1; |
273 | 272 | } |
@@ -285,7 +284,7 @@ | ||
285 | 284 | HANDLE hComPort=(HANDLE)fd->pfd; |
286 | 285 | |
287 | 286 | 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", | |
289 | 288 | progname); |
290 | 289 | return -1; |
291 | 290 | } |
@@ -304,7 +303,7 @@ | ||
304 | 303 | (LPTSTR) &lpMsgBuf, |
305 | 304 | 0, |
306 | 305 | NULL ); |
307 | - avrdude_message("%s: ser_recv(): read error: %s\n", | |
306 | + avrdude_message(MSG_INFO, "%s: ser_recv(): read error: %s\n", | |
308 | 307 | progname, (char*)lpMsgBuf); |
309 | 308 | LocalFree( lpMsgBuf ); |
310 | 309 | return -1; |
@@ -312,8 +311,7 @@ | ||
312 | 311 | |
313 | 312 | /* time out detected */ |
314 | 313 | 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", | |
317 | 315 | progname); |
318 | 316 | return -1; |
319 | 317 | } |
@@ -322,22 +320,22 @@ | ||
322 | 320 | |
323 | 321 | if (verbose > 3) |
324 | 322 | { |
325 | - avrdude_message("%s: Recv: ", progname); | |
323 | + avrdude_message(MSG_TRACE, "%s: Recv: ", progname); | |
326 | 324 | |
327 | 325 | while (read) { |
328 | 326 | c = *p; |
329 | 327 | if (isprint(c)) { |
330 | - avrdude_message("%c ", c); | |
328 | + avrdude_message(MSG_TRACE, "%c ", c); | |
331 | 329 | } |
332 | 330 | else { |
333 | - avrdude_message(". "); | |
331 | + avrdude_message(MSG_TRACE, ". "); | |
334 | 332 | } |
335 | - avrdude_message("[%02x] ", c); | |
333 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
336 | 334 | |
337 | 335 | p++; |
338 | 336 | read--; |
339 | 337 | } |
340 | - avrdude_message("\n"); | |
338 | + avrdude_message(MSG_INFO, "\n"); | |
341 | 339 | } |
342 | 340 | return 0; |
343 | 341 | } |
@@ -353,7 +351,7 @@ | ||
353 | 351 | HANDLE hComPort=(HANDLE)fd->pfd; |
354 | 352 | |
355 | 353 | 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", | |
357 | 355 | progname); |
358 | 356 | return -1; |
359 | 357 | } |
@@ -361,7 +359,7 @@ | ||
361 | 359 | serial_w32SetTimeOut(hComPort,250); |
362 | 360 | |
363 | 361 | if (display) { |
364 | - avrdude_message("drain>"); | |
362 | + avrdude_message(MSG_INFO, "drain>"); | |
365 | 363 | } |
366 | 364 | |
367 | 365 | while (1) { |
@@ -378,7 +376,7 @@ | ||
378 | 376 | (LPTSTR) &lpMsgBuf, |
379 | 377 | 0, |
380 | 378 | NULL ); |
381 | - avrdude_message("%s: ser_drain(): read error: %s\n", | |
379 | + avrdude_message(MSG_INFO, "%s: ser_drain(): read error: %s\n", | |
382 | 380 | progname, (char*)lpMsgBuf); |
383 | 381 | LocalFree( lpMsgBuf ); |
384 | 382 | return -1; |
@@ -385,10 +383,10 @@ | ||
385 | 383 | } |
386 | 384 | |
387 | 385 | if (read) { // data avail |
388 | - if (display) avrdude_message("%02x ", buf[0]); | |
386 | + if (display) avrdude_message(MSG_INFO, "%02x ", buf[0]); | |
389 | 387 | } |
390 | 388 | else { // no more data |
391 | - if (display) avrdude_message("<drain\n"); | |
389 | + if (display) avrdude_message(MSG_INFO, "<drain\n"); | |
392 | 390 | break; |
393 | 391 | } |
394 | 392 | } // while |
@@ -238,7 +238,7 @@ | ||
238 | 238 | |
239 | 239 | r = tcgetattr(pgm->fd.ifd, &mode); |
240 | 240 | if (r < 0) { |
241 | - avrdude_message("%s: ", port); | |
241 | + avrdude_message(MSG_INFO, "%s: ", port); | |
242 | 242 | perror("tcgetattr"); |
243 | 243 | return(-1); |
244 | 244 | } |
@@ -252,7 +252,7 @@ | ||
252 | 252 | |
253 | 253 | r = tcsetattr(pgm->fd.ifd, TCSANOW, &mode); |
254 | 254 | if (r < 0) { |
255 | - avrdude_message("%s: ", port); | |
255 | + avrdude_message(MSG_INFO, "%s: ", port); | |
256 | 256 | perror("tcsetattr"); |
257 | 257 | return(-1); |
258 | 258 | } |
@@ -261,7 +261,7 @@ | ||
261 | 261 | flags = fcntl(pgm->fd.ifd, F_GETFL, 0); |
262 | 262 | if (flags == -1) |
263 | 263 | { |
264 | - avrdude_message("%s: Can not get flags: %s\n", | |
264 | + avrdude_message(MSG_INFO, "%s: Can not get flags: %s\n", | |
265 | 265 | progname, strerror(errno)); |
266 | 266 | return(-1); |
267 | 267 | } |
@@ -268,7 +268,7 @@ | ||
268 | 268 | flags &= ~O_NONBLOCK; |
269 | 269 | if (fcntl(pgm->fd.ifd, F_SETFL, flags) == -1) |
270 | 270 | { |
271 | - avrdude_message("%s: Can not clear nonblock flag: %s\n", | |
271 | + avrdude_message(MSG_INFO, "%s: Can not clear nonblock flag: %s\n", | |
272 | 272 | progname, strerror(errno)); |
273 | 273 | return(-1); |
274 | 274 | } |
@@ -97,13 +97,11 @@ | ||
97 | 97 | break; |
98 | 98 | |
99 | 99 | 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", | |
102 | 101 | progname, pin + 1); |
103 | 102 | return -1; |
104 | 103 | } |
105 | - if (verbose > 4) | |
106 | - avrdude_message("%s: serbb_setpin(): EscapeCommFunction(%s)\n", | |
104 | + avrdude_message(MSG_TRACE2, "%s: serbb_setpin(): EscapeCommFunction(%s)\n", | |
107 | 105 | progname, name); |
108 | 106 | if (!EscapeCommFunction(hComPort, dwFunc)) |
109 | 107 | { |
@@ -117,7 +115,7 @@ | ||
117 | 115 | (LPTSTR) &lpMsgBuf, |
118 | 116 | 0, |
119 | 117 | NULL); |
120 | - avrdude_message("%s: serbb_setpin(): SetCommState() failed: %s\n", | |
118 | + avrdude_message(MSG_INFO, "%s: serbb_setpin(): SetCommState() failed: %s\n", | |
121 | 119 | progname, (char *)lpMsgBuf); |
122 | 120 | CloseHandle(hComPort); |
123 | 121 | LocalFree(lpMsgBuf); |
@@ -163,14 +161,13 @@ | ||
163 | 161 | (LPTSTR) &lpMsgBuf, |
164 | 162 | 0, |
165 | 163 | NULL); |
166 | - avrdude_message("%s: serbb_setpin(): GetCommModemStatus() failed: %s\n", | |
164 | + avrdude_message(MSG_INFO, "%s: serbb_setpin(): GetCommModemStatus() failed: %s\n", | |
167 | 165 | progname, (char *)lpMsgBuf); |
168 | 166 | CloseHandle(hComPort); |
169 | 167 | LocalFree(lpMsgBuf); |
170 | 168 | return -1; |
171 | 169 | } |
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", | |
174 | 171 | progname, modemstate); |
175 | 172 | switch (pin) |
176 | 173 | { |
@@ -206,13 +203,11 @@ | ||
206 | 203 | name = "RTS"; |
207 | 204 | break; |
208 | 205 | 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", | |
211 | 207 | progname, pin + 1); |
212 | 208 | return -1; |
213 | 209 | } |
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", | |
216 | 211 | progname, name); |
217 | 212 | if (invert) |
218 | 213 | rv = !rv; |
@@ -281,7 +276,7 @@ | ||
281 | 276 | (LPTSTR) &lpMsgBuf, |
282 | 277 | 0, |
283 | 278 | 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", | |
285 | 280 | progname, port, (char*)lpMsgBuf); |
286 | 281 | LocalFree(lpMsgBuf); |
287 | 282 | return -1; |
@@ -290,7 +285,7 @@ | ||
290 | 285 | if (!SetupComm(hComPort, W32SERBUFSIZE, W32SERBUFSIZE)) |
291 | 286 | { |
292 | 287 | 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", | |
294 | 289 | progname, port); |
295 | 290 | return -1; |
296 | 291 | } |
@@ -309,12 +304,11 @@ | ||
309 | 304 | if (!SetCommState(hComPort, &dcb)) |
310 | 305 | { |
311 | 306 | 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", | |
313 | 308 | progname, port); |
314 | 309 | return -1; |
315 | 310 | } |
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", | |
318 | 312 | progname, port, (int)hComPort); |
319 | 313 | |
320 | 314 | pgm->fd.pfd = (void *)hComPort; |
@@ -332,8 +326,7 @@ | ||
332 | 326 | pgm->setpin(pgm, PIN_AVR_RESET, 1); |
333 | 327 | CloseHandle (hComPort); |
334 | 328 | } |
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", | |
337 | 330 | progname, (int)hComPort); |
338 | 331 | |
339 | 332 | hComPort = INVALID_HANDLE_VALUE; |
@@ -71,7 +71,7 @@ | ||
71 | 71 | |
72 | 72 | rv = serial_recv(&pgm->fd, buf, len); |
73 | 73 | 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", | |
75 | 75 | progname); |
76 | 76 | return -1; |
77 | 77 | } |
@@ -110,7 +110,7 @@ | ||
110 | 110 | if (resp[0] == Resp_STK_INSYNC){ |
111 | 111 | break; |
112 | 112 | } |
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", | |
114 | 114 | progname, attempt + 1, MAX_SYNC_ATTEMPTS, resp[0]); |
115 | 115 | } |
116 | 116 | if (attempt == MAX_SYNC_ATTEMPTS) { |
@@ -121,7 +121,7 @@ | ||
121 | 121 | if (stk500_recv(pgm, resp, 1) < 0) |
122 | 122 | return -1; |
123 | 123 | 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: " | |
125 | 125 | "resp=0x%02x\n", |
126 | 126 | progname, resp[0]); |
127 | 127 | return -1; |
@@ -152,7 +152,7 @@ | ||
152 | 152 | if (stk500_recv(pgm, buf, 1) < 0) |
153 | 153 | return -1; |
154 | 154 | 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); | |
156 | 156 | return -1; |
157 | 157 | } |
158 | 158 |
@@ -165,7 +165,7 @@ | ||
165 | 165 | if (stk500_recv(pgm, buf, 1) < 0) |
166 | 166 | return -1; |
167 | 167 | 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); | |
169 | 169 | return -1; |
170 | 170 | } |
171 | 171 |
@@ -183,7 +183,7 @@ | ||
183 | 183 | unsigned char res[4]; |
184 | 184 | |
185 | 185 | 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" | |
187 | 187 | "provide a cmd() method.\n", |
188 | 188 | progname, pgm->type); |
189 | 189 | return -1; |
@@ -190,7 +190,7 @@ | ||
190 | 190 | } |
191 | 191 | |
192 | 192 | 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", | |
194 | 194 | p->desc); |
195 | 195 | return -1; |
196 | 196 | } |
@@ -229,7 +229,7 @@ | ||
229 | 229 | return -1; |
230 | 230 | if (buf[0] == Resp_STK_NOSYNC) { |
231 | 231 | 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", | |
233 | 233 | progname); |
234 | 234 | return -1; |
235 | 235 | } |
@@ -238,7 +238,7 @@ | ||
238 | 238 | goto retry; |
239 | 239 | } |
240 | 240 | 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, " | |
242 | 242 | "expect=0x%02x, resp=0x%02x\n", |
243 | 243 | progname, Resp_STK_INSYNC, buf[0]); |
244 | 244 | return -1; |
@@ -250,7 +250,7 @@ | ||
250 | 250 | return 0; |
251 | 251 | } |
252 | 252 | 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", | |
254 | 254 | progname); |
255 | 255 | return -1; |
256 | 256 | } |
@@ -257,13 +257,13 @@ | ||
257 | 257 | |
258 | 258 | if(buf[0] == Resp_STK_FAILED) |
259 | 259 | { |
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", | |
261 | 261 | progname); |
262 | 262 | return -1; |
263 | 263 | } |
264 | 264 | |
265 | 265 | |
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", | |
267 | 267 | progname, buf[0]); |
268 | 268 | |
269 | 269 | return -1; |
@@ -294,7 +294,7 @@ | ||
294 | 294 | return -1; |
295 | 295 | if (buf[0] == Resp_STK_NOSYNC) { |
296 | 296 | 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", | |
298 | 298 | progname); |
299 | 299 | return -1; |
300 | 300 | } |
@@ -303,7 +303,7 @@ | ||
303 | 303 | goto retry; |
304 | 304 | } |
305 | 305 | 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, " | |
307 | 307 | "expect=0x%02x, resp=0x%02x\n", |
308 | 308 | progname, Resp_STK_INSYNC, buf[0]); |
309 | 309 | return -1; |
@@ -315,7 +315,7 @@ | ||
315 | 315 | return 0; |
316 | 316 | } |
317 | 317 | 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", | |
319 | 319 | progname); |
320 | 320 | return -1; |
321 | 321 | } |
@@ -322,7 +322,7 @@ | ||
322 | 322 | |
323 | 323 | if(buf[0] == Resp_STK_FAILED) |
324 | 324 | { |
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 " | |
326 | 326 | "device programming parameters\n", |
327 | 327 | progname); |
328 | 328 | return -1; |
@@ -329,7 +329,7 @@ | ||
329 | 329 | } |
330 | 330 | |
331 | 331 | |
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", | |
333 | 333 | progname, buf[0]); |
334 | 334 | |
335 | 335 | return -1; |
@@ -364,7 +364,7 @@ | ||
364 | 364 | return -1; |
365 | 365 | if (buf[0] == Resp_STK_NOSYNC) { |
366 | 366 | 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", | |
368 | 368 | progname); |
369 | 369 | return -1; |
370 | 370 | } |
@@ -373,7 +373,7 @@ | ||
373 | 373 | goto retry; |
374 | 374 | } |
375 | 375 | 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, " | |
377 | 377 | "expect=0x%02x, resp=0x%02x\n", |
378 | 378 | progname, Resp_STK_INSYNC, buf[0]); |
379 | 379 | return -1; |
@@ -385,7 +385,7 @@ | ||
385 | 385 | return 0; |
386 | 386 | } |
387 | 387 | 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", | |
389 | 389 | progname); |
390 | 390 | return -1; |
391 | 391 | } |
@@ -392,13 +392,13 @@ | ||
392 | 392 | |
393 | 393 | if (buf[0] == Resp_STK_FAILED) |
394 | 394 | { |
395 | - avrdude_message("%s: mib510_isp(): command %d failed\n", | |
395 | + avrdude_message(MSG_INFO, "%s: mib510_isp(): command %d failed\n", | |
396 | 396 | progname, cmd); |
397 | 397 | return -1; |
398 | 398 | } |
399 | 399 | |
400 | 400 | |
401 | - avrdude_message("%s: mib510_isp(): unknown response=0x%02x\n", | |
401 | + avrdude_message(MSG_INFO, "%s: mib510_isp(): unknown response=0x%02x\n", | |
402 | 402 | progname, buf[0]); |
403 | 403 | |
404 | 404 | return -1; |
@@ -459,7 +459,7 @@ | ||
459 | 459 | } |
460 | 460 | |
461 | 461 | #if 0 |
462 | - avrdude_message("%s: stk500_initialize(): n_extparms = %d\n", | |
462 | + avrdude_message(MSG_INFO, "%s: stk500_initialize(): n_extparms = %d\n", | |
463 | 463 | progname, n_extparms); |
464 | 464 | #endif |
465 | 465 |
@@ -533,7 +533,7 @@ | ||
533 | 533 | if (stk500_recv(pgm, buf, 1) < 0) |
534 | 534 | return -1; |
535 | 535 | 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", | |
537 | 537 | progname, buf[0]); |
538 | 538 | if (tries > 33) |
539 | 539 | return -1; |
@@ -542,7 +542,7 @@ | ||
542 | 542 | goto retry; |
543 | 543 | } |
544 | 544 | 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, " | |
546 | 546 | "expect=0x%02x, resp=0x%02x\n", |
547 | 547 | progname, Resp_STK_INSYNC, buf[0]); |
548 | 548 | return -1; |
@@ -551,7 +551,7 @@ | ||
551 | 551 | if (stk500_recv(pgm, buf, 1) < 0) |
552 | 552 | return -1; |
553 | 553 | 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, " | |
555 | 555 | "expect=0x%02x, resp=0x%02x\n", |
556 | 556 | progname, Resp_STK_OK, buf[0]); |
557 | 557 | return -1; |
@@ -559,8 +559,7 @@ | ||
559 | 559 | |
560 | 560 | if (n_extparms) { |
561 | 561 | 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 " | |
564 | 563 | "file for part %s, using dummy values\n", |
565 | 564 | progname, p->desc); |
566 | 565 | buf[2] = 0xD7; /* they look somehow possible, */ |
@@ -590,7 +589,7 @@ | ||
590 | 589 | |
591 | 590 | rc = stk500_set_extended_parms(pgm, n_extparms+1, buf); |
592 | 591 | if (rc) { |
593 | - avrdude_message("%s: stk500_initialize(): failed\n", progname); | |
592 | + avrdude_message(MSG_INFO, "%s: stk500_initialize(): failed\n", progname); | |
594 | 593 | return -1; |
595 | 594 | } |
596 | 595 | } |
@@ -616,7 +615,7 @@ | ||
616 | 615 | return; |
617 | 616 | if (buf[0] == Resp_STK_NOSYNC) { |
618 | 617 | 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", | |
620 | 619 | progname); |
621 | 620 | return; |
622 | 621 | } |
@@ -625,7 +624,7 @@ | ||
625 | 624 | goto retry; |
626 | 625 | } |
627 | 626 | 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, " | |
629 | 628 | "resp=0x%02x\n", |
630 | 629 | progname, Resp_STK_INSYNC, buf[0]); |
631 | 630 | return; |
@@ -637,12 +636,12 @@ | ||
637 | 636 | return; |
638 | 637 | } |
639 | 638 | 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", | |
641 | 640 | progname); |
642 | 641 | return; |
643 | 642 | } |
644 | 643 | |
645 | - avrdude_message("%s: stk500_disable(): unknown response=0x%02x\n", | |
644 | + avrdude_message(MSG_INFO, "%s: stk500_disable(): unknown response=0x%02x\n", | |
646 | 645 | progname, buf[0]); |
647 | 646 | |
648 | 647 | return; |
@@ -727,7 +726,7 @@ | ||
727 | 726 | return -1; |
728 | 727 | if (buf[0] == Resp_STK_NOSYNC) { |
729 | 728 | 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", | |
731 | 730 | progname); |
732 | 731 | return -1; |
733 | 732 | } |
@@ -736,7 +735,7 @@ | ||
736 | 735 | goto retry; |
737 | 736 | } |
738 | 737 | 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, " | |
740 | 739 | "expect=0x%02x, resp=0x%02x\n", |
741 | 740 | progname, Resp_STK_INSYNC, buf[0]); |
742 | 741 | return -1; |
@@ -748,7 +747,7 @@ | ||
748 | 747 | return 0; |
749 | 748 | } |
750 | 749 | |
751 | - avrdude_message("%s: loadaddr(): (b) protocol error, " | |
750 | + avrdude_message(MSG_INFO, "%s: loadaddr(): (b) protocol error, " | |
752 | 751 | "expect=0x%02x, resp=0x%02x\n", |
753 | 752 | progname, Resp_STK_INSYNC, buf[0]); |
754 | 753 |
@@ -785,7 +784,7 @@ | ||
785 | 784 | |
786 | 785 | n = addr + n_bytes; |
787 | 786 | #if 0 |
788 | - avrdude_message("n_bytes = %d\n" | |
787 | + avrdude_message(MSG_INFO, "n_bytes = %d\n" | |
789 | 788 | "n = %u\n" |
790 | 789 | "a_div = %d\n" |
791 | 790 | "page_size = %d\n", |
@@ -823,7 +822,7 @@ | ||
823 | 822 | return -1; |
824 | 823 | if (buf[0] == Resp_STK_NOSYNC) { |
825 | 824 | 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", | |
827 | 826 | progname); |
828 | 827 | return -3; |
829 | 828 | } |
@@ -832,7 +831,7 @@ | ||
832 | 831 | goto retry; |
833 | 832 | } |
834 | 833 | 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, " | |
836 | 835 | "expect=0x%02x, resp=0x%02x\n", |
837 | 836 | progname, Resp_STK_INSYNC, buf[0]); |
838 | 837 | return -4; |
@@ -841,7 +840,7 @@ | ||
841 | 840 | if (stk500_recv(pgm, buf, 1) < 0) |
842 | 841 | return -1; |
843 | 842 | 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, " | |
845 | 844 | "expect=0x%02x, resp=0x%02x\n", |
846 | 845 | progname, Resp_STK_INSYNC, buf[0]); |
847 | 846 | return -5; |
@@ -904,7 +903,7 @@ | ||
904 | 903 | return -1; |
905 | 904 | if (buf[0] == Resp_STK_NOSYNC) { |
906 | 905 | 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", | |
908 | 907 | progname); |
909 | 908 | return -3; |
910 | 909 | } |
@@ -913,7 +912,7 @@ | ||
913 | 912 | goto retry; |
914 | 913 | } |
915 | 914 | 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, " | |
917 | 916 | "expect=0x%02x, resp=0x%02x\n", |
918 | 917 | progname, Resp_STK_INSYNC, buf[0]); |
919 | 918 | return -4; |
@@ -927,7 +926,7 @@ | ||
927 | 926 | |
928 | 927 | if(strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) { |
929 | 928 | 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, " | |
931 | 930 | "expect=0x%02x, resp=0x%02x\n", |
932 | 931 | progname, Resp_STK_INSYNC, buf[0]); |
933 | 932 | return -5; |
@@ -935,7 +934,7 @@ | ||
935 | 934 | } |
936 | 935 | else { |
937 | 936 | 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, " | |
939 | 938 | "expect=0x%02x, resp=0x%02x\n", |
940 | 939 | progname, Resp_STK_OK, buf[0]); |
941 | 940 | return -5; |
@@ -954,13 +953,13 @@ | ||
954 | 953 | utarg = (unsigned)((v + 0.049) * 10); |
955 | 954 | |
956 | 955 | 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", | |
958 | 957 | progname); |
959 | 958 | return -1; |
960 | 959 | } |
961 | 960 | |
962 | 961 | 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", | |
964 | 963 | progname, uaref / 10.0, v); |
965 | 964 | if (stk500_setparm(pgm, Parm_STK_VADJUST, utarg) |
966 | 965 | != 0) |
@@ -978,13 +977,13 @@ | ||
978 | 977 | uaref = (unsigned)((v + 0.049) * 10); |
979 | 978 | |
980 | 979 | 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", | |
982 | 981 | progname); |
983 | 982 | return -1; |
984 | 983 | } |
985 | 984 | |
986 | 985 | 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 " | |
988 | 987 | "V[target] = %.1f\n", |
989 | 988 | progname, utarg / 10.0); |
990 | 989 | return -1; |
@@ -1013,7 +1012,7 @@ | ||
1013 | 1012 | unit = "kHz"; |
1014 | 1013 | } else |
1015 | 1014 | 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", | |
1017 | 1016 | progname, v, unit, STK500_XTAL / 2e6); |
1018 | 1017 | fosc = STK500_XTAL / 2; |
1019 | 1018 | } else |
@@ -1028,7 +1027,7 @@ | ||
1028 | 1027 | } |
1029 | 1028 | } |
1030 | 1029 | 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", | |
1032 | 1031 | progname, fosc, STK500_XTAL / (256 * 1024 * 2)); |
1033 | 1032 | return -1; |
1034 | 1033 | } |
@@ -1060,11 +1059,11 @@ | ||
1060 | 1059 | |
1061 | 1060 | if (v < min) { |
1062 | 1061 | 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", | |
1064 | 1063 | progname, v / 1e-6, dur * min / 1e-6); |
1065 | 1064 | } else if (v > max) { |
1066 | 1065 | 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", | |
1068 | 1067 | progname, v / 1e-6, dur * min / 1e-6); |
1069 | 1068 | } |
1070 | 1069 |
@@ -1090,7 +1089,7 @@ | ||
1090 | 1089 | return -1; |
1091 | 1090 | if (buf[0] == Resp_STK_NOSYNC) { |
1092 | 1091 | 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", | |
1094 | 1093 | progname); |
1095 | 1094 | return -1; |
1096 | 1095 | } |
@@ -1099,7 +1098,7 @@ | ||
1099 | 1098 | goto retry; |
1100 | 1099 | } |
1101 | 1100 | 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, " | |
1103 | 1102 | "expect=0x%02x, resp=0x%02x\n", |
1104 | 1103 | progname, Resp_STK_INSYNC, buf[0]); |
1105 | 1104 | return -2; |
@@ -1112,12 +1111,12 @@ | ||
1112 | 1111 | if (stk500_recv(pgm, buf, 1) < 0) |
1113 | 1112 | return -1; |
1114 | 1113 | 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", | |
1116 | 1115 | progname, v); |
1117 | 1116 | return -3; |
1118 | 1117 | } |
1119 | 1118 | 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, " | |
1121 | 1120 | "expect=0x%02x, resp=0x%02x\n", |
1122 | 1121 | progname, Resp_STK_INSYNC, buf[0]); |
1123 | 1122 | return -3; |
@@ -1147,7 +1146,7 @@ | ||
1147 | 1146 | return -1; |
1148 | 1147 | if (buf[0] == Resp_STK_NOSYNC) { |
1149 | 1148 | 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", | |
1151 | 1150 | progname); |
1152 | 1151 | return -1; |
1153 | 1152 | } |
@@ -1156,7 +1155,7 @@ | ||
1156 | 1155 | goto retry; |
1157 | 1156 | } |
1158 | 1157 | 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, " | |
1160 | 1159 | "expect=0x%02x, resp=0x%02x\n", |
1161 | 1160 | progname, Resp_STK_INSYNC, buf[0]); |
1162 | 1161 | return -2; |
@@ -1171,12 +1170,12 @@ | ||
1171 | 1170 | if (stk500_recv(pgm, buf, 1) < 0) |
1172 | 1171 | return -1; |
1173 | 1172 | 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", | |
1175 | 1174 | progname, parm); |
1176 | 1175 | return -3; |
1177 | 1176 | } |
1178 | 1177 | else { |
1179 | - avrdude_message("\n%s: stk500_setparm(): (a) protocol error, " | |
1178 | + avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, " | |
1180 | 1179 | "expect=0x%02x, resp=0x%02x\n", |
1181 | 1180 | progname, Resp_STK_INSYNC, buf[0]); |
1182 | 1181 | return -3; |
@@ -1193,8 +1192,8 @@ | ||
1193 | 1192 | stk500_getparm(pgm, Parm_STK_SW_MINOR, &min); |
1194 | 1193 | stk500_getparm(pgm, Param_STK500_TOPCARD_DETECT, &topcard); |
1195 | 1194 | |
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); | |
1198 | 1197 | if (topcard < 3) { |
1199 | 1198 | const char *n = "Unknown"; |
1200 | 1199 |
@@ -1207,7 +1206,7 @@ | ||
1207 | 1206 | n = "STK501"; |
1208 | 1207 | break; |
1209 | 1208 | } |
1210 | - avrdude_message("%sTopcard : %s\n", p, n); | |
1209 | + avrdude_message(MSG_INFO, "%sTopcard : %s\n", p, n); | |
1211 | 1210 | } |
1212 | 1211 | stk500_print_parms1(pgm, p); |
1213 | 1212 |
@@ -1225,11 +1224,11 @@ | ||
1225 | 1224 | stk500_getparm(pgm, Parm_STK_OSC_CMATCH, &osc_cmatch); |
1226 | 1225 | stk500_getparm(pgm, Parm_STK_SCK_DURATION, &sck_duration); |
1227 | 1226 | |
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); | |
1231 | 1230 | if (osc_pscale == 0) |
1232 | - avrdude_message("Off\n"); | |
1231 | + avrdude_message(MSG_INFO, "Off\n"); | |
1233 | 1232 | else { |
1234 | 1233 | int prescale = 1; |
1235 | 1234 | double f = STK500_XTAL / 2; |
@@ -1253,9 +1252,9 @@ | ||
1253 | 1252 | unit = "kHz"; |
1254 | 1253 | } else |
1255 | 1254 | unit = "Hz"; |
1256 | - avrdude_message("%.3f %s\n", f, unit); | |
1255 | + avrdude_message(MSG_INFO, "%.3f %s\n", f, unit); | |
1257 | 1256 | } |
1258 | - avrdude_message("%sSCK period : %.1f us\n", p, | |
1257 | + avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p, | |
1259 | 1258 | sck_duration * 8.0e6 / STK500_XTAL + 0.05); |
1260 | 1259 | |
1261 | 1260 | return; |
@@ -1270,7 +1269,7 @@ | ||
1270 | 1269 | static void stk500_setup(PROGRAMMER * pgm) |
1271 | 1270 | { |
1272 | 1271 | 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", | |
1274 | 1273 | progname); |
1275 | 1274 | return; |
1276 | 1275 | } |
@@ -43,7 +43,7 @@ | ||
43 | 43 | stk500_initpgm(pgm); |
44 | 44 | if (pgm->open(pgm, port) >= 0) |
45 | 45 | { |
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", | |
47 | 47 | progname); |
48 | 48 | return 0; |
49 | 49 | } |
@@ -53,12 +53,12 @@ | ||
53 | 53 | stk500v2_initpgm(pgm); |
54 | 54 | if (pgm->open(pgm, port) >= 0) |
55 | 55 | { |
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", | |
57 | 57 | progname); |
58 | 58 | return 0; |
59 | 59 | } |
60 | 60 | |
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", | |
62 | 62 | progname); |
63 | 63 | return -1; |
64 | 64 | } |
@@ -79,13 +79,13 @@ | ||
79 | 79 | #define RETRIES 5 |
80 | 80 | |
81 | 81 | #if 0 |
82 | -#define DEBUG(...) avrdude_message(__VA_ARGS__) | |
82 | +#define DEBUG(...) avrdude_message(MSG_INFO, __VA_ARGS__) | |
83 | 83 | #else |
84 | 84 | #define DEBUG(...) |
85 | 85 | #endif |
86 | 86 | |
87 | 87 | #if 0 |
88 | -#define DEBUGRECV(...) avrdude_message(__VA_ARGS__) | |
88 | +#define DEBUGRECV(...) avrdude_message(MSG_INFO, __VA_ARGS__) | |
89 | 89 | #else |
90 | 90 | #define DEBUGRECV(...) |
91 | 91 | #endif |
@@ -292,7 +292,7 @@ | ||
292 | 292 | void stk500v2_setup(PROGRAMMER * pgm) |
293 | 293 | { |
294 | 294 | 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", | |
296 | 296 | progname); |
297 | 297 | exit(1); |
298 | 298 | } |
@@ -306,7 +306,7 @@ | ||
306 | 306 | void *mycookie, *theircookie; |
307 | 307 | |
308 | 308 | 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", | |
310 | 310 | progname); |
311 | 311 | exit(1); |
312 | 312 | } |
@@ -329,7 +329,7 @@ | ||
329 | 329 | void *mycookie, *theircookie; |
330 | 330 | |
331 | 331 | 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", | |
333 | 333 | progname); |
334 | 334 | exit(1); |
335 | 335 | } |
@@ -388,7 +388,7 @@ | ||
388 | 388 | static int stk500v2_send_mk2(PROGRAMMER * pgm, unsigned char * data, size_t len) |
389 | 389 | { |
390 | 390 | 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); | |
392 | 392 | return -1; |
393 | 393 | } |
394 | 394 |
@@ -421,7 +421,7 @@ | ||
421 | 421 | |
422 | 422 | sz = get_jtagisp_return_size(data[0]); |
423 | 423 | 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", | |
425 | 425 | progname, data[0]); |
426 | 426 | return -1; |
427 | 427 | } |
@@ -441,7 +441,7 @@ | ||
441 | 441 | } |
442 | 442 | |
443 | 443 | 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", | |
445 | 445 | progname); |
446 | 446 | exit(1); |
447 | 447 | } |
@@ -468,7 +468,7 @@ | ||
468 | 468 | void *mycookie; |
469 | 469 | |
470 | 470 | 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", | |
472 | 472 | progname); |
473 | 473 | exit(1); |
474 | 474 | } |
@@ -513,7 +513,7 @@ | ||
513 | 513 | DEBUG(", %d)\n",len+6); |
514 | 514 | |
515 | 515 | 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); | |
517 | 517 | return -1; |
518 | 518 | } |
519 | 519 |
@@ -533,7 +533,7 @@ | ||
533 | 533 | |
534 | 534 | rv = serial_recv(&pgm->fd, msg, maxsize); |
535 | 535 | 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); | |
537 | 537 | return -1; |
538 | 538 | } |
539 | 539 |
@@ -552,12 +552,12 @@ | ||
552 | 552 | rv = jtagmkII_recv(pgm, &jtagmsg); |
553 | 553 | pgm->cookie = mycookie; |
554 | 554 | 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", | |
556 | 556 | progname); |
557 | 557 | return -1; |
558 | 558 | } |
559 | 559 | 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", | |
561 | 561 | progname, (unsigned)rv - 1, (unsigned)maxsize); |
562 | 562 | rv = maxsize; |
563 | 563 | } |
@@ -565,15 +565,15 @@ | ||
565 | 565 | case RSP_SPI_DATA: |
566 | 566 | break; |
567 | 567 | case RSP_FAILED: |
568 | - avrdude_message("%s: stk500v2_jtagmkII_recv(): failed\n", | |
568 | + avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): failed\n", | |
569 | 569 | progname); |
570 | 570 | return -1; |
571 | 571 | 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", | |
573 | 573 | progname); |
574 | 574 | return -1; |
575 | 575 | 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", | |
577 | 577 | progname, jtagmsg[0]); |
578 | 578 | return -1; |
579 | 579 | } |
@@ -593,7 +593,7 @@ | ||
593 | 593 | rv = jtag3_recv(pgm, &jtagmsg); |
594 | 594 | pgm->cookie = mycookie; |
595 | 595 | 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", | |
597 | 597 | progname); |
598 | 598 | return -1; |
599 | 599 | } |
@@ -602,13 +602,12 @@ | ||
602 | 602 | octets from the ICE. Thus, only complain at high verbose |
603 | 603 | levels. */ |
604 | 604 | 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", | |
607 | 606 | progname, (unsigned)rv - 1, (unsigned)maxsize); |
608 | 607 | rv = maxsize; |
609 | 608 | } |
610 | 609 | 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", | |
612 | 611 | progname, jtagmsg[0]); |
613 | 612 | free(jtagmsg); |
614 | 613 | return -1; |
@@ -688,12 +687,12 @@ | ||
688 | 687 | if (curlen < maxsize) { |
689 | 688 | msg[curlen] = c; |
690 | 689 | } 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", | |
692 | 691 | progname,curlen,(unsigned int)maxsize); |
693 | 692 | return -2; |
694 | 693 | } |
695 | 694 | 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", | |
697 | 696 | progname); |
698 | 697 | return -3; |
699 | 698 | } |
@@ -705,13 +704,13 @@ | ||
705 | 704 | state = sDONE; |
706 | 705 | } else { |
707 | 706 | state = sSTART; |
708 | - avrdude_message("%s: stk500v2_recv(): checksum error\n", | |
707 | + avrdude_message(MSG_INFO, "%s: stk500v2_recv(): checksum error\n", | |
709 | 708 | progname); |
710 | 709 | return -4; |
711 | 710 | } |
712 | 711 | break; |
713 | 712 | default: |
714 | - avrdude_message("%s: stk500v2_recv(): unknown state\n", | |
713 | + avrdude_message(MSG_INFO, "%s: stk500v2_recv(): unknown state\n", | |
715 | 714 | progname); |
716 | 715 | return -5; |
717 | 716 | } /* switch */ |
@@ -720,7 +719,7 @@ | ||
720 | 719 | tnow = tv.tv_sec; |
721 | 720 | if (tnow-tstart > timeoutval) { // wuff - signed/unsigned/overflow |
722 | 721 | timedout: |
723 | - avrdude_message("%s: stk500v2_ReceiveMessage(): timeout\n", | |
722 | + avrdude_message(MSG_INFO, "%s: stk500v2_ReceiveMessage(): timeout\n", | |
724 | 723 | progname); |
725 | 724 | return -1; |
726 | 725 | } |
@@ -774,19 +773,17 @@ | ||
774 | 773 | PDATA(pgm)->pgmtype = PGMTYPE_STK600; |
775 | 774 | } else { |
776 | 775 | 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 " | |
779 | 777 | "programmer %s, assuming STK500\n", |
780 | 778 | progname, resp + 3); |
781 | 779 | PDATA(pgm)->pgmtype = PGMTYPE_STK500; |
782 | 780 | } |
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", | |
785 | 782 | progname, pgmname[PDATA(pgm)->pgmtype]); |
786 | 783 | return 0; |
787 | 784 | } else { |
788 | 785 | 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", | |
790 | 787 | progname, resp[0]); |
791 | 788 | return -6; |
792 | 789 | } else |
@@ -796,7 +793,7 @@ | ||
796 | 793 | // or if we got a timeout |
797 | 794 | } else if (status == -1) { |
798 | 795 | 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", | |
800 | 797 | progname); |
801 | 798 | return -1; |
802 | 799 | } else |
@@ -805,7 +802,7 @@ | ||
805 | 802 | // or any other error |
806 | 803 | } else { |
807 | 804 | 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", | |
809 | 806 | progname,status); |
810 | 807 | } else |
811 | 808 | goto retry; |
@@ -836,7 +833,7 @@ | ||
836 | 833 | if (status > 0) { |
837 | 834 | DEBUG(" = %d\n",status); |
838 | 835 | 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); | |
840 | 837 | return -1; |
841 | 838 | } |
842 | 839 | if (buf[0] == CMD_XPROG_SETMODE || buf[0] == CMD_XPROG) { |
@@ -860,7 +857,7 @@ | ||
860 | 857 | case XPRG_ERR_TIMEOUT: msg = "Timeout"; break; |
861 | 858 | default: msg = "Unknown"; break; |
862 | 859 | } |
863 | - avrdude_message("%s: stk500v2_command(): error in %s: %s\n", | |
860 | + avrdude_message(MSG_INFO, "%s: stk500v2_command(): error in %s: %s\n", | |
864 | 861 | progname, |
865 | 862 | (buf[0] == CMD_XPROG_SETMODE? "CMD_XPROG_SETMODE": "CMD_XPROG"), |
866 | 863 | msg); |
@@ -893,19 +890,19 @@ | ||
893 | 890 | break; |
894 | 891 | } |
895 | 892 | if (quell_progress < 2) { |
896 | - avrdude_message("%s: stk500v2_command(): warning: %s\n", | |
893 | + avrdude_message(MSG_INFO, "%s: stk500v2_command(): warning: %s\n", | |
897 | 894 | progname, msg); |
898 | 895 | } |
899 | 896 | } else if (buf[1] == STATUS_CMD_OK) { |
900 | 897 | return status; |
901 | 898 | } 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", | |
903 | 900 | progname); |
904 | 901 | } 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", | |
906 | 903 | progname); |
907 | 904 | } 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", | |
909 | 906 | progname, buf[1]); |
910 | 907 | } |
911 | 908 | return -1; |
@@ -916,7 +913,7 @@ | ||
916 | 913 | status = stk500v2_getsync(pgm); |
917 | 914 | if (status != 0) { |
918 | 915 | 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", | |
920 | 917 | progname,buf[0]); |
921 | 918 | return -1; |
922 | 919 | } else |
@@ -946,11 +943,11 @@ | ||
946 | 943 | |
947 | 944 | result = stk500v2_command(pgm, buf, 8, sizeof(buf)); |
948 | 945 | 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", | |
950 | 947 | progname); |
951 | 948 | return -1; |
952 | 949 | } 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", | |
954 | 951 | progname, result); |
955 | 952 | return -1; |
956 | 953 | } |
@@ -967,7 +964,7 @@ | ||
967 | 964 | static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, const unsigned char *cmd, |
968 | 965 | unsigned char *res) |
969 | 966 | { |
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", | |
971 | 968 | progname); |
972 | 969 | |
973 | 970 | return -1; |
@@ -983,7 +980,7 @@ | ||
983 | 980 | unsigned char buf[16]; |
984 | 981 | |
985 | 982 | 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", | |
987 | 984 | progname, p->desc); |
988 | 985 | return -1; |
989 | 986 | } |
@@ -1103,7 +1100,7 @@ | ||
1103 | 1100 | PDATA(pgm)->lastpart = p; |
1104 | 1101 | |
1105 | 1102 | 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", | |
1107 | 1104 | progname, p->desc); |
1108 | 1105 | return -1; |
1109 | 1106 | } |
@@ -1134,11 +1131,11 @@ | ||
1134 | 1131 | case PGMTYPE_STK600: |
1135 | 1132 | case PGMTYPE_AVRISP_MKII: |
1136 | 1133 | 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", | |
1138 | 1135 | progname); |
1139 | 1136 | } else { |
1140 | 1137 | stk500v2_translate_conn_status(buf[0], msg); |
1141 | - avrdude_message("%s: stk500v2_program_enable():" | |
1138 | + avrdude_message(MSG_INFO, "%s: stk500v2_program_enable():" | |
1142 | 1139 | " bad AVRISPmkII connection status: %s\n", |
1143 | 1140 | progname, msg); |
1144 | 1141 | } |
@@ -1151,8 +1148,7 @@ | ||
1151 | 1148 | unsigned char cmd[4], *resp; |
1152 | 1149 | |
1153 | 1150 | /* 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", | |
1156 | 1152 | progname); |
1157 | 1153 | |
1158 | 1154 | mycookie = pgm->cookie; |
@@ -1182,11 +1178,11 @@ | ||
1182 | 1178 | } |
1183 | 1179 | pgm->cookie = mycookie; |
1184 | 1180 | 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", | |
1186 | 1182 | progname); |
1187 | 1183 | break; |
1188 | 1184 | } |
1189 | - avrdude_message("%s: Target prepared for ISP, signed off.\n" | |
1185 | + avrdude_message(MSG_INFO, "%s: Target prepared for ISP, signed off.\n" | |
1190 | 1186 | "%s: Now retrying without power-cycling the target.\n", |
1191 | 1187 | progname, progname); |
1192 | 1188 | goto retry; |
@@ -1270,7 +1266,7 @@ | ||
1270 | 1266 | AVRMEM *bootmem = avr_locate_mem(p, "boot"); |
1271 | 1267 | AVRMEM *flashmem = avr_locate_mem(p, "flash"); |
1272 | 1268 | 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", | |
1274 | 1270 | progname); |
1275 | 1271 | } else { |
1276 | 1272 | PDATA(pgm)->boot_start = bootmem->offset - flashmem->offset; |
@@ -1306,7 +1302,7 @@ | ||
1306 | 1302 | |
1307 | 1303 | if ((p->flags & AVRPART_HAS_PDI) || |
1308 | 1304 | (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", | |
1310 | 1306 | progname, p->desc); |
1311 | 1307 | return -1; |
1312 | 1308 | } |
@@ -1368,12 +1364,12 @@ | ||
1368 | 1364 | free(PDATA(pgm)->flash_pagecache); |
1369 | 1365 | free(PDATA(pgm)->eeprom_pagecache); |
1370 | 1366 | 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", | |
1372 | 1368 | progname); |
1373 | 1369 | return -1; |
1374 | 1370 | } |
1375 | 1371 | 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", | |
1377 | 1373 | progname); |
1378 | 1374 | free(PDATA(pgm)->flash_pagecache); |
1379 | 1375 | return -1; |
@@ -1395,7 +1391,7 @@ | ||
1395 | 1391 | AVRMEM * m; |
1396 | 1392 | |
1397 | 1393 | 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(): " | |
1399 | 1395 | "%s programming control stack not defined for part \"%s\"\n", |
1400 | 1396 | progname, |
1401 | 1397 | (mode == PPMODE? "parallel": "high-voltage serial"), |
@@ -1409,7 +1405,7 @@ | ||
1409 | 1405 | result = stk500v2_command(pgm, buf, CTL_STACK_SIZE + 1, sizeof(buf)); |
1410 | 1406 | |
1411 | 1407 | if (result < 0) { |
1412 | - avrdude_message("%s: stk500hv_initalize(): " | |
1408 | + avrdude_message(MSG_INFO, "%s: stk500hv_initalize(): " | |
1413 | 1409 | "failed to set control stack\n", |
1414 | 1410 | progname); |
1415 | 1411 | return -1; |
@@ -1439,12 +1435,12 @@ | ||
1439 | 1435 | free(PDATA(pgm)->flash_pagecache); |
1440 | 1436 | free(PDATA(pgm)->eeprom_pagecache); |
1441 | 1437 | 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", | |
1443 | 1439 | progname); |
1444 | 1440 | return -1; |
1445 | 1441 | } |
1446 | 1442 | 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", | |
1448 | 1444 | progname); |
1449 | 1445 | free(PDATA(pgm)->flash_pagecache); |
1450 | 1446 | return -1; |
@@ -1487,7 +1483,7 @@ | ||
1487 | 1483 | result = stk500v2_command(pgm, buf, 3, sizeof(buf)); |
1488 | 1484 | |
1489 | 1485 | 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", | |
1491 | 1487 | progname); |
1492 | 1488 | } |
1493 | 1489 |
@@ -1506,7 +1502,7 @@ | ||
1506 | 1502 | result = stk500v2_command(pgm, buf, 3, sizeof(buf)); |
1507 | 1503 | |
1508 | 1504 | 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", | |
1510 | 1506 | progname); |
1511 | 1507 | } |
1512 | 1508 |
@@ -1536,7 +1532,7 @@ | ||
1536 | 1532 | result = stk500v2_command(pgm, buf, 3, sizeof(buf)); |
1537 | 1533 | |
1538 | 1534 | if (result < 0) { |
1539 | - avrdude_message("%s: stk500hv_disable(): " | |
1535 | + avrdude_message(MSG_INFO, "%s: stk500hv_disable(): " | |
1540 | 1536 | "failed to leave programming mode\n", |
1541 | 1537 | progname); |
1542 | 1538 | } |
@@ -1582,7 +1578,7 @@ | ||
1582 | 1578 | serdev = &avrdoper_serdev; |
1583 | 1579 | PDATA(pgm)->pgmtype = PGMTYPE_STK500; |
1584 | 1580 | #else |
1585 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1581 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1586 | 1582 | return -1; |
1587 | 1583 | #endif |
1588 | 1584 | } |
@@ -1606,7 +1602,7 @@ | ||
1606 | 1602 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
1607 | 1603 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1608 | 1604 | #else |
1609 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1605 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1610 | 1606 | return -1; |
1611 | 1607 | #endif |
1612 | 1608 | } |
@@ -1664,7 +1660,7 @@ | ||
1664 | 1660 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_STK600; |
1665 | 1661 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
1666 | 1662 | #else |
1667 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
1663 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
1668 | 1664 | return -1; |
1669 | 1665 | #endif |
1670 | 1666 | } |
@@ -1717,7 +1713,7 @@ | ||
1717 | 1713 | result = stk500v2_command(pgm, buf, 5, sizeof(buf)); |
1718 | 1714 | |
1719 | 1715 | 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", | |
1721 | 1717 | progname); |
1722 | 1718 | return -1; |
1723 | 1719 | } |
@@ -1739,8 +1735,7 @@ | ||
1739 | 1735 | unsigned int pagesize = 0, use_ext_addr = 0, addrshift = 0; |
1740 | 1736 | unsigned char *cache_ptr = NULL; |
1741 | 1737 | |
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", | |
1744 | 1739 | progname, mem->desc, addr); |
1745 | 1740 | |
1746 | 1741 | if (strcmp(mem->desc, "flash") == 0) { |
@@ -1813,14 +1808,13 @@ | ||
1813 | 1808 | buf[1] = addr; |
1814 | 1809 | } |
1815 | 1810 | |
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: ", | |
1818 | 1812 | progname); |
1819 | 1813 | |
1820 | 1814 | result = stk500v2_command(pgm, buf, cmdlen, sizeof(buf)); |
1821 | 1815 | |
1822 | 1816 | if (result < 0) { |
1823 | - avrdude_message("%s: stk500hv_read_byte(): " | |
1817 | + avrdude_message(MSG_INFO, "%s: stk500hv_read_byte(): " | |
1824 | 1818 | "timeout/error communicating with programmer\n", |
1825 | 1819 | progname); |
1826 | 1820 | return -1; |
@@ -1871,8 +1865,7 @@ | ||
1871 | 1865 | unsigned char *cache_ptr = NULL; |
1872 | 1866 | OPCODE *op; |
1873 | 1867 | |
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", | |
1876 | 1869 | progname, mem->desc, addr); |
1877 | 1870 | |
1878 | 1871 | if (strcmp(mem->desc, "flash") == 0 || |
@@ -1927,13 +1920,13 @@ | ||
1927 | 1920 | |
1928 | 1921 | memset(buf + 1, 0, 5); |
1929 | 1922 | 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", | |
1931 | 1924 | progname, mem->desc); |
1932 | 1925 | return -1; |
1933 | 1926 | } |
1934 | 1927 | avr_set_bits(op, buf + 2); |
1935 | 1928 | 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", | |
1937 | 1930 | progname, mem->desc); |
1938 | 1931 | pollidx = 3; |
1939 | 1932 | } |
@@ -1940,14 +1933,13 @@ | ||
1940 | 1933 | buf[1] = pollidx + 1; |
1941 | 1934 | avr_set_addr(op, buf + 2, addr); |
1942 | 1935 | |
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: ", | |
1945 | 1937 | progname); |
1946 | 1938 | |
1947 | 1939 | result = stk500v2_command(pgm, buf, 6, sizeof(buf)); |
1948 | 1940 | |
1949 | 1941 | if (result < 0) { |
1950 | - avrdude_message("%s: stk500isp_read_byte(): " | |
1942 | + avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): " | |
1951 | 1943 | "timeout/error communicating with programmer\n", |
1952 | 1944 | progname); |
1953 | 1945 | return -1; |
@@ -1971,8 +1963,7 @@ | ||
1971 | 1963 | unsigned int pagesize = 0, use_ext_addr = 0, addrshift = 0; |
1972 | 1964 | unsigned char *cache_ptr = NULL; |
1973 | 1965 | |
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", | |
1976 | 1967 | progname, mem->desc, addr); |
1977 | 1968 | |
1978 | 1969 | if (strcmp(mem->desc, "flash") == 0) { |
@@ -2020,7 +2011,7 @@ | ||
2020 | 2011 | pulsewidth = p->programlockpulsewidth; |
2021 | 2012 | timeout = p->programlockpolltimeout; |
2022 | 2013 | } else { |
2023 | - avrdude_message("%s: stk500hv_write_byte(): " | |
2014 | + avrdude_message(MSG_INFO, "%s: stk500hv_write_byte(): " | |
2024 | 2015 | "unsupported memory type: %s\n", |
2025 | 2016 | progname, mem->desc); |
2026 | 2017 | return -1; |
@@ -2080,14 +2071,13 @@ | ||
2080 | 2071 | } |
2081 | 2072 | } |
2082 | 2073 | |
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: ", | |
2085 | 2075 | progname); |
2086 | 2076 | |
2087 | 2077 | result = stk500v2_command(pgm, buf, cmdlen, sizeof(buf)); |
2088 | 2078 | |
2089 | 2079 | if (result < 0) { |
2090 | - avrdude_message("%s: stk500hv_write_byte(): " | |
2080 | + avrdude_message(MSG_INFO, "%s: stk500hv_write_byte(): " | |
2091 | 2081 | "timeout/error communicating with programmer\n", |
2092 | 2082 | progname); |
2093 | 2083 | return -1; |
@@ -2133,8 +2123,7 @@ | ||
2133 | 2123 | unsigned char *cache_ptr = NULL; |
2134 | 2124 | OPCODE *op; |
2135 | 2125 | |
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", | |
2138 | 2127 | progname, mem->desc, addr); |
2139 | 2128 | |
2140 | 2129 | if (strcmp(mem->desc, "flash") == 0 || |
@@ -2186,7 +2175,7 @@ | ||
2186 | 2175 | } else if (strcmp(mem->desc, "lock") == 0) { |
2187 | 2176 | buf[0] = CMD_PROGRAM_LOCK_ISP; |
2188 | 2177 | } else { |
2189 | - avrdude_message("%s: stk500isp_write_byte(): " | |
2178 | + avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): " | |
2190 | 2179 | "unsupported memory type: %s\n", |
2191 | 2180 | progname, mem->desc); |
2192 | 2181 | return -1; |
@@ -2193,7 +2182,7 @@ | ||
2193 | 2182 | } |
2194 | 2183 | |
2195 | 2184 | if ((op = mem->op[AVR_OP_WRITE]) == NULL) { |
2196 | - avrdude_message("%s: stk500isp_write_byte(): " | |
2185 | + avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): " | |
2197 | 2186 | "no AVR_OP_WRITE for %s memory\n", |
2198 | 2187 | progname, mem->desc); |
2199 | 2188 | return -1; |
@@ -2203,14 +2192,13 @@ | ||
2203 | 2192 | avr_set_addr(op, buf + 1, addr); |
2204 | 2193 | avr_set_input(op, buf + 1, data); |
2205 | 2194 | |
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: ", | |
2208 | 2196 | progname); |
2209 | 2197 | |
2210 | 2198 | result = stk500v2_command(pgm, buf, 5, sizeof(buf)); |
2211 | 2199 | |
2212 | 2200 | if (result < 0) { |
2213 | - avrdude_message("%s: stk500isp_write_byte(): " | |
2201 | + avrdude_message(MSG_INFO, "%s: stk500isp_write_byte(): " | |
2214 | 2202 | "timeout/error communicating with programmer\n", |
2215 | 2203 | progname); |
2216 | 2204 | return -1; |
@@ -2284,7 +2272,7 @@ | ||
2284 | 2272 | commandbuf[3] = m->mode | 0x80; // yes, write the page to flash |
2285 | 2273 | |
2286 | 2274 | 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", | |
2288 | 2276 | progname, p->desc); |
2289 | 2277 | return -1; |
2290 | 2278 | } |
@@ -2292,7 +2280,7 @@ | ||
2292 | 2280 | commandbuf[5] = cmds[0]; |
2293 | 2281 | |
2294 | 2282 | 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", | |
2296 | 2284 | progname, p->desc); |
2297 | 2285 | return -1; |
2298 | 2286 | } |
@@ -2305,7 +2293,7 @@ | ||
2305 | 2293 | commandbuf[3] = m->mode | 0x80; // yes, write the words to flash |
2306 | 2294 | |
2307 | 2295 | 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", | |
2309 | 2297 | progname, p->desc); |
2310 | 2298 | return -1; |
2311 | 2299 | } |
@@ -2316,7 +2304,7 @@ | ||
2316 | 2304 | |
2317 | 2305 | // the read command is common to both methods |
2318 | 2306 | 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", | |
2320 | 2308 | progname, p->desc); |
2321 | 2309 | return -1; |
2322 | 2310 | } |
@@ -2351,7 +2339,7 @@ | ||
2351 | 2339 | |
2352 | 2340 | result = stk500v2_command(pgm,buf,block_size+10, sizeof(buf)); |
2353 | 2341 | 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", | |
2355 | 2343 | progname); |
2356 | 2344 | return -1; |
2357 | 2345 | } |
@@ -2446,7 +2434,7 @@ | ||
2446 | 2434 | |
2447 | 2435 | result = stk500v2_command(pgm, buf, page_size + 5, sizeof(buf)); |
2448 | 2436 | 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", | |
2450 | 2438 | progname); |
2451 | 2439 | return -1; |
2452 | 2440 | } |
@@ -2519,7 +2507,7 @@ | ||
2519 | 2507 | |
2520 | 2508 | // the read command is common to both methods |
2521 | 2509 | 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", | |
2523 | 2511 | progname, p->desc); |
2524 | 2512 | return -1; |
2525 | 2513 | } |
@@ -2548,14 +2536,14 @@ | ||
2548 | 2536 | |
2549 | 2537 | result = stk500v2_command(pgm,buf,4,sizeof(buf)); |
2550 | 2538 | 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", | |
2552 | 2540 | progname); |
2553 | 2541 | return -1; |
2554 | 2542 | } |
2555 | 2543 | #if 0 |
2556 | 2544 | 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"); | |
2559 | 2547 | } |
2560 | 2548 | #endif |
2561 | 2549 |
@@ -2628,14 +2616,14 @@ | ||
2628 | 2616 | |
2629 | 2617 | result = stk500v2_command(pgm, buf, 3, sizeof(buf)); |
2630 | 2618 | 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", | |
2632 | 2620 | progname); |
2633 | 2621 | return -1; |
2634 | 2622 | } |
2635 | 2623 | #if 0 |
2636 | 2624 | 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"); | |
2639 | 2627 | } |
2640 | 2628 | #endif |
2641 | 2629 |
@@ -2669,7 +2657,7 @@ | ||
2669 | 2657 | static int stk500v2_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, |
2670 | 2658 | unsigned int addr) |
2671 | 2659 | { |
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", | |
2673 | 2661 | progname); |
2674 | 2662 | return -1; |
2675 | 2663 | } |
@@ -2681,13 +2669,13 @@ | ||
2681 | 2669 | utarg = (unsigned)((v + 0.049) * 10); |
2682 | 2670 | |
2683 | 2671 | 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", | |
2685 | 2673 | progname); |
2686 | 2674 | return -1; |
2687 | 2675 | } |
2688 | 2676 | |
2689 | 2677 | 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", | |
2691 | 2679 | progname, uaref / 10.0, v); |
2692 | 2680 | if (stk500v2_setparm(pgm, PARAM_VADJUST, utarg) |
2693 | 2681 | != 0) |
@@ -2705,13 +2693,13 @@ | ||
2705 | 2693 | uaref = (unsigned)((v + 0.049) * 10); |
2706 | 2694 | |
2707 | 2695 | 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", | |
2709 | 2697 | progname); |
2710 | 2698 | return -1; |
2711 | 2699 | } |
2712 | 2700 | |
2713 | 2701 | 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 " | |
2715 | 2703 | "V[target] = %.1f\n", |
2716 | 2704 | progname, utarg / 10.0); |
2717 | 2705 | return -1; |
@@ -2741,7 +2729,7 @@ | ||
2741 | 2729 | unit = "kHz"; |
2742 | 2730 | } else |
2743 | 2731 | 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", | |
2745 | 2733 | progname, v, unit, STK500V2_XTAL / 2e6); |
2746 | 2734 | fosc = STK500V2_XTAL / 2; |
2747 | 2735 | } else |
@@ -2756,7 +2744,7 @@ | ||
2756 | 2744 | } |
2757 | 2745 | } |
2758 | 2746 | 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", | |
2760 | 2748 | progname, fosc, STK500V2_XTAL / (256 * 1024 * 2)); |
2761 | 2749 | return -1; |
2762 | 2750 | } |
@@ -2802,8 +2790,7 @@ | ||
2802 | 2790 | break; |
2803 | 2791 | } |
2804 | 2792 | |
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", | |
2807 | 2794 | 1000000 / avrispmkIIfreqs[i], i); |
2808 | 2795 | |
2809 | 2796 | return stk500v2_setparm(pgm, PARAM_SCK_DURATION, i); |
@@ -2826,7 +2813,7 @@ | ||
2826 | 2813 | case 64: return 6u << 1; |
2827 | 2814 | case 128: return 7u << 1; |
2828 | 2815 | } |
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", | |
2830 | 2817 | progname, pagesize); |
2831 | 2818 | return 0; |
2832 | 2819 | } |
@@ -2895,13 +2882,13 @@ | ||
2895 | 2882 | utarg = (unsigned)((v + 0.049) * 10); |
2896 | 2883 | |
2897 | 2884 | 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", | |
2899 | 2886 | progname); |
2900 | 2887 | return -1; |
2901 | 2888 | } |
2902 | 2889 | |
2903 | 2890 | 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", | |
2905 | 2892 | progname, uaref / 100.0, v); |
2906 | 2893 | uaref = 10 * (unsigned)utarg; |
2907 | 2894 | if (stk500v2_setparm2(pgm, PARAM2_AREF0, uaref) |
@@ -2910,13 +2897,13 @@ | ||
2910 | 2897 | } |
2911 | 2898 | |
2912 | 2899 | 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", | |
2914 | 2901 | progname); |
2915 | 2902 | return -1; |
2916 | 2903 | } |
2917 | 2904 | |
2918 | 2905 | 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", | |
2920 | 2907 | progname, uaref / 100.0, v); |
2921 | 2908 | uaref = 10 * (unsigned)utarg; |
2922 | 2909 | if (stk500v2_setparm2(pgm, PARAM2_AREF1, uaref) |
@@ -2946,13 +2933,13 @@ | ||
2946 | 2933 | uaref = (unsigned)((v + 0.0049) * 100); |
2947 | 2934 | |
2948 | 2935 | 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", | |
2950 | 2937 | progname); |
2951 | 2938 | return -1; |
2952 | 2939 | } |
2953 | 2940 | |
2954 | 2941 | 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 " | |
2956 | 2943 | "V[target] = %.1f\n", |
2957 | 2944 | progname, utarg / 10.0); |
2958 | 2945 | return -1; |
@@ -2967,7 +2954,7 @@ | ||
2967 | 2954 | return stk500v2_setparm2(pgm, PARAM2_AREF1, uaref); |
2968 | 2955 | |
2969 | 2956 | 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", | |
2971 | 2958 | progname, chan); |
2972 | 2959 | return -1; |
2973 | 2960 | } |
@@ -3027,7 +3014,7 @@ | ||
3027 | 3014 | buf[1] = parm; |
3028 | 3015 | |
3029 | 3016 | 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", | |
3031 | 3018 | progname, parm); |
3032 | 3019 | return -1; |
3033 | 3020 | } |
@@ -3046,7 +3033,7 @@ | ||
3046 | 3033 | buf[2] = value; |
3047 | 3034 | |
3048 | 3035 | 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", | |
3050 | 3037 | progname, parm); |
3051 | 3038 | return -1; |
3052 | 3039 | } |
@@ -3061,11 +3048,11 @@ | ||
3061 | 3048 | |
3062 | 3049 | res = stk500v2_getparm(pgm, parm, ¤t_value); |
3063 | 3050 | 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); | |
3065 | 3052 | |
3066 | 3053 | // 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); | |
3069 | 3056 | return 0; |
3070 | 3057 | } |
3071 | 3058 |
@@ -3080,7 +3067,7 @@ | ||
3080 | 3067 | buf[1] = parm; |
3081 | 3068 | |
3082 | 3069 | 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", | |
3084 | 3071 | progname, parm); |
3085 | 3072 | return -1; |
3086 | 3073 | } |
@@ -3100,7 +3087,7 @@ | ||
3100 | 3087 | buf[3] = value; |
3101 | 3088 | |
3102 | 3089 | 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", | |
3104 | 3091 | progname, parm); |
3105 | 3092 | return -1; |
3106 | 3093 | } |
@@ -3141,19 +3128,19 @@ | ||
3141 | 3128 | } |
3142 | 3129 | if (PDATA(pgm)->pgmtype != PGMTYPE_JTAGICE_MKII && |
3143 | 3130 | 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); | |
3145 | 3132 | stk500v2_getparm(pgm, PARAM_HW_VER, &hdw); |
3146 | 3133 | stk500v2_getparm(pgm, PARAM_SW_MAJOR, &maj); |
3147 | 3134 | 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); | |
3150 | 3137 | if (PDATA(pgm)->pgmtype == PGMTYPE_STK600) { |
3151 | 3138 | stk500v2_getparm(pgm, PARAM_SW_MAJOR_SLAVE1, &maj_s1); |
3152 | 3139 | stk500v2_getparm(pgm, PARAM_SW_MINOR_SLAVE1, &min_s1); |
3153 | 3140 | stk500v2_getparm(pgm, PARAM_SW_MAJOR_SLAVE2, &maj_s2); |
3154 | 3141 | 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); | |
3157 | 3144 | } |
3158 | 3145 | } |
3159 | 3146 |
@@ -3168,22 +3155,22 @@ | ||
3168 | 3155 | case 0xDD: topcard_name = "STK520"; break; |
3169 | 3156 | default: topcard_name = "Unknown"; break; |
3170 | 3157 | } |
3171 | - avrdude_message("%sTopcard : %s\n", p, topcard_name); | |
3158 | + avrdude_message(MSG_INFO, "%sTopcard : %s\n", p, topcard_name); | |
3172 | 3159 | } else if (PDATA(pgm)->pgmtype == PGMTYPE_STK600) { |
3173 | 3160 | 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, | |
3175 | 3162 | stk600_get_cardname(routing_cards, |
3176 | 3163 | sizeof routing_cards / sizeof routing_cards[0], |
3177 | 3164 | topcard)); |
3178 | 3165 | 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, | |
3180 | 3167 | stk600_get_cardname(socket_cards, |
3181 | 3168 | sizeof socket_cards / sizeof socket_cards[0], |
3182 | 3169 | topcard)); |
3183 | 3170 | 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); | |
3185 | 3172 | 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); | |
3187 | 3174 | } |
3188 | 3175 | stk500v2_print_parms1(pgm, p); |
3189 | 3176 |
@@ -3220,7 +3207,7 @@ | ||
3220 | 3207 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3221 | 3208 | jtagmkII_getparm(pgm, PAR_OCD_VTARGET, vtarget_jtag); |
3222 | 3209 | pgm->cookie = mycookie; |
3223 | - avrdude_message("%sVtarget : %.1f V\n", p, | |
3210 | + avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, | |
3224 | 3211 | b2_to_u16(vtarget_jtag) / 1000.0); |
3225 | 3212 | } else if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE3) { |
3226 | 3213 | mycookie = pgm->cookie; |
@@ -3227,12 +3214,12 @@ | ||
3227 | 3214 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3228 | 3215 | jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, vtarget_jtag, 2); |
3229 | 3216 | pgm->cookie = mycookie; |
3230 | - avrdude_message("%sVtarget : %.1f V\n", p, | |
3217 | + avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, | |
3231 | 3218 | b2_to_u16(vtarget_jtag) / 1000.0); |
3232 | 3219 | |
3233 | 3220 | } else { |
3234 | 3221 | 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); | |
3236 | 3223 | } |
3237 | 3224 | |
3238 | 3225 | switch (PDATA(pgm)->pgmtype) { |
@@ -3241,12 +3228,12 @@ | ||
3241 | 3228 | stk500v2_getparm(pgm, PARAM_VADJUST, &vadjust); |
3242 | 3229 | stk500v2_getparm(pgm, PARAM_OSC_PSCALE, &osc_pscale); |
3243 | 3230 | 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, | |
3245 | 3232 | 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); | |
3248 | 3235 | if (osc_pscale == 0) |
3249 | - avrdude_message("Off\n"); | |
3236 | + avrdude_message(MSG_INFO, "Off\n"); | |
3250 | 3237 | else { |
3251 | 3238 | prescale = 1; |
3252 | 3239 | f = STK500V2_XTAL / 2; |
@@ -3262,7 +3249,7 @@ | ||
3262 | 3249 | f /= prescale; |
3263 | 3250 | f /= (osc_cmatch + 1); |
3264 | 3251 | 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); | |
3266 | 3253 | } |
3267 | 3254 | break; |
3268 | 3255 |
@@ -3269,7 +3256,7 @@ | ||
3269 | 3256 | case PGMTYPE_AVRISP_MKII: |
3270 | 3257 | case PGMTYPE_JTAGICE_MKII: |
3271 | 3258 | 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, | |
3273 | 3260 | (float) 1000000 / avrispmkIIfreqs[sck_duration]); |
3274 | 3261 | break; |
3275 | 3262 |
@@ -3281,7 +3268,7 @@ | ||
3281 | 3268 | if (stk500v2_jtag3_send(pgm, cmd, 1) >= 0 && |
3282 | 3269 | stk500v2_jtag3_recv(pgm, cmd, 4) >= 2) { |
3283 | 3270 | 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, | |
3285 | 3272 | (float)(1E6 / (1000.0 * sck))); |
3286 | 3273 | } |
3287 | 3274 | } |
@@ -3289,11 +3276,11 @@ | ||
3289 | 3276 | |
3290 | 3277 | case PGMTYPE_STK600: |
3291 | 3278 | 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); | |
3293 | 3280 | 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); | |
3295 | 3282 | 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, | |
3297 | 3284 | (float) (sck_stk600 + 1) / 8.0); |
3298 | 3285 | stk500v2_getparm2(pgm, PARAM2_CLOCK_CONF, &clock_conf); |
3299 | 3286 | oct = (clock_conf & 0xf000) >> 12u; |
@@ -3300,12 +3287,12 @@ | ||
3300 | 3287 | dac = (clock_conf & 0x0ffc) >> 2u; |
3301 | 3288 | f = pow(2, (double)oct) * 2078.0 / (2 - (double)dac / 1024.0); |
3302 | 3289 | f = f_to_kHz_MHz(f, &unit); |
3303 | - avrdude_message("%sOscillator : %.3f %s\n", | |
3290 | + avrdude_message(MSG_INFO, "%sOscillator : %.3f %s\n", | |
3304 | 3291 | p, f, unit); |
3305 | 3292 | break; |
3306 | 3293 | |
3307 | 3294 | default: |
3308 | - avrdude_message("%sSCK period : %.1f us\n", p, | |
3295 | + avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p, | |
3309 | 3296 | sck_duration * 8.0e6 / STK500V2_XTAL + 0.05); |
3310 | 3297 | break; |
3311 | 3298 | } |
@@ -3328,7 +3315,7 @@ | ||
3328 | 3315 | |
3329 | 3316 | rv = stk500v2_command(pgm, buf, 1, sizeof(buf)); |
3330 | 3317 | if (rv < 0) { |
3331 | - avrdude_message("%s: stk500v2_perform_osccal(): failed\n", | |
3318 | + avrdude_message(MSG_INFO, "%s: stk500v2_perform_osccal(): failed\n", | |
3332 | 3319 | progname); |
3333 | 3320 | return -1; |
3334 | 3321 | } |
@@ -3352,8 +3339,7 @@ | ||
3352 | 3339 | void *mycookie; |
3353 | 3340 | int rv; |
3354 | 3341 | |
3355 | - if (verbose >= 2) | |
3356 | - avrdude_message("%s: stk500v2_jtagmkII_open()\n", progname); | |
3342 | + avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtagmkII_open()\n", progname); | |
3357 | 3343 | |
3358 | 3344 | /* |
3359 | 3345 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -3380,7 +3366,7 @@ | ||
3380 | 3366 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
3381 | 3367 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
3382 | 3368 | #else |
3383 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
3369 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
3384 | 3370 | return -1; |
3385 | 3371 | #endif |
3386 | 3372 | } |
@@ -3399,7 +3385,7 @@ | ||
3399 | 3385 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3400 | 3386 | if ((rv = jtagmkII_getsync(pgm, EMULATOR_MODE_SPI)) != 0) { |
3401 | 3387 | 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", | |
3403 | 3389 | progname); |
3404 | 3390 | pgm->cookie = mycookie; |
3405 | 3391 | return -1; |
@@ -3424,8 +3410,7 @@ | ||
3424 | 3410 | { |
3425 | 3411 | void *mycookie; |
3426 | 3412 | |
3427 | - if (verbose >= 2) | |
3428 | - avrdude_message("%s: stk500v2_jtagmkII_close()\n", progname); | |
3413 | + avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtagmkII_close()\n", progname); | |
3429 | 3414 | |
3430 | 3415 | mycookie = pgm->cookie; |
3431 | 3416 | pgm->cookie = PDATA(pgm)->chained_pdata; |
@@ -3441,8 +3426,7 @@ | ||
3441 | 3426 | { |
3442 | 3427 | void *mycookie; |
3443 | 3428 | |
3444 | - if (verbose >= 2) | |
3445 | - avrdude_message("%s: stk500v2_jtag3_close()\n", progname); | |
3429 | + avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtag3_close()\n", progname); | |
3446 | 3430 | |
3447 | 3431 | mycookie = pgm->cookie; |
3448 | 3432 | pgm->cookie = PDATA(pgm)->chained_pdata; |
@@ -3466,8 +3450,7 @@ | ||
3466 | 3450 | union pinfo pinfo; |
3467 | 3451 | void *mycookie; |
3468 | 3452 | |
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); | |
3471 | 3454 | |
3472 | 3455 | /* |
3473 | 3456 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -3494,7 +3477,7 @@ | ||
3494 | 3477 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
3495 | 3478 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
3496 | 3479 | #else |
3497 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
3480 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
3498 | 3481 | return -1; |
3499 | 3482 | #endif |
3500 | 3483 | } |
@@ -3512,7 +3495,7 @@ | ||
3512 | 3495 | mycookie = pgm->cookie; |
3513 | 3496 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3514 | 3497 | 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", | |
3516 | 3499 | progname); |
3517 | 3500 | pgm->cookie = mycookie; |
3518 | 3501 | return -1; |
@@ -3545,8 +3528,7 @@ | ||
3545 | 3528 | union pinfo pinfo; |
3546 | 3529 | void *mycookie; |
3547 | 3530 | |
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); | |
3550 | 3532 | |
3551 | 3533 | /* |
3552 | 3534 | * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon |
@@ -3573,7 +3555,7 @@ | ||
3573 | 3555 | pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII; |
3574 | 3556 | pgm->fd.usb.eep = 0; /* no seperate EP for events */ |
3575 | 3557 | #else |
3576 | - avrdude_message("avrdude was compiled without usb support.\n"); | |
3558 | + avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n"); | |
3577 | 3559 | return -1; |
3578 | 3560 | #endif |
3579 | 3561 | } |
@@ -3591,7 +3573,7 @@ | ||
3591 | 3573 | mycookie = pgm->cookie; |
3592 | 3574 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3593 | 3575 | 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", | |
3595 | 3577 | progname); |
3596 | 3578 | pgm->cookie = mycookie; |
3597 | 3579 | return -1; |
@@ -3623,8 +3605,7 @@ | ||
3623 | 3605 | void *mycookie; |
3624 | 3606 | int rv; |
3625 | 3607 | |
3626 | - if (verbose >= 2) | |
3627 | - avrdude_message("%s: stk500v2_jtag3_open()\n", progname); | |
3608 | + avrdude_message(MSG_NOTICE2, "%s: stk500v2_jtag3_open()\n", progname); | |
3628 | 3609 | |
3629 | 3610 | if (jtag3_open_common(pgm, port) < 0) |
3630 | 3611 | return -1; |
@@ -3633,7 +3614,7 @@ | ||
3633 | 3614 | pgm->cookie = PDATA(pgm)->chained_pdata; |
3634 | 3615 | if ((rv = jtag3_getsync(pgm, 42)) != 0) { |
3635 | 3616 | 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", | |
3637 | 3618 | progname); |
3638 | 3619 | pgm->cookie = mycookie; |
3639 | 3620 | return -1; |
@@ -3667,7 +3648,7 @@ | ||
3667 | 3648 | s = cmdsize; |
3668 | 3649 | |
3669 | 3650 | 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", | |
3671 | 3652 | progname); |
3672 | 3653 | return -1; |
3673 | 3654 | } |
@@ -3700,13 +3681,13 @@ | ||
3700 | 3681 | |
3701 | 3682 | if (!use_tpi) { |
3702 | 3683 | 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", | |
3704 | 3685 | progname); |
3705 | 3686 | return -1; |
3706 | 3687 | } |
3707 | 3688 | if ((mem = avr_locate_mem(p, "eeprom")) != NULL) { |
3708 | 3689 | 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", | |
3710 | 3691 | progname); |
3711 | 3692 | return -1; |
3712 | 3693 | } |
@@ -3717,7 +3698,7 @@ | ||
3717 | 3698 | buf[0] = CMD_XPROG_SETMODE; |
3718 | 3699 | buf[1] = use_tpi? XPRG_MODE_TPI: XPRG_MODE_PDI; |
3719 | 3700 | 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", | |
3721 | 3702 | progname, use_tpi? "TPI": "PDI"); |
3722 | 3703 | return -1; |
3723 | 3704 | } |
@@ -3724,7 +3705,7 @@ | ||
3724 | 3705 | |
3725 | 3706 | buf[0] = XPRG_CMD_ENTER_PROGMODE; |
3726 | 3707 | 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", | |
3728 | 3709 | progname); |
3729 | 3710 | return -1; |
3730 | 3711 | } |
@@ -3741,7 +3722,7 @@ | ||
3741 | 3722 | buf[1] = XPRG_PARAM_TPI_3; |
3742 | 3723 | buf[2] = 51; |
3743 | 3724 | 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", | |
3745 | 3726 | progname); |
3746 | 3727 | return -1; |
3747 | 3728 | } |
@@ -3750,7 +3731,7 @@ | ||
3750 | 3731 | buf[1] = XPRG_PARAM_TPI_4; |
3751 | 3732 | buf[2] = 50; |
3752 | 3733 | 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", | |
3754 | 3735 | progname); |
3755 | 3736 | return -1; |
3756 | 3737 | } |
@@ -3770,7 +3751,7 @@ | ||
3770 | 3751 | buf[4] = nvm_base >> 8; |
3771 | 3752 | buf[5] = nvm_base; |
3772 | 3753 | 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", | |
3774 | 3755 | progname); |
3775 | 3756 | return -1; |
3776 | 3757 | } |
@@ -3781,7 +3762,7 @@ | ||
3781 | 3762 | buf[2] = eepagesize >> 8; |
3782 | 3763 | buf[3] = eepagesize; |
3783 | 3764 | 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", | |
3785 | 3766 | progname); |
3786 | 3767 | return -1; |
3787 | 3768 | } |
@@ -3806,7 +3787,7 @@ | ||
3806 | 3787 | |
3807 | 3788 | buf[0] = XPRG_CMD_LEAVE_PROGMODE; |
3808 | 3789 | 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", | |
3810 | 3791 | progname); |
3811 | 3792 | } |
3812 | 3793 | } |
@@ -3843,7 +3824,7 @@ | ||
3843 | 3824 | } else if (strcmp(mem->desc, "usersig") == 0) { |
3844 | 3825 | memcode = XPRG_MEM_TYPE_USERSIG; |
3845 | 3826 | } 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", | |
3847 | 3828 | progname, mem->desc); |
3848 | 3829 | return -1; |
3849 | 3830 | } |
@@ -3857,7 +3838,7 @@ | ||
3857 | 3838 | b[4] = mem->offset >> 8; |
3858 | 3839 | b[5] = mem->offset + 1; |
3859 | 3840 | 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", | |
3861 | 3842 | progname); |
3862 | 3843 | return -1; |
3863 | 3844 | } |
@@ -3884,7 +3865,7 @@ | ||
3884 | 3865 | b[8] = write_size; |
3885 | 3866 | b[9] = data; |
3886 | 3867 | 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", | |
3888 | 3869 | progname); |
3889 | 3870 | return -1; |
3890 | 3871 | } |
@@ -3917,7 +3898,7 @@ | ||
3917 | 3898 | } else if (strcmp(mem->desc, "usersig") == 0) { |
3918 | 3899 | b[1] = XPRG_MEM_TYPE_USERSIG; |
3919 | 3900 | } 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", | |
3921 | 3902 | progname, mem->desc); |
3922 | 3903 | return -1; |
3923 | 3904 | } |
@@ -3931,7 +3912,7 @@ | ||
3931 | 3912 | b[6] = 0; |
3932 | 3913 | b[7] = 1; |
3933 | 3914 | 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", | |
3935 | 3916 | progname); |
3936 | 3917 | return -1; |
3937 | 3918 | } |
@@ -3991,7 +3972,7 @@ | ||
3991 | 3972 | } else if (strcmp(mem->desc, "usersig") == 0) { |
3992 | 3973 | memtype = XPRG_MEM_TYPE_USERSIG; |
3993 | 3974 | } 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", | |
3995 | 3976 | progname, mem->desc); |
3996 | 3977 | return -1; |
3997 | 3978 | } |
@@ -3999,7 +3980,7 @@ | ||
3999 | 3980 | addr += mem->offset; |
4000 | 3981 | |
4001 | 3982 | 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", | |
4003 | 3984 | progname); |
4004 | 3985 | return -1; |
4005 | 3986 | } |
@@ -4022,7 +4003,7 @@ | ||
4022 | 4003 | b[6] = page_size >> 8; |
4023 | 4004 | b[7] = page_size; |
4024 | 4005 | 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", | |
4026 | 4007 | progname); |
4027 | 4008 | free(b); |
4028 | 4009 | return -1; |
@@ -4057,7 +4038,7 @@ | ||
4057 | 4038 | * transfer. |
4058 | 4039 | */ |
4059 | 4040 | 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", | |
4061 | 4042 | progname); |
4062 | 4043 | return -1; |
4063 | 4044 | } |
@@ -4105,7 +4086,7 @@ | ||
4105 | 4086 | memtype = XPRG_MEM_TYPE_USERSIG; |
4106 | 4087 | writemode = (1 << XPRG_MEM_WRITE_WRITE); |
4107 | 4088 | } 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", | |
4109 | 4090 | progname, mem->desc); |
4110 | 4091 | return -1; |
4111 | 4092 | } |
@@ -4113,7 +4094,7 @@ | ||
4113 | 4094 | addr += mem->offset; |
4114 | 4095 | |
4115 | 4096 | 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", | |
4117 | 4098 | progname); |
4118 | 4099 | return -1; |
4119 | 4100 | } |
@@ -4139,7 +4120,7 @@ | ||
4139 | 4120 | * erase page / write page bits in the final chunk helps. |
4140 | 4121 | */ |
4141 | 4122 | 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", | |
4143 | 4124 | progname); |
4144 | 4125 | free(b); |
4145 | 4126 | return -1; |
@@ -4163,7 +4144,7 @@ | ||
4163 | 4144 | b[8] = 0; |
4164 | 4145 | memcpy(b + 9, mem->buf + offset, writesize); |
4165 | 4146 | 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", | |
4167 | 4148 | progname); |
4168 | 4149 | free(b); |
4169 | 4150 | return -1; |
@@ -4197,7 +4178,7 @@ | ||
4197 | 4178 | b[8] = page_size; |
4198 | 4179 | memcpy(b + 9, mem->buf + offset, writesize); |
4199 | 4180 | 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", | |
4201 | 4182 | progname); |
4202 | 4183 | free(b); |
4203 | 4184 | return -1; |
@@ -4223,7 +4204,7 @@ | ||
4223 | 4204 | |
4224 | 4205 | if (p->flags & AVRPART_HAS_TPI) { |
4225 | 4206 | 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", | |
4227 | 4208 | progname); |
4228 | 4209 | return -1; |
4229 | 4210 | } |
@@ -4237,7 +4218,7 @@ | ||
4237 | 4218 | b[4] = addr >> 8; |
4238 | 4219 | b[5] = addr; |
4239 | 4220 | 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", | |
4241 | 4222 | progname); |
4242 | 4223 | return -1; |
4243 | 4224 | } |
@@ -4262,7 +4243,7 @@ | ||
4262 | 4243 | } else if (strcmp(m->desc, "usersig") == 0) { |
4263 | 4244 | b[1] = XPRG_ERASE_USERSIG; |
4264 | 4245 | } 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", | |
4266 | 4247 | progname, m->desc); |
4267 | 4248 | return -1; |
4268 | 4249 | } |
@@ -4273,7 +4254,7 @@ | ||
4273 | 4254 | b[4] = addr >> 8; |
4274 | 4255 | b[5] = addr; |
4275 | 4256 | 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", | |
4277 | 4258 | progname, b[1]); |
4278 | 4259 | return -1; |
4279 | 4260 | } |
@@ -243,7 +243,7 @@ | ||
243 | 243 | int rc; |
244 | 244 | |
245 | 245 | 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"); | |
247 | 247 | return -1; |
248 | 248 | } |
249 | 249 |
@@ -258,7 +258,7 @@ | ||
258 | 258 | |
259 | 259 | mem = avr_locate_mem(p, memtype); |
260 | 260 | 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", | |
262 | 262 | memtype, p->desc); |
263 | 263 | return -1; |
264 | 264 | } |
@@ -266,7 +266,7 @@ | ||
266 | 266 | if (argc == 4) { |
267 | 267 | addr = strtoul(argv[2], &e, 0); |
268 | 268 | 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", | |
270 | 270 | progname, argv[2]); |
271 | 271 | return -1; |
272 | 272 | } |
@@ -273,7 +273,7 @@ | ||
273 | 273 | |
274 | 274 | len = strtol(argv[3], &e, 0); |
275 | 275 | 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", | |
277 | 277 | progname, argv[3]); |
278 | 278 | return -1; |
279 | 279 | } |
@@ -287,7 +287,7 @@ | ||
287 | 287 | addr = 0; |
288 | 288 | } |
289 | 289 | 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", | |
291 | 291 | progname, addr, mem->desc); |
292 | 292 | return -1; |
293 | 293 | } |
@@ -299,7 +299,7 @@ | ||
299 | 299 | |
300 | 300 | buf = malloc(len); |
301 | 301 | 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); | |
303 | 303 | return -1; |
304 | 304 | } |
305 | 305 |
@@ -306,10 +306,10 @@ | ||
306 | 306 | for (i=0; i<len; i++) { |
307 | 307 | rc = pgm->read_byte(pgm, p, mem, addr+i, &buf[i]); |
308 | 308 | 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", | |
310 | 310 | mem->desc, addr+i, p->desc); |
311 | 311 | 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", | |
313 | 313 | mem->desc); |
314 | 314 | return -1; |
315 | 315 | } |
@@ -341,7 +341,7 @@ | ||
341 | 341 | AVRMEM * mem; |
342 | 342 | |
343 | 343 | if (argc < 4) { |
344 | - avrdude_message("Usage: write <memtype> <addr> <byte1> " | |
344 | + avrdude_message(MSG_INFO, "Usage: write <memtype> <addr> <byte1> " | |
345 | 345 | "<byte2> ... byteN>\n"); |
346 | 346 | return -1; |
347 | 347 | } |
@@ -350,7 +350,7 @@ | ||
350 | 350 | |
351 | 351 | mem = avr_locate_mem(p, memtype); |
352 | 352 | 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", | |
354 | 354 | memtype, p->desc); |
355 | 355 | return -1; |
356 | 356 | } |
@@ -359,13 +359,13 @@ | ||
359 | 359 | |
360 | 360 | addr = strtoul(argv[2], &e, 0); |
361 | 361 | 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", | |
363 | 363 | progname, argv[2]); |
364 | 364 | return -1; |
365 | 365 | } |
366 | 366 | |
367 | 367 | 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", | |
369 | 369 | progname, addr, memtype); |
370 | 370 | return -1; |
371 | 371 | } |
@@ -374,7 +374,7 @@ | ||
374 | 374 | len = argc - 3; |
375 | 375 | |
376 | 376 | 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 " | |
378 | 378 | "range for %s memory\n", |
379 | 379 | progname, memtype); |
380 | 380 | return -1; |
@@ -382,7 +382,7 @@ | ||
382 | 382 | |
383 | 383 | buf = malloc(len); |
384 | 384 | 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); | |
386 | 386 | return -1; |
387 | 387 | } |
388 | 388 |
@@ -389,7 +389,7 @@ | ||
389 | 389 | for (i=3; i<argc; i++) { |
390 | 390 | buf[i-3] = strtoul(argv[i], &e, 0); |
391 | 391 | 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", | |
393 | 393 | progname, argv[i]); |
394 | 394 | free(buf); |
395 | 395 | return -1; |
@@ -401,10 +401,10 @@ | ||
401 | 401 | |
402 | 402 | rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]); |
403 | 403 | 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", | |
405 | 405 | progname, buf[i], addr+i, rc); |
406 | 406 | 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", | |
408 | 408 | mem->desc); |
409 | 409 | werror = 1; |
410 | 410 | } |
@@ -411,7 +411,7 @@ | ||
411 | 411 | |
412 | 412 | rc = pgm->read_byte(pgm, p, mem, addr+i, &b); |
413 | 413 | 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", | |
415 | 415 | progname, buf[i], addr+i, b); |
416 | 416 | werror = 1; |
417 | 417 | } |
@@ -438,13 +438,13 @@ | ||
438 | 438 | int len; |
439 | 439 | |
440 | 440 | 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", | |
442 | 442 | pgm->type); |
443 | 443 | return -1; |
444 | 444 | } |
445 | 445 | |
446 | 446 | 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", | |
448 | 448 | pgm->type); |
449 | 449 | return -1; |
450 | 450 | } |
@@ -451,7 +451,7 @@ | ||
451 | 451 | |
452 | 452 | |
453 | 453 | if ((argc > 5) || ((argc < 5) && (!spi_mode))) { |
454 | - avrdude_message(spi_mode? | |
454 | + avrdude_message(MSG_INFO, spi_mode? | |
455 | 455 | "Usage: send <byte1> [<byte2> [<byte3> [<byte4>]]]\n": |
456 | 456 | "Usage: send <byte1> <byte2> <byte3> <byte4>\n"); |
457 | 457 | return -1; |
@@ -464,7 +464,7 @@ | ||
464 | 464 | for (i=1; i<argc; i++) { |
465 | 465 | cmd[i-1] = strtoul(argv[i], &e, 0); |
466 | 466 | 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", | |
468 | 468 | progname, argv[i]); |
469 | 469 | return -1; |
470 | 470 | } |
@@ -480,10 +480,10 @@ | ||
480 | 480 | /* |
481 | 481 | * display results |
482 | 482 | */ |
483 | - avrdude_message("results:"); | |
483 | + avrdude_message(MSG_INFO, "results:"); | |
484 | 484 | 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"); | |
487 | 487 | |
488 | 488 | fprintf(stdout, "\n"); |
489 | 489 |
@@ -494,7 +494,7 @@ | ||
494 | 494 | static int cmd_erase(PROGRAMMER * pgm, struct avrpart * p, |
495 | 495 | int argc, char * argv[]) |
496 | 496 | { |
497 | - avrdude_message("%s: erasing chip\n", progname); | |
497 | + avrdude_message(MSG_INFO, "%s: erasing chip\n", progname); | |
498 | 498 | pgm->chip_erase(pgm, p); |
499 | 499 | return 0; |
500 | 500 | } |
@@ -520,13 +520,13 @@ | ||
520 | 520 | |
521 | 521 | rc = avr_signature(pgm, p); |
522 | 522 | 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", | |
524 | 524 | rc); |
525 | 525 | } |
526 | 526 | |
527 | 527 | m = avr_locate_mem(p, "signature"); |
528 | 528 | 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", | |
530 | 530 | p->desc); |
531 | 531 | } |
532 | 532 | else { |
@@ -551,7 +551,7 @@ | ||
551 | 551 | int argc, char * argv[]) |
552 | 552 | { |
553 | 553 | 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 " | |
555 | 555 | "adjustable parameters\n", |
556 | 556 | progname, pgm->type); |
557 | 557 | return -1; |
@@ -570,22 +570,22 @@ | ||
570 | 570 | char *endp; |
571 | 571 | |
572 | 572 | if (argc != 2) { |
573 | - avrdude_message("Usage: vtarg <value>\n"); | |
573 | + avrdude_message(MSG_INFO, "Usage: vtarg <value>\n"); | |
574 | 574 | return -1; |
575 | 575 | } |
576 | 576 | v = strtod(argv[1], &endp); |
577 | 577 | 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", | |
579 | 579 | progname, argv[1]); |
580 | 580 | return -1; |
581 | 581 | } |
582 | 582 | 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", | |
584 | 584 | progname, pgm->type); |
585 | 585 | return -2; |
586 | 586 | } |
587 | 587 | 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", | |
589 | 589 | progname, rc); |
590 | 590 | return -3; |
591 | 591 | } |
@@ -601,7 +601,7 @@ | ||
601 | 601 | char *endp; |
602 | 602 | |
603 | 603 | 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"); | |
605 | 605 | return -1; |
606 | 606 | } |
607 | 607 | v = strtod(argv[1], &endp); |
@@ -609,7 +609,7 @@ | ||
609 | 609 | if (strcmp(argv[1], "off") == 0) |
610 | 610 | v = 0.0; |
611 | 611 | 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", | |
613 | 613 | progname, argv[1]); |
614 | 614 | return -1; |
615 | 615 | } |
@@ -619,12 +619,12 @@ | ||
619 | 619 | else if (*endp == 'k' || *endp == 'K') |
620 | 620 | v *= 1e3; |
621 | 621 | 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", | |
623 | 623 | progname, pgm->type); |
624 | 624 | return -2; |
625 | 625 | } |
626 | 626 | 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", | |
628 | 628 | progname, rc); |
629 | 629 | return -3; |
630 | 630 | } |
@@ -640,23 +640,23 @@ | ||
640 | 640 | char *endp; |
641 | 641 | |
642 | 642 | if (argc != 2) { |
643 | - avrdude_message("Usage: sck <value>\n"); | |
643 | + avrdude_message(MSG_INFO, "Usage: sck <value>\n"); | |
644 | 644 | return -1; |
645 | 645 | } |
646 | 646 | v = strtod(argv[1], &endp); |
647 | 647 | 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", | |
649 | 649 | progname, argv[1]); |
650 | 650 | return -1; |
651 | 651 | } |
652 | 652 | v *= 1e-6; /* Convert from microseconds to seconds. */ |
653 | 653 | 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", | |
655 | 655 | progname, pgm->type); |
656 | 656 | return -2; |
657 | 657 | } |
658 | 658 | 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", | |
660 | 660 | progname, rc); |
661 | 661 | return -3; |
662 | 662 | } |
@@ -673,7 +673,7 @@ | ||
673 | 673 | char *endp; |
674 | 674 | |
675 | 675 | if (argc != 2 && argc != 3) { |
676 | - avrdude_message("Usage: varef [channel] <value>\n"); | |
676 | + avrdude_message(MSG_INFO, "Usage: varef [channel] <value>\n"); | |
677 | 677 | return -1; |
678 | 678 | } |
679 | 679 | if (argc == 2) { |
@@ -680,7 +680,7 @@ | ||
680 | 680 | chan = 0; |
681 | 681 | v = strtod(argv[1], &endp); |
682 | 682 | 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", | |
684 | 684 | progname, argv[1]); |
685 | 685 | return -1; |
686 | 686 | } |
@@ -687,24 +687,24 @@ | ||
687 | 687 | } else { |
688 | 688 | chan = strtoul(argv[1], &endp, 10); |
689 | 689 | 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", | |
691 | 691 | progname, argv[1]); |
692 | 692 | return -1; |
693 | 693 | } |
694 | 694 | v = strtod(argv[2], &endp); |
695 | 695 | 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", | |
697 | 697 | progname, argv[2]); |
698 | 698 | return -1; |
699 | 699 | } |
700 | 700 | } |
701 | 701 | 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", | |
703 | 703 | progname, pgm->type); |
704 | 704 | return -2; |
705 | 705 | } |
706 | 706 | 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", | |
708 | 708 | progname, rc); |
709 | 709 | return -3; |
710 | 710 | } |
@@ -754,26 +754,26 @@ | ||
754 | 754 | char *endp; |
755 | 755 | |
756 | 756 | if (argc != 1 && argc != 2) { |
757 | - avrdude_message("Usage: verbose [<value>]\n"); | |
757 | + avrdude_message(MSG_INFO, "Usage: verbose [<value>]\n"); | |
758 | 758 | return -1; |
759 | 759 | } |
760 | 760 | if (argc == 1) { |
761 | - avrdude_message("Verbosity level: %d\n", verbose); | |
761 | + avrdude_message(MSG_INFO, "Verbosity level: %d\n", verbose); | |
762 | 762 | return 0; |
763 | 763 | } |
764 | 764 | nverb = strtol(argv[1], &endp, 0); |
765 | 765 | 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", | |
767 | 767 | progname, argv[2]); |
768 | 768 | return -1; |
769 | 769 | } |
770 | 770 | 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", | |
772 | 772 | progname, nverb); |
773 | 773 | return -1; |
774 | 774 | } |
775 | 775 | verbose = nverb; |
776 | - avrdude_message("New verbosity level: %d\n", verbose); | |
776 | + avrdude_message(MSG_INFO, "New verbosity level: %d\n", verbose); | |
777 | 777 | |
778 | 778 | return 0; |
779 | 779 | } |
@@ -870,7 +870,7 @@ | ||
870 | 870 | } |
871 | 871 | else if (strncasecmp(argv[0], cmd[i].name, len)==0) { |
872 | 872 | if (hold != -1) { |
873 | - avrdude_message("%s: command \"%s\" is ambiguous\n", | |
873 | + avrdude_message(MSG_INFO, "%s: command \"%s\" is ambiguous\n", | |
874 | 874 | progname, argv[0]); |
875 | 875 | return -1; |
876 | 876 | } |
@@ -881,7 +881,7 @@ | ||
881 | 881 | if (hold != -1) |
882 | 882 | return cmd[hold].func(pgm, p, argc, argv); |
883 | 883 | |
884 | - avrdude_message("%s: invalid command \"%s\"\n", | |
884 | + avrdude_message(MSG_INFO, "%s: invalid command \"%s\"\n", | |
885 | 885 | progname, argv[0]); |
886 | 886 | |
887 | 887 | return -1; |
@@ -38,7 +38,7 @@ | ||
38 | 38 | |
39 | 39 | upd = (UPDATE *)malloc(sizeof(UPDATE)); |
40 | 40 | if (upd == NULL) { |
41 | - avrdude_message("%s: out of memory\n", progname); | |
41 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
42 | 42 | exit(1); |
43 | 43 | } |
44 | 44 |
@@ -53,7 +53,7 @@ | ||
53 | 53 | upd->op = DEVICE_WRITE; |
54 | 54 | upd->filename = (char *)malloc(strlen(buf) + 1); |
55 | 55 | if (upd->filename == NULL) { |
56 | - avrdude_message("%s: out of memory\n", progname); | |
56 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
57 | 57 | exit(1); |
58 | 58 | } |
59 | 59 | strcpy(upd->filename, buf); |
@@ -63,7 +63,7 @@ | ||
63 | 63 | |
64 | 64 | upd->memtype = (char *)malloc(strlen(buf)+1); |
65 | 65 | if (upd->memtype == NULL) { |
66 | - avrdude_message("%s: out of memory\n", progname); | |
66 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
67 | 67 | exit(1); |
68 | 68 | } |
69 | 69 | strcpy(upd->memtype, buf); |
@@ -79,9 +79,9 @@ | ||
79 | 79 | upd->op = DEVICE_VERIFY; |
80 | 80 | } |
81 | 81 | 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", | |
83 | 83 | progname, *p); |
84 | - avrdude_message(" allowed values are:\n" | |
84 | + avrdude_message(MSG_INFO, " allowed values are:\n" | |
85 | 85 | " r = read device\n" |
86 | 86 | " w = write device\n" |
87 | 87 | " v = verify device\n"); |
@@ -93,7 +93,7 @@ | ||
93 | 93 | p++; |
94 | 94 | |
95 | 95 | if (*p != ':') { |
96 | - avrdude_message("%s: invalid update specification\n", progname); | |
96 | + avrdude_message(MSG_INFO, "%s: invalid update specification\n", progname); | |
97 | 97 | free(upd->memtype); |
98 | 98 | free(upd); |
99 | 99 | return NULL; |
@@ -135,7 +135,7 @@ | ||
135 | 135 | case 'h': upd->format = FMT_HEX; break; |
136 | 136 | case 'o': upd->format = FMT_OCT; break; |
137 | 137 | 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", | |
139 | 139 | progname, p); |
140 | 140 | free(upd->memtype); |
141 | 141 | free(upd); |
@@ -144,7 +144,7 @@ | ||
144 | 144 | } |
145 | 145 | |
146 | 146 | if (upd->filename == NULL) { |
147 | - avrdude_message("%s: out of memory\n", progname); | |
147 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
148 | 148 | free(upd->memtype); |
149 | 149 | free(upd); |
150 | 150 | return NULL; |
@@ -161,7 +161,7 @@ | ||
161 | 161 | |
162 | 162 | u = (UPDATE *)malloc(sizeof(UPDATE)); |
163 | 163 | if (u == NULL) { |
164 | - avrdude_message("%s: out of memory\n", progname); | |
164 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
165 | 165 | exit(1); |
166 | 166 | } |
167 | 167 |
@@ -182,7 +182,7 @@ | ||
182 | 182 | |
183 | 183 | u = (UPDATE *)malloc(sizeof(UPDATE)); |
184 | 184 | if (u == NULL) { |
185 | - avrdude_message("%s: out of memory\n", progname); | |
185 | + avrdude_message(MSG_INFO, "%s: out of memory\n", progname); | |
186 | 186 | exit(1); |
187 | 187 | } |
188 | 188 |
@@ -219,7 +219,7 @@ | ||
219 | 219 | |
220 | 220 | mem = avr_locate_mem(p, upd->memtype); |
221 | 221 | 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", | |
223 | 223 | upd->memtype, p->desc); |
224 | 224 | return -1; |
225 | 225 | } |
@@ -229,13 +229,13 @@ | ||
229 | 229 | * read out the specified device memory and write it to a file |
230 | 230 | */ |
231 | 231 | if (quell_progress < 2) { |
232 | - avrdude_message("%s: reading %s memory:\n", | |
232 | + avrdude_message(MSG_INFO, "%s: reading %s memory:\n", | |
233 | 233 | progname, mem->desc); |
234 | 234 | } |
235 | 235 | report_progress(0,1,"Reading"); |
236 | 236 | rc = avr_read(pgm, p, upd->memtype, 0); |
237 | 237 | 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", | |
239 | 239 | progname, mem->desc, rc); |
240 | 240 | return -1; |
241 | 241 | } |
@@ -243,13 +243,13 @@ | ||
243 | 243 | size = rc; |
244 | 244 | |
245 | 245 | if (quell_progress < 2) { |
246 | - avrdude_message("%s: writing output file \"%s\"\n", | |
246 | + avrdude_message(MSG_INFO, "%s: writing output file \"%s\"\n", | |
247 | 247 | progname, |
248 | 248 | strcmp(upd->filename, "-")==0 ? "<stdout>" : upd->filename); |
249 | 249 | } |
250 | 250 | rc = fileio(FIO_WRITE, upd->filename, upd->format, p, upd->memtype, size); |
251 | 251 | 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", | |
253 | 253 | progname, upd->filename); |
254 | 254 | return -1; |
255 | 255 | } |
@@ -260,13 +260,13 @@ | ||
260 | 260 | * read the data from the specified file |
261 | 261 | */ |
262 | 262 | if (quell_progress < 2) { |
263 | - avrdude_message("%s: reading input file \"%s\"\n", | |
263 | + avrdude_message(MSG_INFO, "%s: reading input file \"%s\"\n", | |
264 | 264 | progname, |
265 | 265 | strcmp(upd->filename, "-")==0 ? "<stdin>" : upd->filename); |
266 | 266 | } |
267 | 267 | rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); |
268 | 268 | 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", | |
270 | 270 | progname, upd->filename); |
271 | 271 | return -1; |
272 | 272 | } |
@@ -276,7 +276,7 @@ | ||
276 | 276 | * write the buffer contents to the selected memory type |
277 | 277 | */ |
278 | 278 | if (quell_progress < 2) { |
279 | - avrdude_message("%s: writing %s (%d bytes):\n", | |
279 | + avrdude_message(MSG_INFO, "%s: writing %s (%d bytes):\n", | |
280 | 280 | progname, mem->desc, size); |
281 | 281 | } |
282 | 282 |
@@ -294,7 +294,7 @@ | ||
294 | 294 | } |
295 | 295 | |
296 | 296 | 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", | |
298 | 298 | progname, mem->desc, rc); |
299 | 299 | return -1; |
300 | 300 | } |
@@ -302,7 +302,7 @@ | ||
302 | 302 | vsize = rc; |
303 | 303 | |
304 | 304 | 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, | |
306 | 306 | vsize, mem->desc); |
307 | 307 | } |
308 | 308 |
@@ -315,16 +315,16 @@ | ||
315 | 315 | pgm->vfy_led(pgm, ON); |
316 | 316 | |
317 | 317 | 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", | |
319 | 319 | progname, mem->desc, upd->filename); |
320 | 320 | |
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", | |
322 | 322 | progname, mem->desc, upd->filename); |
323 | 323 | } |
324 | 324 | |
325 | 325 | rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); |
326 | 326 | 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", | |
328 | 328 | progname, upd->filename); |
329 | 329 | return -1; |
330 | 330 | } |
@@ -331,9 +331,9 @@ | ||
331 | 331 | v = avr_dup_part(p); |
332 | 332 | size = rc; |
333 | 333 | 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", | |
335 | 335 | 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", | |
337 | 337 | progname, mem->desc); |
338 | 338 | } |
339 | 339 |
@@ -340,7 +340,7 @@ | ||
340 | 340 | report_progress (0,1,"Reading"); |
341 | 341 | rc = avr_read(pgm, p, upd->memtype, v); |
342 | 342 | 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", | |
344 | 344 | progname, mem->desc, rc); |
345 | 345 | pgm->err_led(pgm, ON); |
346 | 346 | return -1; |
@@ -350,11 +350,11 @@ | ||
350 | 350 | |
351 | 351 | |
352 | 352 | if (quell_progress < 2) { |
353 | - avrdude_message("%s: verifying ...\n", progname); | |
353 | + avrdude_message(MSG_INFO, "%s: verifying ...\n", progname); | |
354 | 354 | } |
355 | 355 | rc = avr_verify(p, v, upd->memtype, size); |
356 | 356 | if (rc < 0) { |
357 | - avrdude_message("%s: verification error; content mismatch\n", | |
357 | + avrdude_message(MSG_INFO, "%s: verification error; content mismatch\n", | |
358 | 358 | progname); |
359 | 359 | pgm->err_led(pgm, ON); |
360 | 360 | return -1; |
@@ -361,7 +361,7 @@ | ||
361 | 361 | } |
362 | 362 | |
363 | 363 | 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", | |
365 | 365 | progname, rc, mem->desc); |
366 | 366 | } |
367 | 367 |
@@ -368,7 +368,7 @@ | ||
368 | 368 | pgm->vfy_led(pgm, OFF); |
369 | 369 | } |
370 | 370 | else { |
371 | - avrdude_message("%s: invalid update operation (%d) requested\n", | |
371 | + avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n", | |
372 | 372 | progname, upd->op); |
373 | 373 | return -1; |
374 | 374 | } |
@@ -98,7 +98,7 @@ | ||
98 | 98 | |
99 | 99 | if (strlen(serno) > 12) |
100 | 100 | { |
101 | - avrdude_message("%s: usbdev_open(): invalid serial number \"%s\"\n", | |
101 | + avrdude_message(MSG_INFO, "%s: usbdev_open(): invalid serial number \"%s\"\n", | |
102 | 102 | progname, serno); |
103 | 103 | return -1; |
104 | 104 | } |
@@ -127,7 +127,7 @@ | ||
127 | 127 | dev->descriptor.iSerialNumber, |
128 | 128 | string, sizeof(string)) < 0) |
129 | 129 | { |
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", | |
131 | 131 | progname, usb_strerror()); |
132 | 132 | /* |
133 | 133 | * On some systems, libusb appears to have |
@@ -146,7 +146,7 @@ | ||
146 | 146 | dev->descriptor.iProduct, |
147 | 147 | product, sizeof(product)) < 0) |
148 | 148 | { |
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", | |
150 | 150 | progname, usb_strerror()); |
151 | 151 | strcpy(product, "[unnamed product]"); |
152 | 152 | } |
@@ -166,8 +166,7 @@ | ||
166 | 166 | fd->usb.eep = 0; |
167 | 167 | } |
168 | 168 | |
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", | |
171 | 170 | progname, product, string); |
172 | 171 | if (serno != NULL) |
173 | 172 | { |
@@ -179,8 +178,7 @@ | ||
179 | 178 | x = strlen(string) - strlen(serno); |
180 | 179 | if (strcasecmp(string + x, serno) != 0) |
181 | 180 | { |
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", | |
184 | 182 | progname); |
185 | 183 | usb_close(udev); |
186 | 184 | continue; |
@@ -189,7 +187,7 @@ | ||
189 | 187 | |
190 | 188 | if (dev->config == NULL) |
191 | 189 | { |
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", | |
193 | 191 | progname); |
194 | 192 | goto trynext; |
195 | 193 | } |
@@ -196,7 +194,7 @@ | ||
196 | 194 | |
197 | 195 | if (usb_set_configuration(udev, dev->config[0].bConfigurationValue)) |
198 | 196 | { |
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", | |
200 | 198 | progname, dev->config[0].bConfigurationValue, |
201 | 199 | usb_strerror()); |
202 | 200 | /* let's hope it has already been configured */ |
@@ -217,7 +215,7 @@ | ||
217 | 215 | #endif |
218 | 216 | if (usb_claim_interface(udev, usb_interface)) |
219 | 217 | { |
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", | |
221 | 219 | progname, usb_interface, usb_strerror()); |
222 | 220 | } |
223 | 221 | else |
@@ -235,7 +233,7 @@ | ||
235 | 233 | } |
236 | 234 | if (iface == dev->config[0].bNumInterfaces) |
237 | 235 | { |
238 | - avrdude_message("%s: usbdev_open(): no usable interface found\n", | |
236 | + avrdude_message(MSG_INFO, "%s: usbdev_open(): no usable interface found\n", | |
239 | 237 | progname); |
240 | 238 | goto trynext; |
241 | 239 | } |
@@ -251,11 +249,8 @@ | ||
251 | 249 | |
252 | 250 | if ((possible_ep & USB_ENDPOINT_DIR_MASK) != 0) |
253 | 251 | { |
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", | |
257 | 253 | progname, possible_ep); |
258 | - } | |
259 | 254 | fd->usb.rep = possible_ep; |
260 | 255 | break; |
261 | 256 | } |
@@ -262,7 +257,7 @@ | ||
262 | 257 | } |
263 | 258 | if (fd->usb.rep == 0) |
264 | 259 | { |
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", | |
266 | 261 | progname, USBDEV_BULK_EP_READ_MKII); |
267 | 262 | fd->usb.rep = USBDEV_BULK_EP_READ_MKII; |
268 | 263 | } |
@@ -273,8 +268,7 @@ | ||
273 | 268 | dev->config[0].interface[iface].altsetting[0].endpoint[i].bEndpointAddress == fd->usb.wep) && |
274 | 269 | dev->config[0].interface[iface].altsetting[0].endpoint[i].wMaxPacketSize < fd->usb.max_xfer) |
275 | 270 | { |
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", | |
278 | 272 | progname, |
279 | 273 | fd->usb.max_xfer, |
280 | 274 | dev->config[0].interface[iface].altsetting[0].endpoint[i].wMaxPacketSize, |
@@ -285,7 +279,7 @@ | ||
285 | 279 | if (pinfo.usbinfo.flags & PINFO_FL_USEHID) |
286 | 280 | { |
287 | 281 | 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); | |
289 | 283 | } |
290 | 284 | return 0; |
291 | 285 | trynext: |
@@ -292,14 +286,14 @@ | ||
292 | 286 | usb_close(udev); |
293 | 287 | } |
294 | 288 | 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", | |
296 | 290 | progname, usb_strerror()); |
297 | 291 | } |
298 | 292 | } |
299 | 293 | } |
300 | 294 | |
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", | |
303 | 297 | progname, serno? " (matching)": "", port, |
304 | 298 | (unsigned)pinfo.usbinfo.vid, (unsigned)pinfo.usbinfo.pid); |
305 | 299 | return -1; |
@@ -353,7 +347,7 @@ | ||
353 | 347 | rv = usb_bulk_write(udev, fd->usb.wep, (char *)bp, tx_size, 10000); |
354 | 348 | if (rv != tx_size) |
355 | 349 | { |
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", | |
357 | 351 | progname, rv, tx_size, usb_strerror()); |
358 | 352 | return -1; |
359 | 353 | } |
@@ -363,22 +357,22 @@ | ||
363 | 357 | |
364 | 358 | if (verbose > 3) |
365 | 359 | { |
366 | - avrdude_message("%s: Sent: ", progname); | |
360 | + avrdude_message(MSG_TRACE, "%s: Sent: ", progname); | |
367 | 361 | |
368 | 362 | while (i) { |
369 | 363 | unsigned char c = *p; |
370 | 364 | if (isprint(c)) { |
371 | - avrdude_message("%c ", c); | |
365 | + avrdude_message(MSG_TRACE, "%c ", c); | |
372 | 366 | } |
373 | 367 | else { |
374 | - avrdude_message(". "); | |
368 | + avrdude_message(MSG_TRACE, ". "); | |
375 | 369 | } |
376 | - avrdude_message("[%02x] ", c); | |
370 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
377 | 371 | |
378 | 372 | p++; |
379 | 373 | i--; |
380 | 374 | } |
381 | - avrdude_message("\n"); | |
375 | + avrdude_message(MSG_TRACE, "\n"); | |
382 | 376 | } |
383 | 377 | return 0; |
384 | 378 | } |
@@ -402,8 +396,7 @@ | ||
402 | 396 | rv = usb_bulk_read(udev, ep, usbbuf, maxsize, 10000); |
403 | 397 | if (rv < 0) |
404 | 398 | { |
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", | |
407 | 400 | progname, (use_interrupt_xfer? "interrupt": "bulk"), |
408 | 401 | usb_strerror()); |
409 | 402 | return -1; |
@@ -440,22 +433,22 @@ | ||
440 | 433 | |
441 | 434 | if (verbose > 4) |
442 | 435 | { |
443 | - avrdude_message("%s: Recv: ", progname); | |
436 | + avrdude_message(MSG_TRACE2, "%s: Recv: ", progname); | |
444 | 437 | |
445 | 438 | while (i) { |
446 | 439 | unsigned char c = *p; |
447 | 440 | if (isprint(c)) { |
448 | - avrdude_message("%c ", c); | |
441 | + avrdude_message(MSG_TRACE2, "%c ", c); | |
449 | 442 | } |
450 | 443 | else { |
451 | - avrdude_message(". "); | |
444 | + avrdude_message(MSG_TRACE2, ". "); | |
452 | 445 | } |
453 | - avrdude_message("[%02x] ", c); | |
446 | + avrdude_message(MSG_TRACE2, "[%02x] ", c); | |
454 | 447 | |
455 | 448 | p++; |
456 | 449 | i--; |
457 | 450 | } |
458 | - avrdude_message("\n"); | |
451 | + avrdude_message(MSG_TRACE2, "\n"); | |
459 | 452 | } |
460 | 453 | |
461 | 454 | return 0; |
@@ -494,7 +487,7 @@ | ||
494 | 487 | } |
495 | 488 | else if (rv > 0) |
496 | 489 | { |
497 | - avrdude_message("Short event len = %d, ignored.\n", rv); | |
490 | + avrdude_message(MSG_INFO, "Short event len = %d, ignored.\n", rv); | |
498 | 491 | /* fallthrough */ |
499 | 492 | } |
500 | 493 | } |
@@ -510,8 +503,7 @@ | ||
510 | 503 | fd->usb.max_xfer, 10000); |
511 | 504 | if (rv < 0) |
512 | 505 | { |
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", | |
515 | 507 | progname, (fd->usb.use_interrupt_xfer? "interrupt": "bulk"), |
516 | 508 | usb_strerror()); |
517 | 509 | return -1; |
@@ -535,22 +527,22 @@ | ||
535 | 527 | if (verbose > 3) |
536 | 528 | { |
537 | 529 | i = n & USB_RECV_LENGTH_MASK; |
538 | - avrdude_message("%s: Recv: ", progname); | |
530 | + avrdude_message(MSG_TRACE, "%s: Recv: ", progname); | |
539 | 531 | |
540 | 532 | while (i) { |
541 | 533 | unsigned char c = *p; |
542 | 534 | if (isprint(c)) { |
543 | - avrdude_message("%c ", c); | |
535 | + avrdude_message(MSG_TRACE, "%c ", c); | |
544 | 536 | } |
545 | 537 | else { |
546 | - avrdude_message(". "); | |
538 | + avrdude_message(MSG_TRACE, ". "); | |
547 | 539 | } |
548 | - avrdude_message("[%02x] ", c); | |
540 | + avrdude_message(MSG_TRACE, "[%02x] ", c); | |
549 | 541 | |
550 | 542 | p++; |
551 | 543 | i--; |
552 | 544 | } |
553 | - avrdude_message("\n"); | |
545 | + avrdude_message(MSG_TRACE, "\n"); | |
554 | 546 | } |
555 | 547 | return n; |
556 | 548 | } |
@@ -568,8 +560,8 @@ | ||
568 | 560 | rv = usb_interrupt_read(udev, fd->usb.rep, usbbuf, fd->usb.max_xfer, 100); |
569 | 561 | else |
570 | 562 | 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", | |
573 | 565 | progname, rv); |
574 | 566 | } while (rv > 0); |
575 | 567 |
@@ -180,7 +180,7 @@ | ||
180 | 180 | static void usbasp_setup(PROGRAMMER * pgm) |
181 | 181 | { |
182 | 182 | 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", | |
184 | 184 | progname); |
185 | 185 | exit(1); |
186 | 186 | } |
@@ -229,15 +229,15 @@ | ||
229 | 229 | int nbytes; |
230 | 230 | |
231 | 231 | 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", | |
233 | 233 | progname, |
234 | 234 | usbasp_get_funcname(functionid), send[0], send[1], send[2], send[3]); |
235 | 235 | if (!receive && buffersize > 0) { |
236 | 236 | int i; |
237 | - avrdude_message("%s => ", progbuf); | |
237 | + avrdude_message(MSG_TRACE, "%s => ", progbuf); | |
238 | 238 | 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"); | |
241 | 241 | } |
242 | 242 | } |
243 | 243 |
@@ -251,7 +251,7 @@ | ||
251 | 251 | buffersize & 0xffff, |
252 | 252 | 5000); |
253 | 253 | 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))); | |
255 | 255 | return -1; |
256 | 256 | } |
257 | 257 | #else |
@@ -263,7 +263,7 @@ | ||
263 | 263 | (char *)buffer, buffersize, |
264 | 264 | 5000); |
265 | 265 | 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()); | |
267 | 267 | return -1; |
268 | 268 | } |
269 | 269 | #endif |
@@ -270,10 +270,10 @@ | ||
270 | 270 | |
271 | 271 | if (verbose > 3 && receive && nbytes > 0) { |
272 | 272 | int i; |
273 | - avrdude_message("%s<= ", progbuf); | |
273 | + avrdude_message(MSG_TRACE, "%s<= ", progbuf); | |
274 | 274 | 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"); | |
277 | 277 | } |
278 | 278 | |
279 | 279 | return nbytes; |
@@ -314,7 +314,7 @@ | ||
314 | 314 | r = libusb_open(dev, &handle); |
315 | 315 | if (!handle) { |
316 | 316 | 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", | |
318 | 318 | progname, strerror(libusb_to_errno(r))); |
319 | 319 | continue; |
320 | 320 | } |
@@ -325,12 +325,11 @@ | ||
325 | 325 | if (r < 0) { |
326 | 326 | if ((vendorName != NULL) && (vendorName[0] != 0)) { |
327 | 327 | 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", | |
329 | 329 | progname, strerror(libusb_to_errno(r))); |
330 | 330 | } |
331 | 331 | } 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", | |
334 | 333 | progname, string); |
335 | 334 | if ((vendorName != NULL) && (vendorName[0] != 0) && (strcmp(string, vendorName) != 0)) |
336 | 335 | errorCode = USB_ERROR_NOTFOUND; |
@@ -340,12 +339,11 @@ | ||
340 | 339 | if (r < 0) { |
341 | 340 | if ((productName != NULL) && (productName[0] != 0)) { |
342 | 341 | 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", | |
344 | 343 | progname, strerror(libusb_to_errno(r))); |
345 | 344 | } |
346 | 345 | } else { |
347 | - if (verbose > 1) | |
348 | - avrdude_message("%s: seen product ->%s<-\n", | |
346 | + avrdude_message(MSG_NOTICE2, "%s: seen product ->%s<-\n", | |
349 | 347 | progname, string); |
350 | 348 | if((productName != NULL) && (productName[0] != 0) && (strcmp(string, productName) != 0)) |
351 | 349 | errorCode = USB_ERROR_NOTFOUND; |
@@ -389,7 +387,7 @@ | ||
389 | 387 | handle = usb_open(dev); |
390 | 388 | if(!handle){ |
391 | 389 | 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", | |
393 | 391 | progname, usb_strerror()); |
394 | 392 | continue; |
395 | 393 | } |
@@ -401,12 +399,11 @@ | ||
401 | 399 | if(len < 0){ |
402 | 400 | if ((vendorName != NULL) && (vendorName[0] != 0)) { |
403 | 401 | 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", | |
405 | 403 | progname, usb_strerror()); |
406 | 404 | } |
407 | 405 | } 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", | |
410 | 407 | progname, string); |
411 | 408 | if((vendorName != NULL) && (vendorName[0] != 0) && (strcmp(string, vendorName) != 0)) |
412 | 409 | errorCode = USB_ERROR_NOTFOUND; |
@@ -417,12 +414,11 @@ | ||
417 | 414 | if(len < 0){ |
418 | 415 | if ((productName != NULL) && (productName[0] != 0)) { |
419 | 416 | 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", | |
421 | 418 | progname, usb_strerror()); |
422 | 419 | } |
423 | 420 | } else { |
424 | - if (verbose > 1) | |
425 | - avrdude_message("%s: seen product ->%s<-\n", | |
421 | + avrdude_message(MSG_NOTICE2, "%s: seen product ->%s<-\n", | |
426 | 422 | progname, string); |
427 | 423 | if((productName != NULL) && (productName[0] != 0) && (strcmp(string, productName) != 0)) |
428 | 424 | errorCode = USB_ERROR_NOTFOUND; |
@@ -448,8 +444,7 @@ | ||
448 | 444 | /* Interface - prog. */ |
449 | 445 | static int usbasp_open(PROGRAMMER * pgm, char * port) |
450 | 446 | { |
451 | - if (verbose > 2) | |
452 | - avrdude_message("%s: usbasp_open(\"%s\")\n", | |
447 | + avrdude_message(MSG_DEBUG, "%s: usbasp_open(\"%s\")\n", | |
453 | 448 | progname, port); |
454 | 449 | |
455 | 450 | /* usb_init will be done in usbOpenDevice */ |
@@ -458,7 +453,7 @@ | ||
458 | 453 | if (usbpid) { |
459 | 454 | pid = *(int *)(ldata(usbpid)); |
460 | 455 | 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", | |
462 | 457 | progname, pid); |
463 | 458 | } else { |
464 | 459 | pid = USBASP_SHARED_PID; |
@@ -469,12 +464,12 @@ | ||
469 | 464 | if(strcasecmp(ldata(lfirst(pgm->id)), "usbasp") == 0) { |
470 | 465 | /* for id usbasp autodetect some variants */ |
471 | 466 | 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," | |
473 | 468 | "use \"-C nibobee\" instead.\n", |
474 | 469 | progname); |
475 | 470 | if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_NIBOBEE_VID, "www.nicai-systems.com", |
476 | 471 | 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 " | |
478 | 473 | "\"NIBObee\" with vid=0x%x pid=0x%x\n", |
479 | 474 | progname, USBASP_NIBOBEE_VID, USBASP_NIBOBEE_PID); |
480 | 475 | return -1; |
@@ -485,7 +480,7 @@ | ||
485 | 480 | if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_OLD_VID, "www.fischl.de", |
486 | 481 | USBASP_OLD_PID, "USBasp") == 0) { |
487 | 482 | /* 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 " | |
489 | 484 | "old VID/PID! Please update firmware of USBasp!\n", |
490 | 485 | progname); |
491 | 486 | return 0; |
@@ -494,15 +489,15 @@ | ||
494 | 489 | /* no alternative found => fall through to generic error message */ |
495 | 490 | } |
496 | 491 | |
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", | |
498 | 493 | progname, vid, pid); |
499 | 494 | if (pgm->usbvendor[0] != 0) { |
500 | - avrdude_message(" vendor='%s'", pgm->usbvendor); | |
495 | + avrdude_message(MSG_INFO, " vendor='%s'", pgm->usbvendor); | |
501 | 496 | } |
502 | 497 | if (pgm->usbproduct[0] != 0) { |
503 | - avrdude_message(" product='%s'", pgm->usbproduct); | |
498 | + avrdude_message(MSG_INFO, " product='%s'", pgm->usbproduct); | |
504 | 499 | } |
505 | - avrdude_message("\n"); | |
500 | + avrdude_message(MSG_INFO, "\n"); | |
506 | 501 | return -1; |
507 | 502 | } |
508 | 503 |
@@ -511,8 +506,7 @@ | ||
511 | 506 | |
512 | 507 | static void usbasp_close(PROGRAMMER * pgm) |
513 | 508 | { |
514 | - if (verbose > 2) | |
515 | - avrdude_message("%s: usbasp_close()\n", progname); | |
509 | + avrdude_message(MSG_DEBUG, "%s: usbasp_close()\n", progname); | |
516 | 510 | |
517 | 511 | if (PDATA(pgm)->usbhandle!=NULL) { |
518 | 512 | unsigned char temp[4]; |
@@ -566,8 +560,7 @@ | ||
566 | 560 | unsigned char res[4]; |
567 | 561 | IMPORT_PDATA(pgm); |
568 | 562 | |
569 | - if (verbose > 2) | |
570 | - avrdude_message("%s: usbasp_initialize()\n", progname); | |
563 | + avrdude_message(MSG_DEBUG, "%s: usbasp_initialize()\n", progname); | |
571 | 564 | |
572 | 565 | /* get capabilities */ |
573 | 566 | memset(temp, 0, sizeof(temp)); |
@@ -631,8 +624,7 @@ | ||
631 | 624 | static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, |
632 | 625 | unsigned char *res) |
633 | 626 | { |
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", | |
636 | 628 | progname, cmd[0], cmd[1], cmd[2], cmd[3], |
637 | 629 | verbose > 3? "...\n": ""); |
638 | 630 |
@@ -643,16 +635,13 @@ | ||
643 | 635 | if (verbose == 3) |
644 | 636 | putc('\n', stderr); |
645 | 637 | |
646 | - avrdude_message("%s: error: wrong responds size\n", | |
638 | + avrdude_message(MSG_INFO, "%s: error: wrong responds size\n", | |
647 | 639 | progname); |
648 | 640 | return -1; |
649 | 641 | } |
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]); | |
656 | 645 | |
657 | 646 | return 0; |
658 | 647 | } |
@@ -666,8 +655,7 @@ | ||
666 | 655 | |
667 | 656 | cmd[0] = 0; |
668 | 657 | |
669 | - if (verbose > 2) | |
670 | - avrdude_message("%s: usbasp_program_enable()\n", | |
658 | + avrdude_message(MSG_DEBUG, "%s: usbasp_program_enable()\n", | |
671 | 659 | progname); |
672 | 660 | |
673 | 661 | int nbytes = |
@@ -674,7 +662,7 @@ | ||
674 | 662 | usbasp_transmit(pgm, 1, USBASP_FUNC_ENABLEPROG, cmd, res, sizeof(res)); |
675 | 663 | |
676 | 664 | 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", | |
678 | 666 | progname, res[0]); |
679 | 667 | return -1; |
680 | 668 | } |
@@ -687,12 +675,11 @@ | ||
687 | 675 | unsigned char cmd[4]; |
688 | 676 | unsigned char res[4]; |
689 | 677 | |
690 | - if (verbose > 2) | |
691 | - avrdude_message("%s: usbasp_chip_erase()\n", | |
678 | + avrdude_message(MSG_DEBUG, "%s: usbasp_chip_erase()\n", | |
692 | 679 | progname); |
693 | 680 | |
694 | 681 | 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", | |
696 | 683 | p->desc); |
697 | 684 | return -1; |
698 | 685 | } |
@@ -718,8 +705,7 @@ | ||
718 | 705 | unsigned char *buffer = m->buf + address; |
719 | 706 | int function; |
720 | 707 | |
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", | |
723 | 709 | progname, m->desc, address, n_bytes); |
724 | 710 | |
725 | 711 | if (strcmp(m->desc, "flash") == 0) { |
@@ -763,7 +749,7 @@ | ||
763 | 749 | n = usbasp_transmit(pgm, 1, function, cmd, buffer, blocksize); |
764 | 750 | |
765 | 751 | 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", | |
767 | 753 | progname, n); |
768 | 754 | return -3; |
769 | 755 | } |
@@ -787,8 +773,7 @@ | ||
787 | 773 | unsigned char blockflags = USBASP_BLOCKFLAG_FIRST; |
788 | 774 | int function; |
789 | 775 | |
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", | |
792 | 777 | progname, m->desc, address, n_bytes); |
793 | 778 | |
794 | 779 | if (strcmp(m->desc, "flash") == 0) { |
@@ -837,7 +822,7 @@ | ||
837 | 822 | n = usbasp_transmit(pgm, 0, function, cmd, buffer, blocksize); |
838 | 823 | |
839 | 824 | 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", | |
841 | 826 | progname, n); |
842 | 827 | return -3; |
843 | 828 | } |
@@ -876,8 +861,7 @@ | ||
876 | 861 | unsigned char res[4]; |
877 | 862 | unsigned char cmd[4]; |
878 | 863 | |
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", | |
881 | 865 | progname, sckperiod); |
882 | 866 | |
883 | 867 | memset(cmd, 0, sizeof(cmd)); |
@@ -889,8 +873,7 @@ | ||
889 | 873 | if (sckperiod == 0) { |
890 | 874 | /* auto sck set */ |
891 | 875 | |
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); | |
894 | 877 | |
895 | 878 | } else { |
896 | 879 |
@@ -897,8 +880,7 @@ | ||
897 | 880 | int sckfreq = 1 / sckperiod; /* sck in Hz */ |
898 | 881 | int usefreq = 0; |
899 | 882 | |
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); | |
902 | 884 | |
903 | 885 | if (sckfreq >= usbaspSCKoptions[0].frequency) { |
904 | 886 | clockoption = usbaspSCKoptions[0].id; |
@@ -919,7 +901,7 @@ | ||
919 | 901 | /* save used sck frequency */ |
920 | 902 | PDATA(pgm)->sckfreq_hz = usefreq; |
921 | 903 | |
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); | |
923 | 905 | } |
924 | 906 | |
925 | 907 | cmd[0] = clockoption; |
@@ -928,7 +910,7 @@ | ||
928 | 910 | usbasp_transmit(pgm, 1, USBASP_FUNC_SETISPSCK, cmd, res, sizeof(res)); |
929 | 911 | |
930 | 912 | 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", | |
932 | 914 | progname); |
933 | 915 | return -1; |
934 | 916 | } |
@@ -955,7 +937,7 @@ | ||
955 | 937 | |
956 | 938 | if(usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_RAWREAD, temp, temp, sizeof(temp)) != 1) |
957 | 939 | { |
958 | - avrdude_message("%s: error: wrong responds size\n", progname); | |
940 | + avrdude_message(MSG_INFO, "%s: error: wrong responds size\n", progname); | |
959 | 941 | return -1; |
960 | 942 | } |
961 | 943 |
@@ -967,8 +949,7 @@ | ||
967 | 949 | { |
968 | 950 | int retry; |
969 | 951 | |
970 | - if (verbose > 2) | |
971 | - avrdude_message("%s: usbasp_tpi_nvm_waitbusy() ...", progname); | |
952 | + avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_nvm_waitbusy() ...", progname); | |
972 | 953 | |
973 | 954 | for(retry=50; retry>0; retry--) |
974 | 955 | { |
@@ -976,14 +957,12 @@ | ||
976 | 957 | if(usbasp_tpi_recv_byte(pgm) & NVMCSR_BSY) |
977 | 958 | continue; |
978 | 959 | |
979 | - if (verbose > 2) | |
980 | - avrdude_message(" ready\n"); | |
960 | + avrdude_message(MSG_DEBUG, " ready\n"); | |
981 | 961 | |
982 | 962 | return 0; |
983 | 963 | } |
984 | 964 | |
985 | - if (verbose > 2) | |
986 | - avrdude_message(" failure\n"); | |
965 | + avrdude_message(MSG_DEBUG, " failure\n"); | |
987 | 966 | |
988 | 967 | return -1; |
989 | 968 | } |
@@ -990,7 +969,7 @@ | ||
990 | 969 | |
991 | 970 | static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res) |
992 | 971 | { |
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); | |
994 | 973 | return -1; |
995 | 974 | } |
996 | 975 |
@@ -998,8 +977,7 @@ | ||
998 | 977 | { |
999 | 978 | int retry; |
1000 | 979 | |
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); | |
1003 | 981 | |
1004 | 982 | /* change guard time */ |
1005 | 983 | usbasp_tpi_send_byte(pgm, TPI_OP_SSTCS(TPIPCR)); |
@@ -1029,7 +1007,7 @@ | ||
1029 | 1007 | } |
1030 | 1008 | if(retry >= 10) |
1031 | 1009 | { |
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); | |
1033 | 1011 | return -1; |
1034 | 1012 | } |
1035 | 1013 |
@@ -1038,8 +1016,7 @@ | ||
1038 | 1016 | |
1039 | 1017 | static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) |
1040 | 1018 | { |
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); | |
1043 | 1020 | |
1044 | 1021 | /* Set PR to flash */ |
1045 | 1022 | usbasp_tpi_send_byte(pgm, TPI_OP_SSTPR(0)); |
@@ -1070,8 +1047,7 @@ | ||
1070 | 1047 | uint16_t pr; |
1071 | 1048 | |
1072 | 1049 | |
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", | |
1075 | 1051 | progname, m->desc, addr, n_bytes); |
1076 | 1052 | |
1077 | 1053 | dptr = addr + m->buf; |
@@ -1092,7 +1068,7 @@ | ||
1092 | 1068 | n = usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_READBLOCK, cmd, dptr, clen); |
1093 | 1069 | if(n != clen) |
1094 | 1070 | { |
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); | |
1096 | 1072 | return -3; |
1097 | 1073 | } |
1098 | 1074 |
@@ -1114,8 +1090,7 @@ | ||
1114 | 1090 | uint16_t pr; |
1115 | 1091 | |
1116 | 1092 | |
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", | |
1119 | 1094 | progname, m->desc, addr, n_bytes); |
1120 | 1095 | |
1121 | 1096 | sptr = addr + m->buf; |
@@ -1142,7 +1117,7 @@ | ||
1142 | 1117 | n = usbasp_transmit(pgm, 0, USBASP_FUNC_TPI_WRITEBLOCK, cmd, sptr, clen); |
1143 | 1118 | if(n != clen) |
1144 | 1119 | { |
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); | |
1146 | 1121 | return -3; |
1147 | 1122 | } |
1148 | 1123 |
@@ -1165,8 +1140,7 @@ | ||
1165 | 1140 | uint16_t pr; |
1166 | 1141 | |
1167 | 1142 | |
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", | |
1170 | 1144 | progname, m->desc, addr); |
1171 | 1145 | |
1172 | 1146 | pr = m->offset + addr; |
@@ -1179,7 +1153,7 @@ | ||
1179 | 1153 | n = usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_READBLOCK, cmd, value, 1); |
1180 | 1154 | if(n != 1) |
1181 | 1155 | { |
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); | |
1183 | 1157 | return -3; |
1184 | 1158 | } |
1185 | 1159 | return 0; |
@@ -1187,7 +1161,7 @@ | ||
1187 | 1161 | |
1188 | 1162 | static int usbasp_tpi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char data) |
1189 | 1163 | { |
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); | |
1191 | 1165 | return -1; |
1192 | 1166 | } |
1193 | 1167 |
@@ -1229,7 +1203,7 @@ | ||
1229 | 1203 | |
1230 | 1204 | static int usbasp_nousb_open (struct programmer_t *pgm, char * name) |
1231 | 1205 | { |
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", | |
1233 | 1207 | progname); |
1234 | 1208 | |
1235 | 1209 | return -1; |
@@ -75,7 +75,7 @@ | ||
75 | 75 | static void usbtiny_setup(PROGRAMMER * pgm) |
76 | 76 | { |
77 | 77 | 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", | |
79 | 79 | progname); |
80 | 80 | exit(1); |
81 | 81 | } |
@@ -99,7 +99,7 @@ | ||
99 | 99 | NULL, 0, // no data buffer in control messge |
100 | 100 | USB_TIMEOUT ); // default timeout |
101 | 101 | 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()); | |
103 | 103 | return -1; |
104 | 104 | } |
105 | 105 |
@@ -131,7 +131,7 @@ | ||
131 | 131 | } |
132 | 132 | PDATA(pgm)->retries++; |
133 | 133 | } |
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", | |
135 | 135 | progname, usb_strerror(), buflen, nbytes); |
136 | 136 | return -1; |
137 | 137 | } |
@@ -140,7 +140,7 @@ | ||
140 | 140 | static void check_retries (PROGRAMMER * pgm, const char* operation) |
141 | 141 | { |
142 | 142 | 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, | |
144 | 144 | PDATA(pgm)->retries, operation); |
145 | 145 | } |
146 | 146 | PDATA(pgm)->retries = 0; |
@@ -165,7 +165,7 @@ | ||
165 | 165 | (char *)buffer, buflen, |
166 | 166 | timeout); |
167 | 167 | 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", | |
169 | 169 | progname, usb_strerror(), buflen, nbytes); |
170 | 170 | return -1; |
171 | 171 | } |
@@ -184,7 +184,7 @@ | ||
184 | 184 | unsigned char cmd[4]; |
185 | 185 | |
186 | 186 | 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 ); | |
188 | 188 | return -1; |
189 | 189 | } |
190 | 190 | memset(cmd, 0, sizeof(cmd)); |
@@ -234,7 +234,7 @@ | ||
234 | 234 | if (usbpid) { |
235 | 235 | pid = *(int *)(ldata(usbpid)); |
236 | 236 | 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", | |
238 | 238 | progname, pid); |
239 | 239 | } else { |
240 | 240 | pid = USBTINY_PRODUCT_DEFAULT; |
@@ -246,8 +246,7 @@ | ||
246 | 246 | for ( dev = bus->devices; dev; dev = dev->next ) { |
247 | 247 | if (dev->descriptor.idVendor == vid |
248 | 248 | && 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", | |
251 | 250 | progname, bus->dirname, dev->filename); |
252 | 251 | // if -P was given, match device by device name and bus name |
253 | 252 | if(name != NULL && |
@@ -259,7 +258,7 @@ | ||
259 | 258 | |
260 | 259 | // wrong permissions or something? |
261 | 260 | 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", | |
263 | 262 | progname, usb_strerror()); |
264 | 263 | continue; |
265 | 264 | } |
@@ -268,12 +267,12 @@ | ||
268 | 267 | } |
269 | 268 | |
270 | 269 | 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); | |
273 | 272 | return -1; |
274 | 273 | } |
275 | 274 | 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", | |
277 | 276 | progname, vid, pid ); |
278 | 277 | return -1; |
279 | 278 | } |
@@ -318,10 +317,8 @@ | ||
318 | 317 | if (PDATA(pgm)->sck_period > SCK_MAX) |
319 | 318 | PDATA(pgm)->sck_period = SCK_MAX; |
320 | 319 | |
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, | |
323 | 321 | PDATA(pgm)->sck_period ); |
324 | - } | |
325 | 322 | |
326 | 323 | // send the command to the usbtiny device. |
327 | 324 | // MEME: for at90's fix resetstate? |
@@ -345,10 +342,8 @@ | ||
345 | 342 | } else { |
346 | 343 | // -B option not specified: use default |
347 | 344 | 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", | |
350 | 346 | progname, PDATA(pgm)->sck_period ); |
351 | - } | |
352 | 347 | if (usb_control(pgm, USBTINY_POWERUP, |
353 | 348 | PDATA(pgm)->sck_period, RESET_LOW ) < 0) |
354 | 349 | return -1; |
@@ -400,12 +395,10 @@ | ||
400 | 395 | if (nbytes < 0) |
401 | 396 | return -1; |
402 | 397 | 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", | |
406 | 400 | cmd[0], cmd[1], cmd[2], cmd[3], |
407 | 401 | res[0], res[1], res[2], res[3] ); |
408 | - } | |
409 | 402 | return ((nbytes == 4) && // should have read 4 bytes |
410 | 403 | res[2] == cmd[1]); // AVR's do a delayed-echo thing |
411 | 404 | } |
@@ -416,7 +409,7 @@ | ||
416 | 409 | unsigned char res[4]; |
417 | 410 | |
418 | 411 | 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", | |
420 | 413 | p->desc); |
421 | 414 | return -1; |
422 | 415 | } |
@@ -577,7 +570,7 @@ | ||
577 | 570 | |
578 | 571 | static int usbtiny_nousb_open(struct programmer_t *pgm, char * name) |
579 | 572 | { |
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", | |
581 | 574 | progname); |
582 | 575 | |
583 | 576 | return -1; |
@@ -85,7 +85,7 @@ | ||
85 | 85 | * Now prepare our data |
86 | 86 | */ |
87 | 87 | 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", | |
89 | 89 | progname); |
90 | 90 | exit(1); |
91 | 91 | } |
@@ -123,21 +123,19 @@ | ||
123 | 123 | int newsnooze; |
124 | 124 | if (sscanf(extended_param, "snooze=%i", &newsnooze) != 1 || |
125 | 125 | 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", | |
127 | 127 | progname, extended_param); |
128 | 128 | rv = -1; |
129 | 129 | continue; |
130 | 130 | } |
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); | |
135 | 133 | WIRINGPDATA(mycookie)->snoozetime = newsnooze; |
136 | 134 | |
137 | 135 | continue; |
138 | 136 | } |
139 | 137 | |
140 | - avrdude_message("%s: wiring_parseextparms(): invalid extended parameter '%s'\n", | |
138 | + avrdude_message(MSG_INFO, "%s: wiring_parseextparms(): invalid extended parameter '%s'\n", | |
141 | 139 | progname, extended_param); |
142 | 140 | rv = -1; |
143 | 141 | } |
@@ -160,17 +158,12 @@ | ||
160 | 158 | if (WIRINGPDATA(mycookie)->snoozetime > 0) { |
161 | 159 | timetosnooze = WIRINGPDATA(mycookie)->snoozetime; |
162 | 160 | |
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); | |
167 | 163 | while (timetosnooze--) |
168 | 164 | 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); | |
174 | 167 | } else { |
175 | 168 | /* Perform Wiring programming mode RESET. */ |
176 | 169 | /* This effectively *releases* both DTR and RTS. */ |
@@ -177,10 +170,8 @@ | ||
177 | 170 | /* i.e. both DTR and RTS rise to a HIGH logic level */ |
178 | 171 | /* since they are active LOW signals. */ |
179 | 172 | |
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); | |
184 | 175 | |
185 | 176 | serial_set_dtr_rts(&pgm->fd, 0); |
186 | 177 | usleep(50*1000); |
@@ -188,10 +179,8 @@ | ||
188 | 179 | /* After releasing for 50 milliseconds, DTR and RTS */ |
189 | 180 | /* are asserted (i.e. logic LOW) again. */ |
190 | 181 | |
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); | |
195 | 184 | |
196 | 185 | serial_set_dtr_rts(&pgm->fd, 1); |
197 | 186 | usleep(50*1000); |