summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-07 05:22:34 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-07 05:22:34 +0000
commit32350a50064fd9a8fbc266e51bb41140dd7a93c9 (patch)
tree0ba617cb6ed23d74cc045bf6c1d8bf7a08aad824 /src
parent401d6472cc654a0c25bd7efe9072b9ecb2efe75d (diff)
downloadopenocd_libswd-32350a50064fd9a8fbc266e51bb41140dd7a93c9.tar.gz
openocd_libswd-32350a50064fd9a8fbc266e51bb41140dd7a93c9.tar.bz2
openocd_libswd-32350a50064fd9a8fbc266e51bb41140dd7a93c9.tar.xz
openocd_libswd-32350a50064fd9a8fbc266e51bb41140dd7a93c9.zip
Factoring of jtag_examine_chain for maintainability:
- Reduce indent: invert logic test for tap in jtag_examine_chain. git-svn-id: svn://svn.berlios.de/openocd/trunk@2080 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/jtag/jtag.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index 42112cb6..ca4eb684 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -1052,51 +1052,51 @@ static int jtag_examine_chain(void)
bit_count += 32;
}
- if (tap)
- {
- tap->idcode = idcode;
+ device_count++;
+ if (!tap)
+ continue;
- if (tap->expected_ids_cnt > 0) {
- /* Loop over the expected identification codes and test for a match */
- u8 ii;
- for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
- if( tap->idcode == tap->expected_ids[ii] ){
- break;
- }
+ tap->idcode = idcode;
+
+ if (tap->expected_ids_cnt > 0) {
+ /* Loop over the expected identification codes and test for a match */
+ u8 ii;
+ for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
+ if( tap->idcode == tap->expected_ids[ii] ){
+ break;
}
+ }
- /* If none of the expected ids matched, log an error */
- if (ii == tap->expected_ids_cnt) {
- LOG_ERROR("JTAG tap: %s got: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
+ /* If none of the expected ids matched, log an error */
+ if (ii == tap->expected_ids_cnt) {
+ LOG_ERROR("JTAG tap: %s got: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
+ tap->dotted_name,
+ idcode,
+ EXTRACT_MFG( tap->idcode ),
+ EXTRACT_PART( tap->idcode ),
+ EXTRACT_VER( tap->idcode ) );
+ for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
+ LOG_ERROR("JTAG tap: %s expected %hhu of %hhu: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
tap->dotted_name,
- idcode,
- EXTRACT_MFG( tap->idcode ),
- EXTRACT_PART( tap->idcode ),
- EXTRACT_VER( tap->idcode ) );
- for (ii = 0; ii < tap->expected_ids_cnt; ii++) {
- LOG_ERROR("JTAG tap: %s expected %hhu of %hhu: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
- tap->dotted_name,
- ii + 1,
- tap->expected_ids_cnt,
- tap->expected_ids[ii],
- EXTRACT_MFG( tap->expected_ids[ii] ),
- EXTRACT_PART( tap->expected_ids[ii] ),
- EXTRACT_VER( tap->expected_ids[ii] ) );
- }
-
- return ERROR_JTAG_INIT_FAILED;
- } else {
- LOG_INFO("JTAG Tap/device matched");
+ ii + 1,
+ tap->expected_ids_cnt,
+ tap->expected_ids[ii],
+ EXTRACT_MFG( tap->expected_ids[ii] ),
+ EXTRACT_PART( tap->expected_ids[ii] ),
+ EXTRACT_VER( tap->expected_ids[ii] ) );
}
+
+ return ERROR_JTAG_INIT_FAILED;
} else {
+ LOG_INFO("JTAG Tap/device matched");
+ }
+ } else {
#if 0
- LOG_INFO("JTAG TAP ID: 0x%08x - Unknown - please report (A) chipname and (B) idcode to the openocd project",
- tap->idcode);
+ LOG_INFO("JTAG TAP ID: 0x%08x - Unknown - please report (A) chipname and (B) idcode to the openocd project",
+ tap->idcode);
#endif
- }
- tap = jtag_tap_next_enabled(tap);
}
- device_count++;
+ tap = jtag_tap_next_enabled(tap);
}
/* see if number of discovered devices matches configuration */