Streamline Capture-IR handling and integrity test.
authordbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sat, 26 Sep 2009 19:08:34 +0000 (19:08 +0000)
committerdbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sat, 26 Sep 2009 19:08:34 +0000 (19:08 +0000)
Change the handling of the "-ircapture" and "-irmask" parameters
to be slightly more sensible, given that the JTAG spec describes
what is required, and that we already require that conformance in
one place.  IR scan returns some bitstring with LSBs "01".

 - First, provide and use default values that satisfy the IEEE spec.
   Existing TAP configs will override the defaults, but those parms
   are no longer required.

 - Second, warn if any TAP gets set up to violate the JTAG spec.
   It's likely a bug, but maybe not; else this should be an error.
   Improve the related diagnostics to say which TAP is affected.

And associated minor fixes/cleanups to comments and diagnostics.

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

doc/openocd.texi
src/jtag/tcl.c

index 35c1b0d314813dc24f1a795c86c9d4315045e09c..e4609e40a66025d608d24468629d1434a0b164a1 100644 (file)
@@ -2309,19 +2309,9 @@ a JTAG TAP; that TAP should be named @code{sdma}.
 Every TAP requires at least the following @var{configparams}:
 
 @itemize @bullet
-@item @code{-ircapture} @var{NUMBER}
-@*The bit pattern loaded by the TAP into the JTAG shift register
-on entry to the @sc{ircapture} state, such as 0x01.
-JTAG requires the two LSBs of this value to be 01.
-The value is used to verify that instruction scans work correctly.
 @item @code{-irlen} @var{NUMBER}
 @*The length in bits of the
 instruction register, such as 4 or 5 bits.
-@item @code{-irmask} @var{NUMBER}
-@*A mask for the IR register.
-For some devices, there are bits in the IR that aren't used.
-This lets OpenOCD mask them off when doing IDCODE comparisons.
-In general, this should just be all ones for the size of the IR.
 @end itemize
 
 A TAP may also provide optional @var{configparams}:
@@ -2340,6 +2330,18 @@ found when the JTAG chain is examined.
 These codes are not required by all JTAG devices.
 @emph{Repeat the option} as many times as required if more than one
 ID code could appear (for example, multiple versions).
+@item @code{-ircapture} @var{NUMBER}
+@*The bit pattern loaded by the TAP into the JTAG shift register
+on entry to the @sc{ircapture} state, such as 0x01.
+JTAG requires the two LSBs of this value to be 01.
+By default, @code{-ircapture} and @code{-irmask} are set
+up to verify that two-bit value; but you may provide
+additional bits, if you know them.
+@item @code{-irmask} @var{NUMBER}
+@*A mask used with @code{-ircapture}
+to verify that instruction scans work correctly.
+Such scans are not used by OpenOCD except to verify that
+there seems to be no problems with JTAG scan chain operations.
 @end itemize
 @end deffn
 
index 0368c4f89549031fa558623c5bce2a5d827cc5d6..aa32085b0f22104d56387ad48dd89f49c344d3df 100644 (file)
@@ -242,13 +242,15 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
        LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
                          pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
 
-       /* deal with options */
-#define NTREQ_IRLEN      1
-#define NTREQ_IRCAPTURE  2
-#define NTREQ_IRMASK     4
+       /* IEEE specifies that the two LSBs of an IR scan are 01, so make
+        * that the default.  The "-irlen" and "-irmask" options are only
+        * needed to cope with nonstandard TAPs, or to specify more bits.
+        */
+       pTap->ir_capture_mask = 0x03;
+       pTap->ir_capture_value = 0x01;
 
-       /* clear them as we find them */
-       reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK);
+       /* clear flags for "required options" them as we find them */
+       reqbits = 1;
 
        while (goi->argc) {
                e = Jim_GetOpt_Nvp(goi, opts, &n);
@@ -308,31 +310,39 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
                        switch (n->value) {
                        case NTAP_OPT_IRLEN:
                                if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value)))
-                                       LOG_WARNING("huge IR length %d", (int) w);
+                                       LOG_WARNING("%s: huge IR length %d",
+                                                       pTap->dotted_name,
+                                                       (int) w);
                                pTap->ir_length = w;
-                               reqbits &= (~(NTREQ_IRLEN));
+                               reqbits = 0;
                                break;
                        case NTAP_OPT_IRMASK:
                                if (is_bad_irval(pTap->ir_length, w)) {
-                                       LOG_ERROR("IR mask %x too big",
+                                       LOG_ERROR("%s: IR mask %x too big",
+                                                       pTap->dotted_name,
                                                        (int) w);
                                        free((void *)pTap->dotted_name);
                                        free(pTap);
                                        return ERROR_FAIL;
                                }
+                               if ((w & 3) != 3)
+                                       LOG_WARNING("%s: nonstandard IR mask",
+                                                       pTap->dotted_name);
                                pTap->ir_capture_mask = w;
-                               reqbits &= (~(NTREQ_IRMASK));
                                break;
                        case NTAP_OPT_IRCAPTURE:
                                if (is_bad_irval(pTap->ir_length, w)) {
-                                       LOG_ERROR("IR capture %x too big",
+                                       LOG_ERROR("%s: IR capture %x too big",
+                                                       pTap->dotted_name,
                                                        (int) w);
                                        free((void *)pTap->dotted_name);
                                        free(pTap);
                                        return ERROR_FAIL;
                                }
+                               if ((w & 3) != 1)
+                                       LOG_WARNING("%s: nonstandard IR value",
+                                                       pTap->dotted_name);
                                pTap->ir_capture_value = w;
-                               reqbits &= (~(NTREQ_IRCAPTURE));
                                break;
                        }
                } /* switch (n->value) */

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)