From 59330ad80cfdd0694fd856c10ca84378dc54ff12 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 6 Jun 2017 11:28:20 -0700 Subject: eiscat: Make use of known number of dboards --- .../usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp | 20 ++++++++++++++++++++ .../usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp | 4 ++++ 2 files changed, 24 insertions(+) (limited to 'host') diff --git a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp index ea1e31102..35260150f 100644 --- a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp @@ -476,6 +476,20 @@ void eiscat_radio_ctrl_impl::set_rpc_client( ) { _rpcc = rpcc; _block_args = block_args; + auto dboard_info = + _rpcc->request>>( + "get_dboard_info" + ); + _num_dboards = dboard_info.size(); + UHD_LOG_DEBUG("EISCAT", "Using " << _num_dboards << " daughterboards."); + if (_num_dboards == 1) { + UHD_LOG_WARNING("EISCAT", + "Found 1 dboard, expected 2 for optimal operation." + ); + } else if (_num_dboards > 2) { + UHD_LOG_ERROR("EISCAT", "Detected too many dboards: " << _num_dboards); + throw uhd::runtime_error("Too many dboards detected."); + } UHD_LOG_INFO( "EISCAT", @@ -684,12 +698,18 @@ void eiscat_radio_ctrl_impl::enable_counter(bool enable) bool eiscat_radio_ctrl_impl::assert_adcs_deframers() { + if (_num_dboards == 1) { + return _rpcc->request_with_token("db_0_init_adcs_and_deframers"); + } return _rpcc->request_with_token("db_0_init_adcs_and_deframers") and _rpcc->request_with_token("db_1_init_adcs_and_deframers"); } bool eiscat_radio_ctrl_impl::assert_deframer_status() { + if (_num_dboards == 1) { + return _rpcc->request_with_token("db_0_check_deframer_status"); + } return _rpcc->request_with_token("db_0_check_deframer_status") and _rpcc->request_with_token("db_1_check_deframer_status"); } diff --git a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp index 2da01ed03..6210c8aab 100644 --- a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp @@ -276,6 +276,10 @@ private: */ size_t _num_ports; + //! Running with 1 dboard is theoretically possible; thus, store the + // number of active dboards. + size_t _num_dboards = 0; + //! Additional block args; gets set during set_rpc_client() uhd::device_addr_t _block_args; -- cgit v1.2.3