new svf command option 'progress'

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1256 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 8eb27def6b
commit 47d85b3d35

@ -1,3 +1,11 @@
2008-05-27 Arnim Laeuger <arniml@users.sourceforge.net>
* UrJTAG.txt: document progress option of svf command
* src/cmd/svf.c (cmd_svf_run): new command option 'progress'
* src/svf/svf.c (svf_run), include/svf.h (svf_run): new parameter
print_progress
* src/svf/svf_flex.l (fix_yylloc_nl): report line / total number
2008-05-26 Arnim Laeuger <arniml@users.sourceforge.net>
[adding svf progress output] (Steve Franks)

@ -856,6 +856,10 @@ In case the TDO parameter of an SDR command leads to a mismatch the player
issues a warning and continues. If the player should abort in this case then
specify 'stop' at the svf command.
The absence of error or warning messages indicate that the SVF file could be
executed without problems. To get a progress reporting while the player advances
through the SVF file, specify 'progress' at the svf command.
.Limitations and Deficiencies
*****************************
Several limitations exist for the SVF player.

@ -27,6 +27,6 @@
#include "chain.h"
void svf_run(chain_t *chain, FILE *, int);
void svf_run(chain_t *chain, FILE *, int, int);
#endif /* SVF_H */

@ -35,21 +35,24 @@ static int
cmd_svf_run( chain_t *chain, char *params[] )
{
FILE *SVF_FILE;
int num_params, result = -1;
int num_params, i, result = -1;
int stop = 0;
int print_progress = 0;
num_params = cmd_params( params );
if (num_params == 2 || num_params == 3) {
if ((SVF_FILE = fopen(params[1], "r")) != NULL) {
if (num_params > 1) {
for (i = 2; i < num_params; i++) {
if (strcasecmp(params[i], "stop") == 0)
stop = 1;
else if (strcasecmp(params[i], "progress") == 0)
print_progress = 1;
else
return -1;
}
if (num_params == 3) {
if (strcasecmp(params[2], "stop") == 0) {
svf_run(chain, SVF_FILE, 1);
result = 1;
}
} else {
svf_run(chain, SVF_FILE, 0);
result = 1;
}
if ((SVF_FILE = fopen(params[1], "r")) != NULL) {
svf_run(chain, SVF_FILE, stop, print_progress);
result = 1;
fclose(SVF_FILE);
} else {
@ -66,13 +69,13 @@ static void
cmd_svf_help( void )
{
printf( _(
"Usage: %s FILE\n"
"Usage: %s FILE stop\n"
"Usage: %s FILE [stop] [progress]\n"
"Execute svf commands from FILE.\n"
"Command execution stops upon TDO mismatch when 'stop' is specified.\n"
"stop : Command execution stops upon TDO mismatch.\n"
"progress : Continually displays progress status.\n"
"\n"
"FILE file containing SVF commans\n"
), "svf", "svf" );
), "svf" );
}
cmd_t cmd_svf = {

@ -1008,13 +1008,15 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params)
* SVF_FILE : file handle of SVF file
* stop_on_mismatch : 1 = stop upon tdo mismatch
* 0 = continue upon mismatch
* print_progress : 1 = continually print progress status
* 0 = don't print
*
* Return value:
* 1 : all ok
* 0 : error occured
* ***************************************************************************/
void
svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch)
svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch, int print_progress)
{
const sxr_t sxr_default = { {0.0, NULL, NULL, NULL, NULL},
1, 1};
@ -1117,7 +1119,7 @@ svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch)
/* select SIR instruction */
part_set_instruction(priv.part, "SIR");
if (svf_bison_init(&priv, SVF_FILE, num_lines, 0)) {
if (svf_bison_init(&priv, SVF_FILE, num_lines, print_progress)) {
svfparse(&priv, chain);
svf_bison_deinit(&priv);
}

@ -306,7 +306,9 @@ fix_yylloc_nl(YYLTYPE * mylloc, char *str, YY_EXTRA_TYPE extra)
mylloc->last_column = 0;
++mylloc->last_line;
if (extra->print_progress)
printf( _("\rParsing (%3.0d%%)"), ((mylloc->last_line * 100) + 1) / extra->num_lines);
printf( _("\rParsing %6d/%d (%3.0d%%)"),
mylloc->last_line, extra->num_lines,
((mylloc->last_line * 100) + 1) / extra->num_lines );
} else {
++mylloc->last_column;
}

Loading…
Cancel
Save