Add Tincantools Flyswatter2 support
[openocd.git] / src / jtag / drivers / usb_blaster.c
index 68867adf9e81da09dcfafb7aafc72ae4405b158b..c5c356ce574599b26b423271dcb0cc2a5bd40f99 100644 (file)
@@ -97,6 +97,7 @@
 /* USB_BLASTER access library includes */
 #if BUILD_USB_BLASTER_FTD2XX == 1
 #include <ftd2xx.h>
+#include "ftd2xx_common.h"
 #elif BUILD_USB_BLASTER_LIBFTDI == 1
 #include <ftdi.h>
 #endif
@@ -135,7 +136,7 @@ static int usb_blaster_buf_write(
        if (status != FT_OK)
        {
                *bytes_written = dw_bytes_written;
-               LOG_ERROR("FT_Write returned: %lu", status);
+               LOG_ERROR("FT_Write returned: %s", ftd2xx_status_string(status));
                return ERROR_JTAG_DEVICE_ERROR;
        }
        *bytes_written = dw_bytes_written;
@@ -168,11 +169,11 @@ usb_blaster_buf_read(uint8_t *buf, unsigned size, uint32_t *bytes_read)
        if (status != FT_OK)
        {
                *bytes_read = dw_bytes_read;
-               LOG_ERROR("FT_Read returned: %lu", status);
+               LOG_ERROR("FT_Read returned: %s", ftd2xx_status_string(status));
                return ERROR_JTAG_DEVICE_ERROR;
        }
 #ifdef _DEBUG_JTAG_IO_
-       LOG_DEBUG("usb_blaster_buf_read %02X (%lu)", buf[0], dw_bytes_read);
+       LOG_DEBUG("usb_blaster_buf_read %02X (%" PRIu32 ")", buf[0], dw_bytes_read);
 #endif
        *bytes_read = dw_bytes_read;
        return ERROR_OK;
@@ -384,7 +385,8 @@ static int usb_blaster_init(void)
        {
                DWORD num_devices;
 
-               LOG_ERROR("unable to open ftdi device: %lu", status);
+               LOG_ERROR("unable to open ftdi device: %s",
+                               ftd2xx_status_string(status));
                status = FT_ListDevices(&num_devices, NULL,
                                FT_LIST_NUMBER_ONLY);
                if (status == FT_OK)
@@ -402,7 +404,7 @@ static int usb_blaster_init(void)
 
                        if (status == FT_OK)
                        {
-                               LOG_ERROR("ListDevices: %lu", num_devices);
+                               LOG_ERROR("ListDevices: %" PRIu32, (uint32_t)num_devices);
                                for (i = 0; i < num_devices; i++)
                                        LOG_ERROR("%i: %s", i, desc_array[i]);
                        }
@@ -421,14 +423,16 @@ static int usb_blaster_init(void)
        status = FT_SetLatencyTimer(ftdih, 2);
        if (status != FT_OK)
        {
-               LOG_ERROR("unable to set latency timer: %lu", status);
+               LOG_ERROR("unable to set latency timer: %s",
+                               ftd2xx_status_string(status));
                return ERROR_JTAG_INIT_FAILED;
        }
 
        status = FT_GetLatencyTimer(ftdih, &latency_timer);
        if (status != FT_OK)
        {
-               LOG_ERROR("unable to get latency timer: %lu", status);
+               LOG_ERROR("unable to get latency timer: %s",
+                               ftd2xx_status_string(status));
                return ERROR_JTAG_INIT_FAILED;
        }
        LOG_DEBUG("current latency timer: %i", latency_timer);
@@ -436,7 +440,8 @@ static int usb_blaster_init(void)
        status = FT_SetBitMode(ftdih, 0x00, 0);
        if (status != FT_OK)
        {
-               LOG_ERROR("unable to disable bit i/o mode: %lu", status);
+               LOG_ERROR("unable to disable bit i/o mode: %s",
+                               ftd2xx_status_string(status));
                return ERROR_JTAG_INIT_FAILED;
        }
 #elif BUILD_USB_BLASTER_LIBFTDI == 1
@@ -474,12 +479,6 @@ static int usb_blaster_init(void)
 
        bitbang_interface = &usb_blaster_bitbang;
 
-       int jtag_speed_var;
-       int retval = jtag_get_speed(&jtag_speed_var);
-       if (retval != ERROR_OK)
-               return retval;
-       usb_blaster_speed(jtag_speed_var);
-
 #if 0
 #if BUILD_USB_BLASTER_FTD2XX == 1
        if ((status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX)) != FT_OK)

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)