aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-08-01 14:36:07 -0700
committerMartin Braun <martin.braun@ettus.com>2016-08-09 10:21:53 -0700
commit041264b4c46543fcd1a3321017249c1183afa452 (patch)
tree0419864d641d04018f0760ffba23672a5a5d519b /host
parentce2e7e5197ea7db5454a381c5b75c1c63b2d2d59 (diff)
downloaduhd-041264b4c46543fcd1a3321017249c1183afa452.tar.gz
uhd-041264b4c46543fcd1a3321017249c1183afa452.tar.bz2
uhd-041264b4c46543fcd1a3321017249c1183afa452.zip
ad936x: Loopback check now takes peeker/poker functors instead of assuming any kind of interface
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp8
-rw-r--r--host/lib/usrp/common/ad936x_manager.cpp12
-rw-r--r--host/lib/usrp/common/ad936x_manager.hpp5
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp15
4 files changed, 23 insertions, 17 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index ac113804c..9526ae2d1 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -620,11 +620,15 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
for (size_t i = 0; i < _radio_perifs.size(); i++)
this->setup_radio(i);
-
//now test each radio module's connection to the codec interface
BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs)
{
- _codec_mgr->loopback_self_test(perif.ctrl, TOREG(SR_CODEC_IDLE), RB64_CODEC_READBACK);
+ _codec_mgr->loopback_self_test(
+ boost::bind(
+ &b200_radio_ctrl_core::poke32, perif.ctrl, TOREG(SR_CODEC_IDLE), _1
+ ),
+ boost::bind(&b200_radio_ctrl_core::peek64, perif.ctrl, RB64_CODEC_READBACK)
+ );
}
//register time now and pps onto available radio cores
diff --git a/host/lib/usrp/common/ad936x_manager.cpp b/host/lib/usrp/common/ad936x_manager.cpp
index 58893395e..e7af411fa 100644
--- a/host/lib/usrp/common/ad936x_manager.cpp
+++ b/host/lib/usrp/common/ad936x_manager.cpp
@@ -93,14 +93,12 @@ class ad936x_manager_impl : public ad936x_manager
// worst case conditions to stress the interface.
//
void loopback_self_test(
- wb_iface::sptr iface,
- wb_iface::wb_addr_type codec_idle_addr,
- wb_iface::wb_addr_type codec_readback_addr
+ boost::function<void(uint32_t)> poker_functor,
+ boost::function<uint64_t()> peeker_functor
) {
// Put AD936x in loopback mode
_codec_ctrl->data_port_loopback(true);
UHD_MSG(status) << "Performing CODEC loopback test... " << std::flush;
- UHD_ASSERT_THROW(bool(iface));
size_t hash = size_t(time(NULL));
// Allow some time for AD936x to enter loopback mode.
@@ -118,10 +116,10 @@ class ad936x_manager_impl : public ad936x_manager
const boost::uint32_t word32 = boost::uint32_t(hash) & 0xfff0fff0;
// Write test word to codec_idle idle register (on TX side)
- iface->poke32(codec_idle_addr, word32);
+ poker_functor(word32);
// Read back values - TX is lower 32-bits and RX is upper 32-bits
- const boost::uint64_t rb_word64 = iface->peek64(codec_readback_addr);
+ const boost::uint64_t rb_word64 = peeker_functor();
const boost::uint32_t rb_tx = boost::uint32_t(rb_word64 >> 32);
const boost::uint32_t rb_rx = boost::uint32_t(rb_word64 & 0xffffffff);
@@ -136,7 +134,7 @@ class ad936x_manager_impl : public ad936x_manager
UHD_MSG(status) << "pass" << std::endl;
// Zero out the idle data.
- iface->poke32(codec_idle_addr, 0);
+ poker_functor(0);
// Take AD936x out of loopback mode
_codec_ctrl->data_port_loopback(false);
diff --git a/host/lib/usrp/common/ad936x_manager.hpp b/host/lib/usrp/common/ad936x_manager.hpp
index 9b4a351c6..c456715e3 100644
--- a/host/lib/usrp/common/ad936x_manager.hpp
+++ b/host/lib/usrp/common/ad936x_manager.hpp
@@ -80,9 +80,8 @@ public:
* \throws a uhd::runtime_error if the loopback value didn't match.
*/
virtual void loopback_self_test(
- wb_iface::sptr iface,
- wb_iface::wb_addr_type codec_idle_addr,
- wb_iface::wb_addr_type codec_readback_addr
+ boost::function<void(uint32_t)> poker_functor,
+ boost::function<uint64_t()> peeker_functor
) = 0;
/*! Determine a tick rate that will work with a given sampling rate
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index 5a589a7fd..114686b4f 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -510,11 +510,16 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
for(size_t instance = 0; instance < fpga::NUM_RADIOS; instance++)
this->_setup_radio(instance);
- // Radio 0 loopback through AD9361
- _codec_mgr->loopback_self_test(_radio_perifs[0].ctrl, radio::sr_addr(radio::CODEC_IDLE), radio::RB64_CODEC_READBACK);
- // Radio 1 loopback through AD9361
- _codec_mgr->loopback_self_test(_radio_perifs[1].ctrl, radio::sr_addr(radio::CODEC_IDLE), radio::RB64_CODEC_READBACK);
-
+ //now test each radio module's connection to the codec interface
+ BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs)
+ {
+ _codec_mgr->loopback_self_test(
+ boost::bind(
+ &radio_ctrl_core_3000::poke32, perif.ctrl, radio::sr_addr(radio::CODEC_IDLE), _1
+ ),
+ boost::bind(&radio_ctrl_core_3000::peek64, perif.ctrl, radio::RB64_CODEC_READBACK)
+ );
+ }
////////////////////////////////////////////////////////////////////
// internal gpios
////////////////////////////////////////////////////////////////////