diff --git a/urjtag/src/bus/bscoach.c b/urjtag/src/bus/bscoach.c index 3bc72de6..0e49b6cc 100644 --- a/urjtag/src/bus/bscoach.c +++ b/urjtag/src/bus/bscoach.c @@ -171,7 +171,7 @@ flashbscoach_bus_init (urj_bus_t *bus) if (urj_tap_state (chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/ejtag.c b/urjtag/src/bus/ejtag.c index 85c062d7..6741cc4c 100644 --- a/urjtag/src/bus/ejtag.c +++ b/urjtag/src/bus/ejtag.c @@ -296,7 +296,7 @@ ejtag_bus_init (urj_bus_t *bus) if (urj_tap_state (bus->chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index 40937b75..5063e366 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -378,7 +378,7 @@ ejtag_dma_bus_init (urj_bus_t *bus) if (urj_tap_state (bus->chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/jopcyc.c b/urjtag/src/bus/jopcyc.c index 139fc0ea..e64f653f 100644 --- a/urjtag/src/bus/jopcyc.c +++ b/urjtag/src/bus/jopcyc.c @@ -446,7 +446,7 @@ jopcyc_bus_init (urj_bus_t *bus) if (urj_tap_state (chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/pxa2x0.c b/urjtag/src/bus/pxa2x0.c index e61203d7..014fb8e3 100644 --- a/urjtag/src/bus/pxa2x0.c +++ b/urjtag/src/bus/pxa2x0.c @@ -272,7 +272,7 @@ pxa2xx_bus_init (urj_bus_t *bus) if (urj_tap_state (chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/s3c4510x.c b/urjtag/src/bus/s3c4510x.c index 710083e0..4f88dfae 100644 --- a/urjtag/src/bus/s3c4510x.c +++ b/urjtag/src/bus/s3c4510x.c @@ -206,7 +206,7 @@ s3c4510_bus_init (urj_bus_t *bus) if (urj_tap_state (chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/bus/zefant-xs3.c b/urjtag/src/bus/zefant-xs3.c index 27843db0..fa9b9ceb 100644 --- a/urjtag/src/bus/zefant-xs3.c +++ b/urjtag/src/bus/zefant-xs3.c @@ -571,7 +571,7 @@ zefant_xs3_bus_init (urj_bus_t *bus) if (urj_tap_state (chain) != URJ_TAP_STATE_RUN_TEST_IDLE) { - /* silently skip initialization if TAP isn't in RUNTEST/URJ_JIM_IDLE state + /* silently skip initialization if TAP isn't in RUNTEST/IDLE state this is required to avoid interfering with detect when initbus is contained in the part description file URJ_BUS_INIT() will be called latest by URJ_BUS_PREPARE() */ diff --git a/urjtag/src/cmd/cmd_part.c b/urjtag/src/cmd/cmd_part.c index 8f968ef2..0b479445 100644 --- a/urjtag/src/cmd/cmd_part.c +++ b/urjtag/src/cmd/cmd_part.c @@ -48,17 +48,17 @@ cmd_part_run (urj_chain_t *chain, char *params[]) urj_part_t *part = urj_tap_chain_active_part (chain); if (part == NULL) + // retain error state return 1; - part->alias = malloc (strlen (params[2]) + 1); + part->alias = strdup (params[2]); if (part->alias == NULL) { - urj_error_set(URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", - strlen (params[2]) + 1); + urj_error_set(URJ_ERROR_OUT_OF_MEMORY, "strdup(%s) fails", + params[2]); return -1; } - strcpy (part->alias, params[2]); return 1; } } @@ -92,8 +92,6 @@ cmd_part_run (urj_chain_t *chain, char *params[]) } if (i < chain->parts->len) n = i; - - else return -1; } diff --git a/urjtag/src/cmd/cmd_peekpoke.c b/urjtag/src/cmd/cmd_peekpoke.c index c8c34c7e..7233fc73 100644 --- a/urjtag/src/cmd/cmd_peekpoke.c +++ b/urjtag/src/cmd/cmd_peekpoke.c @@ -46,10 +46,16 @@ cmd_peek_run (urj_chain_t *chain, char *params[]) return -1; if (!urj_bus) + { + printf (_("Error: Bus missing.\n")); + return 1; + } + if (!urj_bus->driver) { printf (_("Error: Bus driver missing.\n")); return 1; } + do { if (urj_cmd_get_number (params[j], &adr)) @@ -109,12 +115,16 @@ cmd_poke_run (urj_chain_t *chain, char *params[]) return -1; if (!urj_bus) + { + printf (_("Error: Bus missing.\n")); + return 1; + } + if (!urj_bus->driver) { printf (_("Error: Bus driver missing.\n")); return 1; } - URJ_BUS_PREPARE (urj_bus); while (k < pars) diff --git a/urjtag/src/cmd/cmd_pod.c b/urjtag/src/cmd/cmd_pod.c index 68140d15..e81267bf 100644 --- a/urjtag/src/cmd/cmd_pod.c +++ b/urjtag/src/cmd/cmd_pod.c @@ -85,7 +85,7 @@ cmd_pod_help (void) printf (_("Usage: %s SIGNAL=# [SIGNAL=# ...]\n" "Set state of POD signal(s) to 0 or 1.\n" "\n" - "SIGNAL TCK,TMS, TDI, TRST, or URJ_JIM_RESET\n" + "SIGNAL TCK,TMS, TDI, TRST, or RESET\n" "# 0 or 1\n"), "pod"); } diff --git a/urjtag/src/jim/tap.c b/urjtag/src/jim/tap.c index 5589da26..eb115fce 100644 --- a/urjtag/src/jim/tap.c +++ b/urjtag/src/jim/tap.c @@ -67,8 +67,8 @@ urj_jim_print_tap_state (char *rof, urj_jim_device_t *dev) switch (dev->tap_state & 7) { case 0: - printf ((dev->tap_state == - URJ_JIM_RESET) ? "URJ_JIM_RESET" : "URJ_JIM_IDLE"); + printf ((dev->tap_state == URJ_JIM_RESET) ? "URJ_JIM_RESET" + : "URJ_JIM_IDLE"); break; case 1: printf ("SELECT"); diff --git a/urjtag/src/svf/svf.c b/urjtag/src/svf/svf.c index 3a3c5ded..db288fea 100644 --- a/urjtag/src/svf/svf.c +++ b/urjtag/src/svf/svf.c @@ -243,10 +243,10 @@ urj_svf_map_state (int state) switch (state) { - case URJ_JIM_RESET: + case RESET: jtag_state = URJ_TAP_STATE_TEST_LOGIC_RESET; break; - case URJ_JIM_IDLE: + case IDLE: jtag_state = URJ_TAP_STATE_RUN_TEST_IDLE; break; case DRSELECT: @@ -579,15 +579,15 @@ urj_svf_all_care (char **string, double number) * state : required end state (SVF parser encoding) * ***************************************************************************/ void -urj_svf_endxr (urj_svf_parser_priv_t *priv, - enum URJ_SVF_generic_irdr_coding ir_dr, int state) +urj_svf_endxr (urj_svf_parser_priv_t *priv, enum generic_irdr_coding ir_dr, + int state) { switch (ir_dr) { - case URJ_SVF_generic_ir: + case generic_ir: priv->endir = urj_svf_map_state (state); break; - case URJ_SVF_generic_dr: + case generic_dr: priv->enddr = urj_svf_map_state (state); break; } @@ -626,12 +626,11 @@ urj_svf_frequency (urj_chain_t *chain, double freq) * 0 : error occurred * ***************************************************************************/ int -urj_svf_hxr (enum URJ_SVF_generic_irdr_coding ir_dr, - struct ths_params *params) +urj_svf_hxr (enum generic_irdr_coding ir_dr, struct ths_params *params) { if (params->number != 0.0) printf (_("Warning %s: command %s not implemented\n"), "svf", - ir_dr == URJ_SVF_generic_ir ? "HIR" : "HDR"); + ir_dr == generic_ir ? "HIR" : "HDR"); return (1); } @@ -841,13 +840,13 @@ urj_svf_state (urj_chain_t *chain, urj_svf_parser_priv_t *priv, * ***************************************************************************/ int urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, - enum URJ_SVF_generic_irdr_coding ir_dr, - struct ths_params *params, YYLTYPE *loc) + enum generic_irdr_coding ir_dr, struct ths_params *params, + YYLTYPE *loc) { urj_svf_sxr_t *sxr_params; int len, result = 1; - sxr_params = (ir_dr == URJ_SVF_generic_ir) ? + sxr_params = (ir_dr == generic_ir) ? &(priv->sir_params) : &(priv->sdr_params); /* remember parameters */ @@ -883,7 +882,7 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, { printf (_ ("Error %s: first %s command after length change must have a TDI value.\n"), - "svf", ir_dr == URJ_SVF_generic_ir ? "SIR" : "SDR"); + "svf", ir_dr == generic_ir ? "SIR" : "SDR"); result = 0; } sxr_params->no_tdi = 0; @@ -905,7 +904,7 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, len = (int) sxr_params->params.number; switch (ir_dr) { - case URJ_SVF_generic_ir: + case generic_ir: /* is SIR large enough? */ if (priv->ir->value->len != len) { @@ -921,7 +920,7 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, } break; - case URJ_SVF_generic_dr: + case generic_dr: /* check data register SDR */ if (priv->dr->in->len != len) { @@ -948,16 +947,15 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, /* fill register with value of TDI parameter */ if (!urj_svf_copy_hex_to_register (sxr_params->params.tdi, - ir_dr == - URJ_SVF_generic_ir ? priv->ir-> - value : priv->dr->in)) + ir_dr == generic_ir ? priv->ir->value + : priv->dr->in)) return (0); /* shift selected instruction/register */ switch (ir_dr) { - case URJ_SVF_generic_ir: + case generic_ir: urj_svf_goto_state (chain, URJ_TAP_STATE_SHIFT_IR); urj_tap_chain_shift_instructions_mode (chain, sxr_params->params.tdo ? 1 : 0, @@ -971,7 +969,7 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv, loc); break; - case URJ_SVF_generic_dr: + case generic_dr: urj_svf_goto_state (chain, URJ_TAP_STATE_SHIFT_DR); urj_tap_chain_shift_data_registers_mode (chain, sxr_params->params. @@ -1089,12 +1087,11 @@ urj_svf_trst (urj_chain_t *chain, urj_svf_parser_priv_t *priv, int trst_mode) * 0 : error occurred * ***************************************************************************/ int -urj_svf_txr (enum URJ_SVF_generic_irdr_coding ir_dr, - struct ths_params *params) +urj_svf_txr (enum generic_irdr_coding ir_dr, struct ths_params *params) { if (params->number != 0.0) printf (_("Warning %s: command %s not implemented\n"), "svf", - ir_dr == URJ_SVF_generic_ir ? "TIR" : "TDR"); + ir_dr == generic_ir ? "TIR" : "TDR"); return (1); } diff --git a/urjtag/src/svf/svf.h b/urjtag/src/svf/svf.h index e037f8f6..5035c68e 100644 --- a/urjtag/src/svf/svf.h +++ b/urjtag/src/svf/svf.h @@ -30,8 +30,11 @@ #define MAX_PATH_STATES 64 /* Coding for commands referring either to IR or DR */ -enum URJ_SVF_generic_irdr_coding -{ URJ_SVF_generic_ir, URJ_SVF_generic_dr }; +enum generic_irdr_coding +{ + generic_ir, + generic_dr +}; struct tdval @@ -130,16 +133,16 @@ void urj_svf_flex_deinit (void *); int urj_svf_bison_init (urj_svf_parser_priv_t *, FILE *, int, int); void urj_svf_bison_deinit (urj_svf_parser_priv_t *); -void urj_svf_endxr (urj_svf_parser_priv_t *, enum URJ_SVF_generic_irdr_coding, +void urj_svf_endxr (urj_svf_parser_priv_t *, enum generic_irdr_coding, int); void urj_svf_frequency (urj_chain_t *, double); -int urj_svf_hxr (enum URJ_SVF_generic_irdr_coding, struct ths_params *); +int urj_svf_hxr (enum generic_irdr_coding, struct ths_params *); int urj_svf_runtest (urj_chain_t *, urj_svf_parser_priv_t *, struct runtest *); int urj_svf_state (urj_chain_t *, urj_svf_parser_priv_t *, struct path_states *, int); int urj_svf_sxr (urj_chain_t *, urj_svf_parser_priv_t *, - enum URJ_SVF_generic_irdr_coding, struct ths_params *, + enum generic_irdr_coding, struct ths_params *, struct YYLTYPE *); int urj_svf_trst (urj_chain_t *, urj_svf_parser_priv_t *, int); -int urj_svf_txr (enum URJ_SVF_generic_irdr_coding, struct ths_params *); +int urj_svf_txr (enum generic_irdr_coding, struct ths_params *); diff --git a/urjtag/src/svf/svf_bison.y b/urjtag/src/svf/svf_bison.y index 98d6a96b..28e53a9f 100644 --- a/urjtag/src/svf/svf_bison.y +++ b/urjtag/src/svf/svf_bison.y @@ -64,7 +64,7 @@ static void urj_svf_free_ths_params(struct ths_params *); %token EMPTY %token ENDDR ENDIR %token FREQUENCY HZ -%token STATE URJ_JIM_RESET URJ_JIM_IDLE +%token STATE RESET IDLE %token TDI TDO MASK SMASK %token TRST ON OFF Z ABSENT %token HDR HIR SDR SIR TDR TIR @@ -98,12 +98,12 @@ line svf_statement : ENDIR stable_state ';' { - urj_svf_endxr(priv_data, URJ_SVF_generic_ir, $2); + urj_svf_endxr(priv_data, generic_ir, $2); } | ENDDR stable_state ';' { - urj_svf_endxr(priv_data, URJ_SVF_generic_dr, $2); + urj_svf_endxr(priv_data, generic_dr, $2); } | FREQUENCY ';' @@ -121,7 +121,7 @@ svf_statement struct ths_params *p = &(priv_data->parser_params.ths_params); p->number = $2; - urj_svf_hxr(URJ_SVF_generic_dr, p); + urj_svf_hxr(generic_dr, p); urj_svf_free_ths_params(p); } @@ -130,7 +130,7 @@ svf_statement struct ths_params *p = &(priv_data->parser_params.ths_params); p->number = $2; - urj_svf_hxr(URJ_SVF_generic_ir, p); + urj_svf_hxr(generic_ir, p); urj_svf_free_ths_params(p); } @@ -185,7 +185,7 @@ svf_statement int result; p->number = $2; - result = urj_svf_sxr(chain, priv_data, URJ_SVF_generic_dr, p, &@$); + result = urj_svf_sxr(chain, priv_data, generic_dr, p, &@$); urj_svf_free_ths_params(p); if (!result) { @@ -200,7 +200,7 @@ svf_statement int result; p->number = $2; - result = urj_svf_sxr(chain, priv_data, URJ_SVF_generic_ir, p, &@$); + result = urj_svf_sxr(chain, priv_data, generic_ir, p, &@$); urj_svf_free_ths_params(p); if (!result) { @@ -223,7 +223,7 @@ svf_statement int result; p->number = $2; - result = urj_svf_txr(URJ_SVF_generic_dr, p); + result = urj_svf_txr(generic_dr, p); urj_svf_free_ths_params(p); if (!result) { @@ -238,7 +238,7 @@ svf_statement int result; p->number = $2; - result = urj_svf_txr(URJ_SVF_generic_ir, p); + result = urj_svf_txr(generic_ir, p); urj_svf_free_ths_params(p); if (!result) { @@ -285,8 +285,8 @@ ths_opt_param ; stable_state - : URJ_JIM_RESET - | URJ_JIM_IDLE + : RESET + | IDLE | DRPAUSE | IRPAUSE ; @@ -364,8 +364,8 @@ all_states | IRUPDATE | IRPAUSE | DRPAUSE - | URJ_JIM_RESET - | URJ_JIM_IDLE + | RESET + | IDLE ; path_states diff --git a/urjtag/src/svf/svf_flex.l b/urjtag/src/svf/svf_flex.l index aa1ed852..c2acc100 100644 --- a/urjtag/src/svf/svf_flex.l +++ b/urjtag/src/svf/svf_flex.l @@ -239,7 +239,7 @@ static struct rwtable { "HDR", HDR }, { "HIR", HIR }, { "HZ", HZ }, - { "URJ_JIM_IDLE", URJ_JIM_IDLE }, + { "IDLE", IDLE }, { "IN", IN }, { "INOUT", INOUT }, { "IRCAPTURE", IRCAPTURE }, @@ -257,7 +257,7 @@ static struct rwtable { "OUT", OUT }, { "PIO", PIO }, { "PIOMAP", PIOMAP }, - { "URJ_JIM_RESET", URJ_JIM_RESET }, + { "RESET", RESET }, { "RUNTEST", RUNTEST }, { "SCK", SCK }, { "SDR", SDR }, diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index d5ef170d..0e879a6f 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -202,7 +202,7 @@ typedef struct uint8_t high_byte_value; uint8_t high_byte_dir; - /* the following variables store the bit position of TRST and URJ_JIM_RESET (SRST) + /* the following variables store the bit position of TRST and RESET (SRST) for XOR'ing with the default values of low_byte_value and high_byte_value allowed values: < 0 : feature not used @@ -1276,7 +1276,7 @@ ft2232_set_signal_schedule (params_t *params, int mask, int val, low_or |= BITMASK_TDI; if (sigs & URJ_POD_CS_TMS) low_or |= BITMASK_TMS; - /* TRST and URJ_JIM_RESET (SRST) are XOR'ed to the default value since + /* TRST and RESET (SRST) are XOR'ed to the default value since the right value depends on the external circuitry (inverter or not) */ if ((sigs & URJ_POD_CS_TRST) == 0) if (params->bit_trst >= 0)