mirror of
https://github.com/fairwaves/UHD-Fairwaves.git
synced 2025-11-03 05:23:14 +00:00
umtrx: setup lms6002d_ctrl and register in prop tree
This commit is contained in:
@@ -564,84 +564,8 @@ lms6002d_ctrl_impl::lms6002d_ctrl_impl(uhd::spi_iface::sptr spiface, const int l
|
||||
// Perform autocalibration
|
||||
lms.auto_calibration(_clock_rate, 0xf);
|
||||
|
||||
/*
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Register RX properties
|
||||
////////////////////////////////////////////////////////////////////
|
||||
this->get_rx_subtree()->create<std::string>("name")
|
||||
.set(std::string(str(boost::format("%s - %s") % get_rx_id().to_pp_string() % get_subdev_name())));
|
||||
|
||||
BOOST_FOREACH(const std::string &name, lms_rx_gain_ranges.keys()){
|
||||
this->get_rx_subtree()->create<double>("gains/"+name+"/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_rx_gain, this, _1, name))
|
||||
.set((lms_rx_gain_ranges[name].start()+lms_rx_gain_ranges[name].stop())/2.0);
|
||||
this->get_rx_subtree()->create<meta_range_t>("gains/"+name+"/range")
|
||||
.set(lms_rx_gain_ranges[name]);
|
||||
}
|
||||
|
||||
this->get_rx_subtree()->create<double>("freq/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_freq, this, dboard_iface::UNIT_RX, _1));
|
||||
this->get_rx_subtree()->create<meta_range_t>("freq/range")
|
||||
.set(lms_freq_range);
|
||||
|
||||
this->get_rx_subtree()->create<std::string>("antenna/value")
|
||||
.subscribe(boost::bind(&lms6002d_ctrl_impl::set_rx_ant, this, _1))
|
||||
.set("RX1");
|
||||
this->get_rx_subtree()->create<std::vector<std::string> >("antenna/options")
|
||||
.set(lms_rx_antennas);
|
||||
// In LMS tuning procedure doesn't finish until LO is locked, so we declare it's always locked.
|
||||
this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked")
|
||||
.set(sensor_value_t("LO", true, "locked", "unlocked"));
|
||||
this->get_rx_subtree()->create<std::string>("connection").set("IQ");
|
||||
this->get_rx_subtree()->create<bool>("enabled")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_enabled, this, dboard_iface::UNIT_RX, _1));
|
||||
|
||||
this->get_rx_subtree()->create<bool>("use_lo_offset").set(false);
|
||||
this->get_rx_subtree()->create<double>("bandwidth/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_rx_bandwidth, this, _1))
|
||||
.set(double(2*0.75e6));
|
||||
this->get_rx_subtree()->create<meta_range_t>("bandwidth/range")
|
||||
.set(lms_bandwidth_range);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Register TX properties
|
||||
////////////////////////////////////////////////////////////////////
|
||||
this->get_tx_subtree()->create<std::string>("name")
|
||||
.set(std::string(str(boost::format("%s - %s") % get_tx_id().to_pp_string() % get_subdev_name())));
|
||||
|
||||
BOOST_FOREACH(const std::string &name, lms_tx_gain_ranges.keys()){
|
||||
this->get_tx_subtree()->create<double>("gains/"+name+"/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_tx_gain, this, _1, name))
|
||||
.set((lms_tx_gain_ranges[name].start()+lms_tx_gain_ranges[name].stop())/2.0);
|
||||
this->get_tx_subtree()->create<meta_range_t>("gains/"+name+"/range")
|
||||
.set(lms_tx_gain_ranges[name]);
|
||||
}
|
||||
|
||||
this->get_tx_subtree()->create<double>("freq/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_freq, this, dboard_iface::UNIT_TX, _1));
|
||||
this->get_tx_subtree()->create<meta_range_t>("freq/range")
|
||||
.set(lms_freq_range);
|
||||
|
||||
this->get_tx_subtree()->create<std::string>("antenna/value")
|
||||
.subscribe(boost::bind(&lms6002d_ctrl_impl::set_tx_ant, this, _1))
|
||||
.set("TX2");
|
||||
this->get_tx_subtree()->create<std::vector<std::string> >("antenna/options")
|
||||
.set(lms_tx_antennas);
|
||||
// In LMS tuning procedure doesn't finish until LO is locked, so we declare it's always locked.
|
||||
this->get_tx_subtree()->create<sensor_value_t>("sensors/lo_locked")
|
||||
.set(sensor_value_t("LO", true, "locked", "unlocked"));
|
||||
this->get_tx_subtree()->create<std::string>("connection").set("IQ");
|
||||
this->get_tx_subtree()->create<bool>("enabled")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_enabled, this, dboard_iface::UNIT_TX, _1));
|
||||
|
||||
this->get_tx_subtree()->create<bool>("use_lo_offset").set(false);
|
||||
this->get_tx_subtree()->create<double>("bandwidth/value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl_impl::set_tx_bandwidth, this, _1))
|
||||
.set(double(2*0.75e6));
|
||||
this->get_tx_subtree()->create<meta_range_t>("bandwidth/range")
|
||||
.set(lms_bandwidth_range);
|
||||
|
||||
// UmTRX specific calibration
|
||||
/*
|
||||
this->get_tx_subtree()->create<uint8_t>("lms6002d/tx_dc_i/value")
|
||||
.subscribe(boost::bind(&lms6002d_ctrl_impl::_set_tx_vga1dc_i_int, this, _1))
|
||||
.publish(boost::bind(&umtrx_lms6002d_dev::get_tx_vga1dc_i_int, &lms));
|
||||
|
||||
@@ -213,6 +213,102 @@ umtrx_impl::umtrx_impl(const device_addr_t &device_addr)
|
||||
.publish(boost::bind(&tx_dsp_core_200::get_freq_range, _tx_dsps[dspno]));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// create RF frontend interfacing
|
||||
////////////////////////////////////////////////////////////////////
|
||||
_lms_ctrl["A"] = lms6002d_ctrl::make(_iface, SPI_SS_LMS1, SPI_SS_AUX1, this->get_master_clock_rate());
|
||||
_lms_ctrl["B"] = lms6002d_ctrl::make(_iface, SPI_SS_LMS2, SPI_SS_AUX2, this->get_master_clock_rate());
|
||||
|
||||
BOOST_FOREACH(const std::string &fe_name, _lms_ctrl.keys())
|
||||
{
|
||||
lms6002d_ctrl::sptr ctrl = _lms_ctrl[fe_name];
|
||||
|
||||
const fs_path rx_rf_fe_path = mb_path / "dboards" / fe_name / "rx_frontends" / "0";
|
||||
const fs_path tx_rf_fe_path = mb_path / "dboards" / fe_name / "tx_frontends" / "0";
|
||||
|
||||
_tree->create<std::string>(rx_rf_fe_path / "name").set("LMS-RX-FE");
|
||||
_tree->create<std::string>(tx_rf_fe_path / "name").set("LMS-TX-FE");
|
||||
|
||||
//sensors -- TODO needs lo locked
|
||||
_tree->create<int>(rx_rf_fe_path / "sensors"); //empty TODO
|
||||
_tree->create<int>(tx_rf_fe_path / "sensors"); //empty TODO
|
||||
|
||||
//rx gains
|
||||
BOOST_FOREACH(const std::string &name, ctrl->get_rx_gains())
|
||||
{
|
||||
_tree->create<meta_range_t>(rx_rf_fe_path / "gains" / name / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_rx_gain_range, ctrl, name));
|
||||
|
||||
_tree->create<double>(rx_rf_fe_path / "gains" / name / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_rx_gain, ctrl, _1, name))
|
||||
.set((ctrl->get_rx_gain_range(name).start() + ctrl->get_rx_gain_range(name).stop())/2.0);
|
||||
}
|
||||
|
||||
//tx gains
|
||||
BOOST_FOREACH(const std::string &name, ctrl->get_tx_gains())
|
||||
{
|
||||
_tree->create<meta_range_t>(tx_rf_fe_path / "gains" / name / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_tx_gain_range, ctrl, name));
|
||||
|
||||
_tree->create<double>(tx_rf_fe_path / "gains" / name / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_tx_gain, ctrl, _1, name))
|
||||
.set((ctrl->get_tx_gain_range(name).start() + ctrl->get_tx_gain_range(name).stop())/2.0);
|
||||
}
|
||||
|
||||
//rx freq
|
||||
_tree->create<double>(rx_rf_fe_path / "freq" / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_rx_freq, ctrl, _1));
|
||||
_tree->create<meta_range_t>(rx_rf_fe_path / "freq" / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_rx_freq_range, ctrl));
|
||||
_tree->create<bool>(rx_rf_fe_path / "use_lo_offset").set(false);
|
||||
|
||||
//tx freq
|
||||
_tree->create<double>(tx_rf_fe_path / "freq" / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_tx_freq, ctrl, _1));
|
||||
_tree->create<meta_range_t>(tx_rf_fe_path / "freq" / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_tx_freq_range, ctrl));
|
||||
_tree->create<bool>(tx_rf_fe_path / "use_lo_offset").set(false);
|
||||
|
||||
//rx ant
|
||||
_tree->create<std::vector<std::string> >(rx_rf_fe_path / "antenna" / "options")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_rx_antennas, ctrl));
|
||||
_tree->create<std::string>(rx_rf_fe_path / "antenna" / "value")
|
||||
.subscribe(boost::bind(&lms6002d_ctrl::set_rx_ant, ctrl, _1))
|
||||
.set("RX1");
|
||||
|
||||
//tx ant
|
||||
_tree->create<std::vector<std::string> >(tx_rf_fe_path / "antenna" / "options")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_tx_antennas, ctrl));
|
||||
_tree->create<std::string>(tx_rf_fe_path / "antenna" / "value")
|
||||
.subscribe(boost::bind(&lms6002d_ctrl::set_tx_ant, ctrl, _1))
|
||||
.set("TX2");
|
||||
|
||||
//misc
|
||||
_tree->create<std::string>(rx_rf_fe_path / "connection").set("IQ");
|
||||
_tree->create<std::string>(tx_rf_fe_path / "connection").set("IQ");
|
||||
_tree->create<bool>(rx_rf_fe_path / "enabled")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_rx_enabled, ctrl, _1));
|
||||
_tree->create<bool>(tx_rf_fe_path / "enabled")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_tx_enabled, ctrl, _1));
|
||||
|
||||
//rx bw
|
||||
_tree->create<double>(rx_rf_fe_path / "bandwidth" / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_rx_bandwidth, ctrl, _1))
|
||||
.set(2*0.75e6);
|
||||
_tree->create<meta_range_t>(rx_rf_fe_path / "bandwidth" / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_rx_bw_range, ctrl));
|
||||
|
||||
//tx bw
|
||||
_tree->create<double>(tx_rf_fe_path / "bandwidth" / "value")
|
||||
.coerce(boost::bind(&lms6002d_ctrl::set_tx_bandwidth, ctrl, _1))
|
||||
.set(2*0.75e6);
|
||||
_tree->create<meta_range_t>(tx_rf_fe_path / "bandwidth" / "range")
|
||||
.publish(boost::bind(&lms6002d_ctrl::get_tx_bw_range, ctrl));
|
||||
|
||||
//TODO // UmTRX specific calibration
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
umtrx_impl::~umtrx_impl(void){
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "fw_common.h"
|
||||
#include "umtrx_iface.hpp"
|
||||
#include "lms6002d_ctrl.hpp"
|
||||
#include "cores/rx_frontend_core_200.hpp"
|
||||
#include "cores/tx_frontend_core_200.hpp"
|
||||
#include "cores/rx_dsp_core_200.hpp"
|
||||
@@ -84,6 +85,9 @@ private:
|
||||
//communication interfaces
|
||||
umtrx_iface::sptr _iface;
|
||||
|
||||
//controls for perifs
|
||||
uhd::dict<std::string, lms6002d_ctrl::sptr> _lms_ctrl;
|
||||
|
||||
//control for FPGA cores
|
||||
std::vector<rx_frontend_core_200::sptr> _rx_fes;
|
||||
std::vector<tx_frontend_core_200::sptr> _tx_fes;
|
||||
|
||||
Reference in New Issue
Block a user