aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include
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/include
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/include')
-rw-r--r--host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp52
-rw-r--r--host/lib/include/uhdlib/rfnoc/wb_iface_adapter.hpp53
2 files changed, 61 insertions, 44 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp b/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
index 2ef50a1a1..d89dea534 100644
--- a/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
@@ -8,37 +8,57 @@
#ifndef INCLUDED_LIBUHD_RFNOC_CTRL_IFACE_HPP
#define INCLUDED_LIBUHD_RFNOC_CTRL_IFACE_HPP
-#include <uhd/utils/msg_task.hpp>
-#include <uhd/types/time_spec.hpp>
-#include <uhd/transport/zero_copy.hpp>
-#include <uhd/types/wb_iface.hpp>
+#include "xports.hpp"
#include <boost/shared_ptr.hpp>
-#include <boost/utility.hpp>
#include <string>
namespace uhd { namespace rfnoc {
/*!
- * Provide access to peek, poke for the radio ctrl module
+ * Provide read/write access to registers on an RFNoC block via Noc-Shell.
*/
-class ctrl_iface : public uhd::timed_wb_iface
+class ctrl_iface
{
public:
typedef boost::shared_ptr<ctrl_iface> sptr;
-
virtual ~ctrl_iface(void) = 0;
- //! Make a new control object
+ /*! Make a new control object
+ *
+ * \param xports Bidirectional transport object to the RFNoC block port.
+ * \param name Optional name for better identification in error messages.
+ */
static sptr make(
- const bool big_endian,
- uhd::transport::zero_copy_if::sptr ctrl_xport,
- uhd::transport::zero_copy_if::sptr resp_xport,
- const uint32_t sid,
- const std::string &name = "0"
+ const both_xports_t &xports,
+ const std::string &name="0"
);
- //! Set the tick rate (converting time into ticks)
- virtual void set_tick_rate(const double rate) = 0;
+ /*! Send a command packet.
+ *
+ * \param addr Register address. This is the value that gets put into the
+ * command packet, its interpretation is defined on the FPGA.
+ * \param data Register value to write.
+ * \param readback If true, assume the command packet is for a readback,
+ * and wait for a response packet to return. The return
+ * value will then be the 64-bit payload of that response
+ * packet. If false, the return value is the payload of
+ * any outstanding ACK packet.
+ * \param timestamp Optional timestamp. The command packet will include this
+ * timestamp. Depending on the block configuration, this
+ * can trigger timed commands.
+ * A value of zero indicates that no timestamp will be
+ * applied. It is not possible to request anything to
+ * happen at time zero.
+ *
+ * \throws uhd::io_error if the response is malformed; uhd::runtime_error if
+ * no packet could be sent.
+ */
+ virtual uint64_t send_cmd_pkt(
+ const size_t addr,
+ const size_t data,
+ const bool readback=false,
+ const uint64_t timestamp=0
+ ) = 0;
};
}} /* namespace uhd::rfnoc */
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