diff options
author | Nicolas Cuervo <nicolas.cuervo@ettus.com> | 2016-08-09 18:29:08 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-08-11 15:32:35 -0700 |
commit | 00c70d7155e40e59c7635b5aecc2993ca3f4ae5e (patch) | |
tree | 6a05f2713dad9219e7a0d5208db89a857ada7a29 | |
parent | bf6adfaf6f4b391ea74639133a6a00b0ca7fcfa0 (diff) | |
download | uhd-00c70d7155e40e59c7635b5aecc2993ca3f4ae5e.tar.gz uhd-00c70d7155e40e59c7635b5aecc2993ca3f4ae5e.tar.bz2 uhd-00c70d7155e40e59c7635b5aecc2993ca3f4ae5e.zip |
Frontend corrections: Provide new function for RFNoC-based radio
-rw-r--r-- | host/lib/usrp/common/apply_corrections.cpp | 51 | ||||
-rw-r--r-- | host/lib/usrp/common/apply_corrections.hpp | 16 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.hpp | 4 |
4 files changed, 74 insertions, 11 deletions
diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp index 3d33e7d11..272e0e093 100644 --- a/host/lib/usrp/common/apply_corrections.cpp +++ b/host/lib/usrp/common/apply_corrections.cpp @@ -1,5 +1,5 @@ // -// Copyright 2011 Ettus Research LLC +// Copyright 2011-2016 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -144,6 +144,34 @@ static void apply_fe_corrections( /*********************************************************************** * Wrapper routines with nice try/catch + print **********************************************************************/ +void uhd::usrp::apply_tx_fe_corrections( //overloading to work according to rfnoc tree struct + property_tree::sptr sub_tree, //starts at mboards/x + const uhd::fs_path db_path, + const uhd::fs_path tx_fe_corr_path, + const double lo_freq //actual lo freq +){ + boost::mutex::scoped_lock l(corrections_mutex); + try{ + apply_fe_corrections( + sub_tree, + db_path + "/tx_eeprom", + tx_fe_corr_path + "/iq_balance/value", + "tx_iq_cal_v0.2_", + lo_freq + ); + apply_fe_corrections( + sub_tree, + db_path + "/tx_eeprom", + tx_fe_corr_path + "/dc_offset/value", + "tx_dc_cal_v0.2_", + lo_freq + ); + } + catch(const std::exception &e){ + UHD_MSG(error) << "Failure in apply_tx_fe_corrections: " << e.what() << std::endl; + } +} + void uhd::usrp::apply_tx_fe_corrections( property_tree::sptr sub_tree, //starts at mboards/x const std::string &slot, //name of dboard slot @@ -171,6 +199,27 @@ void uhd::usrp::apply_tx_fe_corrections( } } +void uhd::usrp::apply_rx_fe_corrections( //overloading to work according to rfnoc tree struct + property_tree::sptr sub_tree, //starts at mboards/x + const uhd::fs_path db_path, + const uhd::fs_path rx_fe_corr_path, + const double lo_freq //actual lo freq +){ + boost::mutex::scoped_lock l(corrections_mutex); + try{ + apply_fe_corrections( + sub_tree, + db_path + "/rx_eeprom", + rx_fe_corr_path + "/iq_balance/value", + "rx_iq_cal_v0.2_", + lo_freq + ); + } + catch(const std::exception &e){ + UHD_MSG(error) << "Failure in apply_tx_fe_corrections: " << e.what() << std::endl; + } +} + void uhd::usrp::apply_rx_fe_corrections( property_tree::sptr sub_tree, //starts at mboards/x const std::string &slot, //name of dboard slot diff --git a/host/lib/usrp/common/apply_corrections.hpp b/host/lib/usrp/common/apply_corrections.hpp index c516862d1..0ab5377f3 100644 --- a/host/lib/usrp/common/apply_corrections.hpp +++ b/host/lib/usrp/common/apply_corrections.hpp @@ -1,5 +1,5 @@ // -// Copyright 2011 Ettus Research LLC +// Copyright 2011-2016 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,16 +26,28 @@ namespace uhd{ namespace usrp{ void apply_tx_fe_corrections( property_tree::sptr sub_tree, //starts at mboards/x - const std::string &slot, //name of dboard slot + const fs_path db_path, + const fs_path tx_fe_corr_path, const double tx_lo_freq //actual lo freq ); + void apply_tx_fe_corrections( + property_tree::sptr sub_tree, //starts at mboards/x + const std::string &slot, //name of dboard slot + const double tx_lo_freq //actual lo freq + ); void apply_rx_fe_corrections( property_tree::sptr sub_tree, //starts at mboards/x const std::string &slot, //name of dboard slot const double rx_lo_freq //actual lo freq ); + void apply_rx_fe_corrections( + property_tree::sptr sub_tree, //starts at mboards/x + const fs_path db_path, + const fs_path rx_fe_corr_path, + const double rx_lo_freq //actual lo freq + ); }} //namespace uhd::usrp #endif /* INCLUDED_LIBUHD_USRP_COMMON_APPLY_CORRECTIONS_HPP */ diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 6a4ed8cf5..388b66929 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -391,12 +391,12 @@ void x300_radio_ctrl_impl::setup_radio(uhd::i2c_iface::sptr zpu_i2c, x300_clock_ const fs_path db_tx_fe_path = db_path / "tx_frontends"; BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)) { _tree->access<double>(db_tx_fe_path / name / "freq" / "value") - .add_coerced_subscriber(boost::bind(&x300_radio_ctrl_impl::set_tx_fe_corrections, this, _radio_slot, _1)); + .add_coerced_subscriber(boost::bind(&x300_radio_ctrl_impl::set_tx_fe_corrections, this, db_path, _root_path / "tx_fe_corrections" / name, _1)); } const fs_path db_rx_fe_path = db_path / "rx_frontends"; BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)) { _tree->access<double>(db_rx_fe_path / name / "freq" / "value") - .add_coerced_subscriber(boost::bind(&x300_radio_ctrl_impl::set_rx_fe_corrections, this, _radio_slot, _1)); + .add_coerced_subscriber(boost::bind(&x300_radio_ctrl_impl::set_rx_fe_corrections, this, db_path, _root_path / "rx_fe_corrections" / name,_1)); } //////////////////////////////////////////////////////////////// @@ -411,20 +411,22 @@ void x300_radio_ctrl_impl::setup_radio(uhd::i2c_iface::sptr zpu_i2c, x300_clock_ } void x300_radio_ctrl_impl::set_rx_fe_corrections( - const std::string &slot_name, + const fs_path &db_path, + const fs_path &rx_fe_corr_path, const double lo_freq ) { if (not _ignore_cal_file) { - apply_rx_fe_corrections(_tree, slot_name, lo_freq); + apply_rx_fe_corrections(_tree, db_path, rx_fe_corr_path, lo_freq); } } void x300_radio_ctrl_impl::set_tx_fe_corrections( - const std::string &slot_name, + const fs_path &db_path, + const fs_path &tx_fe_corr_path, const double lo_freq ) { if (not _ignore_cal_file) { - apply_tx_fe_corrections(_tree, slot_name, lo_freq); + apply_tx_fe_corrections(_tree, db_path, tx_fe_corr_path, lo_freq); } } diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp index f2150a982..ff41096bd 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp @@ -152,8 +152,8 @@ private: void _check_adc(const boost::uint32_t val); - void set_rx_fe_corrections(const std::string &fe_name, const double lo_freq); - void set_tx_fe_corrections(const std::string &fe_name, const double lo_freq); + void set_rx_fe_corrections(const uhd::fs_path &db_path, const uhd::fs_path &rx_fe_corr_path, const double lo_freq); + void set_tx_fe_corrections(const uhd::fs_path &db_path, const uhd::fs_path &tx_fe_corr_path, const double lo_freq); private: // members enum radio_connection_t { PRIMARY, SECONDARY }; |