aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp')
-rw-r--r--host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp53
1 files changed, 25 insertions, 28 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp b/host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp
index 753fa13af..1ed8cf69b 100644
--- a/host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp
+++ b/host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp
@@ -9,50 +9,47 @@
#define INCLUDED_RFNOC_WB_IFACE_ADAPTER_HPP
#include <uhd/config.hpp>
+#include "ctrl_iface.hpp"
#include <uhd/types/wb_iface.hpp>
#include <boost/function.hpp>
namespace uhd {
namespace rfnoc {
+/*! wb_iface control into RFNoC block registers.
+ *
+ * This is specifically for mimicking a wb_iface that talks to an RFNoC block.
+ * It assumes an underlying ctrl_iface is talking to an RFNoC block.
+ */
class UHD_API wb_iface_adapter : public uhd::timed_wb_iface
{
public:
- typedef boost::shared_ptr<wb_iface_adapter> sptr;
- typedef boost::function<void(wb_addr_type, uint32_t)> poke32_type;
- typedef boost::function<uint32_t(wb_addr_type)> peek32_type;
- typedef boost::function<uint64_t(wb_addr_type)> peek64_type;
- typedef boost::function<time_spec_t(void)> gettime_type;
- typedef boost::function<void(const time_spec_t&)> settime_type;
+ typedef boost::function<double()> gettickrate_type;
+ typedef boost::function<uhd::time_spec_t()> gettime_type;
+ typedef boost::function<void(const uhd::time_spec_t &)> settime_type;
wb_iface_adapter(
- const poke32_type &,
- const peek32_type &,
- const peek64_type &,
- const gettime_type &,
- const settime_type &
+ ctrl_iface::sptr iface,
+ const gettickrate_type &,
+ const settime_type &,
+ const gettime_type &
);
- wb_iface_adapter(
- const poke32_type &,
- const peek32_type &,
- const peek64_type &
- );
+ virtual ~wb_iface_adapter(void) {}
- virtual ~wb_iface_adapter(void) {};
-
- virtual void poke32(const wb_addr_type addr, const uint32_t data);
- virtual uint32_t peek32(const wb_addr_type addr);
- virtual uint64_t peek64(const wb_addr_type addr);
- virtual time_spec_t get_time(void);
- virtual void set_time(const time_spec_t& t);
+ void poke32(const wb_addr_type addr, const uint32_t data);
+ uint32_t peek32(const wb_addr_type addr);
+ uint64_t peek64(const wb_addr_type addr);
+ time_spec_t get_time() { return gettime_functor(); }
+ void set_time(const uhd::time_spec_t& t) { settime_functor(t); }
private:
- 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;
+ ctrl_iface::sptr _iface;
+ const gettickrate_type gettickrate_functor;
+ const settime_type settime_functor;
+ const gettime_type gettime_functor;
+
+ inline uint64_t get_timestamp() { return gettime_functor().to_ticks(gettickrate_functor()); }
};
}} // namespace uhd::rfnoc