diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 153d75bb..b39e4710 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -71,6 +71,10 @@ src/tap/usbconn/libftd2xx.c, src/tap/usbconn/libftdi.c, src/tap/usbconn/libusb.c: Unify the usb cable drivers. + * src/tap/parport.c, src/tap/parport.h, src/tap/parport_list.h, + src/tap/parport/direct.c, src/tap/parport/ppdev.c, src/tap/parport/ppi.c: + Unify the list of parallel port 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/parport.c b/urjtag/src/tap/parport.c index 6bc909f2..5598bd9f 100644 --- a/urjtag/src/tap/parport.c +++ b/urjtag/src/tap/parport.c @@ -28,23 +28,11 @@ #include -/* @@@@ RFHH move these to some .h file */ -extern urj_parport_driver_t urj_tap_parport_direct_parport_driver; -extern urj_parport_driver_t urj_tap_parport_ppdev_parport_driver; -extern urj_parport_driver_t urj_tap_parport_ppi_parport_driver; +#include "parport.h" urj_parport_driver_t *urj_tap_parport_drivers[] = { -#ifdef ENABLE_LOWLEVEL_DIRECT - &urj_tap_parport_direct_parport_driver, -#endif /* ENABLE_LOWLEVEL_DIRECT */ - -#ifdef ENABLE_LOWLEVEL_PPDEV - &urj_tap_parport_ppdev_parport_driver, -#endif /* ENABLE_LOWLEVEL_PPDEV */ - -#ifdef ENABLE_LOWLEVEL_PPI - &urj_tap_parport_ppi_parport_driver, -#endif /* ENABLE_LOWLEVEL_PPI */ +#define _URJ_LIST(item) &urj_tap_parport_##item##_driver, +#include "parport_list.h" NULL /* last must be NULL */ }; diff --git a/urjtag/src/tap/parport.h b/urjtag/src/tap/parport.h new file mode 100644 index 00000000..2e77b485 --- /dev/null +++ b/urjtag/src/tap/parport.h @@ -0,0 +1,39 @@ +/* + * $Id: buses.h 1711 2010-01-23 19:12:01Z vapier $ + * + * 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. + * + */ + +#ifndef URJ_CABLE_CABLE_H +#define URJ_CABLE_CABLE_H + +#define _URJ_LIST(item) extern urj_parport_driver_t urj_tap_parport_##item##_driver; +#include "parport_list.h" + +typedef struct port_node_t port_node_t; + +struct port_node_t +{ + urj_parport_t *port; + port_node_t *next; +}; + +#endif /* URJ_CABLE_CABLE_H */ diff --git a/urjtag/src/tap/parport/direct.c b/urjtag/src/tap/parport/direct.c index e7a3e185..e37fc2b1 100644 --- a/urjtag/src/tap/parport/direct.c +++ b/urjtag/src/tap/parport/direct.c @@ -37,6 +37,7 @@ #include #include #include +#include "../parport.h" #if defined(HAVE_INPOUTXX) @@ -111,16 +112,6 @@ outb (unsigned char value, unsigned short int port) } #endif /* HAVE_I386_SET_IOPERM */ -urj_parport_driver_t urj_tap_parport_direct_parport_driver; - -typedef struct port_node_t port_node_t; - -struct port_node_t -{ - urj_parport_t *port; - port_node_t *next; -}; - static port_node_t *ports = NULL; /* direct parallel ports */ typedef struct diff --git a/urjtag/src/tap/parport/ppdev.c b/urjtag/src/tap/parport/ppdev.c index b650343d..9732b651 100644 --- a/urjtag/src/tap/parport/ppdev.c +++ b/urjtag/src/tap/parport/ppdev.c @@ -44,16 +44,7 @@ #include #include #include - -urj_parport_driver_t urj_tap_parport_ppdev_parport_driver; - -typedef struct port_node_t port_node_t; - -struct port_node_t -{ - urj_parport_t *port; - port_node_t *next; -}; +#include "../parport.h" static port_node_t *ports = NULL; /* ppdev parallel ports */ diff --git a/urjtag/src/tap/parport/ppi.c b/urjtag/src/tap/parport/ppi.c index 12e46240..a652d50d 100644 --- a/urjtag/src/tap/parport/ppi.c +++ b/urjtag/src/tap/parport/ppi.c @@ -40,16 +40,7 @@ #include #include #include - -urj_parport_driver_t urj_tap_parport_ppi_parport_driver; - -typedef struct port_node_t port_node_t; - -struct port_node_t -{ - urj_parport_t *port; - port_node_t *next; -}; +#include "../parport.h" static port_node_t *ports = NULL; /* ppi parallel ports */ diff --git a/urjtag/src/tap/parport_list.h b/urjtag/src/tap/parport_list.h new file mode 100644 index 00000000..86ff0c9d --- /dev/null +++ b/urjtag/src/tap/parport_list.h @@ -0,0 +1,37 @@ +/* + * $Id: buses.h 1687 2009-12-29 23:53:09Z arniml $ + * + * 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_LOWLEVEL_DIRECT +_URJ_LIST(direct_parport) +#endif + +#ifdef ENABLE_LOWLEVEL_PPDEV +_URJ_LIST(ppdev_parport) +#endif + +#ifdef ENABLE_LOWLEVEL_PPI +_URJ_LIST(ppi_parport) +#endif + +#undef _URJ_LIST