From 0b698810a163e3986939341fee5014fc6ad7e7f9 Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Mon, 20 May 2019 17:14:20 -0700 Subject: rfnoc: Added impl for reg_iface and ctrl_endpoint - Added new register_iface class that translates high-level peek/poke calls into CHDR control payloads - Added new chdr_ctrl_endpoint class that emulates a control stream endpoint in SW. It can create and handle multiple register interfaces --- .../lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp (limited to 'host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp') diff --git a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp new file mode 100644 index 000000000..d135f284c --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp @@ -0,0 +1,61 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_RFNOC_CTRLPORT_ENDPOINT_HPP +#define INCLUDED_LIBUHD_RFNOC_CTRLPORT_ENDPOINT_HPP + +#include +#include +#include + +namespace uhd { namespace rfnoc { + +/*! A software interface that represents a ControlPort endpoint + * + * This interface supports the following: + * - All capabilities of register_iface + * - A function to handle received packets + * - A static factory class to create these endpoints + */ +class ctrlport_endpoint : public register_iface +{ +public: + using sptr = std::shared_ptr; + + //! The function to call when sending a packet to a remote device + using send_fn_t = std::function; + + virtual ~ctrlport_endpoint() = 0; + + //! Handles an incoming control packet (request and response) + // + // \param rx_ctrl The control payload of the received packet + // + virtual void handle_recv(const chdr::ctrl_payload& rx_ctrl) = 0; + + //! Creates a new register interface (ctrl_portendpoint) + // + // \param handle_send The function to call to send a control packet + // \param my_epid The endpoint ID of the SW control stream endpoint + // \param port The port number on the control crossbar + // \param buff_capacity The buffer capacity of the downstream buff in 32-bit words + // \param max_outstanding_async_msgs Max outstanding async messages allowed + // \param ctrl_clk_freq Frequency of the clock driving the ctrlport logic + // \param timebase_freq Frequency of the timebase (for timed commands) + // + static sptr make(const send_fn_t& handle_send, + sep_id_t my_epid, + uint16_t local_port, + size_t buff_capacity, + size_t max_outstanding_async_msgs, + double ctrl_clk_freq, + double timebase_freq); + +}; // class ctrlport_endpoint + +}} /* namespace uhd::rfnoc */ + +#endif /* INCLUDED_LIBUHD_RFNOC_CTRLPORT_ENDPOINT_HPP */ -- cgit v1.2.3