Files
bs_explorer/modules/svf/svf.h
François c77d86efd0 svf: initial SVF player + svf_play command
New modules/svf/ plays the single-device SVF subset over the bscan_*
primitives: SIR/SDR with masked TDO compare, RUNTEST (TCK/SEC), STATE
(RESET/IDLE), ENDIR/ENDDR (IDLE only), HIR/HDR/TIR/TDR (length 0), TRST,
FREQUENCY. Exposed as `svf_play <file>`. It warms up the FTDI link
first — the MPSSE's first data read after open returns stale FIFO
content, normally hidden because jtag_scan runs before anything.

Also adds the bscan_tap_reset prototype. Validated on the live IGLOO2
M2GL010T: a hand-written IDCODE-check SVF passes (masked compare) and a
deliberately wrong one is caught at the mismatching bit. A generic
program dispatch off the prog tag, multi-device chains and non-IDLE end
states are still TODO.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 14:36:41 +02:00

41 lines
1.3 KiB
C

#ifndef _SVF_H
#define _SVF_H
#include "jtag_core/jtag_core.h"
/*
* SVF player (single-device chain).
*
* Plays a standard subset of Serial Vector Format over the currently
* open probe, using the bscan_* TAP primitives. SVF is what Libero,
* Diamond/Radiant, Vivado, … export with the vendor programming
* algorithm already baked in, so one player programs many targets with
* no per-vendor code.
*
* Supported: SIR / SDR with TDI/TDO/MASK/SMASK and a masked TDO compare;
* RUNTEST (TCK/SCK counts and SEC delays); STATE (RESET / IDLE);
* ENDIR / ENDDR (IDLE only); HIR/HDR/TIR/TDR (length 0 only); TRST;
* FREQUENCY. SMASK is parsed but not applied.
*
* Not supported (single-device tool): non-zero header/trailer scans
* (multi-device chains) and non-IDLE stable end states — both rejected
* with a clear error.
*
* log() receives progress / error lines (is_error != 0 on failure).
* Returns 0 on success, < 0 on parse error or a TDO compare mismatch.
* stats may be NULL.
*/
typedef void (*svf_log_fn)(void *user, int is_error, const char *msg);
typedef struct {
long commands; /* commands executed */
long scans; /* SIR + SDR */
long compares; /* TDO compares performed */
} svf_stats;
int svf_play_file(jtag_core *jc, const char *path,
svf_log_fn log, void *user, svf_stats *stats);
#endif