aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/wb_iface_adapter.cpp
diff options
context:
space:
mode:
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);
-}