summaryrefslogtreecommitdiff
path: root/src/jtag/core.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-12-14 15:55:51 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-12-14 15:55:51 -0800
commitaf79925eb1937044977f969a53ea3b7635f576b1 (patch)
tree6b7a97dda6a67ba1f3fe4d711edd4aae0d58b148 /src/jtag/core.c
parent6f929dbd93e1b2c0373f389060bf64e60e8194ab (diff)
downloadopenocd_libswd-af79925eb1937044977f969a53ea3b7635f576b1.tar.gz
openocd_libswd-af79925eb1937044977f969a53ea3b7635f576b1.tar.bz2
openocd_libswd-af79925eb1937044977f969a53ea3b7635f576b1.tar.xz
openocd_libswd-af79925eb1937044977f969a53ea3b7635f576b1.zip
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/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 */