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 --- .../include/rfnoc/example/CMakeLists.txt | 13 ++++++++ .../include/rfnoc/example/gain_block_control.hpp | 39 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 host/examples/rfnoc-example/include/rfnoc/example/CMakeLists.txt create mode 100644 host/examples/rfnoc-example/include/rfnoc/example/gain_block_control.hpp (limited to 'host/examples/rfnoc-example/include/rfnoc') diff --git a/host/examples/rfnoc-example/include/rfnoc/example/CMakeLists.txt b/host/examples/rfnoc-example/include/rfnoc/example/CMakeLists.txt new file mode 100644 index 000000000..04ee6810e --- /dev/null +++ b/host/examples/rfnoc-example/include/rfnoc/example/CMakeLists.txt @@ -0,0 +1,13 @@ +# +# Copyright 2019 Ettus Research, a National Instruments Brand +# +# SPDX-License-Identifier: GPL-3.0-or-later +# + +# List all header files here (UHD and GNU Radio) +install( + FILES + gain_block_control.hpp + DESTINATION include/rfnoc/gain + COMPONENT headers +) diff --git a/host/examples/rfnoc-example/include/rfnoc/example/gain_block_control.hpp b/host/examples/rfnoc-example/include/rfnoc/example/gain_block_control.hpp new file mode 100644 index 000000000..5943454b8 --- /dev/null +++ b/host/examples/rfnoc-example/include/rfnoc/example/gain_block_control.hpp @@ -0,0 +1,39 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_RFNOC_EXAMPLE_GAIN_BLOCK_CONTROL_HPP +#define INCLUDED_RFNOC_EXAMPLE_GAIN_BLOCK_CONTROL_HPP + +#include +#include +#include + +namespace rfnoc { namespace example { + +/*! Block controller for the gain block: Multiply amplitude of signal + * + * This block multiplies the signal input with a fixed gain value. + */ +class UHD_API gain_block_control : public uhd::rfnoc::noc_block_base +{ +public: + RFNOC_DECLARE_BLOCK(gain_block_control) + + //! The register address of the gain value + static const uint32_t REG_GAIN_VALUE; + + /*! Set the gain value + */ + virtual void set_gain_value(const uint32_t gain) = 0; + + /*! Get the current gain value (read it from the device) + */ + virtual uint32_t get_gain_value() = 0; +}; + +}} // namespace rfnoc::example + +#endif /* INCLUDED_RFNOC_EXAMPLE_GAIN_BLOCK_CONTROL_HPP */ -- cgit v1.2.3