aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/eiscat
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-05-12 21:34:18 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:53 -0800
commit451c07a8317f7052b4c48383b0a32a60fff920d5 (patch)
tree017aaf3d8bf59f443d040a8ee7c51284f7895662 /host/lib/usrp/dboard/eiscat
parent5a4a78de6104333307da68b6a0dfc516291ede69 (diff)
downloaduhd-451c07a8317f7052b4c48383b0a32a60fff920d5.tar.gz
uhd-451c07a8317f7052b4c48383b0a32a60fff920d5.tar.bz2
uhd-451c07a8317f7052b4c48383b0a32a60fff920d5.zip
eiscat: Enabled eiscat db to work with rfnoc_rx_to_file
Diffstat (limited to 'host/lib/usrp/dboard/eiscat')
-rw-r--r--host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.cpp103
-rw-r--r--host/lib/usrp/dboard/eiscat/eiscat_radio_ctrl_impl.hpp3
2 files changed, 64 insertions, 42 deletions
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 */