From 1e2f457ee118f55d753a4c124315ab17f8eb5f1b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 22 Jul 2010 23:27:57 -0700 Subject: usrp: fix the N/2 cordic tune issue, use boost math sign inplace of my signum --- host/lib/usrp/dsp_utils.hpp | 4 ++-- host/lib/usrp/tune_helper.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/dsp_utils.hpp b/host/lib/usrp/dsp_utils.hpp index 2f246c788..ebed12c41 100644 --- a/host/lib/usrp/dsp_utils.hpp +++ b/host/lib/usrp/dsp_utils.hpp @@ -82,11 +82,11 @@ namespace dsp_type1{ double &freq, double codec_rate ){ - UHD_ASSERT_THROW(freq >= -codec_rate/2.0 and freq < codec_rate/2.0); + UHD_ASSERT_THROW(std::abs(freq) <= codec_rate/2.0); static const double scale_factor = std::pow(2.0, 32); //calculate the freq register word (signed) - boost::int32_t freq_word = boost::math::iround((freq / codec_rate) * scale_factor); + boost::int32_t freq_word = boost::int32_t(boost::math::round((freq / codec_rate) * scale_factor)); //update the actual frequency freq = (double(freq_word) / scale_factor) * codec_rate; diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp index c5cce3ecf..e516477d3 100644 --- a/host/lib/usrp/tune_helper.cpp +++ b/host/lib/usrp/tune_helper.cpp @@ -16,10 +16,10 @@ // #include -#include #include #include #include //unit_t +#include #include using namespace uhd; @@ -46,7 +46,7 @@ static tune_result_t tune_xx_subdev_and_dxc( double delta_freq = std::fmod(target_freq - actual_inter_freq, dxc_sample_rate); bool outside_of_nyquist = std::abs(delta_freq) > dxc_sample_rate/2.0; double target_dxc_freq = (outside_of_nyquist)? - std::signum(delta_freq)*dxc_sample_rate - delta_freq : -delta_freq; + boost::math::sign(delta_freq)*dxc_sample_rate - delta_freq : -delta_freq; //invert the sign on the dxc freq given the following conditions if (unit == dboard_iface::UNIT_TX) target_dxc_freq *= -1.0; -- cgit v1.2.3 From f86c25317b457b280c697fc47905c79bdbbc0c93 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 26 Jul 2010 11:46:08 -0700 Subject: uhd: removed remaining template stuff from vrt packet handler, also tweaked format in rx timed samples --- host/examples/rx_timed_samples.cpp | 7 ++++--- host/lib/transport/vrt_packet_handler.hpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index 3b9acbb2c..4856f6779 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -74,8 +74,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //setup streaming std::cout << std::endl; - std::cout << boost::format("Begin streaming %u samples, %d seconds in the future...") - % total_num_samps % seconds_in_future << std::endl; + std::cout << boost::format( + "Begin streaming %u samples, %d seconds in the future..." + ) % total_num_samps % seconds_in_future << std::endl; uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); stream_cmd.num_samps = total_num_samps; stream_cmd.stream_now = false; @@ -102,7 +103,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if (num_acc_samps == 0) continue; std::cout << boost::format( "Got timeout before all samples received, possible packet loss, exiting loop..." - ) % md.error_code << std::endl; + ) << std::endl; goto done_loop; default: diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp index 07ad9115c..cf9d649dd 100644 --- a/host/lib/transport/vrt_packet_handler.hpp +++ b/host/lib/transport/vrt_packet_handler.hpp @@ -286,7 +286,6 @@ namespace vrt_packet_handler{ * Pack a vrt header, copy-convert the data, and send it. * - helper function for vrt_packet_handler::send ******************************************************************/ - template static UHD_INLINE void _send1( send_state &state, const std::vector &buffs, @@ -295,7 +294,7 @@ namespace vrt_packet_handler{ uhd::transport::vrt::if_packet_info_t &if_packet_info, const uhd::io_type_t &io_type, const uhd::otw_type_t &otw_type, - vrt_packer_type vrt_packer, + const vrt_packer_t &vrt_packer, const get_send_buffs_t &get_send_buffs, size_t vrt_header_offset_words32 ){ -- cgit v1.2.3