aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-02-15 23:17:24 +0100
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-11-06 09:47:12 +0000
commitbcaf775fc10d88d2c63c06bafada141895318b34 (patch)
tree043dfe21d9dc1d5fefac0e98341d0fa8e7cd4084
parentcc2d4f015f72d7c30d613b50572eb9f31fac515a (diff)
Remove support for the GPL incompatible FTDI D2XX library
Convert Presto, OpenJTAG and USB-Blaster (I) adapter drivers to libftdi only. Change-Id: Ib28887620a3dcbb754b9dbf87b9731acca3ac600 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3237 Tested-by: jenkins Reviewed-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
-rw-r--r--README42
-rw-r--r--configure.ac364
-rw-r--r--doc/openocd.texi2
-rw-r--r--src/jtag/drivers/Makefile.am3
-rw-r--r--src/jtag/drivers/ftd2xx_common.h55
-rw-r--r--src/jtag/drivers/openjtag.c173
-rw-r--r--src/jtag/drivers/presto.c219
-rw-r--r--src/jtag/drivers/usb_blaster/Makefile.am6
-rw-r--r--src/jtag/drivers/usb_blaster/ublast_access.h7
-rw-r--r--src/jtag/drivers/usb_blaster/ublast_access_ftd2xx.c180
-rw-r--r--src/jtag/drivers/usb_blaster/usb_blaster.c9
-rw-r--r--src/jtag/interfaces.c8
-rw-r--r--tcl/board/telo.cfg3
-rw-r--r--tcl/interface/usb-jtag.cfg4
14 files changed, 44 insertions, 1031 deletions
diff --git a/README b/README
index 7ca5957a..792d7e39 100644
--- a/README
+++ b/README
@@ -181,10 +181,6 @@ suggestions:
particular hardware;
- Use "ftdi" interface adapter driver for the FTDI-based devices.
-As a PACKAGER, never link against the FTD2XX library, as the resulting
-binaries can't be legally distributed, due to the restrictions of the
-GPL.
-
================
Building OpenOCD
@@ -226,10 +222,8 @@ libusb-0.1 or libusb-compat-0.1. A compatible implementation, such as
FreeBSD's, additionally needs the corresponding .pc files.
USB-Blaster, ASIX Presto and OpenJTAG interface adapter
-drivers need either one of:
+drivers need:
- libftdi: http://www.intra2net.com/en/developer/libftdi/index.php
- - ftd2xx: http://www.ftdichip.com/Drivers/D2XX.htm (proprietary,
- GPL-incompatible)
CMSIS-DAP support needs HIDAPI library.
@@ -301,40 +295,6 @@ use both the --enable-parport AND the --enable-parport-giveio option
if you want to use giveio instead of ioperm parallel port access
method.
-Using FTDI's FTD2XX
--------------------
-
-The (closed source) FTDICHIP.COM solution is faster than libftdi on
-Windows. That is the motivation for supporting it even though its
-licensing restricts it to non-redistributable OpenOCD binaries, and it
-is not available for all operating systems used with OpenOCD. You may,
-however, build such copies for personal use.
-
-The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux)
-TAR.GZ file. You must unpack them ``some where'' convenient. As of this
-writing FTDICHIP does not supply means to install these files "in an
-appropriate place."
-
-You should use the following ./configure options to make use of
-FTD2XX:
-
- --with-ftd2xx-win32-zipdir
- Where (CYGWIN/MINGW) the zip file from ftdichip.com
- was unpacked <default=search>
- --with-ftd2xx-linux-tardir
- Where (Linux/Unix) the tar file from ftdichip.com
- was unpacked <default=search>
- --with-ftd2xx-lib=(static|shared)
- Use static or shared ftd2xx libs (default is static)
-
-Remember, this library is binary-only, while OpenOCD is licenced
-according to GNU GPLv2 without any exceptions. That means that
-_distributing_ copies of OpenOCD built with the FTDI code would
-violate the OpenOCD licensing terms.
-
-Note that on Linux there is no good reason to use these FTDI binaries;
-they are no faster (on Linux) than libftdi, and cause licensing issues.
-
==========================
Obtaining OpenOCD From GIT
diff --git a/configure.ac b/configure.ac
index 5fb4d2c8..a47a1841 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,36 +159,6 @@ else
fi
AC_MSG_RESULT([$build_release])
-AC_ARG_WITH(ftd2xx,
- AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
- [
-# Option Given.
-cat << __EOF__
-
-The option: --with-ftd2xx=<PATH> has been removed.
-On Linux, the new option is:
-
- --with-ftd2xx-linux-tardir=/path/to/files
-
-Where <path> is the path the the directory where the "tar.gz" file
-from FTDICHIP.COM was unpacked, for example:
-
- --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
-
-On Cygwin/MingW32, the new option is:
-
- --with-ftd2xx-win32-zipdir=/path/to/files
-
-Where <path> is the path to the directory where the "zip" file from
-FTDICHIP.COM was unpacked, for example:
-
- --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
-
-__EOF__
-
- AC_MSG_ERROR([Sorry Cannot continue])
- ], [true])
-
# Adapter drivers
# 1st column -- configure option
# 2nd column -- description
@@ -223,63 +193,6 @@ m4_define([HIDAPI_ADAPTERS],
m4_define([LIBJAYLINK_ADAPTERS],
[[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
-#========================================
-# FTD2XXX support comes in 4 forms.
-# (1) win32 - via a zip file
-# (2) linux - via a tar file
-# (3) linux/cygwin/mingw - via libftdi
-# (4) darwin - installed under /usr/local
-#
-# In case (1) and (2) we need to know where the package was unpacked.
-
-AC_ARG_WITH(ftd2xx-win32-zipdir,
- AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
- [
- # option present
- if test -d $with_ftd2xx_win32_zipdir
- then
- with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
- AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
- else
- AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
- fi
- ], [true])
-
-AC_ARG_WITH(ftd2xx-linux-tardir,
- AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
- [
- # Option present
- if test $is_win32 = yes ; then
- AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
- fi
- if test -d $with_ftd2xx_linux_tardir
- then
- with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
- AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
- else
- AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
- fi
- ], [true])
-
-AC_ARG_WITH(ftd2xx-lib,
- AS_HELP_STRING([--with-ftd2xx-lib],
- [Use static or shared ftd2xx libs (default=static)]),
- [
- case "$withval" in
- static)
- with_ftd2xx_lib=$withval
- ;;
- shared)
- with_ftd2xx_lib=$withval
- ;;
- *)
- AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
- ;;
- esac
- ], [
- # Default is static - it is simpler :-(
- with_ftd2xx_lib=static
- ])
AC_ARG_ENABLE([doxygen-html],
AS_HELP_STRING([--disable-doxygen-html],
@@ -402,12 +315,8 @@ AC_ARG_ENABLE([jtag_vpi],
[build_jtag_vpi=$enableval], [build_jtag_vpi=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])
-
-AC_ARG_ENABLE([usb_blaster_ftd2xx],
- AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
- [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
+ AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver]),
+ [build_usb_blaster=$enableval], [build_usb_blaster=no])
AC_ARG_ENABLE([amtjtagaccel],
AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
@@ -452,20 +361,12 @@ AC_ARG_ENABLE([gw16012],
[build_gw16012=$enableval], [build_gw16012=no])
AC_ARG_ENABLE([presto_libftdi],
- AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
- [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
-
-AC_ARG_ENABLE([presto_ftd2xx],
- AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
- [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
-
-AC_ARG_ENABLE([openjtag_ftd2xx],
- AS_HELP_STRING([--enable-openjtag_ftd2xx], [Enable building support for the OpenJTAG Programmer with ftd2xx driver]),
- [build_openjtag_ftd2xx=$enableval], [build_openjtag_ftd2xx=no])
+ AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi library]),
+ [build_presto=$enableval], [build_presto=no])
AC_ARG_ENABLE([openjtag_ftdi],
- AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with ftdi driver]),
- [build_openjtag_ftdi=$enableval], [build_openjtag_ftdi=no])
+ AS_HELP_STRING([--enable-openjtag_ftdi], [Enable building support for the OpenJTAG Programmer with libftdi library]),
+ [build_openjtag=$enableval], [build_openjtag=no])
AC_ARG_ENABLE([oocd_trace],
AS_HELP_STRING([--enable-oocd_trace],
@@ -679,10 +580,10 @@ else
AC_DEFINE([BUILD_BITBANG], [0], [0 if you don't want a bitbang interface.])
fi
-if test $build_usb_blaster_libftdi = yes; then
- AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [1], [1 if you want libftdi usb_blaster.])
+if test $build_usb_blaster = yes; then
+ AC_DEFINE([BUILD_USB_BLASTER], [1], [1 if you want libftdi usb_blaster.])
else
- AC_DEFINE([BUILD_USB_BLASTER_LIBFTDI], [0], [0 if you don't want libftdi usb_blaster.])
+ AC_DEFINE([BUILD_USB_BLASTER], [0], [0 if you don't want libftdi usb_blaster.])
fi
if test $build_jtag_vpi = yes; then
@@ -691,12 +592,6 @@ else
AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
fi
-if test $build_usb_blaster_ftd2xx = yes; then
- AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [1], [1 if you want ftd2xx usb_blaster.])
-else
- AC_DEFINE([BUILD_USB_BLASTER_FTD2XX], [0], [0 if you don't want ftd2xx usb_blaster.])
-fi
-
if test $build_amtjtagaccel = yes; then
AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
else
@@ -709,18 +604,11 @@ else
AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
fi
-if test $build_presto_libftdi = yes; then
+if test $build_presto = yes; then
build_bitq=yes
- AC_DEFINE([BUILD_PRESTO_LIBFTDI], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
+ AC_DEFINE([BUILD_PRESTO], [1], [1 if you want the ASIX PRESTO driver using libftdi.])
else
- AC_DEFINE([BUILD_PRESTO_LIBFTDI], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
-fi
-
-if test $build_presto_ftd2xx = yes; then
- build_bitq=yes
- AC_DEFINE([BUILD_PRESTO_FTD2XX], [1], [1 if you want the ASIX PRESTO driver using FTD2XX.])
-else
- AC_DEFINE([BUILD_PRESTO_FTD2XX], [0], [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
+ AC_DEFINE([BUILD_PRESTO], [0], [0 if you don't want the ASIX PRESTO driver using libftdi.])
fi
if test $build_bitq = yes; then
@@ -729,17 +617,11 @@ else
AC_DEFINE([BUILD_BITQ], [0], [0 if you don't want a bitq interface.])
fi
-AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
-AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [0], [0 if you don't want the OpenJTAG driver with FTD2XX driver.])
-AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [0], [0 if you don't want to build OpenJTAG driver with libftdi.])
-if test $build_openjtag_ftd2xx = yes; then
+if test $build_openjtag = yes; then
AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG driver.])
- AC_DEFINE([BUILD_OPENJTAG_FTD2XX], [1], [1 if you want the OpenJTAG driver with FTD2XX driver.])
-fi
-if test $build_openjtag_ftdi = yes; then
- AC_DEFINE([BUILD_OPENJTAG], [1], [1 if you want the OpenJTAG drvier.])
- AC_DEFINE([BUILD_OPENJTAG_LIBFTDI], [1], [1 if you want to build OpenJTAG with FTDI driver.])
+else
+ AC_DEFINE([BUILD_OPENJTAG], [0], [0 if you don't want the OpenJTAG driver.])
fi
if test $build_oocd_trace = yes; then
@@ -775,210 +657,8 @@ if test $build_sysfsgpio = yes; then
else
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
fi
-#-- Deal with MingW/Cygwin FTD2XX issues
-
-if test $is_win32 = yes; then
-if test "${with_ftd2xx_linux_tardir+set}" = set
-then
- AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
-fi
-
-if test $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
- AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
-
- # if we are given a zipdir...
- if test "${with_ftd2xx_win32_zipdir+set}" = set
- then
- # Set the CFLAGS for "ftd2xx.h"
- f=$with_ftd2xx_win32_zipdir/ftd2xx.h
- if test ! -f $f ; then
- AC_MSG_ERROR([File: $f cannot be found])
- fi
- CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
-
- # And calculate the LDFLAGS for the machine
- case "$host_cpu" in
- i?86|x86_32)
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
- LIBS="$LIBS -lftd2xx"
- f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
- ;;
- amd64|x86_64)
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
- LIBS="$LIBS -lftd2xx"
- f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
- ;;
- *)
- AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
- ;;
- esac
- if test ! -f $f ; then
- AC_MSG_ERROR([Library: $f not found])
- fi
- else
- LIBS="$LIBS -lftd2xx"
- AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
- fi
-fi
-fi # win32
-
-if test $is_darwin = yes ; then
-if test "${with_ftd2xx_win32_zipdir+set}" = set
-then
- AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
-fi
-if test "${with_ftd2xx_linux_tardir+set}" = set
-then
- AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
-fi
-
-if test $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
- AC_MSG_CHECKING([for libftd2xx.a (darwin)])
-
- if test ! -f /usr/local/include/ftd2xx.h ; then
- AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
- fi
-
- CFLAGS="$CFLAGS -I/usr/local/include"
- LDFLAGS="$LDFLAGS -L/usr/local/lib"
- LIBS="$LIBS -lftd2xx"
- AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
-fi
-fi # darwin
-
-if test $is_win32 = no && test $is_darwin = no ; then
-
-if test "${with_ftd2xx_win32_zipdir+set}" = set
-then
- AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
-fi
-
-if test $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes -o $build_openjtag_ftd2xx = yes; then
- # Must be linux
- if test $host_os != linux-gnu && test $host_os != linux ; then
- AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-*-libftdi instead])
- fi
- # Are we given a TAR directory?
- if test "${with_ftd2xx_linux_tardir+set}" = set
- then
- AC_MSG_CHECKING([uninstalled ftd2xx distribution])
- # The .H file is simple..
- FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
- if test ! -f "${FTD2XX_H}"; then
- AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
- fi
- CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
- if test $with_ftd2xx_lib = shared; then
- FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
- FTD2XX_LIB="-lftd2xx"
- else
- # Test #1 - v1.0.x
- case "$host_cpu" in
- i?86|x86_32)
- dir=build/i386;;
- amd64|x86_64)
- dir=build/x86_64;;
- *)
- dir=none;;
- esac
- if test -f "$with_ftd2xx_linux_tardir/$dir/libftd2xx.a"; then
- FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir/$dir"
- # Also needs -lrt
- FTD2XX_LIB="-lftd2xx -lrt"
- else
- # Test Number2.
- # Grr.. perhaps it exists as a version number?
- FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
- count=`ls ${FTD2XX_LIB} | wc -l`
- if test $count -gt 1 ; then
- AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
- fi
- if test $count -ne 1 ; then
- AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
- fi
- # Because the "-l" rules do not understand version numbers...
- # we will just stuff the absolute path onto the LIBS variable
- FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
- FTD2XX_LDFLAGS=""
- fi
- fi
- LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
- LIBS="${FTD2XX_LIB} ${LIBS}"
- AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
- else
- AC_CHECK_HEADER([ftd2xx.h],[],[
- AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
- ])
- AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
- AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
- ],[-lrt -lusb-1.0])
- fi
-fi
-fi # linux
-
-if test $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
-
-# Before we go any further - make sure we can *BUILD* and *RUN*
-# a simple app with the "ftd2xx.lib" file - in what ever form we where given
-# We should be able to compile, link and run this test program now
-AC_MSG_CHECKING([whether ftd2xx library works])
-
-#
-# Save the LDFLAGS for later..
-LDFLAGS_SAVE=$LDFLAGS
-CFLAGS_SAVE=$CFLAGS
-_LDFLAGS=`eval echo $LDFLAGS`
-_CFLAGS=`eval echo $CFLAGS`
-LDFLAGS=$_LDFLAGS
-CFLAGS=$_CFLAGS
-
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h"
-#if IS_WIN32
-#include "windows.h"
-#endif
-#include <stdio.h>
-#include <ftd2xx.h>
- ]], [[
- DWORD x;
- FT_GetLibraryVersion( &x );
- ]])], [
- AC_MSG_RESULT([Success!])
- ], [
- AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
- ], [
- AC_MSG_RESULT([Skipping as we are cross-compiling])
- ])
-
-AC_MSG_CHECKING([for ftd2xx FT232H device support])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h"
-#if IS_WIN32
-#include "windows.h"
-#endif
-#include <stdio.h>
-#include <ftd2xx.h>
-
-DWORD x = FT_DEVICE_232H;
- ]], [])], [
- AC_DEFINE([HAS_ENUM_FT232H], [1],
- [Support FT232H with FTD2XX or libftdi.])
- has_enum_ft232h=yes
- ], [
- has_enum_ft232h=no
- ])
- AC_MSG_RESULT([$has_enum_ft232h])
-
- if test $has_enum_ft232h = no; then
- AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
- fi
-
-LDFLAGS=$LDFLAGS_SAVE
-CFLAGS=$CFLAGS_SAVE
-fi
-if test $build_usb_blaster_libftdi = yes -o \
- $build_openjtag_ftdi = yes -o $build_presto_libftdi = yes; then
+if test $build_usb_blaster = yes -o $build_openjtag = yes -o $build_presto = yes; then
# we can have libftdi or libftdi1, so check it and use the latest one
PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
@@ -1032,7 +712,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
enum ftdi_chip_type x = TYPE_232H;
]])], [
AC_DEFINE([HAS_ENUM_FT232H], [1],
- [Support FT232H with FTD2XX or libftdi.])
+ [Support FT232H with libftdi.])
has_enum_ft232h=yes
], [
has_enum_ft232h=no
@@ -1131,15 +811,13 @@ AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
AM_CONDITIONAL([BCM2835GPIO], [test $build_bcm2835gpio = yes])
AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
-AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
-AM_CONDITIONAL([USB_BLASTER_FTD2XX], [test $build_usb_blaster_ftd2xx = yes])
AM_CONDITIONAL([JTAG_VPI], [test $build_jtag_vpi = yes -o $build_jtag_vpi = yes])
-AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes -o $enable_usb_blaster_2 != no])
+AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster = yes -o $enable_usb_blaster_2 != no])
+AM_CONDITIONAL([USB_BLASTER], [test $build_usb_blaster = yes])
AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
-AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
-AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
-AM_CONDITIONAL([OPENJTAG], [test $build_openjtag_ftd2xx = yes -o $build_openjtag_ftdi = yes])
+AM_CONDITIONAL([PRESTO], [test $build_presto = yes])
+AM_CONDITIONAL([OPENJTAG], [test $build_openjtag = yes])
AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 34cf69df..0fef9fbb 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2624,7 +2624,7 @@ reset_config srst_only
@end example
@end deffn
-@deffn {Command} {usb_blaster_lowlevel_driver} (@option{ftdi}|@option{ftd2xx}|@option{ublast2})
+@deffn {Command} {usb_blaster_lowlevel_driver} (@option{ftdi}|@option{ublast2})
Chooses the low level access method for the adapter. If not specified,
@option{ftdi} is selected unless it wasn't enabled during the
configure stage. USB-Blaster II needs @option{ublast2}.
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index 4c4e7745..1322c0f1 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -85,7 +85,7 @@ endif
if BITQ
DRIVERFILES += bitq.c
endif
-if PRESTO_DRIVER
+if PRESTO
DRIVERFILES += presto.c
endif
if USBPROG
@@ -145,7 +145,6 @@ endif
noinst_HEADERS = \
bitbang.h \
bitq.h \
- ftd2xx_common.h \
libusb0_common.h \
libusb1_common.h \
libusb_common.h \
diff --git a/src/jtag/drivers/ftd2xx_common.h b/src/jtag/drivers/ftd2xx_common.h
deleted file mode 100644
index eaf14aed..00000000
--- a/src/jtag/drivers/ftd2xx_common.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2011 by Spencer Oliver <spen@spen-soft.co.uk> *
- * *
- * Written by Arnim Laeuger, 2008 (from urjtag) *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#ifndef OPENOCD_JTAG_DRIVERS_FTD2XX_COMMON_H
-#define OPENOCD_JTAG_DRIVERS_FTD2XX_COMMON_H
-
-#if ((BUILD_PRESTO_FTD2XX == 1) || (BUILD_USB_BLASTER_FTD2XX == 1))
-#include <ftd2xx.h>
-
-static const char *ftd2xx_status_string(FT_STATUS status)
-{
- switch (status) {
- case FT_OK: return "OK";
- case FT_INVALID_HANDLE: return "invalid handle";
- case FT_DEVICE_NOT_FOUND: return "device not found";
- case FT_DEVICE_NOT_OPENED: return "device not opened";
- case FT_IO_ERROR: return "io error";
- case FT_INSUFFICIENT_RESOURCES: return "insufficient resources";
- case FT_INVALID_PARAMETER: return "invalid parameter";
- case FT_INVALID_BAUD_RATE: return "invalid baud rate";
-
- case FT_DEVICE_NOT_OPENED_FOR_ERASE: return "device not opened for erase";
- case FT_DEVICE_NOT_OPENED_FOR_WRITE: return "device not opened for write";
- case FT_FAILED_TO_WRITE_DEVICE: return "failed to write device";
- case FT_EEPROM_READ_FAILED: return "eeprom read failed";
- case FT_EEPROM_WRITE_FAILED: return "eeprom write failed";
- case FT_EEPROM_ERASE_FAILED: return "eeprom erase failed";
- case FT_EEPROM_NOT_PRESENT: return "eeprom not present";
- case FT_EEPROM_NOT_PROGRAMMED: return "eeprom not programmed";
- case FT_INVALID_ARGS: return "invalid args";
- case FT_NOT_SUPPORTED: return "not supported";
- case FT_OTHER_ERROR: return "other error";
- }
-
- return "undefined FTD2xx error";
-}
-
-#endif
-#endif /* OPENOCD_JTAG_DRIVERS_FTD2XX_COMMON_H */
diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c
index 157020e8..5d1084ce 100644
--- a/src/jtag/drivers/openjtag.c
+++ b/src/jtag/drivers/openjtag.c
@@ -1,6 +1,6 @@
/*******************************************************************************
* Driver for OpenJTAG Project (www.openjtag.org) *
- * Compatible with libftdi and ftd2xx drivers. *
+ * Compatible with libftdi driver. *
* *
* Copyright (C) 2010 by Ivan Meleca <mileca@gmail.com> *
* *
@@ -66,19 +66,8 @@ typedef enum openjtag_tap_state {
OPENJTAG_TAP_UPDATE_IR = 15,
} openjtag_tap_state_t;
-#if (BUILD_OPENJTAG_FTD2XX == 1 && BUILD_OPENJTAG_LIBFTDI == 1)
-#error "BUILD_OPENJTAG_FTD2XX && BUILD_OPENJTAG_LIBFTDI "
- "are mutually exclusive"
-#elif (BUILD_OPENJTAG_FTD2XX != 1 && BUILD_OPENJTAG_LIBFTDI != 1)
-#error "BUILD_OPENJTAG_FTD2XX || BUILD_OPENJTAG_LIBFTDI must be chosen"
-#endif
-
/* OPENJTAG access library includes */
-#if BUILD_OPENJTAG_FTD2XX == 1
-#include <ftd2xx.h>
-#elif BUILD_OPENJTAG_LIBFTDI == 1
#include <ftdi.h>
-#endif
/* OpenJTAG vid/pid */
static uint16_t openjtag_vid = 0x0403;
@@ -86,12 +75,7 @@ static uint16_t openjtag_pid = 0x6001;
static char *openjtag_device_desc;
-#if BUILD_OPENJTAG_FTD2XX == 1
-static FT_HANDLE ftdih;
-
-#elif BUILD_OPENJTAG_LIBFTDI == 1
static struct ftdi_context ftdic;
-#endif
#define OPENJTAG_BUFFER_SIZE 504
#define OPENJTAG_MAX_PENDING_RESULTS 256
@@ -204,23 +188,6 @@ static int8_t openjtag_get_tap_state(int8_t state)
static int openjtag_buf_write(
uint8_t *buf, int size, uint32_t *bytes_written)
{
-#if BUILD_OPENJTAG_FTD2XX == 1
- FT_STATUS status;
- DWORD dw_bytes_written;
-
-#ifdef _DEBUG_USB_COMMS_
- openjtag_debug_buffer(buf, size, DEBUG_TYPE_WRITE);
-#endif
-
- status = FT_Write(ftdih, buf, size, &dw_bytes_written);
- if (status != FT_OK) {
- *bytes_written = dw_bytes_written;
- LOG_ERROR("FT_Write returned: %u", status);
- return ERROR_JTAG_DEVICE_ERROR;
- }
- *bytes_written = dw_bytes_written;
- return ERROR_OK;
-#elif BUILD_OPENJTAG_LIBFTDI == 1
int retval;
#ifdef _DEBUG_USB_COMMS_
openjtag_debug_buffer(buf, size, DEBUG_TYPE_WRITE);
@@ -236,36 +203,10 @@ static int openjtag_buf_write(
*bytes_written += retval;
return ERROR_OK;
-#endif
}
static int openjtag_buf_read(uint8_t *buf, uint32_t qty, uint32_t *bytes_read)
{
-
-#if BUILD_OPENJTAG_FTD2XX == 1
- DWORD dw_bytes_read;
- FT_STATUS status;
- int timeout = 50;
-
- *bytes_read = 0;
- while (qty && (*bytes_read < qty) && timeout--) {
-
- status = FT_Read(ftdih, buf + *bytes_read,
- qty - *bytes_read, &dw_bytes_read);
- if (status != FT_OK) {
- *bytes_read = dw_bytes_read;
- LOG_ERROR("FT_Read returned: %u", status);
- return ERROR_JTAG_DEVICE_ERROR;
- }
- *bytes_read += dw_bytes_read;
- }
-
-#ifdef _DEBUG_USB_COMMS_
- openjtag_debug_buffer(buf, *bytes_read, DEBUG_TYPE_READ);
-#endif
-
- return ERROR_OK;
-#elif BUILD_OPENJTAG_LIBFTDI == 1
int retval;
int timeout = 5;
@@ -287,7 +228,6 @@ static int openjtag_buf_read(uint8_t *buf, uint32_t qty, uint32_t *bytes_read)
openjtag_debug_buffer(buf, *bytes_read, DEBUG_TYPE_READ);
#endif
-#endif
return ERROR_OK;
}
@@ -339,105 +279,19 @@ static int openjtag_init(void)
{
uint8_t latency_timer;
-#if BUILD_OPENJTAG_FTD2XX == 1
- FT_STATUS status;
-#endif
-
-usb_tx_buf_offs = 0;
-usb_rx_buf_len = 0;
-openjtag_scan_result_count = 0;
+ usb_tx_buf_offs = 0;
+ usb_rx_buf_len = 0;
+ openjtag_scan_result_count = 0;
-#if BUILD_OPENJTAG_FTD2XX == 1
- LOG_DEBUG("'openjtag' interface using FTD2XX");
-#elif BUILD_OPENJTAG_LIBFTDI == 1
LOG_DEBUG("'openjtag' interface using libftdi");
-#endif
-/* Open by device description */
-if (openjtag_device_desc == NULL) {
- LOG_WARNING("no openjtag device description specified, "
+ /* Open by device description */
+ if (openjtag_device_desc == NULL) {
+ LOG_WARNING("no openjtag device description specified, "
"using default 'Open JTAG Project'");
- openjtag_device_desc = "Open JTAG Project";
-}
-
-#if BUILD_OPENJTAG_FTD2XX == 1
-
-#if IS_WIN32 == 0
- /* Add non-standard Vid/Pid to the linux driver */
- status = FT_SetVIDPID(openjtag_vid, openjtag_pid);
- if (status != FT_OK) {
- LOG_WARNING("couldn't add %4.4x:%4.4x",
- openjtag_vid, openjtag_pid);
- }
-#endif
-
- status = FT_OpenEx(openjtag_device_desc, FT_OPEN_BY_DESCRIPTION,
- &ftdih);
- if (status != FT_OK) {
- DWORD num_devices;
-
- LOG_ERROR("unable to open ftdi device: %u", status);
- status = FT_ListDevices(&num_devices, NULL,
- FT_LIST_NUMBER_ONLY);
- if (status == FT_OK) {
- char **desc_array = malloc(sizeof(char *)
- * (num_devices + 1));
- unsigned int i;
-
- for (i = 0; i < num_devices; i++)
- desc_array[i] = malloc(64);
- desc_array[num_devices] = NULL;
-
- status = FT_ListDevices(desc_array, &num_devices,
- FT_LIST_ALL | FT_OPEN_BY_DESCRIPTION);
-
- if (status == FT_OK) {
- LOG_ERROR("ListDevices: %u\n", num_devices);
- for (i = 0; i < num_devices; i++)
- LOG_ERROR("%i: %s", i, desc_array[i]);
- }
-
- for (i = 0; i < num_devices; i++)
- free(desc_array[i]);
- free(desc_array);
- } else {
- LOG_ERROR("ListDevices: NONE\n");
- }
- return ERROR_JTAG_INIT_FAILED;
+ openjtag_device_desc = "Open JTAG Project";
}
- status = FT_SetLatencyTimer(ftdih, 2);
- if (status != FT_OK) {
- LOG_ERROR("unable to set latency timer: %u", status);
- return ERROR_JTAG_INIT_FAILED;
- }
-
- status = FT_GetLatencyTimer(ftdih, &latency_timer);
- if (status != FT_OK) {
- LOG_ERROR("unable to get latency timer: %u", status);
- return ERROR_JTAG_INIT_FAILED;
- }
- LOG_DEBUG("current latency timer: %i", latency_timer);
-
- status = FT_SetBitMode(ftdih, 0x00, 0x40);
- if (status != FT_OK) {
- LOG_ERROR("unable to disable bit i/o mode: %u", status);
- return ERROR_JTAG_INIT_FAILED;
- }
-
- status = FT_SetTimeouts(ftdih, 50, 0);
- if (status != FT_OK) {
- LOG_ERROR("unable to set timeouts: %u", status);
- return ERROR_JTAG_INIT_FAILED;
- }
-
- status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX);
- if (status != FT_OK) {
- LOG_ERROR("unable to FT_Purge() %u", status);
- return ERROR_JTAG_INIT_FAILED;
- }
-
-#elif BUILD_OPENJTAG_LIBFTDI == 1
if (ftdi_init(&ftdic) < 0)
return ERROR_JTAG_INIT_FAILED;
@@ -470,18 +324,11 @@ if (openjtag_device_desc == NULL) {
ftdi_get_error_string(&ftdic));
return ERROR_JTAG_DEVICE_ERROR;
}
-#endif
-#if BUILD_OPENJTAG_FTD2XX == 1
- status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX);
- if (status != FT_OK)
- return ERROR_JTAG_INIT_FAILED;
-#elif BUILD_OPENJTAG_LIBFTDI == 1
if (ftdi_usb_purge_buffers(&ftdic) < 0) {
LOG_ERROR("ftdi_purge_buffers: %s", ftdic.error_str);
return ERROR_JTAG_INIT_FAILED;
}
-#endif
/* OpenJTAG speed */
openjtag_sendcommand(0xE0); /*Start at slowest adapter speed*/
@@ -494,12 +341,8 @@ if (openjtag_device_desc == NULL) {
static int openjtag_quit(void)
{
-#if BUILD_OPENJTAG_FTD2XX == 1
- FT_Close(ftdih);
-#elif BUILD_OPENJTAG_LIBFTDI == 1
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
-#endif
return ERROR_OK;
}
diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c
index 0a18dc9c..49caa679 100644
--- a/src/jtag/drivers/presto.c
+++ b/src/jtag/drivers/presto.c
@@ -34,14 +34,7 @@
#include "bitq.h"
/* PRESTO access library includes */
-#if BUILD_PRESTO_FTD2XX == 1
-#include <ftd2xx.h>
-#include "ftd2xx_common.h"
-#elif BUILD_PRESTO_LIBFTDI == 1
#include <ftdi.h>
-#else
-#error "BUG: either FTD2XX and LIBFTDI has to be used"
-#endif
/* -------------------------------------------------------------------------- */
@@ -55,13 +48,8 @@
#define BUFFER_SIZE (64*62)
struct presto {
-#if BUILD_PRESTO_FTD2XX == 1
- FT_HANDLE handle;
- FT_STATUS status;
-#elif BUILD_PRESTO_LIBFTDI == 1
struct ftdi_context ftdic;
int retval;
-#endif