summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-08-30 16:54:18 -0700
committerJosh Blum <josh@joshknows.com>2010-08-30 16:54:18 -0700
commitf5c62a46cbc44e254c0214b463d51f06675c17ab (patch)
tree54625123fad727091e0061eab6017dc98336f1d6
parent051b611bc304b099541706fe41f47ad5e75b7448 (diff)
downloaduhd-f5c62a46cbc44e254c0214b463d51f06675c17ab.tar.gz
uhd-f5c62a46cbc44e254c0214b463d51f06675c17ab.tar.bz2
uhd-f5c62a46cbc44e254c0214b463d51f06675c17ab.zip
usrp1: subdev spec tweaks and docs
-rw-r--r--host/docs/usrp1.rst35
-rw-r--r--host/include/uhd/usrp/subdev_spec.hpp9
-rw-r--r--host/lib/usrp/misc_utils.cpp13
3 files changed, 46 insertions, 11 deletions
diff --git a/host/docs/usrp1.rst b/host/docs/usrp1.rst
index ebc33cbfa..c960b928b 100644
--- a/host/docs/usrp1.rst
+++ b/host/docs/usrp1.rst
@@ -22,6 +22,41 @@ Change the USRP1's serial number
TODO
------------------------------------------------------------------------
+Specifying the subdevice to use
+------------------------------------------------------------------------
+The USRP1 has multiple daughterboard slots, known as slot A and slot B.
+The subdevice specification can be used to select
+the daughterboard and subdevice for each channel.
+For daughterboards with one one subdevice,
+the subdevice name may be left blank for automatic selection.
+
+Ex: The subdev spec markup string to select a WBX on slot B.
+Notice the use of the blank subdevice name for automatic selection.
+
+::
+
+ B:
+
+ -- OR --
+
+ B:0
+
+Ex: The subdev spec markup string to select a BasicRX on slot B.
+Notice that the subdevice name is always specified in the 3 possible cases.
+
+::
+
+ B:AB
+
+ -- OR --
+
+ B:A
+
+ -- OR --
+
+ B:B
+
+------------------------------------------------------------------------
OS Specific Notes
------------------------------------------------------------------------
diff --git a/host/include/uhd/usrp/subdev_spec.hpp b/host/include/uhd/usrp/subdev_spec.hpp
index 56aa0df20..2f32509b9 100644
--- a/host/include/uhd/usrp/subdev_spec.hpp
+++ b/host/include/uhd/usrp/subdev_spec.hpp
@@ -56,17 +56,8 @@ namespace uhd{ namespace usrp{
*
* 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:
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index a1664d810..5cfcdc8d3 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -164,13 +164,22 @@ static void verify_xx_subdev_spec(
//empty db name means select dboard automatically
if (pair.db_name.empty()){
if (dboard_names.size() != 1) throw std::runtime_error(
- "A daughterboard name must be provided for multi-slot boards: " + subdev_spec.to_string()
+ "A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string()
);
pair.db_name == dboard_names.front();
}
uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name");
wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)];
- uhd::assert_has(dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>(), pair.sd_name, xx_type + " subdev name");
+ prop_names_t subdev_names = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>();
+
+ //empty sd name means select the subdev automatically
+ if (pair.sd_name.empty()){
+ if (subdev_names.size() != 1) throw std::runtime_error(
+ "A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string()
+ );
+ pair.sd_name == subdev_names.front();
+ }
+ uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name");
}
}catch(const std::exception &e){
throw std::runtime_error(str(boost::format(