aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-29 22:55:45 -0700
committerJosh Blum <josh@joshknows.com>2010-07-05 13:45:11 -0700
commit08fad28f209a2f6c79d939ad54ca3a1d4e270b0b (patch)
tree6561410b24bcf0f3e72d680c27143b3b2a015bd0 /host/lib/usrp/usrp2
parent01e5f592d62e2193cc88081bd88765cae4708148 (diff)
downloaduhd-08fad28f209a2f6c79d939ad54ca3a1d4e270b0b.tar.gz
uhd-08fad28f209a2f6c79d939ad54ca3a1d4e270b0b.tar.bz2
uhd-08fad28f209a2f6c79d939ad54ca3a1d4e270b0b.zip
uhd: work vectorizing the vrt packet handler, reworked vrt packet stuff, needs testing
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp32
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp9
2 files changed, 28 insertions, 13 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index aa0f63321..e3a3a3b17 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -52,7 +52,7 @@ struct usrp2_impl::io_impl{
bounded_buffer<managed_recv_buffer::sptr>::sptr recv_pirate_booty;
};
-usrp2_impl::io_impl::io_impl(zero_copy_if::sptr zc_if){
+usrp2_impl::io_impl::io_impl(zero_copy_if::sptr zc_if): packet_handler_recv_state(1){
//create a large enough booty
size_t num_frames = zc_if->get_num_recv_frames();
std::cout << "Recv pirate num frames: " << num_frames << std::endl;
@@ -130,19 +130,26 @@ void usrp2_impl::io_init(void){
/***********************************************************************
* Send Data
**********************************************************************/
+bool tmp_todo_fixme_remove_get_send_buffs(vrt_packet_handler::managed_send_buffs_t &buffs, const zero_copy_if::sptr &zc_if){
+ buffs[0] = zc_if->get_send_buff();
+ return buffs[0].get() != NULL;
+}
+
size_t usrp2_impl::send(
- const asio::const_buffer &buff,
+ const std::vector<const void *> &buffs,
+ size_t nsamps_per_buff,
const tx_metadata_t &metadata,
const io_type_t &io_type,
send_mode_t send_mode
){
return vrt_packet_handler::send(
_io_impl->packet_handler_send_state, //last state of the send handler
- buff, metadata, send_mode, //buffer to empty and samples metadata
+ buffs, nsamps_per_buff, //buffer to empty
+ metadata, send_mode, //samples metadata
io_type, _tx_otw_type, //input and output types to convert
get_master_clock_freq(), //master clock tick rate
- uhd::transport::vrt::pack_be,
- boost::bind(&zero_copy_if::get_send_buff, _data_transport),
+ uhd::transport::vrt::if_hdr_pack_be,
+ boost::bind(&tmp_todo_fixme_remove_get_send_buffs, _1, _data_transport),
get_max_send_samps_per_packet()
);
}
@@ -150,18 +157,25 @@ size_t usrp2_impl::send(
/***********************************************************************
* Receive Data
**********************************************************************/
+bool tmp_todo_fixme_remove_get_recv_buffs(vrt_packet_handler::managed_recv_buffs_t &buffs, boost::shared_ptr<usrp2_impl::io_impl> impl){
+ buffs[0] = impl->get_recv_buff();
+ return buffs[0].get() != NULL;
+}
+
size_t usrp2_impl::recv(
- const asio::mutable_buffer &buff,
+ const std::vector<void *> &buffs,
+ size_t nsamps_per_buff,
rx_metadata_t &metadata,
const io_type_t &io_type,
recv_mode_t recv_mode
){
return vrt_packet_handler::recv(
_io_impl->packet_handler_recv_state, //last state of the recv handler
- buff, metadata, recv_mode, //buffer to fill and samples metadata
+ buffs, nsamps_per_buff, //buffer to empty
+ metadata, recv_mode, //samples metadata
io_type, _rx_otw_type, //input and output types to convert
get_master_clock_freq(), //master clock tick rate
- uhd::transport::vrt::unpack_be,
- boost::bind(&usrp2_impl::io_impl::get_recv_buff, _io_impl)
+ uhd::transport::vrt::if_hdr_unpack_be,
+ boost::bind(&tmp_todo_fixme_remove_get_recv_buffs, _1, _io_impl)
);
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 2126b9565..70735173e 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -108,7 +108,7 @@ public:
return _max_tx_bytes_per_packet/_tx_otw_type.get_sample_size();
}
size_t send(
- const boost::asio::const_buffer &,
+ const std::vector<const void *> &, size_t,
const uhd::tx_metadata_t &,
const uhd::io_type_t &,
uhd::device::send_mode_t
@@ -117,12 +117,14 @@ public:
return _max_rx_bytes_per_packet/_rx_otw_type.get_sample_size();
}
size_t recv(
- const boost::asio::mutable_buffer &,
+ const std::vector<void *> &, size_t,
uhd::rx_metadata_t &,
const uhd::io_type_t &,
uhd::device::recv_mode_t
);
+ UHD_PIMPL_DECL(io_impl) _io_impl;
+
private:
inline double get_master_clock_freq(void){
return _clock_ctrl->get_master_clock_rate();
@@ -148,11 +150,10 @@ private:
;
static const size_t _max_tx_bytes_per_packet =
USRP2_UDP_BYTES -
- uhd::transport::vrt::max_header_words32*sizeof(boost::uint32_t)
+ uhd::transport::vrt::max_if_hdr_words32*sizeof(boost::uint32_t)
;
uhd::otw_type_t _rx_otw_type, _tx_otw_type;
- UHD_PIMPL_DECL(io_impl) _io_impl;
void io_init(void);
//udp transports for control and data