aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/wb_iface_adapter.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-11-01 16:45:29 -0700
committerMartin Braun <martin.braun@ettus.com>2018-03-16 10:48:46 -0700
commit49520bfecb5e13126224ee915208c2cd936f911c (patch)
tree8daa638d55ffe5294306a6fe8e2c8b6261d8a375 /host/lib/rfnoc/wb_iface_adapter.cpp
parent60a911cd460ca1e29d838ee0039d67bf7c8fe7f3 (diff)
downloaduhd-49520bfecb5e13126224ee915208c2cd936f911c.tar.gz
uhd-49520bfecb5e13126224ee915208c2cd936f911c.tar.bz2
uhd-49520bfecb5e13126224ee915208c2cd936f911c.zip
rfnoc: ctrl_iface cleanup
- ctrl_iface is now longer a wb_iface. All it can do now is send command packets, and receive responses to those. - ctrl_iface does not store command time or tick rate - wb_iface_adapter is no longer a set of functors, but a wrapper around ctrl_iface. Command times are stored once, in the block. - DMA FIFO and radio block controllers have an easier time getting access to a timed_wb_iface
Diffstat (limited to 'host/lib/rfnoc/wb_iface_adapter.cpp')
-rw-r--r--host/lib/rfnoc/wb_iface_adapter.cpp50
1 files changed, 18 insertions, 32 deletions
diff --git a/host/lib/rfnoc/wb_iface_adapter.cpp b/host/lib/rfnoc/wb_iface_adapter.cpp
index 3b9202661..64b41d6d2 100644
--- a/host/lib/rfnoc/wb_iface_adapter.cpp
+++ b/host/lib/rfnoc/wb_iface_adapter.cpp
@@ -6,56 +6,42 @@
//
#include <uhdlib/rfnoc/wb_iface_adapter.hpp>
+#include <uhd/rfnoc/constants.hpp>
using namespace uhd::rfnoc;
wb_iface_adapter::wb_iface_adapter(
- const poke32_type &poke32_functor_,
- const peek32_type &peek32_functor_,
- const peek64_type &peek64_functor_,
- const gettime_type &gettime_functor_,
- const settime_type &settime_functor_
-) : poke32_functor(poke32_functor_)
- , peek32_functor(peek32_functor_)
- , peek64_functor(peek64_functor_)
- , gettime_functor(gettime_functor_)
+ ctrl_iface::sptr iface,
+ const gettickrate_type & gettickrate_functor_,
+ const settime_type & settime_functor_,
+ const gettime_type & gettime_functor_
+) : _iface(iface)
+ , gettickrate_functor(gettickrate_functor_)
, settime_functor(settime_functor_)
-{
- // nop
-}
-
-wb_iface_adapter::wb_iface_adapter(
- const poke32_type &poke32_functor_,
- const peek32_type &peek32_functor_,
- const peek64_type &peek64_functor_
-) : poke32_functor(poke32_functor_)
- , peek32_functor(peek32_functor_)
- , peek64_functor(peek64_functor_)
+ , gettime_functor(gettime_functor_)
{
// nop
}
void wb_iface_adapter::poke32(const wb_addr_type addr, const uint32_t data)
{
- poke32_functor(addr / 4, data); // FIXME remove the requirement for /4
+ const uint64_t timestamp = gettime_functor().to_ticks(gettickrate_functor());
+ _iface->send_cmd_pkt(addr / 4, data, false, timestamp);
}
uint32_t wb_iface_adapter::peek32(const wb_addr_type addr)
{
- return peek32_functor(addr / 8);
+ const uint64_t reg_value = peek64(addr);
+ return ((addr/4) & 0x1) ?
+ uint32_t(reg_value >> 32) :
+ uint32_t(reg_value & 0xffffffff);
}
uint64_t wb_iface_adapter::peek64(const wb_addr_type addr)
{
- return peek64_functor(addr / 8);
-}
-
-uhd::time_spec_t wb_iface_adapter::get_time(void)
-{
- return gettime_functor();
+ const uint64_t timestamp = gettime_functor().to_ticks(gettickrate_functor());
+ // TODO: Figure out if we should have a timestamp here
+ _iface->send_cmd_pkt(SR_READBACK_ADDR, addr / 8, false, timestamp);
+ return _iface->send_cmd_pkt(SR_READBACK, SR_READBACK_REG_USER, true, timestamp);
}
-void wb_iface_adapter::set_time(const uhd::time_spec_t& t)
-{
- settime_functor(t);
-}