jtag/mpsse: mpsse_flush should not treat LIBUSB_ERROR_INTERRUPTED as an error
[openocd.git] / src / jtag / drivers / jtag_vpi.c
index 0fc688edf2bc9c2917a9a0807e46af824a4edb04..c2b3b08083f9f24af15575d48a49ab7eec4c90c5 100644 (file)
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  * JTAG to VPI driver
  *
@@ -5,19 +7,6 @@
  *
  * See file CREDITS for list of people who contributed to this
  * project.
- *
- * 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
@@ -38,8 +27,8 @@
 #define NO_TAP_SHIFT   0
 #define TAP_SHIFT      1
 
-#define SERVER_ADDRESS "127.0.0.1"
-#define SERVER_PORT    5555
+#define DEFAULT_SERVER_ADDRESS "127.0.0.1"
+#define DEFAULT_SERVER_PORT    5555
 
 #define        XFERT_MAX_SIZE          512
 
@@ -50,7 +39,7 @@
 #define CMD_STOP_SIMU          4
 
 /* jtag_vpi server port and address to connect to */
-static int server_port = SERVER_PORT;
+static int server_port = DEFAULT_SERVER_PORT;
 static char *server_address;
 
 /* Send CMD_STOP_SIMU to server when OpenOCD exits? */
@@ -551,7 +540,7 @@ static int jtag_vpi_init(void)
        serv_addr.sin_port = htons(server_port);
 
        if (!server_address)
-               server_address = strdup(SERVER_ADDRESS);
+               server_address = strdup(DEFAULT_SERVER_ADDRESS);
 
        serv_addr.sin_addr.s_addr = inet_addr(server_address);
 
@@ -605,38 +594,33 @@ static int jtag_vpi_quit(void)
 COMMAND_HANDLER(jtag_vpi_set_port)
 {
        if (CMD_ARGC == 0)
-               LOG_WARNING("You need to set a port number");
-       else
-               COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], server_port);
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
-       LOG_INFO("Set server port to %u", server_port);
+       COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], server_port);
+       LOG_INFO("jtag_vpi: server port set to %u", server_port);
 
        return ERROR_OK;
 }
 
 COMMAND_HANDLER(jtag_vpi_set_address)
 {
-       free(server_address);
 
-       if (CMD_ARGC == 0) {
-               LOG_WARNING("You need to set an address");
-               server_address = strdup(SERVER_ADDRESS);
-       } else
-               server_address = strdup(CMD_ARGV[0]);
+       if (CMD_ARGC == 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
-       LOG_INFO("Set server address to %s", server_address);
+       free(server_address);
+       server_address = strdup(CMD_ARGV[0]);
+       LOG_INFO("jtag_vpi: server address set to %s", server_address);
 
        return ERROR_OK;
 }
 
 COMMAND_HANDLER(jtag_vpi_stop_sim_on_exit_handler)
 {
-       if (CMD_ARGC != 1) {
-               LOG_ERROR("jtag_vpi_stop_sim_on_exit expects 1 argument (on|off)");
+       if (CMD_ARGC != 1)
                return ERROR_COMMAND_SYNTAX_ERROR;
-       } else {
-               COMMAND_PARSE_ON_OFF(CMD_ARGV[0], stop_sim_on_exit);
-       }
+
+       COMMAND_PARSE_ON_OFF(CMD_ARGV[0], stop_sim_on_exit);
        return ERROR_OK;
 }
 
@@ -645,14 +629,14 @@ static const struct command_registration jtag_vpi_subcommand_handlers[] = {
                .name = "set_port",
                .handler = &jtag_vpi_set_port,
                .mode = COMMAND_CONFIG,
-               .help = "set the port of the VPI server",
+               .help = "set the TCP port number of the jtag_vpi server (default: 5555)",
                .usage = "tcp_port_num",
        },
        {
                .name = "set_address",
                .handler = &jtag_vpi_set_address,
                .mode = COMMAND_CONFIG,
-               .help = "set the address of the VPI server",
+               .help = "set the IP address of the jtag_vpi server (default: 127.0.0.1)",
                .usage = "ipv4_addr",
        },
        {

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)