unify ftdi help output more across sub drivers and the usbconn layer

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1809 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 15 years ago
parent e020ca4737
commit cd4fb2e516

@ -2,6 +2,20 @@
* src/tap/cable/generic_usbconn_list.h: Macro away duplicate ftdi lists.
* src/tap/cable/generic_usbconn.c: Extend help function to include some
ideas used by the FTDI help (show default vid/pid/driver). Also add an
extended help function to show additional help strings so sub-drivers
need not duplicate this function.
* src/tap/cable/generic_usbconn.h: Add prototype for new helper function.
* src/tap/cable/ft2232.c: Switch to new usbconn helper function and export
the FTDI-specific helper function so external FTDI drivers can use it.
* src/tap/usbconn/libftdx.h: Add prototype for new FTDI helper function.
* src/tap/cable/usbblaster.c: Switch to common FTDI helper function and
drop unused local ftdi code.
* src/tap/cable/ft2232_list.h: Drop now that ft2232 uses common code which
only needs the common list of drivers.
* src/tap/Makefile.am: Drop ft2232_list.h reference.
2010-06-28 Mike Frysinger <vapier@gentoo.org>
* src/tap/cable/ice100.c: Drop local help stub and use common libusb one.

@ -121,8 +121,7 @@ endif
if ENABLE_CABLE_FT2232
libtap_la_SOURCES += \
cable/ft2232.c \
cable/ft2232_list.h
cable/ft2232.c
endif
if ENABLE_CABLE_TS7800

@ -1927,32 +1927,12 @@ ft2232_cable_free (urj_cable_t *cable)
}
#define _URJ_FTDI(usb) const urj_usbconn_cable_t urj_tap_cable_usbconn_##usb##_ftdi;
#include "ft2232_list.h"
static void
ft2232_usbcable_help (urj_log_level_t ll, const char *cablename)
void
ftdx_usbcable_help (urj_log_level_t ll, const char *cablename)
{
const urj_usbconn_cable_t *conn;
#define _URJ_FTDI(usb) \
conn = &urj_tap_cable_usbconn_##usb##_ftdi; \
if (strcasecmp (conn->name, cablename) == 0) \
goto found;
#include "ft2232_list.h"
found:
urj_log (ll,
_("Usage: cable %s %s [driver=DRIVER]\n"
"\n" "%s"
"DRIVER usbconn driver, either ftdi-mpsse or ftd2xx-mpsse\n"
"\n"
"Default: vid=%x pid=%x driver=%s\n"
"\n"),
cablename, URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT,
URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC,
conn->vid, conn->pid, DEFAULT_DRIVER);
const char *ex_short = "[driver=DRIVER]";
const char *ex_desc = "DRIVER usbconn driver, either ftdi-mpsse or ftd2xx-mpsse\n";
urj_tap_cable_generic_usbconn_help_ex (ll, cablename, ex_short, ex_desc);
}
@ -1972,7 +1952,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0000, 0x0000, "-mpsse", "FT2232", ft2232)
@ -1992,7 +1972,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_armusbocd_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x15BA, 0x0003, "-mpsse", "ARM-USB-OCD", armusbocd)
URJ_DECLARE_FTDX_CABLE(0x15BA, 0x0004, "-mpsse", "ARM-USB-OCD", armusbocdtiny)
@ -2013,7 +1993,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_armusbtiny_h_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x15BA, 0x002A, "-mpsse", "ARM-USB-TINY-H", armusbtiny_h)
@ -2033,7 +2013,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_gnice_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0456, 0xF000, "-mpsse", "gnICE", gnice)
@ -2053,7 +2033,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_gniceplus_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0456, 0xF001, "-mpsse", "gnICE+", gniceplus)
@ -2073,7 +2053,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_jtagkey_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0xCFF8, "-mpsse", "JTAGkey", jtagkey)
@ -2093,7 +2073,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_oocdlinks_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0xbaf8, "-mpsse", "OOCDLink-s", oocdlinks)
@ -2113,7 +2093,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_turtelizer2_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0xBDC8, "-mpsse", "Turtelizer2", turtelizer2)
@ -2133,7 +2113,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_usbtojtagif_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0000, 0x0000, "-mpsse", "USB-to-JTAG-IF", usbtojtagif)
@ -2153,7 +2133,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_signalyzer_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0xbca1, "-mpsse", "Signalyzer", signalyzer)
@ -2173,7 +2153,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_flyswatter_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0x6010, "-mpsse", "Flyswatter", flyswatter)
@ -2193,7 +2173,7 @@ const urj_cable_driver_t urj_tap_cable_ft2232_usbscarab2_driver = {
ft2232_set_signal,
urj_tap_cable_generic_get_signal,
ft2232_flush,
ft2232_usbcable_help
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x0403, 0xbbe0, "-mpsse", "usbScarab2", usbscarab2)

@ -1,41 +0,0 @@
/*
* $Id$
*
* Generic cable driver for FTDI's FT2232C chip in MPSSE mode.
* Copyright (C) 2007 A. Laeuger
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Arnim Laeuger, 2007-2008.
* Support for JTAGkey submitted by Laurent Gauch, 2008.
* Support for FT2232H written by Michael Hennerich, 2009; adapted
* for urjtag codebase and submitted by Adam Megacz, 2010.
*
*/
_URJ_FTDI(armusbocd)
_URJ_FTDI(flyswatter)
_URJ_FTDI(ft2232)
_URJ_FTDI(gnice)
_URJ_FTDI(gniceplus)
_URJ_FTDI(jtagkey)
_URJ_FTDI(oocdlinks)
_URJ_FTDI(signalyzer)
_URJ_FTDI(turtelizer2)
_URJ_FTDI(usbscarab2)
_URJ_FTDI(usbtojtagif)
#undef _URJ_FTDI

@ -163,13 +163,40 @@ urj_tap_cable_generic_usbconn_done (urj_cable_t *cable)
}
void
urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *cablename)
urj_tap_cable_generic_usbconn_help_ex (urj_log_level_t ll, const char *cablename,
const char *ex_short, const char *ex_desc)
{
int i;
const urj_usbconn_cable_t *conn;
for (i = 0; urj_tap_cable_usbconn_cables[i]; ++i)
{
conn = urj_tap_cable_usbconn_cables[i];
if (strcasecmp (conn->name, cablename) == 0)
break;
}
if (!urj_tap_cable_usbconn_cables[i])
{
urj_warning (_("Unable to locate cable %s"), cablename);
return;
}
urj_log (ll,
_("Usage: cable %s %s\n" "\n%s\n"),
_("Usage: cable %s %s %s\n"
"\n" "%s%s"
"\n"
"Default: vid=%x pid=%x driver=%s\n"
"\n"),
cablename,
URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT,
URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC);
URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT, ex_short,
URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC, ex_desc,
conn->vid, conn->pid, conn->driver);
}
void
urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *cablename)
{
urj_tap_cable_generic_usbconn_help_ex (ll, cablename, "", "");
}
int

@ -39,7 +39,9 @@ int urj_tap_cable_generic_usbconn_connect (urj_cable_t *cable,
void urj_tap_cable_generic_usbconn_done (urj_cable_t *cable);
void urj_tap_cable_generic_usbconn_free (urj_cable_t *cable);
void urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *name);
void urj_tap_cable_generic_usbconn_help (urj_log_level_t ll, const char *cablename);
void urj_tap_cable_generic_usbconn_help_ex (urj_log_level_t ll, const char *cablename,
const char *ex_short, const char *ex_desc);
#define URJ_TAP_CABLE_GENERIC_USBCONN_HELP_SHORT \
"[vid=VID] [pid=PID] [desc=DESC]"
#define URJ_TAP_CABLE_GENERIC_USBCONN_HELP_DESC \

@ -23,6 +23,13 @@
*
*/
/*
* Note: this driver doesn't seem to utilize FTDI code directly because
* it goes through the usbconn layers to access the driver. the
* required status bytes for te FT245 device are automatically added
* to the stream so this driver can focus on the other parts.
*/
#include <sysdep.h>
#include <stdio.h>
@ -36,7 +43,6 @@
#include "generic.h"
#include "generic_usbconn.h"
#include <urjtag/usbconn.h>
#include "usbconn/libftdx.h"
#include "cmd_xfer.h"
@ -53,13 +59,6 @@
#define FIXED_FREQUENCY 12000000L
/* The default driver if not specified otherwise during connect */
#ifdef ENABLE_LOWLEVEL_FTD2XX
#define DEFAULT_DRIVER "ftd2xx"
#else
#define DEFAULT_DRIVER "ftdi"
#endif
typedef struct
{
urj_tap_cable_cx_cmd_root_t cmd_root;
@ -496,19 +495,6 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
}
}
static void
usbblaster_help (urj_log_level_t ll, const char *cablename)
{
urj_log (ll,
_("Usage: cable %s [vid=VID] [pid=PID] [desc=DESC] [driver=DRIVER]\n"
"\n" "VID vendor ID (hex, e.g. 0abc)\n"
"PID product ID (hex, e.g. 0abc)\n"
"DESC Some string to match in description or serial no.\n"
"DRIVER usbconn driver, either ftdi or ftd2xx\n"
" defaults to %s if not specified\n" "\n"), cablename,
DEFAULT_DRIVER);
}
const urj_cable_driver_t urj_tap_cable_usbblaster_driver = {
"UsbBlaster",
N_("Altera USB-Blaster Cable"),
@ -527,7 +513,7 @@ const urj_cable_driver_t urj_tap_cable_usbblaster_driver = {
// urj_tap_cable_generic_flush_one_by_one,
// urj_tap_cable_generic_flush_using_transfer,
usbblaster_flush,
usbblaster_help,
ftdx_usbcable_help
};
URJ_DECLARE_FTDX_CABLE(0x09FB, 0x6001, "", "UsbBlaster", usbblaster)
URJ_DECLARE_FTDX_CABLE(0x09FB, 0x6002, "", "UsbBlaster", cubic_cyclonium)

@ -56,4 +56,6 @@
_URJ_DECLARE_FTDI_CABLE(v, p, "ftdi"d, n, c##_ftdi) \
_URJ_DECLARE_FTD2XX_CABLE(v, p, "ftd2xx"d, n, c##_ftd2xx)
void ftdx_usbcable_help (urj_log_level_t ll, const char *cablename);
#endif

Loading…
Cancel
Save