diff options
author | a-andre <13609565+a-andre@users.noreply.github.com> | 2021-12-09 23:20:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 17:20:55 -0500 |
commit | a2a682518fab2a91b5b4628586568f2e1cf1b65b (patch) | |
tree | 91d0c997b2276022d922c1bd9379020e3840a46d /gr-uhd/python/uhd | |
parent | 97969b6f84cc6fa8730250c6c8111ff8d92eaf30 (diff) |
uhd: pybind rfnoc_{block, ddc, duc, rx/tx_radio} (#5291)
* uhd: pybind rfnoc_block
Signed-off-by: André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de>
* uhd: pybind rfnoc_rx/tx_radio
Signed-off-by: André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de>
* uhd: pybind rfnoc_ddc/duc
Signed-off-by: André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de>
* Fix TypeError: set_freq(): incompatible function arguments
Signed-off-by: André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de>
* uhd: rfnoc_rx/tx_streamer: Fix AttributeError
'gnuradio.uhd.uhd_python.rfnoc_rx_streamer' object has no attribute 'to_basic_block'
Signed-off-by: André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de>
Diffstat (limited to 'gr-uhd/python/uhd')
16 files changed, 810 insertions, 6 deletions
diff --git a/gr-uhd/python/uhd/bindings/CMakeLists.txt b/gr-uhd/python/uhd/bindings/CMakeLists.txt index b5116952fc..952d30278a 100644 --- a/gr-uhd/python/uhd/bindings/CMakeLists.txt +++ b/gr-uhd/python/uhd/bindings/CMakeLists.txt @@ -16,8 +16,13 @@ list(APPEND uhd_python_files if(ENABLE_UHD_RFNOC) add_definitions(-DGR_ENABLE_UHD_RFNOC) list(APPEND uhd_python_files + rfnoc_block_python.cc + rfnoc_ddc_python.cc + rfnoc_duc_python.cc rfnoc_graph_python.cc + rfnoc_rx_radio_python.cc rfnoc_rx_streamer_python.cc + rfnoc_tx_radio_python.cc rfnoc_tx_streamer_python.cc ) endif() diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_block_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_block_pydoc_template.h new file mode 100644 index 0000000000..587bbbbd10 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_block_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, uhd, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_uhd_rfnoc_block = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_block_make_block_ref = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_block_get_unique_id = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_block_general_work = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_ddc_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_ddc_pydoc_template.h new file mode 100644 index 0000000000..991ea23f6c --- /dev/null +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_ddc_pydoc_template.h @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, uhd, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_uhd_rfnoc_ddc = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_ddc_rfnoc_ddc_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_ddc_rfnoc_ddc_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_ddc_make = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_ddc_set_freq = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_ddc_set_output_rate = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_duc_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_duc_pydoc_template.h new file mode 100644 index 0000000000..185655b196 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_duc_pydoc_template.h @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, uhd, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_uhd_rfnoc_duc = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_duc_rfnoc_duc_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_duc_rfnoc_duc_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_duc_make = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_duc_set_freq = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_duc_set_input_rate = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_radio_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_radio_pydoc_template.h new file mode 100644 index 0000000000..a0f7255ec0 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_radio_pydoc_template.h @@ -0,0 +1,75 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, uhd, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_uhd_rfnoc_rx_radio = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_rfnoc_rx_radio_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_rfnoc_rx_radio_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_make = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_rate = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_antenna = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_frequency = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_tune_args = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_gain_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_gain_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_agc = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_gain_profile = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_bandwidth = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_lo_source = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_lo_export_enabled = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_lo_freq = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_dc_offset_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_dc_offset_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_iq_balance_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_radio_set_iq_balance_1 = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_streamer_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_streamer_pydoc_template.h index 86c3acf8d2..1390183afd 100644 --- a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_streamer_pydoc_template.h +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_rx_streamer_pydoc_template.h @@ -17,6 +17,14 @@ static const char* __doc_gr_uhd_rfnoc_rx_streamer = R"doc()doc"; + +static const char* __doc_gr_uhd_rfnoc_rx_streamer_rfnoc_rx_streamer_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_rx_streamer_rfnoc_rx_streamer_1 = R"doc()doc"; + + static const char* __doc_gr_uhd_rfnoc_rx_streamer_make = R"doc()doc"; + static const char* __doc_gr_uhd_rfnoc_rx_streamer_get_unique_id = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_radio_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_radio_pydoc_template.h new file mode 100644 index 0000000000..926e66eb2e --- /dev/null +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_radio_pydoc_template.h @@ -0,0 +1,66 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, uhd, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_uhd_rfnoc_tx_radio = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_rfnoc_tx_radio_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_rfnoc_tx_radio_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_make = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_rate = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_antenna = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_frequency = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_tune_args = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_gain_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_gain_1 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_gain_profile = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_bandwidth = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_lo_source = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_lo_export_enabled = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_lo_freq = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_dc_offset = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_radio_set_iq_balance = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_streamer_pydoc_template.h b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_streamer_pydoc_template.h index c0d974e495..2bdd6214ef 100644 --- a/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_streamer_pydoc_template.h +++ b/gr-uhd/python/uhd/bindings/docstrings/rfnoc_tx_streamer_pydoc_template.h @@ -17,6 +17,14 @@ static const char* __doc_gr_uhd_rfnoc_tx_streamer = R"doc()doc"; + +static const char* __doc_gr_uhd_rfnoc_tx_streamer_rfnoc_tx_streamer_0 = R"doc()doc"; + + +static const char* __doc_gr_uhd_rfnoc_tx_streamer_rfnoc_tx_streamer_1 = R"doc()doc"; + + static const char* __doc_gr_uhd_rfnoc_tx_streamer_make = R"doc()doc"; + static const char* __doc_gr_uhd_rfnoc_tx_streamer_get_unique_id = R"doc()doc"; diff --git a/gr-uhd/python/uhd/bindings/python_bindings.cc b/gr-uhd/python/uhd/bindings/python_bindings.cc index 70b819df92..4a8c5ea10c 100644 --- a/gr-uhd/python/uhd/bindings/python_bindings.cc +++ b/gr-uhd/python/uhd/bindings/python_bindings.cc @@ -22,8 +22,13 @@ void bind_amsg_source(py::module&); void bind_usrp_block(py::module&); void bind_usrp_sink(py::module&); void bind_usrp_source(py::module&); +void bind_rfnoc_block(py::module&); +void bind_rfnoc_ddc(py::module&); +void bind_rfnoc_duc(py::module&); void bind_rfnoc_graph(py::module&); +void bind_rfnoc_rx_radio(py::module&); void bind_rfnoc_rx_streamer(py::module&); +void bind_rfnoc_tx_radio(py::module&); void bind_rfnoc_tx_streamer(py::module&); // We need this hack because import_array() returns NULL @@ -52,8 +57,13 @@ PYBIND11_MODULE(uhd_python, m) bind_usrp_source(m); #ifdef GR_ENABLE_UHD_RFNOC + bind_rfnoc_block(m); + bind_rfnoc_ddc(m); + bind_rfnoc_duc(m); bind_rfnoc_graph(m); + bind_rfnoc_rx_radio(m); bind_rfnoc_rx_streamer(m); + bind_rfnoc_tx_radio(m); bind_rfnoc_tx_streamer(m); #endif diff --git a/gr-uhd/python/uhd/bindings/rfnoc_block_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_block_python.cc new file mode 100644 index 0000000000..c566f72b5a --- /dev/null +++ b/gr-uhd/python/uhd/bindings/rfnoc_block_python.cc @@ -0,0 +1,63 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rfnoc_block.h) */ +/* BINDTOOL_HEADER_FILE_HASH(a090f45dcc320d7e1f19f63c585e5aa0) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/uhd/rfnoc_block.h> +// pydoc.h is automatically generated in the build directory +#include <rfnoc_block_pydoc.h> + +void bind_rfnoc_block(py::module& m) +{ + + using rfnoc_block = ::gr::uhd::rfnoc_block; + + + py::class_<rfnoc_block, gr::block, gr::basic_block, std::shared_ptr<rfnoc_block>>( + m, "rfnoc_block", D(rfnoc_block)) + + + .def_static("make_block_ref", + &rfnoc_block::make_block_ref, + py::arg("graph"), + py::arg("block_args"), + py::arg("block_name"), + py::arg("device_select") = -1, + py::arg("block_select") = -1, + py::arg("max_ref_count") = 1, + D(rfnoc_block, make_block_ref)) + + + .def("get_unique_id", &rfnoc_block::get_unique_id, D(rfnoc_block, get_unique_id)) + + + .def("general_work", + &rfnoc_block::general_work, + py::arg("noutput_items"), + py::arg("ninput_items"), + py::arg("input_items"), + py::arg("output_items"), + D(rfnoc_block, general_work)) + + ; +} diff --git a/gr-uhd/python/uhd/bindings/rfnoc_ddc_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_ddc_python.cc new file mode 100644 index 0000000000..525b8c04db --- /dev/null +++ b/gr-uhd/python/uhd/bindings/rfnoc_ddc_python.cc @@ -0,0 +1,65 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rfnoc_ddc.h) */ +/* BINDTOOL_HEADER_FILE_HASH(0b41834dd8deb06ad7cbca294130abb3) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/uhd/rfnoc_ddc.h> +// pydoc.h is automatically generated in the build directory +#include <rfnoc_ddc_pydoc.h> + +void bind_rfnoc_ddc(py::module& m) +{ + + using rfnoc_ddc = ::gr::uhd::rfnoc_ddc; + + + py::class_<rfnoc_ddc, + gr::uhd::rfnoc_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_ddc>>(m, "rfnoc_ddc", D(rfnoc_ddc)) + + .def(py::init(&rfnoc_ddc::make), + py::arg("graph"), + py::arg("block_args"), + py::arg("device_select"), + py::arg("instance"), + D(rfnoc_ddc, make)) + + + .def("set_freq", + &rfnoc_ddc::set_freq, + py::arg("freq"), + py::arg("chan"), + py::arg("time") = uhd::time_spec_t::ASAP, + D(rfnoc_ddc, set_freq)) + + + .def("set_output_rate", + &rfnoc_ddc::set_output_rate, + py::arg("rate"), + py::arg("chan"), + D(rfnoc_ddc, set_output_rate)) + + ; +} diff --git a/gr-uhd/python/uhd/bindings/rfnoc_duc_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_duc_python.cc new file mode 100644 index 0000000000..64f19a4eb2 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/rfnoc_duc_python.cc @@ -0,0 +1,65 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rfnoc_duc.h) */ +/* BINDTOOL_HEADER_FILE_HASH(da2a1403f029d1ed8a7f89bb807a4076) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/uhd/rfnoc_duc.h> +// pydoc.h is automatically generated in the build directory +#include <rfnoc_duc_pydoc.h> + +void bind_rfnoc_duc(py::module& m) +{ + + using rfnoc_duc = ::gr::uhd::rfnoc_duc; + + + py::class_<rfnoc_duc, + gr::uhd::rfnoc_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_duc>>(m, "rfnoc_duc", D(rfnoc_duc)) + + .def(py::init(&rfnoc_duc::make), + py::arg("graph"), + py::arg("block_args"), + py::arg("device_select"), + py::arg("instance"), + D(rfnoc_duc, make)) + + + .def("set_freq", + &rfnoc_duc::set_freq, + py::arg("freq"), + py::arg("chan"), + py::arg("time") = uhd::time_spec_t::ASAP, + D(rfnoc_duc, set_freq)) + + + .def("set_input_rate", + &rfnoc_duc::set_input_rate, + py::arg("rate"), + py::arg("chan"), + D(rfnoc_duc, set_input_rate)) + + ; +} diff --git a/gr-uhd/python/uhd/bindings/rfnoc_rx_radio_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_rx_radio_python.cc new file mode 100644 index 0000000000..f531bfa172 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/rfnoc_rx_radio_python.cc @@ -0,0 +1,172 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rfnoc_rx_radio.h) */ +/* BINDTOOL_HEADER_FILE_HASH(635a84f92d7ce031bcbe6bd4756ad28e) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/uhd/rfnoc_rx_radio.h> +// pydoc.h is automatically generated in the build directory +#include <rfnoc_rx_radio_pydoc.h> + +void bind_rfnoc_rx_radio(py::module& m) +{ + + using rfnoc_rx_radio = ::gr::uhd::rfnoc_rx_radio; + + + py::class_<rfnoc_rx_radio, + gr::uhd::rfnoc_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_rx_radio>>(m, "rfnoc_rx_radio", D(rfnoc_rx_radio)) + + .def(py::init(&rfnoc_rx_radio::make), + py::arg("graph"), + py::arg("block_args"), + py::arg("device_select"), + py::arg("instance"), + D(rfnoc_rx_radio, make)) + + + .def("set_rate", + &rfnoc_rx_radio::set_rate, + py::arg("rate"), + D(rfnoc_rx_radio, set_rate)) + + + .def("set_antenna", + &rfnoc_rx_radio::set_antenna, + py::arg("antenna"), + py::arg("chan"), + D(rfnoc_rx_radio, set_antenna)) + + + .def("set_frequency", + &rfnoc_rx_radio::set_frequency, + py::arg("frequency"), + py::arg("chan"), + D(rfnoc_rx_radio, set_frequency)) + + + .def("set_tune_args", + &rfnoc_rx_radio::set_tune_args, + py::arg("args"), + py::arg("chan"), + D(rfnoc_rx_radio, set_tune_args)) + + + .def("set_gain", + (double (rfnoc_rx_radio::*)(double const, size_t const)) & + rfnoc_rx_radio::set_gain, + py::arg("gain"), + py::arg("chan"), + D(rfnoc_rx_radio, set_gain, 0)) + + + .def( + "set_gain", + (double (rfnoc_rx_radio::*)(double const, std::string const&, size_t const)) & + rfnoc_rx_radio::set_gain, + py::arg("gain"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_rx_radio, set_gain, 1)) + + + .def("set_agc", + &rfnoc_rx_radio::set_agc, + py::arg("enable"), + py::arg("chan"), + D(rfnoc_rx_radio, set_agc)) + + + .def("set_gain_profile", + &rfnoc_rx_radio::set_gain_profile, + py::arg("profile"), + py::arg("chan"), + D(rfnoc_rx_radio, set_gain_profile)) + + + .def("set_bandwidth", + &rfnoc_rx_radio::set_bandwidth, + py::arg("bandwidth"), + py::arg("chan"), + D(rfnoc_rx_radio, set_bandwidth)) + + + .def("set_lo_source", + &rfnoc_rx_radio::set_lo_source, + py::arg("source"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_rx_radio, set_lo_source)) + + + .def("set_lo_export_enabled", + &rfnoc_rx_radio::set_lo_export_enabled, + py::arg("enabled"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_rx_radio, set_lo_export_enabled)) + + + .def("set_lo_freq", + &rfnoc_rx_radio::set_lo_freq, + py::arg("freq"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_rx_radio, set_lo_freq)) + + + .def("set_dc_offset", + (void (rfnoc_rx_radio::*)(bool const, size_t const)) & + rfnoc_rx_radio::set_dc_offset, + py::arg("enable"), + py::arg("chan"), + D(rfnoc_rx_radio, set_dc_offset, 0)) + + + .def("set_dc_offset", + (void (rfnoc_rx_radio::*)(std::complex<double> const&, size_t const)) & + rfnoc_rx_radio::set_dc_offset, + py::arg("offset"), + py::arg("chan"), + D(rfnoc_rx_radio, set_dc_offset, 1)) + + + .def("set_iq_balance", + (void (rfnoc_rx_radio::*)(bool const, size_t const)) & + rfnoc_rx_radio::set_iq_balance, + py::arg("enable"), + py::arg("chan"), + D(rfnoc_rx_radio, set_iq_balance, 0)) + + + .def("set_iq_balance", + (void (rfnoc_rx_radio::*)(std::complex<double> const&, size_t const)) & + rfnoc_rx_radio::set_iq_balance, + py::arg("correction"), + py::arg("chan"), + D(rfnoc_rx_radio, set_iq_balance, 1)) + + ; +} diff --git a/gr-uhd/python/uhd/bindings/rfnoc_rx_streamer_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_rx_streamer_python.cc index 5363af29b0..be4c1fde06 100644 --- a/gr-uhd/python/uhd/bindings/rfnoc_rx_streamer_python.cc +++ b/gr-uhd/python/uhd/bindings/rfnoc_rx_streamer_python.cc @@ -33,11 +33,25 @@ void bind_rfnoc_rx_streamer(py::module& m) using rfnoc_rx_streamer = ::gr::uhd::rfnoc_rx_streamer; - py::class_<rfnoc_rx_streamer, std::shared_ptr<rfnoc_rx_streamer>>( + py::class_<rfnoc_rx_streamer, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_rx_streamer>>( m, "rfnoc_rx_streamer", D(rfnoc_rx_streamer)) - .def(py::init(&rfnoc_rx_streamer::make), D(rfnoc_rx_streamer, make)) + .def(py::init(&rfnoc_rx_streamer::make), + py::arg("graph"), + py::arg("num_chans"), + py::arg("stream_args"), + py::arg("vlen") = 1, + py::arg("issue_stream_cmd_on_start") = true, + D(rfnoc_rx_streamer, make)) + + .def("get_unique_id", &rfnoc_rx_streamer::get_unique_id, - D(rfnoc_rx_streamer, get_unique_id)); + D(rfnoc_rx_streamer, get_unique_id)) + + ; } diff --git a/gr-uhd/python/uhd/bindings/rfnoc_tx_radio_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_tx_radio_python.cc new file mode 100644 index 0000000000..1536510d31 --- /dev/null +++ b/gr-uhd/python/uhd/bindings/rfnoc_tx_radio_python.cc @@ -0,0 +1,147 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rfnoc_tx_radio.h) */ +/* BINDTOOL_HEADER_FILE_HASH(6a7fea399cb9d3f5ac2849fb0d8135e4) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/uhd/rfnoc_tx_radio.h> +// pydoc.h is automatically generated in the build directory +#include <rfnoc_tx_radio_pydoc.h> + +void bind_rfnoc_tx_radio(py::module& m) +{ + + using rfnoc_tx_radio = ::gr::uhd::rfnoc_tx_radio; + + + py::class_<rfnoc_tx_radio, + gr::uhd::rfnoc_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_tx_radio>>(m, "rfnoc_tx_radio", D(rfnoc_tx_radio)) + + .def(py::init(&rfnoc_tx_radio::make), + py::arg("graph"), + py::arg("block_args"), + py::arg("device_select"), + py::arg("instance"), + D(rfnoc_tx_radio, make)) + + + .def("set_rate", + &rfnoc_tx_radio::set_rate, + py::arg("rate"), + D(rfnoc_tx_radio, set_rate)) + + + .def("set_antenna", + &rfnoc_tx_radio::set_antenna, + py::arg("antenna"), + py::arg("chan"), + D(rfnoc_tx_radio, set_antenna)) + + + .def("set_frequency", + &rfnoc_tx_radio::set_frequency, + py::arg("frequency"), + py::arg("chan"), + D(rfnoc_tx_radio, set_frequency)) + + + .def("set_tune_args", + &rfnoc_tx_radio::set_tune_args, + py::arg("args"), + py::arg("chan"), + D(rfnoc_tx_radio, set_tune_args)) + + + .def("set_gain", + (double (rfnoc_tx_radio::*)(double const, size_t const)) & + rfnoc_tx_radio::set_gain, + py::arg("gain"), + py::arg("chan"), + D(rfnoc_tx_radio, set_gain, 0)) + + + .def( + "set_gain", + (double (rfnoc_tx_radio::*)(double const, std::string const&, size_t const)) & + rfnoc_tx_radio::set_gain, + py::arg("gain"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_tx_radio, set_gain, 1)) + + + .def("set_gain_profile", + &rfnoc_tx_radio::set_gain_profile, + py::arg("profile"), + py::arg("chan"), + D(rfnoc_tx_radio, set_gain_profile)) + + + .def("set_bandwidth", + &rfnoc_tx_radio::set_bandwidth, + py::arg("bandwidth"), + py::arg("chan"), + D(rfnoc_tx_radio, set_bandwidth)) + + + .def("set_lo_source", + &rfnoc_tx_radio::set_lo_source, + py::arg("source"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_tx_radio, set_lo_source)) + + + .def("set_lo_export_enabled", + &rfnoc_tx_radio::set_lo_export_enabled, + py::arg("enabled"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_tx_radio, set_lo_export_enabled)) + + + .def("set_lo_freq", + &rfnoc_tx_radio::set_lo_freq, + py::arg("freq"), + py::arg("name"), + py::arg("chan"), + D(rfnoc_tx_radio, set_lo_freq)) + + + .def("set_dc_offset", + &rfnoc_tx_radio::set_dc_offset, + py::arg("offset"), + py::arg("chan"), + D(rfnoc_tx_radio, set_dc_offset)) + + + .def("set_iq_balance", + &rfnoc_tx_radio::set_iq_balance, + py::arg("correction"), + py::arg("chan"), + D(rfnoc_tx_radio, set_iq_balance)) + + ; +} diff --git a/gr-uhd/python/uhd/bindings/rfnoc_tx_streamer_python.cc b/gr-uhd/python/uhd/bindings/rfnoc_tx_streamer_python.cc index 96f2fe62ae..acca2c5b90 100644 --- a/gr-uhd/python/uhd/bindings/rfnoc_tx_streamer_python.cc +++ b/gr-uhd/python/uhd/bindings/rfnoc_tx_streamer_python.cc @@ -33,11 +33,24 @@ void bind_rfnoc_tx_streamer(py::module& m) using rfnoc_tx_streamer = ::gr::uhd::rfnoc_tx_streamer; - py::class_<rfnoc_tx_streamer, std::shared_ptr<rfnoc_tx_streamer>>( + py::class_<rfnoc_tx_streamer, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<rfnoc_tx_streamer>>( m, "rfnoc_tx_streamer", D(rfnoc_tx_streamer)) - .def(py::init(&rfnoc_tx_streamer::make), D(rfnoc_tx_streamer, make)) + .def(py::init(&rfnoc_tx_streamer::make), + py::arg("graph"), + py::arg("num_chans"), + py::arg("stream_args"), + py::arg("vlen") = 1, + D(rfnoc_tx_streamer, make)) + + .def("get_unique_id", &rfnoc_tx_streamer::get_unique_id, - D(rfnoc_tx_streamer, get_unique_id)); + D(rfnoc_tx_streamer, get_unique_id)) + + ; } |