aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2020-01-03 12:02:17 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2020-01-06 14:42:33 -0800
commitc6a7bd6c52cfdb751084d9dcab43dbe6c02a3151 (patch)
treea3271188d3e2acc95a66c15f286e5bdb9a4dd8b1
parentf56abc714b461e79c01ceb8f90ad9403109a8e4e (diff)
downloaduhd-c6a7bd6c52cfdb751084d9dcab43dbe6c02a3151.tar.gz
uhd-c6a7bd6c52cfdb751084d9dcab43dbe6c02a3151.tar.bz2
uhd-c6a7bd6c52cfdb751084d9dcab43dbe6c02a3151.zip
python: rfnoc: finishing noc_block_base::get_mtu
Adding bindings for res_source_info, which allows us to use noc_block_base::get_mtu. Fixes: 400b00c34338 ("rfnoc: adding RFNoC Python API")
-rw-r--r--host/lib/rfnoc/rfnoc_python.hpp26
-rw-r--r--host/python/rfnoc.py2
2 files changed, 28 insertions, 0 deletions
diff --git a/host/lib/rfnoc/rfnoc_python.hpp b/host/lib/rfnoc/rfnoc_python.hpp
index d3a5734a3..061fb8a9a 100644
--- a/host/lib/rfnoc/rfnoc_python.hpp
+++ b/host/lib/rfnoc/rfnoc_python.hpp
@@ -12,6 +12,7 @@
#include <uhd/rfnoc/graph_edge.hpp>
#include <uhd/rfnoc/mb_controller.hpp>
#include <uhd/rfnoc/noc_block_base.hpp>
+#include <uhd/rfnoc/res_source_info.hpp>
#include <uhd/rfnoc_graph.hpp>
#include <uhd/transport/adapter_id.hpp>
#include <uhd/types/device_addr.hpp>
@@ -132,6 +133,31 @@ void export_rfnoc(py::module& m)
.def("__str__", &graph_edge_t::to_string)
.def("to_string", &graph_edge_t::to_string);
+ py::enum_<res_source_info::source_t>(m, "source")
+ .value("user", res_source_info::USER)
+ .value("input_edge", res_source_info::INPUT_EDGE)
+ .value("output_edge", res_source_info::OUTPUT_EDGE)
+ .value("framework", res_source_info::FRAMEWORK)
+ .export_values();
+
+ py::class_<res_source_info>(m, "res_source_info")
+ // Constructors
+ .def(py::init<res_source_info::source_t, size_t>(),
+ py::arg("source_type"),
+ py::arg("instance_") = 0)
+
+ // Properties
+ .def_readwrite("type", &res_source_info::type)
+ .def_readwrite("instance", &res_source_info::instance)
+
+ // Methods
+ .def("__str__", &res_source_info::to_string)
+ .def("to_string", &res_source_info::to_string)
+ .def_static("invert_edge", &res_source_info::invert_edge)
+
+ // Operators
+ .def(py::self == py::self);
+
py::class_<rfnoc_graph, rfnoc_graph::sptr>(m, "rfnoc_graph")
.def(py::init(&rfnoc_graph::make))
diff --git a/host/python/rfnoc.py b/host/python/rfnoc.py
index 690b3d841..af8200998 100644
--- a/host/python/rfnoc.py
+++ b/host/python/rfnoc.py
@@ -12,6 +12,8 @@ from . import libpyuhd as lib
BlockID = lib.rfnoc.block_id
Edge = lib.rfnoc.edge
GraphEdge = lib.rfnoc.graph_edge
+Source = lib.rfnoc.source
+ResSourceInfo = lib.rfnoc.res_source_info
RfnocGraph = lib.rfnoc.rfnoc_graph
MBController = lib.rfnoc.mb_controller
Timekeeper = lib.rfnoc.timekeeper