begin moving JTAG jim handlers/helpers
[openocd.git] / src / jtag / presto.c
index 154e3e1758df1048df362e5ce96fb2a60bc1874b..f4e689c2a527f7eb229ab517c184c362e518b88e 100644 (file)
 #error "BUG: either FTD2XX and LIBFTDI has to be used"
 #endif
 
-static int presto_jtag_speed(int speed);
-static int presto_jtag_khz(int khz, int *jtag_speed);
-static int presto_jtag_speed_div(int speed, int *khz);
-static int presto_jtag_register_commands(struct command_context_s *cmd_ctx);
-static int presto_jtag_init(void);
-static int presto_jtag_quit(void);
-
-struct jtag_interface presto_interface =
-{
-       .name = "presto",
-       .execute_queue = bitq_execute_queue,
-       .speed = presto_jtag_speed,
-       .khz = presto_jtag_khz,
-       .speed_div = presto_jtag_speed_div,
-       .register_commands = presto_jtag_register_commands,
-       .init = presto_jtag_init,
-       .quit = presto_jtag_quit,
-};
-
-static int presto_bitq_out(int tms, int tdi, int tdo_req);
-static int presto_bitq_flush(void);
-static int presto_bitq_sleep(unsigned long us);
-static int presto_bitq_reset(int trst, int srst);
-static int presto_bitq_in_rdy(void);
-static int presto_bitq_in(void);
-
-static struct bitq_interface presto_bitq =
-{
-       .out = presto_bitq_out,
-       .flush = presto_bitq_flush,
-       .sleep = presto_bitq_sleep,
-       .reset = presto_bitq_reset,
-       .in_rdy = presto_bitq_in_rdy,
-       .in = presto_bitq_in,
-};
-
 /* -------------------------------------------------------------------------- */
 
 #define FT_DEVICE_NAME_LEN 64
@@ -699,6 +663,15 @@ static int presto_bitq_reset(int trst, int srst)
        return 0;
 }
 
+static struct bitq_interface presto_bitq = {
+               .out = &presto_bitq_out,
+               .flush = &presto_bitq_flush,
+               .sleep = &presto_bitq_sleep,
+               .reset = &presto_bitq_reset,
+               .in_rdy = &presto_bitq_in_rdy,
+               .in = &presto_bitq_in,
+       };
+
 /* -------------------------------------------------------------------------- */
 
 static int presto_jtag_khz(int khz, int *jtag_speed)
@@ -752,11 +725,11 @@ static char *presto_serial;
 
 COMMAND_HANDLER(presto_handle_serial_command)
 {
-       if (argc == 1)
+       if (CMD_ARGC == 1)
        {
                if (presto_serial)
                        free(presto_serial);
-               presto_serial = strdup(args[0]);
+               presto_serial = strdup(CMD_ARGV[0]);
        }
        else
        {
@@ -766,12 +739,16 @@ COMMAND_HANDLER(presto_handle_serial_command)
        return ERROR_OK;
 }
 
-static int presto_jtag_register_commands(struct command_context_s *cmd_ctx)
-{
-       register_command(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command,
-               COMMAND_CONFIG, NULL);
-       return ERROR_OK;
-}
+static const struct command_registration presto_command_handlers[] = {
+       {
+               .name = "presto_serial",
+               .handler = &presto_handle_serial_command,
+               .mode = COMMAND_CONFIG,
+               .help = "configure serial port",
+               .usage = "<devname>",
+       },
+       COMMAND_REGISTRATION_DONE
+};
 
 static int presto_jtag_init(void)
 {
@@ -807,3 +784,17 @@ static int presto_jtag_quit(void)
 
        return ERROR_OK;
 }
+
+struct jtag_interface presto_interface = {
+               .name = "presto",
+
+               .commands = presto_command_handlers,
+
+               .execute_queue = &bitq_execute_queue,
+               .speed = &presto_jtag_speed,
+               .khz = &presto_jtag_khz,
+               .speed_div = &presto_jtag_speed_div,
+
+               .init = &presto_jtag_init,
+               .quit = &presto_jtag_quit,
+       };

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)