openocd: fix SPDX tag format for files .c
[fw/openocd] / src / jtag / tcl.c
index af2f149b09d9627453a01adf5a8b01039817a4e8..b1815b79da7d0796d4dbecc46d19f171be7caa77 100644 (file)
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /***************************************************************************
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
  *   Copyright (C) 2009 Zachary T Welch                                    *
  *   zw@superlucidity.net                                                  *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include "adapter.h"
 #include "jtag.h"
 #include "swd.h"
 #include "minidriver.h"
@@ -469,6 +459,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi
 #define NTAP_OPT_DISABLED  4
 #define NTAP_OPT_EXPECTED_ID 5
 #define NTAP_OPT_VERSION   6
+#define NTAP_OPT_BYPASS    7
 
 static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
        struct jtag_tap *tap)
@@ -531,6 +522,7 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
                { .name = "-disable",       .value = NTAP_OPT_DISABLED },
                { .name = "-expected-id",       .value = NTAP_OPT_EXPECTED_ID },
                { .name = "-ignore-version",       .value = NTAP_OPT_VERSION },
+               { .name = "-ignore-bypass",       .value = NTAP_OPT_BYPASS },
                { .name = NULL,       .value = -1 },
        };
 
@@ -616,6 +608,9 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
                    case NTAP_OPT_VERSION:
                            tap->ignore_version = true;
                            break;
+                   case NTAP_OPT_BYPASS:
+                           tap->ignore_bypass = true;
+                           break;
                }       /* switch (n->value) */
        }       /* while (goi->argc) */
 
@@ -640,7 +635,7 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
        struct jtag_tap_event_action *jteap;
        int retval;
 
-       for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) {
+       for (jteap = tap->event_action; jteap; jteap = jteap->next) {
                if (jteap->event != e)
                        continue;
 
@@ -886,6 +881,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
                        "['-enable'|'-disable'] "
                        "['-expected_id' number] "
                        "['-ignore-version'] "
+                       "['-ignore-bypass'] "
                        "['-ircapture' number] "
                        "['-mask' number]",
        },
@@ -1040,13 +1036,13 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
                unsigned khz = 0;
                COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
 
-               retval = jtag_config_rclk(khz);
+               retval = adapter_config_rclk(khz);
                if (retval != ERROR_OK)
                        return retval;
        }
 
-       int cur_khz = jtag_get_speed_khz();
-       retval = jtag_get_speed_readable(&cur_khz);
+       int cur_khz = adapter_get_speed_khz();
+       retval = adapter_get_speed_readable(&cur_khz);
        if (retval != ERROR_OK)
                return retval;