summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/misc_utils.cpp13
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp8
2 files changed, 15 insertions, 6 deletions
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index 41239b144..46094ba32 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -29,9 +29,6 @@
using namespace uhd;
using namespace uhd::usrp;
-static const size_t subdev_gain_priority = 1; //higher, closer to the antenna
-static const size_t codec_gain_priority = 0;
-
/***********************************************************************
* codec gain group helper functions:
* do this so we dont have to bind a templated function
@@ -80,7 +77,15 @@ static void set_subdev_gain(wax::obj subdev, const std::string &name, float gain
/***********************************************************************
* gain group factory function for usrp
**********************************************************************/
-gain_group::sptr usrp::make_gain_group(wax::obj subdev, wax::obj codec){
+gain_group::sptr usrp::make_gain_group(
+ wax::obj subdev, wax::obj codec,
+ gain_group_policy_t gain_group_policy
+){
+ const size_t subdev_gain_priority = 1;
+ const size_t codec_gain_priority = (gain_group_policy == GAIN_GROUP_POLICY_RX)?
+ (subdev_gain_priority - 1): //RX policy, codec gains fill last (lower priority)
+ (subdev_gain_priority + 1); //TX policy, codec gains fill first (higher priority)
+
gain_group::sptr gg = gain_group::make();
gain_fcns_t fcns;
//add all the subdev gains first (antenna to dsp order)
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index 99599f11a..a462b93c2 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -89,7 +89,9 @@ void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
- _dboard_manager->get_rx_subdev(key.name), _rx_codec_proxy->get_link()
+ _dboard_manager->get_rx_subdev(key.name),
+ _rx_codec_proxy->get_link(),
+ GAIN_GROUP_POLICY_RX
);
return;
@@ -143,7 +145,9 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
case DBOARD_PROP_GAIN_GROUP:
val = make_gain_group(
- _dboard_manager->get_tx_subdev(key.name), _tx_codec_proxy->get_link()
+ _dboard_manager->get_tx_subdev(key.name),
+ _tx_codec_proxy->get_link(),
+ GAIN_GROUP_POLICY_TX
);
return;