This is an automated email from Gerrit.

"N S <nlsh...@yahoo.com>" just uploaded a new patch set to Gerrit, which you 
can find at https://review.openocd.org/c/openocd/+/8101

-- gerrit

commit d6f4af61b623e94857d35f467f0fbf1d341b5962
Author: N S <nlsh...@yahoo.com>
Date:   Sun Jan 22 21:34:16 2023 -0800

    jtag/drivers: OpenJTAG standard variant perf improvement
    
    Calculate exact size of response expected from OpenJTAG device so that
    openjtag_buf_read_standard doesn't spend 5 retry cycles waiting for
    data that isn't coming.
    
    Change-Id: Icd010d1fa4453d6592a1f9aed93fb1f01e0a19da
    Signed-off-by: N S <nlsh...@yahoo.com>

diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c
index dca27b0a64..eb5911a316 100644
--- a/src/jtag/drivers/openjtag.c
+++ b/src/jtag/drivers/openjtag.c
@@ -530,9 +530,20 @@ static int openjtag_quit(void)
 static void openjtag_write_tap_buffer(void)
 {
        uint32_t written;
+       uint32_t rx_expected = 0;
+
+       /* calculate expected number of return bytes */
+       for (int tx_offs = 0; tx_offs < usb_tx_buf_offs; tx_offs++) {
+               if ((usb_tx_buf[tx_offs] & 0x0F) == 6) {
+                       rx_expected++;
+                       tx_offs++;
+               } else if ((usb_tx_buf[tx_offs] & 0x0F) == 2) {
+                       rx_expected++;
+               }
+       }
 
        openjtag_buf_write(usb_tx_buf, usb_tx_buf_offs, &written);
-       openjtag_buf_read(usb_rx_buf, usb_tx_buf_offs, &usb_rx_buf_len);
+       openjtag_buf_read(usb_rx_buf, rx_expected, &usb_rx_buf_len);
 
        usb_tx_buf_offs = 0;
 }

-- 

Reply via email to