Standalone LGPL-2.1 parser for BSDL (IEEE 1149.1), shared by essim and bs_explorer. The parser is ported from the Viveris JTAG Core loader, decoupled from jtag_core, and extended with two extractions the original lacks: - PIN_MAP_STRING -> per-port physical package pin, scalar and vector; - TAP_SCAN_* -> TAP signal roles (TDI/TDO/TMS/TCK/TRST). Exposes a stable C ABI (bsdl_parse_file/buffer -> bsdl_t, bsdl_to_json) with a dependency-free JSON serializer and a bsdl2json CLI. CMake builds a versioned shared library with install/export rules for find_package(bsdl). Verified against m2gl010t, xcku040 and xcku15p (100% pin mapping, correct IDCODEs and TAP roles); api and parse regression tests pass, clean build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
1.0 KiB
C
27 lines
1.0 KiB
C
/*
|
|
* libbsdl - internal keyword lookup tables.
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
*
|
|
* These map BSDL tokens onto the public enums. They are the seed for the
|
|
* parser port from Viveris, and already extend it with the two attributes
|
|
* Viveris omits: LINKAGE ports and the TAP_SCAN_* roles.
|
|
*/
|
|
#ifndef LIBBSDL_BSDL_STRINGS_H
|
|
#define LIBBSDL_BSDL_STRINGS_H
|
|
|
|
typedef struct bsdl_kw {
|
|
const char* name; /* BSDL token, upper-cased before lookup. */
|
|
int code; /* corresponding bsdl_* enum value. */
|
|
} bsdl_kw_t;
|
|
|
|
extern const bsdl_kw_t bsdl_dir_kw[]; /* -> bsdl_dir_t */
|
|
extern const bsdl_kw_t bsdl_cell_kw[]; /* -> bsdl_cell_t */
|
|
extern const bsdl_kw_t bsdl_bittype_kw[]; /* -> bsdl_bittype_t */
|
|
extern const bsdl_kw_t bsdl_state_kw[]; /* -> bsdl_state_t */
|
|
extern const bsdl_kw_t bsdl_tap_kw[]; /* -> bsdl_tap_role_t */
|
|
|
|
/* Linear lookup; returns the first table entry's code (UNKNOWN/NONE) if absent. */
|
|
int bsdl_kw_lookup(const bsdl_kw_t* table, const char* name);
|
|
|
|
#endif /* LIBBSDL_BSDL_STRINGS_H */
|