aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp62
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp7
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp122
3 files changed, 62 insertions, 129 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
index 495eca3b0..e2fe1e51b 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
@@ -73,6 +73,17 @@ namespace {
lo_iface->set_output_enable(adf435x_iface::RF_OUTPUT_B, false);
lo_iface->commit();
}
+
+ // TODO: remove this helper when there are only 2 radios
+ fs_path master_fe_base_path(const std::string &radio_slot)
+ {
+ if (radio_slot == "B") {
+ return fs_path("dboards") / "A";
+ }
+ if (radio_slot == "D") {
+ return fs_path("dboards") / "C";
+ }
+ }
}
@@ -141,13 +152,6 @@ void magnesium_radio_ctrl_impl::set_rx_antenna(
% ant
));
}
-
- // TODO: When we go to 1 block per dboard, this entire if statement can go
- // away.
- if (not _master) {
- // tbi
- }
-
UHD_LOG_TRACE(unique_id(),
"Setting RX antenna to " << ant << " for chan " << chan);
magnesium_cpld_ctrl::chan_sel_t chan_sel =
@@ -167,6 +171,14 @@ double magnesium_radio_ctrl_impl::set_tx_frequency(
// bands.
UHD_LOG_TRACE(unique_id(),
"set_tx_frequency(f=" << freq << ", chan=" << chan << ")");
+ if (not _master) {
+ const fs_path master_tx_fe_path =
+ master_fe_base_path(_radio_slot) / fs_path("tx_frontends") / chan;
+ UHD_LOG_DEBUG(unique_id(),
+ "Slave setting TX frequency");
+ _tree->access<double>(master_tx_fe_path / "freq" / "value").set(freq);
+ return _tree->access<double>(master_tx_fe_path / "freq" / "value").get();
+ }
_update_tx_freq_switches(freq, _tx_bypass_amp, chan);
//double ad9371_freq = freq;
double if_freq = 0.0;
@@ -200,6 +212,14 @@ double magnesium_radio_ctrl_impl::set_rx_frequency(
// bands.
UHD_LOG_TRACE(unique_id(),
"set_rx_frequency(f=" << freq << ", chan=" << chan << ")");
+ if (not _master) {
+ const fs_path master_rx_fe_path =
+ master_fe_base_path(_radio_slot) / fs_path("rx_frontends") / chan;
+ UHD_LOG_DEBUG(unique_id(),
+ "Slave setting RX frequency");
+ _tree->access<double>(master_rx_fe_path / "freq" / "value").set(freq);
+ return _tree->access<double>(master_rx_fe_path / "freq" / "value").get();
+ }
_update_rx_freq_switches(freq, _rx_bypass_lnas, chan);
//double ad9371_freq = freq;
double if_freq = 0.0;
@@ -223,6 +243,34 @@ double magnesium_radio_ctrl_impl::set_rx_frequency(
return freq; // FIXME calc the actual frequency
}
+double magnesium_radio_ctrl_impl::get_tx_frequency(
+ const size_t chan)
+{
+ UHD_LOG_TRACE(unique_id(),
+ "get_tx_frequency(chan=" << chan << ")");
+ if (not _master) {
+ const fs_path master_tx_fe_path =
+ master_fe_base_path(_radio_slot) / fs_path("tx_frontends") / chan;
+ UHD_LOG_TRACE(unique_id(), "Slave getting TX frequency");
+ return _tree->access<double>(master_tx_fe_path / "freq" / "value").get();
+ }
+ return radio_ctrl_impl::get_tx_frequency(chan);
+}
+
+double magnesium_radio_ctrl_impl::get_rx_frequency(
+ const size_t chan)
+{
+ UHD_LOG_TRACE(unique_id(),
+ "get_rx_frequency(chan=" << chan << ")");
+ if (not _master) {
+ const fs_path master_rx_fe_path =
+ master_fe_base_path(_radio_slot) / fs_path("rx_frontends") / chan;
+ UHD_LOG_TRACE(unique_id(), "Slave getting RX frequency");
+ return _tree->access<double>(master_rx_fe_path / "freq" / "value").get();
+ }
+ return radio_ctrl_impl::get_rx_frequency(chan);
+}
+
double magnesium_radio_ctrl_impl::set_rx_bandwidth(
const double bandwidth,
const size_t chan
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
index c8597fdf7..7d67a7263 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
@@ -48,7 +48,7 @@ public:
/************************************************************************
* API calls
***********************************************************************/
- // Note: We use the cached values in radio_ctrl_impl, so most getters are
+ // Note: We use the cached values in radio_ctrl_impl, so most getters are
// not reimplemented here
double set_rate(double rate);
@@ -57,9 +57,10 @@ public:
double set_tx_frequency(const double freq, const size_t chan);
double set_rx_frequency(const double freq, const size_t chan);
+ double get_rx_frequency(const size_t chan);
+ double get_tx_frequency(const size_t chan);
double set_tx_bandwidth(const double bandwidth, const size_t chan);
double set_rx_bandwidth(const double bandwidth, const size_t chan);
-
std::vector<std::string> get_rx_lo_names(const size_t chan);
std::vector<std::string> get_rx_lo_sources(
const std::string &name,
@@ -89,7 +90,6 @@ public:
double set_tx_gain(const double gain, const size_t chan);
double set_rx_gain(const double gain, const size_t chan);
-
size_t get_chan_from_dboard_fe(const std::string &fe, const direction_t dir);
std::string get_dboard_fe_from_chan(const size_t chan, const direction_t dir);
@@ -113,7 +113,6 @@ private:
//! Init a subtree for the RF frontends
void _init_frontend_subtree(
uhd::property_tree::sptr subtree,
- const size_t fe_chan_idx,
const size_t chan_idx
);
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
index 0d047c5d9..dfa4482b4 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
@@ -185,11 +185,10 @@ void magnesium_radio_ctrl_impl::_init_defaults()
void magnesium_radio_ctrl_impl::_init_frontend_subtree(
uhd::property_tree::sptr subtree,
- const size_t fe_chan_idx,
const size_t chan_idx
) {
- const fs_path tx_fe_path = fs_path("tx_frontends") / fe_chan_idx;
- const fs_path rx_fe_path = fs_path("rx_frontends") / fe_chan_idx;
+ const fs_path tx_fe_path = fs_path("tx_frontends") / chan_idx;
+ const fs_path rx_fe_path = fs_path("rx_frontends") / chan_idx;
UHD_LOG_TRACE(unique_id(),
"Adding non-RFNoC block properties for channel " << chan_idx <<
" to prop tree path " << tx_fe_path << " and " << rx_fe_path);
@@ -342,127 +341,14 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree(
void magnesium_radio_ctrl_impl::_init_prop_tree()
{
- fs_path gain_mode_path =
- _root_path.branch_path()
- / str(boost::format("Radio_%d") % ((get_block_id().get_block_count()/2)*2))
- / "args/0/gain_mode/value";
- UHD_LOG_DEBUG("GAIN_MODE_STRING","Gain mode path " << gain_mode_path);
- std::string gain_mode = _tree->access<std::string>(gain_mode_path).get();
- UHD_LOG_DEBUG("GAIN_MODE_STRING","Gain mode string" << gain_mode);
-
- /**** Set up legacy compatible properties ******************************/
- // For use with multi_usrp APIs etc.
- // For legacy prop tree init:
- // TODO: determine DB number
const fs_path fe_base = fs_path("dboards") / _radio_slot;
- const std::vector<uhd::direction_t> dir({ RX_DIRECTION, TX_DIRECTION });
- const std::vector<std::string> fe({ "rx_frontends", "tx_frontends" });
- const std::vector<std::string> ant({ "RX" , "TX" });
- //const size_t RX_IDX = 0;
- // const size_t TX_IDX = 1;
- //this->_dsa_set_gain(0.5,0,RX_DIRECTION);
- for (size_t fe_idx = 0; fe_idx < fe.size(); ++fe_idx)
- {
- const fs_path fe_direction_path = fe_base / fe[fe_idx];
- for (size_t chan = 0; chan < MAGNESIUM_NUM_CHANS; ++chan)
- {
- const fs_path fe_path = fe_direction_path / chan;
- UHD_LOG_TRACE(unique_id(), "Adding FE at " << fe_path);
- // Shared TX/RX attributes
- //{
- //auto ad9371_min_gain = (fe_idx == RX_IDX) ? AD9371_MIN_RX_GAIN : AD9371_MIN_TX_GAIN;
- //auto ad9371_max_gain = (fe_idx == RX_IDX) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN;
- //auto ad9371_gain_step = (fe_idx == RX_IDX) ? AD9371_RX_GAIN_STEP : AD9371_TX_GAIN_STEP;
- //auto dsa_min_gain = DSA_MIN_GAIN;
- //auto dsa_max_gain = DSA_MAX_GAIN;
- //auto dsa_gain_step = DSA_GAIN_STEP;
- //auto all_min_gain = (fe_idx == RX_IDX) ? ALL_RX_MIN_GAIN : ALL_TX_MIN_GAIN;
- //auto all_max_gain = (fe_idx == RX_IDX) ? ALL_TX_MAX_GAIN : ALL_TX_MAX_GAIN;
- //auto all_gain_step = 0.5;
- //if (gain_mode == "auto"){
- //ad9371_min_gain = 0;
- //ad9371_max_gain = 0;
- //ad9371_gain_step = 0;
- //dsa_min_gain = 0;
- //dsa_max_gain = 0;
- //dsa_gain_step = 0;
- //}
- //if (gain_mode == "manual")
- //{
- //all_min_gain = 0 ;
- //all_max_gain = 0 ;
- //all_gain_step = 0 ;
-
- //}
- //auto dir_ = dir[fe_idx];
- ////Create gain property for mykonos
- //auto myk_set_gain_func = [this, chan, dir_](const double gain)
- //{
- //return this->_myk_set_gain(gain, chan, dir_);
- //};
- //auto myk_get_gain_func = [this, chan, dir_]()
- //{
- //return this->_myk_get_gain(chan, dir_);
- //};
-
- //_tree->create<double>(fe_path / "gains" / "ad9371" / "value")
- //.set(0)
- //.set_coercer(myk_set_gain_func)
- //.set_publisher(myk_get_gain_func);
- //_tree->create<meta_range_t>(fe_path / "gains" / "ad9371" / "range")
- //.set(meta_range_t(ad9371_min_gain, ad9371_max_gain, ad9371_gain_step));
- //// Create gain property for DSA
- //auto dsa_set_gain_func = [this, chan, dir_](const double gain)
- //{
- //return this->_dsa_set_gain(gain, chan, dir_);
- //};
- //auto dsa_get_gain_func = [this, chan, dir_]()
- //{
- //return this->_dsa_get_gain(chan, dir_);
- //};
- //_tree->create<double>(fe_path / "gains" / "dsa" / "value")
- //.set(0)
- //.set_coercer(dsa_set_gain_func)
- //.set_publisher(dsa_get_gain_func);
- //_tree->create<meta_range_t>(fe_path / "gains" / "dsa" / "range")
- //.set(meta_range_t(dsa_min_gain, dsa_max_gain, dsa_gain_step));
-
- //// Create gain property for all gains
- //auto set_all_gain_func = [this, chan, dir_](const double gain)
- //{
- //return this->_set_all_gain(gain, chan, dir_);
- //};
- //auto get_all_gain_func = [this, chan, dir_]()
- //{
- //return this->_get_all_gain(chan, dir_);
- //};
- //_tree->create<double>(fe_path / "gains" / "all" / "value")
- //.set(0)
- //.set_coercer(set_all_gain_func)
- //.set_publisher(get_all_gain_func);
- //_tree->create<meta_range_t>(fe_path / "gains" / "all" / "range")
- //.set(meta_range_t(all_min_gain, all_max_gain, all_gain_step));
-
- //}
- }
- }
-
-
- // TODO this might be wrong
- if (_master) {
- this->_init_frontend_subtree(_tree->subtree(fe_base), 0, 0);
- std::string slave_slot = (_radio_slot == "A") ? "B" : "D";
- UHD_LOG_TRACE(unique_id(),
- "Also registering props for slave radio " << slave_slot);
- this->_init_frontend_subtree(
- _tree->subtree(fs_path("dboards") / slave_slot), 0, 1);
- }
+ this->_init_frontend_subtree(_tree->subtree(fe_base), 0);
// TODO: When we go to one radio per dboard, the above if statement goes
// away, and instead we have something like this:
/*
*for (chan_idx = 0; chan_idx < MAGNESIUM_NUM_CHANS; chan_idx++) {
* this->_init_frontend_subtree(
- * _tree->get_subtree(fe_base), chan_idx, chan_idx);
+ * _tree->get_subtree(fe_base), chan_idx);
*}
*/