summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-03 16:50:45 -0700
committerJosh Blum <josh@joshknows.com>2010-07-05 13:49:00 -0700
commit11f2aa1ea0fd6c28a20c6d85f94e41a06b3a6770 (patch)
tree35f29c651cf400b03c5aba6939dcc03cc35e2ea7
parent52ea9b8f90c56c12e978387aee670b45d93d74a5 (diff)
downloaduhd-11f2aa1ea0fd6c28a20c6d85f94e41a06b3a6770.tar.gz
uhd-11f2aa1ea0fd6c28a20c6d85f94e41a06b3a6770.tar.bz2
uhd-11f2aa1ea0fd6c28a20c6d85f94e41a06b3a6770.zip
uhd: replaced old send and recv with inline wrappers that take a single buffer and look more like the vectored send/recv
-rw-r--r--host/examples/benchmark_rx_rate.cpp4
-rw-r--r--host/examples/rx_timed_samples.cpp2
-rw-r--r--host/examples/tx_timed_samples.cpp4
-rw-r--r--host/include/uhd/device.hpp53
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp1
5 files changed, 34 insertions, 30 deletions
diff --git a/host/examples/benchmark_rx_rate.cpp b/host/examples/benchmark_rx_rate.cpp
index e7e358e4c..6984d7eff 100644
--- a/host/examples/benchmark_rx_rate.cpp
+++ b/host/examples/benchmark_rx_rate.cpp
@@ -49,7 +49,7 @@ static inline void test_device(
sdev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
do {
size_t num_rx_samps = dev->recv(
- boost::asio::buffer(buff), md,
+ &buff.front(), buff.size(), md,
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
@@ -79,7 +79,7 @@ static inline void test_device(
//flush the buffers
while(dev->recv(
- boost::asio::buffer(buff), md,
+ &buff.front(), buff.size(), md,
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
));
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 3c3c3fdc6..9ff8772bc 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -85,7 +85,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::rx_metadata_t md;
std::vector<std::complex<float> > buff(dev->get_max_recv_samps_per_packet());
size_t num_rx_samps = dev->recv(
- boost::asio::buffer(buff), md,
+ &buff.front(), buff.size(), md,
uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::RECV_MODE_ONE_PACKET
);
diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp
index 846d9b6f4..4226aa4c8 100644
--- a/host/examples/tx_timed_samples.cpp
+++ b/host/examples/tx_timed_samples.cpp
@@ -81,8 +81,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//send the entire buffer, let the driver handle fragmentation
size_t num_tx_samps = dev->send(
- boost::asio::buffer(buff),
- md, uhd::io_type_t::COMPLEX_FLOAT32,
+ &buff.front(), buff.size(), md,
+ uhd::io_type_t::COMPLEX_FLOAT32,
uhd::device::SEND_MODE_FULL_BUFF
);
std::cout << std::endl << boost::format("Sent %d samples") % num_tx_samps << std::endl;
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index f04a5b4fb..e5ef1181f 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -26,7 +26,6 @@
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include <boost/asio/buffer.hpp>
#include <vector>
namespace uhd{
@@ -97,20 +96,6 @@ public:
RECV_MODE_ONE_PACKET = 1
};
- //! wrapper call for single buffer recv //TODO put somewhere
- size_t send(
- const boost::asio::const_buffer &buff,
- const tx_metadata_t &metadata,
- const io_type_t &io_type,
- send_mode_t send_mode
- ){
- return send(
- std::vector<const void *>(1, boost::asio::buffer_cast<const void *>(buff)),
- boost::asio::buffer_size(buff)/io_type.size,
- metadata, io_type, send_mode
- );
- }
-
/*!
* Send buffers containing IF data described by the metadata.
*
@@ -140,17 +125,20 @@ public:
send_mode_t send_mode
) = 0;
- //! wrapper call for single buffer recv //TODO put somewhere
- size_t recv(
- const boost::asio::mutable_buffer &buff,
- rx_metadata_t &metadata,
+ /*!
+ * Convenience wrapper for send that takes a single buffer.
+ */
+ inline size_t send(
+ const void *buff,
+ size_t nsamps_per_buff,
+ const tx_metadata_t &metadata,
const io_type_t &io_type,
- recv_mode_t recv_mode
+ send_mode_t send_mode
){
- return recv(
- std::vector<void *>(1, boost::asio::buffer_cast<void *>(buff)),
- boost::asio::buffer_size(buff)/io_type.size,
- metadata, io_type, recv_mode
+ return send(
+ std::vector<const void *>(1, buff),
+ nsamps_per_buff, metadata,
+ io_type, send_mode
);
}
@@ -196,6 +184,23 @@ public:
) = 0;
/*!
+ * Convenience wrapper for recv that takes a single buffer.
+ */
+ inline size_t recv(
+ void *buff,
+ size_t nsamps_per_buff,
+ rx_metadata_t &metadata,
+ const io_type_t &io_type,
+ recv_mode_t recv_mode
+ ){
+ return recv(
+ std::vector<void *>(1, buff),
+ nsamps_per_buff, metadata,
+ io_type, recv_mode
+ );
+ }
+
+ /*!
* Get the maximum number of samples per packet on send.
* \return the number of samples
*/
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index 31b7e6614..42cbb7e5a 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -27,7 +27,6 @@
#include <uhd/transport/vrt_if_packet.hpp>
#include <uhd/transport/convert_types.hpp>
#include <uhd/transport/zero_copy.hpp>
-#include <boost/asio/buffer.hpp>
#include <boost/function.hpp>
#include <stdexcept>
#include <iostream>