From b48cc6c48040eb89dd4e8072616cd26504731ba3 Mon Sep 17 00:00:00 2001 From: Trung N Tran Date: Tue, 31 Oct 2017 12:55:01 -0700 Subject: n3xx: add atr switch update for tx direction --- .../dboard/magnesium/magnesium_radio_ctrl_impl.cpp | 26 ++++++++++++++++++++-- .../dboard/magnesium/magnesium_radio_ctrl_impl.hpp | 6 ++++- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'host/lib') 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 c0b767a38..9240a9bdd 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -675,7 +675,7 @@ void magnesium_radio_ctrl_impl::_update_atr_switches( const std::string &ant ){ magnesium_cpld_ctrl::rx_sw1_t rx_sw1 = magnesium_cpld_ctrl::RX_SW1_RX2INPUT; - magnesium_cpld_ctrl::sw_trx_t sw_trx = magnesium_cpld_ctrl::SW_TRX_FROMLOWERFILTERBANKTXSW1; + magnesium_cpld_ctrl::sw_trx_t sw_trx = _sw_trx[chan]; bool trx_led = false, rx2_led = true; //bool tx_pa_enb = true, tx_amp_enb = true, tx_myk_en=true; @@ -719,8 +719,29 @@ void magnesium_radio_ctrl_impl::_update_atr_switches( false, true ); - } + if (dir == TX_DIRECTION){ + _cpld->set_tx_atr_bits( + chan, + magnesium_cpld_ctrl::ON, + true, + sw_trx, + true, + true, + true + ); + _cpld->set_rx_atr_bits( + chan, + magnesium_cpld_ctrl::IDLE, + rx_sw1, + false, + false, + false, + false, + false, + true + ); + }; } void magnesium_radio_ctrl_impl::_update_freq_switches( @@ -810,6 +831,7 @@ void magnesium_radio_ctrl_impl::_update_freq_switches( ); } } else { + //TODO : rememeber to cache _sw_trx for chan if (freq < MAGNESIUM_TX_BAND1_MIN_FREQ) { } else if (freq < MAGNESIUM_TX_BAND2_MIN_FREQ) { } else if (freq < MAGNESIUM_TX_BAND3_MIN_FREQ) { 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 7cebc168d..e2cfab304 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp @@ -222,7 +222,11 @@ private: //! All gain double _all_rx_gain = 0.0; double _all_tx_gain = 0.0; - + //! TRX switch state of 2 channels + std::map _sw_trx = { + {magnesium_cpld_ctrl::CHAN1, magnesium_cpld_ctrl::SW_TRX_FROMLOWERFILTERBANKTXSW1}, + {magnesium_cpld_ctrl::CHAN2, magnesium_cpld_ctrl::SW_TRX_FROMLOWERFILTERBANKTXSW1} + }; }; /* class radio_ctrl_impl */ }} /* namespace uhd::rfnoc */ -- cgit v1.2.3