This is an automated email from Gerrit.

Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/6116

-- gerrit

commit 303e6e5d2c2fa7478d82625d65836f931af3ace3
Author: Tomas Vanek <[email protected]>
Date:   Fri Mar 19 15:50:57 2021 +0100

    swd multidrop: fix TAP configuration
    
    http://openocd.zylin.com/4935 recognizes 2 new multidrop related parameters
    in TAP configuration. They are processed only if SWD is selected and the
    processing breaks on old JTAG related parameters.
    
    Move all parameters processing to one loop and run it independently of
    selected transport.
    
    Change-Id: Ie87e46a549817432211906db6d8ba2aa3f714f92
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 3f4a58d..bbfd982 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -609,48 +609,8 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
        LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
                pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
 
-       if (!transport_is_jtag()) {
-           bool target_id_specified = false;
-           bool instance_id_specified = false;
-               while (goi->argc) {
-                       e = Jim_GetOpt_Nvp(goi, opts, &n);
-                       if (e != JIM_OK) {
-                               Jim_GetOpt_NvpUnknown(goi, opts, 0);
-                               free(cp);
-                               free(pTap);
-                               return e;
-                       }
-                       LOG_DEBUG("Processing option: %s", n->name);
-                       switch (n->value) {
-                               case NTAP_OPT_DP_ID:
-                                       target_id_specified = true;
-                                       e = jim_newtap_md_param(n, goi, pTap);
-                                       break;
-                               case NTAP_OPT_INSTANCE_ID:
-                                       instance_id_specified = true;
-                                       e = jim_newtap_md_param(n, goi, pTap);
-                                       break;
-                               default:
-                                       e = JIM_OK;
-                                       break;
-                       } /* switch (n->value) */
-                       if (JIM_OK != e) {
-                               free(cp);
-                               free(pTap);
-                               return e;
-                       }
-               }       /* while (goi->argc) */
-
-               if (instance_id_specified != target_id_specified) {
-                       LOG_ERROR("%s: -dp-id and -instance-id must both be 
specified", pTap->dotted_name);
-                       free(cp);
-                       free(pTap);
-                       return JIM_ERR;
-               }
-               pTap->enabled = true;
-               jtag_tap_init(pTap);
-               return JIM_OK;
-       }
+       bool target_id_specified = false;
+       bool instance_id_specified = false;
 
        /* IEEE specifies that the two LSBs of an IR scan are 01, so make
         * that the default.  The "-ircapture" and "-irmask" options are only
@@ -696,9 +656,29 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
                    case NTAP_OPT_VERSION:
                            pTap->ignore_version = true;
                            break;
+                       case NTAP_OPT_DP_ID:
+                               target_id_specified = true;
+                               e = jim_newtap_md_param(n, goi, pTap);
+                               break;
+                       case NTAP_OPT_INSTANCE_ID:
+                               instance_id_specified = true;
+                               e = jim_newtap_md_param(n, goi, pTap);
+                               break;
                }       /* switch (n->value) */
        }       /* while (goi->argc) */
 
+       if (!transport_is_jtag()) {
+               if (instance_id_specified != target_id_specified) {
+                       LOG_ERROR("%s: -dp-id and -instance-id must both be 
specified", pTap->dotted_name);
+                       free(cp);
+                       free(pTap);
+                       return JIM_ERR;
+               }
+               pTap->enabled = true;
+               jtag_tap_init(pTap);
+               return JIM_OK;
+       }
+
        /* default is enabled-after-reset */
        pTap->enabled = !pTap->disabled_after_reset;
 

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to