bcm2835gpio: Fix incorrect GPIO validation
[openocd.git] / src / jtag / tcl.c
index 2355babf0602a9c71d53d9d13ba48aa341ab9934..e6e976d77d0ab05f08b5088e46273faed2588fc5 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 #endif
 
+#include "adapter.h"
 #include "jtag.h"
 #include "swd.h"
 #include "minidriver.h"
@@ -62,9 +63,9 @@ struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
 {
        const char *cp = Jim_GetString(o, NULL);
        struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL;
-       if (NULL == cp)
+       if (!cp)
                cp = "(unknown)";
-       if (NULL == t)
+       if (!t)
                Jim_SetResultFormatted(interp, "Tap '%s' could not be found", cp);
        return t;
 }
@@ -162,7 +163,7 @@ static int jim_command_drscan(Jim_Interp *interp, int argc, Jim_Obj * const *arg
        assert(e == JIM_OK);
 
        tap = jtag_tap_by_jim_obj(interp, args[1]);
-       if (tap == NULL)
+       if (!tap)
                return JIM_ERR;
 
        num_fields = (argc-2)/2;
@@ -362,7 +363,7 @@ static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap
        if (goi->isconfigure) {
                if (!found)
                        jteap = calloc(1, sizeof(*jteap));
-               else if (NULL != jteap->body)
+               else if (jteap->body)
                        Jim_DecrRefCount(goi->interp, jteap->body);
 
                jteap->interp = goi->interp;
@@ -469,6 +470,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 +533,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 +619,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 +646,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;
 
@@ -769,7 +775,7 @@ int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        struct jtag_tap *t;
 
        t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]);
-       if (t == NULL)
+       if (!t)
                return JIM_ERR;
 
        if (strcasecmp(cmd_name, "tapisenabled") == 0) {
@@ -811,7 +817,7 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        Jim_Obj *o;
        jim_getopt_obj(&goi, &o);
        t = jtag_tap_by_jim_obj(goi.interp, o);
-       if (t == NULL)
+       if (!t)
                return JIM_ERR;
 
        return jtag_tap_configure_cmd(&goi, t);
@@ -886,6 +892,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
                        "['-enable'|'-disable'] "
                        "['-expected_id' number] "
                        "['-ignore-version'] "
+                       "['-ignore-bypass'] "
                        "['-ircapture' number] "
                        "['-mask' number]",
        },
@@ -1040,13 +1047,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;
 
@@ -1122,7 +1129,7 @@ COMMAND_HANDLER(handle_irscan_command)
        int retval;
        for (i = 0; i < num_fields; i++) {
                tap = jtag_tap_by_string(CMD_ARGV[i*2]);
-               if (tap == NULL) {
+               if (!tap) {
                        free(fields);
                        command_print(CMD, "Tap: %s unknown", CMD_ARGV[i*2]);
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)