summaryrefslogtreecommitdiff
path: root/src/jtag/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtag/core.c')
-rw-r--r--src/jtag/core.c13
1 files changed, 11 insertions, 2 deletions
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 */