aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
diff options
context:
space:
mode:
authorTrung N Tran <trung.tran@ettus.com>2018-01-04 11:32:24 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-12 16:26:03 -0800
commit00402669d08b206f3b0367f5f4e3383d25e7944b (patch)
tree1ab5948382dde42f164499ce8e1cd68c3c4d959c /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
parent7ffea3746be77cf926db946987ee83d48a33c798 (diff)
downloaduhd-00402669d08b206f3b0367f5f4e3383d25e7944b.tar.gz
uhd-00402669d08b206f3b0367f5f4e3383d25e7944b.tar.bz2
uhd-00402669d08b206f3b0367f5f4e3383d25e7944b.zip
mg: add facility that handle individual gain
-Create name for each gain/att element -Create property tree entry for each gain and their handlers. -Create gain profile that control how gain distributed. Right now, it is either "default" or "manual".
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
index 449b772b3..f934e5794 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
@@ -28,9 +28,21 @@ double magnesium_radio_ctrl_impl::_set_all_gain(
const size_t ad9371_chan = _master ? 0 : 1; ;// FIXME: use chan when 2 radios
const magnesium_cpld_ctrl::chan_sel_t chan_sel =
_master ? magnesium_cpld_ctrl::CHAN1 : magnesium_cpld_ctrl::CHAN2;
- const auto gain_tuple = (dir == RX_DIRECTION) ?
- get_rx_gain_tuple(gain, _map_freq_to_rx_band(freq)) :
- get_tx_gain_tuple(gain, _map_freq_to_tx_band(freq));
+ gain_tuple_t gain_tuple = (dir == RX_DIRECTION) ?
+ get_rx_gain_tuple(gain, _map_freq_to_rx_band(freq)):
+ get_tx_gain_tuple(gain, _map_freq_to_tx_band(freq));
+
+ if (_gain_profile[dir] == "manual"){
+ UHD_LOG_TRACE(unique_id(), "Manual gain mode. Getting gain from property tree.");
+ gain_tuple = {
+ DSA_MAX_GAIN - _dsa_att[dir],
+ ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN) - _ad9371_att[dir],
+ _amp_bypass[dir]};
+ }else if (_gain_profile[dir] == "default"){
+ UHD_LOG_TRACE(unique_id(), "Getting gain from gain table.");
+ }else {
+ UHD_LOG_ERROR(unique_id(), "Unsupported gain mode: " << _gain_profile[dir])
+ }
const double ad9371_gain =
((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN)
- gain_tuple.ad9371_att;