jtag_vpi: fixed state transitions in "stableclocks" 51/5151/3
authorJan Matyas <matyas@codasip.com>
Mon, 6 May 2019 05:20:33 +0000 (07:20 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 14 May 2019 19:50:19 +0000 (20:50 +0100)
In jtag_vpi_stableclocks() the TMS line needs to be set properly
based on the current JTAG TAP state (TMS=1 in TAP_RESET state vs.
TMS=0 in other cases).

Change-Id: Id49622ba83015f97b61b6a896edde4448f1fbdc6
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/5151
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/jtag/drivers/jtag_vpi.c

index c69f24fd0629ff5d90e6b789d125dd579b85f1b6..1033cedb28c95a18a38483afee01b2ebd9100a46 100644 (file)
@@ -328,7 +328,27 @@ static int jtag_vpi_runtest(int cycles, tap_state_t state)
 
 static int jtag_vpi_stableclocks(int cycles)
 {
-       return jtag_vpi_queue_tdi(NULL, cycles, TAP_SHIFT);
+       uint8_t tms_bits[4];
+       int cycles_remain = cycles;
+       int nb_bits;
+       int retval;
+       const int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8;
+
+       assert(cycles >= 0);
+
+       /* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
+       memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));
+
+       /* send the TMS bits */
+       while (cycles_remain > 0) {
+               nb_bits = (cycles_remain < CYCLES_ONE_BATCH) ? cycles_remain : CYCLES_ONE_BATCH;
+               retval = jtag_vpi_tms_seq(tms_bits, nb_bits);
+               if (retval != ERROR_OK)
+                       return retval;
+               cycles_remain -= nb_bits;
+       }
+
+       return ERROR_OK;
 }
 
 static int jtag_vpi_execute_queue(void)

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)