diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-07 05:23:50 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-07 05:23:50 +0000 |
commit | 9eefd4d7e57f757f74c9164f71b36b74db42020b (patch) | |
tree | d33d8b32aba8505d61721c851cfff53e52a93a97 | |
parent | d8421f276689ee48cb190921119ecca10559a136 (diff) | |
download | openocd+libswd-9eefd4d7e57f757f74c9164f71b36b74db42020b.tar.gz openocd+libswd-9eefd4d7e57f757f74c9164f71b36b74db42020b.tar.bz2 openocd+libswd-9eefd4d7e57f757f74c9164f71b36b74db42020b.tar.xz openocd+libswd-9eefd4d7e57f757f74c9164f71b36b74db42020b.zip |
Factoring of jtag_examine_chain for maintainability:
- Add helper to check for the terminating ID during jtag_examine_chain.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2087 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/jtag/jtag.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 0bc1c4ff..1456a5b5 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -995,6 +995,11 @@ static void jtag_examine_chain_display(enum log_levels level, const char *msg, EXTRACT_MFG(idcode), EXTRACT_PART(idcode), EXTRACT_VER(idcode) ); } +static bool jtag_idcode_is_final(u32 idcode) +{ + return idcode == 0x000000FF || idcode == 0xFFFFFFFF; +} + /** * This helper checks that remaining bits in the examined chain data are * all as expected, but a single JTAG device requires only 64 bits to be @@ -1008,7 +1013,7 @@ static void jtag_examine_chain_end(u8 *idcodes, unsigned count, unsigned max) { u32 idcode = buf_get_u32(idcodes, count, 32); // do not trigger the warning if the data looks good - if (!triggered && (idcode == 0x000000FF || idcode == 0xFFFFFFFF)) + if (!triggered && jtag_idcode_is_final(idcode)) continue; LOG_WARNING("Unexpected idcode after end of chain: %d 0x%08x", count, idcode); @@ -1055,7 +1060,7 @@ static int jtag_examine_chain(void) * as AVR will output all 1's instead of TDI input value at * end of chain. */ - if ((idcode == 0x000000FF)||(idcode == 0xFFFFFFFF)) + if (jtag_idcode_is_final(idcode)) { jtag_examine_chain_end(idcode_buffer, bit_count + 32, JTAG_MAX_CHAIN_SIZE * 32); |