SVF: clean up, mostly for TAP state name handling
[openocd.git] / src / jtag / interface.c
index 1511dfebf28674047a80e26dcfec019a63d59160..fcdb8ee7fc2c2c8c551e8d90c7dc552caa8ef2ec 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
- *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
+ *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2009 SoftPLC Corporation                                *
@@ -133,13 +133,10 @@ static const struct tms_sequences old_tms_seqs[6][6] =            /*  [from_state_ndx][to_
 {
        /* value clocked to TMS to move from one of six stable states to another.
         * N.B. OOCD clocks TMS from LSB first, so read these right-to-left.
-        * N.B. These values are tightly bound to the table in tap_get_tms_path_len().
         * N.B. Reset only needs to be 0b11111, but in JLink an even byte of 1's is more stable.
         * These extra ones cause no TAP state problem, because we go into reset and stay in reset.
         */
 
-
-
        /* to state: */
        /*      RESET                   IDLE                    DRSHIFT                 DRPAUSE                 IRSHIFT                 IRPAUSE         */              /* from state: */
        {       B8(1111111,7),  B8(0000000,7),  B8(0010111,7),  B8(0001010,7),  B8(0011011,7),  B8(0010110,7) },        /* RESET */
@@ -168,24 +165,33 @@ static const struct tms_sequences short_tms_seqs[6][6] =          /*  [from_state_ndx][t
 
                state specific comments:
                ------------------------
-               *->RESET                   tried the 5 bit reset and it gave me problems, 7 bits seems to
+               *->RESET           tried the 5 bit reset and it gave me problems, 7 bits seems to
                                           work better on ARM9 with ft2232 driver.  (Dick)
 
                RESET->DRSHIFT add 1 extra clock cycles in the RESET state before advancing.
                                                needed on ARM9 with ft2232 driver.  (Dick)
+                                               (For a total of *THREE* extra clocks in RESET; NOP.)
 
                RESET->IRSHIFT add 1 extra clock cycles in the RESET state before advancing.
                                                needed on ARM9 with ft2232 driver.  (Dick)
+                                               (For a total of *TWO* extra clocks in RESET; NOP.)
+
+               RESET->*                always adds one or more clocks in the target state,
+                                               which should be NOPS; except shift states which (as
+                                               noted above) add those clocks in RESET.
+
+               The X-to-X transitions always add clocks; from *SHIFT, they go
+               via IDLE and thus *DO HAVE SIDE EFFECTS* (capture and update).
        */
 
        /* to state: */
-       /*      RESET                   IDLE                            DRSHIFT                 DRPAUSE                 IRSHIFT                 IRPAUSE */                      /* from state: */
-       {       B8(1111111,7),  B8(0000000,7),  B8(0010111,7),          B8(0001010,7),  B8(0011011,7),  B8(0010110,7) },        /* RESET */
-       {       B8(1111111,7),  B8(0000000,7),  B8(001,3),                      B8(0101,4),             B8(0011,4),     B8(01011,5) },          /* IDLE */
-       {       B8(1111111,7),  B8(011,3),              B8(00111,5),            B8(01,2),               B8(001111,6),   B8(0101111,7) },        /* DRSHIFT */
-       {       B8(1111111,7),  B8(011,3),              B8(01,2),               B8(0,1),                B8(001111,6),   B8(0101111,7) },        /* DRPAUSE */
-       {       B8(1111111,7),  B8(011,3),              B8(00111,5),            B8(010111,6),   B8(001111,6),   B8(01,2) },                     /* IRSHIFT */
-       {       B8(1111111,7),  B8(011,3),              B8(00111,5),            B8(010111,6),   B8(01,2),               B8(0,1) }                       /* IRPAUSE */
+       /*      RESET                   IDLE                    DRSHIFT                 DRPAUSE                 IRSHIFT                 IRPAUSE */                      /* from state: */
+       {       B8(1111111,7),  B8(0000000,7),  B8(0010111,7),  B8(0001010,7),  B8(0011011,7),  B8(0010110,7) },        /* RESET */
+       {       B8(1111111,7),  B8(0000000,7),  B8(001,3),              B8(0101,4),             B8(0011,4),             B8(01011,5) },          /* IDLE */
+       {       B8(1111111,7),  B8(011,3),              B8(00111,5),    B8(01,2),               B8(001111,6),   B8(0101111,7) },        /* DRSHIFT */
+       {       B8(1111111,7),  B8(011,3),              B8(01,2),               B8(0,1),                B8(001111,6),   B8(0101111,7) },        /* DRPAUSE */
+       {       B8(1111111,7),  B8(011,3),              B8(00111,5),    B8(010111,6),   B8(001111,6),   B8(01,2) },                     /* IRSHIFT */
+       {       B8(1111111,7),  B8(011,3),              B8(00111,5),    B8(010111,6),   B8(01,2),               B8(0,1)}                        /* IRPAUSE */
 
 };
 
@@ -359,6 +365,10 @@ tap_state_t tap_state_by_name(const char *name)
 {
        tap_state_t x;
 
+       /* standard SVF name is "IDLE" */
+       if (0 == strcasecmp(name, "IDLE"))
+               return TAP_IDLE;
+
        for (x = 0 ; x < TAP_NUM_STATES ; x++) {
                /* be nice to the human */
                if (0 == strcasecmp(name, tap_state_name(x))) {

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)