diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-12-14 15:55:51 -0800 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-12-14 15:55:51 -0800 |
commit | af79925eb1937044977f969a53ea3b7635f576b1 (patch) | |
tree | 6b7a97dda6a67ba1f3fe4d711edd4aae0d58b148 /src/jtag/tcl.c | |
parent | 6f929dbd93e1b2c0373f389060bf64e60e8194ab (diff) |
jtag: add '-ignore-version' option
Add a "-ignore-version" to "jtag newtap" which makes the IDCODE
comparison logic optionally ignore version differences.
Update the "scan_chain" command to illustrate this by showing
the "*" character instead of the (ignored) version nibble.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/jtag/tcl.c')
-rw-r--r-- | src/jtag/tcl.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 9704c302..f4815c8e 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -454,6 +454,7 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, #define NTAP_OPT_ENABLED 3 #define NTAP_OPT_DISABLED 4 #define NTAP_OPT_EXPECTED_ID 5 +#define NTAP_OPT_VERSION 6 static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi, struct jtag_tap *pTap) @@ -520,6 +521,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) { .name = "-enable" , .value = NTAP_OPT_ENABLED }, { .name = "-disable" , .value = NTAP_OPT_DISABLED }, { .name = "-expected-id" , .value = NTAP_OPT_EXPECTED_ID }, + { .name = "-ignore-version" , .value = NTAP_OPT_VERSION }, { .name = NULL , .value = -1 }, }; @@ -595,6 +597,9 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) return e; } break; + case NTAP_OPT_VERSION: + pTap->ignore_version = true; + break; } /* switch (n->value) */ } /* while (goi->argc) */ @@ -1013,6 +1018,7 @@ COMMAND_HANDLER(handle_interface_command) COMMAND_HANDLER(handle_scan_chain_command) { struct jtag_tap *tap; + char expected_id[12]; tap = jtag_all_taps(); command_print(CMD_CTX, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr "); @@ -1020,25 +1026,39 @@ COMMAND_HANDLER(handle_scan_chain_command) while (tap) { uint32_t expected, expected_mask, cur_instr, ii; + + snprintf(expected_id, sizeof expected_id, "0x%08x", + (unsigned)((tap->expected_ids_cnt > 0) + ? tap->expected_ids[0] + : 0)); + if (tap->ignore_version) + expected_id[2] = '*'; + expected = buf_get_u32(tap->expected, 0, tap->ir_length); expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length); cur_instr = buf_get_u32(tap->cur_instr, 0, tap->ir_length); command_print(CMD_CTX, - "%2d | %-18s | %c | 0x%08x | 0x%08x | 0x%02x | 0x%02x | 0x%02x | 0x%02x", + "%2d | %-18s | %c | 0x%08x | %s | 0x%02x | 0x%02x | 0x%02x | 0x%02x", tap->abs_chain_position, tap->dotted_name, tap->enabled ? 'Y' : 'n', (unsigned int)(tap->idcode), - (unsigned int)(tap->expected_ids_cnt > 0 ? tap->expected_ids[0] : 0), + expected_id, (unsigned int)(tap->ir_length), (unsigned int)(expected), (unsigned int)(expected_mask), (unsigned int)(cur_instr)); for (ii = 1; ii < tap->expected_ids_cnt; ii++) { - command_print(CMD_CTX, " | | | | 0x%08x | | | | ", - (unsigned int)(tap->expected_ids[ii])); + snprintf(expected_id, sizeof expected_id, "0x%08x", + (unsigned) tap->expected_ids[1]); + if (tap->ignore_version) + expected_id[2] = '*'; + + command_print(CMD_CTX, + " | | | | %s | | | | ", + expected_id); } tap = tap->next_tap; |