From dd8373063684418eb978cdd1a2b0896923ba1d47 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 30 Apr 2010 12:22:23 -0700 Subject: made buffer size args part of constructor --- host/lib/usrp/usrp2/usrp2_impl.cpp | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 2b974fb9b..1dde8c054 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -113,31 +113,23 @@ device::sptr usrp2::make(const device_addr_t &device_addr){ device_addr["addr"], num2str(USRP2_UDP_CTRL_PORT) ); - //create a data transport - udp_zero_copy::sptr data_transport = udp_zero_copy::make( - device_addr["addr"], num2str(USRP2_UDP_DATA_PORT) - ); - - //resize the recv data transport buffers + //extract the receive and send buffer sizes + size_t recv_buff_size = 0, send_buff_size= 0 ; if (device_addr.has_key("recv_buff_size")){ - size_t num_byes = size_t(boost::lexical_cast(device_addr["recv_buff_size"])); - size_t actual_bytes = data_transport->resize_recv_buff_size(num_byes); - if (num_byes != actual_bytes) std::cout << boost::format( - "Target recv buffer size: %d\n" - "Actual recv byffer size: %d" - ) % num_byes % actual_bytes << std::endl; + recv_buff_size = size_t(boost::lexical_cast(device_addr["recv_buff_size"])); } - - //resize the send data transport buffers if (device_addr.has_key("send_buff_size")){ - size_t num_byes = size_t(boost::lexical_cast(device_addr["send_buff_size"])); - size_t actual_bytes = data_transport->resize_send_buff_size(num_byes); - if (num_byes != actual_bytes) std::cout << boost::format( - "Target send buffer size: %d\n" - "Actual send byffer size: %d" - ) % num_byes % actual_bytes << std::endl; + send_buff_size = size_t(boost::lexical_cast(device_addr["send_buff_size"])); } + //create a data transport + udp_zero_copy::sptr data_transport = udp_zero_copy::make( + device_addr["addr"], + num2str(USRP2_UDP_DATA_PORT), + recv_buff_size, + send_buff_size + ); + //create the usrp2 implementation guts return device::sptr( new usrp2_impl(ctrl_transport, data_transport) -- cgit v1.2.3