From b873eb29f3db273033d73111bcc09808396a50c9 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Mon, 26 Jun 2023 18:47:16 +0200 Subject: [PATCH] BMD: Fix wrong calculation in TDI --- src/bmd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bmd.cpp b/src/bmd.cpp index f125c1b..e203b4e 100644 --- a/src/bmd.cpp +++ b/src/bmd.cpp @@ -193,9 +193,9 @@ void Bmd::remote_v0_jtag_tdi_tdo_seq(uint8_t *data_out, bool final_tms, const ui /* Loop through the data to send/receive and handle it in chunks of up to 32 bits */ for (size_t cycle = 0; cycle < clock_cycles; cycle += 32U) { /* Calculate how many bits need to be in this chunk, capped at 32 */ - const size_t chunk_length = clock_cycles - cycle; - if (clock_cycles > 32U) - clock_cycles = 32U; + size_t chunk_length = clock_cycles - cycle; + if (chunk_length > 32U) + chunk_length = 32U; /* If the result would complete the transaction, check if TMS needs to be high at the end */ const char packet_type = cycle + chunk_length == clock_cycles && final_tms ? REMOTE_TDITDO_TMS : REMOTE_TDITDO_NOTMS;