From 58519b292b561cbec5eb41c85f85c8c6bd4a06fe Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Aug 2010 21:34:16 -0700 Subject: usrp: moved usrp utils into public include space --- host/lib/usrp/usrp2/dboard_impl.cpp | 4 ++-- host/lib/usrp/usrp2/dsp_impl.cpp | 10 +++++----- host/lib/usrp/usrp2/mboard_impl.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp/usrp2') diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index bafeb3f15..99599f11a 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -17,8 +17,8 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" -#include "../dsp_utils.hpp" -#include "../misc_utils.hpp" +#include +#include #include #include #include diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp index 7d9cdc441..347ec38af 100644 --- a/host/lib/usrp/usrp2/dsp_impl.cpp +++ b/host/lib/usrp/usrp2/dsp_impl.cpp @@ -17,9 +17,10 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" -#include "../dsp_utils.hpp" +#include #include #include +#include using namespace uhd; using namespace uhd::usrp; @@ -30,10 +31,9 @@ static const size_t default_interp = 16; /*********************************************************************** * DDC Helper Methods **********************************************************************/ -template static rate_t -pick_closest_rate(double exact_rate, const std::vector &rates){ - rate_t closest_match = rates.at(0); - BOOST_FOREACH(rate_t possible_rate, rates){ +static unsigned pick_closest_rate(double exact_rate, const std::vector &rates){ + unsigned closest_match = rates.front(); + BOOST_FOREACH(unsigned possible_rate, rates){ if(std::abs(exact_rate - possible_rate) < std::abs(exact_rate - closest_match)) closest_match = possible_rate; } diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index d354a943b..e3c5d5ed6 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -17,8 +17,8 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" -#include "../misc_utils.hpp" -#include "../dsp_utils.hpp" +#include +#include #include #include #include -- cgit v1.2.3 From a80a62dfe6ebfe5a814c71880b83b64a6bee0d0a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Aug 2010 22:23:04 -0700 Subject: usrp: use different priority policies for gain group (rx vs tx) --- host/include/uhd/usrp/misc_utils.hpp | 16 +++++++++++++++- host/lib/usrp/misc_utils.cpp | 13 +++++++++---- host/lib/usrp/usrp2/dboard_impl.cpp | 8 ++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'host/lib/usrp/usrp2') 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 @@ -25,10 +25,24 @@ 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; -- cgit v1.2.3 From f75869e4f7ffb53ca7f348c3a1b6d6c8fb1499b7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Aug 2010 23:21:10 -0700 Subject: usrp2: fix missing include --- host/lib/usrp/usrp2/mboard_impl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'host/lib/usrp/usrp2') diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index e3c5d5ed6..d5785f326 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3