summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-09-23 12:47:46 -0700
committerJosh Blum <josh@joshknows.com>2010-09-23 12:47:46 -0700
commitfbcd677284685e666556f396745ec570b01ea830 (patch)
tree6f43c8aa50b77416e9abd40a82447918fbb89c9c
parentc36b8a83b1b510a0a8bc6e5600a537cbedea8f30 (diff)
downloaduhd-fbcd677284685e666556f396745ec570b01ea830.tar.gz
uhd-fbcd677284685e666556f396745ec570b01ea830.tar.bz2
uhd-fbcd677284685e666556f396745ec570b01ea830.zip
usrp1: sanity check, only 1 channel per tx slot
-rw-r--r--host/lib/usrp/usrp1/mboard_impl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp
index e55c3685b..fe3774eb4 100644
--- a/host/lib/usrp/usrp1/mboard_impl.cpp
+++ b/host/lib/usrp/usrp1/mboard_impl.cpp
@@ -148,6 +148,7 @@ static boost::uint32_t calc_tx_mux(
//calculate the channel flags
int channel_flags = 0, chan = 0;
+ uhd::dict<std::string, int> slot_to_chan_count = boost::assign::map_list_of("A", 0)("B", 0);
BOOST_FOREACH(const subdev_spec_pair_t &pair, subdev_spec){
wax::obj dboard = mboard[named_prop_t(MBOARD_PROP_TX_DBOARD, pair.db_name)];
wax::obj subdev = dboard[named_prop_t(DBOARD_PROP_SUBDEV, pair.sd_name)];
@@ -157,6 +158,14 @@ static boost::uint32_t calc_tx_mux(
if (pair.db_name == "A") channel_flags |= chan_to_conn_to_flag[chan][conn] << 0;
if (pair.db_name == "B") channel_flags |= chan_to_conn_to_flag[chan][conn] << 8;
+ //sanity check, only 1 channel per slot
+ slot_to_chan_count[pair.db_name]++;
+ if (slot_to_chan_count[pair.db_name] > 1){
+ throw std::runtime_error(str(boost::format(
+ "dboard slot %s assigned to multiple channels in subdev spec %s"
+ ) % pair.db_name % subdev_spec.to_string()));
+ }
+
//increment for the next channel
chan++;
}