summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt1
-rw-r--r--host/include/uhd/usrp/dboard_props.hpp1
-rw-r--r--host/include/uhd/usrp/mboard_props.hpp2
-rw-r--r--host/include/uhd/usrp/mimo_usrp.hpp5
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp5
-rw-r--r--host/include/uhd/usrp/subdev_spec.hpp95
-rw-r--r--host/include/uhd/utils/CMakeLists.txt1
-rw-r--r--host/include/uhd/utils/algorithm.hpp25
-rw-r--r--host/include/uhd/utils/warning.hpp34
9 files changed, 168 insertions, 1 deletions
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index bdb4b90a8..76ee24e5f 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -33,6 +33,7 @@ INSTALL(FILES
dboard_manager.hpp
### utilities ###
+ subdev_spec.hpp
tune_helper.hpp
### interfaces ###
diff --git a/host/include/uhd/usrp/dboard_props.hpp b/host/include/uhd/usrp/dboard_props.hpp
index e2c0f9c7b..aab6c31ce 100644
--- a/host/include/uhd/usrp/dboard_props.hpp
+++ b/host/include/uhd/usrp/dboard_props.hpp
@@ -31,7 +31,6 @@ namespace uhd{ namespace usrp{
DBOARD_PROP_NAME = 'n', //ro, std::string
DBOARD_PROP_SUBDEV = 's', //ro, wax::obj
DBOARD_PROP_SUBDEV_NAMES = 'S', //ro, prop_names_t
- DBOARD_PROP_USED_SUBDEVS = 'u', //ro, prop_names_t
DBOARD_PROP_DBOARD_ID = 'i', //rw, dboard_id_t
DBOARD_PROP_DBOARD_IFACE = 'f', //ro, dboard_iface::sptr
DBOARD_PROP_CODEC = 'c', //ro, wax::obj
diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp
index a432ce50c..0f250f439 100644
--- a/host/include/uhd/usrp/mboard_props.hpp
+++ b/host/include/uhd/usrp/mboard_props.hpp
@@ -39,6 +39,8 @@ namespace uhd{ namespace usrp{
MBOARD_PROP_RX_DBOARD_NAMES = 'E', //ro, prop_names_t
MBOARD_PROP_TX_DBOARD = 'v', //ro, wax::obj
MBOARD_PROP_TX_DBOARD_NAMES = 'V', //ro, prop_names_t
+ MBOARD_PROP_RX_SUBDEV_SPEC = 'r', //rw, subdev_spec_t
+ MBOARD_PROP_TX_SUBDEV_SPEC = 'R', //rw, subdev_spec_t
MBOARD_PROP_CLOCK_CONFIG = 'C', //rw, clock_config_t
MBOARD_PROP_TIME_NOW = 't', //rw, time_spec_t
MBOARD_PROP_TIME_NEXT_PPS = 'T', //wo, time_spec_t
diff --git a/host/include/uhd/usrp/mimo_usrp.hpp b/host/include/uhd/usrp/mimo_usrp.hpp
index fd0f4596f..9856f9d32 100644
--- a/host/include/uhd/usrp/mimo_usrp.hpp
+++ b/host/include/uhd/usrp/mimo_usrp.hpp
@@ -24,6 +24,7 @@
#include <uhd/types/stream_cmd.hpp>
#include <uhd/types/clock_config.hpp>
#include <uhd/types/tune_result.hpp>
+#include <uhd/usrp/subdev_spec.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
@@ -119,6 +120,8 @@ public:
/*******************************************************************
* RX methods
******************************************************************/
+ virtual void set_rx_subdev_spec(size_t chan, const uhd::usrp::subdev_spec_t &spec) = 0;
+
virtual void set_rx_rate_all(double rate) = 0;
virtual double get_rx_rate_all(void) = 0;
@@ -148,6 +151,8 @@ public:
/*******************************************************************
* TX methods
******************************************************************/
+ virtual void set_tx_subdev_spec(size_t chan, const uhd::usrp::subdev_spec_t &spec) = 0;
+
virtual void set_tx_rate_all(double rate) = 0;
virtual double get_tx_rate_all(void) = 0;
diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index a100579ce..a6275cfcc 100644
--- a/host/include/uhd/usrp/simple_usrp.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -24,6 +24,7 @@
#include <uhd/types/stream_cmd.hpp>
#include <uhd/types/clock_config.hpp>
#include <uhd/types/tune_result.hpp>
+#include <uhd/usrp/subdev_spec.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
@@ -107,6 +108,8 @@ public:
/*******************************************************************
* RX methods
******************************************************************/
+ virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0;
+
virtual void set_rx_rate(double rate) = 0;
virtual double get_rx_rate(void) = 0;
@@ -135,6 +138,8 @@ public:
/*******************************************************************
* TX methods
******************************************************************/
+ virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0;
+
virtual void set_tx_rate(double rate) = 0;
virtual double get_tx_rate(void) = 0;
diff --git a/host/include/uhd/usrp/subdev_spec.hpp b/host/include/uhd/usrp/subdev_spec.hpp
new file mode 100644
index 000000000..4d8f03b77
--- /dev/null
+++ b/host/include/uhd/usrp/subdev_spec.hpp
@@ -0,0 +1,95 @@
+//
+// Copyright 2010 Ettus Research LLC
+//
+// 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/>.
+//
+
+#ifndef INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP
+#define INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP
+
+#include <uhd/config.hpp>
+#include <vector>
+#include <string>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * A subdevice specification (daughterboard, subdevice) name pairing.
+ */
+ struct UHD_API subdev_spec_pair_t{
+ //! The daughterboard name
+ std::string db_name;
+
+ //! The subdevice name
+ std::string sd_name;
+
+ /*!
+ * Create a new subdevice specification pair from dboard and subdev names.
+ * \param db_name the name of a daughterboard slot
+ * \param sd_name the name of a subdevice on that daughterboard
+ */
+ subdev_spec_pair_t(
+ const std::string &db_name, const std::string &sd_name
+ );
+ };
+
+ /*!
+ * A list of (daughterboard name, subdevice name) pairs:
+ *
+ * A subdevice specification represents a list of subdevices on a motherboard.
+ * The subdevices specified may span across multiple daughterboards;
+ * Hence the need for a subdevice specification over a simple list of strings.
+ * Typically, the user will pass a RX or TX subdevice specification into the API,
+ * and the implementation will infer the channel configuration from the specification.
+ *
+ * The subdevice specification can be represented as a markup-string.
+ * The markup-string is a whitespace separated list of dboard:subdev pairs.
+ * The "dboard:" part is optional on boards with only one daughterboard slot.
+ * The first pair represents the subdevice for channel zero,
+ * the second pair represents the subdevice for channel one, and so on.
+ *
+ * Examples:
+ * - Use subdevice AB on daughterboard A (USRP1): "A:AB"
+ * - Use subdevice A on daughterboard A for channel zero and subdevice A on daughterboard B for channel one (USRP1): "A:A B:A"
+ * - Use subdevice AB (USRP2): "AB" or ":AB"
+ *
+ * An empty subdevice specification can be used to automatically
+ * select the first subdevice on the first present daughterboard.
+ */
+ class UHD_API subdev_spec_t : public std::vector<subdev_spec_pair_t>{
+ public:
+
+ /*!
+ * Create a subdev specification from a markup string.
+ * \param markup the markup string
+ */
+ subdev_spec_t(const std::string &markup = "");
+
+ /*!
+ * Convert a subdev specification into a pretty print string.
+ * \return a printable string representing the subdev specification
+ */
+ std::string to_pp_string(void) const;
+
+ /*!
+ * Convert the subdevice specification into a markup string.
+ * The markup string contains the delimiter symbols.
+ * \return a string with delimiter markup
+ */
+ std::string to_string(void) const;
+ };
+
+}}
+
+#endif /* INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP */
diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt
index f7feab5a8..ef8e64ce0 100644
--- a/host/include/uhd/utils/CMakeLists.txt
+++ b/host/include/uhd/utils/CMakeLists.txt
@@ -28,5 +28,6 @@ INSTALL(FILES
safe_main.hpp
static.hpp
thread_priority.hpp
+ warning.hpp
DESTINATION ${INCLUDE_DIR}/uhd/utils
)
diff --git a/host/include/uhd/utils/algorithm.hpp b/host/include/uhd/utils/algorithm.hpp
index 54bc78494..1b5eacfa9 100644
--- a/host/include/uhd/utils/algorithm.hpp
+++ b/host/include/uhd/utils/algorithm.hpp
@@ -69,6 +69,31 @@ namespace std{
}
/*!
+ * A wrapper around std::reverse that takes a range instead of an iterator.
+ *
+ * The elements are reversed into descending order using the less-than operator.
+ *
+ * \param range the range of elements to be reversed
+ */
+ template<typename Range> inline void reverse(Range &range){
+ return std::reverse(boost::begin(range), boost::end(range));
+ }
+
+ /*!
+ * A wrapper around std::reverse that takes a range instead of an iterator.
+ *
+ * The elements are reversed into descending order using the less-than operator.
+ * This wrapper reverses the elements non-destructively into a new range.
+ * Based on the builtin python function reversed(...)
+ *
+ * \param range the range of elements to be reversed
+ * \return a new range with the elements reversed
+ */
+ template<typename Range> inline Range reversed(const Range &range){
+ Range srange(range); std::reverse(srange); return srange;
+ }
+
+ /*!
* Is the value found within the elements in this range?
*
* Uses std::find to search the iterable for an element.
diff --git a/host/include/uhd/utils/warning.hpp b/host/include/uhd/utils/warning.hpp
new file mode 100644
index 000000000..91d8400ab
--- /dev/null
+++ b/host/include/uhd/utils/warning.hpp
@@ -0,0 +1,34 @@
+//
+// Copyright 2010 Ettus Research LLC
+//
+// 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/>.
+//
+
+#ifndef INCLUDED_UHD_UTILS_WARNING_HPP
+#define INCLUDED_UHD_UTILS_WARNING_HPP
+
+#include <uhd/config.hpp>
+#include <string>
+
+namespace uhd{
+
+ /*!
+ * Print a formatted warning string to stderr.
+ * \param msg the multiline warning message
+ */
+ UHD_API void print_warning(const std::string &msg);
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_UTILS_WARNING_HPP */