commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9446 - in gnuradio/branches/features/gr-usrp2: . conf


From: jcorgan
Subject: [Commit-gnuradio] r9446 - in gnuradio/branches/features/gr-usrp2: . config gr-usrp2 gr-usrp2/src
Date: Fri, 29 Aug 2008 13:41:01 -0600 (MDT)

Author: jcorgan
Date: 2008-08-29 13:41:00 -0600 (Fri, 29 Aug 2008)
New Revision: 9446

Added:
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.am
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.swig
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/run_tests.in
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/test_gr_usrp2.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.h
Removed:
   gnuradio/branches/features/gr-usrp2/gr-usrp2/Makefile.am
   gnuradio/branches/features/gr-usrp2/gr-usrp2/test.sh
   gnuradio/branches/features/gr-usrp2/gr-usrp2/test_gr_usrp2.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2.i
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.h
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.h
Modified:
   gnuradio/branches/features/gr-usrp2/config/Makefile.am
   gnuradio/branches/features/gr-usrp2/configure.ac
Log:
wip

Modified: gnuradio/branches/features/gr-usrp2/config/Makefile.am
===================================================================
--- gnuradio/branches/features/gr-usrp2/config/Makefile.am      2008-08-29 
19:06:44 UTC (rev 9445)
+++ gnuradio/branches/features/gr-usrp2/config/Makefile.am      2008-08-29 
19:41:00 UTC (rev 9446)
@@ -74,6 +74,7 @@
        gr_check_usrp.m4 \
        grc_pmt.m4 \
        grc_usrp.m4 \
+       grc_usrp2.m4 \
        grc_gr_msdd6000.m4 \
        gr_doxygen.m4 \
        gr_fortran.m4 \

Modified: gnuradio/branches/features/gr-usrp2/configure.ac
===================================================================
--- gnuradio/branches/features/gr-usrp2/configure.ac    2008-08-29 19:06:44 UTC 
(rev 9445)
+++ gnuradio/branches/features/gr-usrp2/configure.ac    2008-08-29 19:41:00 UTC 
(rev 9446)
@@ -281,6 +281,7 @@
 GRC_MBLOCK                     dnl this must come after GRC_PMT
 GRC_USRP
 GRC_GR_USRP                    dnl this must come after GRC_USRP
+GRC_GR_USRP2
 GRC_GR_GCELL                   dnl this must come after GRC_GCELL and 
GRC_GNURADIO_CORE
 GRC_GR_MSDD6000        
 GRC_GR_AUDIO_ALSA

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/Makefile.am


Property changes on: gnuradio/branches/features/gr-usrp2/gr-usrp2/src
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
.libs
.deps
usrp2.py
usrp2.cc
run_tests


Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.am (from rev 
9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/Makefile.am)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.am                
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.am        
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,85 @@
+#
+# Copyright 2004,2005,2006,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.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+# ----------------------------------------------------------------------
+# C++ block API interface librar(ies)
+#
+# libgr-usrp.so
+# ----------------------------------------------------------------------
+AM_CPPFLAGS = \
+       $(STD_DEFINES_AND_INCLUDES)  \
+       $(PYTHON_CPPFLAGS) \
+       $(USRP2_CFLAGS) \
+       $(WITH_INCLUDES)
+
+lib_LTLIBRARIES = libgr-usrp2.la
+
+libgr_usrp2_la_SOURCES = \
+       usrp2_source_base.cc \
+       usrp2_source_32fc.cc
+#      usrp2_source_16sc.cc
+#      usrp2_sink_base.cc
+#      usrp2_sink_32fc.cc
+#      usrp2_sink_16sc.cc
+
+libgr_usrp2_la_LIBADD = \
+       $(USRP2_LIBS) \
+       $(GNURADIO_LA)
+
+include_HEADERS = \
+       usrp2_source_base.h \
+       usrp2_source_32fc.h
+#      usrp2_source_16sc.h
+#      usrp2_sink_base.h \
+#      usrp2_sink_32fc.h \
+#      usrp2_sink_16sc.h
+
+
+# ----------------------------------------------------------------------
+# C++ binaries, not installed
+#
+# test_gr_usrp2
+# ----------------------------------------------------------------------
+noinst_PROGRAMS = test_gr_usrp2
+test_gr_usrp2_SOURCES = test_gr_usrp2.cc
+test_gr_usrp2_LDADD = libgr-usrp2.la
+
+# Uncomment to include swig part of build
+#include Makefile.swig
+
+# ----------------------------------------------------------------------
+# Local Python files, not installed
+#
+# qa_usrp2.py
+# ----------------------------------------------------------------------
+
+#noinst_PYTHON = qa_usrp.py                    
+
+
+# ----------------------------------------------------------------------
+# Miscellaneous build operations
+# ----------------------------------------------------------------------
+
+EXTRA_DIST = run_tests.in
+TESTS = run_tests
+MOSTLYCLEANFILES = $(BUILT_SOURCES)

Added: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.swig
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.swig              
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/Makefile.swig      
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,54 @@
+# ----------------------------------------------------------------------
+# Python SWIG wrapper around C++ library
+#
+# usrp2.py
+# _usrp2.so
+# ----------------------------------------------------------------------
+
+# Python installation locations
+ourpythondir = $(grpythondir)
+ourlibdir    = $(grpyexecdir)
+
+# SWIG interface files
+LOCAL_IFILES = usrp2.i
+NON_LOCAL_IFILES = $(GNURADIO_I)
+ALL_IFILES = $(LOCAL_IFILES) $(NON_LOCAL_IFILES)               
+
+# Install the SWIG interface files
+swiginclude_HEADERS = $(LOCAL_IFILES)
+
+# Generated by SWIG wrapper generator
+BUILT_SOURCES = usrp2.cc usrp2.py                      
+
+# Install the SWIG python output
+ourpython_PYTHON = usrp2.py
+
+# Arguments to the swig wrapper generator
+SWIGPYTHONARGS = \
+       $(STD_DEFINES_AND_INCLUDES) \
+       $(SWIGPYTHONFLAGS) \
+       -I$(USRP2_INCLUDEDIR) \
+       $(WITH_INCLUDES) \
+       $(WITH_SWIG_INCLUDES)
+
+# Invoke SWIG wrapper generator
+usrp2.cc usrp2.py: $(ALL_IFILES)
+       $(SWIG) $(SWIGPYTHONARGS) -module usrp2 -o usrp2.cc usrp2.i
+
+# Create the Python shared library
+ourlib_LTLIBRARIES = _usrp2.la
+_usrp2_la_SOURCES = usrp2.cc
+_usrp2_la_CXXFLAGS = @swig_CXXFLAGS@
+_usrp2_la_LDFLAGS = $(swig_CXXFLAGS) $(NO_UNDEFINED) -module -avoid-version
+
+# Link the library as needed
+_usrp2_la_LIBADD = \
+       $(PYTHON_LDFLAGS) \
+       $(GNURADIO_CORE_LA) \
+       $(USRP2_LIBS) \
+       -lstdc++
+
+# 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

Added: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/run_tests.in
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/run_tests.in               
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/run_tests.in       
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,17 @@
+#!/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
address@hidden@/usrp/host/lib/legacy:@abs_top_builddir@/usrp/host/lib/legacy/.libs:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
+
+# For Win32
address@hidden@/usrp/host/lib/legacy:@abs_top_builddir@/usrp/host/lib/legacy/.libs:$PATH
+
address@hidden@/run_tests.sh \
+    @abs_top_srcdir@/gr-usrp \
+    @abs_top_builddir@/gr-usrp \
+    @srcdir@

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/test_gr_usrp2.cc (from 
rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/test_gr_usrp2.cc)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/test_gr_usrp2.cc           
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/test_gr_usrp2.cc   
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,194 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <usrp2/strtod_si.h>
+#include <gruel/realtime.h>
+#include <usrp2_source_32fc.h>
+#include <string.h>
+#include <iostream>
+
+static void
+usage(const char *progname)
+{
+  const char *p = strrchr(progname, '/');      // drop leading directory path
+  if (p)
+    p++;
+
+  if (strncmp(p, "lt-", 3) == 0)               // drop lt- libtool prefix
+    p += 3;
+  
+  fprintf(stderr, "Usage: %s [options]\n\n", p);
+  fprintf(stderr, "Options:\n");
+  fprintf(stderr, "  -h                   show this message and exit\n");
+  fprintf(stderr, "  -e ETH_INTERFACE     specify ethernet interface 
[default=eth0]\n");
+  fprintf(stderr, "  -m MAC_ADDR          mac address of USRP2 HH:HH 
[default=first one found]\n");
+  fprintf(stderr, "  -g GAIN              specify receive daughterboard gain 
[default=0]\n");
+  fprintf(stderr, "  -f FREQUENCY         specify receive center frequency in 
Hz [default=0.0]\n");
+  fprintf(stderr, "  -d DECIM             specify receive decimation rate 
[default=5]\n");
+#if 0
+  fprintf(stderr, "  -N NSAMPLES          specify number of samples to receive 
[default=infinite]\n");
+  fprintf(stderr, "  -o OUTPUT_FILENAME   specify file to receive samples 
[default=none]\n");
+  fprintf(stderr, "  -s                   write complex<short> 
[default=complex<float>]\n");
+#endif
+  fprintf(stderr, "  -v                   verbose output\n");
+}
+
+int
+main(int argc, char **argv)
+{
+  // options and their defaults
+  const char *interface = "eth0";
+  const char *mac_addr_str = "";
+  double rx_gain = 0.0;
+  double rx_freq = 0.0;
+  int rx_decim = 5;
+#if 0
+  uint64_t nsamples = 0;
+  bool output_shorts = false;
+  char *output_filename = 0;
+#endif
+  bool verbose = false;
+
+  int ch;
+
+  //while ((ch = getopt(argc, argv, "he:m:f:d:g:N:o:sv")) != EOF){
+  while ((ch = getopt(argc, argv, "he:m:g:f:d:v")) != EOF){
+    //double tmp;
+    switch (ch){
+
+    case 'e':
+      interface = optarg;
+      break;
+      
+    case 'm':
+      mac_addr_str = optarg;
+      break;
+
+    case 'g':
+      if (!strtod_si(optarg, &rx_gain)) {
+        std::cerr << "invalid number: " << optarg << std::endl;
+       usage(argv[0]);
+       exit(1);
+      }
+      break;
+
+    case 'f':
+      if (!strtod_si(optarg, &rx_freq)) {
+        std::cerr << "invalid number: " << optarg << std::endl;
+       usage(argv[0]);
+       exit(1);
+      }
+      break;
+
+    case 'd':
+      rx_decim = strtol(optarg, 0, 0);
+      if (rx_decim < 4 or rx_decim > 512) { 
+        std::cerr << "invalid decimation rate: " << optarg << std::endl;
+       usage(argv[0]);
+       exit(1);
+      }
+      break;
+
+#if 0
+    case 'N':
+      if (!strtod_si(optarg, &tmp)) {
+        std::cerr << "invalid number: " << optarg << std::endl;
+       usage(argv[0]);
+       exit(1);
+      }
+      nsamples = static_cast<uint64_t>(tmp);
+      break;
+      
+    case 's':
+      output_shorts = true;
+      break;
+
+    case 'o':
+      output_filename = optarg;
+      break;
+#endif      
+    case 'v':
+      verbose = true;
+      break;
+
+    case 'h':
+    default:
+      usage(argv[0]);
+      exit(1);
+    }
+  }
+
+  gruel::rt_status_t rt = gruel::enable_realtime_scheduling();
+  if (rt != gruel::RT_OK)
+    std::cerr << "Failed to enable realtime scheduling" << std::endl;
+
+  usrp2_source_32fc_sptr u2 = usrp2_make_source_32fc(interface, mac_addr_str);
+
+  if (!u2->set_gain(rx_gain)){
+    fprintf(stderr, "set_gain(%f) failed\n", rx_gain);
+    exit(1);
+  }
+
+  usrp2::tune_result tr;
+  if (!u2->set_center_freq(rx_freq, &tr)){
+    fprintf(stderr, "set_center_freq(%g) failed\n", rx_freq);
+    exit(1);
+  }
+
+  if (verbose){
+    printf("USRP2 MAC address: %s\n\n", u2->mac_addr().c_str());
+    printf("Daughterboard configuration:\n");
+    printf("  baseband_freq=%f\n", tr.baseband_freq);
+    printf("       ddc_freq=%f\n", tr.dxc_freq);
+    printf("  residual_freq=%f\n", tr.residual_freq);
+    printf("       inverted=%s\n\n", tr.spectrum_inverted ? "yes" : "no");
+  }
+
+  if (!u2->set_decim(rx_decim)) {
+    fprintf(stderr, "set_decim(%d) failed\n", rx_decim);
+    exit(1);
+  }
+
+  if (verbose)
+    printf("USRP2 using decimation rate of %d\n", rx_decim);
+
+#if 0    
+  if (verbose) {
+    if (nsamples > 0)
+        printf("Receiving %zd samples\n\n", nsamples);
+    else
+        printf("Receiving infinite samples\n\n");
+  }
+  
+  struct timeval start, end;
+  gettimeofday(&start, 0);
+
+  // Run flowgraph here
+
+  gettimeofday(&end, 0);
+  long n_usecs = end.tv_usec-start.tv_usec;
+  long n_secs = end.tv_sec-start.tv_sec;
+  double elapsed = (double)n_secs + (double)n_usecs*1e-6;
+#endif
+
+  return 0;
+}

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i (from rev 
9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2.i)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i                    
        (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i    2008-08-29 
19:41:00 UTC (rev 9446)
@@ -0,0 +1,102 @@
+/* -*- 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 "usrp2_sink_32fc.h"
+#include "usrp2_source_32fc.h"
+%}
+
+#if 0
+// ----------------------------------------------------------------
+
+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();
+
+};
+#endif
+
+// ----------------------------------------------------------------
+
+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();
+
+};
+
+#if 0
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(usrp2,sink_32fc)
+
+usrp2_sink_32fc_sptr
+usrp2_make_sink_32fc() throw (std::runtime_error);
+
+class usrp2_sink_32fc : public usrp2_sink_base {
+
+protected:
+  usrp2_sink_32fc();
+
+public:
+  ~usrp2_sink_32fc();
+
+};
+#endif
+// ----------------------------------------------------------------
+
+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();
+
+  bool set_gain(double gain);
+  bool set_center_freq(double frequency, tune_result r);
+  bool set_decim(int decimation_factor);
+};

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.cc 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.cc)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.cc         
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.cc 
2008-08-29 19:41:00 UTC (rev 9446)
@@ -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_32fc.h>
+#include <gr_io_signature.h>
+#include <usrp_standard.h>
+#include <usrp_bytesex.h>
+
+usrp2_sink_32fc_sptr
+usrp2_make_sink_32fc() throw (std::runtime_error)
+{
+  return usrp2_sink_32fc_sptr(new usrp2_sink_32fc());
+}
+
+usrp2_sink_32fc::usrp2_sink_32fc() throw (std::runtime_error)
+  : usrp2_sink_base("usrp2_sink_32fc",
+                   gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+}
+
+usrp2_sink_32fc::~usrp2_sink_32fc()
+{
+}

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.h 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.h)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.h          
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_32fc.h  
2008-08-29 19:41:00 UTC (rev 9446)
@@ -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_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() throw (std::runtime_error);
+
+class usrp2_sink_32fc : public usrp2_sink_base {
+private:
+
+  friend usrp2_sink_32fc_sptr
+  usrp2_make_sink_32fc() throw (std::runtime_error);
+
+protected:
+  usrp2_sink_32fc() throw (std::runtime_error);
+
+public:
+  ~usrp2_sink_32fc();
+};
+
+#endif /* INCLUDED_USRP2_SINK_32FC_H */

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.cc 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.cc)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.cc         
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.cc 
2008-08-29 19:41:00 UTC (rev 9446)
@@ -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;
+}

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.h 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.h)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.h          
                (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_sink_base.h  
2008-08-29 19:41:00 UTC (rev 9446)
@@ -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 */

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.cc)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc       
                        (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc       
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,57 @@
+/* -*- 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 <gr_io_signature.h>
+
+usrp2_source_32fc_sptr
+usrp2_make_source_32fc(const std::string &interface,
+                   const std::string &mac_addr) 
+  throw (std::runtime_error)
+{
+  return usrp2_source_32fc_sptr(new usrp2_source_32fc(interface, mac_addr));
+}
+
+usrp2_source_32fc::usrp2_source_32fc(const std::string &interface,
+                              const std::string &mac_addr) 
+  throw (std::runtime_error)
+  : usrp2_source_base("usrp2_source_32fc",
+                     gr_make_io_signature(1, 1, sizeof(gr_complex)),
+                     interface, mac_addr)
+{
+}
+
+usrp2_source_32fc::~usrp2_source_32fc()
+{
+}
+
+int
+usrp2_source_32fc::work(int noutput_items,
+                    gr_vector_const_void_star &input_items,
+                    gr_vector_void_star &output_items)
+{
+  return noutput_items;
+}

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h 
(from rev 9440, gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.h)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h        
                        (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h        
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,55 @@
+/* -*- 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_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);
+
+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="eth0",
+                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 */

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.cc 
(from rev 9440, 
gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.cc)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.cc       
                        (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.cc       
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,68 @@
+/* -*- 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 0
+
+usrp2_source_base::usrp2_source_base(const std::string &name,
+                                    gr_io_signature_sptr output_signature,
+                                    const std::string &interface,
+                                    const std::string &mac) 
+  throw (std::runtime_error)
+  : gr_sync_block(name,
+                 gr_make_io_signature(0, 0, 0),
+                 output_signature),
+    d_u2(usrp2::usrp2::sptr())
+{
+  d_u2 = usrp2::usrp2::make(interface, mac);
+  if (!d_u2)
+    throw std::runtime_error("Unable to initialize USRP2!");
+}
+
+usrp2_source_base::~usrp2_source_base ()
+{
+}
+
+bool
+usrp2_source_base::set_gain(double gain)
+{
+  return d_u2->set_rx_gain(gain);
+}
+
+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);
+}

Copied: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.h 
(from rev 9440, 
gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.h)
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.h        
                        (rev 0)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_base.h        
2008-08-29 19:41:00 UTC (rev 9446)
@@ -0,0 +1,72 @@
+/* -*- 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/usrp2.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::usrp2::sptr d_u2;
+
+public:
+  ~usrp2_source_base();
+
+  /*!
+   * \brief Return USRP2 MAC address
+   */
+  const std::string &mac_addr() const { return d_u2->mac_addr(); }
+
+  /*!
+   * \brief Set receiver gain
+   */
+  bool set_gain(double gain);
+
+  /*!
+   * \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 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_SOURCE_BASE_H */

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/test.sh

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/test_gr_usrp2.cc

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2.i

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.cc

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_base.h

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.cc

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_sink_c.h

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.cc

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_base.h

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.cc

Deleted: gnuradio/branches/features/gr-usrp2/gr-usrp2/usrp2_source_c.h





reply via email to

[Prev in Thread] Current Thread [Next in Thread]