aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorSugandha Gupta <sugandha.gupta@ettus.com>2018-06-22 14:49:33 +0100
committerMartin Braun <martin.braun@ettus.com>2018-06-22 09:13:11 -0700
commitb5be620d1922e924eb5da5bf26955b570eab2584 (patch)
tree9a6f3c06c1a51c3524ce027f8104d37efb0fadf4 /host
parent068c9cf64541338a62bab06a57b62f5a917fae84 (diff)
downloaduhd-b5be620d1922e924eb5da5bf26955b570eab2584.tar.gz
uhd-b5be620d1922e924eb5da5bf26955b570eab2584.tar.bz2
uhd-b5be620d1922e924eb5da5bf26955b570eab2584.zip
RFNoC: Add Siggen block controller
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/siggen_block_ctrl.hpp25
-rw-r--r--host/lib/rfnoc/siggen_block_ctrl_impl.cpp49
2 files changed, 74 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/siggen_block_ctrl.hpp b/host/include/uhd/rfnoc/siggen_block_ctrl.hpp
new file mode 100644
index 000000000..3d21ca258
--- /dev/null
+++ b/host/include/uhd/rfnoc/siggen_block_ctrl.hpp
@@ -0,0 +1,25 @@
+//
+// Copyright 2014-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_RFNOC_SIGGEN_BLOCK_CTRL_HPP
+#define INCLUDED_LIBUHD_RFNOC_SIGGEN_BLOCK_CTRL_HPP
+
+#include <uhd/rfnoc/source_block_ctrl_base.hpp>
+#include <uhd/rfnoc/sink_block_ctrl_base.hpp>
+
+namespace uhd {
+ namespace rfnoc {
+
+class UHD_RFNOC_API siggen_block_ctrl : public source_block_ctrl_base, public sink_block_ctrl_base
+{
+public:
+ UHD_RFNOC_BLOCK_OBJECT(siggen_block_ctrl)
+
+}; /* class siggen_block_ctrl*/
+
+}} /* namespace uhd::rfnoc */
+
+#endif /* INCLUDED_LIBUHD_RFNOC_SIGGEN_BLOCK_CTRL_HPP */
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 <boost/format.hpp>
+#include <uhd/utils/log.hpp>
+#include <uhd/rfnoc/siggen_block_ctrl.hpp>
+
+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");