From a801d6b046743140e9a50c7788dd17dd71f5540a Mon Sep 17 00:00:00 2001 From: Sugandha Gupta Date: Tue, 15 Oct 2019 11:52:46 -0700 Subject: examples: Add example out-of-tree module for RFNoC modules This subdirectory is its own, self-contained project. It is supposed to work against the UHD version it is shipped with. Co-Authored-By: Martin Braun Co-Authored-By: Wade Fife --- .../rfnoc-example/lib/gain_block_control.cpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 host/examples/rfnoc-example/lib/gain_block_control.cpp (limited to 'host/examples/rfnoc-example/lib/gain_block_control.cpp') diff --git a/host/examples/rfnoc-example/lib/gain_block_control.cpp b/host/examples/rfnoc-example/lib/gain_block_control.cpp new file mode 100644 index 000000000..d53bafc8b --- /dev/null +++ b/host/examples/rfnoc-example/lib/gain_block_control.cpp @@ -0,0 +1,41 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +// Include our own header: +#include + +// These two includes are the minimum required to implement a block: +#include +#include + +using namespace rfnoc::example; +using namespace uhd::rfnoc; + +const uint32_t gain_block_control::REG_GAIN_VALUE = 0x00; + +class gain_block_control_impl : public gain_block_control +{ +public: + RFNOC_BLOCK_CONSTRUCTOR(gain_block_control) + { + } + + void set_gain_value(const uint32_t gain) + { + regs().poke32(REG_GAIN_VALUE, gain); + } + + uint32_t get_gain_value() + { + return regs().peek32(REG_GAIN_VALUE); + } + +private: + +}; + +UHD_RFNOC_BLOCK_REGISTER_DIRECT( + gain_block_control, 0xb16, "Gain", CLOCK_KEY_GRAPH, "bus_clk") -- cgit v1.2.3