From 796483f61f02a6e3959871b1a91b7d3d0f905d57 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sun, 9 Jan 2022 15:38:37 +0100 Subject: [PATCH] jtag: fix shiftIR: bypass_after must be computed in all case --- src/jtag.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jtag.cpp b/src/jtag.cpp index c95577e..9970772 100644 --- a/src/jtag.cpp +++ b/src/jtag.cpp @@ -307,6 +307,14 @@ int Jtag::shiftIR(unsigned char *tdi, unsigned char *tdo, int irlen, int end_sta { display("%s: avant shiftIR\n", __func__); int bypass_after = 0; + if (end_state != SHIFT_IR) { + /* when the device is not alone and not + * the first a serie of bypass must be + * send to complete send ir sequence + */ + for (int i = 0; i < device_index; i++) + bypass_after += _irlength_list[i]; + } /* if not in SHIFT IR move to this state */ if (_state != SHIFT_IR) { @@ -321,10 +329,6 @@ int Jtag::shiftIR(unsigned char *tdi, unsigned char *tdo, int irlen, int end_sta int bypass_before = 0; for (unsigned int i = device_index + 1; i < _devices_list.size(); i++) bypass_before += _irlength_list[i]; - /* same for device after targeted device - */ - for (int i = 0; i < device_index; i++) - bypass_after += _irlength_list[i]; /* if > 0 send bits */ if (bypass_before > 0) {