diff options
-rw-r--r-- | host/include/uhd/rfnoc/blocks/ddc_eiscat.xml | 113 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/blocks/radio_eiscat.xml | 19 | ||||
-rw-r--r-- | host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp | 103 | ||||
-rw-r--r-- | host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp | 3 |
4 files changed, 185 insertions, 53 deletions
diff --git a/host/include/uhd/rfnoc/blocks/ddc_eiscat.xml b/host/include/uhd/rfnoc/blocks/ddc_eiscat.xml index 93cf8371f..6cd0f117c 100644 --- a/host/include/uhd/rfnoc/blocks/ddc_eiscat.xml +++ b/host/include/uhd/rfnoc/blocks/ddc_eiscat.xml @@ -57,10 +57,6 @@ <type>double</type> <value>0.0</value> <port>0</port> - <!--<action>--> - <!--SR_WRITE("CORDIC_FREQ", $cordic_freq)--> - <!--</action>--> - <!--FIXME Calculate this properly--> </arg> <arg> <name>input_rate</name> @@ -96,10 +92,6 @@ <type>double</type> <value>0.0</value> <port>1</port> - <!--<action>--> - <!--SR_WRITE("CORDIC_FREQ", $cordic_freq)--> - <!--</action>--> - <!--FIXME Calculate this properly--> </arg> <arg> <name>input_rate</name> @@ -130,6 +122,111 @@ <value>1.0</value> <port>1</port> </arg> + <arg> + <name>freq</name> + <type>double</type> + <value>0.0</value> + <port>2</port> + </arg> + <arg> + <name>input_rate</name> + <type>double</type> + <value>1.0</value> + <port>2</port> + <check>GE($input_rate, 0.0)</check> + <check_message>The input rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>output_rate</name> + <type>double</type> + <value>1.0</value> + <port>2</port> + <check>GE($output_rate, 0.0)</check> + <check_message>The output rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>fullscale</name> + <type>double</type> + <value>1.0</value> + <port>2</port> + <check>GE($fullscale, 0.0)</check> + </arg> + <arg> + <name>scalar_correction</name> + <type>double</type> + <value>1.0</value> + <port>2</port> + </arg> + <arg> + <name>freq</name> + <type>double</type> + <value>0.0</value> + <port>3</port> + </arg> + <arg> + <name>input_rate</name> + <type>double</type> + <value>1.0</value> + <port>3</port> + <check>GE($input_rate, 0.0)</check> + <check_message>The input rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>output_rate</name> + <type>double</type> + <value>1.0</value> + <port>3</port> + <check>GE($output_rate, 0.0)</check> + <check_message>The output rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>fullscale</name> + <type>double</type> + <value>1.0</value> + <port>3</port> + <check>GE($fullscale, 0.0)</check> + </arg> + <arg> + <name>scalar_correction</name> + <type>double</type> + <value>1.0</value> + <port>3</port> + </arg> + <arg> + <name>freq</name> + <type>double</type> + <value>0.0</value> + <port>4</port> + </arg> + <arg> + <name>input_rate</name> + <type>double</type> + <value>1.0</value> + <port>4</port> + <check>GE($input_rate, 0.0)</check> + <check_message>The input rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>output_rate</name> + <type>double</type> + <value>1.0</value> + <port>4</port> + <check>GE($output_rate, 0.0)</check> + <check_message>The output rate must be a positive value (in Hz).</check_message> + </arg> + <arg> + <name>fullscale</name> + <type>double</type> + <value>1.0</value> + <port>4</port> + <check>GE($fullscale, 0.0)</check> + </arg> + <arg> + <name>scalar_correction</name> + <type>double</type> + <value>1.0</value> + <port>4</port> + </arg> </args> <!--All the connections to the outside world are listed in 'ports':--> <ports> diff --git a/host/include/uhd/rfnoc/blocks/radio_eiscat.xml b/host/include/uhd/rfnoc/blocks/radio_eiscat.xml index 03b440943..e6a81e800 100644 --- a/host/include/uhd/rfnoc/blocks/radio_eiscat.xml +++ b/host/include/uhd/rfnoc/blocks/radio_eiscat.xml @@ -9,14 +9,20 @@ <!-- Registers --> <registers> <setreg> + <!--1-Bit register. Enable Beam Stream Channels. There are 10, so this is a 10 bit value. --> + <name>SR_RX_STREAM_ENABLE</name> + <address>159</address> + </setreg> + <setreg> <!--1-Bit register. Are we sending the upper or lower 5 beam contirbutions? --> <name>SR_BEAMS_TO_NEIGHBOR</name> - <address>135</address> + <address>202</address> + <value>2</value> </setreg> <setreg> <!--1-Bit register. Are we expecting previous contributions? 1==yes we are --> <name>SR_PREV_OR_NULL</name> - <address>136</address> + <address>203</address> </setreg> <setreg> <!--1-Bit register. Are we expecting previous contributions? 1==yes we are --> @@ -84,7 +90,14 @@ <arg> <name>neighbors</name> <type>int</type> - <value>0</value> + <value>2</value> + <action>SR_WRITE("SR_BEAMS_TO_NEIGHBOR", 2)</action> + </arg> + <arg> + <name>channel_enable</name> + <type>int</type> + <value>1</value> + <action>SR_WRITE("SR_RX_STREAM_ENABLE", 1)</action> </arg> <arg> <name>gain</name> 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 e65f2f6df..a8f11b4aa 100644 --- a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp @@ -18,70 +18,105 @@ #include "eiscat_radio_ctrl_impl.hpp" #include <uhd/utils/log.hpp> -#include <uhd/rfnoc/node_ctrl_base.hpp> -#include <uhd/transport/chdr.hpp> #include <uhd/utils/math.hpp> +#include <uhd/rfnoc/node_ctrl_base.hpp> +#include <uhd/types/ranges.hpp> #include <boost/algorithm/string.hpp> #include <boost/make_shared.hpp> #include <boost/date_time/posix_time/posix_time_io.hpp> +#include <boost/format.hpp> using namespace uhd; using namespace uhd::usrp; using namespace uhd::rfnoc; -static const size_t IO_MASTER_RADIO = 0; static const double EISCAT_TICK_RATE = 208e6; // Hz static const double EISCAT_RADIO_RATE = 104e6; // Hz static const double EISCAT_CENTER_FREQ = 104e6; // Hz static const double EISCAT_DEFAULT_GAIN = 0.0; // Hz static const double EISCAT_DEFAULT_BANDWIDTH = 52e6; // Hz -static const std::string EISCAT_ANTENNA_NAME = "Rx"; +static const char* EISCAT_ANTENNA_NAME = "Rx"; static const size_t EISCAT_NUM_CHANS = 5; +static const size_t EISCAT_NUM_FRONTENDS = 16; UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(eiscat_radio_ctrl) { UHD_LOG_TRACE("EISCAT", "eiscat_radio_ctrl_impl::ctor() "); - _radio_type = (get_block_id().get_block_count() == IO_MASTER_RADIO) ? PRIMARY : SECONDARY; - _radio_slot = (get_block_id().get_block_count() == IO_MASTER_RADIO) ? "A" : "B"; - UHD_LOG_TRACE("EISCAT", "Radio slot: " << _radio_slot); const size_t num_chans = get_output_ports().size(); UHD_ASSERT_THROW(num_chans == EISCAT_NUM_CHANS); UHD_LOG_TRACE("EISCAT", "Number of channels: " << num_chans); UHD_LOG_TRACE("EISCAT", "Setting tick rate to " << EISCAT_TICK_RATE/1e6 << " MHz"); - radio_ctrl_impl::set_rate(EISCAT_TICK_RATE); - - // For legacy prop tree init: - fs_path fe_path = fs_path("dboards" / _radio_slot / "rx_frontends"); - // Init parent class + /**** Configure the radio itself ***************************************/ + radio_ctrl_impl::set_rate(EISCAT_TICK_RATE); for (size_t chan = 0; chan < num_chans; chan++) { radio_ctrl_impl::set_rx_frequency(EISCAT_CENTER_FREQ, chan); radio_ctrl_impl::set_rx_gain(EISCAT_DEFAULT_GAIN, chan); radio_ctrl_impl::set_rx_antenna(EISCAT_ANTENNA_NAME, chan); radio_ctrl_impl::set_rx_bandwidth(EISCAT_DEFAULT_BANDWIDTH, chan); + } - // Legacy prop tree paths (for use with multi_usrp API) - _tree->access<std::string>(fe_path / chan / "antenna" / "value") - .add_coerced_subscriber(boost::bind(&eiscat_radio_ctrl_impl::set_rx_antenna, this, _1, chan)) - .set_publisher(boost::bind(&radio_ctrl_impl::get_rx_antenna, this, chan)) + /**** Set up legacy compatible properties ******************************/ + // For use with multi_usrp APIs etc. + // For legacy prop tree init: + fs_path fe_path = fs_path("dboards") / "A" / "rx_frontends"; + + // The EISCAT dboards have 16 frontends total, but they map to 5 channels + // each through a matrix of FIR filters and summations. UHD will get much + // less confused if we create 5 fake frontends, because that's also the + // number of channels. Since we have no control over the frontends, + // nothing is lost here. + for (size_t fe_idx = 0; fe_idx < EISCAT_NUM_CHANS; fe_idx++) { + _tree->create<std::string>(fe_path / fe_idx / "name") + .set(str(boost::format("EISCAT Rx %d") % fe_idx)) + ; + _tree->create<std::string>(fe_path / fe_idx / "connection") + .set("I") + ; + _tree->create<std::string>(fe_path / fe_idx / "antenna" / "value") + .set(EISCAT_ANTENNA_NAME) + //.add_coerced_subscriber(boost::bind(&eiscat_radio_ctrl_impl::set_rx_antenna, this, _1, 0)) + ////.set_publisher(boost::bind(&radio_ctrl_impl::get_rx_antenna, this, 0)) + //.set_publisher([](){ return EISCAT_ANTENNA_NAME; }) ; - _tree->access<double>(fe_path / chan / "freq" / "value") - .set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_frequency, this, _1, chan)) - .set_publisher(boost::bind(&radio_ctrl_impl::get_rx_frequency, this, chan)) + _tree->create<std::vector<std::string>>(fe_path / fe_idx / "antenna" / "options") + .set(std::vector<std::string>(1, "Rx")) ; - _tree->access<double>(fe_path / chan / "gain" / "value") - .set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_gain, this, _1, chan)) - .set_publisher(boost::bind(&radio_ctrl_impl::get_rx_gain, this, chan)) + _tree->create<double>(fe_path / fe_idx / "freq" / "value") + .set(EISCAT_CENTER_FREQ) + //.set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_frequency, this, _1, 0)) + ////.set_publisher(boost::bind(&radio_ctrl_impl::get_rx_frequency, this, 0)) ; - _tree->access<double>(fe_path / chan / "bandwidth" / "value") - .set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_bandwidth, this, _1, chan)) - .set_publisher(boost::bind(&radio_ctrl_impl::get_rx_bandwidth, this, chan)) + _tree->create<meta_range_t>(fe_path / fe_idx / "freq" / "range") + .set(meta_range_t(EISCAT_CENTER_FREQ, EISCAT_CENTER_FREQ)) + ; + _tree->create<double>(fe_path / fe_idx / "gains" / "null" / "value") + .set(EISCAT_DEFAULT_GAIN) + //.set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_gain, this, _1, 0)) + //.set_publisher(boost::bind(&radio_ctrl_impl::get_rx_gain, this, 0)) + ; + _tree->create<meta_range_t>(fe_path / fe_idx / "gains" / "null" / "range") + .set(meta_range_t(EISCAT_DEFAULT_GAIN, EISCAT_DEFAULT_GAIN)) + ; + _tree->create<double>(fe_path / fe_idx / "bandwidth" / "value") + .set(EISCAT_DEFAULT_BANDWIDTH) + //.set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rx_bandwidth, this, _1, 0)) + //.set_publisher(boost::bind(&radio_ctrl_impl::get_rx_bandwidth, this, 0)) + ; + _tree->create<meta_range_t>(fe_path / fe_idx / "bandwidth" / "range") + .set(meta_range_t(EISCAT_DEFAULT_BANDWIDTH, EISCAT_DEFAULT_BANDWIDTH)) ; - // TODO: Add ranges or options for all of these. Not high-prio. } - UHD_HERE(); + // There is only ever one EISCAT radio per dboard, so this should be unset + // when we reach this line: + UHD_ASSERT_THROW(not _tree->exists("tick_rate")); + _tree->create<double>("tick_rate") + //.set_coercer(boost::bind(&eiscat_radio_ctrl_impl::set_rate, this, _1)) + .set(EISCAT_TICK_RATE) + ; + UHD_VAR((_tree->exists(fs_path("time/cmd")))); } @@ -152,22 +187,12 @@ double eiscat_radio_ctrl_impl::set_rate(double rate) size_t eiscat_radio_ctrl_impl::get_chan_from_dboard_fe(const std::string &fe, const uhd::direction_t dir) { - if (dir != uhd::direction_t::RX_DIRECTION) { - throw uhd::runtime_error("Unable to get chan from fe, EISCAT only has Rx frontends"); - } - - // A:0 -> A:7, B:0 -> B:7 - return boost::lexical_cast<size_t>(fe.substr(2)); + return boost::lexical_cast<size_t>(fe); } std::string eiscat_radio_ctrl_impl::get_dboard_fe_from_chan(const size_t chan, const uhd::direction_t dir) { - if (dir != uhd::direction_t::RX_DIRECTION) { - throw uhd::runtime_error("Unable to get fe from chan, EISCAT only has Rx frontends"); - } - - // A:0 -> A:7, B:0 -> B:7 - return _radio_slot + ':' + std::to_string(chan); + return std::to_string(chan); } double eiscat_radio_ctrl_impl::get_output_samp_rate(size_t /* port */) 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 5ffdffc6a..f90e15c8b 100644 --- a/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp @@ -60,10 +60,7 @@ public: double get_output_samp_rate(size_t port); private: - enum radio_connection_t { PRIMARY, SECONDARY }; - radio_connection_t _radio_type; - std::string _radio_slot; }; /* class radio_ctrl_impl */ }} /* namespace uhd::rfnoc */ |