From 7590c751a7d49484eecb5af6b8db603cfece0e1c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 28 Jun 2010 20:49:54 +0000 Subject: [PATCH] convert usbblaster from (light) libftdi usage to pure libusb git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1803 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 ++++ urjtag/configure.ac | 4 ++-- urjtag/src/tap/cable/usbblaster.c | 40 ++++++------------------------- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index af301e2f..7893513d 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2010-06-28 Mike Frysinger + + * configure.ac (usbblaster): Move from libftdi to libusb requirement. + * src/tap/cable/usbblaster.c: Convert from FTDX helpers to libusb helpers. + 2010-06-24 Mike Frysinger * configure.ac: Merge libusb-0.x and libusb-1.x variables so that "libusb" diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 515ddeaa..651db7fa 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//" -e "s/usbblaster//"` + drivers=`echo ${drivers} | $SED -e "s/ft2232//"` ]) AS_IF([test "x$HAVELIBUSB" = "xno"], [ - drivers=`echo ${drivers} | $SED -e "s/jlink//" -e "s/xpc//"` + drivers=`echo ${drivers} | $SED -e "s/jlink//" -e "s/xpc//" -e "s/usbblaster//"` ]) ]) dnl the "fake" jim cable driver is special diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index fee2e670..cf4368f9 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -36,9 +36,6 @@ #include "generic.h" #include "generic_usbconn.h" -#include -#include "usbconn/libftdx.h" - #include "cmd_xfer.h" @@ -53,13 +50,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; @@ -163,9 +153,8 @@ usbblaster_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) if (chunkbytes > 63) chunkbytes = 63; - if (urj_tap_cable_cx_cmd_space (cmd_root, - URJ_USBCONN_FTDX_MAXSEND) - < chunkbytes + 1) + /* 4096 == URJ_USBCONN_FTDX_MAXSEND ? */ + if (urj_tap_cable_cx_cmd_space (cmd_root, 4096) < chunkbytes + 1) { /* no space left for next clocking command transfer queued commands to device and read receive data @@ -496,19 +485,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"), @@ -524,12 +500,10 @@ 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, - usbblaster_help, + urj_tap_cable_generic_usbconn_help, }; -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) +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)