2017-02-09 19:16:16 +00:00
|
|
|
//
|
2017-05-02 18:10:05 +00:00
|
|
|
// Copyright 2017-2018 Ettus Research, a National Instruments Company
|
2019-02-04 15:00:16 +00:00
|
|
|
// Copyright 2019 Ettus Research, a National Instruments Brand
|
2017-02-09 19:16:16 +00:00
|
|
|
//
|
2017-05-02 18:10:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2017-02-09 19:16:16 +00:00
|
|
|
//
|
|
|
|
|
|
2019-11-01 22:29:22 +00:00
|
|
|
#include <pybind11/complex.h>
|
2020-03-02 23:25:13 +00:00
|
|
|
#include <pybind11/pybind11.h>
|
2021-12-16 19:48:26 +00:00
|
|
|
#include <pybind11/stl.h>
|
2018-07-27 14:47:31 +00:00
|
|
|
|
2017-02-09 19:16:16 +00:00
|
|
|
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
|
|
|
|
#include <numpy/arrayobject.h>
|
|
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
namespace py = pybind11;
|
|
|
|
|
|
2020-03-04 00:10:06 +00:00
|
|
|
#include "cal/cal_python.hpp"
|
2020-12-04 12:53:34 +00:00
|
|
|
#include "device_python.hpp"
|
2020-10-12 10:22:00 +00:00
|
|
|
#include "property_tree_python.hpp"
|
2020-06-01 19:48:02 +00:00
|
|
|
#include "rfnoc/ddc_block_control_python.hpp"
|
2020-06-01 19:51:53 +00:00
|
|
|
#include "rfnoc/duc_block_control_python.hpp"
|
2020-06-04 21:24:01 +00:00
|
|
|
#include "rfnoc/fft_block_control_python.hpp"
|
2020-06-01 20:01:04 +00:00
|
|
|
#include "rfnoc/fir_filter_block_control_python.hpp"
|
2020-06-01 19:56:16 +00:00
|
|
|
#include "rfnoc/fosphor_block_control_python.hpp"
|
2020-08-05 12:37:38 +00:00
|
|
|
#include "rfnoc/keep_one_in_n_block_control_python.hpp"
|
2020-07-14 22:28:19 +00:00
|
|
|
#include "rfnoc/moving_average_block_control_python.hpp"
|
2020-06-01 20:31:21 +00:00
|
|
|
#include "rfnoc/null_block_control_python.hpp"
|
2020-06-01 20:21:43 +00:00
|
|
|
#include "rfnoc/radio_control_python.hpp"
|
2020-08-03 16:36:18 +00:00
|
|
|
#include "rfnoc/replay_block_control_python.hpp"
|
2019-11-18 08:36:39 +00:00
|
|
|
#include "rfnoc/rfnoc_python.hpp"
|
2020-07-24 15:28:07 +00:00
|
|
|
#include "rfnoc/siggen_block_control_python.hpp"
|
2020-07-23 00:55:05 +00:00
|
|
|
#include "rfnoc/switchboard_block_control_python.hpp"
|
2020-06-01 20:26:33 +00:00
|
|
|
#include "rfnoc/vector_iir_block_control_python.hpp"
|
2020-06-16 18:38:29 +00:00
|
|
|
#include "rfnoc/window_block_control_python.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include "stream_python.hpp"
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "types/filters_python.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include "types/metadata_python.hpp"
|
|
|
|
|
#include "types/sensors_python.hpp"
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "types/serial_python.hpp"
|
|
|
|
|
#include "types/time_spec_python.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include "types/tune_python.hpp"
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "types/types_python.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include "usrp/dboard_iface_python.hpp"
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "usrp/fe_connection_python.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include "usrp/multi_usrp_python.hpp"
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "usrp/subdev_spec_python.hpp"
|
2020-03-11 21:36:00 +00:00
|
|
|
#include "utils/paths_python.hpp"
|
2020-06-25 20:43:32 +00:00
|
|
|
#include "utils/utils_python.hpp"
|
2017-02-09 19:16:16 +00:00
|
|
|
|
2017-05-02 18:10:05 +00:00
|
|
|
// We need this hack because import_array() returns NULL
|
|
|
|
|
// for newer Python versions.
|
|
|
|
|
// This function is also necessary because it ensures access to the C API
|
|
|
|
|
// and removes a warning.
|
2017-02-09 19:16:16 +00:00
|
|
|
void* init_numpy()
|
|
|
|
|
{
|
|
|
|
|
import_array();
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
PYBIND11_MODULE(libpyuhd, m)
|
2017-02-09 19:16:16 +00:00
|
|
|
{
|
2017-05-02 18:10:05 +00:00
|
|
|
// Initialize the numpy C API
|
|
|
|
|
// (otherwise we will see segmentation faults)
|
|
|
|
|
init_numpy();
|
|
|
|
|
|
2020-12-04 12:53:34 +00:00
|
|
|
// Register uhd::device::find
|
|
|
|
|
export_device(m);
|
|
|
|
|
|
2020-03-11 21:36:00 +00:00
|
|
|
// Register paths submodule
|
|
|
|
|
auto paths_module = m.def_submodule("paths", "Path Utilities");
|
|
|
|
|
export_paths(paths_module);
|
|
|
|
|
|
2017-05-02 18:10:05 +00:00
|
|
|
// Register types submodule
|
2019-02-04 15:00:16 +00:00
|
|
|
auto types_module = m.def_submodule("types", "UHD Types");
|
2018-11-20 20:02:43 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
export_types(types_module);
|
|
|
|
|
export_time_spec(types_module);
|
|
|
|
|
export_spi_config(types_module);
|
|
|
|
|
export_metadata(types_module);
|
|
|
|
|
export_sensors(types_module);
|
|
|
|
|
export_tune(types_module);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
|
|
|
|
// Register usrp submodule
|
2019-02-04 15:00:16 +00:00
|
|
|
auto usrp_module = m.def_submodule("usrp", "USRP Objects");
|
|
|
|
|
export_multi_usrp(usrp_module);
|
|
|
|
|
export_subdev_spec(usrp_module);
|
|
|
|
|
export_dboard_iface(usrp_module);
|
|
|
|
|
export_fe_connection(usrp_module);
|
|
|
|
|
export_stream(usrp_module);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
|
|
|
|
// Register filters submodule
|
2019-02-04 15:00:16 +00:00
|
|
|
auto filters_module = m.def_submodule("filters", "Filter Submodule");
|
|
|
|
|
export_filters(filters_module);
|
2019-11-18 08:36:39 +00:00
|
|
|
|
|
|
|
|
// Register RFNoC submodule
|
|
|
|
|
auto rfnoc_module = m.def_submodule("rfnoc", "RFNoC Objects");
|
|
|
|
|
export_rfnoc(rfnoc_module);
|
2020-06-01 19:48:02 +00:00
|
|
|
export_ddc_block_control(rfnoc_module);
|
2020-06-01 19:51:53 +00:00
|
|
|
export_duc_block_control(rfnoc_module);
|
2020-06-04 21:24:01 +00:00
|
|
|
export_fft_block_control(rfnoc_module);
|
2020-06-01 19:56:16 +00:00
|
|
|
export_fosphor_block_control(rfnoc_module);
|
2020-06-01 20:01:04 +00:00
|
|
|
export_fir_filter_block_control(rfnoc_module);
|
2020-08-05 12:37:38 +00:00
|
|
|
export_keep_one_in_n_block_control(rfnoc_module);
|
2020-07-14 22:28:19 +00:00
|
|
|
export_moving_average_block_control(rfnoc_module);
|
2020-06-01 20:31:21 +00:00
|
|
|
export_null_block_control(rfnoc_module);
|
2020-06-01 20:21:43 +00:00
|
|
|
export_radio_control(rfnoc_module);
|
2020-08-03 16:36:18 +00:00
|
|
|
export_replay_block_control(rfnoc_module);
|
2020-07-24 15:28:07 +00:00
|
|
|
export_siggen_block_control(rfnoc_module);
|
2020-07-23 00:55:05 +00:00
|
|
|
export_switchboard_block_control(rfnoc_module);
|
2020-06-01 20:26:33 +00:00
|
|
|
export_vector_iir_block_control(rfnoc_module);
|
2020-06-16 18:38:29 +00:00
|
|
|
export_window_block_control(rfnoc_module);
|
2020-03-04 00:10:06 +00:00
|
|
|
|
|
|
|
|
// Register calibration submodule
|
|
|
|
|
auto cal_module = m.def_submodule("cal", "Calibration Objects");
|
|
|
|
|
export_cal(cal_module);
|
2020-06-25 20:43:32 +00:00
|
|
|
|
|
|
|
|
auto chdr_module = m.def_submodule("chdr", "CHDR Parsing");
|
|
|
|
|
export_utils(chdr_module);
|
2020-10-12 10:22:00 +00:00
|
|
|
|
|
|
|
|
// Register property tree
|
|
|
|
|
export_property_tree(m);
|
2017-02-09 19:16:16 +00:00
|
|
|
}
|