target/xtensa: avoid IHI for writes to non-executable memory
[openocd.git] / src / jtag / drivers / mpsse.c
index 9f2fdde9fb77fe50810ab5e796df5bcb97692024..f3499e3864fcb92ef8228d2b1f4ccaacb3b86f41 100644 (file)
@@ -265,6 +265,24 @@ static bool open_matching_device(struct mpsse_ctx *ctx, const uint16_t vids[], c
        case 0x900:
                ctx->type = TYPE_FT232H;
                break;
+       case 0x2800:
+               ctx->type = TYPE_FT2233HP;
+               break;
+       case 0x2900:
+               ctx->type = TYPE_FT4233HP;
+               break;
+       case 0x3000:
+               ctx->type = TYPE_FT2232HP;
+               break;
+       case 0x3100:
+               ctx->type = TYPE_FT4232HP;
+               break;
+       case 0x3200:
+               ctx->type = TYPE_FT233HP;
+               break;
+       case 0x3300:
+               ctx->type = TYPE_FT232HP;
+               break;
        default:
                LOG_ERROR("unsupported FTDI chip type: 0x%04x", desc.bcdDevice);
                goto error;
@@ -313,7 +331,7 @@ struct mpsse_ctx *mpsse_open(const uint16_t vids[], const uint16_t pids[], const
        int err;
 
        if (!ctx)
-               return 0;
+               return NULL;
 
        bit_copy_queue_init(&ctx->read_queue);
        ctx->read_chunk_size = 16384;
@@ -348,7 +366,7 @@ struct mpsse_ctx *mpsse_open(const uint16_t vids[], const uint16_t pids[], const
                                description ? description : "*",
                                serial ? serial : "*",
                                location ? location : "*");
-               ctx->usb_dev = 0;
+               ctx->usb_dev = NULL;
                goto error;
        }
 
@@ -378,7 +396,7 @@ struct mpsse_ctx *mpsse_open(const uint16_t vids[], const uint16_t pids[], const
        return ctx;
 error:
        mpsse_close(ctx);
-       return 0;
+       return NULL;
 }
 
 void mpsse_close(struct mpsse_ctx *ctx)
@@ -465,13 +483,13 @@ static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_
 void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
        unsigned length, uint8_t mode)
 {
-       mpsse_clock_data(ctx, out, out_offset, 0, 0, length, mode);
+       mpsse_clock_data(ctx, out, out_offset, NULL, 0, length, mode);
 }
 
 void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, unsigned length,
        uint8_t mode)
 {
-       mpsse_clock_data(ctx, 0, 0, in, in_offset, length, mode);
+       mpsse_clock_data(ctx, NULL, 0, in, in_offset, length, mode);
 }
 
 void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
@@ -548,7 +566,7 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
 void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
        unsigned length, bool tdi, uint8_t mode)
 {
-       mpsse_clock_tms_cs(ctx, out, out_offset, 0, 0, length, tdi, mode);
+       mpsse_clock_tms_cs(ctx, out, out_offset, NULL, 0, length, tdi, mode);
 }
 
 void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
@@ -842,7 +860,7 @@ int mpsse_flush(struct mpsse_ctx *ctx)
        if (ctx->write_count == 0)
                return retval;
 
-       struct libusb_transfer *read_transfer = 0;
+       struct libusb_transfer *read_transfer = NULL;
        struct transfer_result read_result = { .ctx = ctx, .done = true };
        if (ctx->read_count) {
                buffer_write_byte(ctx, 0x87); /* SEND_IMMEDIATE */
@@ -880,20 +898,6 @@ int mpsse_flush(struct mpsse_ctx *ctx)
 
                retval = libusb_handle_events_timeout_completed(ctx->usb_ctx, &timeout_usb, NULL);
                keep_alive();
-               if (retval == LIBUSB_ERROR_NO_DEVICE || retval == LIBUSB_ERROR_INTERRUPTED)
-                       break;
-
-               if (retval != LIBUSB_SUCCESS) {
-                       libusb_cancel_transfer(write_transfer);
-                       if (read_transfer)
-                               libusb_cancel_transfer(read_transfer);
-                       while (!write_result.done || !read_result.done) {
-                               retval = libusb_handle_events_timeout_completed(ctx->usb_ctx,
-                                                               &timeout_usb, NULL);
-                               if (retval != LIBUSB_SUCCESS)
-                                       break;
-                       }
-               }
 
                int64_t now = timeval_ms();
                if (now - start > warn_after) {
@@ -901,6 +905,15 @@ int mpsse_flush(struct mpsse_ctx *ctx)
                                        "ms.", now - start);
                        warn_after *= 2;
                }
+
+               if (retval == LIBUSB_ERROR_INTERRUPTED)
+                       continue;
+
+               if (retval != LIBUSB_SUCCESS) {
+                       libusb_cancel_transfer(write_transfer);
+                       if (read_transfer)
+                               libusb_cancel_transfer(read_transfer);
+               }
        }
 
 error_check:

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)