use ARRAY_SIZE macro
[openocd.git] / src / jtag / tcl.c
index 6b420211c0d2ec815bd845cd4e26cd953b6f994c..e755dd7ef2b7ff983bf892f26ead0b128dd9643c 100644 (file)
@@ -1304,7 +1304,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
 {
        tap_state_t states[8];
 
-       if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states) + 1)))
+       if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1)))
        {
                Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
                return JIM_ERR;
@@ -1529,26 +1529,37 @@ static const struct command_registration jtag_command_handlers[] = {
                .help = "choose short(default) or long tms_sequence",
                .usage = "<short | long>",
        },
+       // jim commands
+       {
+               .name = "jtag",
+               .mode = COMMAND_ANY,
+               .jim_handler = &jim_jtag_command,
+               .help = "perform jtag tap actions",
+       },
+       {
+               .name = "drscan",
+               .mode = COMMAND_EXEC,
+               .jim_handler = &Jim_Command_drscan,
+               .help = "execute DR scan <device> "
+                       "<num_bits> <value> <num_bits1> <value2> ...",
+       },
+       {
+               .name = "flush_count",
+               .mode = COMMAND_EXEC,
+               .jim_handler = &Jim_Command_flush_count,
+               .help = "returns number of times the JTAG queue has been flushed",
+       },
+       {
+               .name = "pathmove",
+               .mode = COMMAND_EXEC,
+               .jim_handler = &Jim_Command_pathmove,
+               .usage = "<state1>,<state2>,<state3>... ",
+               .help = "move JTAG to state1 then to state2, state3, etc.",
+       },
        COMMAND_REGISTRATION_DONE
 };
 
 int jtag_register_commands(struct command_context *cmd_ctx)
 {
-       register_jim(cmd_ctx, "jtag", jim_jtag_command,
-                       "perform jtag tap actions");
-
-       register_jim(cmd_ctx, "drscan", Jim_Command_drscan,
-                       "execute DR scan <device> "
-                       "<num_bits> <value> <num_bits1> <value2> ...");
-
-       register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count,
-                       "returns number of times the JTAG queue has been flushed");
-
-       register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove,
-                       "<state1>,<state2>,<state3>... "
-                       "- move JTAG to state1 then to state2, state3, etc.");
-
        return register_commands(cmd_ctx, NULL, jtag_command_handlers);
 }
-
-

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)