From 20285b91008106c9fa966cea3269c6f6a81e539a Mon Sep 17 00:00:00 2001 From: N S Date: Fri, 23 Dec 2022 16:59:18 -0800 Subject: [PATCH] jtag/drivers/openjtag: fix annoying num_cycles > 16 warning The OpenJTAG driver logs "num_cycles > 16 on run test" warning whenever the JTAG_RUNTEST operation cycle count is larger than 16. Instead of logging the warning and only running the first 16 TCLK cycles, remove the warning and queue up multiple operations of up to 16 cycles each. Signed-off-by: N S Change-Id: Id405fa802ff1cf3db7a21e76bd6df0c2d3a0fe61 Reviewed-on: https://review.openocd.org/c/openocd/+/7420 Tested-by: jenkins Reviewed-by: Jonathan McDowell Reviewed-by: Antonio Borneo --- src/jtag/drivers/openjtag.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c index 6be950718..12ea46330 100644 --- a/src/jtag/drivers/openjtag.c +++ b/src/jtag/drivers/openjtag.c @@ -742,16 +742,18 @@ static void openjtag_execute_runtest(struct jtag_command *cmd) tap_set_state(TAP_IDLE); } - if (cmd->cmd.runtest->num_cycles > 16) - LOG_WARNING("num_cycles > 16 on run test"); - if (openjtag_variant != OPENJTAG_VARIANT_CY7C65215 || cmd->cmd.runtest->num_cycles) { uint8_t command; - command = 7; - command |= ((cmd->cmd.runtest->num_cycles - 1) & 0x0F) << 4; + int cycles = cmd->cmd.runtest->num_cycles; - openjtag_add_byte(command); + do { + command = 7; + command |= (((cycles > 16 ? 16 : cycles) - 1) & 0x0F) << 4; + + openjtag_add_byte(command); + cycles -= 16; + } while (cycles > 0); } tap_set_end_state(end_state);