From b5be620d1922e924eb5da5bf26955b570eab2584 Mon Sep 17 00:00:00 2001 From: Sugandha Gupta Date: Fri, 22 Jun 2018 14:49:33 +0100 Subject: RFNoC: Add Siggen block controller --- host/lib/rfnoc/siggen_block_ctrl_impl.cpp | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 host/lib/rfnoc/siggen_block_ctrl_impl.cpp (limited to 'host/lib') diff --git a/host/lib/rfnoc/siggen_block_ctrl_impl.cpp b/host/lib/rfnoc/siggen_block_ctrl_impl.cpp new file mode 100644 index 000000000..b876cf715 --- /dev/null +++ b/host/lib/rfnoc/siggen_block_ctrl_impl.cpp @@ -0,0 +1,49 @@ +// +// Copyright 2016-2018 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include +#include +#include + +using namespace uhd::rfnoc; + +class siggen_block_ctrl_impl : public siggen_block_ctrl +{ +public: + UHD_RFNOC_BLOCK_CONSTRUCTOR(siggen_block_ctrl) + { + // nop + } + + void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd, const size_t) + { + UHD_LOGGER_TRACE(unique_id()) << "issue_stream_cmd()" << std::endl; + if (not stream_cmd.stream_now) { + throw uhd::not_implemented_error( + "siggen_block does not support timed commands."); + } + switch (stream_cmd.stream_mode) { + case uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS: + sr_write("ENABLE", true); + break; + + case uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS: + sr_write("ENABLE", false); + break; + + case uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE: + case uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE: + throw uhd::not_implemented_error( + "siggen_block does not support streaming modes other than CONTINUOUS"); + + default: + UHD_THROW_INVALID_CODE_PATH(); + } + } + +}; + +UHD_RFNOC_BLOCK_REGISTER(siggen_block_ctrl, "SigGen"); -- cgit v1.2.3