[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8391 - in usrp2/trunk/host: . apps config gr-usrp2 li
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r8391 - in usrp2/trunk/host: . apps config gr-usrp2 lib |
Date: |
Sun, 11 May 2008 11:41:56 -0600 (MDT) |
Author: jcorgan
Date: 2008-05-11 11:41:54 -0600 (Sun, 11 May 2008)
New Revision: 8391
Added:
usrp2/trunk/host/config/gr_python.m4
usrp2/trunk/host/config/gr_scripting.m4
usrp2/trunk/host/config/gr_swig.m4
usrp2/trunk/host/gr-usrp2/
usrp2/trunk/host/gr-usrp2/Makefile.am
usrp2/trunk/host/gr-usrp2/usrp2.i
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h
usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc
usrp2/trunk/host/gr-usrp2/usrp2_source_c.h
Removed:
usrp2/trunk/host/gr-usrp2/Makefile.am
usrp2/trunk/host/gr-usrp2/usrp2.i
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h
usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc
usrp2/trunk/host/gr-usrp2/usrp2_source_c.h
Modified:
usrp2/trunk/host/Makefile.am
usrp2/trunk/host/Makefile.common
usrp2/trunk/host/apps/Makefile.am
usrp2/trunk/host/apps/find_usrps.cc
usrp2/trunk/host/configure.ac
usrp2/trunk/host/lib/
usrp2/trunk/host/lib/Makefile.am
usrp2/trunk/host/lib/usrp2_basic.cc
usrp2/trunk/host/lib/usrp2_basic.h
Log:
Merged r8357:8387 on jcorgan/gr-usrp2 into usrp2/trunk. Wip on GNU Radio host
interface.
Modified: usrp2/trunk/host/Makefile.am
===================================================================
--- usrp2/trunk/host/Makefile.am 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/Makefile.am 2008-05-11 17:41:54 UTC (rev 8391)
@@ -26,4 +26,4 @@
configure \
config.h.in
-SUBDIRS = config lib apps
+SUBDIRS = config lib gr-usrp2 apps
Modified: usrp2/trunk/host/Makefile.common
===================================================================
--- usrp2/trunk/host/Makefile.common 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/Makefile.common 2008-05-11 17:41:54 UTC (rev 8391)
@@ -1,6 +1,6 @@
# -*- Makefile -*-
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2008 Free Software Foundation, Inc.
#
# 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
@@ -22,3 +22,23 @@
-I$(top_srcdir)/../firmware/include \
-I$(top_srcdir)/lib \
$(GNURADIO_CORE_CFLAGS)
+
+# includes
+grincludedir = $(includedir)/gnuradio
+swigincludedir = $(grincludedir)/swig
+
+# Install Python modules in the appropriate subdirectory
+# This usually ends up at:
+# ${prefix}/lib/python${python_version}/site-packages/gnuradio
+
+grpythondir = $(pythondir)/gnuradio
+grpyexecdir = $(pyexecdir)/gnuradio
+
+# swig flags
+SWIGPYTHONFLAGS = $(PYTHON_CPPFLAGS) -fvirtual -python -modern
+SWIGGRFLAGS = -I$(swigincludedir) -I$(grincludedir)
+
+# Don't assume that make predefines $(RM), because BSD make does
+# not. We define it now in configure.ac using AM_PATH_PROG, but now
+# here have to add a -f to be like GNU make.
+RM=$(RM_PROG) -f
Modified: usrp2/trunk/host/apps/Makefile.am
===================================================================
--- usrp2/trunk/host/apps/Makefile.am 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/apps/Makefile.am 2008-05-11 17:41:54 UTC (rev 8391)
@@ -19,7 +19,9 @@
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
-LDADD = ../lib/libusrp2.la
+LDADD = \
+ ../lib/libusrp2.la \
+ $(GNURADIO_CORE_LIBS) # FIXME: Should only be needed by rx_samples but
can't be LDADDed below (include errors!?)
bin_PROGRAMS = \
find_usrps \
Modified: usrp2/trunk/host/apps/find_usrps.cc
===================================================================
--- usrp2/trunk/host/apps/find_usrps.cc 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/apps/find_usrps.cc 2008-05-11 17:41:54 UTC (rev 8391)
@@ -54,6 +54,7 @@
exit(1);
}
+#if 0
usrp2_basic *u2 = new usrp2_basic();
if (!u2->open(interface)){
@@ -62,7 +63,10 @@
}
std::vector<op_id_reply_t> r = u2->find_usrps();
+#endif
+ std::vector<op_id_reply_t> r = usrp2_basic::find_usrps(interface);
+
for (size_t i = 0; i < r.size(); i++){
std::cout << r[i] << std::endl;
}
Copied: usrp2/trunk/host/config/gr_python.m4 (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/config/gr_python.m4)
===================================================================
--- usrp2/trunk/host/config/gr_python.m4 (rev 0)
+++ usrp2/trunk/host/config/gr_python.m4 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,128 @@
+dnl
+dnl Copyright 2003,2004,2005 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+dnl
+
+# PYTHON_DEVEL()
+#
+# Checks for Python and tries to get the include path to 'Python.h'.
+# It sets the $(PYTHON_CPPFLAGS), $(PYTHON_LDFLAGS) and $(pythondir) output
variables,
+#
+AC_DEFUN([PYTHON_DEVEL],[
+ AC_REQUIRE([AM_PATH_PYTHON])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ AC_ARG_WITH(pythondir,
+ AC_HELP_STRING([--with-pythondir=DIR],
+ [python installation directory (cross-compiling)
[[default=$prefix/lib/python2.5/site-packages]]]),
+
[with_pythondir=${withval}],[with_pythondir=${prefix}/lib/python2.5/site-packages])
+
+ # if we're cross-compiling, asking the host python about any of
+ # this is completely useless...
+
+ if test x$cross_compiling != xno
+ then
+ pythondir=$with_pythondir
+ pyexecdir=$with_pythondir
+ AC_SUBST(PYTHON_CPPFLAGS)
+ AC_SUBST(PYTHON_LDFLAGS)
+ else
+
+ # For Fedora Core 5 and 6, see ticket:39 in Trac
+ if test -f '/etc/redhat-release'; then
+ if (echo $pyexecdir | grep -q lib64); then
+ pythondir="$pyexecdir"
+ fi
+ fi
+
+ # Check for Python include path
+ AC_MSG_CHECKING([for Python include path])
+ if test -z "$PYTHON" ; then
+ AC_MSG_ERROR([cannot find Python path])
+ fi
+
+ # ask distutils which include path we should use
+ python_cmd='
+import distutils.sysconfig
+import os
+path = distutils.sysconfig.get_python_inc(plat_specific=False)
+if os.sep == "\\":
+ path = path.replace("\\", "/")
+print path
+'
+ python_path=`$PYTHON -c "$python_cmd"`
+ AC_MSG_RESULT([$python_path])
+ if test -z "$python_path" ; then
+ AC_MSG_ERROR([cannot find Python include path])
+ fi
+
+ AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path])
+
+ # Check for Python headers usability
+ python_save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+ AC_CHECK_HEADERS([Python.h], [],
+ [AC_MSG_ERROR([cannot find usable Python headers])])
+ CPPFLAGS="$python_save_CPPFLAGS"
+
+ # Only set this on mingw and cygwin hosts, (only implemented
+ # for mingw host, for crosscompiling you need to trick this)
+
+ PYTHON_LDFLAGS=""
+ case $host_os in
+ *mingw* | *cygwin* )
+ AC_MSG_CHECKING([for Python LDFLAGS])
+
+ python_cmd='
+import distutils.sysconfig
+import os
+path = distutils.sysconfig.get_config_var("LIBPL")
+if path == None:
+ path = distutils.sysconfig.PREFIX + "/libs"
+if os.sep == "\\":
+ path = path.replace("\\", "/")
+print path
+'
+ python_stdlib_path=`$PYTHON -c "$python_cmd"`
+
+ python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"`
+ libpython_name="python$PYTHON_VERSION"
+
+ # Standard install of python for win32 has libpython24.a
+ # instead of libpython2.4.a so we check for the library
+ # without the dot in the version number.
+
+ python_stdlib_filename=`find $python_stdlib_path -type f -name
libpython$python_version_nodot.* -print | sed "1q"`
+ if test -n "$python_stdlib_filename" ; then
+ libpython_name="python$python_version_nodot"
+ fi
+
+ PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
+ AC_MSG_RESULT($PYTHON_LDFLAGS)
+ # Replace all backslashes in PYTHON Paths with forward slashes
+ pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
+ pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
+ pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
+ pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
+ ;;
+ esac
+
+ AC_SUBST(PYTHON_LDFLAGS)
+ fi
+])
Copied: usrp2/trunk/host/config/gr_scripting.m4 (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/config/gr_scripting.m4)
===================================================================
--- usrp2/trunk/host/config/gr_scripting.m4 (rev 0)
+++ usrp2/trunk/host/config/gr_scripting.m4 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,30 @@
+dnl
+dnl Copyright 2003 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+dnl
+
+AC_DEFUN([GR_SCRIPTING],[
+ AC_REQUIRE([AC_PROG_LN_S])
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_REQUIRE([AC_PROG_LIBTOOL])
+
+ SWIG_PROG(1.3.31)
+ SWIG_ENABLE_CXX
+ SWIG_PYTHON
+])
Copied: usrp2/trunk/host/config/gr_swig.m4 (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/config/gr_swig.m4)
===================================================================
--- usrp2/trunk/host/config/gr_swig.m4 (rev 0)
+++ usrp2/trunk/host/config/gr_swig.m4 2008-05-11 17:41:54 UTC (rev 8391)
@@ -0,0 +1,85 @@
+dnl
+dnl Copyright 2003 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+dnl
+
+# SWIG_PROG([required-version])
+#
+# Checks for the SWIG program. If found you can (and should) call SWIG via
$(SWIG).
+# You can use the optional first argument to check if the version of the
available SWIG
+# is greater or equal to the value of the argument. It should have the format:
+# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
+AC_DEFUN([SWIG_PROG],[
+ AC_REQUIRE([AC_PROG_MAKE_SET])
+ AC_CHECK_PROG(SWIG,swig,[`which swig`])
+ if test -z "$SWIG" ; then
+ AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1
required])
+ SWIG=false
+ elif test -n "$1" ; then
+ AC_MSG_CHECKING([for SWIG version])
+ swig_version=`$SWIG -version 2>&1 | \
+ awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ {
split($[3],a,"[[^.0-9]]"); print a[[1]] }'`
+ AC_MSG_RESULT([$swig_version])
+ if test -n "$swig_version" ; then
+ swig_version=`echo $swig_version | \
+ awk '{ split($[1],a,"\."); print
[a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
+ swig_required_version=`echo $1 | \
+ awk '{ split($[1],a,"\."); print
[a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
+ if test $swig_required_version -gt $swig_version ; then
+ AC_MSG_ERROR([SWIG version >= $1 required])
+ fi
+ else
+ AC_MSG_ERROR([cannot determine SWIG version])
+ fi
+ fi
+])
+
+# SWIG_ENABLE_CXX()
+#
+# Enable swig C++ support. This effects all invocations of $(SWIG).
+AC_DEFUN([SWIG_ENABLE_CXX],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([AC_PROG_CXX])
+ if test "$SWIG" != "false" ; then
+ SWIG="$SWIG -c++"
+ fi
+])
+
+# SWIG_PYTHON([use-shadow-classes])
+#
+# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
+# $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables.
+# $(SWIG_PYTHON_OPT) contains all necessary swig options to generate
+# code for Python. If you need multi module support use
+# $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT()
+# macro) to link against the appropriate library. It contains the
+# SWIG Python runtime library that is needed by the type check system
+# for example.
+
+AC_DEFUN([SWIG_PYTHON],[
+ AC_REQUIRE([SWIG_PROG])
+ AC_REQUIRE([PYTHON_DEVEL])
+ if test "$SWIG" != "false" ; then
+ AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy])
+dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
+dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
+ AC_SUBST(SWIG_PYTHON_OPT,[-python])
+ fi
+ AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS])
+])
Modified: usrp2/trunk/host/configure.ac
===================================================================
--- usrp2/trunk/host/configure.ac 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/configure.ac 2008-05-11 17:41:54 UTC (rev 8391)
@@ -88,7 +88,7 @@
dnl GR_FORTRAN
GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag
-dnl GR_SCRIPTING
+GR_SCRIPTING
dnl AC_CHECK_PROG([XMLTO],[xmlto],[yes],[])
dnl AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes])
@@ -167,9 +167,9 @@
dnl PKG_CHECK_MODULES(FFTW3F, fftw3f >= 3.0)
dnl AC_SUBST(FFTW3F_LIBS)
-dnl PKG_CHECK_MODULES(GR_OMNITHREAD, gnuradio-omnithread >= 3.0)
-dnl AC_SUBST(GR_OMNITHREAD_LIBS)
-dnl AC_SUBST(GR_OMNITHREAD_CFLAGS)
+PKG_CHECK_MODULES(GR_OMNITHREAD, gnuradio-omnithread >= 3.0)
+AC_SUBST(GR_OMNITHREAD_LIBS)
+AC_SUBST(GR_OMNITHREAD_CFLAGS)
dnl CFLAGS="${CFLAGS} $PTHREAD_CFLAGS"
dnl CXXFLAGS="${CXXFLAGS} $PTHREAD_CFLAGS"
@@ -196,9 +196,7 @@
dnl so we can use some utilities. FIXME hoist them out
PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3)
-LIBS="$LIBS $GNURADIO_CORE_LIBS"
-
# If this is being done from a subversion tree, create variables
GR_SUBVERSION
@@ -207,6 +205,7 @@
Makefile \
config/Makefile \
apps/Makefile \
+ gr-usrp2/Makefile \
lib/Makefile \
])
Copied: usrp2/trunk/host/gr-usrp2 (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2)
Property changes on: usrp2/trunk/host/gr-usrp2
___________________________________________________________________
Name: svn:ignore
+ .libs
.deps
Makefile
Makefile.in
*.pyc
usrp2.cc
usrp2.py
Deleted: usrp2/trunk/host/gr-usrp2/Makefile.am
Copied: usrp2/trunk/host/gr-usrp2/Makefile.am (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/Makefile.am)
===================================================================
--- usrp2/trunk/host/gr-usrp2/Makefile.am (rev 0)
+++ usrp2/trunk/host/gr-usrp2/Makefile.am 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,84 @@
+#
+# Copyright 2007,2008 Free Software Foundation, Inc.
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
+
+lib_LTLIBRARIES = \
+ libgr_usrp2.la
+
+libgr_usrp2_la_SOURCES = \
+ usrp2_sink_base.cc \
+ usrp2_sink_c.cc \
+ usrp2_source_base.cc \
+ usrp2_source_c.cc
+
+libgr_usrp2_la_LIBADD = \
+ ../lib/libusrp2.la
+
+include_HEADERS = \
+ usrp2_sink_base.h \
+ usrp2_sink_c.h \
+ usrp2_source_base.h \
+ usrp2_source_c.h
+
+# Export C++ GNU Radio driver to Python via SWIG
+ourpythondir = $(grpythondir)
+ourlibdir = $(grpyexecdir)
+
+SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) $(WITH_SWIG_INCLUDES) \
+ $(WITH_INCLUDES)
+
+LOCAL_IFILES = \
+ usrp2.i
+
+BUILT_SOURCES = \
+ usrp2.cc \
+ usrp2.py
+
+ourpython_PYTHON = \
+ usrp2.py
+
+ourlib_LTLIBRARIES = \
+ _usrp2.la
+
+_usrp2_la_SOURCES = \
+ usrp2.cc
+
+_usrp2_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
+
+_usrp2_la_LIBADD = \
+ $(PYTHON_LDFLAGS) \
+ libgr_usrp2.la \
+ $(GNURADIO_CORE_LIBS) \
+ -lstdc++
+
+_usrp2_la_CPPFLAGS = $(PYTHON_CPPFLAGS)
+
+usrp2.cc usrp2.py: $(LOCAL_IFILES)
+ $(SWIG) $(SWIGPYTHONARGS) -module usrp2 -o usrp2.cc $(LOCAL_IFILES)
+
+swiginclude_HEADERS = \
+ $(LOCAL_IFILES)
+
+# Don't distribute output of swig
+dist-hook:
+ @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
+ @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
+
+MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc *~
Deleted: usrp2/trunk/host/gr-usrp2/usrp2.i
Copied: usrp2/trunk/host/gr-usrp2/usrp2.i (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2.i)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2.i (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2.i 2008-05-11 17:41:54 UTC (rev 8391)
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+%feature("autodoc", "1"); // generate python docstrings
+
+%include "exception.i"
+%import "gnuradio.i" // the common stuff
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include "usrp2_sink_c.h"
+#include "usrp2_source_c.h"
+%}
+
+// ----------------------------------------------------------------
+
+class usrp2_sink_base : public gr_sync_block {
+
+protected:
+ usrp2_sink_base(const std::string &name,
+ gr_io_signature_sptr input_signature)
+ throw (std::runtime_error);
+
+public:
+ ~usrp2_sink_base();
+
+};
+
+// ----------------------------------------------------------------
+
+class usrp2_source_base : public gr_sync_block {
+
+protected:
+ usrp2_source_base(const std::string &name,
+ gr_io_signature_sptr output_signature)
+ throw (std::runtime_error);
+
+public:
+ ~usrp2_source_base();
+
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(usrp2,sink_c)
+
+usrp2_sink_c_sptr
+usrp2_make_sink_c() throw (std::runtime_error);
+
+class usrp2_sink_c : public usrp2_sink_base {
+
+protected:
+ usrp2_sink_c();
+
+public:
+ ~usrp2_sink_c();
+
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(usrp2,source_c)
+
+usrp2_source_c_sptr
+usrp2_make_source_c(const std::string &ifc="eth0",
+ const std::string &mac="")
+ throw (std::runtime_error);
+
+class usrp2_source_c : public usrp2_source_base {
+
+protected:
+ usrp2_source_c(const std::string &ifc,
+ const std::string &mac);
+
+public:
+ ~usrp2_source_c();
+
+};
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
Copied: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_sink_base.cc)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
(rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc 2008-05-11 17:41:54 UTC
(rev 8391)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrp2_sink_base.h>
+#include <gr_io_signature.h>
+
+usrp2_sink_base::usrp2_sink_base(const std::string &name,
+ gr_io_signature_sptr input_signature)
+ throw (std::runtime_error)
+ : gr_sync_block(name,
+ input_signature,
+ gr_make_io_signature(0, 0, 0))
+{
+}
+
+usrp2_sink_base::~usrp2_sink_base ()
+{
+}
+
+int
+usrp2_sink_base::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ return noutput_items;
+}
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h
Copied: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_sink_base.h)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_BASE_H
+#define INCLUDED_USRP2_SINK_BASE_H
+
+#include <gr_sync_block.h>
+#include <stdexcept>
+
+class usrp2_sink_base : public gr_sync_block {
+
+private:
+
+protected:
+ usrp2_sink_base(const std::string &name,
+ gr_io_signature_sptr input_signature)
+ throw (std::runtime_error);
+
+public:
+ ~usrp2_sink_base();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SINK_BASE_H */
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc
Copied: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_sink_c.cc)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrp2_sink_c.h>
+#include <gr_io_signature.h>
+#include <usrp_standard.h>
+#include <usrp_bytesex.h>
+
+usrp2_sink_c_sptr
+usrp2_make_sink_c() throw (std::runtime_error)
+{
+ return usrp2_sink_c_sptr(new usrp2_sink_c());
+}
+
+usrp2_sink_c::usrp2_sink_c() throw (std::runtime_error)
+ : usrp2_sink_base("usrp2_sink_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+}
+
+usrp2_sink_c::~usrp2_sink_c()
+{
+}
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h
Copied: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_sink_c.h)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_C_H
+#define INCLUDED_USRP2_SINK_C_H
+
+#include <usrp2_sink_base.h>
+
+class usrp2_sink_c;
+typedef boost::shared_ptr<usrp2_sink_c> usrp2_sink_c_sptr;
+
+usrp2_sink_c_sptr
+usrp2_make_sink_c() throw (std::runtime_error);
+
+class usrp2_sink_c : public usrp2_sink_base {
+private:
+
+ friend usrp2_sink_c_sptr
+ usrp2_make_sink_c() throw (std::runtime_error);
+
+protected:
+ usrp2_sink_c() throw (std::runtime_error);
+
+public:
+ ~usrp2_sink_c();
+};
+
+#endif /* INCLUDED_USRP2_SINK_C_H */
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
Copied: usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_source_base.cc)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
(rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc 2008-05-11 17:41:54 UTC
(rev 8391)
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrp2_source_base.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+#define USRP2_SOURCE_BASE_DEBUG 1
+
+usrp2_source_base::usrp2_source_base(const std::string &name,
+ gr_io_signature_sptr output_signature,
+ const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error)
+ : gr_sync_block(name,
+ gr_make_io_signature(0, 0, 0),
+ output_signature),
+ d_u2(0), d_addr()
+{
+ std::vector<op_id_reply_t> r = usrp2_basic::find_usrps(ifc);
+ if (r.size() == 0)
+ throw std::runtime_error("No USRP2s found on interface.");
+
+ if (mac == "") {
+ if (r.size() > 1)
+ throw std::runtime_error("Must supply USRP2 MAC address when multiple
devices are present");
+ d_addr = r[0].addr;
+ }
+ else {
+ u2_mac_addr_t addr;
+ if (!usrp2_basic::parse_mac_addr(mac, &addr))
+ throw std::runtime_error("Invalid MAC address");
+
+ unsigned int i;
+ for (i = 0; i < r.size(); i++)
+ if (r[i].addr == addr) {
+ d_addr = addr;
+ break;
+ }
+
+ if (i == r.size())
+ throw std::runtime_error("Unable to find specified USRP2.");
+ }
+
+ if (USRP2_SOURCE_BASE_DEBUG)
+ std::cout << "usrp2_source_base: using ifc=" << ifc << " mac=" << d_addr
<< std::endl;
+
+ // Now retrieve or make and return usrp2_basic object for MAC address in
d_addr
+}
+
+usrp2_source_base::~usrp2_source_base ()
+{
+ if (d_u2)
+ delete d_u2;
+}
+
+int
+usrp2_source_base::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ return noutput_items;
+}
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
Copied: usrp2/trunk/host/gr-usrp2/usrp2_source_base.h (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_source_base.h)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
(rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_base.h 2008-05-11 17:41:54 UTC
(rev 8391)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SOURCE_BASE_H
+#define INCLUDED_USRP2_SOURCE_BASE_H
+
+#include <gr_sync_block.h>
+#include <usrp2_basic.h>
+#include <stdexcept>
+
+class usrp2_source_base : public gr_sync_block {
+
+protected:
+ usrp2_source_base(const std::string &name,
+ gr_io_signature_sptr output_signature,
+ const std::string &ifc = "eth0",
+ const std::string &mac = "")
+ throw (std::runtime_error);
+
+ usrp2_basic *d_u2;
+ u2_mac_addr_t d_addr;
+
+public:
+ ~usrp2_source_base();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SOURCE_BASE_H */
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc
Copied: usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_source_c.cc)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_c.cc 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrp2_source_c.h>
+#include <gr_io_signature.h>
+
+usrp2_source_c_sptr
+usrp2_make_source_c(const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error)
+{
+ return usrp2_source_c_sptr(new usrp2_source_c(ifc, mac));
+}
+
+usrp2_source_c::usrp2_source_c(const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error)
+ : usrp2_source_base("usrp2_source_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ ifc, mac)
+{
+}
+
+usrp2_source_c::~usrp2_source_c()
+{
+}
Deleted: usrp2/trunk/host/gr-usrp2/usrp2_source_c.h
Copied: usrp2/trunk/host/gr-usrp2/usrp2_source_c.h (from rev 8387,
usrp2/branches/developers/jcorgan/gr-usrp2/host/gr-usrp2/usrp2_source_c.h)
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_c.h (rev 0)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_c.h 2008-05-11 17:41:54 UTC (rev
8391)
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SOURCE_C_H
+#define INCLUDED_USRP2_SOURCE_C_H
+
+#include <usrp2_source_base.h>
+
+class usrp2_source_c;
+typedef boost::shared_ptr<usrp2_source_c> usrp2_source_c_sptr;
+
+usrp2_source_c_sptr
+usrp2_make_source_c(const std::string &ifc="eth0",
+ const std::string &mac="")
+ throw (std::runtime_error);
+
+class usrp2_source_c : public usrp2_source_base {
+
+private:
+ friend usrp2_source_c_sptr
+ usrp2_make_source_c(const std::string &ifc,
+ const std::string &mac) throw (std::runtime_error);
+
+protected:
+ usrp2_source_c(const std::string &ifc="eth0",
+ const std::string &mac="") throw (std::runtime_error);
+
+public:
+ ~usrp2_source_c();
+};
+
+#endif /* INCLUDED_USRP2_SOURCE_C_H */
Property changes on: usrp2/trunk/host/lib
___________________________________________________________________
Name: svn:ignore
- .libs
*-stamp
*.a
*.bin
*.dump
*.log
*.rom
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
buf_ram_zero
hello
+ .libs
.deps
Makefile
Makefile.in
usrp2.cc
usrp2.py
Modified: usrp2/trunk/host/lib/Makefile.am
===================================================================
--- usrp2/trunk/host/lib/Makefile.am 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/lib/Makefile.am 2008-05-11 17:41:54 UTC (rev 8391)
@@ -1,5 +1,5 @@
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2008 Free Software Foundation, Inc.
#
# 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
@@ -19,11 +19,11 @@
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
-lib_LTLIBRARIES = libusrp2.la
-noinst_LTLIBRARIES = libpfring.la
+lib_LTLIBRARIES = \
+ libusrp2.la
-libpfring_la_SOURCES = \
- pfring.c
+noinst_LTLIBRARIES = \
+ libpfring.la
libusrp2_la_SOURCES = \
@@ -34,7 +34,13 @@
strtod_si.c \
usrp2_basic.cc
+libpfring_la_SOURCES = \
+ pfring.c
+libusrp2_la_LIBADD = \
+ libpfring.la \
+ $(GR_OMNITHREAD_LIBS)
+
include_HEADERS = \
gri_ethernet.h \
gri_ethernet_pfring.h \
@@ -43,4 +49,3 @@
strtod_si.h \
usrp2_basic.h
-libusrp2_la_LIBADD = libpfring.la
Modified: usrp2/trunk/host/lib/usrp2_basic.cc
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.cc 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/lib/usrp2_basic.cc 2008-05-11 17:41:54 UTC (rev 8391)
@@ -156,6 +156,21 @@
return result;
}
+// static
+std::vector<op_id_reply_t>
+usrp2_basic::find_usrps(const std::string &ifc)
+{
+ usrp2_basic *u2 = new usrp2_basic();
+ if (!u2 || !u2->open(ifc)) {
+ std::cerr << "Unable to open network interface: " << ifc << std::endl;
+ return std::vector<op_id_reply_t>(0);
+ }
+
+ std::vector<op_id_reply_t> r = u2->find_usrps();
+ delete u2;
+ return r;
+}
+
bool
usrp2_basic::find_usrp_by_mac(const u2_mac_addr_t &addr, op_id_reply_t *u)
{
@@ -544,3 +559,4 @@
{
return memcmp(&a, &b, sizeof(u2_mac_addr_t)) == 0;
}
+
Modified: usrp2/trunk/host/lib/usrp2_basic.h
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.h 2008-05-11 17:39:19 UTC (rev 8390)
+++ usrp2/trunk/host/lib/usrp2_basic.h 2008-05-11 17:41:54 UTC (rev 8391)
@@ -53,11 +53,16 @@
bool close();
/*!
- * Return a vector that describes all usrps found
+ * Return a vector that describes all usrps found on already open'd interface
*/
std::vector<op_id_reply_t> find_usrps();
/*!
+ * Return a vector that describes all usrps found on a specified interface.
+ */
+ static std::vector<op_id_reply_t> find_usrps(const std::string &ifc);
+
+ /*!
* \brief Find usrp by mac address
*
* \param[in] addr is the mac address of the USRP to look for
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8391 - in usrp2/trunk/host: . apps config gr-usrp2 lib,
jcorgan <=