diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-02 22:07:17 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-02 22:07:17 -0800 |
commit | 4efafcc2e20b9a980800a979edf5ea7a493b6462 (patch) | |
tree | 49fbf3c6e5b25f31a0de30ecf11ceb19872e590f /host/lib/usrp/usrp2/usrp2_impl.hpp | |
parent | 13bd67b4949a91df5e6696e708c935266b14c502 (diff) | |
download | uhd-4efafcc2e20b9a980800a979edf5ea7a493b6462.tar.gz uhd-4efafcc2e20b9a980800a979edf5ea7a493b6462.tar.bz2 uhd-4efafcc2e20b9a980800a979edf5ea7a493b6462.zip |
Expanded the UDP api:
We can make simple udp transports for discovery and control.
We can support a udp zero copy transport (currently just asio).
Reworked the io_impl for usrp2 to work with the zero copy api.
So far, all of this untested other than compiling.
A cut-down vrt library is in the works to simplify the io impl.
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_impl.hpp')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 037aed477..a58bf8471 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -22,7 +22,8 @@ #include <boost/thread.hpp> #include <boost/shared_ptr.hpp> #include <boost/function.hpp> -#include <uhd/transport/udp.hpp> +#include <uhd/transport/udp_simple.hpp> +#include <uhd/transport/udp_zero_copy.hpp> #include <uhd/usrp/dboard_manager.hpp> #include "fw_common.h" @@ -81,8 +82,8 @@ public: * \param data_transport the udp transport for data */ usrp2_impl( - uhd::transport::udp::sptr ctrl_transport, - uhd::transport::udp::sptr data_transport + uhd::transport::udp_simple::sptr ctrl_transport, + uhd::transport::udp_zero_copy::sptr data_transport ); ~usrp2_impl(void); @@ -103,8 +104,8 @@ public: private: //the raw io interface (samples are in the usrp2 native format) - size_t send_raw(const boost::asio::const_buffer &, const uhd::metadata_t &); - size_t recv_raw(const boost::asio::mutable_buffer &, uhd::metadata_t &); + size_t send_raw(const uhd::metadata_t &); + void recv_raw(uhd::metadata_t &); uhd::dict<uint32_t, size_t> _tx_stream_id_to_packet_seq; uhd::dict<uint32_t, size_t> _rx_stream_id_to_packet_seq; static const size_t _mtu = 1500; //FIXME we have no idea @@ -114,15 +115,16 @@ private: USRP2_HOST_RX_VRT_TRAILER_WORDS32 - ((2 + 14 + 20 + 8)/sizeof(uint32_t)) //size of headers (pad, eth, ip, udp) ; - uint32_t _tmp_send_mem[_mtu/sizeof(uint32_t)]; - uint32_t _tmp_recv_mem[_mtu/sizeof(uint32_t)]; - uint32_t _spillover_mem[_mtu/sizeof(uint32_t)]; - boost::asio::mutable_buffer _splillover_buff; + static const size_t _tx_vrt_max_offset_words32 = 7; //TODO move to future vrt lib + uint32_t _tx_mem[_mtu/sizeof(uint32_t)]; + boost::asio::const_buffer _tx_copy_buff; + uhd::transport::smart_buffer::sptr _rx_smart_buff; + boost::asio::const_buffer _rx_copy_buff; void io_init(void); //udp transports for control and data - uhd::transport::udp::sptr _ctrl_transport; - uhd::transport::udp::sptr _data_transport; + uhd::transport::udp_simple::sptr _ctrl_transport; + uhd::transport::udp_zero_copy::sptr _data_transport; //private vars for dealing with send/recv control uint32_t _ctrl_seq_num; |