blob: d89dea534655b28a9280fb8f5a0e6bb3e3cdc3c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
//
// Copyright 2012-2016 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef INCLUDED_LIBUHD_RFNOC_CTRL_IFACE_HPP
#define INCLUDED_LIBUHD_RFNOC_CTRL_IFACE_HPP
#include "xports.hpp"
#include <boost/shared_ptr.hpp>
#include <string>
namespace uhd { namespace rfnoc {
/*!
* Provide read/write access to registers on an RFNoC block via Noc-Shell.
*/
class ctrl_iface
{
public:
typedef boost::shared_ptr<ctrl_iface> sptr;
virtual ~ctrl_iface(void) = 0;
/*! 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 both_xports_t &xports,
const std::string &name="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 */
#endif /* INCLUDED_LIBUHD_RFNOC_CTRL_IFACE_HPP */
|