aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-07-23 10:06:46 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-07-23 10:01:46 -0500
commit3f8d93d2f178e6291ffd0112aa3342b00a3e2e5a (patch)
tree12744498066a4d0bfc57072062637e9bd7f41e42 /host
parent5683b30c8f62a0dc176cefbab25b56760363e878 (diff)
downloaduhd-3f8d93d2f178e6291ffd0112aa3342b00a3e2e5a.tar.gz
uhd-3f8d93d2f178e6291ffd0112aa3342b00a3e2e5a.tar.bz2
uhd-3f8d93d2f178e6291ffd0112aa3342b00a3e2e5a.zip
python: rfnoc: Change reference type for noc_block_base export
By changing the type for accesses to noc_block_base calls in the Python from sptr& to a simple reference (&), we fix the "holder type" issues that crop up when trying to use radio_control from multi_usrp, which returns access to the block as a reference rather than a `sptr`. The error message seen without this fix always contains this string: Unable to cast from non-held to held instance (T& to Holder<T>) (The exact message depends on the API call made).
Diffstat (limited to 'host')
-rw-r--r--host/lib/rfnoc/rfnoc_python.hpp118
1 files changed, 64 insertions, 54 deletions
diff --git a/host/lib/rfnoc/rfnoc_python.hpp b/host/lib/rfnoc/rfnoc_python.hpp
index 2b0b2df4b..6eb669b1c 100644
--- a/host/lib/rfnoc/rfnoc_python.hpp
+++ b/host/lib/rfnoc/rfnoc_python.hpp
@@ -280,133 +280,143 @@ void export_rfnoc(py::module& m)
uhd::property_tree::sptr tree = self->get_tree();
return tree;
})
- .def("poke32",
- [](noc_block_base::sptr& self, uint32_t addr, uint32_t data) {
- self->regs().poke32(addr, data);
+ .def(
+ "poke32",
+ [](noc_block_base& self, uint32_t addr, uint32_t data) {
+ self.regs().poke32(addr, data);
},
py::arg("addr"),
py::arg("data"))
- .def("poke32",
- [](noc_block_base::sptr& self,
+ .def(
+ "poke32",
+ [](noc_block_base& self,
uint32_t addr,
uint32_t data,
uhd::time_spec_t time,
- bool ack = false) { self->regs().poke32(addr, data, time, ack); },
+ bool ack = false) { self.regs().poke32(addr, data, time, ack); },
py::arg("addr"),
py::arg("data"),
py::arg("time"),
py::arg("ack") = false)
- .def("poke64",
- [](noc_block_base::sptr& self, uint32_t addr, uint64_t data) {
- self->regs().poke64(addr, data);
+ .def(
+ "poke64",
+ [](noc_block_base& self, uint32_t addr, uint64_t data) {
+ self.regs().poke64(addr, data);
},
py::arg("addr"),
py::arg("data"))
- .def("poke64",
- [](noc_block_base::sptr& self,
+ .def(
+ "poke64",
+ [](noc_block_base& self,
uint32_t addr,
uint32_t data,
uhd::time_spec_t time,
- bool ack = false) { self->regs().poke64(addr, data, time, ack); },
+ bool ack = false) { self.regs().poke64(addr, data, time, ack); },
py::arg("addr"),
py::arg("data"),
py::arg("time"),
py::arg("ack") = false)
- .def("multi_poke32",
- [](noc_block_base::sptr& self,
+ .def(
+ "multi_poke32",
+ [](noc_block_base& self,
std::vector<uint32_t> addr,
- std::vector<uint32_t> data) { self->regs().multi_poke32(addr, data); },
+ std::vector<uint32_t> data) { self.regs().multi_poke32(addr, data); },
py::arg("addr"),
py::arg("data"))
- .def("multi_poke32",
- [](noc_block_base::sptr& self,
+ .def(
+ "multi_poke32",
+ [](noc_block_base& self,
std::vector<uint32_t> addr,
std::vector<uint32_t> data,
uhd::time_spec_t time,
- bool ack = false) { self->regs().multi_poke32(addr, data, time, ack); },
+ bool ack = false) { self.regs().multi_poke32(addr, data, time, ack); },
py::arg("addr"),
py::arg("data"),
py::arg("time"),
py::arg("ack") = false)
- .def("block_poke32",
- [](noc_block_base::sptr& self,
- uint32_t first_addr,
- std::vector<uint32_t> data) {
- self->regs().block_poke32(first_addr, data);
+ .def(
+ "block_poke32",
+ [](noc_block_base& self, uint32_t first_addr, std::vector<uint32_t> data) {
+ self.regs().block_poke32(first_addr, data);
},
py::arg("first_addr"),
py::arg("data"))
- .def("block_poke32",
- [](noc_block_base::sptr& self,
+ .def(
+ "block_poke32",
+ [](noc_block_base& self,
uint32_t first_addr,
std::vector<uint32_t> data,
uhd::time_spec_t time,
bool ack = false) {
- self->regs().block_poke32(first_addr, data, time, ack);
+ self.regs().block_poke32(first_addr, data, time, ack);
},
py::arg("first_addr"),
py::arg("data"),
py::arg("time"),
py::arg("ack") = false)
- .def("peek32",
- [](noc_block_base::sptr& self, uint32_t addr) {
- return self->regs().peek32(addr);
- },
+ .def(
+ "peek32",
+ [](noc_block_base& self, uint32_t addr) { return self.regs().peek32(addr); },
py::arg("addr"))
- .def("peek32",
- [](noc_block_base::sptr& self, uint32_t addr, uhd::time_spec_t time) {
- return self->regs().peek32(addr, time);
+ .def(
+ "peek32",
+ [](noc_block_base& self, uint32_t addr, uhd::time_spec_t time) {
+ return self.regs().peek32(addr, time);
},
py::arg("addr"),
py::arg("time"))
- .def("peek64",
- [](noc_block_base::sptr& self, uint32_t addr) {
- return self->regs().peek64(addr);
- },
+ .def(
+ "peek64",
+ [](noc_block_base& self, uint32_t addr) { return self.regs().peek64(addr); },
py::arg("addr"))
- .def("peek64",
- [](noc_block_base::sptr& self, uint32_t addr, uhd::time_spec_t time) {
- return self->regs().peek64(addr, time);
+ .def(
+ "peek64",
+ [](noc_block_base& self, uint32_t addr, uhd::time_spec_t time) {
+ return self.regs().peek64(addr, time);
},
py::arg("addr"),
py::arg("time"))
- .def("block_peek32",
- [](noc_block_base::sptr& self, uint32_t first_addr, size_t length) {
- return self->regs().block_peek32(first_addr, length);
+ .def(
+ "block_peek32",
+ [](noc_block_base& self, uint32_t first_addr, size_t length) {
+ return self.regs().block_peek32(first_addr, length);
},
py::arg("first_addr"),
py::arg("length"))
- .def("block_peek32",
- [](noc_block_base::sptr& self,
+ .def(
+ "block_peek32",
+ [](noc_block_base& self,
uint32_t first_addr,
size_t length,
uhd::time_spec_t time) {
- return self->regs().block_peek32(first_addr, length, time);
+ return self.regs().block_peek32(first_addr, length, time);
},
py::arg("first_addr"),
py::arg("length"),
py::arg("time"))
- .def("poll32",
- [](noc_block_base::sptr& self,
+ .def(
+ "poll32",
+ [](noc_block_base& self,
uint32_t addr,
uint32_t data,
uint32_t mask,
uhd::time_spec_t timeout) {
- return self->regs().poll32(addr, data, mask, timeout);
+ return self.regs().poll32(addr, data, mask, timeout);
},
py::arg("addr"),
py::arg("data"),
py::arg("mask"),
py::arg("timeout"))
- .def("poll32",
- [](noc_block_base::sptr& self,
+ .def(
+ "poll32",
+ [](noc_block_base& self,
uint32_t addr,
uint32_t data,
uint32_t mask,
uhd::time_spec_t timeout,
uhd::time_spec_t time,
bool ack = false) {
- return self->regs().poll32(addr, data, mask, timeout, time, ack);
+ return self.regs().poll32(addr, data, mask, timeout, time, ack);
},
py::arg("addr"),
py::arg("data"),
@@ -415,8 +425,8 @@ void export_rfnoc(py::module& m)
py::arg("time"),
py::arg("ack") = false)
.def("__repr__",
- [](noc_block_base::sptr& self) {
- return "<NocBlock for block ID '" + self->get_unique_id() + "'>";
+ [](noc_block_base& self) {
+ return "<NocBlock for block ID '" + self.get_unique_id() + "'>";
})
// node_t superclass methods--not worth having a separate Py class
// for them