This is an automated email from Gerrit.

"Name of user not set <kai.schm...@advantest.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7433

-- gerrit

commit e3491f642b032668065b01e71412143af592db5b
Author: Kai Schmitz <kai.schm...@advantest.com>
Date:   Thu Jan 5 13:50:53 2023 +0100

    svf: new command line options -noreset and -addcycles
    
    -noreset: when using several SVF input files in a sequence it is not always 
desireable to have
     a JTAG reset between the execution of the files. The -noreset option skips 
this unwanted reset
    
    -addcycles <x>: some tests rely on a certain number of extra clock cycles 
between the actual JTAG
     commands. The -addcycles option injects a number x cycles after each SDR 
instruction
    
    Signed-off-by: Kai Schmitz <kai.schm...@advantest.com>
    Change-Id: I31932d6041dbc803be00016cd0a4f23fb2e7dbe1

diff --git a/doc/openocd.texi b/doc/openocd.texi
index d8a5e86b42..2b890bb5aa 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -11426,7 +11426,8 @@ In a debug session using JTAG for its transport 
protocol,
 OpenOCD supports running such test files.
 
 @deffn {Command} {svf} @file{filename} [@option{-tap @var{tapname}}] 
[@option{[-]quiet}] @
-                     [@option{[-]nil}] [@option{[-]progress}] 
[@option{[-]ignore_error}]
+                     [@option{[-]nil}] [@option{[-]progress}] 
[@option{[-]ignore_error}] @
+                     [@option{[-]noreset}] [@option{-addcycles 
@var{cyclecount}}]
 This issues a JTAG reset (Test-Logic-Reset) and then
 runs the SVF script from @file{filename}.
 
@@ -11445,6 +11446,10 @@ on the real interface;
 @item @option{[-]progress} enable progress indication;
 @item @option{[-]ignore_error} continue execution despite TDO check
 errors.
+@item @option{[-]noreset} ommit JTAG reset (Test-Logic-Reset) before executing
+content of the SVF file;
+@item @option{-addcycles @var{cyclecount}} inject @var{cyclecount} number of
+additional TCLK cycles after each SDR scan instruction;
 @end itemize
 @end deffn
 
diff --git a/src/svf/svf.c b/src/svf/svf.c
index a5374316ea..0f253f486b 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -139,6 +139,9 @@ static const struct svf_statemove svf_statemoves[] = {
 #define XXR_TDO                                (1 << 1)
 #define XXR_MASK                       (1 << 2)
 #define XXR_SMASK                      (1 << 3)
+
+#define SVF_MAX_ADDCYCLES      255
+
 struct svf_xxr_para {
        int len;
        int data_mask;
@@ -220,6 +223,8 @@ static int svf_buffer_index, svf_buffer_size;
 static int svf_quiet;
 static int svf_nil;
 static int svf_ignore_error;
+static int svf_noreset;
+static int svf_addcycles;
 
 /* Targeting particular tap */
 static int svf_tap_is_specified;
@@ -343,7 +348,7 @@ int svf_add_statemove(tap_state_t state_to)
 COMMAND_HANDLER(handle_svf_command)
 {
 #define SVF_MIN_NUM_OF_OPTIONS 1
-#define SVF_MAX_NUM_OF_OPTIONS 5
+#define SVF_MAX_NUM_OF_OPTIONS 8
        int command_num = 0;
        int ret = ERROR_OK;
        int64_t time_measure_ms;
@@ -363,8 +368,18 @@ COMMAND_HANDLER(handle_svf_command)
        svf_nil = 0;
        svf_progress_enabled = 0;
        svf_ignore_error = 0;
+       svf_noreset = 0;
+       svf_addcycles = 0;
+
        for (unsigned int i = 0; i < CMD_ARGC; i++) {
-               if (strcmp(CMD_ARGV[i], "-tap") == 0) {
+               if (strcmp(CMD_ARGV[i], "-addcycles") == 0) {
+                       svf_addcycles = atoi(CMD_ARGV[i+1]);
+                       if (svf_addcycles > SVF_MAX_ADDCYCLES) {
+                               command_print(CMD, "addcycles: %s out of 
range", CMD_ARGV[i+1]);
+                               return ERROR_FAIL;
+                       }
+                       i++;
+               } else if (strcmp(CMD_ARGV[i], "-tap") == 0) {
                        tap = jtag_tap_by_string(CMD_ARGV[i+1]);
                        if (!tap) {
                                command_print(CMD, "Tap: %s unknown", 
CMD_ARGV[i+1]);
@@ -382,6 +397,9 @@ COMMAND_HANDLER(handle_svf_command)
                else if ((strcmp(CMD_ARGV[i],
                                  "ignore_error") == 0) || (strcmp(CMD_ARGV[i], 
"-ignore_error") == 0))
                        svf_ignore_error = 1;
+               else if ((strcmp(CMD_ARGV[i],
+                                 "noreset") == 0) || (strcmp(CMD_ARGV[i], 
"-noreset") == 0))
+                       svf_noreset = 1;
                else {
                        svf_fd = fopen(CMD_ARGV[i], "r");
                        if (!svf_fd) {
@@ -424,7 +442,7 @@ COMMAND_HANDLER(handle_svf_command)
 
        memcpy(&svf_para, &svf_para_init, sizeof(svf_para));
 
-       if (!svf_nil) {
+       if (!svf_nil && !svf_noreset) {
                /* TAP_RESET */
                jtag_add_tlr();
        }
@@ -1189,6 +1207,10 @@ xxr_common:
                                                        svf_para.dr_end_state);
                                }
 
+                               if (svf_addcycles) {
+                                       jtag_add_clocks(svf_addcycles);
+                               }
+
                                svf_buffer_index += (i + 7) >> 3;
                        } else if (command == SIR) {
                                /* check buffer size first, reallocate if 
necessary */

-- 

Reply via email to