From ab83e9259b6fc45ae8258bd0b4252e3b6d7260c5 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 4 Jan 2018 07:21:00 -0800 Subject: mg: Use enums for all bands, move freq mapping to single location This removes the need to re-implement the band checks (in particular, the low band check) in multiple places, potentially causing confusion. Signed-off-by: Trung Tran Reviewed-by: Trung Tran --- host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp') 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 d7869a24a..449b772b3 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp @@ -26,9 +26,11 @@ double magnesium_radio_ctrl_impl::_set_all_gain( "chan=" << chan << ", " "dir=" << dir); const size_t ad9371_chan = _master ? 0 : 1; ;// FIXME: use chan when 2 radios - magnesium_cpld_ctrl::chan_sel_t chan_sel = + const magnesium_cpld_ctrl::chan_sel_t chan_sel = _master ? magnesium_cpld_ctrl::CHAN1 : magnesium_cpld_ctrl::CHAN2; - const auto gain_tuple = get_gain_tuple(gain, freq, dir); + 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)); const double ad9371_gain = ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN) - gain_tuple.ad9371_att; -- cgit v1.2.3