Documentation: fix warning "unbalanced square brackets"
[openocd.git] / src / jtag / drivers / usb_blaster / usb_blaster.c
index c312468b41b954dcf1b2806c60f1b6e80a1cc932..c84055c4a1cea7bc2b3cdf4dcc6dc080a0fbbdb9 100644 (file)
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  *   Driver for USB-JTAG, Altera USB-Blaster and compatibles
  *
  *   Copyright (C) 2009 Catalin Patulea cat@vv.carleton.ca
  *   Copyright (C) 2006 Kolja Waschk usbjtag@ixo.de
  *
- *   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/>.
- *
  */
 
 /*
@@ -119,7 +108,6 @@ struct ublast_info {
 
        char *lowlevel_name;
        struct ublast_lowlevel *drv;
-       char *ublast_device_desc;
        uint16_t ublast_vid, ublast_pid;
        uint16_t ublast_vid_uninit, ublast_pid_uninit;
        int flags;
@@ -140,7 +128,7 @@ static struct ublast_info info = {
 };
 
 /*
- * Available lowlevel drivers (FTDI, FTD2xx, ...)
+ * Available lowlevel drivers (FTDI, libusb, ...)
  */
 struct drvs_map {
        char *name;
@@ -561,8 +549,8 @@ static int ublast_read_byteshifted_tdos(uint8_t *buf, int nb_bytes)
  *  - first bit is stored in byte0, bit0 (LSB)
  *  - second bit is stored in byte0, bit 1
  *  ...
- *  - eight bit is sotred in byte0, bit 7
- *  - ninth bit is sotred in byte1, bit 0
+ *  - eight bit is stored in byte0, bit 7
+ *  - ninth bit is stored in byte1, bit 0
  *  - etc ...
  *
  * Returns ERROR_OK if OK, ERROR_xxx if a read error occurred
@@ -777,7 +765,7 @@ static void ublast_initial_wipeout(void)
        tap_set_state(TAP_RESET);
 }
 
-static int ublast_execute_queue(void)
+static int ublast_execute_queue(struct jtag_command *cmd_queue)
 {
        struct jtag_command *cmd;
        static int first_call = 1;
@@ -788,7 +776,7 @@ static int ublast_execute_queue(void)
                ublast_initial_wipeout();
        }
 
-       for (cmd = jtag_command_queue; ret == ERROR_OK && cmd != NULL;
+       for (cmd = cmd_queue; ret == ERROR_OK && cmd;
             cmd = cmd->next) {
                switch (cmd->type) {
                case JTAG_RESET:
@@ -874,7 +862,6 @@ static int ublast_init(void)
        info.drv->ublast_pid = info.ublast_pid;
        info.drv->ublast_vid_uninit = info.ublast_vid_uninit;
        info.drv->ublast_pid_uninit = info.ublast_pid_uninit;
-       info.drv->ublast_device_desc = info.ublast_device_desc;
        info.drv->firmware_path = info.firmware_path;
 
        info.flags |= info.drv->flags;
@@ -908,16 +895,6 @@ static int ublast_quit(void)
        return info.drv->close(info.drv);
 }
 
-COMMAND_HANDLER(ublast_handle_device_desc_command)
-{
-       if (CMD_ARGC != 1)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       info.ublast_device_desc = strdup(CMD_ARGV[0]);
-
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(ublast_handle_vid_pid_command)
 {
        if (CMD_ARGC > 4) {
@@ -1030,16 +1007,9 @@ COMMAND_HANDLER(ublast_firmware_command)
 }
 
 
-static const struct command_registration ublast_command_handlers[] = {
-       {
-               .name = "usb_blaster_device_desc",
-               .handler = ublast_handle_device_desc_command,
-               .mode = COMMAND_CONFIG,
-               .help = "set the USB device description of the USB-Blaster",
-               .usage = "description-string",
-       },
+static const struct command_registration ublast_subcommand_handlers[] = {
        {
-               .name = "usb_blaster_vid_pid",
+               .name = "vid_pid",
                .handler = ublast_handle_vid_pid_command,
                .mode = COMMAND_CONFIG,
                .help = "the vendor ID and product ID of the USB-Blaster and "
@@ -1048,21 +1018,21 @@ static const struct command_registration ublast_command_handlers[] = {
                .usage = "vid pid vid_uninit pid_uninit",
        },
        {
-               .name = "usb_blaster_lowlevel_driver",
+               .name = "lowlevel_driver",
                .handler = ublast_handle_lowlevel_drv_command,
                .mode = COMMAND_CONFIG,
                .help = "set the lowlevel access for the USB Blaster (ftdi, ublast2)",
                .usage = "(ftdi|ublast2)",
        },
        {
-               .name = "usb_blaster_pin",
+               .name = "pin",
                .handler = ublast_handle_pin_command,
                .mode = COMMAND_ANY,
                .help = "show or set pin state for the unused GPIO pins",
                .usage = "(pin6|pin8) (0|1|s|t)",
        },
                {
-               .name = "usb_blaster_firmware",
+               .name = "firmware",
                .handler = &ublast_firmware_command,
                .mode = COMMAND_CONFIG,
                .help = "configure the USB-Blaster II firmware location",
@@ -1071,6 +1041,17 @@ static const struct command_registration ublast_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
+static const struct command_registration ublast_command_handlers[] = {
+       {
+               .name = "usb_blaster",
+               .mode = COMMAND_ANY,
+               .help = "perform usb_blaster management",
+               .chain = ublast_subcommand_handlers,
+               .usage = "",
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
 static struct jtag_interface usb_blaster_interface = {
        .supported = DEBUG_CAP_TMS_SEQ,
        .execute_queue = ublast_execute_queue,

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)