add the ref_freq option to svf command

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1385 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 16 years ago
parent bfcc7becba
commit aeb93db8d2

@ -1,3 +1,9 @@
2008-10-30 Arnim Laeuger <arniml@users.sourceforge.net>
* include/svf.h, src/cmd/svf.c, src/svf/svf.c,
src/svf/svf_bison.y, src/svf/svf.h, doc/UrJTAG.txt:
add the ref_freq option to svf command
2008-10-28 Arnim Laeuger <arniml@users.sourceforge.net>
* src/cmd/parse.c (jtag_parse_stream): avoid clipping message when

@ -862,7 +862,7 @@ 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
The absence of error or warning messages indicate that the SVF file was
executed without problems. To get a progress reporting while the player advances
through the SVF file, specify 'progress' at the svf command.
@ -898,11 +898,15 @@ The implementation of some SVF commands has deficiencies.
- TIR, TDR commands not supported. +
Their functionality should be covered by the part concept of JTAG Tools.
Operation can be slowed down significantly when the FREQUENCY command has
been specified. This is not a problem of the SVF player itself but seem to
happen when the frequency of UrJTAG is set to a value larger than 0.
Configuration takes very long although the maximum allowed frequency is 10 MHz.
Consider to comment out the FREQUENCY command at the beginning of the SVF file.
SVF files for programming flash-based devices might or might not work for a given
setup. This has been observed for Actel IGLOO devices where success and failure
depends on the actual clocking rate of the chosen cable.
The ref_freq=<...> option to the svf command allows to tweak the calculation
of 'RUNTEST xxx SEC' commands. For these commands, the SVF player needs to
calculate the equivalent number of clocks and per default it will use the
current cable clock frequency. This can be overridden with the ref_freq option
that specifies a fixed reference frequency for such calculations.
*****************************
===== bsdl =====

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

@ -26,6 +26,7 @@
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <svf.h>
@ -34,10 +35,11 @@
static int
cmd_svf_run( chain_t *chain, char *params[] )
{
FILE *SVF_FILE;
int num_params, i, result = -1;
int stop = 0;
int print_progress = 0;
FILE *SVF_FILE;
int num_params, i, result = -1;
int stop = 0;
int print_progress = 0;
uint32_t ref_freq = 0;
num_params = cmd_params( params );
if (num_params > 1) {
@ -46,12 +48,14 @@ cmd_svf_run( chain_t *chain, char *params[] )
stop = 1;
else if (strcasecmp(params[i], "progress") == 0)
print_progress = 1;
else if (strncasecmp(params[i], "ref_freq=", 9) == 0)
ref_freq = strtol(params[i]+9, NULL, 10);
else
return -1;
}
if ((SVF_FILE = fopen(params[1], "r")) != NULL) {
svf_run(chain, SVF_FILE, stop, print_progress);
svf_run(chain, SVF_FILE, stop, print_progress, ref_freq);
result = 1;
fclose(SVF_FILE);
@ -69,12 +73,13 @@ static void
cmd_svf_help( void )
{
printf( _(
"Usage: %s FILE [stop] [progress]\n"
"Usage: %s FILE [stop] [progress] [ref_freq=<frequency>]\n"
"Execute svf commands from FILE.\n"
"stop : Command execution stops upon TDO mismatch.\n"
"progress : Continually displays progress status.\n"
"ref_freq : Use <frequency> as the reference for 'RUNTEST xxx SEC' commands\n"
"\n"
"FILE file containing SVF commans\n"
"FILE file containing SVF commands\n"
), "svf" );
}

@ -560,7 +560,7 @@ svf_endxr(parser_priv_t *priv, enum generic_irdr_coding ir_dr, int state)
* freq : frequency in HZ
* ***************************************************************************/
void
svf_frequency(chain_t *chain, double freq)
svf_frequency(chain_t *chain, parser_priv_t *priv, double freq)
{
cable_set_frequency(chain->cable, freq);
}
@ -647,7 +647,7 @@ svf_runtest(chain_t *chain, parser_priv_t *priv, struct runtest *params)
/* compute run_count */
run_count = params->run_count;
if (params->min_time > 0.0) {
frequency = cable_get_frequency(chain->cable);
frequency = priv->ref_freq > 0 ? priv->ref_freq : cable_get_frequency(chain->cable);
if (frequency > 0) {
uint32_t min_time_run_count = ceil(params->min_time * frequency);
if (min_time_run_count > run_count) {
@ -1000,7 +1000,7 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params)
/* ***************************************************************************
* svf_run(chain, SVF_FILE, stop_on_mismatch)
* svf_run(chain, SVF_FILE, stop_on_mismatch, ref_freq)
*
* Main entry point for the 'svf' command. Calls the svf parser.
*
@ -1009,18 +1009,21 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params)
* afterwards.
*
* Parameter:
* chain : pointer to global chain
* 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
* ref_freq : reference frequency for RUNTEST
*
* Return value:
* 1 : all ok
* 0 : error occured
* ***************************************************************************/
void
svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch, int print_progress)
svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch, int print_progress,
uint32_t ref_freq)
{
const sxr_t sxr_default = { {0.0, NULL, NULL, NULL, NULL},
1, 1};
@ -1120,6 +1123,7 @@ svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch, int print_progress
/* set back flags for issued warnings */
priv.issued_runtest_maxtime = 0;
priv.ref_freq = ref_freq;
/* select SIR instruction */
part_set_instruction(priv.part, "SIR");

@ -97,6 +97,7 @@ struct parser_priv {
int svf_stop_on_mismatch;
int svf_trst_absent;
int svf_state_executed;
uint32_t ref_freq;
/* protocol issued warnings */
int issued_runtest_maxtime;
};
@ -105,6 +106,7 @@ typedef struct parser_priv parser_priv_t;
struct scanner_extra {
int num_lines;
int print_progress;
int planb;
char decimal_point;
};
typedef struct scanner_extra scanner_extra_t;
@ -118,7 +120,7 @@ int svf_bison_init(parser_priv_t *, FILE *, int, int);
void svf_bison_deinit(parser_priv_t *);
void svf_endxr(parser_priv_t *, enum generic_irdr_coding, int);
void svf_frequency(chain_t *, double);
void svf_frequency(chain_t *, parser_priv_t *, double);
int svf_hxr(enum generic_irdr_coding, struct ths_params *);
int svf_runtest(chain_t *, parser_priv_t *, struct runtest *);
int svf_state(chain_t *, parser_priv_t *, struct path_states *, int);

@ -108,12 +108,12 @@ svf_statement
| FREQUENCY ';'
{
svf_frequency(chain, 0.0);
svf_frequency(chain, priv_data, 0.0);
}
| FREQUENCY NUMBER HZ ';'
{
svf_frequency(chain, $2);
svf_frequency(chain, priv_data, $2);
}
| HDR NUMBER ths_param_list ';'

Loading…
Cancel
Save