diff options
author | Josh Blum <josh@joshknows.com> | 2012-02-14 16:34:36 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-02-14 16:34:36 -0800 |
commit | 82d38412e2688bb41967b301ce0de084e82cdeef (patch) | |
tree | ac3ec78962b2d7643d4ebf45ecf9d5e4ef6b125d | |
parent | 1463a78fd2ebac1985182dede9c3ec1af11a3799 (diff) | |
download | uhd-82d38412e2688bb41967b301ce0de084e82cdeef.tar.gz uhd-82d38412e2688bb41967b301ce0de084e82cdeef.tar.bz2 uhd-82d38412e2688bb41967b301ce0de084e82cdeef.zip |
b100: use frame boundary to calculate frame size
-rw-r--r-- | host/lib/transport/usb_zero_copy_wrapper.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/b100/io_impl.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/host/lib/transport/usb_zero_copy_wrapper.cpp b/host/lib/transport/usb_zero_copy_wrapper.cpp index 07105cad3..690e5aaa2 100644 --- a/host/lib/transport/usb_zero_copy_wrapper.cpp +++ b/host/lib/transport/usb_zero_copy_wrapper.cpp @@ -112,6 +112,7 @@ class usb_zero_copy_wrapper : public usb_zero_copy{ public: usb_zero_copy_wrapper(sptr usb_zc, const size_t frame_boundary): _internal_zc(usb_zc), + _frame_boundary(frame_boundary), _available_recv_buffs(this->get_num_recv_frames()), _mrb_pool(this->get_num_recv_frames(), usb_zero_copy_wrapper_mrb(_available_recv_buffs)), _the_only_msb(usb_zero_copy_wrapper_msb(usb_zc, frame_boundary)) @@ -157,7 +158,7 @@ public: } size_t get_recv_frame_size(void) const{ - return _internal_zc->get_recv_frame_size(); + return std::min(_frame_boundary, _internal_zc->get_recv_frame_size()); } managed_send_buffer::sptr get_send_buff(double timeout){ @@ -169,11 +170,12 @@ public: } size_t get_send_frame_size(void) const{ - return _internal_zc->get_send_frame_size(); + return std::min(_frame_boundary, _internal_zc->get_send_frame_size()); } private: sptr _internal_zc; + size_t _frame_boundary; bounded_buffer<usb_zero_copy_wrapper_mrb *> _available_recv_buffs; std::vector<usb_zero_copy_wrapper_mrb> _mrb_pool; usb_zero_copy_wrapper_msb _the_only_msb; diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp index d7effcac1..6f8d3fb52 100644 --- a/host/lib/usrp/b100/io_impl.cpp +++ b/host/lib/usrp/b100/io_impl.cpp @@ -206,7 +206,7 @@ rx_streamer::sptr b100_impl::get_rx_stream(const uhd::stream_args_t &args_){ - sizeof(vrt::if_packet_info_t().cid) //no class id ever used - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used ; - const size_t bpp = B100_MAX_PKT_BYTE_LIMIT - hdr_size; + const size_t bpp = _data_transport->get_recv_frame_size() - hdr_size; const size_t bpi = convert::get_bytes_per_item(args.otw_format); const size_t spp = unsigned(args.args.cast<double>("spp", bpp/bpi)); @@ -263,7 +263,7 @@ tx_streamer::sptr b100_impl::get_tx_stream(const uhd::stream_args_t &args_){ - sizeof(vrt::if_packet_info_t().cid) //no class id ever used - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used ; - static const size_t bpp = B100_MAX_PKT_BYTE_LIMIT - hdr_size; + static const size_t bpp = _data_transport->get_send_frame_size() - hdr_size; const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); //make the new streamer given the samples per packet |