summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-uhd/grc/uhd_simple_sink.xml8
-rw-r--r--gr-uhd/grc/uhd_simple_source.xml8
-rw-r--r--gr-uhd/lib/uhd_mimo_sink.cc4
-rw-r--r--gr-uhd/lib/uhd_mimo_sink.h7
-rw-r--r--gr-uhd/lib/uhd_mimo_source.cc4
-rw-r--r--gr-uhd/lib/uhd_mimo_source.h7
-rw-r--r--gr-uhd/lib/uhd_simple_sink.cc4
-rw-r--r--gr-uhd/lib/uhd_simple_sink.h6
-rw-r--r--gr-uhd/lib/uhd_simple_source.cc4
-rw-r--r--gr-uhd/lib/uhd_simple_source.h6
-rw-r--r--gr-uhd/lib/utils.cc22
11 files changed, 69 insertions, 11 deletions
diff --git a/gr-uhd/grc/uhd_simple_sink.xml b/gr-uhd/grc/uhd_simple_sink.xml
index 2992f650e..782b984ae 100644
--- a/gr-uhd/grc/uhd_simple_sink.xml
+++ b/gr-uhd/grc/uhd_simple_sink.xml
@@ -10,6 +10,7 @@
<category>UHD</category>
<import>from gnuradio import uhd</import>
<make>uhd.simple_sink($args, uhd.io_type_t.$type.type)
+self.$(id).set_subdev_spec($sd_spec)
self.$(id).set_samp_rate($samp_rate)
self.$(id).set_center_freq($center_freq)
self.$(id).set_gain($gain)
@@ -44,6 +45,13 @@ self.$(id).set_antenna($ant)
<type>string</type>
</param>
<param>
+ <name>Subdev Spec</name>
+ <key>sd_spec</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $sd_spec() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Samp Rate (Sps)</name>
<key>samp_rate</key>
<value>samp_rate</value>
diff --git a/gr-uhd/grc/uhd_simple_source.xml b/gr-uhd/grc/uhd_simple_source.xml
index ecd963928..ae7518803 100644
--- a/gr-uhd/grc/uhd_simple_source.xml
+++ b/gr-uhd/grc/uhd_simple_source.xml
@@ -10,6 +10,7 @@
<category>UHD</category>
<import>from gnuradio import uhd</import>
<make>uhd.simple_source($args, uhd.io_type_t.$type.type)
+self.$(id).set_subdev_spec($sd_spec)
self.$(id).set_samp_rate($samp_rate)
self.$(id).set_center_freq($center_freq)
self.$(id).set_gain($gain)
@@ -44,6 +45,13 @@ self.$(id).set_antenna($ant)
<type>string</type>
</param>
<param>
+ <name>Subdev Spec</name>
+ <key>sd_spec</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $sd_spec() then 'none' else 'part'#</hide>
+ </param>
+ <param>
<name>Samp Rate (Sps)</name>
<key>samp_rate</key>
<value>samp_rate</value>
diff --git a/gr-uhd/lib/uhd_mimo_sink.cc b/gr-uhd/lib/uhd_mimo_sink.cc
index 95174522a..0a2ce1b0a 100644
--- a/gr-uhd/lib/uhd_mimo_sink.cc
+++ b/gr-uhd/lib/uhd_mimo_sink.cc
@@ -53,6 +53,10 @@ public:
//NOP
}
+ void set_subdev_spec(size_t chan, const std::string &spec){
+ return _dev->set_tx_subdev_spec(chan, spec);
+ }
+
void set_samp_rate_all(double rate){
_dev->set_tx_rate_all(rate);
do_samp_rate_error_message(rate, get_samp_rate_all(), "TX");
diff --git a/gr-uhd/lib/uhd_mimo_sink.h b/gr-uhd/lib/uhd_mimo_sink.h
index 951980908..46679d973 100644
--- a/gr-uhd/lib/uhd_mimo_sink.h
+++ b/gr-uhd/lib/uhd_mimo_sink.h
@@ -44,6 +44,13 @@ public:
uhd_mimo_sink(gr_io_signature_sptr sig);
/*!
+ * Set the subdevice specification.
+ * \param chan the channel number from 0 to N-1
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(size_t chan, const std::string &spec) = 0;
+
+ /*!
* Set the sample rate for the usrp device (across all mboards).
* \param rate a new rate in Sps
*/
diff --git a/gr-uhd/lib/uhd_mimo_source.cc b/gr-uhd/lib/uhd_mimo_source.cc
index b620a56fc..718af08f5 100644
--- a/gr-uhd/lib/uhd_mimo_source.cc
+++ b/gr-uhd/lib/uhd_mimo_source.cc
@@ -53,6 +53,10 @@ public:
set_streaming(false);
}
+ void set_subdev_spec(size_t chan, const std::string &spec){
+ return _dev->set_rx_subdev_spec(chan, spec);
+ }
+
void set_samp_rate_all(double rate){
_dev->set_rx_rate_all(rate);
do_samp_rate_error_message(rate, get_samp_rate_all(), "RX");
diff --git a/gr-uhd/lib/uhd_mimo_source.h b/gr-uhd/lib/uhd_mimo_source.h
index e234779df..fbd7f2c42 100644
--- a/gr-uhd/lib/uhd_mimo_source.h
+++ b/gr-uhd/lib/uhd_mimo_source.h
@@ -44,6 +44,13 @@ public:
uhd_mimo_source(gr_io_signature_sptr sig);
/*!
+ * Set the subdevice specification.
+ * \param chan the channel number from 0 to N-1
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(size_t chan, const std::string &spec) = 0;
+
+ /*!
* Set the sample rate for the usrp device (across all mboards).
* \param rate a new rate in Sps
*/
diff --git a/gr-uhd/lib/uhd_simple_sink.cc b/gr-uhd/lib/uhd_simple_sink.cc
index 9df6c8e02..7b31218db 100644
--- a/gr-uhd/lib/uhd_simple_sink.cc
+++ b/gr-uhd/lib/uhd_simple_sink.cc
@@ -50,6 +50,10 @@ public:
//NOP
}
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_tx_subdev_spec(spec);
+ }
+
void set_samp_rate(double rate){
_dev->set_tx_rate(rate);
do_samp_rate_error_message(rate, get_samp_rate(), "TX");
diff --git a/gr-uhd/lib/uhd_simple_sink.h b/gr-uhd/lib/uhd_simple_sink.h
index 7f1596259..0abf30681 100644
--- a/gr-uhd/lib/uhd_simple_sink.h
+++ b/gr-uhd/lib/uhd_simple_sink.h
@@ -43,6 +43,12 @@ public:
uhd_simple_sink(gr_io_signature_sptr sig);
/*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
* Set the sample rate for the usrp device.
* \param rate a new rate in Sps
*/
diff --git a/gr-uhd/lib/uhd_simple_source.cc b/gr-uhd/lib/uhd_simple_source.cc
index 846c0faeb..2ace1da68 100644
--- a/gr-uhd/lib/uhd_simple_source.cc
+++ b/gr-uhd/lib/uhd_simple_source.cc
@@ -51,6 +51,10 @@ public:
set_streaming(false);
}
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_rx_subdev_spec(spec);
+ }
+
void set_samp_rate(double rate){
_dev->set_rx_rate(rate);
do_samp_rate_error_message(rate, get_samp_rate(), "RX");
diff --git a/gr-uhd/lib/uhd_simple_source.h b/gr-uhd/lib/uhd_simple_source.h
index 8568fc2d4..b95c0cfd9 100644
--- a/gr-uhd/lib/uhd_simple_source.h
+++ b/gr-uhd/lib/uhd_simple_source.h
@@ -43,6 +43,12 @@ public:
uhd_simple_source(gr_io_signature_sptr sig);
/*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
* Set the sample rate for the usrp device.
* \param rate a new rate in Sps
*/
diff --git a/gr-uhd/lib/utils.cc b/gr-uhd/lib/utils.cc
index 5d40c4fff..da8352965 100644
--- a/gr-uhd/lib/utils.cc
+++ b/gr-uhd/lib/utils.cc
@@ -21,8 +21,8 @@
*/
#include "utils.h" //local include
+#include <uhd/utils/warning.hpp>
#include <boost/format.hpp>
-#include <iostream>
#include <cmath>
void do_samp_rate_error_message(
@@ -32,11 +32,11 @@ void do_samp_rate_error_message(
){
static const double max_allowed_error = 1.0; //Sps
if (std::abs(target_rate - actual_rate) > max_allowed_error){
- std::cerr << boost::format(
- "Warning: The hardware does not support the requested %s sample rate:\n"
- " Target sample rate: %f MSps\n"
- " Actual sample rate: %f MSps\n"
- ) % xx % (target_rate/1e6) % (actual_rate/1e6) << std::endl;
+ uhd::print_warning(str(boost::format(
+ "The hardware does not support the requested %s sample rate:\n"
+ "Target sample rate: %f MSps\n"
+ "Actual sample rate: %f MSps\n"
+ ) % xx % (target_rate/1e6) % (actual_rate/1e6)));
}
}
@@ -47,10 +47,10 @@ void do_tune_freq_error_message(
){
static const double max_allowed_error = 1.0; //Hz
if (std::abs(target_freq - actual_freq) > max_allowed_error){
- std::cerr << boost::format(
- "Warning: The hardware does not support the requested %s frequency:\n"
- " Target frequency: %f MHz\n"
- " Actual frequency: %f MHz\n"
- ) % xx % (target_freq/1e6) % (actual_freq/1e6) << std::endl;
+ uhd::print_warning(str(boost::format(
+ "The hardware does not support the requested %s frequency:\n"
+ "Target frequency: %f MHz\n"
+ "Actual frequency: %f MHz\n"
+ ) % xx % (target_freq/1e6) % (actual_freq/1e6)));
}
}