aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
diff options
context:
space:
mode:
authorTrung Tran <trung.tran@ettus.com>2017-11-10 07:34:54 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:05 -0800
commite88169017333f590ef6980652a8054a41f729568 (patch)
tree2e098b331767862adc4c75915c50307a5ecef553 /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
parent95545e393518d880eeb2833be12d98488c7f6e40 (diff)
downloaduhd-e88169017333f590ef6980652a8054a41f729568.tar.gz
uhd-e88169017333f590ef6980652a8054a41f729568.tar.bz2
uhd-e88169017333f590ef6980652a8054a41f729568.zip
mg: master and slave radio sharing frequency
This addresses the fact that two Mg Radio RFNoC blocks share a single LO in both Tx and Rx direction. When setting the frequency on one, the appropriate actions are now triggered on the other side. The same goes for getters, they now actually tell the truth.
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp62
1 files changed, 55 insertions, 7 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