Files
bs_explorer/modules/probes/probes.h
François 4ee1c2b631 probes: add probe-config profiles loaded from probes.yaml
- new modules/probes/ parses probes.yaml (libyaml): a defaults: map
  applied on every jtag_open + named profiles: selected with
  `jtag_open <idx> <profile>` (jtag_profiles lists them); each value is
  pushed into the script envvar store the driver reads at open time
- ships a flashpro profile (ADBUS4 high-Z) that lets the IGLOO2 kit's
  embedded FlashPro (FT4232H, port 0) detect the chain
- CLAUDE.md: decision entry for probes.yaml + a design note on the
  probe / JTAG-link / device config strategy (driver-neutral link layer)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 11:22:19 +02:00

41 lines
1.6 KiB
C

#ifndef _PROBES_H
#define _PROBES_H
/*
* Probe configuration profiles, loaded at runtime from probes.yaml.
*
* The built-in config.script (and an optional CWD config.script) set the
* baseline probe variables. probes.yaml layers on top of that:
* - a `defaults:` map applied on every jtag_open (so opening without a
* profile restores a known baseline), then
* - a named `profiles:` map whose vars override the defaults for one
* probe (e.g. an embedded FlashPro that needs ADBUS4 high-Z).
*
* Each key/value is pushed into the script envvar store via the caller's
* callback — the same vars config.script sets and the driver reads at
* open time (jtagcore_getEnvVarValue). This keeps the parser decoupled
* from the script context.
*
* File lookup: $BS_PROBES, else "probes.yaml" relative to the current
* directory (same convention as fpga_registry.yaml). Absence is silent —
* profiles are optional.
*/
/* Callback used to set one envvar. `user` is opaque to this module. */
typedef void (*probe_set_fn)(void *user, const char *key, const char *value);
/* Apply the defaults: map. Returns the number of vars applied (0 if none
* or no file). */
int probe_apply_defaults(probe_set_fn set, void *user);
/* Apply the named profile's vars on top of the defaults. Returns the
* number of vars applied, or -1 if no such profile exists. */
int probe_apply_profile(const char *name, probe_set_fn set, void *user);
/* Listing / diagnostics. */
int probe_profile_count(void);
const char *probe_profile_name(int index);
const char *probe_config_source(void); /* path loaded, or NULL */
#endif