diff options
-rw-r--r-- | host/include/uhd/usrp/misc_utils.hpp | 16 | ||||
-rw-r--r-- | host/lib/usrp/misc_utils.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_impl.cpp | 8 |
3 files changed, 30 insertions, 7 deletions
diff --git a/host/include/uhd/usrp/misc_utils.hpp b/host/include/uhd/usrp/misc_utils.hpp index 14db80162..2af9f5b40 100644 --- a/host/include/uhd/usrp/misc_utils.hpp +++ b/host/include/uhd/usrp/misc_utils.hpp @@ -26,9 +26,23 @@ namespace uhd{ namespace usrp{ /*! + * Different policies for gain group prioritization. + */ + enum gain_group_policy_t{ + GAIN_GROUP_POLICY_RX = 'R', + GAIN_GROUP_POLICY_TX = 'T' + }; + + /*! * Create a gain group that represents the subdevice and its codec. + * \param subdev the object with subdevice properties + * \param codec the object with codec properties + * \param gain_group_policy the policy to use */ - UHD_API gain_group::sptr make_gain_group(wax::obj subdev, wax::obj codec); + UHD_API gain_group::sptr make_gain_group( + wax::obj subdev, wax::obj codec, + gain_group_policy_t gain_group_policy + ); /*! * Verify the rx subdevice specification. 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; |