summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-08-05 11:50:30 -0700
committerJosh Blum <josh@joshknows.com>2010-08-06 12:15:05 -0700
commit53341c286eb71ead76ff11796ab67bd98f73c3ab (patch)
tree9a60145a06d3614dd99670093b2fc337879e6a98 /host/include
parent7e8a1f296f934a5546cdad575bcbe030a78b8bb1 (diff)
downloaduhd-53341c286eb71ead76ff11796ab67bd98f73c3ab.tar.gz
uhd-53341c286eb71ead76ff11796ab67bd98f73c3ab.tar.bz2
uhd-53341c286eb71ead76ff11796ab67bd98f73c3ab.zip
usrp: added subdev spec class with parser to specify subdevice specifications for channel config
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt1
-rw-r--r--host/include/uhd/usrp/subdev_spec.hpp77
2 files changed, 78 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index 6f8c1a2d8..ef0696700 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -32,6 +32,7 @@ INSTALL(FILES
dboard_manager.hpp
### utilities ###
+ subdev_spec.hpp
tune_helper.hpp
### interfaces ###
diff --git a/host/include/uhd/usrp/subdev_spec.hpp b/host/include/uhd/usrp/subdev_spec.hpp
new file mode 100644
index 000000000..d874a9bd9
--- /dev/null
+++ b/host/include/uhd/usrp/subdev_spec.hpp
@@ -0,0 +1,77 @@
+//
+// 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 <utility> //std::pair
+#include <vector>
+#include <string>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * 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<std::pair<std::string, std::string> >{
+ public:
+ typedef std::pair<std::string, std::string> pair_t;
+
+ /*!
+ * 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 */