diff options
Diffstat (limited to 'host/utils/usrp_gen_rx_fe_cal_table.cpp')
-rw-r--r-- | host/utils/usrp_gen_rx_fe_cal_table.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/host/utils/usrp_gen_rx_fe_cal_table.cpp b/host/utils/usrp_gen_rx_fe_cal_table.cpp index 4d5d4168e..a365c9be7 100644 --- a/host/utils/usrp_gen_rx_fe_cal_table.cpp +++ b/host/utils/usrp_gen_rx_fe_cal_table.cpp @@ -20,22 +20,17 @@ #include <uhd/utils/safe_main.hpp> #include <uhd/utils/paths.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/property_tree.hpp> #include <uhd/usrp/multi_usrp.hpp> -#include <uhd/usrp/dboard_eeprom.hpp> #include <boost/program_options.hpp> #include <boost/format.hpp> #include <boost/thread/thread.hpp> -#include <boost/filesystem.hpp> #include <boost/math/special_functions/round.hpp> #include <iostream> -#include <fstream> #include <complex> #include <cmath> #include <ctime> namespace po = boost::program_options; -namespace fs = boost::filesystem; /*********************************************************************** * Transmit thread @@ -116,47 +111,6 @@ static void capture_samples(uhd::usrp::multi_usrp::sptr usrp, uhd::rx_streamer:: } /*********************************************************************** - * Store data to file - **********************************************************************/ -static void store_results(uhd::usrp::multi_usrp::sptr usrp, const std::vector<result_t> &results){ - //extract eeprom serial - uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); - const uhd::fs_path db_path = "/mboards/0/dboards/A/rx_eeprom"; - const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); - if (db_eeprom.serial.empty()) throw std::runtime_error("RX dboard has empty serial!"); - - //make the calibration file path - fs::path cal_data_path = fs::path(uhd::get_app_path()) / ".uhd"; - fs::create_directory(cal_data_path); - cal_data_path = cal_data_path / "cal"; - fs::create_directory(cal_data_path); - cal_data_path = cal_data_path / ("rx_fe_cal_v0.1_" + db_eeprom.serial + ".csv"); - if (fs::exists(cal_data_path)){ - fs::rename(cal_data_path, cal_data_path.string() + str(boost::format(".%d") % time(NULL))); - } - - //fill the calibration file - std::ofstream cal_data(cal_data_path.string().c_str()); - cal_data << boost::format("name, RX Frontend Calibration\n"); - cal_data << boost::format("serial, %s\n") % db_eeprom.serial; - cal_data << boost::format("timestamp, %d\n") % time(NULL); - cal_data << boost::format("version, 0, 1\n"); - cal_data << boost::format("DATA STARTS HERE\n"); - cal_data << "rx_lo_frequency, rx_iq_correction_real, rx_iq_correction_imag, measured_suppression\n"; - - for (size_t i = 0; i < results.size(); i++){ - cal_data - << results[i].freq << ", " - << results[i].real_corr << ", " - << results[i].imag_corr << ", " - << results[i].sup << "\n" - ; - } - - std::cout << "wrote cal data to " << cal_data_path << std::endl; -} - -/*********************************************************************** * Main **********************************************************************/ int UHD_SAFE_MAIN(int argc, char *argv[]){ @@ -304,7 +258,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ threads.interrupt_all(); threads.join_all(); - store_results(usrp, results); + store_results(usrp, results, "RX", "rx"); return 0; } |