summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorttsou <ttsou@vt.edu>2009-09-14 21:42:03 -0400
committerttsou <ttsou@vt.edu>2009-09-16 17:08:53 -0400
commit44269e7b15129102f93131269e7796fde70ddc05 (patch)
treebd9a11623e0ad6b20c6c41b2caf6d313c6e969b4
parent7f32e69cf2d599e0c5462164500ac2337f4417a7 (diff)
Moved to single generated fusb.h, headers now generated out of lib directory
-rw-r--r--config/usrp_libusb.m422
-rw-r--r--usrp/host/Makefile.am2
-rw-r--r--usrp/host/include/usrp/Makefile.am10
-rw-r--r--usrp/host/lib/Makefile.am33
-rw-r--r--usrp/host/lib/fusb.cc4
-rw-r--r--usrp/host/lib/fusb.h.in (renamed from usrp/host/lib/fusb.h)30
-rw-r--r--usrp/host/lib/fusb_libusb1.cc3
-rw-r--r--usrp/host/lib/fusb_libusb1.h2
-rw-r--r--usrp/host/lib/fusb_libusb1_base.h140
-rw-r--r--usrp/host/lib/fusb_sysconfig_libusb1.cc2
-rw-r--r--usrp/host/lib/usrp_basic.h.in (renamed from usrp/host/include/usrp/usrp_basic.h.in)0
-rw-r--r--usrp/host/lib/usrp_basic_common.cc3
-rw-r--r--usrp/host/lib/usrp_basic_libusb1.cc2
-rw-r--r--usrp/host/lib/usrp_prims.h.in (renamed from usrp/host/include/usrp/usrp_prims.h.in)0
14 files changed, 50 insertions, 203 deletions
diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4
index 9a019a4607..2eecc47db5 100644
--- a/config/usrp_libusb.m4
+++ b/config/usrp_libusb.m4
@@ -68,11 +68,19 @@ AC_DEFUN([USRP_LIBUSB], [
fi
AC_OUTPUT_COMMANDS([
case "$CONFIG_OTHER" in
+ fusb*)
+ outfile=usrp/host/lib/$CONFIG_OTHER
+ ;;
usrp*)
outfile=usrp/host/include/usrp/$CONFIG_OTHER
+ ;;
+ esac
+
+ case "$CONFIG_OTHER" in
+ fusb*|usrp*)
tmpfile=${outfile}T
dirname="sed s,^.*/,,g"
-
+
echo creating $outfile
cat > $tmpfile << _EOF_
/* -*- Mode: C++ -*-
@@ -102,7 +110,6 @@ AC_DEFUN([USRP_LIBUSB], [
* Boston, MA 02110-1301, USA.
*/
-
_EOF_
echo "#ifndef _`echo $outfile | $dirname | tr a-z. A-Z_`_" >> $tmpfile
echo "#define _`echo $outfile | $dirname | tr a-z. A-Z_`_" >> $tmpfile
@@ -129,9 +136,10 @@ _EOF_
echo 'struct usb_device;'>> $tmpfile
echo 'struct usb_dev_handle;'>> $tmpfile
echo 'struct usb_device_descriptor;' >> $tmpfile
- echo 'typedef usb_device libusb_device;' >> $tmpfile
- echo 'typedef usb_dev_handle libusb_device_handle;' >> $tmpfile
- echo 'typedef usb_device_descriptor libusb_device_descriptor;' >> $tmpfile
+ echo >> $tmpfile
+ echo 'typedef struct usb_device libusb_device;' >> $tmpfile
+ echo 'typedef struct usb_dev_handle libusb_device_handle;' >> $tmpfile
+ echo 'typedef struct usb_device_descriptor libusb_device_descriptor;' >> $tmpfile
echo >> $tmpfile
fi
@@ -143,9 +151,9 @@ _EOF_
fi
# The ugly but portable cpp stuff comes from here
- infile=usrp/host/include/usrp/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`.h.in
+ infile=usrp/host/lib/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`.h.in
sed '/^##.*$/d' $infile >> $tmpfile
- mv ${tmpfile} ${outfile}
+ mv -f ${tmpfile} ${outfile}
;;
esac
diff --git a/usrp/host/Makefile.am b/usrp/host/Makefile.am
index cc4ba91aaa..aa94fbd6ec 100644
--- a/usrp/host/Makefile.am
+++ b/usrp/host/Makefile.am
@@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA.
#
-SUBDIRS = misc include lib apps
+SUBDIRS = misc lib include apps
if PYTHON
SUBDIRS += swig
diff --git a/usrp/host/include/usrp/Makefile.am b/usrp/host/include/usrp/Makefile.am
index 1e36b105a1..d580d8a755 100644
--- a/usrp/host/include/usrp/Makefile.am
+++ b/usrp/host/include/usrp/Makefile.am
@@ -23,16 +23,6 @@ include $(top_srcdir)/Makefile.common
usrpincludedir = $(includedir)/usrp
-usrp_prims.h: usrp_prims.h.in $(top_srcdir)/config.status
- cd $(top_srcdir) \
- && CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=usrp_prims.h \
- $(SHELL) ./config.status
-
-usrp_basic.h: usrp_basic.h.in $(top_srcdir)/config.status
- cd $(top_srcdir) \
- && CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=usrp_basic.h \
- $(SHELL) ./config.status
-
usrpinclude_HEADERS = \
db_base.h \
db_basic.h \
diff --git a/usrp/host/lib/Makefile.am b/usrp/host/lib/Makefile.am
index 3687aae72c..16f53bd386 100644
--- a/usrp/host/lib/Makefile.am
+++ b/usrp/host/lib/Makefile.am
@@ -44,10 +44,16 @@ endif
EXTRA_DIST = \
std_paths.h.in \
- usrp_dbid.dat
+ usrp_dbid.dat \
+ fusb.h.in \
+ usrp_prims.h.in \
+ usrp_basic.h.in
BUILT_SOURCES = \
- $(abs_top_builddir)/usrp/host/include/usrp/usrp_dbid.h
+ $(abs_top_builddir)/usrp/host/include/usrp/usrp_dbid.h \
+ fusb.h \
+ usrp_prims.h \
+ usrp_basic.h
BUILT_SOURCES += usrp_dbid.cc \
usrp_dbid.py
@@ -133,8 +139,6 @@ libusrp_la_common_SOURCES = \
db_dtt768.cc \
db_util.cc
-
-
if FUSB_TECH_generic
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(generic_CODE)
endif
@@ -166,7 +170,6 @@ noinst_HEADERS = \
db_boards.h \
db_util.h \
fusb.h \
- fusb_libusb1_base.h \
fusb_darwin.h \
fusb_generic.h \
fusb_linux.h \
@@ -193,3 +196,23 @@ gen_sources = $(BUILT_SOURCES)
gen_sources_deps = gen_usrp_dbid.py usrp_dbid.dat
par_gen_command = PYTHONPATH=$(top_srcdir)/usrp/src srcdir=$(srcdir) $(PYTHON) $(srcdir)/gen_usrp_dbid.py $(srcdir)/usrp_dbid.dat
include $(top_srcdir)/Makefile.par.gen
+
+
+# Generate libusb dependent header files from configure.
+# These are already defined, but override them here, which throws warnings.
+# Need to figure out how to separate rules for BUILD_SOURCES.
+fusb.h: fusb.h.in $(top_srcdir)/config.status
+ cd $(top_srcdir) \
+ && CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=fusb.h \
+ $(SHELL) ./config.status
+
+usrp_prims.h: usrp_prims.h.in $(top_srcdir)/config.status
+ cd $(top_srcdir) \
+ && CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=usrp_prims.h \
+ $(SHELL) ./config.status
+
+usrp_basic.h: usrp_basic.h.in $(top_srcdir)/config.status
+ cd $(top_srcdir) \
+ && CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=usrp_basic.h \
+ $(SHELL) ./config.status
+
diff --git a/usrp/host/lib/fusb.cc b/usrp/host/lib/fusb.cc
index 992e1a2e96..c14d7c1fbb 100644
--- a/usrp/host/lib/fusb.cc
+++ b/usrp/host/lib/fusb.cc
@@ -24,11 +24,7 @@
#include "config.h"
#endif
-#ifdef HAVE_LIBUSB_1
-#include <fusb_libusb1_base.h>
-#else
#include <fusb.h>
-#endif
// ------------------------------------------------------------------------
// device handle
diff --git a/usrp/host/lib/fusb.h b/usrp/host/lib/fusb.h.in
index 506f396fa3..4a65d994fa 100644
--- a/usrp/host/lib/fusb.h
+++ b/usrp/host/lib/fusb.h.in
@@ -1,33 +1,3 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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 3, or (at your option)
- * any later version.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// Fast USB interface
-
-#ifndef _FUSB_H_
-#define _FUSB_H_
-
-struct usb_dev_handle;
-typedef usb_dev_handle libusb_device_handle;
-
struct libusb_context;
class fusb_ephandle;
diff --git a/usrp/host/lib/fusb_libusb1.cc b/usrp/host/lib/fusb_libusb1.cc
index 6ea7607268..0171235de8 100644
--- a/usrp/host/lib/fusb_libusb1.cc
+++ b/usrp/host/lib/fusb_libusb1.cc
@@ -25,6 +25,7 @@
#endif
#include <fusb_libusb1.h>
+#include <fusb.h>
#include <libusb-1.0/libusb.h>
#include <stdexcept>
#include <cstdio>
@@ -41,7 +42,7 @@ static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE;
static const int DEFAULT_BUFFER_SIZE = 4 * (1L << 20); // 4 MB endpoint
static const int LIBUSB_TIMEOUT = 0; // no timeout
-inline static fusb_ephandle_libusb1*
+inline static fusb_ephandle_libusb1 *
lut_get_ephandle (libusb_transfer *lut)
{
return (fusb_ephandle_libusb1 *) lut->user_data;
diff --git a/usrp/host/lib/fusb_libusb1.h b/usrp/host/lib/fusb_libusb1.h
index 0257ac38a5..4bc49aafbd 100644
--- a/usrp/host/lib/fusb_libusb1.h
+++ b/usrp/host/lib/fusb_libusb1.h
@@ -23,7 +23,7 @@
#ifndef _FUSB_LIBUSB1_H_
#define _FUSB_LIBUSB1_H_
-#include <fusb_libusb1_base.h>
+#include <fusb.h>
#include <list>
struct libusb_transfer;
diff --git a/usrp/host/lib/fusb_libusb1_base.h b/usrp/host/lib/fusb_libusb1_base.h
deleted file mode 100644
index 6a24364539..0000000000
--- a/usrp/host/lib/fusb_libusb1_base.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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 3, or (at your option)
- * any later version.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// Fast USB interface
-
-#ifndef _FUSB_LIBUSB1_BASE_H_
-#define _FUSB_LIBUSB1_BASE_H_
-
-struct libusb_device_handle;
-struct libusb_context;
-class fusb_ephandle;
-
-/*!
- * \brief abstract usb device handle
- */
-class fusb_devhandle {
-private:
- // NOT IMPLEMENTED
- fusb_devhandle (const fusb_devhandle &rhs); // no copy constructor
- fusb_devhandle &operator= (const fusb_devhandle &rhs); // no assignment operator
-
-protected:
- libusb_device_handle *d_udh;
-
-public:
- // CREATORS
- fusb_devhandle (libusb_device_handle *udh);
- virtual ~fusb_devhandle ();
-
- // MANIPULATORS
-
- /*!
- * \brief return an ephandle of the correct subtype
- */
- virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p,
- int block_size = 0, int nblocks = 0) = 0;
-
- // ACCESSORS
- libusb_device_handle *get_usb_dev_handle () const { return d_udh; }
-};
-
-
-/*!
- * \brief abstract usb end point handle
- */
-class fusb_ephandle {
-private:
- // NOT IMPLEMENTED
- fusb_ephandle (const fusb_ephandle &rhs); // no copy constructor
- fusb_ephandle &operator= (const fusb_ephandle &rhs); // no assignment operator
-
-protected:
- int d_endpoint;
- bool d_input_p;
- int d_block_size;
- int d_nblocks;
- bool d_started;
-
-public:
- fusb_ephandle (int endpoint, bool input_p,
- int block_size = 0, int nblocks = 0);
- virtual ~fusb_ephandle ();
-
- virtual bool start () = 0; //!< begin streaming i/o
- virtual bool stop () = 0; //!< stop streaming i/o
-
- /*!
- * \returns \p nbytes if write was successfully enqueued, else -1.
- * Will block if no free buffers available.
- */
- virtual int write (const void *buffer, int nbytes) = 0;
-
- /*!
- * \returns number of bytes read or -1 if error.
- * number of bytes read will be <= nbytes.
- * Will block if no input available.
- */
- virtual int read (void *buffer, int nbytes) = 0;
-
- /*
- * block until all outstanding writes have completed
- */
- virtual void wait_for_completion () = 0;
-
- /*!
- * \brief returns current block size.
- */
- int block_size () { return d_block_size; };
-};
-
-
-/*!
- * \brief factory for creating concrete instances of the appropriate subtype.
- */
-class fusb_sysconfig {
-public:
- /*!
- * \brief returns fusb_devhandle or throws if trouble
- */
- static fusb_devhandle *make_devhandle (libusb_device_handle *udh,
- libusb_context *ctx = 0);
-
- /*!
- * \brief Returns max block size in bytes (hard limit).
- */
- static int max_block_size ();
-
- /*!
- * \brief Returns default block size in bytes.
- */
- static int default_block_size ();
-
- /*!
- * \brief Returns the default buffer size in bytes.
- */
- static int default_buffer_size ();
-
-};
-
-#endif /*_FUSB_LIBUSB1_BASE_H_ */
-
diff --git a/usrp/host/lib/fusb_sysconfig_libusb1.cc b/usrp/host/lib/fusb_sysconfig_libusb1.cc
index ab3c475d59..f71e34fa94 100644
--- a/usrp/host/lib/fusb_sysconfig_libusb1.cc
+++ b/usrp/host/lib/fusb_sysconfig_libusb1.cc
@@ -20,7 +20,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <fusb_libusb1_base.h>
+#include <fusb.h>
#include <fusb_libusb1.h>
static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit
diff --git a/usrp/host/include/usrp/usrp_basic.h.in b/usrp/host/lib/usrp_basic.h.in
index 3faa5304f5..3faa5304f5 100644
--- a/usrp/host/include/usrp/usrp_basic.h.in
+++ b/usrp/host/lib/usrp_basic.h.in
diff --git a/usrp/host/lib/usrp_basic_common.cc b/usrp/host/lib/usrp_basic_common.cc
index 9a1f9fd550..b617f52070 100644
--- a/usrp/host/lib/usrp_basic_common.cc
+++ b/usrp/host/lib/usrp_basic_common.cc
@@ -25,10 +25,8 @@
#endif
#ifdef HAVE_LIBUSB_1
-#include "fusb_libusb1_base.h"
#include <libusb-1.0/libusb.h>
#else
-#include "fusb.h"
#include <usb.h>
#endif
@@ -37,6 +35,7 @@
#include "usrp_interfaces.h"
#include "fpga_regs_common.h"
#include "fpga_regs_standard.h"
+#include "fusb.h"
#include "db_boards.h"
#include <stdexcept>
#include <assert.h>
diff --git a/usrp/host/lib/usrp_basic_libusb1.cc b/usrp/host/lib/usrp_basic_libusb1.cc
index 7cfd69be67..64cff60786 100644
--- a/usrp/host/lib/usrp_basic_libusb1.cc
+++ b/usrp/host/lib/usrp_basic_libusb1.cc
@@ -29,7 +29,7 @@
#include "usrp_interfaces.h"
#include "fpga_regs_common.h"
#include "fpga_regs_standard.h"
-#include "fusb_libusb1_base.h"
+#include "fusb.h"
#include "db_boards.h"
#include <libusb-1.0/libusb.h>
#include <stdexcept>
diff --git a/usrp/host/include/usrp/usrp_prims.h.in b/usrp/host/lib/usrp_prims.h.in
index 8198d17972..8198d17972 100644
--- a/usrp/host/include/usrp/usrp_prims.h.in
+++ b/usrp/host/lib/usrp_prims.h.in