From af79925eb1937044977f969a53ea3b7635f576b1 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 14 Dec 2009 15:55:51 -0800 Subject: 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 --- src/jtag/core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/jtag/core.c') diff --git a/src/jtag/core.c b/src/jtag/core.c index 77cf48ac..e311bfbc 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -958,16 +958,25 @@ static bool jtag_examine_chain_end(uint8_t *idcodes, unsigned count, unsigned ma static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap) { + uint32_t idcode = tap->idcode; + /* ignore expected BYPASS codes; warn otherwise */ - if (0 == tap->expected_ids_cnt && !tap->idcode) + if (0 == tap->expected_ids_cnt && !idcode) return true; + /* optionally ignore the JTAG version field */ + uint32_t mask = tap->ignore_version ? ~(0xff << 24) : ~0; + + idcode &= mask; + /* Loop over the expected identification codes and test for a match */ unsigned ii, limit = tap->expected_ids_cnt; for (ii = 0; ii < limit; ii++) { - if (tap->idcode == tap->expected_ids[ii]) + uint32_t expected = tap->expected_ids[ii] & mask; + + if (idcode == expected) return true; /* treat "-expected-id 0" as a "don't-warn" wildcard */ -- cgit v1.2.3