This is an automated email from Gerrit.

Salvador E. Tropea (salva...@inti.gob.ar) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/834

-- gerrit

commit de55e690fefb6e28dec9f5e6d5df50269d6f2366
Author: Salvador E. Tropea <salva...@inti.gob.ar>
Date:   Mon Sep 17 09:09:49 2012 -0300

    topic: FTDI FT2232 channel selection
    
    Added ft2232_channel config command to select the FTDI FT2232
    channel to be used.
    
    Change-Id: I48afb46eaffcd4e92cf0c19f3d34eecfb57a316f
    Signed-off-by: Salvador E. Tropea <salva...@inti.gob.ar>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 1604e9c..6e05a31 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2529,6 +2529,14 @@ also reduces the risk of timeouts before receiving the 
expected number of bytes.
 The OpenOCD default value is 2 and for some systems a value of 10 has proved 
useful.
 @end deffn
 
+@deffn {Config Command} {ft2232_channel} number
+The FTDI FT2232 chips have more than one serializers. Some JTAG cables doesn't 
use
+the default channel (1). You can change the channel using this option. Valida 
values
+range from 0 (automatic) to 4. This is useful when you have a cable that uses 
a known
+layout, but a different channel (i.e. Opendous FT2232 cable is like jtagkey 
but using
+channel 2 instead of 1).
+@end deffn
+
 For example, the interface config file for a
 Turtelizer JTAG Adapter looks something like this:
 
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 1997aeb..d53729a 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -156,6 +156,7 @@ static char *ft2232_device_desc;
 static char *ft2232_serial;
 static uint8_t ft2232_latency = 2;
 static unsigned ft2232_max_tck = FTDI_2232C_MAX_TCK;
+static int      ft2232_channel = INTERFACE_ANY;
 
 #define MAX_USB_IDS 8
 /* vid = pid = 0 marks the end of the list */
@@ -2358,7 +2359,7 @@ static int ft2232_init(void)
                                more, &try_more);
 #elif BUILD_FT2232_LIBFTDI == 1
                retval = ft2232_init_libftdi(ft2232_vid[i], ft2232_pid[i],
-                               more, &try_more, layout->channel);
+                               more, &try_more, ft2232_channel);
 #endif
                if (retval >= 0)
                        break;
@@ -3147,6 +3148,19 @@ static int ft2232_quit(void)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(ft2232_handle_channel_command)
+{
+       if (CMD_ARGC == 1) {
+               ft2232_channel = atoi(CMD_ARGV[0]);
+               if (ft2232_channel < 0 || ft2232_channel > 4) {
+                       LOG_ERROR("ft2232_channel must be in the 0 to 4 range");
+               }
+       } else
+               LOG_ERROR("expected exactly one argument to ft2232_channel 
<ch>");
+
+       return ERROR_OK;
+}
+
 COMMAND_HANDLER(ft2232_handle_device_desc_command)
 {
        char *cp;
@@ -3203,6 +3217,7 @@ COMMAND_HANDLER(ft2232_handle_layout_command)
        for (const struct ft2232_layout *l = ft2232_layouts; l->name; l++) {
                if (strcmp(l->name, CMD_ARGV[0]) == 0) {
                        layout = l;
+                       ft2232_channel = l->channel;
                        return ERROR_OK;
                }
        }
@@ -4258,6 +4273,13 @@ static const struct command_registration 
ft2232_command_handlers[] = {
                .help = "set the FT2232 latency timer to a new value",
                .usage = "value",
        },
+       {
+               .name = "ft2232_channel",
+               .handler = &ft2232_handle_channel_command,
+               .mode = COMMAND_CONFIG,
+               .help = "set the FT2232 channel to a new value",
+               .usage = "value",
+       },
        COMMAND_REGISTRATION_DONE
 };
 

-- 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to