Moved to single generated fusb.h, headers now generated out of lib directory

changes/39/5939/1
ttsou 14 years ago
parent 0b0f523d25
commit fca986b8ae
  1. 2
      host/Makefile.am
  2. 10
      host/include/usrp/Makefile.am
  3. 33
      host/lib/Makefile.am
  4. 4
      host/lib/fusb.cc
  5. 30
      host/lib/fusb.h.in
  6. 3
      host/lib/fusb_libusb1.cc
  7. 2
      host/lib/fusb_libusb1.h
  8. 140
      host/lib/fusb_libusb1_base.h
  9. 2
      host/lib/fusb_sysconfig_libusb1.cc
  10. 0
      host/lib/usrp_basic.h.in
  11. 3
      host/lib/usrp_basic_common.cc
  12. 2
      host/lib/usrp_basic_libusb1.cc
  13. 0
      host/lib/usrp_prims.h.in

@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA.
#
SUBDIRS = misc include lib apps
SUBDIRS = misc lib include apps
if PYTHON
SUBDIRS += swig

@ -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 \

@ -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

@ -24,11 +24,7 @@
#include "config.h"
#endif
#ifdef HAVE_LIBUSB_1
#include <fusb_libusb1_base.h>
#else
#include <fusb.h>
#endif
// ------------------------------------------------------------------------
// device handle

@ -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;

@ -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;

@ -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;

@ -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_ */

@ -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

@ -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>

@ -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>

Loading…
Cancel
Save