From 93c3697d61f03bc947839659c805df3852ebae83 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 23 Jan 2010 20:33:44 +0000 Subject: [PATCH] unify the list of ftdi usb cable drivers git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1716 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 3 ++ urjtag/src/tap/cable/ft2232.c | 47 ++++-------------------------- urjtag/src/tap/cable/ft2232_list.h | 41 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 urjtag/src/tap/cable/ft2232_list.h diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index b059caa4..365f020d 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -53,6 +53,9 @@ * src/tap/cable/generic_usbconn_list.h, src/tap/cable/generic_usbconn.c, src/tap/cable/generic_usbconn.h: Unify the list of usb cable drivers. + * src/tap/cable/ft2232.c, src/tap/cable/ft2232_list.h: Unify the list of + ftdi usb cable drivers. + 2010-01-22 Mike Frysinger * src/cmd/cmd_bit.c (cmd_bit_print_params): Fix strncat length handling. diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 75363b39..679b1530 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -1819,17 +1819,8 @@ ft2232_cable_free (urj_cable_t *cable) } -urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi; -urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi; +#define _URJ_FTDI(usb) urj_usbconn_cable_t urj_tap_cable_usbconn_##usb##_ftdi; +#include "ft2232_list.h" static void @@ -1837,37 +1828,11 @@ ft2232_usbcable_help (urj_log_level_t ll, const char *cablename) { urj_usbconn_cable_t *conn; - conn = &urj_tap_cable_usbconn_armusbocd_ftdi; - if (strcasecmp (conn->name, cablename) == 0) +#define _URJ_FTDI(usb) \ + conn = &urj_tap_cable_usbconn_##usb##_ftdi; \ + if (strcasecmp (conn->name, cablename) == 0) \ goto found; - conn = &urj_tap_cable_usbconn_gnice_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_gniceplus_ftdi; - if (strcasecmp( conn->name, cablename ) == 0) - goto found; - conn = &urj_tap_cable_usbconn_jtagkey_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_oocdlinks_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_turtelizer2_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_usbtojtagif_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_signalyzer_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_flyswatter_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_usbscarab2_ftdi; - if (strcasecmp (conn->name, cablename) == 0) - goto found; - conn = &urj_tap_cable_usbconn_ft2232_ftdi; +#include "ft2232_list.h" found: urj_log (ll, diff --git a/urjtag/src/tap/cable/ft2232_list.h b/urjtag/src/tap/cable/ft2232_list.h new file mode 100644 index 00000000..b1843f4d --- /dev/null +++ b/urjtag/src/tap/cable/ft2232_list.h @@ -0,0 +1,41 @@ +/* + * $Id: ft2232.c 1714 2010-01-23 20:07:41Z vapier $ + * + * 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(ft2232) +_URJ_FTDI(armusbocd) +_URJ_FTDI(gnice) +_URJ_FTDI(gniceplus) +_URJ_FTDI(jtagkey) +_URJ_FTDI(oocdlinks) +_URJ_FTDI(turtelizer2) +_URJ_FTDI(usbtojtagif) +_URJ_FTDI(signalyzer) +_URJ_FTDI(flyswatter) +_URJ_FTDI(usbscarab2) + +#undef _URJ_FTDI