From c6a7bd6c52cfdb751084d9dcab43dbe6c02a3151 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Fri, 3 Jan 2020 12:02:17 -0800 Subject: 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") --- host/lib/rfnoc/rfnoc_python.hpp | 26 ++++++++++++++++++++++++++ host/python/rfnoc.py | 2 ++ 2 files changed, 28 insertions(+) (limited to 'host') 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 #include #include +#include #include #include #include @@ -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_(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_(m, "res_source_info") + // Constructors + .def(py::init(), + 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_(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 -- cgit v1.2.3