aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/usrp_gen_tx_fe_cal_table.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-11 18:41:05 -0800
committerJosh Blum <josh@joshknows.com>2011-11-11 18:41:05 -0800
commite108294eed585aa8602631fe90fea4cf7b5e23c2 (patch)
tree230de76615c5a821c7525543947463092a2a3d63 /host/utils/usrp_gen_tx_fe_cal_table.cpp
parentb23126d3a0fca7d56a933e7f2f0011a9d625b006 (diff)
downloaduhd-e108294eed585aa8602631fe90fea4cf7b5e23c2.tar.gz
uhd-e108294eed585aa8602631fe90fea4cf7b5e23c2.tar.bz2
uhd-e108294eed585aa8602631fe90fea4cf7b5e23c2.zip
uhd: share more common code in cal utils
Diffstat (limited to 'host/utils/usrp_gen_tx_fe_cal_table.cpp')
-rw-r--r--host/utils/usrp_gen_tx_fe_cal_table.cpp48
1 files changed, 1 insertions, 47 deletions
diff --git a/host/utils/usrp_gen_tx_fe_cal_table.cpp b/host/utils/usrp_gen_tx_fe_cal_table.cpp
index 1e4a9d11f..bf19e4a37 100644
--- a/host/utils/usrp_gen_tx_fe_cal_table.cpp
+++ b/host/utils/usrp_gen_tx_fe_cal_table.cpp
@@ -20,21 +20,16 @@
#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 <ctime>
namespace po = boost::program_options;
-namespace fs = boost::filesystem;
/***********************************************************************
* Transmit thread
@@ -117,47 +112,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/tx_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("TX 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 / ("tx_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, TX 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 << "tx_lo_frequency, tx_iq_correction_real, tx_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[]){
@@ -306,7 +260,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
threads.interrupt_all();
threads.join_all();
- store_results(usrp, results);
+ store_results(usrp, results, "TX", "tx");
return 0;
}