From 4ac5545625d3d6df9881695f764c9c94049edb7b Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Mon, 18 Oct 2010 12:18:13 -0700
Subject: uhd: added multi usrp skeleton and added deprecation note to other
 headers

---
 gr-uhd/lib/uhd_multi_usrp_sink.cc | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 gr-uhd/lib/uhd_multi_usrp_sink.cc

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
new file mode 100644
index 0000000000..6854649c34
--- /dev/null
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -0,0 +1,24 @@
+/*
+ * 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <uhd_multi_usrp_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
-- 
cgit v1.2.3


From 873228d25b3ea5df8eb10f6652518f144858af61 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Mon, 18 Oct 2010 13:46:51 -0700
Subject: uhd: filled in multi usrp code and swig file

---
 gr-uhd/lib/uhd_multi_usrp_sink.cc    | 151 ++++++++++++++++++++++++++++++++++
 gr-uhd/lib/uhd_multi_usrp_sink.h     |   6 ++
 gr-uhd/lib/uhd_multi_usrp_source.cc  | 154 +++++++++++++++++++++++++++++++++++
 gr-uhd/lib/uhd_multi_usrp_source.h   |   6 ++
 gr-uhd/lib/uhd_single_usrp_sink.cc   |  10 +--
 gr-uhd/lib/uhd_single_usrp_source.cc |   6 +-
 gr-uhd/swig/uhd_swig.i               |  33 +++++---
 7 files changed, 344 insertions(+), 22 deletions(-)

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index 6854649c34..202f128406 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -22,3 +22,154 @@
 #include <uhd_multi_usrp_sink.h>
 #include <gr_io_signature.h>
 #include <stdexcept>
+
+/***********************************************************************
+ * UHD Multi USRP Sink
+ **********************************************************************/
+uhd_multi_usrp_sink::uhd_multi_usrp_sink(gr_io_signature_sptr sig)
+:gr_sync_block("uhd multi usrp sink", sig, gr_make_io_signature(0, 0, 0)){
+    /* NOP */
+}
+
+/***********************************************************************
+ * UHD Multi USRP Sink Impl
+ **********************************************************************/
+class uhd_multi_usrp_sink_impl : public uhd_multi_usrp_sink{
+public:
+    uhd_multi_usrp_sink_impl(
+        const std::string &args,
+        const uhd::io_type_t &type,
+        size_t num_channels
+    ) : uhd_multi_usrp_sink(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type), _nchan(num_channels)
+    {
+        _dev = uhd::usrp::multi_usrp::make(args);
+    }
+
+    void set_subdev_spec(const std::string &spec, size_t mboard){
+        return _dev->set_tx_subdev_spec(spec, mboard);
+    }
+
+    void set_samp_rate(double rate){
+        _dev->set_tx_rate(rate);
+    }
+
+    double get_samp_rate(void){
+        return _dev->get_tx_rate();
+    }
+
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        uhd::tune_result_t tr = _dev->set_tx_freq(freq, chan);
+        return tr;
+    }
+
+    uhd::freq_range_t get_freq_range(size_t chan){
+        return _dev->get_tx_freq_range(chan);
+    }
+
+    void set_gain(float gain, size_t chan){
+        return _dev->set_tx_gain(gain, chan);
+    }
+
+    float get_gain(size_t chan){
+        return _dev->get_tx_gain(chan);
+    }
+
+    uhd::gain_range_t get_gain_range(size_t chan){
+        return _dev->get_tx_gain_range(chan);
+    }
+
+    void set_antenna(const std::string &ant, size_t chan){
+        return _dev->set_tx_antenna(ant, chan);
+    }
+
+    std::string get_antenna(size_t chan){
+        return _dev->get_tx_antenna(chan);
+    }
+
+    std::vector<std::string> get_antennas(size_t chan){
+        return _dev->get_tx_antennas(chan);
+    }
+
+    void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
+        return _dev->set_clock_config(clock_config, mboard);
+    }
+
+    uhd::time_spec_t get_time_now(void){
+        return _dev->get_time_now();
+    }
+
+    void set_time_next_pps(const uhd::time_spec_t &time_spec){
+        return _dev->set_time_next_pps(time_spec);
+    }
+
+    void set_time_unknown_pps(const uhd::time_spec_t &time_spec){
+        return _dev->set_time_unknown_pps(time_spec);
+    }
+
+    uhd::usrp::multi_usrp::sptr get_device(void){
+        return _dev;
+    }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+    int work(
+        int noutput_items,
+        gr_vector_const_void_star &input_items,
+        gr_vector_void_star &output_items
+    ){
+        uhd::tx_metadata_t metadata;
+        metadata.start_of_burst = true;
+
+        return _dev->get_device()->send(
+            input_items, noutput_items, metadata,
+            _type, uhd::device::SEND_MODE_FULL_BUFF
+        );
+    }
+
+    //Send an empty start-of-burst packet to begin streaming.
+    //Set at a time in the near future so data will be sync'd.
+    bool start(void){
+        uhd::tx_metadata_t metadata;
+        metadata.start_of_burst = true;
+        metadata.has_time_spec = true;
+        metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); //10ms offset in future
+
+        _dev->get_device()->send(
+            gr_vector_const_void_star(_nchan), 0, metadata,
+            _type, uhd::device::SEND_MODE_ONE_PACKET
+        );
+        return true;
+    }
+
+    //Send an empty end-of-burst packet to end streaming.
+    //Ending the burst avoids an underflow error on stop.
+    bool stop(void){
+        uhd::tx_metadata_t metadata;
+        metadata.end_of_burst = true;
+
+        _dev->get_device()->send(
+            gr_vector_const_void_star(_nchan), 0, metadata,
+            _type, uhd::device::SEND_MODE_ONE_PACKET
+        );
+        return true;
+    }
+
+protected:
+    uhd::usrp::multi_usrp::sptr _dev;
+    const uhd::io_type_t _type;
+    size_t _nchan;
+};
+
+/***********************************************************************
+ * Make UHD Multi USRP Sink
+ **********************************************************************/
+boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
+    const std::string &args,
+    const uhd::io_type_t::tid_t &type,
+    size_t num_channels
+){
+    return boost::shared_ptr<uhd_multi_usrp_sink>(
+        new uhd_multi_usrp_sink_impl(args, type, num_channels)
+    );
+}
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
index b29657e941..13bba20fb6 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.h
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -128,6 +128,12 @@ public:
      */
     virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
 
+    /*!
+     * Sync the time registers with an unknown pps edge.
+     * \param time_spec the new time
+     */
+    virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0;
+
     /*!
      * Get access to the underlying uhd device object.
      * \return the multi usrp device object
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index 27caffbfc8..c10c08c500 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -22,3 +22,157 @@
 #include <uhd_multi_usrp_source.h>
 #include <gr_io_signature.h>
 #include <stdexcept>
+#include <iostream>
+#include <boost/format.hpp>
+
+/***********************************************************************
+ * UHD Multi USRP Source
+ **********************************************************************/
+uhd_multi_usrp_source::uhd_multi_usrp_source(gr_io_signature_sptr sig)
+:gr_sync_block("uhd multi_usrp source", gr_make_io_signature(0, 0, 0), sig){
+    /* NOP */
+}
+
+/***********************************************************************
+ * UHD Multi USRP Source Impl
+ **********************************************************************/
+class uhd_multi_usrp_source_impl : public uhd_multi_usrp_source{
+public:
+    uhd_multi_usrp_source_impl(
+        const std::string &args,
+        const uhd::io_type_t &type,
+        size_t num_channels
+    ) : uhd_multi_usrp_source(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type)
+    {
+        _dev = uhd::usrp::multi_usrp::make(args);
+    }
+
+    void set_subdev_spec(const std::string &spec, size_t mboard){
+        return _dev->set_rx_subdev_spec(spec, mboard);
+    }
+
+    void set_samp_rate(double rate){
+        _dev->set_rx_rate(rate);
+    }
+
+    double get_samp_rate(void){
+        return _dev->get_rx_rate();
+    }
+
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        uhd::tune_result_t tr = _dev->set_rx_freq(freq, chan);
+        return tr;
+    }
+
+    uhd::freq_range_t get_freq_range(size_t chan){
+        return _dev->get_rx_freq_range(chan);
+    }
+
+    void set_gain(float gain, size_t chan){
+        return _dev->set_rx_gain(gain, chan);
+    }
+
+    float get_gain(size_t chan){
+        return _dev->get_rx_gain(chan);
+    }
+
+    uhd::gain_range_t get_gain_range(size_t chan){
+        return _dev->get_rx_gain_range(chan);
+    }
+
+    void set_antenna(const std::string &ant, size_t chan){
+        return _dev->set_rx_antenna(ant, chan);
+    }
+
+    std::string get_antenna(size_t chan){
+        return _dev->get_rx_antenna(chan);
+    }
+
+    std::vector<std::string> get_antennas(size_t chan){
+        return _dev->get_rx_antennas(chan);
+    }
+
+    void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
+        return _dev->set_clock_config(clock_config, mboard);
+    }
+
+    uhd::time_spec_t get_time_now(void){
+        return _dev->get_time_now();
+    }
+
+    void set_time_next_pps(const uhd::time_spec_t &time_spec){
+        return _dev->set_time_next_pps(time_spec);
+    }
+
+    void set_time_unknown_pps(const uhd::time_spec_t &time_spec){
+        return _dev->set_time_unknown_pps(time_spec);
+    }
+
+    uhd::usrp::multi_usrp::sptr get_device(void){
+        return _dev;
+    }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+    int work(
+        int noutput_items,
+        gr_vector_const_void_star &input_items,
+        gr_vector_void_star &output_items
+    ){
+        uhd::rx_metadata_t metadata; //not passed out of this block
+
+        size_t num_samps = _dev->get_device()->recv(
+            output_items, noutput_items, metadata,
+            _type, uhd::device::RECV_MODE_FULL_BUFF
+        );
+
+        switch(metadata.error_code){
+        case uhd::rx_metadata_t::ERROR_CODE_NONE:
+            return num_samps;
+
+        case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
+            //ignore overflows and try work again
+            return work(noutput_items, input_items, output_items);
+
+        default:
+            std::cout << boost::format(
+                "UHD source block got error code 0x%x"
+            ) % metadata.error_code << std::endl;
+            return num_samps;
+        }
+    }
+
+    bool start(void){
+        //setup a stream command that starts streaming slightly in the future
+        static const double reasonable_delay = 0.01; //10 ms (order of magnitude >> RTT)
+        uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+        stream_cmd.stream_now = false;
+        stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(_dev->get_num_mboards() * reasonable_delay);
+        _dev->issue_stream_cmd(stream_cmd);
+        return true;
+    }
+
+    bool stop(void){
+        _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+        return true;
+    }
+
+private:
+    uhd::usrp::multi_usrp::sptr _dev;
+    const uhd::io_type_t _type;
+};
+
+
+/***********************************************************************
+ * Make UHD Multi USRP Source
+ **********************************************************************/
+boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
+    const std::string &args,
+    const uhd::io_type_t::tid_t &type,
+    size_t num_channels
+){
+    return boost::shared_ptr<uhd_multi_usrp_source>(
+        new uhd_multi_usrp_source_impl(args, type, num_channels)
+    );
+}
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
index b2c4a3ac17..b94e53f01b 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.h
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -128,6 +128,12 @@ public:
      */
     virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
 
+    /*!
+     * Sync the time registers with an unknown pps edge.
+     * \param time_spec the new time
+     */
+    virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0;
+
     /*!
      * Get access to the underlying uhd device object.
      * \return the multi usrp device object
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
index cd7d7a6188..96c1dbdf49 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -24,7 +24,7 @@
 #include <stdexcept>
 
 /***********************************************************************
- * UHD Single USPR Sink
+ * UHD Single USRP Sink
  **********************************************************************/
 uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig)
 :gr_sync_block("uhd single usrp sink", sig, gr_make_io_signature(0, 0, 0)){
@@ -32,7 +32,7 @@ uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig)
 }
 
 /***********************************************************************
- * UHD Single USPR Sink Impl
+ * UHD Single USRP Sink Impl
  **********************************************************************/
 class uhd_single_usrp_sink_impl : public uhd_single_usrp_sink{
 public:
@@ -45,10 +45,6 @@ public:
         _dev = uhd::usrp::single_usrp::make(args);
     }
 
-    ~uhd_single_usrp_sink_impl(void){
-        //NOP
-    }
-
     void set_subdev_spec(const std::string &spec){
         return _dev->set_tx_subdev_spec(spec);
     }
@@ -164,7 +160,7 @@ protected:
 };
 
 /***********************************************************************
- * Make UHD Single USPR Sink
+ * Make UHD Single USRP Sink
  **********************************************************************/
 boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
     const std::string &args,
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
index fc2c453eb3..7c3694a99d 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.cc
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -26,7 +26,7 @@
 #include <boost/format.hpp>
 
 /***********************************************************************
- * UHD Single USPR Source
+ * UHD Single USRP Source
  **********************************************************************/
 uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig)
 :gr_sync_block("uhd single_usrp source", gr_make_io_signature(0, 0, 0), sig){
@@ -34,7 +34,7 @@ uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig)
 }
 
 /***********************************************************************
- * UHD Single USPR Source Impl
+ * UHD Single USRP Source Impl
  **********************************************************************/
 class uhd_single_usrp_source_impl : public uhd_single_usrp_source{
 public:
@@ -160,7 +160,7 @@ private:
 
 
 /***********************************************************************
- * Make UHD Single USPR Source
+ * Make UHD Single USRP Source
  **********************************************************************/
 boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
     const std::string &args,
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index d755dfeee6..1631a768a7 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -29,10 +29,13 @@ namespace std {
 }
 
 %{
-#include <uhd_mimo_source.h>
-#include <uhd_mimo_sink.h>
-#include <uhd_simple_source.h>
-#include <uhd_simple_sink.h>
+#include <uhd_mimo_source.h> //deprecated
+#include <uhd_mimo_sink.h> //deprecated
+#include <uhd_simple_source.h> //deprecated
+#include <uhd_simple_sink.h> //deprecated
+
+#include <uhd_multi_usrp_source.h>
+#include <uhd_multi_usrp_sink.h>
 #include <uhd_single_usrp_source.h>
 #include <uhd_single_usrp_sink.h>
 %}
@@ -44,17 +47,23 @@ namespace std {
 %include <uhd/types/time_spec.hpp>
 %include <uhd/types/clock_config.hpp>
 
-GR_SWIG_BLOCK_MAGIC(uhd,mimo_source)
-%include <uhd_mimo_source.h>
+GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) //deprecated
+%include <uhd_mimo_source.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) //deprecated
+%include <uhd_mimo_sink.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,simple_source) //deprecated
+%include <uhd_simple_source.h> //deprecated
 
-GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink)
-%include <uhd_mimo_sink.h>
+GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) //deprecated
+%include <uhd_simple_sink.h> //deprecated
 
-GR_SWIG_BLOCK_MAGIC(uhd,simple_source)
-%include <uhd_simple_source.h>
+GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source)
+%include <uhd_multi_usrp_source.h>
 
-GR_SWIG_BLOCK_MAGIC(uhd,simple_sink)
-%include <uhd_simple_sink.h>
+GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_sink)
+%include <uhd_multi_usrp_sink.h>
 
 GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source)
 %include <uhd_single_usrp_source.h>
-- 
cgit v1.2.3


From 7f46efca9cb0c87e9130c117ac41650f6e0c25cc Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Mon, 18 Oct 2010 16:49:08 -0700
Subject: uhd: renamed make function params, cleanup, clock config for multi
 usrp

---
 gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py  | 11 ++++++++++-
 gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py |  6 +++++-
 gr-uhd/lib/uhd_multi_usrp_sink.cc            | 19 ++++++++++++-------
 gr-uhd/lib/uhd_multi_usrp_sink.h             |  4 ++--
 gr-uhd/lib/uhd_multi_usrp_source.cc          | 18 +++++++++++-------
 gr-uhd/lib/uhd_multi_usrp_source.h           |  4 ++--
 gr-uhd/lib/uhd_single_usrp_sink.cc           | 19 ++++++++++++-------
 gr-uhd/lib/uhd_single_usrp_sink.h            |  4 ++--
 gr-uhd/lib/uhd_single_usrp_source.cc         | 18 +++++++++++-------
 gr-uhd/lib/uhd_single_usrp_source.h          |  4 ++--
 10 files changed, 69 insertions(+), 38 deletions(-)

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index 8de4408d5a..aa550157d2 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -25,8 +25,17 @@ MAIN_TMPL = """\
 	<name>UHD: Multi USRP $sourk.title()</name>
 	<key>uhd_multi_usrp_$(sourk)</key>
 	<import>from gnuradio import uhd</import>
-	<make>uhd.multi_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan)
+	<make>uhd.multi_usrp_$(sourk)(
+	device_addr=\$dev_addr,
+	io_type=uhd.io_type_t.\$type.type,
+	num_channels=\$nchan,
+)
 \#if \$sync()
+clk_cfg = uhd.clock_config_t()
+clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(clk_cfg, ~0);
 self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
 \#end if
 #for $m in range($max_mboards)
diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
index 5b87719e5e..4d645afe15 100755
--- a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
@@ -25,7 +25,11 @@ MAIN_TMPL = """\
 	<name>UHD: Single USRP $sourk.title()</name>
 	<key>uhd_single_usrp_$(sourk)</key>
 	<import>from gnuradio import uhd</import>
-	<make>uhd.single_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan)
+	<make>uhd.single_usrp_$(sourk)(
+	device_addr=\$dev_addr,
+	io_type=uhd.io_type_t.\$type.type,
+	num_channels\$nchan,
+)
 self.\$(id).set_subdev_spec(\$sd_spec)
 self.\$(id).set_samp_rate(\$samp_rate)
 #for $n in range($max_nchan)
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index 202f128406..31dbac44f4 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -37,12 +37,17 @@ uhd_multi_usrp_sink::uhd_multi_usrp_sink(gr_io_signature_sptr sig)
 class uhd_multi_usrp_sink_impl : public uhd_multi_usrp_sink{
 public:
     uhd_multi_usrp_sink_impl(
-        const std::string &args,
-        const uhd::io_type_t &type,
+        const std::string &device_addr,
+        const uhd::io_type_t &io_type,
         size_t num_channels
-    ) : uhd_multi_usrp_sink(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type), _nchan(num_channels)
+    ):
+        uhd_multi_usrp_sink(gr_make_io_signature(
+            num_channels, num_channels, io_type.size
+        )),
+        _type(io_type),
+        _nchan(num_channels)
     {
-        _dev = uhd::usrp::multi_usrp::make(args);
+        _dev = uhd::usrp::multi_usrp::make(device_addr);
     }
 
     void set_subdev_spec(const std::string &spec, size_t mboard){
@@ -165,11 +170,11 @@ protected:
  * Make UHD Multi USRP Sink
  **********************************************************************/
 boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 ){
     return boost::shared_ptr<uhd_multi_usrp_sink>(
-        new uhd_multi_usrp_sink_impl(args, type, num_channels)
+        new uhd_multi_usrp_sink_impl(device_addr, io_type, num_channels)
     );
 }
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
index 13bba20fb6..5dacc1fac7 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.h
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -28,8 +28,8 @@
 class uhd_multi_usrp_sink;
 
 boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 );
 
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index c10c08c500..1fcb576501 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -39,12 +39,16 @@ uhd_multi_usrp_source::uhd_multi_usrp_source(gr_io_signature_sptr sig)
 class uhd_multi_usrp_source_impl : public uhd_multi_usrp_source{
 public:
     uhd_multi_usrp_source_impl(
-        const std::string &args,
-        const uhd::io_type_t &type,
+        const std::string &device_addr,
+        const uhd::io_type_t &io_type,
         size_t num_channels
-    ) : uhd_multi_usrp_source(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type)
+    ):
+        uhd_multi_usrp_source(gr_make_io_signature(
+            num_channels, num_channels, io_type.size
+        )),
+        _type(io_type)
     {
-        _dev = uhd::usrp::multi_usrp::make(args);
+        _dev = uhd::usrp::multi_usrp::make(device_addr);
     }
 
     void set_subdev_spec(const std::string &spec, size_t mboard){
@@ -168,11 +172,11 @@ private:
  * Make UHD Multi USRP Source
  **********************************************************************/
 boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 ){
     return boost::shared_ptr<uhd_multi_usrp_source>(
-        new uhd_multi_usrp_source_impl(args, type, num_channels)
+        new uhd_multi_usrp_source_impl(device_addr, io_type, num_channels)
     );
 }
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
index b94e53f01b..36c4b6fdcc 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.h
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -28,8 +28,8 @@
 class uhd_multi_usrp_source;
 
 boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 );
 
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
index 96c1dbdf49..4297a83ffa 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -37,12 +37,17 @@ uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig)
 class uhd_single_usrp_sink_impl : public uhd_single_usrp_sink{
 public:
     uhd_single_usrp_sink_impl(
-        const std::string &args,
-        const uhd::io_type_t &type,
+        const std::string &device_addr,
+        const uhd::io_type_t &io_type,
         size_t num_channels
-    ) : uhd_single_usrp_sink(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type), _nchan(num_channels)
+    ):
+        uhd_single_usrp_sink(gr_make_io_signature(
+            num_channels, num_channels, io_type.size
+        )),
+        _type(io_type),
+        _nchan(num_channels)
     {
-        _dev = uhd::usrp::single_usrp::make(args);
+        _dev = uhd::usrp::single_usrp::make(device_addr);
     }
 
     void set_subdev_spec(const std::string &spec){
@@ -163,11 +168,11 @@ protected:
  * Make UHD Single USRP Sink
  **********************************************************************/
 boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 ){
     return boost::shared_ptr<uhd_single_usrp_sink>(
-        new uhd_single_usrp_sink_impl(args, type, num_channels)
+        new uhd_single_usrp_sink_impl(device_addr, io_type, num_channels)
     );
 }
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h
index bec788193b..e83bb6ded8 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.h
+++ b/gr-uhd/lib/uhd_single_usrp_sink.h
@@ -28,8 +28,8 @@
 class uhd_single_usrp_sink;
 
 boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels = 1
 );
 
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
index 7c3694a99d..27a788d960 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.cc
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -39,12 +39,16 @@ uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig)
 class uhd_single_usrp_source_impl : public uhd_single_usrp_source{
 public:
     uhd_single_usrp_source_impl(
-        const std::string &args,
-        const uhd::io_type_t &type,
+        const std::string &device_addr,
+        const uhd::io_type_t &io_type,
         size_t num_channels
-    ) : uhd_single_usrp_source(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type)
+    ):
+        uhd_single_usrp_source(gr_make_io_signature(
+            num_channels, num_channels, io_type.size
+        )),
+        _type(io_type)
     {
-        _dev = uhd::usrp::single_usrp::make(args);
+        _dev = uhd::usrp::single_usrp::make(device_addr);
     }
 
     void set_subdev_spec(const std::string &spec){
@@ -163,11 +167,11 @@ private:
  * Make UHD Single USRP Source
  **********************************************************************/
 boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels
 ){
     return boost::shared_ptr<uhd_single_usrp_source>(
-        new uhd_single_usrp_source_impl(args, type, num_channels)
+        new uhd_single_usrp_source_impl(device_addr, io_type, num_channels)
     );
 }
diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
index 196b7c6759..c323fbd7ed 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.h
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -28,8 +28,8 @@
 class uhd_single_usrp_source;
 
 boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
-    const std::string &args,
-    const uhd::io_type_t::tid_t &type,
+    const std::string &device_addr,
+    const uhd::io_type_t::tid_t &io_type,
     size_t num_channels = 1
 );
 
-- 
cgit v1.2.3


From f8c63c369e0e8800f76d427434424f7209fcde86 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Tue, 19 Oct 2010 13:04:42 -0700
Subject: uhd: tweaking timeouts for multi usrp blocks

---
 gr-uhd/lib/uhd_multi_usrp_sink.cc   | 11 +++++++----
 gr-uhd/lib/uhd_multi_usrp_source.cc |  4 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index 31dbac44f4..17cd1ad78e 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -128,7 +128,7 @@ public:
 
         return _dev->get_device()->send(
             input_items, noutput_items, metadata,
-            _type, uhd::device::SEND_MODE_FULL_BUFF
+            _type, uhd::device::SEND_MODE_FULL_BUFF, 1.0
         );
     }
 
@@ -138,11 +138,14 @@ public:
         uhd::tx_metadata_t metadata;
         metadata.start_of_burst = true;
         metadata.has_time_spec = true;
-        metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); //10ms offset in future
+        //TODO: Time in the near future, must be less than source time in future
+        //because ethernet pause frames with throttle stream commands.
+        //It will be fixed with the invention of host-based flow control.
+        metadata.time_spec = get_time_now() + uhd::time_spec_t(0.05);
 
         _dev->get_device()->send(
             gr_vector_const_void_star(_nchan), 0, metadata,
-            _type, uhd::device::SEND_MODE_ONE_PACKET
+            _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
         );
         return true;
     }
@@ -155,7 +158,7 @@ public:
 
         _dev->get_device()->send(
             gr_vector_const_void_star(_nchan), 0, metadata,
-            _type, uhd::device::SEND_MODE_ONE_PACKET
+            _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
         );
         return true;
     }
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index 0ac686c795..63dad1a25e 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -128,7 +128,7 @@ public:
 
         size_t num_samps = _dev->get_device()->recv(
             output_items, noutput_items, metadata,
-            _type, uhd::device::RECV_MODE_FULL_BUFF
+            _type, uhd::device::RECV_MODE_FULL_BUFF, 1.0
         );
 
         switch(metadata.error_code){
@@ -149,7 +149,7 @@ public:
 
     bool start(void){
         //setup a stream command that starts streaming slightly in the future
-        static const double reasonable_delay = 0.05; //order of magnitude over RTT
+        static const double reasonable_delay = 0.1; //order of magnitude over RTT
         uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
         stream_cmd.stream_now = false;
         stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay);
-- 
cgit v1.2.3


From f13e1e1a87cf3d8b891e94226be047cff3733bb7 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Tue, 19 Oct 2010 15:46:27 -0700
Subject: uhd: implement set bandwidth for uhd blocks, remove chan=0 default
 for multi blocks

---
 gr-uhd/lib/uhd_multi_usrp_sink.cc    |  4 ++++
 gr-uhd/lib/uhd_multi_usrp_sink.h     | 22 ++++++++++++++--------
 gr-uhd/lib/uhd_multi_usrp_source.cc  |  4 ++++
 gr-uhd/lib/uhd_multi_usrp_source.h   | 22 ++++++++++++++--------
 gr-uhd/lib/uhd_single_usrp_sink.cc   |  4 ++++
 gr-uhd/lib/uhd_single_usrp_sink.h    |  6 ++++++
 gr-uhd/lib/uhd_single_usrp_source.cc |  4 ++++
 gr-uhd/lib/uhd_single_usrp_source.h  |  6 ++++++
 8 files changed, 56 insertions(+), 16 deletions(-)

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index 17cd1ad78e..b75a8303cb 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -95,6 +95,10 @@ public:
         return _dev->get_tx_antennas(chan);
     }
 
+    void set_bandwidth(double bandwidth, size_t chan){
+        return _dev->set_tx_bandwidth(bandwidth, chan);
+    }
+
     void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
         return _dev->set_clock_config(clock_config, mboard);
     }
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
index 5dacc1fac7..0ccc0fe6c5 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.h
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -66,49 +66,55 @@ public:
      * \param freq the desired frequency in Hz
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan = 0) = 0;
+    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan) = 0;
 
     /*!
      * Get the tunable frequency range.
      * \return the frequency range in Hz
      */
-    virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0;
+    virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
 
     /*!
      * Set the gain for the dboard.
      * \param gain the gain in dB
      */
-    virtual void set_gain(float gain, size_t chan = 0) = 0;
+    virtual void set_gain(float gain, size_t chan) = 0;
 
     /*!
      * Get the actual dboard gain setting.
      * \return the actual gain in dB
      */
-    virtual float get_gain(size_t chan = 0) = 0;
+    virtual float get_gain(size_t chan) = 0;
 
     /*!
      * Get the settable gain range.
      * \return the gain range in dB
      */
-    virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
+    virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
 
     /*!
      * Set the antenna to use.
      * \param ant the antenna string
      */
-    virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0;
+    virtual void set_antenna(const std::string &ant, size_t chan) = 0;
 
     /*!
      * Get the antenna in use.
      * \return the antenna string
      */
-    virtual std::string get_antenna(size_t chan = 0) = 0;
+    virtual std::string get_antenna(size_t chan) = 0;
 
     /*!
      * Get a list of possible antennas.
      * \return a vector of antenna strings
      */
-    virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
+    virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+    /*!
+     * Set the subdevice bandpass filter.
+     * \param bandwidth the filter bandwidth in Hz
+     */
+    virtual void set_bandwidth(double bandwidth, size_t chan) = 0;
 
     /*!
      * Set the clock configuration.
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index 63dad1a25e..226e8b86fb 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -96,6 +96,10 @@ public:
         return _dev->get_rx_antennas(chan);
     }
 
+    void set_bandwidth(double bandwidth, size_t chan){
+        return _dev->set_rx_bandwidth(bandwidth, chan);
+    }
+
     void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
         return _dev->set_clock_config(clock_config, mboard);
     }
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
index 36c4b6fdcc..483ce098cf 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.h
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -66,49 +66,55 @@ public:
      * \param freq the desired frequency in Hz
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan = 0) = 0;
+    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan) = 0;
 
     /*!
      * Get the tunable frequency range.
      * \return the frequency range in Hz
      */
-    virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0;
+    virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
 
     /*!
      * Set the gain for the dboard.
      * \param gain the gain in dB
      */
-    virtual void set_gain(float gain, size_t chan = 0) = 0;
+    virtual void set_gain(float gain, size_t chan) = 0;
 
     /*!
      * Get the actual dboard gain setting.
      * \return the actual gain in dB
      */
-    virtual float get_gain(size_t chan = 0) = 0;
+    virtual float get_gain(size_t chan) = 0;
 
     /*!
      * Get the settable gain range.
      * \return the gain range in dB
      */
-    virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
+    virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
 
     /*!
      * Set the antenna to use.
      * \param ant the antenna string
      */
-    virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0;
+    virtual void set_antenna(const std::string &ant, size_t chan) = 0;
 
     /*!
      * Get the antenna in use.
      * \return the antenna string
      */
-    virtual std::string get_antenna(size_t chan = 0) = 0;
+    virtual std::string get_antenna(size_t chan) = 0;
 
     /*!
      * Get a list of possible antennas.
      * \return a vector of antenna strings
      */
-    virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
+    virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+    /*!
+     * Set the subdevice bandpass filter.
+     * \param bandwidth the filter bandwidth in Hz
+     */
+    virtual void set_bandwidth(double bandwidth, size_t chan) = 0;
 
     /*!
      * Set the clock configuration.
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
index 4297a83ffa..24981a59af 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -95,6 +95,10 @@ public:
         return _dev->get_tx_antennas(chan);
     }
 
+    void set_bandwidth(double bandwidth, size_t chan){
+        return _dev->set_tx_bandwidth(bandwidth, chan);
+    }
+
     void set_clock_config(const uhd::clock_config_t &clock_config){
         return _dev->set_clock_config(clock_config);
     }
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h
index e83bb6ded8..0987685f47 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.h
+++ b/gr-uhd/lib/uhd_single_usrp_sink.h
@@ -110,6 +110,12 @@ public:
      */
     virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
 
+    /*!
+     * Set the subdevice bandpass filter.
+     * \param bandwidth the filter bandwidth in Hz
+     */
+    virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
+
     /*!
      * Set the clock configuration.
      * \param clock_config the new configuration
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
index 27a788d960..f7c7fc8396 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.cc
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -96,6 +96,10 @@ public:
         return _dev->get_rx_antennas(chan);
     }
 
+    void set_bandwidth(double bandwidth, size_t chan){
+        return _dev->set_rx_bandwidth(bandwidth, chan);
+    }
+
     void set_clock_config(const uhd::clock_config_t &clock_config){
         return _dev->set_clock_config(clock_config);
     }
diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
index c323fbd7ed..1b71d2ad54 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.h
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -110,6 +110,12 @@ public:
      */
     virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
 
+    /*!
+     * Set the subdevice bandpass filter.
+     * \param bandwidth the filter bandwidth in Hz
+     */
+    virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
+
     /*!
      * Set the clock configuration.
      * \param clock_config the new configuration
-- 
cgit v1.2.3


From 5a2de999da86d48cd7f005d08cc48965cb8c7a65 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Mon, 25 Oct 2010 16:22:05 -0700
Subject: uhd: move tune functions to tune_request and provide wrapper for
 simple case

---
 gr-uhd/lib/uhd_multi_usrp_sink.cc    |  7 ++++---
 gr-uhd/lib/uhd_multi_usrp_sink.h     | 16 +++++++++++++++-
 gr-uhd/lib/uhd_multi_usrp_source.cc  |  7 ++++---
 gr-uhd/lib/uhd_multi_usrp_source.h   | 16 +++++++++++++++-
 gr-uhd/lib/uhd_single_usrp_sink.cc   |  7 ++++---
 gr-uhd/lib/uhd_single_usrp_sink.h    | 16 +++++++++++++++-
 gr-uhd/lib/uhd_single_usrp_source.cc |  7 ++++---
 gr-uhd/lib/uhd_single_usrp_source.h  | 16 +++++++++++++++-
 gr-uhd/swig/uhd_swig.i               |  1 +
 9 files changed, 77 insertions(+), 16 deletions(-)

(limited to 'gr-uhd/lib/uhd_multi_usrp_sink.cc')

diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index b75a8303cb..ee16e2928d 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -62,9 +62,10 @@ public:
         return _dev->get_tx_rate();
     }
 
-    uhd::tune_result_t set_center_freq(double freq, size_t chan){
-        uhd::tune_result_t tr = _dev->set_tx_freq(freq, chan);
-        return tr;
+    uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ){
+        return _dev->set_tx_freq(tune_request, chan);
     }
 
     uhd::freq_range_t get_freq_range(size_t chan){
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
index a94e7bd5ae..370e59d0e1 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.h
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -64,11 +64,25 @@ public:
 
     /*!
      * Tune the usrp device to the desired center frequency.
+     * \param tune_request the tune request instructions
+     * \param chan the channel index 0 to N-1
+     * \return a tune result with the actual frequencies
+     */
+    virtual uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ) = 0;
+
+    /*!
+     * Tune the usrp device to the desired center frequency.
+     * This is a wrapper around set center freq so that in this case,
+     * the user can pass a single frequency in the call through swig.
      * \param freq the desired frequency in Hz
      * \param chan the channel index 0 to N-1
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan) = 0;
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        return set_center_freq(uhd::tune_request_t(freq), chan);
+    }
 
     /*!
      * Get the tunable frequency range.
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index 226e8b86fb..029a763e33 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -63,9 +63,10 @@ public:
         return _dev->get_rx_rate();
     }
 
-    uhd::tune_result_t set_center_freq(double freq, size_t chan){
-        uhd::tune_result_t tr = _dev->set_rx_freq(freq, chan);
-        return tr;
+    uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ){
+        return _dev->set_rx_freq(tune_request, chan);
     }
 
     uhd::freq_range_t get_freq_range(size_t chan){
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
index 081c82ee64..b3cbdae1f6 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.h
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -64,11 +64,25 @@ public:
 
     /*!
      * Tune the usrp device to the desired center frequency.
+     * \param tune_request the tune request instructions
+     * \param chan the channel index 0 to N-1
+     * \return a tune result with the actual frequencies
+     */
+    virtual uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ) = 0;
+
+    /*!
+     * Tune the usrp device to the desired center frequency.
+     * This is a wrapper around set center freq so that in this case,
+     * the user can pass a single frequency in the call through swig.
      * \param freq the desired frequency in Hz
      * \param chan the channel index 0 to N-1
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan) = 0;
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        return set_center_freq(uhd::tune_request_t(freq), chan);
+    }
 
     /*!
      * Get the tunable frequency range.
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
index 24981a59af..622f506b55 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -62,9 +62,10 @@ public:
         return _dev->get_tx_rate();
     }
 
-    uhd::tune_result_t set_center_freq(double freq, size_t chan){
-        uhd::tune_result_t tr = _dev->set_tx_freq(freq, chan);
-        return tr;
+    uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ){
+        return _dev->set_tx_freq(tune_request, chan);
     }
 
     uhd::freq_range_t get_freq_range(size_t chan){
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h
index 390667df9c..a4c4e6452e 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.h
+++ b/gr-uhd/lib/uhd_single_usrp_sink.h
@@ -63,11 +63,25 @@ public:
 
     /*!
      * Tune the usrp device to the desired center frequency.
+     * \param tune_request the tune request instructions
+     * \param chan the channel index 0 to N-1
+     * \return a tune result with the actual frequencies
+     */
+    virtual uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ) = 0;
+
+    /*!
+     * Tune the usrp device to the desired center frequency.
+     * This is a wrapper around set center freq so that in this case,
+     * the user can pass a single frequency in the call through swig.
      * \param freq the desired frequency in Hz
      * \param chan the channel index 0 to N-1
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan = 0) = 0;
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        return set_center_freq(uhd::tune_request_t(freq), chan);
+    }
 
     /*!
      * Get the tunable frequency range.
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
index f7c7fc8396..907e8be542 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.cc
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -63,9 +63,10 @@ public:
         return _dev->get_rx_rate();
     }
 
-    uhd::tune_result_t set_center_freq(double freq, size_t chan){
-        uhd::tune_result_t tr = _dev->set_rx_freq(freq, chan);
-        return tr;
+    uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ){
+        return _dev->set_rx_freq(tune_request, chan);
     }
 
     uhd::freq_range_t get_freq_range(size_t chan){
diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
index 415c52e9a5..495f8c6117 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.h
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -63,11 +63,25 @@ public:
 
     /*!
      * Tune the usrp device to the desired center frequency.
+     * \param tune_request the tune request instructions
+     * \param chan the channel index 0 to N-1
+     * \return a tune result with the actual frequencies
+     */
+    virtual uhd::tune_result_t set_center_freq(
+        const uhd::tune_request_t tune_request, size_t chan
+    ) = 0;
+
+    /*!
+     * Tune the usrp device to the desired center frequency.
+     * This is a wrapper around set center freq so that in this case,
+     * the user can pass a single frequency in the call through swig.
      * \param freq the desired frequency in Hz
      * \param chan the channel index 0 to N-1
      * \return a tune result with the actual frequencies
      */
-    virtual uhd::tune_result_t set_center_freq(double freq, size_t chan = 0) = 0;
+    uhd::tune_result_t set_center_freq(double freq, size_t chan){
+        return set_center_freq(uhd::tune_request_t(freq), chan);
+    }
 
     /*!
      * Get the tunable frequency range.
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index 5b3b524720..d332bb6171 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -69,6 +69,7 @@ namespace std {
 ////////////////////////////////////////////////////////////////////////
 %include <uhd/config.hpp>
 %include <uhd/types/ranges.hpp>
+%include <uhd/types/tune_request.hpp>
 %include <uhd/types/tune_result.hpp>
 %include <uhd/types/io_type.hpp>
 %include <uhd/types/time_spec.hpp>
-- 
cgit v1.2.3