jtag/drivers/bcm2835gpio: fix bcm2835_peri_base output format
[openocd.git] / src / jtag / drivers / esp_usb_jtag.c
index 65293ee3751f2bd3a981d9e7a40e54c32af495b5..2ed0f58fd1e5e73b9687e4d42b7751340678d781 100644 (file)
@@ -16,8 +16,6 @@
 #include "bitq.h"
 #include "libusb_helper.h"
 
-#define __packed __attribute__((packed))
-
 /*
 Holy Crap, it's protocol documentation, and it's even vendor-provided!
 
@@ -110,7 +108,7 @@ descriptor.
 struct jtag_proto_caps_hdr {
        uint8_t proto_ver;      /* Protocol version. Expects JTAG_PROTO_CAPS_VER for now. */
        uint8_t length; /* of this plus any following descriptors */
-} __packed;
+} __attribute__((packed));
 
 /* start of the descriptor headers */
 #define JTAG_BUILTIN_DESCR_START_OFF            0      /* Devices with builtin usb jtag */
@@ -133,7 +131,7 @@ of caps header to assume this. If no such caps exist, assume a minimum (in) buff
 struct jtag_gen_hdr {
        uint8_t type;
        uint8_t length;
-} __packed;
+} __attribute__((packed));
 
 struct jtag_proto_caps_speed_apb {
        uint8_t type;                                   /* Type, always JTAG_PROTO_CAPS_SPEED_APB_TYPE */
@@ -141,7 +139,7 @@ struct jtag_proto_caps_speed_apb {
        uint8_t apb_speed_10khz[2];             /* ABP bus speed, in 10KHz increments. Base speed is half this. */
        uint8_t div_min[2];                             /* minimum divisor (to base speed), inclusive */
        uint8_t div_max[2];                             /* maximum divisor (to base speed), inclusive */
-} __packed;
+} __attribute__((packed));
 
 #define JTAG_PROTO_CAPS_DATA_LEN                255
 #define JTAG_PROTO_CAPS_SPEED_APB_TYPE          1
@@ -508,11 +506,13 @@ static int esp_usb_jtag_init(void)
         * 1- With the minimum size required to get to know the total length of that struct,
         * 2- Then exactly the length of that struct. */
        uint8_t jtag_caps_desc[JTAG_PROTO_CAPS_DATA_LEN];
-       int jtag_caps_read_len = jtag_libusb_control_transfer(priv->usb_device,
+       int jtag_caps_read_len;
+       r = jtag_libusb_control_transfer(priv->usb_device,
                LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE,
                LIBUSB_REQUEST_GET_DESCRIPTOR, esp_usb_jtag_caps, 0,
-               (char *)jtag_caps_desc, JTAG_PROTO_CAPS_DATA_LEN, LIBUSB_TIMEOUT_MS);
-       if (jtag_caps_read_len <= 0) {
+               (char *)jtag_caps_desc, JTAG_PROTO_CAPS_DATA_LEN, LIBUSB_TIMEOUT_MS,
+               &jtag_caps_read_len);
+       if (r != ERROR_OK) {
                LOG_ERROR("esp_usb_jtag: could not retrieve jtag_caps descriptor!");
                goto out;
        }
@@ -582,7 +582,8 @@ static int esp_usb_jtag_init(void)
                0,
                NULL,
                0,
-               LIBUSB_TIMEOUT_MS);
+               LIBUSB_TIMEOUT_MS,
+               NULL);
 
        return ERROR_OK;
 
@@ -639,7 +640,7 @@ static int esp_usb_jtag_speed(int divisor)
 
        LOG_DEBUG("esp_usb_jtag: setting divisor %d", divisor);
        jtag_libusb_control_transfer(priv->usb_device,
-               LIBUSB_REQUEST_TYPE_VENDOR, VEND_JTAG_SETDIV, divisor, 0, NULL, 0, LIBUSB_TIMEOUT_MS);
+               LIBUSB_REQUEST_TYPE_VENDOR, VEND_JTAG_SETDIV, divisor, 0, NULL, 0, LIBUSB_TIMEOUT_MS, NULL);
 
        return ERROR_OK;
 }
@@ -650,8 +651,8 @@ COMMAND_HANDLER(esp_usb_jtag_tdo_cmd)
        if (!priv->usb_device)
                return ERROR_FAIL;
        int r = jtag_libusb_control_transfer(priv->usb_device,
-               LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR, VEND_JTAG_GETTDO, 0, 0, &tdo, 1, LIBUSB_TIMEOUT_MS);
-       if (r < 1)
+               LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR, VEND_JTAG_GETTDO, 0, 0, &tdo, 1, LIBUSB_TIMEOUT_MS, NULL);
+       if (r != ERROR_OK)
                return r;
 
        command_print(CMD, "%d", tdo);
@@ -687,7 +688,7 @@ COMMAND_HANDLER(esp_usb_jtag_setio_cmd)
                d |= VEND_JTAG_SETIO_SRST;
 
        jtag_libusb_control_transfer(priv->usb_device,
-               0x40, VEND_JTAG_SETIO, d, 0, NULL, 0, LIBUSB_TIMEOUT_MS);
+               0x40, VEND_JTAG_SETIO, d, 0, NULL, 0, LIBUSB_TIMEOUT_MS, NULL);
 
        return ERROR_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)