summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-14 19:49:17 +0100
committerJosh Blum <josh@joshknows.com>2011-04-16 17:57:12 +0100
commit76fb9508a9cb4cb45ef48af4bd3afb4ac507813b (patch)
tree5f90c24447f1a62c651c3bce2ea101e408f63c5f
parent546b5b882902a065c667b45d0529978340457786 (diff)
downloaduhd-76fb9508a9cb4cb45ef48af4bd3afb4ac507813b.tar.gz
uhd-76fb9508a9cb4cb45ef48af4bd3afb4ac507813b.tar.bz2
uhd-76fb9508a9cb4cb45ef48af4bd3afb4ac507813b.zip
usrp_e100: added recv/send_frame_size xport args
-rw-r--r--host/lib/usrp/usrp_e100/io_impl.cpp15
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_impl.cpp12
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_impl.hpp7
3 files changed, 23 insertions, 11 deletions
diff --git a/host/lib/usrp/usrp_e100/io_impl.cpp b/host/lib/usrp/usrp_e100/io_impl.cpp
index 51ff02d3b..40b8a2393 100644
--- a/host/lib/usrp/usrp_e100/io_impl.cpp
+++ b/host/lib/usrp/usrp_e100/io_impl.cpp
@@ -31,8 +31,6 @@ using namespace uhd;
using namespace uhd::usrp;
using namespace uhd::transport;
-zero_copy_if::sptr usrp_e100_make_mmap_zero_copy(usrp_e100_iface::sptr iface);
-
/***********************************************************************
* Constants
**********************************************************************/
@@ -49,8 +47,8 @@ static const bool recv_debug = false;
* - vrt packet handler states
**********************************************************************/
struct usrp_e100_impl::io_impl{
- io_impl(usrp_e100_iface::sptr iface):
- data_xport(usrp_e100_make_mmap_zero_copy(iface)),
+ io_impl(zero_copy_if::sptr &xport):
+ data_xport(xport),
get_recv_buffs_fcn(boost::bind(&usrp_e100_impl::io_impl::get_recv_buffs, this, _1)),
get_send_buffs_fcn(boost::bind(&usrp_e100_impl::io_impl::get_send_buffs, this, _1)),
recv_pirate_booty(data_xport->get_num_recv_frames()),
@@ -79,7 +77,8 @@ struct usrp_e100_impl::io_impl{
//The data transport is listed first so that it is deconstructed last,
//which is after the states and booty which may hold managed buffers.
- zero_copy_if::sptr data_xport;
+ //This comment is invalid because its now a reference and not stored here.
+ zero_copy_if::sptr &data_xport;
//bound callbacks for get buffs (bound once here, not in fast-path)
vrt_packet_handler::get_recv_buffs_t get_recv_buffs_fcn;
@@ -181,7 +180,7 @@ void usrp_e100_impl::io_init(void){
_recv_otw_type.byteorder = otw_type_t::BO_LITTLE_ENDIAN;
//setup before the registers (transport called to calculate max spp)
- _io_impl = UHD_PIMPL_MAKE(io_impl, (_iface));
+ _io_impl = UHD_PIMPL_MAKE(io_impl, (_data_xport));
//clear state machines
_iface->poke32(UE_REG_CTRL_RX_CLEAR, 0);
@@ -234,7 +233,7 @@ size_t usrp_e100_impl::get_max_send_samps_per_packet(void) const{
+ vrt::max_if_hdr_words32*sizeof(boost::uint32_t)
- sizeof(vrt::if_packet_info_t().cid) //no class id ever used
;
- size_t bpp = _io_impl->data_xport->get_send_frame_size() - hdr_size;
+ size_t bpp = _send_frame_size - hdr_size;
return bpp/_send_otw_type.get_sample_size();
}
@@ -265,7 +264,7 @@ size_t usrp_e100_impl::get_max_recv_samps_per_packet(void) const{
+ sizeof(vrt::if_packet_info_t().tlr) //forced to have trailer
- sizeof(vrt::if_packet_info_t().cid) //no class id ever used
;
- size_t bpp = _io_impl->data_xport->get_recv_frame_size() - hdr_size;
+ size_t bpp = _recv_frame_size - hdr_size;
return bpp/_recv_otw_type.get_sample_size();
}
diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
index a8fbe5d69..fe839c409 100644
--- a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
+++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
@@ -138,7 +138,7 @@ static device::sptr usrp_e100_make(const device_addr_t &device_addr){
) % USRP_E_FPGA_COMPAT_NUM % fpga_compat_num));
}
- return device::sptr(new usrp_e100_impl(iface));
+ return device::sptr(new usrp_e100_impl(iface, device_addr));
}
UHD_STATIC_BLOCK(register_usrp_e100_device){
@@ -148,7 +148,15 @@ UHD_STATIC_BLOCK(register_usrp_e100_device){
/***********************************************************************
* Structors
**********************************************************************/
-usrp_e100_impl::usrp_e100_impl(usrp_e100_iface::sptr iface): _iface(iface){
+usrp_e100_impl::usrp_e100_impl(
+ usrp_e100_iface::sptr iface,
+ const device_addr_t &device_addr
+):
+ _iface(iface),
+ _data_xport(usrp_e100_make_mmap_zero_copy(_iface)),
+ _recv_frame_size(std::min(_data_xport->get_recv_frame_size(), size_t(device_addr.cast<double>("recv_frame_size", 1e9)))),
+ _send_frame_size(std::min(_data_xport->get_send_frame_size(), size_t(device_addr.cast<double>("send_frame_size", 1e9))))
+{
//setup interfaces into hardware
_clock_ctrl = usrp_e100_clock_ctrl::make(_iface);
diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp
index 737aa4e8f..ab3379dd5 100644
--- a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp
+++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp
@@ -26,10 +26,13 @@
#include <uhd/types/clock_config.hpp>
#include <uhd/types/stream_cmd.hpp>
#include <uhd/usrp/dboard_manager.hpp>
+#include <uhd/transport/zero_copy.hpp>
#ifndef INCLUDED_USRP_E100_IMPL_HPP
#define INCLUDED_USRP_E100_IMPL_HPP
+uhd::transport::zero_copy_if::sptr usrp_e100_make_mmap_zero_copy(usrp_e100_iface::sptr iface);
+
static const boost::uint16_t USRP_E_FPGA_COMPAT_NUM = 0x03;
//! load an fpga image from a bin file into the usrp-e fpga
@@ -79,7 +82,7 @@ private:
class usrp_e100_impl : public uhd::device{
public:
//structors
- usrp_e100_impl(usrp_e100_iface::sptr);
+ usrp_e100_impl(usrp_e100_iface::sptr, const uhd::device_addr_t &);
~usrp_e100_impl(void);
//the io interface
@@ -94,7 +97,9 @@ private:
usrp_e100_iface::sptr _iface;
//handle io stuff
+ uhd::transport::zero_copy_if::sptr _data_xport;
UHD_PIMPL_DECL(io_impl) _io_impl;
+ size_t _recv_frame_size, _send_frame_size;
uhd::otw_type_t _send_otw_type, _recv_otw_type;
void io_init(void);
void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd);