added verbose level in avrdude_message()

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1321 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
awachtler
2014-06-13 20:07:40 +00:00
parent 81a6464d53
commit bb48be1ac0
45 changed files with 1854 additions and 2128 deletions

View File

@@ -73,9 +73,8 @@ static void bitbang_calibrate_delay(void)
if (QueryPerformanceFrequency(&freq))
{
has_perfcount = 1;
if (verbose >= 2)
avrdude_message("%s: Using performance counter for bitbang delays\n",
progname);
avrdude_message(MSG_NOTICE2, "%s: Using performance counter for bitbang delays\n",
progname);
}
else
{
@@ -88,18 +87,16 @@ static void bitbang_calibrate_delay(void)
* auto-calibration figures seen on various Unix systems on
* comparable hardware.
*/
if (verbose >= 2)
avrdude_message("%s: Using guessed per-microsecond delay count for bitbang delays\n",
progname);
avrdude_message(MSG_NOTICE2, "%s: Using guessed per-microsecond delay count for bitbang delays\n",
progname);
delay_decrement = 100;
}
#else /* !WIN32NATIVE */
struct itimerval itv;
volatile int i;
if (verbose >= 2)
avrdude_message("%s: Calibrating delay loop...",
progname);
avrdude_message(MSG_NOTICE2, "%s: Calibrating delay loop...",
progname);
i = 0;
done = 0;
saved_alarmhandler = signal(SIGALRM, alarmhandler);
@@ -125,9 +122,8 @@ static void bitbang_calibrate_delay(void)
* Calculate back from 100 ms to 1 us.
*/
delay_decrement = -i / 100000;
if (verbose >= 2)
avrdude_message(" calibrated to %d cycles per us\n",
delay_decrement);
avrdude_message(MSG_NOTICE2, " calibrated to %d cycles per us\n",
delay_decrement);
#endif /* WIN32NATIVE */
}
@@ -266,7 +262,7 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
break;
}
if (b != 0) {
avrdude_message("bitbang_tpi_rx: start bit not received correctly\n");
avrdude_message(MSG_INFO, "bitbang_tpi_rx: start bit not received correctly\n");
return -1;
}
@@ -281,7 +277,7 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
/* parity bit */
if (bitbang_tpi_clk(pgm) != parity) {
avrdude_message("bitbang_tpi_rx: parity bit is wrong\n");
avrdude_message(MSG_INFO, "bitbang_tpi_rx: parity bit is wrong\n");
return -1;
}
@@ -290,7 +286,7 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
b &= bitbang_tpi_clk(pgm);
b &= bitbang_tpi_clk(pgm);
if (b != 1) {
avrdude_message("bitbang_tpi_rx: stop bits not received correctly\n");
avrdude_message(MSG_INFO, "bitbang_tpi_rx: stop bits not received correctly\n");
return -1;
}
@@ -337,15 +333,15 @@ int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message("bitbang_cmd(): [ ");
avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
for(i = 0; i < 4; i++)
avrdude_message("%02X ", cmd[i]);
avrdude_message("] [ ");
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
for(i = 0; i < 4; i++)
{
avrdude_message("%02X ", res[i]);
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
}
avrdude_message("]\n");
avrdude_message(MSG_NOTICE2, "]\n");
}
return 0;
@@ -372,15 +368,15 @@ int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message("bitbang_cmd_tpi(): [ ");
avrdude_message(MSG_NOTICE2, "bitbang_cmd_tpi(): [ ");
for(i = 0; i < cmd_len; i++)
avrdude_message("%02X ", cmd[i]);
avrdude_message("] [ ");
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
for(i = 0; i < res_len; i++)
{
avrdude_message("%02X ", res[i]);
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
}
avrdude_message("]\n");
avrdude_message(MSG_NOTICE2, "]\n");
}
pgm->pgm_led(pgm, OFF);
@@ -408,15 +404,15 @@ int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message("bitbang_cmd(): [ ");
avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
for(i = 0; i < count; i++)
avrdude_message("%02X ", cmd[i]);
avrdude_message("] [ ");
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
for(i = 0; i < count; i++)
{
avrdude_message("%02X ", res[i]);
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
}
avrdude_message("]\n");
avrdude_message(MSG_NOTICE2, "]\n");
}
return 0;
@@ -444,7 +440,7 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
/* Set Pointer Register */
mem = avr_locate_mem(p, "flash");
if (mem == NULL) {
avrdude_message("No flash memory to erase for part %s\n",
avrdude_message(MSG_INFO, "No flash memory to erase for part %s\n",
p->desc);
return -1;
}
@@ -465,7 +461,7 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
}
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
avrdude_message("chip erase instruction not defined for part \"%s\"\n",
avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
p->desc);
return -1;
}
@@ -506,7 +502,7 @@ int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
avrdude_message("program enable instruction not defined for part \"%s\"\n",
avrdude_message(MSG_INFO, "program enable instruction not defined for part \"%s\"\n",
p->desc);
return -1;
}
@@ -539,7 +535,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
if (p->flags & AVRPART_HAS_TPI) {
/* make sure cmd_tpi() is defined */
if (pgm->cmd_tpi == NULL) {
avrdude_message("%s: Error: %s programmer does not support TPI\n",
avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n",
progname, pgm->type);
return -1;
}
@@ -548,22 +544,20 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
pgm->setpin(pgm, PIN_AVR_RESET, 1);
usleep(1000);
if (verbose >= 2)
avrdude_message("doing MOSI-MISO link check\n");
avrdude_message(MSG_NOTICE2, "doing MOSI-MISO link check\n");
pgm->setpin(pgm, PIN_AVR_MOSI, 0);
if (pgm->getpin(pgm, PIN_AVR_MISO) != 0) {
avrdude_message("MOSI->MISO 0 failed\n");
avrdude_message(MSG_INFO, "MOSI->MISO 0 failed\n");
return -1;
}
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
if (pgm->getpin(pgm, PIN_AVR_MISO) != 1) {
avrdude_message("MOSI->MISO 1 failed\n");
avrdude_message(MSG_INFO, "MOSI->MISO 1 failed\n");
return -1;
}
if (verbose >= 2)
avrdude_message("MOSI-MISO link present\n");
avrdude_message(MSG_NOTICE2, "MOSI-MISO link present\n");
}
pgm->setpin(pgm, PIN_AVR_SCK, 0);
@@ -584,7 +578,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR);
rc = bitbang_tpi_rx(pgm);
if (rc != 0x80) {
avrdude_message("TPIIR not correct\n");
avrdude_message(MSG_INFO, "TPIIR not correct\n");
return -1;
}
} else {
@@ -618,7 +612,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
* can't sync with the device, maybe it's not attached?
*/
if (rc) {
avrdude_message("%s: AVR device not responding\n", progname);
avrdude_message(MSG_INFO, "%s: AVR device not responding\n", progname);
return -1;
}
}
@@ -629,7 +623,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc)
{
if (pgm->pinno[pin] == 0) {
avrdude_message("%s: error: no pin has been assigned for %s\n",
avrdude_message(MSG_INFO, "%s: error: no pin has been assigned for %s\n",
progname, desc);
return -1;
}
@@ -653,7 +647,7 @@ int bitbang_check_prerequisites(PROGRAMMER *pgm)
return -1;
if (pgm->cmd == NULL) {
avrdude_message("%s: error: no cmd() method defined for bitbang programmer\n",
avrdude_message(MSG_INFO, "%s: error: no cmd() method defined for bitbang programmer\n",
progname);
return -1;
}