From 52e60bdd0bf082bdaa11d11c034ad95afe656c0a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 23 Jan 2010 20:32:50 +0000 Subject: [PATCH] unify the list of usb cable drivers git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1715 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 3 + urjtag/src/tap/cable/generic_usbconn.c | 110 +------------------- urjtag/src/tap/cable/generic_usbconn.h | 3 + urjtag/src/tap/cable/generic_usbconn_list.h | 79 ++++++++++++++ 4 files changed, 87 insertions(+), 108 deletions(-) create mode 100644 urjtag/src/tap/cable/generic_usbconn_list.h diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 9c213df5..b059caa4 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -50,6 +50,9 @@ src/tap/cable/wiggler.c, src/tap/cable/xpc.c: Constify the cable drivers. + * 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. + 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/generic_usbconn.c b/urjtag/src/tap/cable/generic_usbconn.c index 421237e6..a3af2389 100644 --- a/urjtag/src/tap/cable/generic_usbconn.c +++ b/urjtag/src/tap/cable/generic_usbconn.c @@ -35,115 +35,9 @@ #include -/* @@@@ RFHH put these in a .h file */ -#ifdef ENABLE_CABLE_XPC -extern urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_int; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_ext; -#endif -#ifdef ENABLE_CABLE_JLINK -extern urj_usbconn_cable_t urj_tap_cable_usbconn_jlink; -#endif -#ifdef ENABLE_CABLE_FT2232 -#ifdef ENABLE_LOWLEVEL_FTD2XX -extern urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftd2xx; -#endif -#ifdef ENABLE_LOWLEVEL_FTDI -extern urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbtiny_h_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_gniceplus_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi; -#endif -#endif -#ifdef ENABLE_CABLE_USBBLASTER -#ifdef ENABLE_LOWLEVEL_FTD2XX -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftd2xx; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftd2xx; -#endif -#ifdef ENABLE_LOWLEVEL_FTDI -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftdi; -extern urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftdi; -#endif -#endif - urj_usbconn_cable_t *urj_tap_cable_usbconn_cables[] = { -#ifdef ENABLE_CABLE_XPC - &urj_tap_cable_usbconn_xpc_int, - &urj_tap_cable_usbconn_xpc_ext, -#endif -#ifdef ENABLE_CABLE_JLINK - &urj_tap_cable_usbconn_jlink, -#endif -#ifdef ENABLE_CABLE_FT2232 -#ifdef ENABLE_LOWLEVEL_FTD2XX - &urj_tap_cable_usbconn_ft2232_ftd2xx, - &urj_tap_cable_usbconn_armusbocd_ftd2xx, - &urj_tap_cable_usbconn_armusbocdtiny_ftd2xx, - &urj_tap_cable_usbconn_armusbtiny_h_ftd2xx, - &urj_tap_cable_usbconn_gnice_ftd2xx, - &urj_tap_cable_usbconn_gniceplus_ftd2xx, - &urj_tap_cable_usbconn_jtagkey_ftd2xx, - &urj_tap_cable_usbconn_oocdlinks_ftd2xx, - &urj_tap_cable_usbconn_turtelizer2_ftd2xx, - &urj_tap_cable_usbconn_usbtojtagif_ftd2xx, - &urj_tap_cable_usbconn_signalyzer_ftd2xx, - &urj_tap_cable_usbconn_flyswatter_ftd2xx, - &urj_tap_cable_usbconn_usbscarab2_ftd2xx, -#endif -#ifdef ENABLE_LOWLEVEL_FTDI - &urj_tap_cable_usbconn_ft2232_ftdi, - &urj_tap_cable_usbconn_armusbocd_ftdi, - &urj_tap_cable_usbconn_armusbocdtiny_ftdi, - &urj_tap_cable_usbconn_armusbtiny_h_ftdi, - &urj_tap_cable_usbconn_gnice_ftdi, - &urj_tap_cable_usbconn_gniceplus_ftdi, - &urj_tap_cable_usbconn_jtagkey_ftdi, - &urj_tap_cable_usbconn_oocdlinks_ftdi, - &urj_tap_cable_usbconn_turtelizer2_ftdi, - &urj_tap_cable_usbconn_usbtojtagif_ftdi, - &urj_tap_cable_usbconn_signalyzer_ftdi, - &urj_tap_cable_usbconn_flyswatter_ftdi, - &urj_tap_cable_usbconn_usbscarab2_ftdi, -#endif -#endif -#ifdef ENABLE_CABLE_USBBLASTER -#ifdef ENABLE_LOWLEVEL_FTD2XX - &urj_tap_cable_usbconn_usbblaster_ftd2xx, - &urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx, - &urj_tap_cable_usbconn_nios_eval_ftd2xx, - &urj_tap_cable_usbconn_usb_jtag_ftd2xx, -#endif -#ifdef ENABLE_LOWLEVEL_FTDI - &urj_tap_cable_usbconn_usbblaster_ftdi, - &urj_tap_cable_usbconn_cubic_cyclonium_ftdi, - &urj_tap_cable_usbconn_nios_eval_ftdi, - &urj_tap_cable_usbconn_usb_jtag_ftdi, -#endif -#endif +#define _URJ_USB(usb) &urj_tap_cable_usbconn_##usb, +#include "generic_usbconn_list.h" NULL }; diff --git a/urjtag/src/tap/cable/generic_usbconn.h b/urjtag/src/tap/cable/generic_usbconn.h index c4fcdf24..105c4949 100644 --- a/urjtag/src/tap/cable/generic_usbconn.h +++ b/urjtag/src/tap/cable/generic_usbconn.h @@ -28,6 +28,9 @@ #include #include +#define _URJ_USB(usb) extern urj_usbconn_cable_t urj_tap_cable_usbconn_##usb; +#include "generic_usbconn_list.h" + /** * @return URJ_STATUS_OK on success, URJ_STATUS_FAIL and urj_error on error */ diff --git a/urjtag/src/tap/cable/generic_usbconn_list.h b/urjtag/src/tap/cable/generic_usbconn_list.h new file mode 100644 index 00000000..b495af72 --- /dev/null +++ b/urjtag/src/tap/cable/generic_usbconn_list.h @@ -0,0 +1,79 @@ +/* + * $Id: generic_usbconn.c 1689 2010-01-08 17:06:27Z kawk $ + * + * Copyright (C) 2003 ETC s.r.o. + * + * 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 Marcel Telka , 2003. + * + */ + +#ifdef ENABLE_CABLE_XPC +_URJ_USB(xpc_int) +_URJ_USB(xpc_ext) +#endif +#ifdef ENABLE_CABLE_JLINK +_URJ_USB(jlink) +#endif +#ifdef ENABLE_CABLE_FT2232 +#ifdef ENABLE_LOWLEVEL_FTD2XX +_URJ_USB(ft2232_ftd2xx) +_URJ_USB(armusbocd_ftd2xx) +_URJ_USB(armusbocdtiny_ftd2xx) +_URJ_USB(armusbtiny_h_ftd2xx) +_URJ_USB(gnice_ftd2xx) +_URJ_USB(gniceplus_ftd2xx) +_URJ_USB(jtagkey_ftd2xx) +_URJ_USB(oocdlinks_ftd2xx) +_URJ_USB(turtelizer2_ftd2xx) +_URJ_USB(usbtojtagif_ftd2xx) +_URJ_USB(signalyzer_ftd2xx) +_URJ_USB(flyswatter_ftd2xx) +_URJ_USB(usbscarab2_ftd2xx) +#endif +#ifdef ENABLE_LOWLEVEL_FTDI +_URJ_USB(ft2232_ftdi) +_URJ_USB(armusbocd_ftdi) +_URJ_USB(armusbocdtiny_ftdi) +_URJ_USB(armusbtiny_h_ftdi) +_URJ_USB(gnice_ftdi) +_URJ_USB(gniceplus_ftdi) +_URJ_USB(jtagkey_ftdi) +_URJ_USB(oocdlinks_ftdi) +_URJ_USB(turtelizer2_ftdi) +_URJ_USB(usbtojtagif_ftdi) +_URJ_USB(signalyzer_ftdi) +_URJ_USB(flyswatter_ftdi) +_URJ_USB(usbscarab2_ftdi) +#endif +#endif +#ifdef ENABLE_CABLE_USBBLASTER +#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 + +#undef _URJ_USB