From 3222da493d6fb37f80f42d46a78d79ed97cc3d87 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 29 Jun 2010 20:12:53 +0000 Subject: [PATCH] revert usbblaster de-ftdi-ification as Arnim points out things are used indirectly via the generic usb layers git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1807 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 --- urjtag/configure.ac | 4 +-- urjtag/src/tap/cable/generic_usbconn_list.h | 16 ++++++--- urjtag/src/tap/cable/usbblaster.c | 40 +++++++++++++++++---- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 3e0c9b71..ccbf0103 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,10 +1,5 @@ 2010-06-28 Mike Frysinger - * configure.ac (usbblaster): Move from libftdi to libusb requirement. - * src/tap/cable/generic_usbconn_list.h: Drop ftdx usbblaster cables and add - libusb usbblaser cables. - * src/tap/cable/usbblaster.c: Convert from libftdx helpers to libusb helpers. - * src/tap/cable/ice100.c: Drop local help stub and use common libusb one. * src/tap/cable/generic_usbconn.h: Split help text out so sub-libusb drivers diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 651db7fa..515ddeaa 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -662,10 +662,10 @@ URJ_DRIVER_SET([cable], [ ],[ # automatically disable cable drivers when a required feature is not available AS_IF([test "x$HAVELIBFTDI" != "xyes" -a "x$HAVELIBFTD2XX" != "xyes"], [ - drivers=`echo ${drivers} | $SED -e "s/ft2232//"` + drivers=`echo ${drivers} | $SED -e "s/ft2232//" -e "s/usbblaster//"` ]) AS_IF([test "x$HAVELIBUSB" = "xno"], [ - drivers=`echo ${drivers} | $SED -e "s/jlink//" -e "s/xpc//" -e "s/usbblaster//"` + drivers=`echo ${drivers} | $SED -e "s/jlink//" -e "s/xpc//"` ]) ]) dnl the "fake" jim cable driver is special diff --git a/urjtag/src/tap/cable/generic_usbconn_list.h b/urjtag/src/tap/cable/generic_usbconn_list.h index ab862847..57891773 100644 --- a/urjtag/src/tap/cable/generic_usbconn_list.h +++ b/urjtag/src/tap/cable/generic_usbconn_list.h @@ -62,10 +62,18 @@ _URJ_USB(usbscarab2_ftdi) #endif #endif #ifdef ENABLE_CABLE_USBBLASTER -_URJ_USB(usbblaster) -_URJ_USB(cubic_cyclonium) -_URJ_USB(nios_eval) -_URJ_USB(usb_jtag) +#ifdef ENABLE_LOWLEVEL_FTD2XX +_URJ_USB(usbblaster_ftd2xx) +_URJ_USB(cubic_cyclonium_ftd2xx) +_URJ_USB(nios_eval_ftd2xx) +_URJ_USB(usb_jtag_ftd2xx) +#endif +#ifdef ENABLE_LOWLEVEL_FTDI +_URJ_USB(usbblaster_ftdi) +_URJ_USB(cubic_cyclonium_ftdi) +_URJ_USB(nios_eval_ftdi) +_URJ_USB(usb_jtag_ftdi) +#endif #endif #ifdef ENABLE_CABLE_ICE100 _URJ_USB(ice100B) diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index cf4368f9..fee2e670 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -36,6 +36,9 @@ #include "generic.h" #include "generic_usbconn.h" +#include +#include "usbconn/libftdx.h" + #include "cmd_xfer.h" @@ -50,6 +53,13 @@ #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; @@ -153,8 +163,9 @@ usbblaster_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) if (chunkbytes > 63) chunkbytes = 63; - /* 4096 == URJ_USBCONN_FTDX_MAXSEND ? */ - if (urj_tap_cable_cx_cmd_space (cmd_root, 4096) < chunkbytes + 1) + if (urj_tap_cable_cx_cmd_space (cmd_root, + URJ_USBCONN_FTDX_MAXSEND) + < chunkbytes + 1) { /* no space left for next clocking command transfer queued commands to device and read receive data @@ -485,6 +496,19 @@ 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"), @@ -500,10 +524,12 @@ const urj_cable_driver_t urj_tap_cable_usbblaster_driver = { usbblaster_transfer, usbblaster_set_signal, urj_tap_cable_generic_get_signal, +// urj_tap_cable_generic_flush_one_by_one, +// urj_tap_cable_generic_flush_using_transfer, usbblaster_flush, - urj_tap_cable_generic_usbconn_help, + usbblaster_help, }; -URJ_DECLARE_USBCONN_CABLE(0x09FB, 0x6001, "libusb", "UsbBlaster", usbblaster) -URJ_DECLARE_USBCONN_CABLE(0x09FB, 0x6002, "libusb", "UsbBlaster", cubic_cyclonium) -URJ_DECLARE_USBCONN_CABLE(0x09FB, 0x6003, "libusb", "UsbBlaster", nios_eval) -URJ_DECLARE_USBCONN_CABLE(0x16C0, 0x06AD, "libusb", "UsbBlaster", usb_jtag) +URJ_DECLARE_FTDX_CABLE(0x09FB, 0x6001, "", "UsbBlaster", usbblaster) +URJ_DECLARE_FTDX_CABLE(0x09FB, 0x6002, "", "UsbBlaster", cubic_cyclonium) +URJ_DECLARE_FTDX_CABLE(0x09FB, 0x6003, "", "UsbBlaster", nios_eval) +URJ_DECLARE_FTDX_CABLE(0x16C0, 0x06AD, "", "UsbBlaster", usb_jtag)