aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-02 15:21:56 -0700
committerJosh Blum <josh@joshknows.com>2010-06-02 15:21:56 -0700
commita4494bc2c985919aee7119ed401c72f41cde206e (patch)
treec1ff7ff39521e39f976f2f2318575561cc2742a2 /host/lib/usrp/usrp2
parent92fd3a514b6808e7b94f172c75afb2026b849fce (diff)
downloaduhd-a4494bc2c985919aee7119ed401c72f41cde206e.tar.gz
uhd-a4494bc2c985919aee7119ed401c72f41cde206e.tar.bz2
uhd-a4494bc2c985919aee7119ed401c72f41cde206e.zip
use smart pointer for io impl, simplify send buffer callback
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp12
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp3
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp3
3 files changed, 4 insertions, 14 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 43d6e814a..5d425bd8a 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -122,20 +122,12 @@ void usrp2_impl::io_init(void){
std::cout << "TX samples per packet: " << get_max_send_samps_per_packet() << std::endl;
//create new io impl
- _io_impl = new io_impl(_data_transport);
-}
-
-void usrp2_impl::io_done(void){
- delete _io_impl;
+ _io_impl = boost::shared_ptr<io_impl>(new io_impl(_data_transport));
}
/***********************************************************************
* Send Data
**********************************************************************/
-static inline managed_send_buffer::sptr get_send_buff(zero_copy_if::sptr zc_if){
- return zc_if->get_send_buff();
-}
-
size_t usrp2_impl::send(
const asio::const_buffer &buff,
const tx_metadata_t &metadata,
@@ -147,7 +139,7 @@ size_t usrp2_impl::send(
buff, metadata, send_mode, //buffer to empty and samples metadata
io_type, _tx_otw_type, //input and output types to convert
get_master_clock_freq(), //master clock tick rate
- boost::bind(get_send_buff, _data_transport),
+ boost::bind(&zero_copy_if::get_send_buff, _data_transport),
get_max_send_samps_per_packet()
);
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 7f79c483b..af3ec216a 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -185,8 +185,7 @@ usrp2_impl::usrp2_impl(
}
usrp2_impl::~usrp2_impl(void){
- //cleanup the send and recv io
- io_done();
+ /* NOP */
}
/***********************************************************************
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 4b6805217..bb4554e8d 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -153,9 +153,8 @@ private:
;
uhd::otw_type_t _rx_otw_type, _tx_otw_type;
- struct io_impl; io_impl *_io_impl;
+ struct io_impl; boost::shared_ptr<io_impl> _io_impl;
void io_init(void);
- void io_done(void);
//udp transports for control and data
uhd::transport::udp_zero_copy::sptr _data_transport;