Skip to content

Commit 6932030

Browse files
committed
Update bitclock help text
1 parent 2ffe0cb commit 6932030

24 files changed

+73
-92
lines changed

src/arduino.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ static int arduino_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const
112112
}
113113

114114
static int arduino_open(PROGRAMMER *pgm, const char *port) {
115-
union pinfo pinfo;
115+
if(pgm->bitclock)
116+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
116117

117118
pgm->port = port;
119+
union pinfo pinfo;
118120
pinfo.serialinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
119121
pinfo.serialinfo.cflags = SERIAL_8N1;
120122
if(serial_open(port, pinfo, &pgm->fd) == -1) {

src/avr910.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,8 @@ static int avr910_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
321321
}
322322

323323
static int avr910_open(PROGRAMMER *pgm, const char *port) {
324-
if(pgm->bitclock != 0.0) {
325-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
326-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
327-
}
324+
if(pgm->bitclock)
325+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
328326

329327
union pinfo pinfo;
330328
if(pgm->baudrate == 0)

src/buspirate.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,12 @@ static int buspirate_verifyconfig(const PROGRAMMER *pgm) {
441441

442442
// ====== Programmer methods =======
443443
static int buspirate_open(PROGRAMMER *pgm, const char *port) {
444-
if(pgm->bitclock != 0.0) {
445-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ)) {
446-
pmsg_warning("%s does not support adjustable bitclock speed using -B.\n", pgmid);
447-
imsg_warning("Ignoring -B flag. Use -x help to view alternative SPI clock options\n");
444+
if(pgm->bitclock) {
445+
if(str_eq(pgm->type, "buspirate_bb"))
446+
pmsg_warning("programmer type %s does not support adjustable bitclock speed using -B. Use -i instead\n", pgm->type);
447+
else {
448+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
449+
imsg_warning("Use -x help to view alternative SPI clock options\n");
448450
}
449451
}
450452

src/butterfly.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,8 @@ static void butterfly_enable(PROGRAMMER *pgm, const AVRPART *p) {
321321
}
322322

323323
static int butterfly_open(PROGRAMMER *pgm, const char *port) {
324-
if(pgm->bitclock != 0.0) {
325-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
326-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
327-
}
324+
if(pgm->bitclock)
325+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
328326

329327
pgm->port = port;
330328

src/ch341a.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,8 @@ static int ch341a_open(PROGRAMMER *pgm, const char *port) {
251251
return -1;
252252
}
253253

254-
if(pgm->bitclock != 0.0) {
255-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
256-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
257-
}
254+
if(pgm->bitclock)
255+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
258256

259257
return 0;
260258
}

src/dryrun.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,9 @@ static void dryrun_disable(const PROGRAMMER *pgm) {
728728
}
729729

730730
static int dryrun_open(PROGRAMMER *pgm, const char *port) {
731+
if(pgm->bitclock)
732+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
733+
731734
pmsg_debug("%s(%s)\n", __func__, port? port: "NULL");
732735

733736
return 0;

src/flip1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,8 @@ void flip1_initpgm(PROGRAMMER *pgm) {
180180
#ifdef HAVE_LIBUSB
181181

182182
static int flip1_open(PROGRAMMER *pgm, const char *port_spec) {
183-
if(pgm->bitclock != 0.0) {
184-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
185-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
186-
}
183+
if(pgm->bitclock)
184+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
187185

188186
FLIP1(pgm)->dfu = dfu_open(port_spec);
189187
return (FLIP1(pgm)->dfu != NULL)? 0: -1;

src/flip2.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ void flip2_initpgm(PROGRAMMER *pgm) {
178178
}
179179

180180
static int flip2_open(PROGRAMMER *pgm, const char *port_spec) {
181-
if(pgm->bitclock != 0.0) {
182-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
183-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
184-
}
181+
if(pgm->bitclock)
182+
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
185183

186184
FLIP2(pgm)->dfu = dfu_open(port_spec);
187185
return (FLIP2(pgm)->dfu != NULL)? 0: -1;

src/jtag3.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,9 +1060,9 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
10601060
return -1;
10611061

10621062

1063-
if(pgm->bitclock != 0.0 && !(pgm->extra_features & HAS_BITCLOCK_ADJ))
1064-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
1065-
else {
1063+
if(pgm->bitclock && !(pgm->extra_features & HAS_BITCLOCK_ADJ))
1064+
pmsg_warning("setting bitclock despite missing HAS_BITCLOCK_ADJ setting in extra_features\n");
1065+
10661066
if(conn == PARM3_CONN_PDI || conn == PARM3_CONN_UPDI)
10671067
my.set_sck = jtag3_set_sck_xmega_pdi;
10681068
else if(conn == PARM3_CONN_JTAG) {
@@ -1080,7 +1080,6 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
10801080
if(my.set_sck(pgm, parm) < 0)
10811081
return -1;
10821082
}
1083-
}
10841083

10851084

10861085
if(conn == PARM3_CONN_JTAG) {

src/jtagmkI.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,12 @@ static int jtagmkI_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
452452
}
453453
}
454454

455-
if(pgm->bitclock != 0.0) {
455+
if(pgm->bitclock) {
456456
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
457-
pmsg_warning("%s does not support adjustable bitclock speed. Ignoring -B flag\n", pgmid);
458-
else {
459-
pmsg_notice2("%s(): trying to set JTAG clock period to %.1f us\n", __func__, pgm->bitclock);
460-
if(jtagmkI_set_sck_period(pgm, pgm->bitclock) != 0)
461-
return -1;
462-
}
457+
pmsg_warning("setting bitclock despite missing HAS_BITCLOCK_ADJ setting in extra_features\n");
458+
pmsg_notice2("%s(): trying to set JTAG clock period to %.1f us\n", __func__, pgm->bitclock);
459+
if(jtagmkI_set_sck_period(pgm, pgm->bitclock) != 0)
460+
return -1;
463461
}
464462

465463
cmd[0] = CMD_STOP;

0 commit comments

Comments
 (0)