commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11060 - in gnuradio/branches/developers/eb/vrt/gr-vrt


From: eb
Subject: [Commit-gnuradio] r11060 - in gnuradio/branches/developers/eb/vrt/gr-vrt: . src
Date: Tue, 19 May 2009 15:38:40 -0600 (MDT)

Author: eb
Date: 2009-05-19 15:38:39 -0600 (Tue, 19 May 2009)
New Revision: 11060

Added:
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_ctrl_base.h
Modified:
   gnuradio/branches/developers/eb/vrt/gr-vrt/
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.am
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.cc
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.h
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.cc
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.h
Log:
work-in-progress


Property changes on: gnuradio/branches/developers/eb/vrt/gr-vrt
___________________________________________________________________
Modified: svn:ignore
   - Makefile
Makefile.in
gnuradio-usrp2.pc


   + Makefile
Makefile.in
gnuradio-vrt.pc



Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.am  2009-05-19 
19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.am  2009-05-19 
21:38:39 UTC (rev 11060)
@@ -52,13 +52,17 @@
 lib_LTLIBRARIES = libgnuradio-vrt.la
 
 libgnuradio_vrt_la_SOURCES = \
-       rx_16sc_handler.cc \
-       rx_32fc_handler.cc \
        vrt_base.cc \
-       vrt_source_base.cc \
-       vrt_source_16sc.cc \
-       vrt_source_32fc.cc
+       vrt_source_base.cc
 
+#libgnuradio_vrt_la_SOURCES = \
+#      rx_16sc_handler.cc \
+#      rx_32fc_handler.cc \
+#      vrt_base.cc \
+#      vrt_source_base.cc \
+#      vrt_source_16sc.cc \
+#      vrt_source_32fc.cc
+
 #      vrt_sink_base.cc \
 #      vrt_sink_16sc.cc \
 #      vrt_sink_32fc.cc
@@ -69,6 +73,7 @@
 
 grinclude_HEADERS = \
        vrt_base.h \
+       vrt_ctrl_base.h \
        vrt_source_base.h \
        vrt_source_32fc.h \
        vrt_source_16sc.h
@@ -106,7 +111,7 @@
 vrt_la_swig_libadd =           \
        libgnuradio-vrt.la
 
-include $(top_srcdir)/Makefile.swig
+#include $(top_srcdir)/Makefile.swig
 
 # add some of the variables generated inside the Makefile.swig.gen
 BUILT_SOURCES = $(swig_built_sources)

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-05-19 
19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-05-19 
21:38:39 UTC (rev 11060)
@@ -24,322 +24,72 @@
 %import <stdint.i>
 
 %{
-#include "usrp2_source_16sc.h"
-#include "usrp2_source_32fc.h"
-#include "usrp2_sink_16sc.h"
-#include "usrp2_sink_32fc.h"
+#include "vrt_source_16sc.h"
+#include "vrt_source_32fc.h"
+#include "vrt_sink_16sc.h"
+#include "vrt_sink_32fc.h"
 %}
 
-%include <usrp2/tune_result.h>
-%include <usrp2/mimo_config.h>
-
 %template(uint32_t_vector) std::vector<uint32_t>;
 
 // ----------------------------------------------------------------
 
-class usrp2_base : public gr_sync_block 
+class vrt_base : public gr_sync_block 
 {
 protected:
-  usrp2_base() throw (std::runtime_error);
+  vrt_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);
+  ~vrt_base();
 };
 
 // ----------------------------------------------------------------
 
-class usrp2_source_base : public usrp2_base 
+class vrt_source_base : public vrt_base 
 {
 protected:
-  usrp2_source_base() throw (std::runtime_error);
+  vrt_source_base() throw (std::runtime_error);
 
 public:
-  ~usrp2_source_base();
+  ~vrt_source_base();
 
-  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)
+%if 0
+GR_SWIG_BLOCK_MAGIC(vrt,source_32fc)
 
-usrp2_source_32fc_sptr
-usrp2_make_source_32fc(const std::string ifc="eth0", 
+vrt_source_32fc_sptr
+vrt_make_source_32fc(const std::string ifc="eth0", 
                        const std::string mac="") 
   throw (std::runtime_error);
 
-class usrp2_source_32fc : public usrp2_source_base 
+class vrt_source_32fc : public vrt_source_base 
 {
 protected:
-  usrp2_source_32fc(const std::string &ifc, const std::string &mac);
+  vrt_source_32fc(const std::string &ifc, const std::string &mac);
 
 public:
-  ~usrp2_source_32fc();
+  ~vrt_source_32fc();
 };
 
 // ----------------------------------------------------------------
 
-GR_SWIG_BLOCK_MAGIC(usrp2,source_16sc)
+GR_SWIG_BLOCK_MAGIC(vrt,source_16sc)
 
-usrp2_source_16sc_sptr
-usrp2_make_source_16sc(const std::string ifc="eth0", 
+vrt_source_16sc_sptr
+vrt_make_source_16sc(const std::string ifc="eth0", 
                       const std::string mac="") 
   throw (std::runtime_error);
 
-class usrp2_source_16sc : public usrp2_source_base 
+class vrt_source_16sc : public vrt_source_base 
 {
 protected:
-  usrp2_source_16sc(const std::string &ifc, const std::string &mac);
+  vrt_source_16sc(const std::string &ifc, const std::string &mac);
 
 public:
-  ~usrp2_source_16sc();
+  ~vrt_source_16sc();
 };
+%endif
 
-// ----------------------------------------------------------------
-
-class usrp2_sink_base : public usrp2_base 
-{
-protected:
-  usrp2_sink_base() throw (std::runtime_error);
-
-public:
-  ~usrp2_sink_base();
-
-  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);
-};
-
-// ----------------------------------------------------------------
-
-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);
-
-// 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
-
-%}

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.cc  2009-05-19 
19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.cc  2009-05-19 
21:38:39 UTC (rev 11060)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -25,88 +25,33 @@
 #endif
 
 #include <vrt_base.h>
-#include <gr_io_signature.h>
 #include <iostream>
 
 vrt_base::vrt_base(const char *name,
-                      gr_io_signature_sptr input_signature,
-                      gr_io_signature_sptr output_signature,
-                      const std::string &ifc,
-                      const std::string &mac) 
+                  gr_io_signature_sptr input_signature,
+                  gr_io_signature_sptr output_signature,
+                  vrt_ctrl_base::sptr ctrl)
   throw (std::runtime_error)
   : gr_sync_block(name,
                  input_signature,
                  output_signature),
-    d_u2(vrt::vrt::sptr())
+    d_ctrl(ctrl)
 {
-  d_u2 = vrt::vrt::make(ifc, mac);
-  if (!d_u2)
-    throw std::runtime_error("Unable to initialize USRP2!");
 }
 
-vrt_base::~vrt_base ()
+vrt_base::~vrt_base()
 {
   // NOP
 }
 
-std::string
-vrt_base::mac_addr() const
-{
-  return d_u2->mac_addr();
-}
-
-std::string
-vrt_base::interface_name() const
-{
-  return d_u2->interface_name();
-}
-
 bool
-vrt_base::fpga_master_clock_freq(long *freq) const
-{
-  return d_u2->fpga_master_clock_freq(freq);
-}
-
-bool
-vrt_base::config_mimo(int flags)
-{
-  return d_u2->config_mimo(flags);
-}
-
-bool
-vrt_base::sync_to_pps()
-{
-  return d_u2->sync_to_pps();
-}
-
-bool
-vrt_base::sync_every_pps(bool enable)
-{
-  return d_u2->sync_every_pps(enable);
-}
-
-std::vector<uint32_t>
-vrt_base::peek32(uint32_t addr, uint32_t words)
-{
-  return d_u2->peek32(addr, words);
-}
-
-bool
-vrt_base::poke32(uint32_t addr, const std::vector<uint32_t> &data)
-{
-  return d_u2->poke32(addr, data);
-}
-
-bool
 vrt_base::start()
 {
-  // Default implementation is NOP
-  return true;
+  return d_ctrl->start();
 }
 
 bool
 vrt_base::stop()
 {
-  // Default implementation is NOP
-  return true;
+  return d_ctrl->stop();
 }

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.h   2009-05-19 
19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_base.h   2009-05-19 
21:38:39 UTC (rev 11060)
@@ -24,12 +24,9 @@
 #define INCLUDED_USRP2_BASE_H
 
 #include <gr_sync_block.h>
-#include <vrt/vrt.h>
+#include <vrt_ctrl_base.h>
 #include <stdexcept>
 
-// BIG ASS FIXME: get from lower layer MTU calculation
-#define USRP2_MIN_RX_SAMPLES 371
-
 /*!
  * Base class for all USRP2 blocks
  */
@@ -37,58 +34,17 @@
 {
 protected:
   vrt_base(const char *name,
-            gr_io_signature_sptr input_signature,
-            gr_io_signature_sptr output_signature,
-            const std::string &ifc,
-            const std::string &mac)
+          gr_io_signature_sptr input_signature,
+          gr_io_signature_sptr output_signature,
+          vrt_ctrl_base::sptr ctrl)
     throw (std::runtime_error);
 
-  vrt::vrt::sptr d_u2;
+  vrt_ctrl_base::sptr  d_ctrl;
 
 public:
   ~vrt_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();
@@ -98,12 +54,6 @@
    */
   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 */

Added: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_ctrl_base.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_ctrl_base.h              
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_ctrl_base.h      
2009-05-19 21:38:39 UTC (rev 11060)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_CTRL_BASE_H
+#define INCLUDED_VRT_CTRL_BASE_H
+
+#include <boost/shared_ptr.hpp>
+
+/*!
+ * \brief Minimal abstract control interface that GR requires
+ */
+class vrt_ctrl_base
+{
+public:
+  typedef boost::shared_ptr<vrt_ctrl_base> sptr;
+
+  virtual ~vrt_ctrl_base() = 0;
+
+  /*!
+   * \brief Called by scheduler when starting flowgraph
+   */
+  virtual bool start() = 0;
+
+  /*!
+   * \brief Called by scheduler when stopping flowgraph
+   */
+  virtual bool stop() = 0;
+
+};
+
+#endif /* INCLUDED_VRT_CTRL_BASE_H */
+ 


Property changes on: 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_ctrl_base.h
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.cc   
2009-05-19 19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.cc   
2009-05-19 21:38:39 UTC (rev 11060)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -29,151 +29,19 @@
 #include <iostream>
 
 vrt_source_base::vrt_source_base(const char *name,
-                                    gr_io_signature_sptr output_signature,
-                                    const std::string &ifc,
-                                    const std::string &mac) 
-  throw (std::runtime_error)
+                                gr_io_signature_sptr output_signature,
+                                vrt_ctrl_base::sptr ctrl,
+                                int data_socket_fd,
+                                size_t rx_bufsize
+                                ) throw (std::runtime_error)
   : vrt_base(name,
-               gr_make_io_signature(0, 0, 0),
-              output_signature,
-              ifc, mac)
+            gr_make_io_signature(0, 0, 0),
+            output_signature,
+            ctrl),
+    d_rx(vrt::rx::make(data_socket_fd, rx_bufsize))
 {
-  // NOP
 }
 
-vrt_source_base::~vrt_source_base ()
+vrt_source_base::~vrt_source_base()
 {
-  // NOP
 }
-
-bool
-vrt_source_base::set_gain(double gain)
-{
-  return d_u2->set_rx_gain(gain);
-}
-
-bool
-vrt_source_base::set_lo_offset(double frequency)
-{
-  return d_u2->set_rx_lo_offset(frequency);
-}
-
-bool
-vrt_source_base::set_center_freq(double frequency, vrt::tune_result *tr)
-{
-  return d_u2->set_rx_center_freq(frequency, tr);
-}
-
-bool
-vrt_source_base::set_decim(int decimation_factor)
-{
-  return d_u2->set_rx_decim(decimation_factor);
-}
-
-bool 
-vrt_source_base::set_scale_iq(int scale_i, int scale_q)
-{
-  return d_u2->set_rx_scale_iq(scale_i, scale_q);
-}
-
-int
-vrt_source_base::decim()
-{
-  return d_u2->rx_decim();
-}
-
-bool
-vrt_source_base::adc_rate(long *rate)
-{
-  return d_u2->adc_rate(rate);
-}
-
-double
-vrt_source_base::gain_min()
-{
-  return d_u2->rx_gain_min();
-}
-
-double
-vrt_source_base::gain_max()
-{
-  return d_u2->rx_gain_max();
-}
-
-double
-vrt_source_base::gain_db_per_step()
-{
-  return d_u2->rx_gain_db_per_step();
-}
-  
-double
-vrt_source_base::freq_min()
-{
-  return d_u2->rx_freq_min();
-}
-
-double
-vrt_source_base::freq_max()
-{
-  return d_u2->rx_freq_max();
-}
-
-bool
-vrt_source_base::daughterboard_id(int *dbid)
-{
-  return d_u2->rx_daughterboard_id(dbid);
-}
-
-unsigned int
-vrt_source_base::overruns()
-{
-  return d_u2->rx_overruns();
-}
-
-unsigned int
-vrt_source_base::missing()
-{
-  return d_u2->rx_missing();
-}
-
-bool
-vrt_source_base::start()
-{
-  return d_u2->start_rx_streaming(0); // FIXME: someday sources will have 
channel #s
-}
-
-bool
-vrt_source_base::stop()
-{
-  return d_u2->stop_rx_streaming(0); // FIXME: someday sources will have 
channel #s
-}
-
-bool
-vrt_source_base::set_gpio_ddr(uint16_t value, uint16_t mask)
-{
-  return d_u2->set_gpio_ddr(vrt::GPIO_RX_BANK, value, mask);
-}
-
-bool
-vrt_source_base::set_gpio_sels(std::string sels)
-{
-  return d_u2->set_gpio_sels(vrt::GPIO_RX_BANK, sels);
-}
-
-bool
-vrt_source_base::write_gpio(uint16_t value, uint16_t mask)
-{
-  return d_u2->write_gpio(vrt::GPIO_RX_BANK, value, mask);
-}
-
-bool
-vrt_source_base::read_gpio(uint16_t *value)
-{
-  return d_u2->read_gpio(vrt::GPIO_RX_BANK, value);
-}
-
-bool
-vrt_source_base::enable_gpio_streaming(int enable)
-{
-  return d_u2->enable_gpio_streaming(vrt::GPIO_RX_BANK, enable);
-}

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.h    
2009-05-19 19:51:09 UTC (rev 11059)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.h    
2009-05-19 21:38:39 UTC (rev 11060)
@@ -20,140 +20,30 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef INCLUDED_USRP2_SOURCE_BASE_H
-#define INCLUDED_USRP2_SOURCE_BASE_H
+#ifndef INCLUDED_VRT_SOURCE_BASE_H
+#define INCLUDED_VRT_SOURCE_BASE_H
 
 #include <vrt_base.h>
+#include <vrt/rx.h>
 
 /*!
- * Base class for all USRP2 source blocks
+ * Base class for all VRT source blocks
  */
-class vrt_source_base : public vrt_base 
+class vrt_source_base : public vrt_base
 {
 protected:
   vrt_source_base(const char *name,
-                   gr_io_signature_sptr output_signature,
-                   const std::string &ifc,
-                   const std::string &mac)
+                 gr_io_signature_sptr output_signature,
+                 vrt_ctrl_base::sptr ctrl,
+                 int data_socket_fd,
+                 size_t rx_bufsize = 0)
     throw (std::runtime_error);
 
+  vrt::rx::sptr        d_rx;
+
 public:
   ~vrt_source_base();
 
-  /*!
-   * \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, vrt::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 */
+#endif /* INCLUDED_VRT_SOURCE_BASE_H */





reply via email to

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