aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Rossetto <aaron.rossetto@ni.com>2020-06-01 14:48:02 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-06-09 07:09:34 -0500
commit463dbf9ac3bca7b69331a4315404a6e6e6d29674 (patch)
treece90dccb145ee5609669b5ac5589cbf5078a44d0
parent04b8cca22b61c24ca0451b7655b46b85c9a7f310 (diff)
downloaduhd-463dbf9ac3bca7b69331a4315404a6e6e6d29674.tar.gz
uhd-463dbf9ac3bca7b69331a4315404a6e6e6d29674.tar.bz2
uhd-463dbf9ac3bca7b69331a4315404a6e6e6d29674.zip
python: Add DDC RFNoC block controller bindings
-rw-r--r--host/lib/rfnoc/ddc_block_control_python.hpp32
-rw-r--r--host/python/pyuhd.cpp2
-rw-r--r--host/python/uhd/rfnoc.py2
3 files changed, 36 insertions, 0 deletions
diff --git a/host/lib/rfnoc/ddc_block_control_python.hpp b/host/lib/rfnoc/ddc_block_control_python.hpp
new file mode 100644
index 000000000..75a44e1ea
--- /dev/null
+++ b/host/lib/rfnoc/ddc_block_control_python.hpp
@@ -0,0 +1,32 @@
+//
+// Copyright 2020 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#pragma once
+
+#include "block_controller_factory_python.hpp"
+#include <uhd/rfnoc/ddc_block_control.hpp>
+
+using namespace uhd::rfnoc;
+
+void export_ddc_block_control(py::module& m)
+{
+ py::class_<ddc_block_control, noc_block_base, ddc_block_control::sptr>(
+ m, "ddc_block_control")
+ .def(py::init(&block_controller_factory<ddc_block_control>::make_from))
+ .def("set_freq",
+ &ddc_block_control::set_freq,
+ py::arg("freq"),
+ py::arg("chan"),
+ py::arg("time") = boost::optional<uhd::time_spec_t>())
+ .def("get_freq", &ddc_block_control::get_freq)
+ .def("get_frequency_range", &ddc_block_control::get_frequency_range)
+ .def("get_input_rate", &ddc_block_control::get_input_rate)
+ .def("set_input_rate", &ddc_block_control::set_input_rate)
+ .def("get_output_rate", &ddc_block_control::get_output_rate)
+ .def("get_output_rates", &ddc_block_control::get_output_rates)
+ .def("set_output_rate", &ddc_block_control::set_output_rate)
+ .def("issue_stream_cmd", &ddc_block_control::issue_stream_cmd);
+}
diff --git a/host/python/pyuhd.cpp b/host/python/pyuhd.cpp
index 5e8c6424c..149a53bba 100644
--- a/host/python/pyuhd.cpp
+++ b/host/python/pyuhd.cpp
@@ -14,6 +14,7 @@
namespace py = pybind11;
#include "cal/cal_python.hpp"
+#include "rfnoc/ddc_block_control_python.hpp"
#include "rfnoc/rfnoc_python.hpp"
#include "stream_python.hpp"
#include "types/filters_python.hpp"
@@ -74,6 +75,7 @@ PYBIND11_MODULE(libpyuhd, m)
// Register RFNoC submodule
auto rfnoc_module = m.def_submodule("rfnoc", "RFNoC Objects");
export_rfnoc(rfnoc_module);
+ export_ddc_block_control(rfnoc_module);
// Register calibration submodule
auto cal_module = m.def_submodule("cal", "Calibration Objects");
diff --git a/host/python/uhd/rfnoc.py b/host/python/uhd/rfnoc.py
index af8200998..464013d62 100644
--- a/host/python/uhd/rfnoc.py
+++ b/host/python/uhd/rfnoc.py
@@ -18,3 +18,5 @@ RfnocGraph = lib.rfnoc.rfnoc_graph
MBController = lib.rfnoc.mb_controller
Timekeeper = lib.rfnoc.timekeeper
NocBlock = lib.rfnoc.noc_block_base
+DdcBlockControl = lib.rfnoc.ddc_block_control
+