diff options
Diffstat (limited to 'gr-usrp2/src')
29 files changed, 0 insertions, 2485 deletions
diff --git a/gr-usrp2/src/.gitignore b/gr-usrp2/src/.gitignore deleted file mode 100644 index 71f825820..000000000 --- a/gr-usrp2/src/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/Makefile -/Makefile.in -/.libs -/.deps -/usrp2.py -/usrp2.cc -/usrp2_python.cc -/run_tests -/test_gr_usrp2 -/*.pyc -/guile -/python -/usrp2_swig.py -/run_guile_tests diff --git a/gr-usrp2/src/Makefile.am b/gr-usrp2/src/Makefile.am deleted file mode 100644 index a84637f73..000000000 --- a/gr-usrp2/src/Makefile.am +++ /dev/null @@ -1,115 +0,0 @@ -# -# Copyright 2004,2005,2006,2008,2009,2010 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. -# - -include $(top_srcdir)/Makefile.common -include $(top_srcdir)/Makefile.swig - -TESTS = -EXTRA_DIST += run_tests.in run_guile_tests.in $(nobase_guile_DATA) -DISTCLEANFILES += run_tests run_guile_tests - -noinst_PYTHON = qa_usrp2.py -noinst_GUILE = usrp2.test - -if GUILE -nobase_guile_DATA = gnuradio/usrp2.scm -endif - -# ---------------------------------------------------------------------- -# C++ block API interface librar(ies) -# -# libgr-usrp.so -# ---------------------------------------------------------------------- -AM_CPPFLAGS = \ - $(GRUEL_INCLUDES) \ - $(USRP2_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - $(WITH_INCLUDES) - -lib_LTLIBRARIES = libgnuradio-usrp2.la - -libgnuradio_usrp2_la_LDFLAGS = $(LTVERSIONFLAGS) - -libgnuradio_usrp2_la_SOURCES = \ - rx_16sc_handler.cc \ - rx_32fc_handler.cc \ - usrp2_base.cc \ - usrp2_source_base.cc \ - usrp2_source_16sc.cc \ - usrp2_source_32fc.cc \ - usrp2_sink_base.cc \ - usrp2_sink_16sc.cc \ - usrp2_sink_32fc.cc - -libgnuradio_usrp2_la_LIBADD = \ - $(USRP2_LA) \ - $(GNURADIO_CORE_LA) - -grinclude_HEADERS = \ - usrp2_base.h \ - usrp2_source_base.h \ - usrp2_source_32fc.h \ - usrp2_source_16sc.h \ - usrp2_sink_base.h \ - usrp2_sink_16sc.h \ - usrp2_sink_32fc.h - -noinst_HEADERS = \ - rx_16sc_handler.h \ - rx_32fc_handler.h - -# ---------------------------------------------------------------------- -# SWIG wrappers around C++ library -# -# usrp2.py -# _usrp2.so -# ---------------------------------------------------------------------- - -TOP_SWIG_IFILES = \ - usrp2_swig.i - -# Install so that they end up available as: -# import gnuradio.usrp2 -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp2 -usrp2_swig_pythondir_category = \ - gnuradio/usrp2 - -# additional arguments to the SWIG command -usrp2_swig_swig_args = \ - $(USRP2_INCLUDES) - -# additional libraries for linking with the SWIG-generated library -usrp2_swig_la_swig_libadd = \ - libgnuradio-usrp2.la - -# additional Python files to be installed along with the SWIG-generated one -usrp2_swig_python = \ - __init__.py - -if PYTHON -TESTS += run_tests -endif - -if GUILE -TESTS += run_guile_tests -endif diff --git a/gr-usrp2/src/Makefile.swig.gen b/gr-usrp2/src/Makefile.swig.gen deleted file mode 100644 index 78cb4e5c6..000000000 --- a/gr-usrp2/src/Makefile.swig.gen +++ /dev/null @@ -1,145 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2009 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. -# - -# Makefile.swig.gen for usrp2_swig.i - -## Default install locations for these files: -## -## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp2_swig -## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp2_swig -## -## The following can be overloaded to change the install location, but -## this has to be done in the including Makefile.am -before- -## Makefile.swig is included. - -usrp2_swig_pythondir_category ?= gnuradio/usrp2_swig -usrp2_swig_pylibdir_category ?= $(usrp2_swig_pythondir_category) -usrp2_swig_pythondir = $(pythondir)/$(usrp2_swig_pythondir_category) -usrp2_swig_pylibdir = $(pyexecdir)/$(usrp2_swig_pylibdir_category) - -# The .so libraries for the guile modules get installed whereever guile -# is installed, usually /usr/lib/guile/gnuradio/ -# FIXME: determince whether these should be installed with gnuradio. -usrp2_swig_scmlibdir = $(libdir) - -# The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/usrp2_swig -# FIXME: determince whether these should be installed with gnuradio. -usrp2_swig_scmdir = $(guiledir) - -## SWIG headers are always installed into the same directory. - -usrp2_swig_swigincludedir = $(swigincludedir) - -## This is a template file for a "generated" Makefile addition (in -## this case, "Makefile.swig.gen"). By including the top-level -## Makefile.swig, this file will be used to generate the SWIG -## dependencies. Assign the variable TOP_SWIG_FILES to be the list of -## SWIG .i files to generated wrappings for; there can be more than 1 -## so long as the names are unique (no sorting is done on the -## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i -## file will generate .cc, .py, and possibly .h files -- meaning that -## all of these files will have the same base name (that provided for -## the SWIG .i file). -## -## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the -## right thing. For more info, see < -## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > - -## Other cleaned files: dependency files generated by SWIG or this Makefile - -MOSTLYCLEANFILES += $(DEPDIR)/*.S* - -## Various SWIG variables. These can be overloaded in the including -## Makefile.am by setting the variable value there, then including -## Makefile.swig . - -usrp2_swig_swiginclude_HEADERS = \ - usrp2_swig.i \ - $(usrp2_swig_swiginclude_headers) - -if PYTHON -usrp2_swig_pylib_LTLIBRARIES = \ - _usrp2_swig.la - -_usrp2_swig_la_SOURCES = \ - python/usrp2_swig.cc \ - $(usrp2_swig_la_swig_sources) - -usrp2_swig_python_PYTHON = \ - usrp2_swig.py \ - $(usrp2_swig_python) - -_usrp2_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_swig_la_swig_libadd) - -_usrp2_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_swig_la_swig_ldflags) - -_usrp2_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp2_swig_la_swig_cxxflags) - -python/usrp2_swig.cc: usrp2_swig.py -usrp2_swig.py: usrp2_swig.i - -# Include the python dependencies for this file --include python/usrp2_swig.d - -endif # end of if python - -if GUILE - -usrp2_swig_scmlib_LTLIBRARIES = \ - libguile-gnuradio-usrp2_swig.la -libguile_gnuradio_usrp2_swig_la_SOURCES = \ - guile/usrp2_swig.cc \ - $(usrp2_swig_la_swig_sources) -nobase_usrp2_swig_scm_DATA = \ - gnuradio/usrp2_swig.scm \ - gnuradio/usrp2_swig-primitive.scm -libguile_gnuradio_usrp2_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_swig_la_swig_libadd) -libguile_gnuradio_usrp2_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_swig_la_swig_ldflags) -libguile_gnuradio_usrp2_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp2_swig_la_swig_cxxflags) - -guile/usrp2_swig.cc: gnuradio/usrp2_swig.scm -gnuradio/usrp2_swig.scm: usrp2_swig.i -gnuradio/usrp2_swig-primitive.scm: gnuradio/usrp2_swig.scm - -# Include the guile dependencies for this file --include guile/usrp2_swig.d - -endif # end of GUILE - - diff --git a/gr-usrp2/src/__init__.py b/gr-usrp2/src/__init__.py deleted file mode 100644 index fd4289af5..000000000 --- a/gr-usrp2/src/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2008,2010 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. -# - -# The presence of this file turns this directory into a Python package - -# Add SWIG generated code to this namespace -from usrp2_swig import * - -# Add other content from pure-Python modules here - diff --git a/gr-usrp2/src/gnuradio/.gitignore b/gr-usrp2/src/gnuradio/.gitignore deleted file mode 100644 index 3c1ff87f5..000000000 --- a/gr-usrp2/src/gnuradio/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -usrp2_swig.scm -usrp2_swig-primitive.scm diff --git a/gr-usrp2/src/gnuradio/usrp2.scm b/gr-usrp2/src/gnuradio/usrp2.scm deleted file mode 100644 index 7ead5015d..000000000 --- a/gr-usrp2/src/gnuradio/usrp2.scm +++ /dev/null @@ -1,79 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Module that re-exports the usrp2_swig module and adds convenience functions - -(define-module (gnuradio usrp2) - #:use-module (oop goops) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio usrp2_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio usrp2_swig)) - -;; Utilities (guaranteed not to leak the allocated object) -(define (call-with-long-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-long-ptr))) - (lambda () (and (fn ptr) (gr:deref-long-ptr ptr))) - (lambda () (gr:free-long-ptr ptr))))) - -(define (call-with-int-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-int-ptr))) - (lambda () (and (fn ptr) (gr:deref-int-ptr ptr))) - (lambda () (gr:free-int-ptr ptr))))) - -(define (call-with-uint16-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-uint16-ptr))) - (lambda () (and (fn ptr) (gr:deref-uint16-ptr ptr))) - (lambda () (gr:free-uint16-ptr ptr))))) - - -;;; scheme-ish convenience functions - -(define-method (gr:set-center-freq self freq) - (let ((tr (make <tune-result>))) - (if (gr:-real-set-center-freq self freq tr) - tr - #f))) - -(define-method (gr:fpga-master-clock-freq self) - (call-with-long-ptr (lambda (ptr) (gr:-real-fpga-master-clock-freq self ptr)))) - -(define-method (gr:adc-rate self) - (call-with-long-ptr (lambda (ptr) (gr:-real-adc-rate self ptr)))) - -(define-method (gr:dac-rate self) - (call-with-long-ptr (lambda (ptr) (gr:-real-dac-rate self ptr)))) - -(define-method (gr:daughterboard-id self) - (call-with-int-ptr (lambda (ptr) (gr:-real-daugherboard-id self ptr)))) - -;; (define-method (gr:default-tx-scale-iq self) ...) FIXME - -(define-method (gr:read-gpio self) - (call-with-uint16-ptr (lambda (ptr) (gr:-real-read-gpio self ptr)))) - -;; Export them -(export-safely gr:set-center-freq gr:fpga-master-clock-freq gr:adc-rate gr:dac-rate gr:daughterboard-id gr:read-gpio) diff --git a/gr-usrp2/src/qa_usrp2.py b/gr-usrp2/src/qa_usrp2.py deleted file mode 100755 index 33e44aeed..000000000 --- a/gr-usrp2/src/qa_usrp2.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2008,2010 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. -# - -from gnuradio import gr, gr_unittest -import usrp2_swig - -class test_usrp2(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module... - They may not have a USRP2 connected, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_usrp2, "test_usrp2.xml") diff --git a/gr-usrp2/src/run_guile_tests.in b/gr-usrp2/src/run_guile_tests.in deleted file mode 100644 index 5d08b0dd5..000000000 --- a/gr-usrp2/src/run_guile_tests.in +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -. @top_builddir@/setup_guile_test_env - -# 1st argument is absolute path to hand coded guile source directory -# 2nd argument is absolute path to component C++ shared library build directory -# 3nd argument is absolute path to component SWIG build directory - -add_local_paths \ - @srcdir@ \ - @abs_builddir@ \ - @abs_builddir@ - -@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ diff --git a/gr-usrp2/src/run_tests.in b/gr-usrp2/src/run_tests.in deleted file mode 100644 index 3f068256e..000000000 --- a/gr-usrp2/src/run_tests.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# 1st parameter is absolute path to component source directory -# 2nd parameter is absolute path to component build directory -# 3rd parameter is path to Python QA directory - -# For OS/X -DYLD_LIBRARY_PATH=@abs_top_builddir@/usrp2/host/lib:@abs_top_builddir@/usrp2/host/lib/.libs:$DYLD_LIBRARY_PATH -export DYLD_LIBRARY_PATH - -# For Win32 -PATH=@abs_top_builddir@/usrp2/host/lib:@abs_top_builddir@/usrp2/host/lib/.libs:$PATH - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-usrp2 \ - @abs_top_builddir@/gr-usrp2 \ - @srcdir@ diff --git a/gr-usrp2/src/rx_16sc_handler.cc b/gr-usrp2/src/rx_16sc_handler.cc deleted file mode 100644 index 7fb9ad06f..000000000 --- a/gr-usrp2/src/rx_16sc_handler.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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 <rx_16sc_handler.h> - -rx_16sc_handler::~rx_16sc_handler() -{ - // NOP -} diff --git a/gr-usrp2/src/rx_16sc_handler.h b/gr-usrp2/src/rx_16sc_handler.h deleted file mode 100644 index 9d5b1f2e9..000000000 --- a/gr-usrp2/src/rx_16sc_handler.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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_RX_16SC_HANDLER_H -#define INCLUDED_RX_16SC_HANDLER_H - -#include <usrp2/rx_nop_handler.h> -#include <usrp2/copiers.h> - -class rx_16sc_handler : public usrp2::rx_nop_handler -{ - std::complex<int16_t> *d_dest; - - // Private constructor - rx_16sc_handler(uint64_t max_samples, uint64_t max_quantum, std::complex<int16_t> *dest) - : rx_nop_handler(max_samples, max_quantum), d_dest(dest) {} - -public: - // Shared pointer to one of these - typedef boost::shared_ptr<rx_16sc_handler> sptr; - - // Factory function to return a shared pointer to a new instance - static sptr make(uint64_t max_samples, uint64_t max_quantum, std::complex<int16_t> *dest) - { - return sptr(new rx_16sc_handler(max_samples, max_quantum, dest)); - } - - // Invoked by USRP2 API when samples are available - bool operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - // Copy/reformat/endian swap USRP2 data to destination buffer - usrp2::copy_u2_16sc_to_host_16sc(nitems, items, d_dest); - d_dest += nitems; - - // FIXME: do something with metadata - - // Call parent to determine if there is room to be called again - return rx_nop_handler::operator()(items, nitems, metadata); - } - - ~rx_16sc_handler(); -}; - -#endif /* INCLUDED_RX_16SC_HANDLER_H */ diff --git a/gr-usrp2/src/rx_32fc_handler.cc b/gr-usrp2/src/rx_32fc_handler.cc deleted file mode 100644 index c9c251558..000000000 --- a/gr-usrp2/src/rx_32fc_handler.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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 <rx_32fc_handler.h> - -rx_32fc_handler::~rx_32fc_handler() -{ - // NOP -} diff --git a/gr-usrp2/src/rx_32fc_handler.h b/gr-usrp2/src/rx_32fc_handler.h deleted file mode 100644 index f2ce2b55d..000000000 --- a/gr-usrp2/src/rx_32fc_handler.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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_RX_32FC_HANDLER_H -#define INCLUDED_RX_32FC_HANDLER_H - -#include <usrp2/rx_nop_handler.h> -#include <usrp2/copiers.h> -#include <gr_complex.h> - -class rx_32fc_handler : public usrp2::rx_nop_handler -{ - gr_complex *d_dest; - - // Private constructor - rx_32fc_handler(uint64_t max_samples, uint64_t max_quantum, gr_complex *dest) - : rx_nop_handler(max_samples, max_quantum), d_dest(dest) {} - -public: - // Shared pointer to one of these - typedef boost::shared_ptr<rx_32fc_handler> sptr; - - // Factory function to return a shared pointer to a new instance - static sptr make(uint64_t max_samples, uint64_t max_quantum, gr_complex *dest) - { - return sptr(new rx_32fc_handler(max_samples, max_quantum, dest)); - } - - // Invoked by USRP2 API when samples are available - bool operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - // Copy/reformat/endian swap USRP2 data to destination buffer - usrp2::copy_u2_16sc_to_host_32fc(nitems, items, d_dest); - d_dest += nitems; - - // FIXME: do something with metadata - - // Call parent to determine if there is room to be called again - return rx_nop_handler::operator()(items, nitems, metadata); - } - - ~rx_32fc_handler(); -}; - -#endif /* INCLUDED_RX_32FC_HANDLER_H */ diff --git a/gr-usrp2/src/usrp2.test b/gr-usrp2/src/usrp2.test deleted file mode 100644 index 69544c5e6..000000000 --- a/gr-usrp2/src/usrp2.test +++ /dev/null @@ -1,37 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. -;;; See also the very end of the file, where the test-equal, test-eqv -;;; and test-eq macros are defined. - -(define-module (test-module) - #:use-module (oop goops) - #:use-module (gnuradio core) - #:use-module (gnuradio test-suite lib) - #:duplicates (merge-generics replace check)) - -;;; Just see if we can import the module... -;;; They may not have a USRP2 attached, powered up etc. - -(use-modules (gnuradio usrp2)) diff --git a/gr-usrp2/src/usrp2_base.cc b/gr-usrp2/src/usrp2_base.cc deleted file mode 100644 index bb9959725..000000000 --- a/gr-usrp2/src/usrp2_base.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- 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_base.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_base::usrp2_base(const char *name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : gr_sync_block(name, - input_signature, - output_signature), - d_u2(usrp2::usrp2::sptr()) -{ - d_u2 = usrp2::usrp2::make(ifc, mac); - if (!d_u2) - throw std::runtime_error("Unable to initialize USRP2!"); -} - -usrp2_base::~usrp2_base () -{ - // NOP -} - -std::string -usrp2_base::mac_addr() const -{ - return d_u2->mac_addr(); -} - -std::string -usrp2_base::interface_name() const -{ - return d_u2->interface_name(); -} - -bool -usrp2_base::fpga_master_clock_freq(long *freq) const -{ - return d_u2->fpga_master_clock_freq(freq); -} - -bool -usrp2_base::config_mimo(int flags) -{ - return d_u2->config_mimo(flags); -} - -bool -usrp2_base::sync_to_pps() -{ - return d_u2->sync_to_pps(); -} - -bool -usrp2_base::sync_every_pps(bool enable) -{ - return d_u2->sync_every_pps(enable); -} - -std::vector<uint32_t> -usrp2_base::peek32(uint32_t addr, uint32_t words) -{ - return d_u2->peek32(addr, words); -} - -bool -usrp2_base::poke32(uint32_t addr, const std::vector<uint32_t> &data) -{ - return d_u2->poke32(addr, data); -} - -bool -usrp2_base::start() -{ - // Default implementation is NOP - return true; -} - -bool -usrp2_base::stop() -{ - // Default implementation is NOP - return true; -} diff --git a/gr-usrp2/src/usrp2_base.h b/gr-usrp2/src/usrp2_base.h deleted file mode 100644 index 67a62ba10..000000000 --- a/gr-usrp2/src/usrp2_base.h +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 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_BASE_H -#define INCLUDED_USRP2_BASE_H - -#include <gr_sync_block.h> -#include <usrp2/usrp2.h> -#include <stdexcept> - -// BIG ASS FIXME: get from lower layer MTU calculation -#define USRP2_MIN_RX_SAMPLES 371 - -/*! - * Base class for all USRP2 blocks - */ -class usrp2_base : public gr_sync_block -{ -protected: - usrp2_base(const char *name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - - usrp2::usrp2::sptr d_u2; - -public: - ~usrp2_base(); - - /*! - * \brief Get USRP2 hardware MAC address - */ - std::string mac_addr() const; - - /*! - * \brief Get interface name used to communicat with USRP2 - */ - std::string interface_name() const; - - /*! - * \brief Get USRP2 master clock rate - */ - bool fpga_master_clock_freq(long *freq) const; - - /*! - * \brief MIMO configuration - */ - bool config_mimo(int flags); - - /*! - * \brief Set master time to 0 at next PPS rising edge - */ - bool sync_to_pps(); - - /*! - * Reset master time to 0 at every PPS edge - */ - bool sync_every_pps(bool enable); - - /*! - * \brief Read memory from Wishbone bus as words - */ - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - - /*! - * \brief Write memory to Wishbone bus as words - */ - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); - - /*! - * \brief Called by scheduler when starting flowgraph - */ - virtual bool start(); - - /*! - * \brief Called by scheduler when stopping flowgraph - */ - virtual bool stop(); - - /*! - * \brief Derived class must override this - */ - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) = 0; -}; - -#endif /* INCLUDED_USRP2_BASE_H */ diff --git a/gr-usrp2/src/usrp2_sink_16sc.cc b/gr-usrp2/src/usrp2_sink_16sc.cc deleted file mode 100644 index 75cc1f4a6..000000000 --- a/gr-usrp2/src/usrp2_sink_16sc.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- 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_16sc.h> -#include <usrp2/metadata.h> -#include <gr_io_signature.h> -#include <iostream> - -// FIXME hack until VRT replaces libusrp2 -#define U2_MIN_SAMPLES 9 - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_sink_16sc(ifc, mac_addr)); -} - -usrp2_sink_16sc::usrp2_sink_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_sink_base("usrp2_sink_16sc", - gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)), - ifc, mac_addr) -{ - // NOP -} - -usrp2_sink_16sc::~usrp2_sink_16sc() -{ - // NOP -} - -int -usrp2_sink_16sc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - std::complex<int16_t> *in = (std::complex<int16_t> *)input_items[0]; - - // FIXME: Current libusrp2 can't handle short packets. - // Returning 0 assumes there will be more samples - // the next round... - if (noutput_items < U2_MIN_SAMPLES) - return 0; - - usrp2::tx_metadata metadata; - - // Set TX metadata to either start time or now - if (d_should_wait == true) { - metadata.timestamp = d_tx_time; - metadata.send_now = 0; - d_should_wait = false; - } - else { - metadata.timestamp = -1; - metadata.send_now = 1; - } - metadata.start_of_burst = 1; - - bool ok = d_u2->tx_16sc(0, in, noutput_items, &metadata); - if (!ok){ - std::cerr << "usrp2_sink_16sc: tx_16sc failed" << std::endl; - return -1; // say we're done - } - - return noutput_items; -} diff --git a/gr-usrp2/src/usrp2_sink_16sc.h b/gr-usrp2/src/usrp2_sink_16sc.h deleted file mode 100644 index faacc447a..000000000 --- a/gr-usrp2/src/usrp2_sink_16sc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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_16SC_H -#define INCLUDED_USRP2_SINK_16SC_H - -#include <usrp2_sink_base.h> - -class usrp2_sink_16sc; -typedef boost::shared_ptr<usrp2_sink_16sc> usrp2_sink_16sc_sptr; - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup sink_blk - * \ingroup usrp2 - */ -class usrp2_sink_16sc : public usrp2_sink_base -{ -private: - friend usrp2_sink_16sc_sptr - usrp2_make_sink_16sc(const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -protected: - usrp2_sink_16sc(const std::string &ifc, const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_sink_16sc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SINK_16SC_H */ diff --git a/gr-usrp2/src/usrp2_sink_32fc.cc b/gr-usrp2/src/usrp2_sink_32fc.cc deleted file mode 100644 index fa75b3805..000000000 --- a/gr-usrp2/src/usrp2_sink_32fc.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- 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_32fc.h> -#include <usrp2/metadata.h> -#include <gr_io_signature.h> -#include <iostream> - -// FIXME hack until VRT replaces libusrp2 -#define U2_MIN_SAMPLES 9 - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_sink_32fc(ifc, mac_addr)); -} - -usrp2_sink_32fc::usrp2_sink_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_sink_base("usrp2_sink_32fc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - ifc, mac_addr) -{ - // NOP -} - -usrp2_sink_32fc::~usrp2_sink_32fc() -{ - // NOP -} - -int -usrp2_sink_32fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *)input_items[0]; - - // FIXME: Current libusrp2 can't handle short packets. - // Returning 0 assumes there will be more samples - // the next round... - if (noutput_items < U2_MIN_SAMPLES) - return 0; - - usrp2::tx_metadata metadata; - - // Set TX metadata to either start time or now - if (d_should_wait == true) { - metadata.timestamp = d_tx_time; - metadata.send_now = 0; - d_should_wait = false; - } - else { - metadata.timestamp = -1; - metadata.send_now = 1; - } - metadata.start_of_burst = 1; - - bool ok = d_u2->tx_32fc(0, in, noutput_items, &metadata); - if (!ok){ - std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl; - return -1; // say we're done - } - - return noutput_items; -} diff --git a/gr-usrp2/src/usrp2_sink_32fc.h b/gr-usrp2/src/usrp2_sink_32fc.h deleted file mode 100644 index b63f96871..000000000 --- a/gr-usrp2/src/usrp2_sink_32fc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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_32FC_H -#define INCLUDED_USRP2_SINK_32FC_H - -#include <usrp2_sink_base.h> - -class usrp2_sink_32fc; -typedef boost::shared_ptr<usrp2_sink_32fc> usrp2_sink_32fc_sptr; - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup sink_blk - * \ingroup usrp2 - */ -class usrp2_sink_32fc : public usrp2_sink_base -{ -private: - friend usrp2_sink_32fc_sptr - usrp2_make_sink_32fc(const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -protected: - usrp2_sink_32fc(const std::string &ifc, const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_sink_32fc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SINK_32FC_H */ diff --git a/gr-usrp2/src/usrp2_sink_base.cc b/gr-usrp2/src/usrp2_sink_base.cc deleted file mode 100644 index c9b34a54a..000000000 --- a/gr-usrp2/src/usrp2_sink_base.cc +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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> -#include <iostream> - -usrp2_sink_base::usrp2_sink_base(const char *name, - gr_io_signature_sptr input_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : usrp2_base(name, - input_signature, - gr_make_io_signature(0, 0, 0), - ifc, mac), - d_should_wait(false), - d_tx_time(0) -{ - // NOP -} - -usrp2_sink_base::~usrp2_sink_base () -{ - // NOP -} - -bool -usrp2_sink_base::set_antenna(int ant) -{ - return d_u2->set_tx_antenna(ant); -} - -bool -usrp2_sink_base::set_gain(double gain) -{ - return d_u2->set_tx_gain(gain); -} - -bool -usrp2_sink_base::set_lo_offset(double frequency) -{ - return d_u2->set_tx_lo_offset(frequency); -} - -bool -usrp2_sink_base::set_center_freq(double frequency, usrp2::tune_result *tr) -{ - return d_u2->set_tx_center_freq(frequency, tr); -} - -bool -usrp2_sink_base::set_interp(int interp_factor) -{ - return d_u2->set_tx_interp(interp_factor); -} - -void -usrp2_sink_base::default_scale_iq(int interp_factor, int *scale_i, int *scale_q) -{ - return d_u2->default_tx_scale_iq(interp_factor, scale_i, scale_q); -} - -bool -usrp2_sink_base::set_scale_iq(int scale_i, int scale_q) -{ - return d_u2->set_tx_scale_iq(scale_i, scale_q); -} - -int -usrp2_sink_base::interp() -{ - return d_u2->tx_interp(); -} - -bool -usrp2_sink_base::dac_rate(long *rate) -{ - return d_u2->dac_rate(rate); -} - -double -usrp2_sink_base::gain_min() -{ - return d_u2->tx_gain_min(); -} - -double -usrp2_sink_base::gain_max() -{ - return d_u2->tx_gain_max(); -} - -double -usrp2_sink_base::gain_db_per_step() -{ - return d_u2->tx_gain_db_per_step(); -} - -double -usrp2_sink_base::freq_min() -{ - return d_u2->tx_freq_min(); -} - -double -usrp2_sink_base::freq_max() -{ - return d_u2->tx_freq_max(); -} - -bool -usrp2_sink_base::daughterboard_id(int *dbid) -{ - return d_u2->tx_daughterboard_id(dbid); -} - -bool usrp2_sink_base::set_gpio_ddr(uint16_t value, uint16_t mask) -{ - return d_u2->set_gpio_ddr(usrp2::GPIO_TX_BANK, value, mask); -} - -bool usrp2_sink_base::set_gpio_sels(std::string sels) -{ - return d_u2->set_gpio_sels(usrp2::GPIO_TX_BANK, sels); -} - -bool usrp2_sink_base::write_gpio(uint16_t value, uint16_t mask) -{ - return d_u2->write_gpio(usrp2::GPIO_TX_BANK, value, mask); -} - -bool usrp2_sink_base::read_gpio(uint16_t *value) -{ - return d_u2->read_gpio(usrp2::GPIO_TX_BANK, value); -} - -bool usrp2_sink_base::start_streaming_at(usrp2::fpga_timestamp time) -{ - d_should_wait = true; - d_tx_time = time; - return true; -} diff --git a/gr-usrp2/src/usrp2_sink_base.h b/gr-usrp2/src/usrp2_sink_base.h deleted file mode 100644 index d831d4df6..000000000 --- a/gr-usrp2/src/usrp2_sink_base.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 <usrp2_base.h> - -/*! - * Base class for all USRP2 transmit blocks - */ -class usrp2_sink_base : public usrp2_base -{ -protected: - usrp2_sink_base(const char *name, - gr_io_signature_sptr input_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - - bool d_should_wait; - usrp2::fpga_timestamp d_tx_time; - -public: - ~usrp2_sink_base(); - - /*! - * \brief Set antenna - */ - bool set_antenna(int ant); - - /*! - * \brief Set transmitter gain - */ - bool set_gain(double gain); - - /*! - * \brief Set transmitter LO offset frequency - */ - bool set_lo_offset(double frequency); - - /*! - * \brief Set transmitter center frequency - */ - bool set_center_freq(double frequency, usrp2::tune_result *tr); - - /*! - * \brief Set transmit interpolation rate - */ - bool set_interp(int interp_factor); - - /*! - * \brief Calculate default scale_iq for given interpolation factor - */ - void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q); - - /*! - * \brief Set transmit IQ scale factors - */ - bool set_scale_iq(int scale_i, int scale_q); - - /*! - * \brief Get transmit interpolation rate - */ - int interp(); - - /*! - * \brief Get DAC sample rate in Hz - */ - bool dac_rate(long *rate); - - /*! - * \brief Returns minimum Tx gain - */ - double gain_min(); - - /*! - * \brief Returns maximum Tx gain - */ - double gain_max(); - - /*! - * \brief Returns Tx gain db_per_step - */ - double gain_db_per_step(); - - /*! - * \brief Returns minimum Tx center frequency - */ - double freq_min(); - - /*! - * \brief Returns maximum Tx center frequency - */ - double freq_max(); - - /*! - * \brief Get Tx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool daughterboard_id(int *dbid); - - /*! - * \brief Set daughterboard GPIO data direction register. - */ - bool set_gpio_ddr(uint16_t value, uint16_t mask); - - /*! - * \brief Set daughterboard GPIO output selection register. - */ - bool set_gpio_sels(std::string sels); - - /*! - * \brief Set daughterboard GPIO pin values. - */ - bool write_gpio(uint16_t value, uint16_t mask); - - /*! - * \brief Read daughterboard GPIO pin values - */ - bool read_gpio(uint16_t *value); - - /*! - * \brief First samples begin streaming to USRP2 at given time - */ - bool start_streaming_at(usrp2::fpga_timestamp time); -}; - -#endif /* INCLUDED_USRP2_SINK_BASE_H */ diff --git a/gr-usrp2/src/usrp2_source_16sc.cc b/gr-usrp2/src/usrp2_source_16sc.cc deleted file mode 100644 index 33114b51d..000000000 --- a/gr-usrp2/src/usrp2_source_16sc.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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_16sc.h> -#include <rx_16sc_handler.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_source_16sc(ifc, mac_addr)); -} - -usrp2_source_16sc::usrp2_source_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_source_base("usrp2_source_16sc", - gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)), - ifc, mac_addr) -{ - set_output_multiple(USRP2_MIN_RX_SAMPLES); -} - -usrp2_source_16sc::~usrp2_source_16sc() -{ - // NOP -} - -int -usrp2_source_16sc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - std::complex<int16_t> *out = (std::complex<int16_t> *)output_items[0]; - - rx_16sc_handler::sptr handler = rx_16sc_handler::make(noutput_items, USRP2_MIN_RX_SAMPLES, out); - - bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number instead of 0 - if (!ok){ - std::cerr << "usrp2::rx_samples() failed" << std::endl; - return -1; // say we're done - } - - return handler->nsamples(); -} diff --git a/gr-usrp2/src/usrp2_source_16sc.h b/gr-usrp2/src/usrp2_source_16sc.h deleted file mode 100644 index d5a86be73..000000000 --- a/gr-usrp2/src/usrp2_source_16sc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- 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_16SC_H -#define INCLUDED_USRP2_SOURCE_16SC_H - -#include <usrp2_source_base.h> - -class usrp2_source_16sc; -typedef boost::shared_ptr<usrp2_source_16sc> usrp2_source_16sc_sptr; - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup source_blk - * \ingroup usrp2 - */ -class usrp2_source_16sc : public usrp2_source_base -{ -private: - friend usrp2_source_16sc_sptr - usrp2_make_source_16sc(const std::string &ifc, - const std::string &mac) throw (std::runtime_error); - -protected: - usrp2_source_16sc(const std::string &ifc, const std::string &mac) throw (std::runtime_error); - -public: - ~usrp2_source_16sc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SOURCE_16SC_H */ diff --git a/gr-usrp2/src/usrp2_source_32fc.cc b/gr-usrp2/src/usrp2_source_32fc.cc deleted file mode 100644 index 89b4bea0e..000000000 --- a/gr-usrp2/src/usrp2_source_32fc.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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_32fc.h> -#include <rx_32fc_handler.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_source_32fc(ifc, mac_addr)); -} - -usrp2_source_32fc::usrp2_source_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_source_base("usrp2_source_32fc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - ifc, mac_addr) -{ - set_output_multiple(USRP2_MIN_RX_SAMPLES); -} - -usrp2_source_32fc::~usrp2_source_32fc() -{ - // NOP -} - -int -usrp2_source_32fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *out = (gr_complex *)output_items[0]; - - rx_32fc_handler::sptr handler = rx_32fc_handler::make(noutput_items, USRP2_MIN_RX_SAMPLES, out); - - bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number instead of 0 - if (!ok){ - std::cerr << "usrp2::rx_samples() failed" << std::endl; - return -1; // say we're done - } - - return handler->nsamples(); -} diff --git a/gr-usrp2/src/usrp2_source_32fc.h b/gr-usrp2/src/usrp2_source_32fc.h deleted file mode 100644 index 041416ded..000000000 --- a/gr-usrp2/src/usrp2_source_32fc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- 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_32FC_H -#define INCLUDED_USRP2_SOURCE_32FC_H - -#include <usrp2_source_base.h> - -class usrp2_source_32fc; -typedef boost::shared_ptr<usrp2_source_32fc> usrp2_source_32fc_sptr; - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup source_blk - * \ingroup usrp2 - */ -class usrp2_source_32fc : public usrp2_source_base -{ -private: - friend usrp2_source_32fc_sptr - usrp2_make_source_32fc(const std::string &ifc, - const std::string &mac) throw (std::runtime_error); - -protected: - usrp2_source_32fc(const std::string &ifc, const std::string &mac) throw (std::runtime_error); - -public: - ~usrp2_source_32fc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SOURCE_32FC_H */ diff --git a/gr-usrp2/src/usrp2_source_base.cc b/gr-usrp2/src/usrp2_source_base.cc deleted file mode 100644 index d946991de..000000000 --- a/gr-usrp2/src/usrp2_source_base.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- 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> - -usrp2_source_base::usrp2_source_base(const char *name, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : usrp2_base(name, - gr_make_io_signature(0, 0, 0), - output_signature, - ifc, mac) -{ - // NOP -} - -usrp2_source_base::~usrp2_source_base () -{ - // NOP -} - -bool -usrp2_source_base::set_antenna(int ant) -{ - return d_u2->set_rx_antenna(ant); -} - -bool -usrp2_source_base::set_gain(double gain) -{ - return d_u2->set_rx_gain(gain); -} - -bool -usrp2_source_base::set_lo_offset(double frequency) -{ - return d_u2->set_rx_lo_offset(frequency); -} - -bool -usrp2_source_base::set_center_freq(double frequency, usrp2::tune_result *tr) -{ - return d_u2->set_rx_center_freq(frequency, tr); -} - -bool -usrp2_source_base::set_decim(int decimation_factor) -{ - return d_u2->set_rx_decim(decimation_factor); -} - -bool -usrp2_source_base::set_scale_iq(int scale_i, int scale_q) -{ - return d_u2->set_rx_scale_iq(scale_i, scale_q); -} - -int -usrp2_source_base::decim() -{ - return d_u2->rx_decim(); -} - -bool -usrp2_source_base::adc_rate(long *rate) -{ - return d_u2->adc_rate(rate); -} - -double -usrp2_source_base::gain_min() -{ - return d_u2->rx_gain_min(); -} - -double -usrp2_source_base::gain_max() -{ - return d_u2->rx_gain_max(); -} - -double -usrp2_source_base::gain_db_per_step() -{ - return d_u2->rx_gain_db_per_step(); -} - -double -usrp2_source_base::freq_min() -{ - return d_u2->rx_freq_min(); -} - -double -usrp2_source_base::freq_max() -{ - return d_u2->rx_freq_max(); -} - -bool -usrp2_source_base::daughterboard_id(int *dbid) -{ - return d_u2->rx_daughterboard_id(dbid); -} - -unsigned int -usrp2_source_base::overruns() -{ - return d_u2->rx_overruns(); -} - -unsigned int -usrp2_source_base::missing() -{ - return d_u2->rx_missing(); -} - -bool -usrp2_source_base::start() -{ - return d_u2->start_rx_streaming(0); // FIXME: someday sources will have channel #s -} - -bool -usrp2_source_base::stop() -{ - return d_u2->stop_rx_streaming(0); // FIXME: someday sources will have channel #s -} - -bool -usrp2_source_base::set_gpio_ddr(uint16_t value, uint16_t mask) -{ - return d_u2->set_gpio_ddr(usrp2::GPIO_RX_BANK, value, mask); -} - -bool -usrp2_source_base::set_gpio_sels(std::string sels) -{ - return d_u2->set_gpio_sels(usrp2::GPIO_RX_BANK, sels); -} - -bool -usrp2_source_base::write_gpio(uint16_t value, uint16_t mask) -{ - return d_u2->write_gpio(usrp2::GPIO_RX_BANK, value, mask); -} - -bool -usrp2_source_base::read_gpio(uint16_t *value) -{ - return d_u2->read_gpio(usrp2::GPIO_RX_BANK, value); -} - -bool -usrp2_source_base::enable_gpio_streaming(int enable) -{ - return d_u2->enable_gpio_streaming(usrp2::GPIO_RX_BANK, enable); -} diff --git a/gr-usrp2/src/usrp2_source_base.h b/gr-usrp2/src/usrp2_source_base.h deleted file mode 100644 index 9e35e2e93..000000000 --- a/gr-usrp2/src/usrp2_source_base.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2010 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 <usrp2_base.h> - -/*! - * Base class for all USRP2 source blocks - */ -class usrp2_source_base : public usrp2_base -{ -protected: - usrp2_source_base(const char *name, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_source_base(); - - /*! - * \brief Set antenna - */ - bool set_antenna(int ant); - - /*! - * \brief Set receiver gain - */ - bool set_gain(double gain); - - /*! - * \brief Set receive LO offset frequency - */ - bool set_lo_offset(double frequency); - - /*! - * \brief Set receiver center frequency - */ - bool set_center_freq(double frequency, usrp2::tune_result *tr); - - /*! - * \brief Set receive decimation rate - */ - bool set_decim(int decimation_factor); - - /*! - * \brief Set receive IQ scale factors - */ - bool set_scale_iq(int scale_i, int scale_q); - - /*! - * \brief Get receive decimation rate - */ - int decim(); - - /*! - * \brief Get the ADC sample rate - */ - bool adc_rate(long *rate); - - /*! - * \brief Returns minimum Rx gain - */ - double gain_min(); - - /*! - * \brief Returns maximum Rx gain - */ - double gain_max(); - - /*! - * \brief Returns Rx gain db_per_step - */ - double gain_db_per_step(); - - /*! - * \brief Returns minimum Rx center frequency - */ - double freq_min(); - - /*! - * \brief Returns maximum Rx center frequency - */ - double freq_max(); - - /*! - * \brief Get Rx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool daughterboard_id(int *dbid); - - /*! - * \brief Returns number of receiver overruns - */ - unsigned int overruns(); - - /*! - * \brief Returns number of missing sequence numbers - */ - unsigned int missing(); - - /*! - * \brief Called by scheduler when starting flowgraph - */ - virtual bool start(); - - /*! - * \brief Called by scheduler when stopping flowgraph - */ - virtual bool stop(); - - /*! - * \brief Set daughterboard GPIO data direction register. - */ - bool set_gpio_ddr(uint16_t value, uint16_t mask); - - /*! - * \brief Set daughterboard GPIO output selection register. - */ - bool set_gpio_sels(std::string sels); - - /*! - * \brief Set daughterboard GPIO pin values. - */ - bool write_gpio(uint16_t value, uint16_t mask); - - /*! - * \brief Read daughterboard GPIO pin values - */ - bool read_gpio(uint16_t *value); - - /*! - * \brief Enable streaming GPIO in sample LSBs - */ - bool enable_gpio_streaming(int enable); -}; - -#endif /* INCLUDED_USRP2_SOURCE_BASE_H */ diff --git a/gr-usrp2/src/usrp2_swig.i b/gr-usrp2/src/usrp2_swig.i deleted file mode 100644 index 6e8fa1960..000000000 --- a/gr-usrp2/src/usrp2_swig.i +++ /dev/null @@ -1,361 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 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. - */ - -%include "gnuradio.i" // the common stuff -%import <stdint.i> - -%{ -#include "usrp2_source_16sc.h" -#include "usrp2_source_32fc.h" -#include "usrp2_sink_16sc.h" -#include "usrp2_sink_32fc.h" -%} - -%include <usrp2/tune_result.h> -%include <usrp2/mimo_config.h> -%include <usrp2/metadata.h> - -%template(uint32_t_vector) std::vector<uint32_t>; - -// ---------------------------------------------------------------- - -class usrp2_base : public gr_sync_block -{ -protected: - usrp2_base() throw (std::runtime_error); - -public: - ~usrp2_base(); - - std::string mac_addr() const; - std::string interface_name() const; - %rename(_real_fpga_master_clock_freq) fpga_master_clock_freq; - bool fpga_master_clock_freq(long *freq); - bool config_mimo(int flags); - bool sync_to_pps(); - bool sync_every_pps(bool enable); - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); -}; - -// ---------------------------------------------------------------- - -class usrp2_source_base : public usrp2_base -{ -protected: - usrp2_source_base() throw (std::runtime_error); - -public: - ~usrp2_source_base(); - - bool set_antenna(int ant); - bool set_gain(double gain); - %rename(_real_set_center_freq) set_center_freq; - bool set_lo_offset(double frequency); - bool set_center_freq(double frequency, usrp2::tune_result *r); - bool set_decim(int decimation_factor); - bool set_scale_iq(int scale_i, int scale_q); - int decim(); - %rename(_real_adc_rate) adc_rate; - bool adc_rate(long *rate); - double gain_min(); - double gain_max(); - double gain_db_per_step(); - double freq_min(); - double freq_max(); - %rename(_real_daughterboard_id) daughterboard_id; - bool daughterboard_id(int *dbid); - unsigned int overruns(); - unsigned int missing(); - bool set_gpio_ddr(uint16_t value, uint16_t mask); - bool set_gpio_sels(std::string sels); - bool write_gpio(uint16_t value, uint16_t mask); - %rename(_real_read_gpio) read_gpio; - bool read_gpio(uint16_t *value); - bool enable_gpio_streaming(int enable); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,source_32fc) - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_source_32fc : public usrp2_source_base -{ -protected: - usrp2_source_32fc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_source_32fc(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,source_16sc) - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_source_16sc : public usrp2_source_base -{ -protected: - usrp2_source_16sc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_source_16sc(); -}; - -// ---------------------------------------------------------------- - -class usrp2_sink_base : public usrp2_base -{ -protected: - usrp2_sink_base() throw (std::runtime_error); - -public: - ~usrp2_sink_base(); - - bool set_antenna(int ant); - bool set_gain(double gain); - %rename(_real_set_center_freq) set_center_freq; - bool set_lo_offset(double frequency); - bool set_center_freq(double frequency, usrp2::tune_result *r); - bool set_interp(int interp_factor); - bool set_scale_iq(int scale_i, int scale_q); - int interp(); - %rename(_real_default_tx_scale_iq) default_scale_iq; - void default_scale_iq(int interp, int *scale_i, int *scale_q); - %rename(_real_dac_rate) dac_rate; - bool dac_rate(long *rate); - double gain_min(); - double gain_max(); - double gain_db_per_step(); - double freq_min(); - double freq_max(); - %rename(_real_daughterboard_id) daughterboard_id; - bool daughterboard_id(int *dbid); - bool set_gpio_ddr(uint16_t value, uint16_t mask); - bool set_gpio_sels(std::string sels); - bool write_gpio(uint16_t value, uint16_t mask); - %rename(_real_read_gpio) read_gpio; - bool read_gpio(uint16_t *value); - bool start_streaming_at(usrp2::fpga_timestamp time); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,sink_32fc) - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_sink_32fc : public usrp2_sink_base -{ -protected: - usrp2_sink_32fc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_sink_32fc(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,sink_16sc) - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_sink_16sc : public usrp2_sink_base -{ -protected: - usrp2_sink_16sc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_sink_16sc(); -}; - -// ---------------------------------------------------------------- - -// some utility functions to allow Python to deal with pointers -%{ - long *make_long_ptr() { return new long; } - long deref_long_ptr(long *l) { return *l; } - void free_long_ptr(long *l) { delete l; } - int *make_int_ptr() { return new int; } - int deref_int_ptr(int *l) { return *l; } - void free_int_ptr(int *l) { delete l; } - uint16_t *make_uint16_ptr() { return new uint16_t; } - int deref_uint16_ptr(uint16_t *l) { return *l; } - void free_uint16_ptr(uint16_t *l) { delete l; } -%} - -long *make_long_ptr(); -long deref_long_ptr(long *l); -void free_long_ptr(long *l); -int *make_int_ptr(); -int deref_int_ptr(int *l); -void free_int_ptr(int *l); -uint16_t *make_uint16_ptr(); -int deref_uint16_ptr(uint16_t *l); -void free_uint16_ptr(uint16_t *l); - -#ifdef SWIGPYTHON -// create a more pythonic interface -%pythoncode %{ - -def __set_center_freq(self, freq): - tr = tune_result() - r = self._real_set_center_freq(freq, tr) - if r: - return tr - else: - return None - -def __fpga_master_clock_freq(self): - f = make_long_ptr(); - r = self._real_fpga_master_clock_freq(f) - if r: - result = deref_long_ptr(f) - else: - result = None - free_long_ptr(f) - return result - -def __adc_rate(self): - rate = make_long_ptr(); - r = self._real_adc_rate(rate) - if r: - result = deref_long_ptr(rate) - else: - result = None - free_long_ptr(rate) - return result - -def __dac_rate(self): - rate = make_long_ptr(); - r = self._real_dac_rate(rate) - if r: - result = deref_long_ptr(rate) - else: - result = None - free_long_ptr(rate) - return result - -def __gain_range(self): - return [self.gain_min(), - self.gain_max(), - self.gain_db_per_step()] - -# NOTE: USRP1 uses a length three tuple here (3rd value is 'freq step'), -# but it's not really useful. We let an index error happen here -# to identify code using it. -def __freq_range(self): - return [self.freq_min(), - self.freq_max()] - -def __daughterboard_id(self): - dbid = make_int_ptr() - r = self._real_daughterboard_id(dbid) - if r: - result = deref_int_ptr(dbid) - else: - result = None - free_int_ptr(dbid) - return result - -def __default_tx_scale_iq(self, interp): - scale_i = make_int_ptr() - scale_q = make_int_ptr() - self._real_default_tx_scale_iq(interp, scale_i, scale_q) - return (deref_int_ptr(scale_i), deref_int_ptr(scale_q)) - -def __read_gpio(self): - value = make_uint16_ptr() - r = self._real_read_gpio(value) - if r: - result = deref_uint16_ptr(value) - else: - result = None - free_uint16_ptr(value) - return result - - -usrp2_source_32fc_sptr.set_center_freq = __set_center_freq -usrp2_source_16sc_sptr.set_center_freq = __set_center_freq -usrp2_sink_32fc_sptr.set_center_freq = __set_center_freq -usrp2_sink_16sc_sptr.set_center_freq = __set_center_freq - -usrp2_source_32fc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_source_16sc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_sink_32fc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_sink_16sc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq - -usrp2_source_32fc_sptr.adc_rate = __adc_rate -usrp2_source_16sc_sptr.adc_rate = __adc_rate -usrp2_sink_32fc_sptr.dac_rate = __dac_rate -usrp2_sink_16sc_sptr.dac_rate = __dac_rate - -usrp2_source_32fc_sptr.gain_range = __gain_range -usrp2_source_16sc_sptr.gain_range = __gain_range -usrp2_sink_32fc_sptr.gain_range = __gain_range -usrp2_sink_16sc_sptr.gain_range = __gain_range - -usrp2_source_32fc_sptr.freq_range = __freq_range -usrp2_source_16sc_sptr.freq_range = __freq_range -usrp2_sink_32fc_sptr.freq_range = __freq_range -usrp2_sink_16sc_sptr.freq_range = __freq_range - -usrp2_source_32fc_sptr.daughterboard_id = __daughterboard_id -usrp2_source_16sc_sptr.daughterboard_id = __daughterboard_id -usrp2_sink_32fc_sptr.daughterboard_id = __daughterboard_id -usrp2_sink_16sc_sptr.daughterboard_id = __daughterboard_id - -usrp2_sink_32fc_sptr.default_scale_iq = __default_tx_scale_iq -usrp2_sink_16sc_sptr.default_scale_iq = __default_tx_scale_iq - -usrp2_source_32fc_sptr.read_gpio = __read_gpio -usrp2_source_16sc_sptr.read_gpio = __read_gpio -usrp2_sink_32fc_sptr.read_gpio = __read_gpio -usrp2_sink_16sc_sptr.read_gpio = __read_gpio - -%} -#endif - -#if SWIGGUILE -%scheme %{ -(load-extension-global "libguile-gnuradio-usrp2_swig" "scm_init_gnuradio_usrp2_swig_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif |