summaryrefslogtreecommitdiff
path: root/gr-uhd/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-uhd/lib')
-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
9 files changed, 53 insertions, 11 deletions
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)));
}
}