modules/fpga/ holds an fpga_target struct (IDCODE/mask, family, IR length and private opcodes, proxy bitstream path, quirks) and a compile-time registry. Initial entry: Xilinx Kintex UltraScale+ XCKU15P, populated from bsdl_files/xcku15p_ffve1517.bsd (IDCODE 0x04A56093, IR 6, USER1=0x02, CFG_IN=0x05, JPROGRAM=0x0B, JSTART=0x0C, JSHUTDOWN=0x0D, ISC_DISABLE=0x16, quirk CCLK_VIA_STARTUP). Two new script commands: - fpga_list: enumerate the registry - fpga_info: match each device on the JTAG chain against the registry and surface known quirks Adding another FPGA = one entry in fpga_registry[] + its .bsd in bsdl_files/. Proxy .bit will be wired in phase 2.5 (bscan_spi/). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
58 lines
1.9 KiB
C
58 lines
1.9 KiB
C
#ifndef _FPGA_H
|
|
#define _FPGA_H
|
|
|
|
/*
|
|
* Per-target FPGA descriptor and registry.
|
|
*
|
|
* Holds the facts that cannot be derived from the BSDL alone:
|
|
* - IDCODE pattern to match on the chain
|
|
* - private IR opcodes (USER1, CFG_IN, JPROGRAM, …) needed for
|
|
* configuration and for the BSCAN proxy bridge (Phase 2.5)
|
|
* - path to the BSCAN proxy bitstream
|
|
* - per-target quirks
|
|
*
|
|
* Adding an FPGA = one entry in fpga_registry[] + its .bsd in
|
|
* bsdl_files/ + (optionally) its proxy .bit in bscan_proxies/.
|
|
*/
|
|
|
|
#include "jtag_core/jtag_core.h"
|
|
|
|
typedef enum {
|
|
FPGA_FAMILY_UNKNOWN = 0,
|
|
FPGA_FAMILY_XILINX_7,
|
|
FPGA_FAMILY_XILINX_US,
|
|
FPGA_FAMILY_XILINX_USP,
|
|
} fpga_family;
|
|
|
|
/* Quirk flags */
|
|
#define FPGA_QUIRK_CCLK_VIA_STARTUP (1u << 0) /* CCLK not directly drivable in EXTEST */
|
|
|
|
typedef struct {
|
|
const char *name; /* human-readable part name */
|
|
unsigned long idcode; /* IDCODE pattern */
|
|
unsigned long idcode_mask; /* bits to ignore (typically 0x0FFFFFFF for Xilinx — version masked) */
|
|
fpga_family family;
|
|
const char *bsdl_filename; /* basename within bsdl_files/ */
|
|
int ir_length; /* IR width in bits */
|
|
|
|
/* Private IR opcodes (0 = N/A for this family).
|
|
* For Xilinx, these are read from the BSDL INSTRUCTION_OPCODE block. */
|
|
unsigned int ir_cfg_in;
|
|
unsigned int ir_user1;
|
|
unsigned int ir_jprogram;
|
|
unsigned int ir_jstart;
|
|
unsigned int ir_jshutdown;
|
|
unsigned int ir_isc_disable;
|
|
|
|
const char *proxy_bitstream; /* path under bscan_proxies/, NULL if not yet available */
|
|
unsigned int quirks;
|
|
} fpga_target;
|
|
|
|
/* Registry access */
|
|
int fpga_get_target_count(void);
|
|
const fpga_target * fpga_get_target_by_index(int index);
|
|
const fpga_target * fpga_lookup_by_idcode(unsigned long idcode);
|
|
const char * fpga_family_name(fpga_family f);
|
|
|
|
#endif
|