blob: 1ed8cf69b493d01f11e90d1b823a3b1ec631d746 (
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
|
//
// Copyright 2016 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef INCLUDED_RFNOC_WB_IFACE_ADAPTER_HPP
#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::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(
ctrl_iface::sptr iface,
const gettickrate_type &,
const settime_type &,
const gettime_type &
);
virtual ~wb_iface_adapter(void) {}
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:
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
#endif /* INCLUDED_RFNOC_WB_IFACE_ADAPTER_HPP */
|