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>
|
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-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-01 19:56:16 +00:00
|
|
|
#include "rfnoc/fosphor_block_control_python.hpp"
|
2019-11-18 08:36:39 +00:00
|
|
|
#include "rfnoc/rfnoc_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"
|
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-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-01 19:56:16 +00:00
|
|
|
export_fosphor_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);
|
2017-02-09 19:16:16 +00:00
|
|
|
}
|