stlink: remove unused assignment
[openocd.git] / src / jtag / drivers / opendous.c
index f58dc9240ca8e05c90dcaafab4607d348a28e555..458df34a703adbdad96f9ce102b31e89bb621e24 100644 (file)
@@ -23,9 +23,7 @@
  *   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, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 #include <jtag/commands.h>
 #include "libusb_common.h"
 #include <string.h>
-#include <sys/timeb.h>
 #include <time.h>
 
 #define OPENDOUS_MAX_VIDS_PIDS 4
 /* define some probes with similar interface */
 struct opendous_probe {
-       char *name;
+       const char *name;
        uint16_t VID[OPENDOUS_MAX_VIDS_PIDS];
        uint16_t PID[OPENDOUS_MAX_VIDS_PIDS];
        uint8_t READ_EP;
@@ -51,7 +48,7 @@ struct opendous_probe {
        int BUFFERSIZE;
 };
 
-static struct opendous_probe opendous_probes[] = {
+static const struct opendous_probe opendous_probes[] = {
        {"usbprog-jtag",        {0x1781, 0},                    {0x0C63, 0},                    0x82, 0x02, 0x00, 510 },
        {"opendous",            {0x1781, 0x03EB, 0},    {0xC0C0, 0x204F, 0},    0x81, 0x02, 0x00, 360 },
        {"usbvlab",                     {0x16C0, 0},                    {0x05DC, 0},                    0x81, 0x02, 0x01, 360 },
@@ -110,7 +107,7 @@ static struct pending_scan_result *pending_scan_results_buffer;
 #define FUNC_READ_DATA        0x51
 
 static char *opendous_type;
-static struct opendous_probe *opendous_probe;
+static const struct opendous_probe *opendous_probe;
 
 /* External interface functions */
 static int opendous_execute_queue(void);
@@ -150,9 +147,7 @@ static int opendous_usb_read(struct opendous_jtag *opendous_jtag);
 int opendous_get_version_info(void);
 
 #ifdef _DEBUG_USB_COMMS_
-char time_str[50];
 static void opendous_debug_buffer(uint8_t *buffer, int length);
-char *opendous_get_time(char *);
 #endif
 
 static struct opendous_jtag *opendous_jtag_handle;
@@ -307,7 +302,7 @@ static int opendous_execute_queue(void)
                                break;
 
                        case JTAG_SLEEP:
-                               DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
+                               DEBUG_JTAG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
                                opendous_tap_execute();
                                jtag_sleep(cmd->cmd.sleep->us);
                                break;
@@ -324,7 +319,7 @@ static int opendous_execute_queue(void)
 static int opendous_init(void)
 {
        int check_cnt;
-       struct opendous_probe *cur_opendous_probe;
+       const struct opendous_probe *cur_opendous_probe;
 
        cur_opendous_probe = opendous_probes;
 
@@ -350,8 +345,8 @@ static int opendous_init(void)
        usb_in_buffer = malloc(opendous_probe->BUFFERSIZE);
        usb_out_buffer = malloc(opendous_probe->BUFFERSIZE);
 
-       pending_scan_results_buffer = (struct pending_scan_result *)
-                       malloc(MAX_PENDING_SCAN_RESULTS * sizeof(struct pending_scan_result));
+       pending_scan_results_buffer = malloc(
+                       MAX_PENDING_SCAN_RESULTS * sizeof(*pending_scan_results_buffer));
 
        opendous_jtag_handle = opendous_usb_open();
 
@@ -712,13 +707,13 @@ struct opendous_jtag *opendous_usb_open(void)
        struct opendous_jtag *result;
 
        struct jtag_libusb_device_handle *devh;
-       if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, &devh) != ERROR_OK)
+       if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, NULL, &devh) != ERROR_OK)
                return NULL;
 
        jtag_libusb_set_configuration(devh, 0);
        jtag_libusb_claim_interface(devh, 0);
 
-       result = (struct opendous_jtag *) malloc(sizeof(struct opendous_jtag));
+       result = malloc(sizeof(*result));
        result->usb_handle = devh;
        return result;
 }
@@ -760,7 +755,7 @@ int opendous_usb_write(struct opendous_jtag *opendous_jtag, int out_length)
        }
 
 #ifdef _DEBUG_USB_COMMS_
-       LOG_DEBUG("%s: USB write begin", opendous_get_time(time_str));
+       LOG_DEBUG("USB write begin");
 #endif
        if (opendous_probe->CONTROL_TRANSFER) {
                result = jtag_libusb_control_transfer(opendous_jtag->usb_handle,
@@ -771,7 +766,7 @@ int opendous_usb_write(struct opendous_jtag *opendous_jtag, int out_length)
                        (char *)usb_out_buffer, out_length, OPENDOUS_USB_TIMEOUT);
        }
 #ifdef _DEBUG_USB_COMMS_
-       LOG_DEBUG("%s: USB write end: %d bytes", opendous_get_time(time_str), result);
+       LOG_DEBUG("USB write end: %d bytes", result);
 #endif
 
        DEBUG_JTAG_IO("opendous_usb_write, out_length = %d, result = %d", out_length, result);
@@ -786,7 +781,7 @@ int opendous_usb_write(struct opendous_jtag *opendous_jtag, int out_length)
 int opendous_usb_read(struct opendous_jtag *opendous_jtag)
 {
 #ifdef _DEBUG_USB_COMMS_
-       LOG_DEBUG("%s: USB read begin", opendous_get_time(time_str));
+       LOG_DEBUG("USB read begin");
 #endif
        int result;
        if (opendous_probe->CONTROL_TRANSFER) {
@@ -798,7 +793,7 @@ int opendous_usb_read(struct opendous_jtag *opendous_jtag)
                        (char *)usb_in_buffer, OPENDOUS_IN_BUFFER_SIZE, OPENDOUS_USB_TIMEOUT);
        }
 #ifdef _DEBUG_USB_COMMS_
-       LOG_DEBUG("%s: USB read end: %d bytes", opendous_get_time(time_str), result);
+       LOG_DEBUG("USB read end: %d bytes", result);
 #endif
        DEBUG_JTAG_IO("opendous_usb_read, result = %d", result);
 
@@ -827,15 +822,4 @@ void opendous_debug_buffer(uint8_t *buffer, int length)
                LOG_DEBUG("%s", line);
        }
 }
-
-char *opendous_get_time(char *str)
-{
-       struct timeb timebuffer;
-       char *timeline;
-
-       ftime(&timebuffer);
-       timeline = ctime(&(timebuffer.time));
-       snprintf(str, 49, "%.8s.%hu", &timeline[11], timebuffer.millitm);
-       return str;
-}
 #endif

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)