Add FTDI JTAG driver using MPSSE layer

Based on ft2232.c but uses the MPSSE layer for low-level access, greatly
simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout
specific code. Layout specifications are instead handled in Tcl.

Use a signal abstraction to enable Tcl configuration files to define
outputs for one or several FTDI GPIO. These outputs can then be
controlled using the ftdi_set_signal command. Special signal names are
reserved for nTRST, nSRST and LED (for blink) so that they, if defined,
will be used for their customary purpose.

Depending on the type of buffer attached to the FTDI GPIO, the outputs
have to be controlled differently. In order to support tristateable
signals such as nSRST, both a data GPIO and an output-enable GPIO can be
specified for each signal. The following output buffer configurations are
supported:

* Push-pull with one FTDI output as (non-)inverted data line
* Open drain with one FTDI output as (non-)inverted output-enable
* Tristate with one FTDI output as (non-)inverted data line and another
  FTDI output as (non-)inverted output-enable
* Unbuffered, using the FTDI GPIO as a tristate output directly by
  switching data and direction as necessary

The data and output-enables are specified as 16-bit bitmasks,
corresponding to the concatenation of the high and low FTDI GPIO
registers. To specify an unbuffered output, use the same bitmask
for both data and output-enable.

The adapter configuration file must also specify default values for the
FTDI data and direction GPIO registers, and the channel being used (if
different from 0).

Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/452
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
Andreas Fritiofson
2012-01-30 00:45:18 +01:00
committed by Peter Stuge
parent b598efb613
commit f5e97b5e1b
4 changed files with 889 additions and 1 deletions

View File

@@ -385,6 +385,10 @@ AC_ARG_ENABLE([ft2232_ftd2xx],
AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
[build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
AC_ARG_ENABLE([ftdi],
AS_HELP_STRING([--enable-ftdi], [Enable building support for the MPSSE mode of FTDI based devices, using libusb-1.0 in asynchronous mode]),
[build_ftdi=$enableval], [build_ftdi=no])
AC_ARG_ENABLE([usb_blaster_libftdi],
AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
[build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
@@ -682,6 +686,12 @@ else
AC_DEFINE([BUILD_FT2232_FTD2XX], [0], [0 if you don't want ftd2xx ft2232.])
fi
if test $build_ftdi = yes; then
AC_DEFINE([BUILD_FTDI], [1], [1 if you want ftdi.])
else
AC_DEFINE([BUILD_FTDI], [0], [0 if you don't want ftdi.])
fi
if test $build_usb_blaster_libftdi = yes; then
build_bitbang=yes
AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
@@ -1081,7 +1091,7 @@ fi
# Check for libusb1 ported drivers.
build_usb_ng=no
if test $build_jlink = yes -o $build_stlink = yes -o $build_osbdm = yes -o \
$build_opendous = yes
$build_opendous = yes -o $build_ftdi = yes
then
build_usb_ng=yes
fi
@@ -1114,6 +1124,7 @@ AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
AM_CONDITIONAL([FTDI_DRIVER], [test $build_ftdi = yes])
AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes])
AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])

View File

@@ -43,6 +43,9 @@ endif
if FT2232_DRIVER
DRIVERFILES += ft2232.c
endif
if FTDI_DRIVER
DRIVERFILES += ftdi.c mpsse.c
endif
if USB_BLASTER_DRIVER
DRIVERFILES += usb_blaster.c
endif

868
src/jtag/drivers/ftdi.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -59,6 +59,9 @@ extern struct jtag_interface ft2232_interface;
#if BUILD_FT2232_LIBFTDI == 1
extern struct jtag_interface ft2232_interface;
#endif
#if BUILD_FTDI == 1
extern struct jtag_interface ftdi_interface;
#endif
#if BUILD_USB_BLASTER_LIBFTDI == 1 || BUILD_USB_BLASTER_FTD2XX == 1
extern struct jtag_interface usb_blaster_interface;
#endif
@@ -137,6 +140,9 @@ struct jtag_interface *jtag_interfaces[] = {
#if BUILD_FT2232_LIBFTDI == 1
&ft2232_interface,
#endif
#if BUILD_FTDI == 1
&ftdi_interface,
#endif
#if BUILD_USB_BLASTER_LIBFTDI == 1 || BUILD_USB_BLASTER_FTD2XX == 1
&usb_blaster_interface,
#endif