diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-12-14 16:20:58 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:06:11 -0800 |
commit | 9e5fb0c49f7911e0e9f6e9390e81d9465304cfeb (patch) | |
tree | c54c9292f3d0b008b4e7c36ee1faa1f5f8833e68 | |
parent | 3ee587672022ed9b7093b22d25bc8e2a4432f618 (diff) | |
download | uhd-9e5fb0c49f7911e0e9f6e9390e81d9465304cfeb.tar.gz uhd-9e5fb0c49f7911e0e9f6e9390e81d9465304cfeb.tar.bz2 uhd-9e5fb0c49f7911e0e9f6e9390e81d9465304cfeb.zip |
mg: Add 'identify' block arg, will toggle LEDs for identification
5 files changed, 51 insertions, 1 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp index a1e9bf3a3..d6b6011d9 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp @@ -272,7 +272,7 @@ public: const bool defer_commit = false ); - /*! ATR settings: LEDs, input switches for RX side + /*! ATR settings: Amp, Mykonos settings for RX side * * Note: These ATR states are not frequency dependent (or dependent on * anything other than RX ATR state). diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp index d1ef730b7..fd92500b0 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp @@ -40,6 +40,35 @@ using namespace uhd; using namespace uhd::usrp; using namespace uhd::rfnoc; using namespace uhd::math::fp_compare; + +void magnesium_radio_ctrl_impl::_identify_with_leds( + const int identify_duration +) { + auto end_time = std::chrono::steady_clock::now() + + std::chrono::seconds(identify_duration); + bool led_state = true; + while (std::chrono::steady_clock::now() < end_time) { + _cpld->set_tx_atr_bits( + magnesium_cpld_ctrl::BOTH, + magnesium_cpld_ctrl::ANY, + led_state, + false, + false, + true + ); + _cpld->set_rx_input_atr_bits( + magnesium_cpld_ctrl::BOTH, + magnesium_cpld_ctrl::ANY, + magnesium_cpld_ctrl::RX_SW1_TXRXINPUT, /* whatever */ + led_state, + led_state + ); + led_state = !led_state; + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + _cpld->reset(); +} + void magnesium_radio_ctrl_impl::_update_atr_switches( const magnesium_cpld_ctrl::chan_sel_t chan, const direction_t dir, 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 7796b8b47..f54112ac8 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -19,6 +19,7 @@ #include <boost/format.hpp> #include <sstream> #include <cmath> +#include <cstdlib> using namespace uhd; using namespace uhd::usrp; @@ -755,6 +756,18 @@ void magnesium_radio_ctrl_impl::set_rpc_client( ) ); + if (_master and block_args.has_key("identify")) { + const std::string identify_val = block_args.get("identify"); + int identify_duration = std::atoi(identify_val.c_str()); + if (identify_duration == 0) { + identify_duration = 5; + } + UHD_LOG_INFO(unique_id(), + "Running LED identification process for " << identify_duration + << " seconds."); + _identify_with_leds(identify_duration); + } + // Note: MCR gets set during the init() call (prior to this), which takes // in arguments from the device args. So if block_args contains a // master_clock_rate key, then it should better be whatever the device is 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 b706c565b..33c147f53 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp @@ -205,9 +205,16 @@ private: const size_t chan, const uhd::direction_t dir ); + /************************************************************************** * CPLD Controls (implemented in magnesium_radio_ctrl_cpld.cpp) *************************************************************************/ + //! Blink the front-panel LEDs for \p identify_duration, then reset CPLD + // and resume normal operation. + void _identify_with_leds( + const int identify_duration + ); + void _update_rx_freq_switches( const double freq, const bool bypass_lnas, 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 2b842cbcf..2a75a52c2 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp @@ -553,3 +553,4 @@ void magnesium_radio_ctrl_impl::_init_mpm_sensors( ; } } + |