From d743784919b362d93e6408f05bdef6e543e3fc7e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 8 Apr 2010 10:57:16 -0700 Subject: converted timespec to use nanoseconds for fractional part --- host/lib/types.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'host/lib/types.cpp') diff --git a/host/lib/types.cpp b/host/lib/types.cpp index 61a63b710..cd688e73d 100644 --- a/host/lib/types.cpp +++ b/host/lib/types.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -101,29 +102,26 @@ tx_metadata_t::tx_metadata_t(void){ /*********************************************************************** * time spec **********************************************************************/ -time_spec_t::time_spec_t(boost::uint32_t new_secs, boost::uint32_t new_ticks){ +time_spec_t::time_spec_t(boost::uint32_t new_secs, double new_nsecs){ secs = new_secs; - ticks = new_ticks; + nsecs = new_nsecs; } -static const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1)); -static double time_tick_rate = double(boost::posix_time::time_duration::ticks_per_second()); +boost::uint32_t time_spec_t::get_ticks(double tick_rate) const{ + return boost::math::iround(nsecs*tick_rate*1e-9); +} -time_spec_t::time_spec_t(boost::posix_time::ptime time, double tick_rate){ - boost::posix_time::time_duration td = time - epoch; - secs = boost::uint32_t(td.total_seconds()); - double time_ticks_per_device_ticks = time_tick_rate/tick_rate; - ticks = boost::uint32_t(td.fractional_seconds()/time_ticks_per_device_ticks); +void time_spec_t::set_ticks(boost::uint32_t ticks, double tick_rate){ + nsecs = double(ticks)*1e9/tick_rate; } /*********************************************************************** * device addr **********************************************************************/ std::string device_addr_t::to_string(void) const{ - const device_addr_t &device_addr = *this; std::stringstream ss; - BOOST_FOREACH(std::string key, device_addr.keys()){ - ss << boost::format("%s: %s") % key % device_addr[key] << std::endl; + BOOST_FOREACH(std::string key, this->keys()){ + ss << boost::format("%s: %s") % key % (*this)[key] << std::endl; } return ss.str(); } @@ -137,9 +135,8 @@ static std::string trim(const std::string &in){ std::string device_addr_t::to_args_str(void) const{ std::string args_str; - const device_addr_t &device_addr = *this; - BOOST_FOREACH(const std::string &key, device_addr.keys()){ - args_str += key + pair_delim + device_addr[key] + arg_delim; + BOOST_FOREACH(const std::string &key, this->keys()){ + args_str += key + pair_delim + (*this)[key] + arg_delim; } return args_str; } -- cgit v1.2.3 From 36d81c56583f37e5304db885cc82637e30bff8f5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 14 Apr 2010 11:47:55 -0700 Subject: renamed dxc to dsp for tune result --- host/include/uhd/types/tune_result.hpp | 6 +++--- host/include/uhd/usrp/CMakeLists.txt | 2 +- host/lib/types.cpp | 4 ++-- host/lib/usrp/tune_helper.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'host/lib/types.cpp') diff --git a/host/include/uhd/types/tune_result.hpp b/host/include/uhd/types/tune_result.hpp index 31742e1af..c428a7692 100644 --- a/host/include/uhd/types/tune_result.hpp +++ b/host/include/uhd/types/tune_result.hpp @@ -26,15 +26,15 @@ namespace uhd{ * The tune result struct holds result of a 2-phase tuning: * The struct hold the result of tuning the dboard as * the target and actual intermediate frequency. - * The struct hold the result of tuning the DDC/DUC as + * The struct hold the result of tuning the DSP as * the target and actual digital converter frequency. * It also tell us weather or not the spectrum is inverted. */ struct UHD_API tune_result_t{ double target_inter_freq; double actual_inter_freq; - double target_dxc_freq; - double actual_dxc_freq; + double target_dsp_freq; + double actual_dsp_freq; bool spectrum_inverted; tune_result_t(void); }; diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index 9140d98ca..23758041c 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -27,7 +27,7 @@ INSTALL(FILES #### dboard headers ### dboard_base.hpp dboard_id.hpp - dboard_interface.hpp + dboard_iface.hpp dboard_manager.hpp ### usrp headers ### diff --git a/host/lib/types.cpp b/host/lib/types.cpp index cd688e73d..0fd2522cf 100644 --- a/host/lib/types.cpp +++ b/host/lib/types.cpp @@ -55,8 +55,8 @@ freq_range_t::freq_range_t(double min_, double max_){ tune_result_t::tune_result_t(void){ target_inter_freq = 0.0; actual_inter_freq = 0.0; - target_dxc_freq = 0.0; - actual_dxc_freq = 0.0; + target_dsp_freq = 0.0; + actual_dsp_freq = 0.0; spectrum_inverted = false; } diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp index 2fb15064c..a7d695b4e 100644 --- a/host/lib/usrp/tune_helper.cpp +++ b/host/lib/usrp/tune_helper.cpp @@ -74,8 +74,8 @@ static tune_result_t tune_xx_subdev_and_dxc( tune_result_t tune_result; tune_result.target_inter_freq = target_inter_freq; tune_result.actual_inter_freq = actual_inter_freq; - tune_result.target_dxc_freq = target_dxc_freq; - tune_result.actual_dxc_freq = actual_dxc_freq; + tune_result.target_dsp_freq = target_dxc_freq; + tune_result.actual_dsp_freq = actual_dxc_freq; tune_result.spectrum_inverted = inverted; return tune_result; } -- cgit v1.2.3