Factoring of jtag_examine_chain for maintainability:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 7 Jun 2009 05:22:42 +0000 (05:22 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 7 Jun 2009 05:22:42 +0000 (05:22 +0000)
- Reduce indent: invert logic test for unexpected TAP (no IDs).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2081 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/jtag.c

index ca4eb6849319a1feb9263df2ea723ff5a43a72ff..47d16fdf11afb12700e8a6d48a893baf115f73f7 100644 (file)
@@ -1058,44 +1058,48 @@ static int jtag_examine_chain(void)
 
                tap->idcode = idcode;
 
-               if (tap->expected_ids_cnt > 0) {
+               if (0 == tap->expected_ids_cnt)
+               {
+                       // @todo Enable LOG_INFO to ask for reports about unknown TAP IDs.
+#if 0
+                       LOG_INFO("Uknown JTAG TAP ID: 0x%08x", tap->idcode)
+                       LOG_INFO("Please report the chip name and reported ID code to the openocd project");
+#endif
+                       tap = jtag_tap_next_enabled(tap);
+                       continue;
+               }
                        /* 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;
-                               }
+               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 {
-#if 0
-                       LOG_INFO("JTAG TAP ID: 0x%08x - Unknown - please report (A) chipname and (B) idcode to the openocd project",
-                                        tap->idcode);
-#endif
+                       LOG_INFO("JTAG Tap/device matched");
                }
+               
                tap = jtag_tap_next_enabled(tap);
        }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)