aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/CMakeLists.txt6
-rw-r--r--host/docs/build.rst1
-rw-r--r--host/examples/benchmark_rx_rate.cpp16
-rw-r--r--host/examples/rx_timed_samples.cpp22
-rw-r--r--host/include/uhd/config.hpp11
-rw-r--r--host/include/uhd/utils/byteswap.ipp6
-rw-r--r--host/lib/transport/udp_zero_copy_asio.cpp3
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp3
-rw-r--r--host/lib/usrp/mimo_usrp.cpp19
-rw-r--r--host/test/vrt_test.cpp6
10 files changed, 72 insertions, 21 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index c60372fb9..e26ec03d2 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -81,7 +81,11 @@ ENDIF(MSVC)
########################################################################
# Setup Boost
########################################################################
-SET(Boost_ADDITIONAL_VERSIONS "1.42.0" "1.42")
+IF(EXISTS "/usr/lib64")
+ LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+ENDIF(EXISTS "/usr/lib64")
+
+SET(Boost_ADDITIONAL_VERSIONS "1.42.0" "1.42 1.43.0" "1.43")
FIND_PACKAGE(Boost 1.36 REQUIRED COMPONENTS
date_time
filesystem
diff --git a/host/docs/build.rst b/host/docs/build.rst
index 108d8dc8b..6f0afdb6e 100644
--- a/host/docs/build.rst
+++ b/host/docs/build.rst
@@ -100,7 +100,6 @@ Generate Makefiles with cmake
**Notes:**
* For a custom prefix, use: cmake -DCMAKE_INSTALL_PREFIX=<prefix> ../
-* On some Fedora 64-bit systems, cmake has trouble finding boost, use: cmake -DBOOST_LIBRARYDIR=/usr/lib64 ../
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Build and install
diff --git a/host/examples/benchmark_rx_rate.cpp b/host/examples/benchmark_rx_rate.cpp
index a63337b38..752facb0d 100644
--- a/host/examples/benchmark_rx_rate.cpp
+++ b/host/examples/benchmark_rx_rate.cpp
@@ -62,13 +62,18 @@ static inline void test_device(
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
- if (num_rx_samps == 0 and md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){
- std::cerr << "Unexpected timeout on recv, exit test..." << std::endl;
+
+ //handle the error codes
+ switch(md.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ case uhd::rx_metadata_t::ERROR_CODE_OVERRUN:
+ break;
+
+ default:
+ std::cerr << "Unexpected error on recv, exit test..." << std::endl;
return;
}
- if (num_rx_samps == 0 and md.error_code != uhd::rx_metadata_t::ERROR_CODE_OVERRUN){
- std::cerr << "Unexpected error on recv, continuing..." << std::endl;
- }
+
if (not md.has_time_spec){
std::cerr << "Metadata missing time spec, exit test..." << std::endl;
return;
@@ -132,6 +137,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Creating the usrp device with: %s...") % args << std::endl;
uhd::usrp::simple_usrp::sptr sdev = uhd::usrp::simple_usrp::make(args);
std::cout << boost::format("Using Device: %s") % sdev->get_pp_string() << std::endl;
+ sdev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); //stop if left running
if (not vm.count("rate")){
sdev->set_rx_rate(500e3); //initial rate
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 95f805007..3b9acbb2c 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -92,20 +92,32 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
- if (num_rx_samps == 0 and num_acc_samps > 0){
+
+ //handle the error codes
+ switch(md.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ break;
+
+ case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
+ if (num_acc_samps == 0) continue;
std::cout << boost::format(
- "Got error code 0x%x before all samples received, possible packet loss, exiting loop..."
+ "Got timeout before all samples received, possible packet loss, exiting loop..."
) % md.error_code << std::endl;
- break;
+ goto done_loop;
+
+ default:
+ std::cout << boost::format(
+ "Got error code 0x%x, exiting loop..."
+ ) % md.error_code << std::endl;
+ goto done_loop;
}
- if (num_rx_samps == 0) continue; //wait for packets with contents
if(verbose) std::cout << boost::format(
"Got packet: %u samples, %u full secs, %f frac secs"
) % num_rx_samps % md.time_spec.get_full_secs() % md.time_spec.get_frac_secs() << std::endl;
num_acc_samps += num_rx_samps;
- }
+ } done_loop:
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 2360174a4..dacd3a96b 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -101,4 +101,15 @@
#define UHD_DEPRECATED
#endif
+// Platform defines for conditional parts of headers:
+// Taken from boost/config/select_platform_config.hpp,
+// however, we define macros, not strings for platforms.
+#if defined(linux) || defined(__linux) || defined(__linux__)
+ #define UHD_PLATFORM_LINUX
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define UHD_PLATFORM_WIN32
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ #define UHD_PLATFORM_MACOS
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp
index 11c82a4ec..a070a7cf5 100644
--- a/host/include/uhd/utils/byteswap.ipp
+++ b/host/include/uhd/utils/byteswap.ipp
@@ -21,7 +21,7 @@
/***********************************************************************
* Platform-specific implementation details for byteswap below:
**********************************************************************/
-#ifdef BOOST_MSVC //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
+#if defined(UHD_PLATFORM_WIN32) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
#include <stdlib.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -50,7 +50,7 @@
return __builtin_bswap64(x);
}
-#elif defined(__FreeBSD__) || defined(__MACOSX__) || defined(__APPLE__)
+#elif defined(UHD_PLATFORM_MACOS)
#include <libkern/OSByteOrder.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -65,7 +65,7 @@
return OSSwapInt64(x);
}
-#elif defined(linux) || defined(__linux)
+#elif defined(UHD_PLATFORM_LINUX)
#include <byteswap.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp
index 98451f188..bfbcf62d8 100644
--- a/host/lib/transport/udp_zero_copy_asio.cpp
+++ b/host/lib/transport/udp_zero_copy_asio.cpp
@@ -161,10 +161,13 @@ template<typename Opt> static void resize_buff_helper(
) % name % MIN_SOCK_BUFF_SIZE << std::endl;
}
+ //only enable on platforms that are happy with the large buffer resize
+ #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
//otherwise, ensure that the buffer is at least the minimum size
else if (udp_trans->get_buff_size<Opt>() < MIN_SOCK_BUFF_SIZE){
resize_buff_helper<Opt>(udp_trans, MIN_SOCK_BUFF_SIZE, name);
}
+ #endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}
udp_zero_copy::sptr udp_zero_copy::make(
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index 6623957ac..fdcff24b8 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -146,6 +146,8 @@ namespace vrt_packet_handler{
const handle_overrun_t &handle_overrun,
size_t vrt_header_offset_words32
){
+ metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
+
//perform a receive if no rx data is waiting to be copied
if (state.size_of_copy_buffs == 0){
state.fragment_offset_in_samps = 0;
@@ -171,7 +173,6 @@ namespace vrt_packet_handler{
metadata.has_time_spec = false;
metadata.start_of_burst = false;
metadata.end_of_burst = false;
- metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
}
//extract the number of samples available to copy
diff --git a/host/lib/usrp/mimo_usrp.cpp b/host/lib/usrp/mimo_usrp.cpp
index fd8225074..b40f98226 100644
--- a/host/lib/usrp/mimo_usrp.cpp
+++ b/host/lib/usrp/mimo_usrp.cpp
@@ -125,20 +125,33 @@ public:
void set_time_unknown_pps(const time_spec_t &time_spec){
std::cout << "Set time with unknown pps edge:" << std::endl;
- std::cout << " 1) set times next pps (race condition)" << std::endl;
+ std::cout << " 1) set times next pps (race condition)" << std::endl;
set_time_next_pps(time_spec);
boost::this_thread::sleep(boost::posix_time::seconds(1));
- std::cout << " 2) catch seconds rollover at pps edge" << std::endl;
+ std::cout << " 2) catch seconds rollover at pps edge" << std::endl;
time_t last_secs = 0, curr_secs = 0;
while(curr_secs == last_secs){
last_secs = curr_secs;
curr_secs = get_time_now().get_full_secs();
}
- std::cout << " 3) set times next pps (synchronously)" << std::endl;
+ std::cout << " 3) set times next pps (synchronously)" << std::endl;
set_time_next_pps(time_spec);
boost::this_thread::sleep(boost::posix_time::seconds(1));
+
+ //verify that the time registers are read to be within a few RTT
+ for (size_t i = 1; i < get_num_channels(); i++){
+ time_spec_t time_0 = _mboards.front()[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
+ time_spec_t time_i = _mboards.at(i)[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
+ if (time_i < time_0 or (time_i - time_0) > time_spec_t(0.01)){ //10 ms: greater than RTT but not too big
+ std::cerr << boost::format(
+ "Error: time deviation between board %d and board 0.\n"
+ " Board 0 time is %f seconds.\n"
+ " Board %d time is %f seconds.\n"
+ ) % i % time_0.get_real_secs() % i % time_i.get_real_secs() << std::endl;
+ }
+ }
}
void issue_stream_cmd(const stream_cmd_t &stream_cmd){
diff --git a/host/test/vrt_test.cpp b/host/test/vrt_test.cpp
index b90b2fc15..9e131a10b 100644
--- a/host/test/vrt_test.cpp
+++ b/host/test/vrt_test.cpp
@@ -95,11 +95,13 @@ BOOST_AUTO_TEST_CASE(test_with_sid){
pack_and_unpack(if_packet_info);
}
+static const bool cid_enb = false;
+
BOOST_AUTO_TEST_CASE(test_with_cid){
vrt::if_packet_info_t if_packet_info;
if_packet_info.packet_count = 2;
if_packet_info.has_sid = false;
- if_packet_info.has_cid = true;
+ if_packet_info.has_cid = cid_enb;
if_packet_info.has_tsi = false;
if_packet_info.has_tsf = false;
if_packet_info.has_tlr = false;
@@ -126,7 +128,7 @@ BOOST_AUTO_TEST_CASE(test_with_all){
vrt::if_packet_info_t if_packet_info;
if_packet_info.packet_count = 4;
if_packet_info.has_sid = true;
- if_packet_info.has_cid = true;
+ if_packet_info.has_cid = cid_enb;
if_packet_info.has_tsi = true;
if_packet_info.has_tsf = true;
if_packet_info.has_tlr = false;