summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-27 09:42:36 -0700
committerJosh Blum <josh@joshknows.com>2010-04-27 09:42:36 -0700
commitb920557788fc5435915584bec6ab16a97d7c6090 (patch)
tree36ad5dc6058cd7164f11f47430ba6d0ace84e6ab /host/lib/usrp/usrp2
parent8497eb2ac016f72e2b9a9028e5126bc73f5b0c9a (diff)
downloaduhd-b920557788fc5435915584bec6ab16a97d7c6090.tar.gz
uhd-b920557788fc5435915584bec6ab16a97d7c6090.tar.bz2
uhd-b920557788fc5435915584bec6ab16a97d7c6090.zip
work on controlling the socket buffer sizes from the front end api
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 4079357f9..ffcdbb43d 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -24,6 +24,7 @@
#include <boost/assign/list_of.hpp>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp> //htonl and ntohl
#include <iostream>
@@ -117,6 +118,26 @@ device::sptr usrp2::make(const device_addr_t &device_addr){
device_addr["addr"], num2str(USRP2_UDP_DATA_PORT)
);
+ //resize the recv data transport buffers
+ if (device_addr.has_key("recv_buff_size")){
+ size_t num_byes = size_t(boost::lexical_cast<double>(device_addr["recv_buff_size"]));
+ size_t actual_bytes = data_transport->set_recv_buff_size(num_byes);
+ std::cout << boost::format(
+ "Target recv buffer size: %d"
+ "Actual recv byffer size: %d"
+ ) % num_byes % actual_bytes << std::endl;
+ }
+
+ //resize the send data transport buffers
+ if (device_addr.has_key("send_buff_size")){
+ size_t num_byes = size_t(boost::lexical_cast<double>(device_addr["send_buff_size"]));
+ size_t actual_bytes = data_transport->set_send_buff_size(num_byes);
+ std::cout << boost::format(
+ "Target send buffer size: %d"
+ "Actual send byffer size: %d"
+ ) % num_byes % actual_bytes << std::endl;
+ }
+
//create the usrp2 implementation guts
return device::sptr(
new usrp2_impl(ctrl_transport, data_transport)