From e108294eed585aa8602631fe90fea4cf7b5e23c2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 11 Nov 2011 18:41:05 -0800 Subject: uhd: share more common code in cal utils --- host/utils/usrp_gen_rx_fe_cal_table.cpp | 48 +-------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) (limited to 'host/utils/usrp_gen_rx_fe_cal_table.cpp') 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 #include #include -#include #include -#include #include #include #include -#include #include #include -#include #include #include #include namespace po = boost::program_options; -namespace fs = boost::filesystem; /*********************************************************************** * Transmit thread @@ -115,47 +110,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 &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(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 **********************************************************************/ @@ -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; } -- cgit v1.2.3