jtag/fpga: prog method tag + RTCK link setting (phase C)
- fpga_target gains a prog method (proxy_spi/svf/none), set in the registry or inferred when omitted (proxy_bitstream -> proxy_spi; Microsemi/Lattice -> svf); shown by fpga_info/fpga_list and exposed via fpga_prog_method_name() for the future program dispatch - generalise RTCK as a neutral JTAG_RTCK, mirrored to PROBE_FTDI_JTAG_ENABLE_RTCK at open (FTDI-only) - reset abstraction deferred (no clean neutral form yet); the program dispatch command itself lands with the SVF player Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,29 @@ static fpga_family parse_family(const char *s)
|
||||
return FPGA_FAMILY_UNKNOWN;
|
||||
}
|
||||
|
||||
static fpga_prog_method parse_prog(const char *s)
|
||||
{
|
||||
if (!s) return FPGA_PROG_NONE;
|
||||
if (!strcmp(s, "proxy_spi")) return FPGA_PROG_PROXY_SPI;
|
||||
if (!strcmp(s, "svf")) return FPGA_PROG_SVF;
|
||||
if (!strcmp(s, "none")) return FPGA_PROG_NONE;
|
||||
fprintf(stderr, "fpga: unknown prog method '%s'\n", s);
|
||||
return FPGA_PROG_NONE;
|
||||
}
|
||||
|
||||
/* Guess the programming method when the entry doesn't state one. */
|
||||
static fpga_prog_method infer_prog(const fpga_target *t)
|
||||
{
|
||||
if (t->proxy_bitstream) return FPGA_PROG_PROXY_SPI;
|
||||
switch (t->family) {
|
||||
case FPGA_FAMILY_MICROSEMI_IGLOO2:
|
||||
case FPGA_FAMILY_MICROSEMI_SMARTFUSION2:
|
||||
case FPGA_FAMILY_LATTICE_MACHXO2:
|
||||
case FPGA_FAMILY_LATTICE_MACHXO3: return FPGA_PROG_SVF;
|
||||
default: return FPGA_PROG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int parse_caveats(const char *s)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
@@ -90,6 +113,7 @@ static void set_field(fpga_target *t, const char *key, const char *val)
|
||||
else if (!strcmp(key, "proxy_bitstream")) { free((void *)t->proxy_bitstream); t->proxy_bitstream = xstrdup(val); }
|
||||
else if (!strcmp(key, "caveats")) t->caveats = parse_caveats(val);
|
||||
else if (!strcmp(key, "max_tck_khz")) t->max_tck_khz = (int)strtol(val, NULL, 0);
|
||||
else if (!strcmp(key, "prog")) t->prog = parse_prog(val);
|
||||
else fprintf(stderr, "fpga: unknown key '%s'\n", key);
|
||||
}
|
||||
|
||||
@@ -102,7 +126,10 @@ static int commit_entry(const fpga_target *cur)
|
||||
return -1;
|
||||
}
|
||||
g_registry = tmp;
|
||||
g_registry[g_count++] = *cur;
|
||||
g_registry[g_count] = *cur;
|
||||
if (g_registry[g_count].prog == FPGA_PROG_NONE)
|
||||
g_registry[g_count].prog = infer_prog(&g_registry[g_count]);
|
||||
g_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -267,6 +294,16 @@ const char *fpga_family_name(fpga_family f)
|
||||
}
|
||||
}
|
||||
|
||||
const char *fpga_prog_method_name(fpga_prog_method m)
|
||||
{
|
||||
switch (m) {
|
||||
case FPGA_PROG_PROXY_SPI: return "proxy_spi";
|
||||
case FPGA_PROG_SVF: return "svf";
|
||||
case FPGA_PROG_NONE:
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
const char *fpga_registry_source(void)
|
||||
{
|
||||
ensure_loaded();
|
||||
|
||||
Reference in New Issue
Block a user