diff options
author | Josh Blum <josh@joshknows.com> | 2010-07-20 16:58:33 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-07-20 16:58:33 -0700 |
commit | 8e29df8b3176d966ba2b987f0bbaea108ba8135c (patch) | |
tree | 6d142c308ea0c197a464a93a6a7fbd3d0d1f5ab2 /host/lib | |
parent | 20381a1c839ded4eb58728d3a1fd3a952d2444f6 (diff) | |
parent | 5a4545d3f9689dcddd88f9316ad7bd9c489a3925 (diff) | |
download | uhd-8e29df8b3176d966ba2b987f0bbaea108ba8135c.tar.gz uhd-8e29df8b3176d966ba2b987f0bbaea108ba8135c.tar.bz2 uhd-8e29df8b3176d966ba2b987f0bbaea108ba8135c.zip |
Merge branch 'master' into tx_report
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/transport/vrt_packet_handler.hpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 8 |
3 files changed, 17 insertions, 23 deletions
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp index bd76cbb8f..07ad9115c 100644 --- a/host/lib/transport/vrt_packet_handler.hpp +++ b/host/lib/transport/vrt_packet_handler.hpp @@ -41,6 +41,7 @@ namespace vrt_packet_handler{ typedef std::vector<uhd::transport::managed_recv_buffer::sptr> managed_recv_buffs_t; typedef boost::function<bool(managed_recv_buffs_t &)> get_recv_buffs_t; typedef boost::function<void(size_t /*which channel*/)> handle_overrun_t; + typedef boost::function<void(const boost::uint32_t *, uhd::transport::vrt::if_packet_info_t &)> vrt_unpacker_t; static inline void handle_overrun_nop(size_t){} @@ -69,12 +70,11 @@ namespace vrt_packet_handler{ * Unpack a received vrt header and set the copy buffer. * - helper function for vrt_packet_handler::_recv1 ******************************************************************/ - template<typename vrt_unpacker_type> static UHD_INLINE void _recv1_helper( recv_state &state, uhd::rx_metadata_t &metadata, double tick_rate, - vrt_unpacker_type vrt_unpacker, + const vrt_unpacker_t &vrt_unpacker, const handle_overrun_t &handle_overrun, size_t vrt_header_offset_words32 ){ @@ -131,7 +131,6 @@ namespace vrt_packet_handler{ * Recv data, unpack a vrt header, and copy-convert the data. * - helper function for vrt_packet_handler::recv ******************************************************************/ - template<typename vrt_unpacker_type> static UHD_INLINE size_t _recv1( recv_state &state, const std::vector<void *> &buffs, @@ -141,7 +140,7 @@ namespace vrt_packet_handler{ const uhd::io_type_t &io_type, const uhd::otw_type_t &otw_type, double tick_rate, - vrt_unpacker_type vrt_unpacker, + const vrt_unpacker_t &vrt_unpacker, const get_recv_buffs_t &get_recv_buffs, const handle_overrun_t &handle_overrun, size_t vrt_header_offset_words32 @@ -206,7 +205,6 @@ namespace vrt_packet_handler{ /******************************************************************* * Recv vrt packets and copy convert the samples into the buffer. ******************************************************************/ - template<typename vrt_unpacker_type> static UHD_INLINE size_t recv( recv_state &state, const std::vector<void *> &buffs, @@ -216,7 +214,7 @@ namespace vrt_packet_handler{ const uhd::io_type_t &io_type, const uhd::otw_type_t &otw_type, double tick_rate, - vrt_unpacker_type vrt_unpacker, + const vrt_unpacker_t &vrt_unpacker, const get_recv_buffs_t &get_recv_buffs, const handle_overrun_t &handle_overrun = &handle_overrun_nop, size_t vrt_header_offset_words32 = 0 @@ -273,6 +271,7 @@ namespace vrt_packet_handler{ **********************************************************************/ typedef std::vector<uhd::transport::managed_send_buffer::sptr> managed_send_buffs_t; typedef boost::function<bool(managed_send_buffs_t &)> get_send_buffs_t; + typedef boost::function<void(boost::uint32_t *, uhd::transport::vrt::if_packet_info_t &)> vrt_packer_t; struct send_state{ //init the expected seq number @@ -334,7 +333,6 @@ namespace vrt_packet_handler{ /******************************************************************* * Send vrt packets and copy convert the samples into the buffer. ******************************************************************/ - template<typename vrt_packer_type> static UHD_INLINE size_t send( send_state &state, const std::vector<const void *> &buffs, @@ -344,7 +342,7 @@ namespace vrt_packet_handler{ const uhd::io_type_t &io_type, const uhd::otw_type_t &otw_type, double tick_rate, - vrt_packer_type vrt_packer, + const vrt_packer_t &vrt_packer, const get_send_buffs_t &get_send_buffs, size_t max_samples_per_packet, size_t vrt_header_offset_words32 = 0 diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index e4a49184e..1947fdf00 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -57,7 +57,7 @@ struct usrp2_impl::io_impl{ bool get_recv_buffs(vrt_packet_handler::managed_recv_buffs_t &buffs){ boost::this_thread::disable_interruption di; //disable because the wait can throw - return recv_pirate_booty->pop_elems_with_timed_wait(buffs, boost::posix_time::milliseconds(100)); + return recv_pirate_booty->pop_elems_with_timed_wait(buffs, boost::posix_time::milliseconds(recv_timeout_ms)); } //state management for the vrt packet handler code @@ -69,6 +69,7 @@ struct usrp2_impl::io_impl{ boost::thread_group recv_pirate_crew; bool recv_pirate_crew_raiding; alignment_buffer_type::sptr recv_pirate_booty; + size_t recv_timeout_ms; }; /*********************************************************************** @@ -170,10 +171,8 @@ bool get_send_buffs( } size_t usrp2_impl::send( - const std::vector<const void *> &buffs, - size_t num_samps, - const tx_metadata_t &metadata, - const io_type_t &io_type, + const std::vector<const void *> &buffs, size_t num_samps, + const tx_metadata_t &metadata, const io_type_t &io_type, send_mode_t send_mode ){ return vrt_packet_handler::send( @@ -192,12 +191,11 @@ size_t usrp2_impl::send( * Receive Data **********************************************************************/ size_t usrp2_impl::recv( - const std::vector<void *> &buffs, - size_t num_samps, - rx_metadata_t &metadata, - const io_type_t &io_type, - recv_mode_t recv_mode + const std::vector<void *> &buffs, size_t num_samps, + rx_metadata_t &metadata, const io_type_t &io_type, + recv_mode_t recv_mode, size_t timeout_ms ){ + _io_impl->recv_timeout_ms = timeout_ms; return vrt_packet_handler::recv( _io_impl->packet_handler_recv_state, //last state of the recv handler buffs, num_samps, //buffer to fill diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index ab23830c0..cae1b21d6 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -224,8 +224,7 @@ public: } size_t send( const std::vector<const void *> &, size_t, - const uhd::tx_metadata_t &, - const uhd::io_type_t &, + const uhd::tx_metadata_t &, const uhd::io_type_t &, uhd::device::send_mode_t ); size_t get_max_recv_samps_per_packet(void) const{ @@ -233,9 +232,8 @@ public: } size_t recv( const std::vector<void *> &, size_t, - uhd::rx_metadata_t &, - const uhd::io_type_t &, - uhd::device::recv_mode_t + uhd::rx_metadata_t &, const uhd::io_type_t &, + uhd::device::recv_mode_t, size_t ); private: |