diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-18 08:15:15 +0000 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-18 08:15:15 +0000 |
commit | d105f614477c7f2a4f24a4efc802de7eb750bd7a (patch) | |
tree | 6c5f6e615f153862e546e5fb3879a400b73bfec1 /host/lib/transport | |
parent | 5de235715b36ef9a98ea418832a5382cbf25d4d6 (diff) | |
parent | f2a86eb6389210a8ebd475782ab707f814c6e49c (diff) | |
download | uhd-d105f614477c7f2a4f24a4efc802de7eb750bd7a.tar.gz uhd-d105f614477c7f2a4f24a4efc802de7eb750bd7a.tar.bz2 uhd-d105f614477c7f2a4f24a4efc802de7eb750bd7a.zip |
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhd into u1e_uhd
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/udp_simple.cpp | 2 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy_none.cpp | 10 | ||||
-rw-r--r-- | host/lib/transport/vrt.cpp | 21 |
3 files changed, 18 insertions, 15 deletions
diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp index 7004bdfdf..3c8ecb70d 100644 --- a/host/lib/transport/udp_simple.cpp +++ b/host/lib/transport/udp_simple.cpp @@ -38,7 +38,7 @@ static void reasonable_recv_timeout( boost::asio::ip::udp::socket &socket ){ boost::asio::deadline_timer timer(socket.get_io_service()); - timer.expires_from_now(boost::posix_time::milliseconds(50)); + timer.expires_from_now(boost::posix_time::milliseconds(100)); while (not (socket.available() or timer.expires_from_now().is_negative())){ boost::this_thread::sleep(boost::posix_time::milliseconds(1)); } diff --git a/host/lib/transport/udp_zero_copy_none.cpp b/host/lib/transport/udp_zero_copy_none.cpp index e29530cf1..219ae8720 100644 --- a/host/lib/transport/udp_zero_copy_none.cpp +++ b/host/lib/transport/udp_zero_copy_none.cpp @@ -16,8 +16,10 @@ // #include <uhd/transport/udp_zero_copy.hpp> +#include <boost/cstdint.hpp> #include <boost/thread.hpp> #include <boost/format.hpp> +#include <iostream> using namespace uhd::transport; @@ -36,7 +38,7 @@ public: } ~smart_buffer_impl(void){ - delete [] boost::asio::buffer_cast<const uint32_t *>(_buff); + delete [] boost::asio::buffer_cast<const boost::uint32_t *>(_buff); } const boost::asio::const_buffer &get(void) const{ @@ -89,12 +91,12 @@ udp_zero_copy_impl::udp_zero_copy_impl(const std::string &addr, const std::strin // set the rx socket buffer size: // pick a huge size, and deal with whatever we get - set_recv_buff_size(54321e3); //some big number! + set_recv_buff_size(size_t(54321e3)); //some big number! size_t current_buff_size = get_recv_buff_size(); std::cout << boost::format( "Current rx socket buffer size: %d\n" ) % current_buff_size; - if (current_buff_size < .1e6) std::cout << boost::format( + if (current_buff_size < size_t(.1e6)) std::cout << boost::format( "Adjust max rx socket buffer size (linux only):\n" " sysctl -w net.core.rmem_max=VALUE\n" ); @@ -119,7 +121,7 @@ smart_buffer::sptr udp_zero_copy_impl::recv(void){ } //allocate memory and create buffer - uint32_t *buff_mem = new uint32_t[available/sizeof(uint32_t)]; + boost::uint32_t *buff_mem = new boost::uint32_t[available/sizeof(boost::uint32_t)]; boost::asio::mutable_buffer buff(buff_mem, available); //receive only if data is available diff --git a/host/lib/transport/vrt.cpp b/host/lib/transport/vrt.cpp index 5029df217..a06b5bf21 100644 --- a/host/lib/transport/vrt.cpp +++ b/host/lib/transport/vrt.cpp @@ -16,20 +16,21 @@ // #include <uhd/transport/vrt.hpp> -#include <netinet/in.h> +#include <boost/asio.hpp> //endianness conversion #include <stdexcept> +using namespace uhd; using namespace uhd::transport; void vrt::pack( const tx_metadata_t &metadata, //input - uint32_t *header_buff, //output + boost::uint32_t *header_buff, //output size_t &num_header_words32, //output size_t num_payload_words32, //input size_t &num_packet_words32, //output size_t packet_count //input ){ - uint32_t vrt_hdr_flags = 0; + boost::uint32_t vrt_hdr_flags = 0; num_header_words32 = 1; //load the vrt header and flags @@ -58,18 +59,18 @@ void vrt::pack( } void vrt::unpack( - rx_metadata_t &metadata, //output - const uint32_t *header_buff, //input - size_t &num_header_words32, //output - size_t &num_payload_words32, //output - size_t num_packet_words32, //input - size_t &packet_count //output + rx_metadata_t &metadata, //output + const boost::uint32_t *header_buff, //input + size_t &num_header_words32, //output + size_t &num_payload_words32, //output + size_t num_packet_words32, //input + size_t &packet_count //output ){ //clear the metadata metadata = rx_metadata_t(); //extract vrt header - uint32_t vrt_hdr_word = ntohl(header_buff[0]); + boost::uint32_t vrt_hdr_word = ntohl(header_buff[0]); size_t packet_words32 = vrt_hdr_word & 0xffff; packet_count = (vrt_hdr_word >> 16) & 0xf; |