This is an automated email from Gerrit.

Peter Stuge ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/939

-- gerrit

commit cda6e36933f02d35c52c8283fdf57e9bc1e382ae
Author: Peter Stuge <[email protected]>
Date:   Sun Oct 28 05:42:15 2012 +0100

    mpsse: Always perform a general reset of the MPSSE in mpsse_open()
    
    Per AN_135 FTDI MPSSE Basics Version 1.1, section 4.2 step 7.
    http://www.ftdichip.com/Support/Documents/AppNotes/AN_135_MPSSE_Basics.pdf
    
    This allows to stop and restart OpenOCD reliably, without needing
    to power cycle the interface.
    
    Change-Id: Ibeafe5ecfe7b2f6f82712cbc85116904407ddb36
    Signed-off-by: Peter Stuge <[email protected]>

diff --git a/src/jtag/drivers/mpsse.c b/src/jtag/drivers/mpsse.c
index d6cbc84..92f9331 100644
--- a/src/jtag/drivers/mpsse.c
+++ b/src/jtag/drivers/mpsse.c
@@ -55,6 +55,7 @@
 #define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | 
LIBUSB_RECIPIENT_DEVICE)
 #define FTDI_DEVICE_IN_REQTYPE (0x80 | LIBUSB_REQUEST_TYPE_VENDOR | 
LIBUSB_RECIPIENT_DEVICE)
 
+#define BITMODE_RESET 0x00
 #define BITMODE_MPSSE 0x02
 
 #define SIO_RESET_REQUEST             0x00
@@ -315,6 +316,19 @@ struct mpsse_ctx *mpsse_open(const uint16_t *vid, const 
uint16_t *pid, const cha
        err = libusb_control_transfer(ctx->usb_dev,
                        FTDI_DEVICE_OUT_REQTYPE,
                        SIO_SET_BITMODE_REQUEST,
+                       0x0b | (BITMODE_RESET << 8),
+                       ctx->index,
+                       NULL,
+                       0,
+                       ctx->usb_write_timeout);
+       if (err < 0) {
+               LOG_ERROR("unable to reset bitmode: %d", err);
+               goto error;
+       }
+
+       err = libusb_control_transfer(ctx->usb_dev,
+                       FTDI_DEVICE_OUT_REQTYPE,
+                       SIO_SET_BITMODE_REQUEST,
                        0x0b | (BITMODE_MPSSE << 8),
                        ctx->index,
                        NULL,

-- 

------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to