diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 94e524c5..4cb3ad0a 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,120 @@ +2008-02-27 Jie Zhang + + * include/bus.h: Don't include chain.h. + * include/svf.h: Include chain.h. + (svf_run): Add a parameter to pass chain. + * include/cmd.h: Include chain.h. + (cmd_t): Add a parameter to pass chain for run. + (cmd_run, cmd_test_cable): Add a parameter to pass chain. + * include/bus_driver.h: Include chain.h. + (struct bus_driver): Add a parameter to pass chain for new_bus. + * include/bsdl.h: Include chain.h + (bsdl_read_file, bsdl_scan_files): Add a parameter to pass chain. + * include/jtag.h (chain): Don't declare. + (jtag_parse_file): Add a parameter to pass chain. + * src/bsdl/bsdl.c (bsdl_read_file): Add a parameter to pass chain. + Initialize parser_priv->jtag_ctrl.chain. + (bsdl_scan_files): Add a parameter to pass chain. + * src/bsdl/bsdl_sem.c (bsdl_set_instruction_length): Call cmd_run + with priv->jtag_ctrl.chain. + * src/bsdl/bsdl.h (struct jtag_ctrl): Add chain field. + * src/detect.c (detect_parts): Pass chain to bsdl_scan_files + and cmd_run. + * src/bus/bf548_ezkit.c (bf548_ezkit_bus_new): Add a parameter to + pass chain. + * src/bus/fjmem.c (fjmem_bus_new): Likewise. + * src/bus/ppc405ep.c (ppc405ep_bus_new): Likewise. + * src/bus/sh7727.c (sh7727_bus_new): Likewise. + * src/bus/prototype.c (prototype_bus_new): Likewise. + * src/bus/sa1110.c (sa1110_bus_new): Likewise. + * src/bus/ppc440gx_ebc8.c (ppc440gx_ebc8_bus_new): Likewise. + * src/bus/tx4925.c (tx4925_bus_new): Likewise. + * src/bus/sh7750r.c (sh7750r_bus_new): Likewise. + * src/bus/pxa2x0.c (pxa2x0_bus_new): Likewise. + (pxa27x_bus_new): Likewise. + * src/bus/bf533_stamp.c (bf533_stamp_bus_new): Likewise. + * src/bus/bf533_ezkit.c (bf533_ezkit_bus_new): Likewise. + * src/bus/bf537_stamp.c (bf537_stamp_bus_new): Likewise. + * src/bus/ixp425.c (ixp425_bus_new): Likewise. + * src/bus/h7202.c (h7202_bus_new): Likewise. + * src/bus/zefant-xs3.c (zefant_xs3_bus_new): Likewise. + * src/bus/bcm1250.c (bcm1250_bus_new): Likewise. + * src/bus/sharc21065l.c (sharc_21065L_bus_new): Likewise. + * src/bus/au1500.c (au1500_bus_new): Likewise. + * src/bus/lh7a400.c (lh7a400_bus_new): Likewise. + * src/bus/sh7751r.c (sh7751r_bus_new): Likewise. + * src/bus/mpc5200.c (mpc5200_bus_new): Likewise. + * src/bus/jopcyc.c (jopcyc_bus_new): Likewise. + * src/bus/slsup3.c (slsup3_bus_new): Likewise. + * src/bus/bf561_ezkit.c (bf561_ezkit_bus_new): Likewise. + * src/bus/s3c4510x.c (s3c4510_bus_new): Likewise. + * src/bus/ejtag.c (ejtag_bus_new): Likewise. + * src/bus/mpc824x.c (mpc824x_bus_new): Likewise. + (mpc824x_bus_write): Change chain to CHAIN. + * src/svf/svf.c (yyparse): Add a parameter to pass chain. And update + all call sites. + (svf_force_reset_state): Likewise. + (svf_goto_state): Likewise. + (svf_frequency): Likewise. + (svf_runtest): Likewise. + (svf_state): Likewise. + (svf_sxr): Likewise. + (svf_trst): Likewsie. + (svf_run): Likewise. + * src/svf/svf_bison.y (yyerror): Update declaration and call sites. + (chain): %parse-param. + * src/svf/svf.h: Include chain.h and update function declarations. + * src/cmd/endian.c (cmd_endian_run): Add a parameter to pass chain. + And update all call sites. + * src/cmd/frequency.c (cmd_frequency_run): Likewise. + * src/cmd/part.c (cmd_part_run): Likewise. + * src/cmd/salias.c (cmd_salias_run): Likewise. + * src/cmd/instruction.c (cmd_instruction_run): Likewise. + * src/cmd/quit.c (cmd_quit_run): Likewise. + * src/cmd/register.c (cmd_register_run): Likewise. + * src/cmd/debug.c (cmd_debug_run): Likewise. + * src/cmd/flashmem.c (cmd_flashmem_run): Likewise. + * src/cmd/svf.c (cmd_svf_run): Likewise. + * src/cmd/peekpoke.c (cmd_peek_run): Likewise. + (cmd_poke_run): Likewise. + * src/cmd/cmd.c (cmd_test_cable): Likewise. + (cmd_run): Likewise. + * src/cmd/dr.c (cmd_dr_run): Likewise. + * src/cmd/cable.c (cmd_cable_run): Likewise. + * src/cmd/shell.c (cmd_shell_run): Likewise. + * src/cmd/discovery.c (cmd_discovery_run): Likewise. + * src/cmd/detect.c (cmd_detect_run): Likewise. + * src/cmd/readmem.c (cmd_readmem_run): Likewise. + * src/cmd/signal.c (cmd_signal_run): Likewise. + * src/cmd/shift.c (cmd_shift_run): Likewise. + * src/cmd/initbus.c (cmd_initbus_run): Likewise. + * src/cmd/eraseflash.c (cmd_eraseflash_run): Likewise. + * src/cmd/bit.c (cmd_bit_run): Likewise. + * src/cmd/get.c (cmd_get_run): Likewise. + * src/cmd/test.c (cmd_test_run): Likewise. + * src/cmd/reset.c (cmd_reset_run): Likewise. + * src/cmd/include.c (cmd_include_or_script_run): Likewise. + (cmd_include_run): Likewise. + (cmd_script_run): Likewise. + * src/cmd/bsdl.c (cmd_bsdl_run): Likewise. + * src/cmd/scan.c (cmd_scan_run): Likewise. + * src/cmd/detectflash.c (cmd_detectflash_run): Likewise. + * src/cmd/help.c (cmd_help_run): Likewise. + * src/cmd/writemem.c (cmd_writemem_run): Likewise. + * src/cmd/bus.c (cmd_bus_run): Likewise. + * src/cmd/set.c (cmd_set_run): Likewise. + * src/cmd/print.c (cmd_print_run): Likewise. + * src/jtag.c (chain): Don't define. + (jtag_parse_line): Add a parameter to pass chain. + And update all call sites. + (jtag_readline_multiple_commands_support): Likewise. + (jtag_readline_loop): Likewise. + (jtag_parse_stream): Likewise. + (jtag_parse_file): Likewise. + (jtag_parse_rc): Likewise. + (cleanup): Likewise. + (main): Define a local chain. + 2008-02-26 Arnim Laeuger * src/tap/cable/ft2232.c (send_and_receive): loopback_off moved to ftdi.c/ftd2xx.c diff --git a/jtag/include/bsdl.h b/jtag/include/bsdl.h index 86ed407e..2e0193bc 100644 --- a/jtag/include/bsdl.h +++ b/jtag/include/bsdl.h @@ -25,10 +25,12 @@ #ifndef BSDL_H #define BSDL_H +#include "chain.h" + extern int bsdl_debug; -int bsdl_read_file(const char *, int, char *); +int bsdl_read_file(chain_t *, const char *, int, char *); void bsdl_set_path(const char *); -int bsdl_scan_files(const char *, int); +int bsdl_scan_files(chain_t *, const char *, int); #endif /* BSDL_H */ diff --git a/jtag/include/bus.h b/jtag/include/bus.h index b034ad39..304fc6a8 100644 --- a/jtag/include/bus.h +++ b/jtag/include/bus.h @@ -27,7 +27,6 @@ #define BUS_H #include -#include "chain.h" #include diff --git a/jtag/include/bus_driver.h b/jtag/include/bus_driver.h index 1dbb0508..55ff6e19 100644 --- a/jtag/include/bus_driver.h +++ b/jtag/include/bus_driver.h @@ -37,6 +37,8 @@ #include +#include "chain.h" + typedef struct { const char *description; uint32_t start; @@ -49,7 +51,7 @@ typedef struct bus bus_t; typedef struct bus_driver { const char *name; const char *description; - bus_t *(*new_bus)( char *cmd_params[] ); + bus_t *(*new_bus)( chain_t *chain, char *cmd_params[] ); void (*free_bus)( bus_t *bus ); void (*printinfo)( bus_t *bus ); void (*prepare)( bus_t *bus ); diff --git a/jtag/include/cmd.h b/jtag/include/cmd.h index 39ab240b..4629a763 100644 --- a/jtag/include/cmd.h +++ b/jtag/include/cmd.h @@ -34,18 +34,20 @@ #ifndef CMD_H #define CMD_H +#include "chain.h" + typedef struct { char *name; char *desc; void (*help)( void ); - int (*run)( char *params[] ); + int (*run)( chain_t *chain, char *params[] ); } cmd_t; extern const cmd_t *cmds[]; -int cmd_run( char *params[] ); +int cmd_run( chain_t *chain, char *params[] ); int cmd_params( char *params[] ); int cmd_get_number( char *s, unsigned int *i ); -int cmd_test_cable( void ); +int cmd_test_cable( chain_t *chain ); #endif /* CMD_H */ diff --git a/jtag/include/jtag.h b/jtag/include/jtag.h index 967f374f..ee2af1b9 100644 --- a/jtag/include/jtag.h +++ b/jtag/include/jtag.h @@ -34,12 +34,11 @@ #include "bus.h" #include "part.h" -extern chain_t *chain; extern bus_t *bus; extern int big_endian; extern int debug_mode; -int jtag_parse_file( const char *filename ); +int jtag_parse_file( chain_t *chain, const char *filename ); int detect_parts( chain_t *chain, char *db_path ); int detect_register_size( chain_t *chain ); diff --git a/jtag/include/svf.h b/jtag/include/svf.h index 56e99e06..5d91dd14 100644 --- a/jtag/include/svf.h +++ b/jtag/include/svf.h @@ -25,6 +25,8 @@ #ifndef SVF_H #define SVF_H -void svf_run(FILE *, int); +#include "chain.h" + +void svf_run(chain_t *chain, FILE *, int); #endif /* SVF_H */ diff --git a/jtag/src/bsdl/bsdl.c b/jtag/src/bsdl/bsdl.c index 56a80482..7cc4aa74 100644 --- a/jtag/src/bsdl/bsdl.c +++ b/jtag/src/bsdl/bsdl.c @@ -87,7 +87,7 @@ void bsdl_msg(int type, const char *format, ...) * > 0 : No errors, idcode checked and matched * ****************************************************************************/ -int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) +int bsdl_read_file(chain_t *chain, const char *BSDL_File_Name, int mode, const char *idcode) { FILE *BSDL_File; parser_priv_t *parser_priv; @@ -124,11 +124,16 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) fclose(BSDL_File); return -1; } + parser_priv->jtag_ctrl.chain = chain; parser_priv->jtag_ctrl.part = chain->parts->parts[chain->active_part]; - } else + } else { + parser_priv->jtag_ctrl.chain = NULL; parser_priv->jtag_ctrl.part = NULL; - } else + } + } else { + parser_priv->jtag_ctrl.chain = NULL; parser_priv->jtag_ctrl.part = NULL; + } parser_priv->jtag_ctrl.idcode = NULL; @@ -250,7 +255,7 @@ void bsdl_set_path(const char *pathlist) * > 0 : No errors, idcode checked and matched * ****************************************************************************/ -int bsdl_scan_files(const char *idcode, int mode) +int bsdl_scan_files(chain_t *chain, const char *idcode, int mode) { int idx = 0; int result = 0; @@ -282,14 +287,14 @@ int bsdl_scan_files(const char *idcode, int mode) if (mode >= 1) { /* now we know we can finally read the file */ /* do a test read first */ - result = bsdl_read_file(name, -1, idcode); + result = bsdl_read_file(chain, name, -1, idcode); if (result > 0) { /* read in BSDL file if IDCODE matched */ printf( _(" Filename: %s\n"), name ); - result = bsdl_read_file(name, 1, idcode); + result = bsdl_read_file(chain, name, 1, idcode); } } else - result = bsdl_read_file(name, mode, idcode); + result = bsdl_read_file(chain, name, mode, idcode); } } diff --git a/jtag/src/bsdl/bsdl.h b/jtag/src/bsdl/bsdl.h index 0327d47f..92487984 100644 --- a/jtag/src/bsdl/bsdl.h +++ b/jtag/src/bsdl/bsdl.h @@ -116,6 +116,7 @@ struct jtag_ctrl { int mode; int debug; char *idcode; /* IDCODE string */ + chain_t *chain; part_t *part; struct port_desc port_desc; struct cell_info cell_info; diff --git a/jtag/src/bsdl/bsdl_sem.c b/jtag/src/bsdl/bsdl_sem.c index eb960ce2..23ed211e 100644 --- a/jtag/src/bsdl/bsdl_sem.c +++ b/jtag/src/bsdl/bsdl_sem.c @@ -237,7 +237,7 @@ void bsdl_set_instruction_length(parser_priv_t *priv, int len) lenstring[5] = '\0'; if (priv->jtag_ctrl.mode >= 1) - cmd_run(cmd); + cmd_run(priv->jtag_ctrl.chain, cmd); else print_cmd(cmd); } @@ -375,7 +375,7 @@ void bsdl_prt_apply_port(parser_priv_t *priv) port_string[str_len-1] = '\0'; if (priv->jtag_ctrl.mode >= 1) - cmd_run(cmd); + cmd_run(priv->jtag_ctrl.chain, cmd); else print_cmd(cmd); } @@ -426,7 +426,7 @@ static void create_register(parser_priv_t *priv, char *reg_name, size_t len) snprintf(len_str, str_len, "%i", len); if (priv->jtag_ctrl.mode >= 1) - cmd_run(cmd); + cmd_run(priv->jtag_ctrl.chain, cmd); else print_cmd(cmd); } @@ -712,7 +712,7 @@ void bsdl_ci_apply_cell_info(parser_priv_t *priv, int bit_num) cmd[5] = NULL; if (priv->jtag_ctrl.mode >= 1) - cmd_run(cmd); + cmd_run(priv->jtag_ctrl.chain, cmd); else print_cmd(cmd); } @@ -932,7 +932,7 @@ void bsdl_ac_finalize(parser_priv_t *priv) NULL}; if (priv->jtag_ctrl.mode >= 1) - cmd_run(cmd); + cmd_run(priv->jtag_ctrl.chain, cmd); else print_cmd(cmd); } diff --git a/jtag/src/bus/au1500.c b/jtag/src/bus/au1500.c index 0c40ccb5..bc4d6b90 100644 --- a/jtag/src/bus/au1500.c +++ b/jtag/src/bus/au1500.c @@ -114,7 +114,7 @@ setup_data( bus_t *bus, uint32_t d) part_set_signal( p, RD[i], 1, ( d>>i ) & 1 ); } -static bus_t *au1500_bus_new( char *cmd_params[] ) +static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/bcm1250.c b/jtag/src/bus/bcm1250.c index d7cd5296..f22576a1 100644 --- a/jtag/src/bus/bcm1250.c +++ b/jtag/src/bus/bcm1250.c @@ -268,7 +268,7 @@ bcm1250_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bcm1250_bus_new( char *cmd_params[] ); +static bus_t *bcm1250_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bcm1250_bus = { "bcm1250", @@ -287,7 +287,7 @@ const bus_driver_t bcm1250_bus = { }; static bus_t * -bcm1250_bus_new( char *cmd_params[] ) +bcm1250_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/bf533_ezkit.c b/jtag/src/bus/bf533_ezkit.c index fc98fce7..aa0f0b14 100644 --- a/jtag/src/bus/bf533_ezkit.c +++ b/jtag/src/bus/bf533_ezkit.c @@ -252,7 +252,7 @@ bf533_ezkit_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bf533_ezkit_bus_new( char *cmd_params[] ); +static bus_t *bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bf533_ezkit_bus = { "bf533_ezkit", @@ -270,7 +270,7 @@ const bus_driver_t bf533_ezkit_bus = { }; static bus_t * -bf533_ezkit_bus_new( char *cmd_params[] ) +bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/bf533_stamp.c b/jtag/src/bus/bf533_stamp.c index bb866e0b..6b5de3e0 100644 --- a/jtag/src/bus/bf533_stamp.c +++ b/jtag/src/bus/bf533_stamp.c @@ -252,7 +252,7 @@ bf533_stamp_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bf533_stamp_bus_new( char *cmd_params[] ); +static bus_t *bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bf533_stamp_bus = { "bf533_stamp", @@ -270,7 +270,7 @@ const bus_driver_t bf533_stamp_bus = { }; static bus_t * -bf533_stamp_bus_new( char *cmd_params[] ) +bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/bf537_stamp.c b/jtag/src/bus/bf537_stamp.c index 115252bd..7123683b 100644 --- a/jtag/src/bus/bf537_stamp.c +++ b/jtag/src/bus/bf537_stamp.c @@ -263,7 +263,7 @@ bf537_stamp_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bf537_stamp_bus_new( char *cmd_params[] ); +static bus_t *bf537_stamp_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bf537_stamp_bus = { "bf537_stamp", @@ -297,7 +297,7 @@ const bus_driver_t bf537_ezkit_bus = { static bus_t * -bf537_stamp_bus_new( char *cmd_params[] ) +bf537_stamp_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/bf548_ezkit.c b/jtag/src/bus/bf548_ezkit.c index 892d607c..1d95c07d 100644 --- a/jtag/src/bus/bf548_ezkit.c +++ b/jtag/src/bus/bf548_ezkit.c @@ -237,7 +237,7 @@ bf548_ezkit_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bf548_ezkit_bus_new( char *cmd_params[] ); +static bus_t *bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bf548_ezkit_bus = { "bf548_ezkit", @@ -256,7 +256,7 @@ const bus_driver_t bf548_ezkit_bus = { static bus_t * -bf548_ezkit_bus_new( char *cmd_params[] ) +bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/bf561_ezkit.c b/jtag/src/bus/bf561_ezkit.c index 9c4e5263..4e613255 100644 --- a/jtag/src/bus/bf561_ezkit.c +++ b/jtag/src/bus/bf561_ezkit.c @@ -260,7 +260,7 @@ bf561_ezkit_bus_free( bus_t *bus ) free( bus ); } -static bus_t *bf561_ezkit_bus_new( char *cmd_params[] ); +static bus_t *bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t bf561_ezkit_bus = { "bf561_ezkit", @@ -278,7 +278,7 @@ const bus_driver_t bf561_ezkit_bus = { }; static bus_t * -bf561_ezkit_bus_new( char *cmd_params[] ) +bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/ejtag.c b/jtag/src/bus/ejtag.c index 5f3df2a0..93e79649 100644 --- a/jtag/src/bus/ejtag.c +++ b/jtag/src/bus/ejtag.c @@ -449,7 +449,7 @@ ejtag_bus_free( bus_t *bus ) free( bus ); } -static bus_t *ejtag_bus_new( char *cmd_params[] ); +static bus_t *ejtag_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t ejtag_bus = { "ejtag", @@ -467,7 +467,7 @@ const bus_driver_t ejtag_bus = { }; static bus_t * -ejtag_bus_new( char *cmd_params[] ) +ejtag_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; diff --git a/jtag/src/bus/fjmem.c b/jtag/src/bus/fjmem.c index cefe9068..0673c9d4 100644 --- a/jtag/src/bus/fjmem.c +++ b/jtag/src/bus/fjmem.c @@ -643,7 +643,7 @@ fjmem_query_blocks( chain_t *chain, part_t *part, bus_t *bus ) } static bus_t * -fjmem_bus_new( char *params[] ) +fjmem_bus_new( chain_t *chain, char *params[] ) { bus_t *bus = NULL; int failed = 0; diff --git a/jtag/src/bus/h7202.c b/jtag/src/bus/h7202.c index 355d85e9..2aa578fb 100644 --- a/jtag/src/bus/h7202.c +++ b/jtag/src/bus/h7202.c @@ -236,7 +236,7 @@ h7202_bus_free( bus_t *bus ) free( bus ); } -static bus_t *h7202_bus_new( char *cmd_params[] ); +static bus_t *h7202_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t h7202_bus = { "h7202", @@ -254,7 +254,7 @@ const bus_driver_t h7202_bus = { }; static bus_t * -h7202_bus_new( char *cmd_params[] ) +h7202_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index 4f750d8f..19f4bf35 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -231,7 +231,7 @@ ixp425_bus_free( bus_t *bus ) free( bus ); } -static bus_t *ixp425_bus_new( char *cmd_params[] ); +static bus_t *ixp425_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t ixp425_bus = { "ixp425", @@ -250,7 +250,7 @@ const bus_driver_t ixp425_bus = { }; static bus_t * -ixp425_bus_new( char *cmd_params[] ) +ixp425_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/jopcyc.c b/jtag/src/bus/jopcyc.c index 2a24acda..dc2c9f10 100644 --- a/jtag/src/bus/jopcyc.c +++ b/jtag/src/bus/jopcyc.c @@ -500,7 +500,7 @@ attach_sig( bus_t *bus, signal_t **sig, char *id ) } static bus_t * -jopcyc_bus_new( char *cmd_params[] ) +jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; int failed = 0; diff --git a/jtag/src/bus/lh7a400.c b/jtag/src/bus/lh7a400.c index e04c4ba1..b1d8c567 100644 --- a/jtag/src/bus/lh7a400.c +++ b/jtag/src/bus/lh7a400.c @@ -257,7 +257,7 @@ lh7a400_bus_free( bus_t *bus ) free( bus ); } -static bus_t *lh7a400_bus_new( char *cmd_params[] ); +static bus_t *lh7a400_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t lh7a400_bus = { "lh7a400", @@ -276,7 +276,7 @@ const bus_driver_t lh7a400_bus = { }; static bus_t * -lh7a400_bus_new( char *cmd_params[] ) +lh7a400_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/mpc5200.c b/jtag/src/bus/mpc5200.c index 774bc907..8b97fce7 100644 --- a/jtag/src/bus/mpc5200.c +++ b/jtag/src/bus/mpc5200.c @@ -243,7 +243,7 @@ mpc5200_bus_free( bus_t *bus ) } static bus_t * -mpc5200_bus_new( char *cmd_params[] ) +mpc5200_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/mpc824x.c b/jtag/src/bus/mpc824x.c index f4abe2cd..6cb04583 100644 --- a/jtag/src/bus/mpc824x.c +++ b/jtag/src/bus/mpc824x.c @@ -288,13 +288,13 @@ mpc824x_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) setup_data( bus, adr, data ); - chain_shift_data_registers( chain, 0 ); + chain_shift_data_registers( CHAIN, 0 ); part_set_signal( p, nWE, 1, 0 ); - chain_shift_data_registers( chain, 0 ); + chain_shift_data_registers( CHAIN, 0 ); part_set_signal( p, nWE, 1, 1 ); part_set_signal( p, nRCS0, 1, 1 ); - chain_shift_data_registers( chain, 0 ); + chain_shift_data_registers( CHAIN, 0 ); @@ -357,7 +357,7 @@ mpc824x_bus_free( bus_t *bus ) } static bus_t * -mpc824x_bus_new( char *cmd_params[] ) +mpc824x_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/ppc405ep.c b/jtag/src/bus/ppc405ep.c index 52d2d11e..92fd17c1 100644 --- a/jtag/src/bus/ppc405ep.c +++ b/jtag/src/bus/ppc405ep.c @@ -216,7 +216,7 @@ ppc405ep_bus_free( bus_t *bus ) free( bus ); } -static bus_t *ppc405ep_bus_new( char *cmd_params[] ); +static bus_t *ppc405ep_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t ppc405ep_bus = { "ppc405ep", @@ -234,7 +234,7 @@ const bus_driver_t ppc405ep_bus = { }; static bus_t * -ppc405ep_bus_new( char *cmd_params[] ) +ppc405ep_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/ppc440gx_ebc8.c b/jtag/src/bus/ppc440gx_ebc8.c index 7b6c65e1..953aaa21 100644 --- a/jtag/src/bus/ppc440gx_ebc8.c +++ b/jtag/src/bus/ppc440gx_ebc8.c @@ -214,7 +214,7 @@ ppc440gx_ebc8_bus_free( bus_t *bus ) free( bus ); } -static bus_t *ppc440gx_ebc8_bus_new( char *cmd_params[] ); +static bus_t *ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t ppc440gx_ebc8_bus = { "ppc440gx_ebc8", @@ -233,7 +233,7 @@ const bus_driver_t ppc440gx_ebc8_bus = { }; static bus_t * -ppc440gx_ebc8_bus_new( char *cmd_params[] ) +ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/prototype.c b/jtag/src/bus/prototype.c index c21a5966..cd391f16 100644 --- a/jtag/src/bus/prototype.c +++ b/jtag/src/bus/prototype.c @@ -253,7 +253,7 @@ prototype_bus_signal_parse( char *str, char *fmt, int *inst ) } static bus_t * -prototype_bus_new( char *cmd_params[] ) +prototype_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; signal_t *sig; diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index f07f4643..95d50e76 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -607,8 +607,8 @@ pxa2xx_bus_free( bus_t *bus ) free( bus ); } -static bus_t *pxa2x0_bus_new( char *cmd_params[] ); -static bus_t *pxa27x_bus_new( char *cmd_params[] ); +static bus_t *pxa2x0_bus_new( chain_t *chain, char *cmd_params[] ); +static bus_t *pxa27x_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t pxa2x0_bus = { "pxa2x0", @@ -754,7 +754,7 @@ pxa2xx_bus_new_common(bus_t * bus) } static bus_t * -pxa2x0_bus_new( char *cmd_params[] ) +pxa2x0_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; int failed = 0; @@ -791,7 +791,7 @@ pxa2x0_bus_new( char *cmd_params[] ) } static bus_t * -pxa27x_bus_new( char *cmd_params[] ) +pxa27x_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; int failed = 0; diff --git a/jtag/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index a365a8ba..27a0ab61 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -325,7 +325,7 @@ s3c4510_bus_free( bus_t *bus ) free( bus ); } -static bus_t *s3c4510_bus_new( char *cmd_params[] ); +static bus_t *s3c4510_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t s3c4510_bus = { "s3c4510x", @@ -344,7 +344,7 @@ const bus_driver_t s3c4510_bus = { }; static bus_t * -s3c4510_bus_new( char *cmd_params[] ) +s3c4510_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index dc00ddc8..0f6f79e3 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -245,7 +245,7 @@ sa1110_bus_free( bus_t *bus ) free( bus ); } -static bus_t *sa1110_bus_new( char *cmd_params[] ); +static bus_t *sa1110_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t sa1110_bus = { "sa1110", @@ -264,7 +264,7 @@ const bus_driver_t sa1110_bus = { }; static bus_t * -sa1110_bus_new( char *cmd_params[] ) +sa1110_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index 6fd86630..7320dc1e 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -277,7 +277,7 @@ sh7727_bus_free( bus_t *bus ) free( bus ); } -static bus_t *sh7727_bus_new( char *cmd_params[] ); +static bus_t *sh7727_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t sh7727_bus = { "sh7727", @@ -296,7 +296,7 @@ const bus_driver_t sh7727_bus = { }; static bus_t * -sh7727_bus_new( char *cmd_params[] ) +sh7727_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/sh7750r.c b/jtag/src/bus/sh7750r.c index 217e801c..d87f2b12 100644 --- a/jtag/src/bus/sh7750r.c +++ b/jtag/src/bus/sh7750r.c @@ -259,7 +259,7 @@ sh7750r_bus_free( bus_t *bus ) free( bus ); } -static bus_t *sh7750r_bus_new( char *cmd_params[] ); +static bus_t *sh7750r_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t sh7750r_bus = { "sh7750r", @@ -278,7 +278,7 @@ const bus_driver_t sh7750r_bus = { }; static bus_t * -sh7750r_bus_new( char *cmd_params[] ) +sh7750r_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/sh7751r.c b/jtag/src/bus/sh7751r.c index 284e146a..6cb46e32 100644 --- a/jtag/src/bus/sh7751r.c +++ b/jtag/src/bus/sh7751r.c @@ -252,7 +252,7 @@ sh7751r_bus_free( bus_t *bus ) free( bus ); } -static bus_t *sh7751r_bus_new( char *cmd_params[] ); +static bus_t *sh7751r_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t sh7751r_bus = { "sh7751r", @@ -271,7 +271,7 @@ const bus_driver_t sh7751r_bus = { }; static bus_t * -sh7751r_bus_new( char *cmd_params[] ) +sh7751r_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/sharc21065l.c b/jtag/src/bus/sharc21065l.c index 022dcae3..65dc4d5c 100644 --- a/jtag/src/bus/sharc21065l.c +++ b/jtag/src/bus/sharc21065l.c @@ -258,7 +258,7 @@ static void sharc_21065L_bus_free( bus_t *bus ) free( bus ); } -static bus_t *sharc_21065L_bus_new( char *cmd_params[] ); +static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t sharc_21065L_bus = { "SHARC_21065L", @@ -276,7 +276,7 @@ const bus_driver_t sharc_21065L_bus = { }; -static bus_t *sharc_21065L_bus_new( char *cmd_params[] ) +static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/slsup3.c b/jtag/src/bus/slsup3.c index b019b317..cd3c0684 100644 --- a/jtag/src/bus/slsup3.c +++ b/jtag/src/bus/slsup3.c @@ -356,7 +356,7 @@ slsup3_bus_free( bus_t *bus ) } static bus_t * -slsup3_bus_new( char *cmd_params[] ) +slsup3_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[10]; diff --git a/jtag/src/bus/tx4925.c b/jtag/src/bus/tx4925.c index 5a4cfdc6..73b8ec72 100644 --- a/jtag/src/bus/tx4925.c +++ b/jtag/src/bus/tx4925.c @@ -249,7 +249,7 @@ tx4925_bus_free( bus_t *bus ) free( bus ); } -static bus_t *tx4925_bus_new( char *cmd_params[] ); +static bus_t *tx4925_bus_new( chain_t *chain, char *cmd_params[] ); const bus_driver_t tx4925_bus = { "tx4925", @@ -269,7 +269,7 @@ const bus_driver_t tx4925_bus = { static bus_t * -tx4925_bus_new( char *cmd_params[] ) +tx4925_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; char buff[15]; diff --git a/jtag/src/bus/zefant-xs3.c b/jtag/src/bus/zefant-xs3.c index d5b6e6f4..2f94ab6a 100644 --- a/jtag/src/bus/zefant-xs3.c +++ b/jtag/src/bus/zefant-xs3.c @@ -723,7 +723,7 @@ attach_sig( bus_t *bus, signal_t **sig, char *id ) } static bus_t * -zefant_xs3_bus_new( char *cmd_params[] ) +zefant_xs3_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; int failed = 0; diff --git a/jtag/src/cmd/bit.c b/jtag/src/cmd/bit.c index 6bcd4a77..10dd48ac 100644 --- a/jtag/src/cmd/bit.c +++ b/jtag/src/cmd/bit.c @@ -44,7 +44,7 @@ cmd_bit_print_params( char *params[], unsigned int parameters, char *command ) } static int -cmd_bit_run( char *params[] ) +cmd_bit_run( chain_t *chain, char *params[] ) { part_t *part; data_register *bsr; @@ -62,7 +62,7 @@ cmd_bit_run( char *params[] ) return -1; } - if (!cmd_test_cable()) { + if (!cmd_test_cable( chain )) { printf( _("%s: cable test failed for command '%s'\n"), "bit", command); return 1; } diff --git a/jtag/src/cmd/bsdl.c b/jtag/src/cmd/bsdl.c index 6349d906..32bcef31 100644 --- a/jtag/src/cmd/bsdl.c +++ b/jtag/src/cmd/bsdl.c @@ -32,7 +32,7 @@ #include static int -cmd_bsdl_run( char *params[] ) +cmd_bsdl_run( chain_t *chain, char *params[] ) { int num_params, result = -1; @@ -44,9 +44,9 @@ cmd_bsdl_run( char *params[] ) debug_save = bsdl_debug; bsdl_debug = 1; if (num_params == 3) { - result = bsdl_read_file(params[2], -1, NULL) >= 0 ? 1 : -1; + result = bsdl_read_file(chain, params[2], -1, NULL) >= 0 ? 1 : -1; } else if (num_params == 2) { - bsdl_scan_files(NULL, -1); + bsdl_scan_files(chain, NULL, -1); result = 1; } bsdl_debug = debug_save; @@ -54,9 +54,9 @@ cmd_bsdl_run( char *params[] ) if (strcmp(params[1], "dump") == 0) { if (num_params == 3) { - result = bsdl_read_file(params[2], 0, NULL) >= 0 ? 1 : -1; + result = bsdl_read_file(chain, params[2], 0, NULL) >= 0 ? 1 : -1; } else if (num_params == 2) { - bsdl_scan_files(NULL, 0); + bsdl_scan_files(chain, NULL, 0); result = 1; } } diff --git a/jtag/src/cmd/bus.c b/jtag/src/cmd/bus.c index b4cd350c..eefe6ecb 100644 --- a/jtag/src/cmd/bus.c +++ b/jtag/src/cmd/bus.c @@ -32,14 +32,14 @@ #include "cmd.h" static int -cmd_bus_run( char *params[] ) +cmd_bus_run( chain_t *chain, char *params[] ) { unsigned int n; if (cmd_params( params ) != 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/cable.c b/jtag/src/cmd/cable.c index 6ccbc295..671b961d 100644 --- a/jtag/src/cmd/cable.c +++ b/jtag/src/cmd/cable.c @@ -38,7 +38,7 @@ #include "cmd.h" static int -cmd_cable_run( char *params[] ) +cmd_cable_run( chain_t *chain, char *params[] ) { cable_t *cable; int i; diff --git a/jtag/src/cmd/cmd.c b/jtag/src/cmd/cmd.c index 983adf92..9aa32fa6 100644 --- a/jtag/src/cmd/cmd.c +++ b/jtag/src/cmd/cmd.c @@ -117,7 +117,7 @@ const cmd_t *cmds[] = { }; int -cmd_test_cable( void ) +cmd_test_cable( chain_t *chain ) { if (chain->cable) return 1; @@ -129,7 +129,7 @@ cmd_test_cable( void ) /* Remainder copied from libbrux/cmd/cmd.c */ int -cmd_run( char *params[] ) +cmd_run( chain_t *chain, char *params[] ) { int i; @@ -138,7 +138,7 @@ cmd_run( char *params[] ) for (i = 0; cmds[i]; i++) if (strcasecmp( cmds[i]->name, params[0] ) == 0) { - int r = cmds[i]->run( params ); + int r = cmds[i]->run( chain, params ); if (r < 0) printf( _("%s: syntax error!\n"), params[0] ); return r; diff --git a/jtag/src/cmd/debug.c b/jtag/src/cmd/debug.c index ad236005..662c96fe 100644 --- a/jtag/src/cmd/debug.c +++ b/jtag/src/cmd/debug.c @@ -35,7 +35,7 @@ #include "cmd.h" static int -cmd_debug_run( char *params[] ) +cmd_debug_run( chain_t *chain, char *params[] ) { unsigned int i; diff --git a/jtag/src/cmd/detect.c b/jtag/src/cmd/detect.c index af87470e..1e430e44 100644 --- a/jtag/src/cmd/detect.c +++ b/jtag/src/cmd/detect.c @@ -34,7 +34,7 @@ #include "cmd.h" static int -cmd_detect_run( char *params[] ) +cmd_detect_run( chain_t *chain, char *params[] ) { int i; bus_t * abus; @@ -42,7 +42,7 @@ cmd_detect_run( char *params[] ) if (cmd_params( params ) != 1) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; buses_free(); diff --git a/jtag/src/cmd/detectflash.c b/jtag/src/cmd/detectflash.c index f27415c5..417b32a1 100644 --- a/jtag/src/cmd/detectflash.c +++ b/jtag/src/cmd/detectflash.c @@ -30,7 +30,7 @@ #include static int -cmd_detectflash_run( char *params[] ) +cmd_detectflash_run( chain_t *chain, char *params[] ) { uint32_t adr; diff --git a/jtag/src/cmd/discovery.c b/jtag/src/cmd/discovery.c index b8882508..c4e5806f 100644 --- a/jtag/src/cmd/discovery.c +++ b/jtag/src/cmd/discovery.c @@ -31,12 +31,12 @@ #include "cmd.h" static int -cmd_discovery_run( char *params[] ) +cmd_discovery_run( chain_t *chain, char *params[] ) { if (cmd_params( params ) != 1) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; discovery( chain ); diff --git a/jtag/src/cmd/dr.c b/jtag/src/cmd/dr.c index 89a4b243..7423631c 100644 --- a/jtag/src/cmd/dr.c +++ b/jtag/src/cmd/dr.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_dr_run( char *params[] ) +cmd_dr_run( chain_t *chain, char *params[] ) { int dir = 1; tap_register *r; @@ -41,7 +41,7 @@ cmd_dr_run( char *params[] ) if (cmd_params( params ) < 1 || cmd_params( params ) > 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/endian.c b/jtag/src/cmd/endian.c index 7d739ffc..eac3acfc 100644 --- a/jtag/src/cmd/endian.c +++ b/jtag/src/cmd/endian.c @@ -32,7 +32,7 @@ #include "cmd.h" static int -cmd_endian_run( char *params[] ) +cmd_endian_run( chain_t *chain, char *params[] ) { if (cmd_params( params ) > 2) return -1; diff --git a/jtag/src/cmd/eraseflash.c b/jtag/src/cmd/eraseflash.c index 66a93cf5..2d4ad04b 100644 --- a/jtag/src/cmd/eraseflash.c +++ b/jtag/src/cmd/eraseflash.c @@ -34,14 +34,14 @@ #include "cmd.h" static int -cmd_eraseflash_run( char *params[] ) +cmd_eraseflash_run( chain_t *chain, char *params[] ) { uint32_t adr = 0; unsigned int number = 0; if (cmd_params( params ) != 3) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!bus) { printf( _("Error: Bus driver missing.\n") ); diff --git a/jtag/src/cmd/flashmem.c b/jtag/src/cmd/flashmem.c index d76957ea..311df528 100644 --- a/jtag/src/cmd/flashmem.c +++ b/jtag/src/cmd/flashmem.c @@ -34,7 +34,7 @@ #include "cmd.h" static int -cmd_flashmem_run( char *params[] ) +cmd_flashmem_run( chain_t *chain, char *params[] ) { int msbin; uint32_t adr = 0; diff --git a/jtag/src/cmd/frequency.c b/jtag/src/cmd/frequency.c index af235f4d..23e9d7ee 100644 --- a/jtag/src/cmd/frequency.c +++ b/jtag/src/cmd/frequency.c @@ -32,7 +32,7 @@ #include "cmd.h" static int -cmd_frequency_run( char *params[] ) +cmd_frequency_run( chain_t *chain, char *params[] ) { unsigned int freq; diff --git a/jtag/src/cmd/get.c b/jtag/src/cmd/get.c index bc71b7fc..f94701a0 100644 --- a/jtag/src/cmd/get.c +++ b/jtag/src/cmd/get.c @@ -34,7 +34,7 @@ #include "cmd.h" static int -cmd_get_run( char *params[] ) +cmd_get_run( chain_t *chain, char *params[] ) { int data; signal_t *s; @@ -45,7 +45,7 @@ cmd_get_run( char *params[] ) if (strcasecmp( params[1], "signal") != 0) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/help.c b/jtag/src/cmd/help.c index e114cea7..580cb367 100644 --- a/jtag/src/cmd/help.c +++ b/jtag/src/cmd/help.c @@ -30,7 +30,7 @@ #include static int -cmd_help_run( char *params[] ) +cmd_help_run( chain_t *chain, char *params[] ) { int i; diff --git a/jtag/src/cmd/include.c b/jtag/src/cmd/include.c index b18f556a..a84b3451 100644 --- a/jtag/src/cmd/include.c +++ b/jtag/src/cmd/include.c @@ -34,7 +34,7 @@ #include "bsdl.h" static int -cmd_include_or_script_run( int is_include, char *params[] ) +cmd_include_or_script_run( chain_t *chain, int is_include, char *params[] ) { int go = 0, i, j = 1; char *path; @@ -72,10 +72,10 @@ cmd_include_or_script_run( int is_include, char *params[] ) #ifdef ENABLE_BSDL /* perform a test read to check for BSDL syntax */ - if (bsdl_read_file( path, -1, NULL ) >= 0) + if (bsdl_read_file( chain, path, -1, NULL ) >= 0) { /* it seems to be a proper BSDL file, so re-read and execute */ - go = bsdl_read_file( path, 1, NULL ); + go = bsdl_read_file( chain, path, 1, NULL ); free( path ); return go >= 0 ? 1 : 0; @@ -87,7 +87,7 @@ cmd_include_or_script_run( int is_include, char *params[] ) }; for(i = 0; i < j ;i++) { - go = jtag_parse_file( path ); + go = jtag_parse_file( chain, path ); if (go < 0) { if (go != -99) @@ -113,9 +113,9 @@ cmd_include_or_script_help( char *cmd ) } static int -cmd_include_run( char *params[] ) +cmd_include_run( chain_t *chain, char *params[] ) { - return cmd_include_or_script_run( 1, params ); + return cmd_include_or_script_run( chain, 1, params ); } static void @@ -132,9 +132,9 @@ cmd_t cmd_include = { }; static int -cmd_script_run( char *params[] ) +cmd_script_run( chain_t *chain, char *params[] ) { - return cmd_include_or_script_run( 0, params ); + return cmd_include_or_script_run( chain, 0, params ); } static void diff --git a/jtag/src/cmd/initbus.c b/jtag/src/cmd/initbus.c index b9ce8205..32686831 100644 --- a/jtag/src/cmd/initbus.c +++ b/jtag/src/cmd/initbus.c @@ -32,14 +32,14 @@ #include "jtag.h" static int -cmd_initbus_run( char *params[] ) +cmd_initbus_run( chain_t *chain, char *params[] ) { int i; if (cmd_params( params ) < 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { @@ -54,7 +54,7 @@ cmd_initbus_run( char *params[] ) for (i = 0; bus_drivers[i] != NULL; i++) { if (strcasecmp( bus_drivers[i]->name, params[1] ) == 0) { - bus_t *bus = bus_drivers[i]->new_bus( params ); + bus_t *bus = bus_drivers[i]->new_bus( chain, params ); if (bus == NULL) { printf( _("bus initialization failed!\n") ); return 1; diff --git a/jtag/src/cmd/instruction.c b/jtag/src/cmd/instruction.c index 11f573d6..fbe09129 100644 --- a/jtag/src/cmd/instruction.c +++ b/jtag/src/cmd/instruction.c @@ -33,11 +33,11 @@ #include "cmd.h" static int -cmd_instruction_run( char *params[] ) +cmd_instruction_run( chain_t *chain, char *params[] ) { part_t *part; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/part.c b/jtag/src/cmd/part.c index 955fbc01..82f041a4 100644 --- a/jtag/src/cmd/part.c +++ b/jtag/src/cmd/part.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_part_run( char *params[] ) +cmd_part_run( chain_t *chain, char *params[] ) { unsigned int n; @@ -52,7 +52,7 @@ part_t *part; if (cmd_params( params ) != 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/peekpoke.c b/jtag/src/cmd/peekpoke.c index 72af28d5..6560e60b 100644 --- a/jtag/src/cmd/peekpoke.c +++ b/jtag/src/cmd/peekpoke.c @@ -32,7 +32,7 @@ #include "cmd.h" static int -cmd_peek_run( char *params[] ) +cmd_peek_run( chain_t *chain, char *params[] ) { uint32_t adr, val; int pars, j = 1; @@ -95,7 +95,7 @@ cmd_t cmd_peek = { }; static int -cmd_poke_run( char *params[] ) +cmd_poke_run( chain_t *chain, char *params[] ) { uint32_t adr, val; bus_area_t area; diff --git a/jtag/src/cmd/print.c b/jtag/src/cmd/print.c index 58d55004..ea1882f7 100644 --- a/jtag/src/cmd/print.c +++ b/jtag/src/cmd/print.c @@ -44,7 +44,7 @@ typedef char wchar_t; #include "cmd.h" static int -cmd_print_run( char *params[] ) +cmd_print_run( chain_t *chain, char *params[] ) { char format[128]; #if HAVE_SWPRINTF @@ -58,7 +58,7 @@ cmd_print_run( char *params[] ) if (cmd_params( params ) > 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/quit.c b/jtag/src/cmd/quit.c index aebb0bf4..ab462128 100644 --- a/jtag/src/cmd/quit.c +++ b/jtag/src/cmd/quit.c @@ -29,7 +29,7 @@ #include static int -cmd_quit_run( char *params[] ) +cmd_quit_run( chain_t *chain, char *params[] ) { if (params[1]) return -1; diff --git a/jtag/src/cmd/readmem.c b/jtag/src/cmd/readmem.c index 22398441..84df5951 100644 --- a/jtag/src/cmd/readmem.c +++ b/jtag/src/cmd/readmem.c @@ -32,7 +32,7 @@ #include "cmd.h" static int -cmd_readmem_run( char *params[] ) +cmd_readmem_run( chain_t *chain, char *params[] ) { uint32_t adr; uint32_t len; diff --git a/jtag/src/cmd/register.c b/jtag/src/cmd/register.c index 715ea570..780542a6 100644 --- a/jtag/src/cmd/register.c +++ b/jtag/src/cmd/register.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_register_run( char *params[] ) +cmd_register_run( chain_t *chain, char *params[] ) { part_t *part; unsigned int len; @@ -43,7 +43,7 @@ cmd_register_run( char *params[] ) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/reset.c b/jtag/src/cmd/reset.c index a54c0009..2add69b1 100644 --- a/jtag/src/cmd/reset.c +++ b/jtag/src/cmd/reset.c @@ -34,12 +34,12 @@ void jtag_reset( chain_t *chain ); static int -cmd_reset_run( char *params[] ) +cmd_reset_run( chain_t *chain, char *params[] ) { if (cmd_params( params ) > 1) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; jtag_reset( chain ); diff --git a/jtag/src/cmd/salias.c b/jtag/src/cmd/salias.c index 6250c384..89bc0ae6 100644 --- a/jtag/src/cmd/salias.c +++ b/jtag/src/cmd/salias.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_salias_run( char *params[] ) +cmd_salias_run( chain_t *chain, char *params[] ) { part_t *part; signal_t *s; @@ -42,7 +42,7 @@ cmd_salias_run( char *params[] ) if (cmd_params( params ) != 3) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/scan.c b/jtag/src/cmd/scan.c index 432c93d1..21f0d4e0 100644 --- a/jtag/src/cmd/scan.c +++ b/jtag/src/cmd/scan.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_scan_run( char *params[] ) +cmd_scan_run( chain_t *chain, char *params[] ) { part_t *part; data_register *bsr; @@ -43,7 +43,7 @@ cmd_scan_run( char *params[] ) if ((i = cmd_params( params )) < 1) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/set.c b/jtag/src/cmd/set.c index 9049a750..c7148d5b 100644 --- a/jtag/src/cmd/set.c +++ b/jtag/src/cmd/set.c @@ -34,7 +34,7 @@ #include "cmd.h" static int -cmd_set_run( char *params[] ) +cmd_set_run( chain_t *chain, char *params[] ) { int dir; unsigned int data = 0; @@ -46,7 +46,7 @@ cmd_set_run( char *params[] ) if (strcasecmp( params[1], "signal" ) != 0) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/shell.c b/jtag/src/cmd/shell.c index b7f7216e..bfdad132 100644 --- a/jtag/src/cmd/shell.c +++ b/jtag/src/cmd/shell.c @@ -37,7 +37,7 @@ #include "cmd.h" static int -cmd_shell_run( char *params[] ) +cmd_shell_run( chain_t *chain, char *params[] ) { int i, len, n = cmd_params(params); char *shell_cmd; diff --git a/jtag/src/cmd/shift.c b/jtag/src/cmd/shift.c index 3101c6e5..bc5824a7 100644 --- a/jtag/src/cmd/shift.c +++ b/jtag/src/cmd/shift.c @@ -33,12 +33,12 @@ #include "cmd.h" static int -cmd_shift_run( char *params[] ) +cmd_shift_run( chain_t *chain, char *params[] ) { if (cmd_params( params ) != 2) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (strcasecmp( params[1], "ir" ) == 0) { diff --git a/jtag/src/cmd/signal.c b/jtag/src/cmd/signal.c index c041f0cf..ce0fa5ea 100644 --- a/jtag/src/cmd/signal.c +++ b/jtag/src/cmd/signal.c @@ -33,7 +33,7 @@ #include "cmd.h" static int -cmd_signal_run( char *params[] ) +cmd_signal_run( chain_t *chain, char *params[] ) { part_t *part; signal_t *s; @@ -43,7 +43,7 @@ cmd_signal_run( char *params[] ) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/svf.c b/jtag/src/cmd/svf.c index 9527ef61..7a28b1b6 100644 --- a/jtag/src/cmd/svf.c +++ b/jtag/src/cmd/svf.c @@ -32,7 +32,7 @@ #include static int -cmd_svf_run( char *params[] ) +cmd_svf_run( chain_t *chain, char *params[] ) { FILE *SVF_FILE; int num_params, result = -1; @@ -43,11 +43,11 @@ cmd_svf_run( char *params[] ) if (num_params == 3) { if (strcasecmp(params[2], "stop") == 0) { - svf_run(SVF_FILE, 1); + svf_run(chain, SVF_FILE, 1); result = 1; } } else { - svf_run(SVF_FILE, 0); + svf_run(chain, SVF_FILE, 0); result = 1; } diff --git a/jtag/src/cmd/test.c b/jtag/src/cmd/test.c index e75f8b77..f466546f 100644 --- a/jtag/src/cmd/test.c +++ b/jtag/src/cmd/test.c @@ -35,7 +35,7 @@ #include "cmd.h" static int -cmd_test_run( char *params[] ) +cmd_test_run( chain_t *chain, char *params[] ) { int data; unsigned int i; @@ -47,7 +47,7 @@ cmd_test_run( char *params[] ) if (strcasecmp( params[1], "signal") != 0) return -1; - if (!cmd_test_cable()) + if (!cmd_test_cable( chain )) return 1; if (!chain->parts) { diff --git a/jtag/src/cmd/writemem.c b/jtag/src/cmd/writemem.c index e39761b1..01974218 100644 --- a/jtag/src/cmd/writemem.c +++ b/jtag/src/cmd/writemem.c @@ -30,7 +30,7 @@ #include "cmd.h" static int -cmd_writemem_run( char *params[] ) +cmd_writemem_run( chain_t *chain, char *params[] ) { uint32_t adr; uint32_t len; diff --git a/jtag/src/detect.c b/jtag/src/detect.c index 6b767b54..1284d780 100644 --- a/jtag/src/detect.c +++ b/jtag/src/detect.c @@ -277,7 +277,7 @@ detect_parts( chain_t *chain, char *db_path ) chain->active_part = ps->len - 1; #ifdef ENABLE_BSDL - if (bsdl_scan_files(register_get_string( did ), 1) <= 0) { + if (bsdl_scan_files(chain, register_get_string( did ), 1) <= 0) { #endif /* find JTAG declarations for a part with id */ @@ -364,7 +364,7 @@ detect_parts( chain_t *chain, char *db_path ) strcpy( part->manufacturer, manufacturer ); strcpy( part->part, partname ); strcpy( part->stepping, stepping ); - cmd_run( cmd ); + cmd_run( chain, cmd ); #ifdef ENABLE_BSDL } #endif diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 92f6bb9f..6678eb1f 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -55,7 +55,6 @@ ssize_t getline( char **lineptr, size_t *n, FILE *stream ); #endif -chain_t *chain = NULL; int debug_mode = 0; int big_endian = 0; int interactive = 0; @@ -154,7 +153,7 @@ jtag_save_history( void ) #endif static int -jtag_parse_line( char *line ) +jtag_parse_line( chain_t *chain, char *line ) { char *t; int l; @@ -190,14 +189,14 @@ jtag_parse_line( char *line ) t = get_token( NULL ); } - r = cmd_run( a ); + r = cmd_run( chain, a ); if(debug_mode & 1)printf("Return in jtag_parse_line r=%d\n",r); free( a ); return r; } -static int jtag_readline_multiple_commands_support(char * line) /* multiple commands should be separated with '::' */ +static int jtag_readline_multiple_commands_support(chain_t *chain, char * line) /* multiple commands should be separated with '::' */ { int r; char *nextcmd = line; @@ -216,7 +215,7 @@ static int jtag_readline_multiple_commands_support(char * line) /* multiple comm while (*line == ':') ++line; } - r = jtag_parse_line( line ); + r = jtag_parse_line( chain, line ); chain_flush( chain ); @@ -226,13 +225,13 @@ static int jtag_readline_multiple_commands_support(char * line) /* multiple comm } static void -jtag_readline_loop( const char *prompt ) +jtag_readline_loop( chain_t *chain, const char *prompt ) { #ifdef HAVE_LIBREADLINE char *line = NULL; /* Iterate */ - while (jtag_readline_multiple_commands_support( line )) { + while (jtag_readline_multiple_commands_support( chain, line )) { free( line ); /* Read a line from the terminal */ @@ -267,7 +266,7 @@ jtag_readline_loop( const char *prompt ) } static int -jtag_parse_stream( FILE *f ) +jtag_parse_stream( chain_t *chain, FILE *f ) { int go = 1; char *line = NULL; @@ -275,7 +274,7 @@ jtag_parse_stream( FILE *f ) while (go && (getline( &line, &n, f ) != -1)) if ((strlen(line) > 0) && (line[0] != '#')) - go = jtag_parse_line(line); + go = jtag_parse_line(chain, line); free(line); @@ -283,7 +282,7 @@ jtag_parse_stream( FILE *f ) } int -jtag_parse_file( const char *filename ) +jtag_parse_file( chain_t *chain, const char *filename ) { FILE *f; int go; @@ -292,7 +291,7 @@ jtag_parse_file( const char *filename ) if (!f) return -1; - go = jtag_parse_stream( f ); + go = jtag_parse_stream( chain, f ); fclose(f); if(debug_mode & 1)printf("File Closed gp=%d\n",go); @@ -300,7 +299,7 @@ jtag_parse_file( const char *filename ) } static int -jtag_parse_rc( void ) +jtag_parse_rc( chain_t *chain ) { char *home = getenv( "HOME" ); char *file; @@ -319,7 +318,7 @@ jtag_parse_rc( void ) strcat( file, "/" ); strcat( file, RCFILE ); - go = jtag_parse_file( file ); + go = jtag_parse_file( chain, file ); free( file ); @@ -327,7 +326,7 @@ jtag_parse_rc( void ) } static void -cleanup( void ) +cleanup( chain_t *chain ) { cfi_array_free( cfi_array ); cfi_array = NULL; @@ -350,6 +349,7 @@ main( int argc, char *const argv[] ) int help = 0; int version = 0; int quiet = 0; + chain_t *chain = NULL; if(geteuid()==0 && getuid()!=0) { @@ -470,8 +470,8 @@ main( int argc, char *const argv[] ) return -1; } - go = jtag_parse_file( argv[i] ); - cleanup(); + go = jtag_parse_file( chain, argv[i] ); + cleanup( chain ); if (go < 0) { printf( _("Unable to open file `%s'!\n"), argv[i] ); break; @@ -489,9 +489,9 @@ main( int argc, char *const argv[] ) return -1; } - jtag_parse_stream( stdin ); + jtag_parse_stream( chain, stdin ); - cleanup(); + cleanup( chain ); return 0; } @@ -523,7 +523,7 @@ main( int argc, char *const argv[] ) jtag_create_jtagdir(); /* Parse and execute the RC file */ - go = norc ? 1 : jtag_parse_rc(); + go = norc ? 1 : jtag_parse_rc( chain ); if (go) { @@ -533,7 +533,7 @@ main( int argc, char *const argv[] ) #endif /* main loop */ - jtag_readline_loop( "jtag> " ); + jtag_readline_loop( chain, "jtag> " ); #ifdef HAVE_READLINE_HISTORY /* Save history */ @@ -541,7 +541,7 @@ main( int argc, char *const argv[] ) #endif } - cleanup(); + cleanup( chain ); return 0; } diff --git a/jtag/src/svf/svf.c b/jtag/src/svf/svf.c index f36bf85f..8d8dd84d 100644 --- a/jtag/src/svf/svf.c +++ b/jtag/src/svf/svf.c @@ -51,7 +51,7 @@ #include "svf.h" #include "svf_bison.h" -int yyparse(void); +int yyparse(chain_t *chain); struct sxr { @@ -93,7 +93,7 @@ static int issued_runtest_maxtime; * Puts TAP controller into reset state by clocking 5 times with TMS = 1. */ static void -svf_force_reset_state(void) +svf_force_reset_state( chain_t *chain ) { chain_clock(chain, 1, 0, 5); tap_state_reset(chain); @@ -113,7 +113,7 @@ svf_force_reset_state(void) * state : new TAP controller state */ static void -svf_goto_state(int new_state) +svf_goto_state( chain_t *chain, int new_state) { int current_state; @@ -226,12 +226,12 @@ svf_goto_state(int new_state) break; default: - svf_force_reset_state(); + svf_force_reset_state(chain); break; } /* continue state changes */ - svf_goto_state(new_state); + svf_goto_state(chain, new_state); } @@ -582,7 +582,7 @@ svf_endxr(enum generic_irdr_coding ir_dr, int state) /* *************************************************************************** - * svf_frequency(freq) + * svf_frequency(chain, freq) * * Implements the FREQUENCY command. * @@ -590,7 +590,7 @@ svf_endxr(enum generic_irdr_coding ir_dr, int state) * freq : frequency in HZ * ***************************************************************************/ void -svf_frequency(double freq) +svf_frequency(chain_t *chain, double freq) { cable_set_frequency(chain->cable, freq); } @@ -643,7 +643,7 @@ static void sigalrm_handler(int signal) * 0 : error occured * ***************************************************************************/ int -svf_runtest(struct runtest *params) +svf_runtest(chain_t *chain, struct runtest *params) { uint32_t run_count, frequency; @@ -685,7 +685,7 @@ svf_runtest(struct runtest *params) } assert(run_count > 0); - svf_goto_state(runtest_run_state); + svf_goto_state(chain, runtest_run_state); /* set up the timer for max_time */ if (params->max_time > 0.0) { @@ -714,7 +714,7 @@ svf_runtest(struct runtest *params) else chain_clock(chain, 0, 0, run_count); - svf_goto_state(runtest_end_state); + svf_goto_state(chain, runtest_end_state); /* stop the timer */ if (params->max_time > 0.0) { @@ -748,17 +748,17 @@ svf_runtest(struct runtest *params) * 0 : error occured * ***************************************************************************/ int -svf_state(struct path_states *path_states, int stable_state) +svf_state(chain_t *chain, struct path_states *path_states, int stable_state) { int i; svf_state_executed = 1; for (i = 0; i < path_states->num_states; i++) - svf_goto_state(svf_map_state(path_states->states[i])); + svf_goto_state(chain, svf_map_state(path_states->states[i])); if (stable_state) - svf_goto_state(svf_map_state(stable_state)); + svf_goto_state(chain, svf_map_state(stable_state)); return(1); } @@ -778,7 +778,7 @@ svf_state(struct path_states *path_states, int stable_state) * 0 : error occured * ***************************************************************************/ int -svf_sxr(enum generic_irdr_coding ir_dr, struct ths_params *params, YYLTYPE *loc) +svf_sxr(chain_t *chain, enum generic_irdr_coding ir_dr, struct ths_params *params, YYLTYPE *loc) { struct sxr *sxr_params; int len, result = 1; @@ -883,9 +883,9 @@ svf_sxr(enum generic_irdr_coding ir_dr, struct ths_params *params, YYLTYPE *loc) /* shift selected instruction/register */ switch (ir_dr) { case generic_ir: - svf_goto_state(Shift_IR); + svf_goto_state(chain, Shift_IR); chain_shift_instructions_mode(chain, 0, EXITMODE_EXIT1); - svf_goto_state(endir); + svf_goto_state(chain, endir); if (sxr_params->params.tdo) if (!issued_sir_tdo) { @@ -896,12 +896,12 @@ svf_sxr(enum generic_irdr_coding ir_dr, struct ths_params *params, YYLTYPE *loc) break; case generic_dr: - svf_goto_state(Shift_DR); + svf_goto_state(chain, Shift_DR); chain_shift_data_registers_mode(chain, sxr_params->params.tdo ? 1 : 0, 0, EXITMODE_EXIT1); - svf_goto_state(enddr); + svf_goto_state(chain, enddr); if (sxr_params->params.tdo) result = svf_compare_tdo(sxr_params->params.tdo, sxr_params->params.mask, dr->out, loc); @@ -930,7 +930,7 @@ svf_sxr(enum generic_irdr_coding ir_dr, struct ths_params *params, YYLTYPE *loc) * 0 : error occured * ***************************************************************************/ int -svf_trst(int trst_mode) +svf_trst(chain_t *chain, int trst_mode) { int trst_cable = -1; char *unimplemented_mode; @@ -1009,7 +1009,7 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params) /* *************************************************************************** - * svf_run(SVF_FILE, stop_on_mismatch) + * svf_run(chain, SVF_FILE, stop_on_mismatch) * * Main entry point for the 'svf' command. Calls the svf parser. * @@ -1027,7 +1027,7 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params) * 0 : error occured * ***************************************************************************/ void -svf_run(FILE *SVF_FILE, int stop_on_mismatch) +svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch) { const struct sxr sxr_default = { {0.0, NULL, NULL, NULL, NULL}, 1, 1}; @@ -1053,7 +1053,7 @@ svf_run(FILE *SVF_FILE, int stop_on_mismatch) "32", NULL}; - if (cmd_run(register_cmd) < 1) + if (cmd_run(chain, register_cmd) < 1) return; if (!(dr = part_find_data_register(part, "SDR"))) { @@ -1079,7 +1079,7 @@ svf_run(FILE *SVF_FILE, int stop_on_mismatch) instruction_string[len] = '\0'; instruction_cmd[2] = instruction_string; - result = cmd_run(instruction_cmd); + result = cmd_run(chain,instruction_cmd); free(instruction_string); @@ -1115,7 +1115,7 @@ svf_run(FILE *SVF_FILE, int stop_on_mismatch) part_set_instruction(part, "SIR"); yyin = SVF_FILE; - yyparse(); + yyparse(chain); /* clean up */ /* SIR */ diff --git a/jtag/src/svf/svf.h b/jtag/src/svf/svf.h index 1538079b..d31c9cbb 100644 --- a/jtag/src/svf/svf.h +++ b/jtag/src/svf/svf.h @@ -25,6 +25,7 @@ #include +#include "chain.h" #define MAX_PATH_STATES 64 @@ -68,10 +69,10 @@ struct runtest { struct YYLTYPE; void svf_endxr(enum generic_irdr_coding, int); -void svf_frequency(double); +void svf_frequency(chain_t *, double); int svf_hxr(enum generic_irdr_coding, struct ths_params *); -int svf_runtest(struct runtest *); -int svf_state(struct path_states *, int); -int svf_sxr(enum generic_irdr_coding, struct ths_params *, struct YYLTYPE *); -int svf_trst(int); +int svf_runtest(chain_t *, struct runtest *); +int svf_state(chain_t *, struct path_states *, int); +int svf_sxr(chain_t *, enum generic_irdr_coding, struct ths_params *, struct YYLTYPE *); +int svf_trst(chain_t *, int); int svf_txr(enum generic_irdr_coding, struct ths_params *); diff --git a/jtag/src/svf/svf_bison.y b/jtag/src/svf/svf_bison.y index 5e9ead63..cde0ec7f 100644 --- a/jtag/src/svf/svf_bison.y +++ b/jtag/src/svf/svf_bison.y @@ -51,11 +51,13 @@ static struct svf_parser_params parser_params = { {0, 0.0, 0, 0, 0, 0} }; -void yyerror(const char *); +void yyerror(YYLTYPE *, chain_t *, const char *); static void svf_free_ths_params(struct ths_params *); %} +%parse-param {chain_t *chain} + %union { int token; double dvalue; @@ -115,12 +117,12 @@ svf_statement | FREQUENCY ';' { - svf_frequency(0.0); + svf_frequency(chain, 0.0); } | FREQUENCY NUMBER HZ ';' { - svf_frequency($2); + svf_frequency(chain, $2); } | HDR NUMBER ths_param_list ';' @@ -144,7 +146,7 @@ svf_statement | PIOMAP '(' direction IDENTIFIER piomap_rec ')' ';' { printf("PIOMAP not implemented\n"); - yyerror("PIOMAP"); + yyerror(&@$, chain, "PIOMAP"); YYERROR; } @@ -152,7 +154,7 @@ svf_statement { free($2); printf("PIO not implemented\n"); - yyerror("PIO"); + yyerror(&@$, chain, "PIO"); YYERROR; } @@ -165,8 +167,8 @@ svf_statement rt->run_clk = $3.token; rt->end_state = $5; - if (!svf_runtest(rt)) { - yyerror("RUNTEST"); + if (!svf_runtest(chain, rt)) { + yyerror(&@$, chain, "RUNTEST"); YYERROR; } } @@ -180,8 +182,8 @@ svf_statement rt->run_clk = 0; rt->end_state = $4; - if (!svf_runtest(rt)) { - yyerror("RUNTEST"); + if (!svf_runtest(chain, rt)) { + yyerror(&@$, chain, "RUNTEST"); YYERROR; } } @@ -192,11 +194,11 @@ svf_statement int result; p->number = $2; - result = svf_sxr(generic_dr, p, &@$); + result = svf_sxr(chain, generic_dr, p, &@$); svf_free_ths_params(p); if (!result) { - yyerror("SDR"); + yyerror(&@$, chain, "SDR"); YYERROR; } } @@ -207,19 +209,19 @@ svf_statement int result; p->number = $2; - result = svf_sxr(generic_ir, p, &@$); + result = svf_sxr(chain, generic_ir, p, &@$); svf_free_ths_params(p); if (!result) { - yyerror("SIR"); + yyerror(&@$, chain, "SIR"); YYERROR; } } | STATE path_states stable_state ';' { - if (!svf_state(&parser_params.path_states, $3)) { - yyerror("STATE"); + if (!svf_state(chain, &parser_params.path_states, $3)) { + yyerror(&@$, chain, "STATE"); YYERROR; } } @@ -234,7 +236,7 @@ svf_statement svf_free_ths_params(p); if (!result) { - yyerror("TDR"); + yyerror(&@$, chain, "TDR"); YYERROR; } } @@ -249,15 +251,15 @@ svf_statement svf_free_ths_params(p); if (!result) { - yyerror("TIR"); + yyerror(&@$, chain, "TIR"); YYERROR; } } | TRST trst_mode ';' { - if (!svf_trst($2)) { - yyerror("TRST"); + if (!svf_trst(chain, $2)) { + yyerror(&@$, chain, "TRST"); YYERROR; } } @@ -413,7 +415,7 @@ direction void -yyerror(const char *error_string) +yyerror(YYLTYPE *locp, chain_t *chain, const char *error_string) { printf("Error occured for SVF command %s.\n", error_string); }