From fa3506e4204901770662b1878b1234e3ff0debe9 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Fri, 8 May 2009 10:18:59 +0000 Subject: [PATCH] Replace occurrence of urj_cmd_run() in tap/detect.c with an API call urj_part_instruction_define() git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1581 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/src/tap/detect.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index 8c8f6655..8b06f3c8 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -398,8 +398,8 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path) #endif if (part->active_instruction == NULL) - part->active_instruction = - urj_part_find_instruction (part, "IDCODE"); + part->active_instruction = urj_part_find_instruction (part, + "IDCODE"); } for (i = 0; i < 32; i++) @@ -430,9 +430,8 @@ urj_tap_manual_add (urj_chain_t *chain, int instr_len) { urj_tap_register_t *id; urj_part_t *part; - char *cmd[] = { NULL, NULL, NULL, NULL, NULL }; char *str; - int result; + urj_part_instruction_t *bypass; id = urj_tap_register_alloc (1); if (id == NULL) @@ -464,10 +463,6 @@ urj_tap_manual_add (urj_chain_t *chain, int instr_len) } /* create a string of 1's for BYPASS instruction */ - cmd[0] = "instruction"; - cmd[1] = "BYPASS"; - cmd[3] = "BR"; - cmd[4] = NULL; str = calloc (instr_len + 1, sizeof (char)); if (str == NULL) { @@ -478,14 +473,14 @@ urj_tap_manual_add (urj_chain_t *chain, int instr_len) memset (str, '1', instr_len); str[instr_len] = '\0'; - cmd[2] = str; - result = urj_cmd_run (chain, cmd); + bypass = urj_part_instruction_define (part, "BYPASS", str, "BR"); free (str); - if (result < 1) + if (bypass == NULL) { urj_log (URJ_LOG_LEVEL_NORMAL, _("Error: could not set BYPASS instruction")); + // retain error state return -1; } @@ -519,6 +514,8 @@ urj_tap_detect (urj_chain_t *chain) urj_error_set (URJ_ERROR_INVALID, "chain has empty parts list"); return URJ_STATUS_FAIL; } + + /* @@@@ RFHH check results? */ urj_part_parts_set_instruction (chain->parts, "SAMPLE/PRELOAD"); urj_tap_chain_shift_instructions (chain); urj_tap_chain_shift_data_registers (chain, 1);