mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 18:44:17 +00:00
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:
139
stk500.c
139
stk500.c
@@ -71,7 +71,7 @@ static int stk500_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len)
|
||||
|
||||
rv = serial_recv(&pgm->fd, buf, len);
|
||||
if (rv < 0) {
|
||||
avrdude_message("%s: stk500_recv(): programmer is not responding\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_recv(): programmer is not responding\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ int stk500_getsync(PROGRAMMER * pgm)
|
||||
if (resp[0] == Resp_STK_INSYNC){
|
||||
break;
|
||||
}
|
||||
avrdude_message("%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n",
|
||||
progname, attempt + 1, MAX_SYNC_ATTEMPTS, resp[0]);
|
||||
}
|
||||
if (attempt == MAX_SYNC_ATTEMPTS) {
|
||||
@@ -121,7 +121,7 @@ int stk500_getsync(PROGRAMMER * pgm)
|
||||
if (stk500_recv(pgm, resp, 1) < 0)
|
||||
return -1;
|
||||
if (resp[0] != Resp_STK_OK) {
|
||||
avrdude_message("%s: stk500_getsync(): can't communicate with device: "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_getsync(): can't communicate with device: "
|
||||
"resp=0x%02x\n",
|
||||
progname, resp[0]);
|
||||
return -1;
|
||||
@@ -152,7 +152,7 @@ static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_cmd(): programmer is out of sync\n", progname);
|
||||
avrdude_message(MSG_INFO, "%s: stk500_cmd(): programmer is out of sync\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
avrdude_message("%s: stk500_cmd(): protocol error\n", progname);
|
||||
avrdude_message(MSG_INFO, "%s: stk500_cmd(): protocol error\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -183,14 +183,14 @@ static int stk500_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
unsigned char res[4];
|
||||
|
||||
if (pgm->cmd == NULL) {
|
||||
avrdude_message("%s: Error: %s programmer uses stk500_chip_erase() but does not\n"
|
||||
avrdude_message(MSG_INFO, "%s: Error: %s programmer uses stk500_chip_erase() but does not\n"
|
||||
"provide a cmd() method.\n",
|
||||
progname, pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("%s: stk500_program_enable(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_program_enable(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_program_enable(): protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_program_enable(): protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
@@ -250,20 +250,20 @@ static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
return 0;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
avrdude_message("%s: stk500_program_enable(): no device\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_program_enable(): no device\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(buf[0] == Resp_STK_FAILED)
|
||||
{
|
||||
avrdude_message("%s: stk500_program_enable(): failed to enter programming mode\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_program_enable(): failed to enter programming mode\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
avrdude_message("%s: stk500_program_enable(): unknown response=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_program_enable(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return -1;
|
||||
@@ -294,7 +294,7 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("%s: stk500_set_extended_parms(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_set_extended_parms(): protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
@@ -315,21 +315,21 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
|
||||
return 0;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
avrdude_message("%s: stk500_set_extended_parms(): no device\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): no device\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(buf[0] == Resp_STK_FAILED)
|
||||
{
|
||||
avrdude_message("%s: stk500_set_extended_parms(): failed to set extended "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): failed to set extended "
|
||||
"device programming parameters\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
avrdude_message("%s: stk500_set_extended_parms(): unknown response=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_extended_parms(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return -1;
|
||||
@@ -364,7 +364,7 @@ static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("%s: mib510_isp(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "%s: mib510_isp(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: mib510_isp(): protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: mib510_isp(): protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
@@ -385,20 +385,20 @@ static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd)
|
||||
return 0;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
avrdude_message("%s: mib510_isp(): no device\n",
|
||||
avrdude_message(MSG_INFO, "%s: mib510_isp(): no device\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[0] == Resp_STK_FAILED)
|
||||
{
|
||||
avrdude_message("%s: mib510_isp(): command %d failed\n",
|
||||
avrdude_message(MSG_INFO, "%s: mib510_isp(): command %d failed\n",
|
||||
progname, cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
avrdude_message("%s: mib510_isp(): unknown response=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: mib510_isp(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return -1;
|
||||
@@ -459,7 +459,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
}
|
||||
|
||||
#if 0
|
||||
avrdude_message("%s: stk500_initialize(): n_extparms = %d\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_initialize(): n_extparms = %d\n",
|
||||
progname, n_extparms);
|
||||
#endif
|
||||
|
||||
@@ -533,7 +533,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
avrdude_message("%s: stk500_initialize(): programmer not in sync, resp=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_initialize(): programmer not in sync, resp=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
if (tries > 33)
|
||||
return -1;
|
||||
@@ -542,7 +542,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_initialize(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_initialize(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
@@ -551,7 +551,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
avrdude_message("%s: stk500_initialize(): (b) protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_initialize(): (b) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[0]);
|
||||
return -1;
|
||||
@@ -559,8 +559,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
if (n_extparms) {
|
||||
if ((p->pagel == 0) || (p->bs2 == 0)) {
|
||||
if (verbose > 1)
|
||||
avrdude_message("%s: PAGEL and BS2 signals not defined in the configuration "
|
||||
avrdude_message(MSG_NOTICE2, "%s: PAGEL and BS2 signals not defined in the configuration "
|
||||
"file for part %s, using dummy values\n",
|
||||
progname, p->desc);
|
||||
buf[2] = 0xD7; /* they look somehow possible, */
|
||||
@@ -590,7 +589,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
rc = stk500_set_extended_parms(pgm, n_extparms+1, buf);
|
||||
if (rc) {
|
||||
avrdude_message("%s: stk500_initialize(): failed\n", progname);
|
||||
avrdude_message(MSG_INFO, "%s: stk500_initialize(): failed\n", progname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -616,7 +615,7 @@ static void stk500_disable(PROGRAMMER * pgm)
|
||||
return;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("%s: stk500_disable(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_disable(): can't get into sync\n",
|
||||
progname);
|
||||
return;
|
||||
}
|
||||
@@ -625,7 +624,7 @@ static void stk500_disable(PROGRAMMER * pgm)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_disable(): protocol error, expect=0x%02x, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_disable(): protocol error, expect=0x%02x, "
|
||||
"resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return;
|
||||
@@ -637,12 +636,12 @@ static void stk500_disable(PROGRAMMER * pgm)
|
||||
return;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
avrdude_message("%s: stk500_disable(): no device\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_disable(): no device\n",
|
||||
progname);
|
||||
return;
|
||||
}
|
||||
|
||||
avrdude_message("%s: stk500_disable(): unknown response=0x%02x\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_disable(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return;
|
||||
@@ -727,7 +726,7 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("%s: stk500_loadaddr(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_loadaddr(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -736,7 +735,7 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("%s: stk500_loadaddr(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_loadaddr(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
@@ -748,7 +747,7 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
avrdude_message("%s: loadaddr(): (b) protocol error, "
|
||||
avrdude_message(MSG_INFO, "%s: loadaddr(): (b) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
|
||||
@@ -785,7 +784,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
n = addr + n_bytes;
|
||||
#if 0
|
||||
avrdude_message("n_bytes = %d\n"
|
||||
avrdude_message(MSG_INFO, "n_bytes = %d\n"
|
||||
"n = %u\n"
|
||||
"a_div = %d\n"
|
||||
"page_size = %d\n",
|
||||
@@ -823,7 +822,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("\n%s: stk500_paged_write(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): can't get into sync\n",
|
||||
progname);
|
||||
return -3;
|
||||
}
|
||||
@@ -832,7 +831,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("\n%s: stk500_paged_write(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -4;
|
||||
@@ -841,7 +840,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
avrdude_message("\n%s: stk500_paged_write(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -5;
|
||||
@@ -904,7 +903,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("\n%s: stk500_paged_load(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): can't get into sync\n",
|
||||
progname);
|
||||
return -3;
|
||||
}
|
||||
@@ -913,7 +912,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -4;
|
||||
@@ -927,7 +926,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
if(strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -5;
|
||||
@@ -935,7 +934,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
}
|
||||
else {
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
avrdude_message("\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[0]);
|
||||
return -5;
|
||||
@@ -954,13 +953,13 @@ static int stk500_set_vtarget(PROGRAMMER * pgm, double v)
|
||||
utarg = (unsigned)((v + 0.049) * 10);
|
||||
|
||||
if (stk500_getparm(pgm, Parm_STK_VADJUST, &uaref) != 0) {
|
||||
avrdude_message("%s: stk500_set_vtarget(): cannot obtain V[aref]\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_vtarget(): cannot obtain V[aref]\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (uaref > utarg) {
|
||||
avrdude_message("%s: stk500_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_vtarget(): reducing V[aref] from %.1f to %.1f\n",
|
||||
progname, uaref / 10.0, v);
|
||||
if (stk500_setparm(pgm, Parm_STK_VADJUST, utarg)
|
||||
!= 0)
|
||||
@@ -978,13 +977,13 @@ static int stk500_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */,
|
||||
uaref = (unsigned)((v + 0.049) * 10);
|
||||
|
||||
if (stk500_getparm(pgm, Parm_STK_VTARGET, &utarg) != 0) {
|
||||
avrdude_message("%s: stk500_set_varef(): cannot obtain V[target]\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_varef(): cannot obtain V[target]\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (uaref > utarg) {
|
||||
avrdude_message("%s: stk500_set_varef(): V[aref] must not be greater than "
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_varef(): V[aref] must not be greater than "
|
||||
"V[target] = %.1f\n",
|
||||
progname, utarg / 10.0);
|
||||
return -1;
|
||||
@@ -1013,7 +1012,7 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v)
|
||||
unit = "kHz";
|
||||
} else
|
||||
unit = "Hz";
|
||||
avrdude_message("%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_fosc(): f = %.3f %s too high, using %.3f MHz\n",
|
||||
progname, v, unit, STK500_XTAL / 2e6);
|
||||
fosc = STK500_XTAL / 2;
|
||||
} else
|
||||
@@ -1028,7 +1027,7 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v)
|
||||
}
|
||||
}
|
||||
if (idx == sizeof(ps) / sizeof(ps[0])) {
|
||||
avrdude_message("%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_fosc(): f = %u Hz too low, %u Hz min\n",
|
||||
progname, fosc, STK500_XTAL / (256 * 1024 * 2));
|
||||
return -1;
|
||||
}
|
||||
@@ -1060,11 +1059,11 @@ static int stk500_set_sck_period(PROGRAMMER * pgm, double v)
|
||||
|
||||
if (v < min) {
|
||||
dur = 1;
|
||||
avrdude_message("%s: stk500_set_sck_period(): p = %.1f us too small, using %.1f us\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_sck_period(): p = %.1f us too small, using %.1f us\n",
|
||||
progname, v / 1e-6, dur * min / 1e-6);
|
||||
} else if (v > max) {
|
||||
dur = 255;
|
||||
avrdude_message("%s: stk500_set_sck_period(): p = %.1f us too large, using %.1f us\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_set_sck_period(): p = %.1f us too large, using %.1f us\n",
|
||||
progname, v / 1e-6, dur * min / 1e-6);
|
||||
}
|
||||
|
||||
@@ -1090,7 +1089,7 @@ static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("\n%s: stk500_getparm(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -1099,7 +1098,7 @@ static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("\n%s: stk500_getparm(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -2;
|
||||
@@ -1112,12 +1111,12 @@ static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value)
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_FAILED) {
|
||||
avrdude_message("\n%s: stk500_getparm(): parameter 0x%02x failed\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): parameter 0x%02x failed\n",
|
||||
progname, v);
|
||||
return -3;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_OK) {
|
||||
avrdude_message("\n%s: stk500_getparm(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -3;
|
||||
@@ -1147,7 +1146,7 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
avrdude_message("\n%s: stk500_setparm(): can't get into sync\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -1156,7 +1155,7 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value)
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
avrdude_message("\n%s: stk500_setparm(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -2;
|
||||
@@ -1171,12 +1170,12 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value)
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_FAILED) {
|
||||
avrdude_message("\n%s: stk500_setparm(): parameter 0x%02x failed\n",
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): parameter 0x%02x failed\n",
|
||||
progname, parm);
|
||||
return -3;
|
||||
}
|
||||
else {
|
||||
avrdude_message("\n%s: stk500_setparm(): (a) protocol error, "
|
||||
avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -3;
|
||||
@@ -1193,8 +1192,8 @@ static void stk500_display(PROGRAMMER * pgm, const char * p)
|
||||
stk500_getparm(pgm, Parm_STK_SW_MINOR, &min);
|
||||
stk500_getparm(pgm, Param_STK500_TOPCARD_DETECT, &topcard);
|
||||
|
||||
avrdude_message("%sHardware Version: %d\n", p, hdw);
|
||||
avrdude_message("%sFirmware Version: %d.%d\n", p, maj, min);
|
||||
avrdude_message(MSG_INFO, "%sHardware Version: %d\n", p, hdw);
|
||||
avrdude_message(MSG_INFO, "%sFirmware Version: %d.%d\n", p, maj, min);
|
||||
if (topcard < 3) {
|
||||
const char *n = "Unknown";
|
||||
|
||||
@@ -1207,7 +1206,7 @@ static void stk500_display(PROGRAMMER * pgm, const char * p)
|
||||
n = "STK501";
|
||||
break;
|
||||
}
|
||||
avrdude_message("%sTopcard : %s\n", p, n);
|
||||
avrdude_message(MSG_INFO, "%sTopcard : %s\n", p, n);
|
||||
}
|
||||
stk500_print_parms1(pgm, p);
|
||||
|
||||
@@ -1225,11 +1224,11 @@ static void stk500_print_parms1(PROGRAMMER * pgm, const char * p)
|
||||
stk500_getparm(pgm, Parm_STK_OSC_CMATCH, &osc_cmatch);
|
||||
stk500_getparm(pgm, Parm_STK_SCK_DURATION, &sck_duration);
|
||||
|
||||
avrdude_message("%sVtarget : %.1f V\n", p, vtarget / 10.0);
|
||||
avrdude_message("%sVaref : %.1f V\n", p, vadjust / 10.0);
|
||||
avrdude_message("%sOscillator : ", p);
|
||||
avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, vtarget / 10.0);
|
||||
avrdude_message(MSG_INFO, "%sVaref : %.1f V\n", p, vadjust / 10.0);
|
||||
avrdude_message(MSG_INFO, "%sOscillator : ", p);
|
||||
if (osc_pscale == 0)
|
||||
avrdude_message("Off\n");
|
||||
avrdude_message(MSG_INFO, "Off\n");
|
||||
else {
|
||||
int prescale = 1;
|
||||
double f = STK500_XTAL / 2;
|
||||
@@ -1253,9 +1252,9 @@ static void stk500_print_parms1(PROGRAMMER * pgm, const char * p)
|
||||
unit = "kHz";
|
||||
} else
|
||||
unit = "Hz";
|
||||
avrdude_message("%.3f %s\n", f, unit);
|
||||
avrdude_message(MSG_INFO, "%.3f %s\n", f, unit);
|
||||
}
|
||||
avrdude_message("%sSCK period : %.1f us\n", p,
|
||||
avrdude_message(MSG_INFO, "%sSCK period : %.1f us\n", p,
|
||||
sck_duration * 8.0e6 / STK500_XTAL + 0.05);
|
||||
|
||||
return;
|
||||
@@ -1270,7 +1269,7 @@ static void stk500_print_parms(PROGRAMMER * pgm)
|
||||
static void stk500_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
avrdude_message("%s: stk500_setup(): Out of memory allocating private data\n",
|
||||
avrdude_message(MSG_INFO, "%s: stk500_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user