jtag: drivers: ft232r: unhardcoded 81/4681/9
authorEMARD <vordah@gmail.com>
Thu, 27 Sep 2018 13:12:10 +0000 (15:12 +0200)
committerPaul Fertser <fercerpav@gmail.com>
Thu, 6 Dec 2018 08:51:01 +0000 (08:51 +0000)
FT232R: introducing configurable parameters for pinout,
initial buffer size, state of RS232 signals at exit with
option to reattach kernel driver. All this was hardcoded before.
New parameters are documented in "openocd.texi" file.
Allows hopfully self-explainable and user-friendly adaptation to
various pinouts and similar chips like FT230X and FT231X.

Change-Id: Ib807f2ea3d4c1a164d351d65aeacd1978318d217
Signed-off-by: EMARD <vordah@gmail.com>
Reviewed-on: http://openocd.zylin.com/4681
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
doc/openocd.texi
src/jtag/drivers/ft232r.c

index e7d0c67c56fec1d3cf95718ec671efaaa11ffc33..6ad19e1e892bd64652921119d0b0747d5ef4aab8 100644 (file)
@@ -2578,10 +2578,11 @@ For example adapter definitions, see the configuration files shipped in the
 @end deffn
 
 @deffn {Interface Driver} {ft232r}
 @end deffn
 
 @deffn {Interface Driver} {ft232r}
-This driver is implementing synchronous bitbang mode of an FTDI FT232R
-USB UART bridge IC.
+This driver is implementing synchronous bitbang mode of an FTDI FT232R,
+FT230X, FT231X and similar USB UART bridge ICs by reusing RS232 signals as GPIO.
+It currently doesn't support using CBUS pins as GPIO.
 
 
-List of connections (pin numbers for SSOP):
+List of connections (default physical pin numbers for FT232R in 28-pin SSOP package):
 @itemize @minus
 @item RXD(5) - TDI
 @item TXD(1) - TCK
 @itemize @minus
 @item RXD(5) - TDI
 @item TXD(1) - TCK
@@ -2591,6 +2592,27 @@ List of connections (pin numbers for SSOP):
 @item DCD(10) - SRST
 @end itemize
 
 @item DCD(10) - SRST
 @end itemize
 
+User can change default pinout by supplying configuration
+commands with GPIO numbers or RS232 signal names.
+GPIO numbers correspond to bit numbers in FTDI GPIO register.
+They differ from physical pin numbers.
+For details see actual FTDI chip datasheets.
+Every JTAG line must be configured to unique GPIO number
+different than any other JTAG line, even those lines
+that are sometimes not used like TRST or SRST.
+
+FT232R
+@itemize @minus
+@item bit 7 - RI
+@item bit 6 - DCD
+@item bit 5 - DSR
+@item bit 4 - DTR
+@item bit 3 - CTS
+@item bit 2 - RTS
+@item bit 1 - RXD
+@item bit 0 - TXD
+@end itemize
+
 These interfaces have several commands, used to configure the driver
 before initializing the JTAG scan chain:
 
 These interfaces have several commands, used to configure the driver
 before initializing the JTAG scan chain:
 
@@ -2605,6 +2627,47 @@ vendor provides unique IDs and more than one adapter is connected to
 the host. If not specified, serial numbers are not considered.
 @end deffn
 
 the host. If not specified, serial numbers are not considered.
 @end deffn
 
+@deffn {Config Command} {ft232r_jtag_nums} @var{tck} @var{tms} @var{tdi} @var{tdo}
+Set four JTAG GPIO numbers at once.
+If not specified, default 0 3 1 2 or TXD CTS RXD RTS is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_tck_num} @var{tck}
+Set TCK GPIO number. If not specified, default 0 or TXD is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_tms_num} @var{tms}
+Set TMS GPIO number. If not specified, default 3 or CTS is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_tdi_num} @var{tdi}
+Set TDI GPIO number. If not specified, default 1 or RXD is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_tdo_num} @var{tdo}
+Set TDO GPIO number. If not specified, default 2 or RTS is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_trst_num} @var{trst}
+Set TRST GPIO number. If not specified, default 4 or DTR is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_srst_num} @var{srst}
+Set SRST GPIO number. If not specified, default 6 or DCD is used.
+@end deffn
+
+@deffn {Config Command} {ft232r_restore_serial} @var{word}
+Restore serial port after JTAG. This USB bitmode control word
+(16-bit) will be sent before quit. Lower byte should
+set GPIO direction register to a "sane" state:
+0x15 for TXD RTS DTR as outputs (1), others as inputs (0). Higher
+byte is usually 0 to disable bitbang mode.
+When kernel driver reattaches, serial port should continue to work.
+Value 0xFFFF disables sending control word and serial port,
+then kernel driver will not reattach.
+If not specified, default 0xFFFF is used.
+@end deffn
+
 @end deffn
 
 @deffn {Interface Driver} {remote_bitbang}
 @end deffn
 
 @deffn {Interface Driver} {remote_bitbang}
index fc3d75f4368a7a97adb15d38a03c84445ded0549..e16bcdcbfeea7a761f283ca6662b09eb7098133f 100644 (file)
 #include <time.h>
 
 /*
 #include <time.h>
 
 /*
- *   Bit 7 (0x80, pin 6, RI ): unused.
- *   Bit 6 (0x40, pin 10,DCD): /SYSRST output.
- *   Bit 5 (0x20, pin 9, DSR): unused.
- *   Bit 4 (0x10, pin 2, DTR): /TRST output.
- *   Bit 3 (0x08, pin 11,CTS): TMS output.
- *   Bit 2 (0x04, pin 3, RTS): TDO input.
- *   Bit 1 (0x02, pin 5, RXD): TDI output.
- *   Bit 0 (0x01, pin 1, TXD): TCK output.
- *
  * Sync bit bang mode is implemented as described in FTDI Application
  * Note AN232R-01: "Bit Bang Modes for the FT232R and FT245R".
  */
  * Sync bit bang mode is implemented as described in FTDI Application
  * Note AN232R-01: "Bit Bang Modes for the FT232R and FT245R".
  */
-#define TCK                    (1 << 0)
-#define TDI                    (1 << 1)
-#define READ_TDO               (1 << 2)
-#define TMS                    (1 << 3)
-#define NTRST                  (1 << 4)
-#define NSYSRST                        (1 << 6)
 
 /*
  * USB endpoints.
 
 /*
  * USB endpoints.
@@ -81,7 +66,7 @@
 #define SIO_WRITE_EEPROM       0x91
 #define SIO_ERASE_EEPROM       0x92
 
 #define SIO_WRITE_EEPROM       0x91
 #define SIO_ERASE_EEPROM       0x92
 
-#define FT232R_BUF_SIZE                4000
+#define FT232R_BUF_SIZE_EXTRA  4096
 
 static char *ft232r_serial_desc;
 static uint16_t ft232r_vid = 0x0403; /* FTDI */
 
 static char *ft232r_serial_desc;
 static uint16_t ft232r_vid = 0x0403; /* FTDI */
@@ -91,6 +76,33 @@ static jtag_libusb_device_handle *adapter;
 static uint8_t *ft232r_output;
 static size_t ft232r_output_len;
 
 static uint8_t *ft232r_output;
 static size_t ft232r_output_len;
 
+/**
+ * FT232R GPIO bit number to RS232 name
+ */
+#define FT232R_BIT_COUNT 8
+static char *ft232r_bit_name_array[FT232R_BIT_COUNT] = {
+       "TXD", /* 0: pin 1  TCK output */
+       "RXD", /* 1: pin 5  TDI output */
+       "RTS", /* 2: pin 3  TDO input */
+       "CTS", /* 3: pin 11 TMS output */
+       "DTR", /* 4: pin 2  /TRST output */
+       "DSR", /* 5: pin 9  unused */
+       "DCD", /* 6: pin 10 /SYSRST output */
+       "RI"   /* 7: pin 6  unused */
+};
+
+static int tck_gpio; /* initialized to 0 by default */
+static int tdi_gpio = 1;
+static int tdo_gpio = 2;
+static int tms_gpio = 3;
+static int ntrst_gpio = 4;
+static int nsysrst_gpio = 6;
+static size_t ft232r_buf_size = FT232R_BUF_SIZE_EXTRA;
+/** 0xFFFF disables restore by default, after exit serial port will not work.
+ *  0x15 sets TXD RTS DTR as outputs, after exit serial port will continue to work.
+ */
+static uint16_t ft232r_restore_bitmode = 0xFFFF;
+
 /**
  * Perform sync bitbang output/input transaction.
  * Before call, an array ft232r_output[] should be filled with data to send.
 /**
  * Perform sync bitbang output/input transaction.
  * Before call, an array ft232r_output[] should be filled with data to send.
@@ -160,20 +172,35 @@ static int ft232r_send_recv(void)
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
+void ft232r_increase_buf_size(size_t new_buf_size)
+{
+       uint8_t *new_buf_ptr;
+       if (new_buf_size >= ft232r_buf_size) {
+               new_buf_size += FT232R_BUF_SIZE_EXTRA;
+               new_buf_ptr = realloc(ft232r_output, new_buf_size);
+               if (new_buf_ptr != NULL) {
+                       ft232r_output = new_buf_ptr;
+                       ft232r_buf_size = new_buf_size;
+               }
+       }
+}
+
 /**
  * Add one TCK/TMS/TDI sample to send buffer.
  */
 static void ft232r_write(int tck, int tms, int tdi)
 {
 /**
  * Add one TCK/TMS/TDI sample to send buffer.
  */
 static void ft232r_write(int tck, int tms, int tdi)
 {
-       unsigned out_value = NTRST | NSYSRST;
+       unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio);
        if (tck)
        if (tck)
-               out_value |= TCK;
+               out_value |= (1<<tck_gpio);
        if (tms)
        if (tms)
-               out_value |= TMS;
+               out_value |= (1<<tms_gpio);
        if (tdi)
        if (tdi)
-               out_value |= TDI;
+               out_value |= (1<<tdi_gpio);
 
 
-       if (ft232r_output_len >= FT232R_BUF_SIZE) {
+       ft232r_increase_buf_size(ft232r_output_len);
+
+       if (ft232r_output_len >= ft232r_buf_size) {
                /* FIXME: should we just execute queue here? */
                LOG_ERROR("ft232r_write: buffer overflow");
                return;
                /* FIXME: should we just execute queue here? */
                LOG_ERROR("ft232r_write: buffer overflow");
                return;
@@ -187,20 +214,22 @@ static void ft232r_write(int tck, int tms, int tdi)
  */
 static void ft232r_reset(int trst, int srst)
 {
  */
 static void ft232r_reset(int trst, int srst)
 {
-       unsigned out_value = NTRST | NSYSRST;
+       unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio);
        LOG_DEBUG("ft232r_reset(%d,%d)", trst, srst);
 
        if (trst == 1)
        LOG_DEBUG("ft232r_reset(%d,%d)", trst, srst);
 
        if (trst == 1)
-               out_value &= ~NTRST;            /* switch /TRST low */
+               out_value &= ~(1<<ntrst_gpio);          /* switch /TRST low */
        else if (trst == 0)
        else if (trst == 0)
-               out_value |= NTRST;                     /* switch /TRST high */
+               out_value |= (1<<ntrst_gpio);                   /* switch /TRST high */
 
        if (srst == 1)
 
        if (srst == 1)
-               out_value &= ~NSYSRST;          /* switch /SYSRST low */
+               out_value &= ~(1<<nsysrst_gpio);                /* switch /SYSRST low */
        else if (srst == 0)
        else if (srst == 0)
-               out_value |= NSYSRST;           /* switch /SYSRST high */
+               out_value |= (1<<nsysrst_gpio);         /* switch /SYSRST high */
+
+       ft232r_increase_buf_size(ft232r_output_len);
 
 
-       if (ft232r_output_len >= FT232R_BUF_SIZE) {
+       if (ft232r_output_len >= ft232r_buf_size) {
                /* FIXME: should we just execute queue here? */
                LOG_ERROR("ft232r_write: buffer overflow");
                return;
                /* FIXME: should we just execute queue here? */
                LOG_ERROR("ft232r_write: buffer overflow");
                return;
@@ -236,7 +265,10 @@ static int ft232r_init(void)
                return ERROR_JTAG_INIT_FAILED;
        }
 
                return ERROR_JTAG_INIT_FAILED;
        }
 
-       libusb_detach_kernel_driver(adapter, 0);
+       if (ft232r_restore_bitmode == 0xFFFF) /* serial port will not be restored after jtag: */
+               libusb_detach_kernel_driver(adapter, 0);
+       else /* serial port will be restored after jtag: */
+               libusb_set_auto_detach_kernel_driver(adapter, 1); /* 1: DONT_DETACH_SIO_MODULE */
 
        if (jtag_libusb_claim_interface(adapter, 0)) {
                LOG_ERROR("unable to claim interface");
 
        if (jtag_libusb_claim_interface(adapter, 0)) {
                LOG_ERROR("unable to claim interface");
@@ -254,7 +286,7 @@ static int ft232r_init(void)
        /* Sync bit bang mode. */
        if (jtag_libusb_control_transfer(adapter,
                LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
        /* Sync bit bang mode. */
        if (jtag_libusb_control_transfer(adapter,
                LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
-               SIO_SET_BITMODE, TCK | TDI | TMS | NTRST | NSYSRST | 0x400,
+               SIO_SET_BITMODE, (1<<tck_gpio) | (1<<tdi_gpio) | (1<<tms_gpio) | (1<<ntrst_gpio) | (1<<nsysrst_gpio) | 0x400,
                0, 0, 0, 1000) != 0) {
                LOG_ERROR("cannot set sync bitbang mode");
                return ERROR_JTAG_INIT_FAILED;
                0, 0, 0, 1000) != 0) {
                LOG_ERROR("cannot set sync bitbang mode");
                return ERROR_JTAG_INIT_FAILED;
@@ -279,7 +311,7 @@ static int ft232r_init(void)
                return ERROR_JTAG_INIT_FAILED;
        }
 
                return ERROR_JTAG_INIT_FAILED;
        }
 
-       ft232r_output = malloc(FT232R_BUF_SIZE);
+       ft232r_output = malloc(ft232r_buf_size);
        if (ft232r_output == NULL) {
                LOG_ERROR("Unable to allocate memory for the buffer");
                return ERROR_JTAG_INIT_FAILED;
        if (ft232r_output == NULL) {
                LOG_ERROR("Unable to allocate memory for the buffer");
                return ERROR_JTAG_INIT_FAILED;
@@ -290,11 +322,24 @@ static int ft232r_init(void)
 
 static int ft232r_quit(void)
 {
 
 static int ft232r_quit(void)
 {
+       /* to restore serial port: set TXD RTS DTR as outputs, others as inputs, disable sync bit bang mode. */
+       if (ft232r_restore_bitmode != 0xFFFF) {
+               if (jtag_libusb_control_transfer(adapter,
+                       LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
+                       SIO_SET_BITMODE, ft232r_restore_bitmode,
+                       0, 0, 0, 1000) != 0) {
+                       LOG_ERROR("cannot set bitmode to restore serial port");
+               }
+       }
+
        if (jtag_libusb_release_interface(adapter, 0) != 0)
                LOG_ERROR("usb release interface failed");
 
        jtag_libusb_close(adapter);
        if (jtag_libusb_release_interface(adapter, 0) != 0)
                LOG_ERROR("usb release interface failed");
 
        jtag_libusb_close(adapter);
-       free(ft232r_output);
+
+       free(ft232r_output); /* free used memory */
+       ft232r_output = NULL; /* reset pointer to memory */
+       ft232r_buf_size = FT232R_BUF_SIZE_EXTRA; /* reset next initial buffer size */
 
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
@@ -331,6 +376,27 @@ static int ft232r_khz(int khz, int *divisor)
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
+static char *ft232r_bit_number_to_name(int bit)
+{
+       if (bit >= 0 && bit < FT232R_BIT_COUNT)
+               return ft232r_bit_name_array[bit];
+       return "?";
+}
+
+static int ft232r_bit_name_to_number(const char *name)
+{
+       int i;
+       if (name[0] >= '0' && name[0] <= '9' && name[1] == '\0') {
+               i = atoi(name);
+               if (i >= 0 && i < FT232R_BIT_COUNT)
+                       return i;
+       }
+       for (i = 0; i < FT232R_BIT_COUNT; i++)
+               if (strcasecmp(name, ft232r_bit_name_array[i]) == 0)
+                       return i;
+       return -1;
+}
+
 COMMAND_HANDLER(ft232r_handle_serial_desc_command)
 {
        if (CMD_ARGC == 1)
 COMMAND_HANDLER(ft232r_handle_serial_desc_command)
 {
        if (CMD_ARGC == 1)
@@ -357,6 +423,145 @@ COMMAND_HANDLER(ft232r_handle_vid_pid_command)
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(ft232r_handle_jtag_nums_command)
+{
+       if (CMD_ARGC == 4) {
+               tck_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+               tms_gpio = ft232r_bit_name_to_number(CMD_ARGV[1]);
+               tdi_gpio = ft232r_bit_name_to_number(CMD_ARGV[2]);
+               tdo_gpio = ft232r_bit_name_to_number(CMD_ARGV[3]);
+       } else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (tck_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       if (tms_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       if (tdi_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       if (tdo_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R nums: TCK = %d %s, TMS = %d %s, TDI = %d %s, TDO = %d %s",
+                       tck_gpio, ft232r_bit_number_to_name(tck_gpio),
+                       tms_gpio, ft232r_bit_number_to_name(tms_gpio),
+                       tdi_gpio, ft232r_bit_number_to_name(tdi_gpio),
+                       tdo_gpio, ft232r_bit_number_to_name(tdo_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_tck_num_command)
+{
+       if (CMD_ARGC == 1)
+               tck_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (tck_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: TCK = %d %s", tck_gpio, ft232r_bit_number_to_name(tck_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_tms_num_command)
+{
+       if (CMD_ARGC == 1)
+               tms_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (tms_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: TMS = %d %s", tms_gpio, ft232r_bit_number_to_name(tms_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_tdo_num_command)
+{
+       if (CMD_ARGC == 1)
+               tdo_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (tdo_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: TDO = %d %s", tdo_gpio, ft232r_bit_number_to_name(tdo_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_tdi_num_command)
+{
+       if (CMD_ARGC == 1)
+               tdi_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (tdi_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: TDI = %d %s", tdi_gpio, ft232r_bit_number_to_name(tdi_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_trst_num_command)
+{
+       if (CMD_ARGC == 1)
+               ntrst_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (ntrst_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: TRST = %d %s", ntrst_gpio, ft232r_bit_number_to_name(ntrst_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_srst_num_command)
+{
+       if (CMD_ARGC == 1)
+               nsysrst_gpio = ft232r_bit_name_to_number(CMD_ARGV[0]);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       if (nsysrst_gpio < 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R num: SRST = %d %s", nsysrst_gpio, ft232r_bit_number_to_name(nsysrst_gpio));
+
+       return ERROR_OK;
+}
+
+COMMAND_HANDLER(ft232r_handle_restore_serial_command)
+{
+       if (CMD_ARGC == 1)
+               COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], ft232r_restore_bitmode);
+       else if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       command_print(CMD_CTX,
+                       "FT232R restore serial: 0x%04X (%s)",
+                       ft232r_restore_bitmode, ft232r_restore_bitmode == 0xFFFF ? "disabled" : "enabled");
+
+       return ERROR_OK;
+}
+
 static const struct command_registration ft232r_command_handlers[] = {
        {
                .name = "ft232r_serial_desc",
 static const struct command_registration ft232r_command_handlers[] = {
        {
                .name = "ft232r_serial_desc",
@@ -372,6 +577,62 @@ static const struct command_registration ft232r_command_handlers[] = {
                .help = "USB VID and PID of the adapter",
                .usage = "vid pid",
        },
                .help = "USB VID and PID of the adapter",
                .usage = "vid pid",
        },
+       {
+               .name = "ft232r_jtag_nums",
+               .handler = ft232r_handle_jtag_nums_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio numbers for tck, tms, tdi, tdo. (in that order)",
+               .usage = "<0-7|TXD-RI> <0-7|TXD-RI> <0-7|TXD-RI> <0-7|TXD-RI>",
+       },
+       {
+               .name = "ft232r_tck_num",
+               .handler = ft232r_handle_tck_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for tck.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_tms_num",
+               .handler = ft232r_handle_tms_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for tms.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_tdo_num",
+               .handler = ft232r_handle_tdo_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for tdo.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_tdi_num",
+               .handler = ft232r_handle_tdi_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for tdi.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_srst_num",
+               .handler = ft232r_handle_srst_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for srst.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_trst_num",
+               .handler = ft232r_handle_trst_num_command,
+               .mode = COMMAND_CONFIG,
+               .help = "gpio number for trst.",
+               .usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
+       },
+       {
+               .name = "ft232r_restore_serial",
+               .handler = ft232r_handle_restore_serial_command,
+               .mode = COMMAND_CONFIG,
+               .help = "bitmode control word that restores serial port.",
+               .usage = "bitmode_control_word",
+       },
        COMMAND_REGISTRATION_DONE
 };
 
        COMMAND_REGISTRATION_DONE
 };
 
@@ -553,7 +814,7 @@ static void syncbb_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int
                        int bcval = 1 << (bit_cnt % 8);
                        int val = ft232r_output[bit0_index + bit_cnt*2 + 1];
 
                        int bcval = 1 << (bit_cnt % 8);
                        int val = ft232r_output[bit0_index + bit_cnt*2 + 1];
 
-                       if (val & READ_TDO)
+                       if (val & (1<<tdo_gpio))
                                buffer[bytec] |= bcval;
                        else
                                buffer[bytec] &= ~bcval;
                                buffer[bytec] |= bcval;
                        else
                                buffer[bytec] &= ~bcval;

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)