aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/types')
-rw-r--r--host/lib/types/filters_python.hpp60
-rw-r--r--host/lib/types/metadata_python.hpp111
-rw-r--r--host/lib/types/sensors_python.hpp46
-rw-r--r--host/lib/types/serial_python.hpp32
-rw-r--r--host/lib/types/time_spec_python.hpp35
-rw-r--r--host/lib/types/tune_python.hpp39
-rw-r--r--host/lib/types/types_python.hpp33
7 files changed, 356 insertions, 0 deletions
diff --git a/host/lib/types/filters_python.hpp b/host/lib/types/filters_python.hpp
new file mode 100644
index 000000000..ff5785345
--- /dev/null
+++ b/host/lib/types/filters_python.hpp
@@ -0,0 +1,60 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_FILTERS_PYTHON_HPP
+#define INCLUDED_UHD_FILTERS_PYTHON_HPP
+
+#include <uhd/types/filters.hpp>
+
+void export_filters()
+{
+ using filter_info_base = uhd::filter_info_base;
+ using filter_info_type = filter_info_base::filter_type;
+ using analog_filter_base = uhd::analog_filter_base;
+ using analog_filter_lp = uhd::analog_filter_lp;
+
+ bp::enum_<filter_info_type>("filter_type")
+ .value("analog_low_pass" , filter_info_base::ANALOG_LOW_PASS )
+ .value("analog_band_pass", filter_info_base::ANALOG_BAND_PASS)
+ .value("digital_i16" , filter_info_base::DIGITAL_I16 )
+ .value("digital_fir_i16" , filter_info_base::DIGITAL_FIR_I16 )
+ ;
+
+ bp::class_<
+ filter_info_base,
+ boost::shared_ptr<filter_info_base> >
+ ("filter_info_base", bp::init<filter_info_type, bool, size_t>())
+
+ // Methods
+ .def("is_bypassed", &filter_info_base::is_bypassed )
+ .def("get_type" , &filter_info_base::get_type )
+ .def("__str__" , &filter_info_base::to_pp_string)
+ ;
+
+ bp::class_<
+ analog_filter_base,
+ boost::shared_ptr<analog_filter_base>,
+ bp::bases<filter_info_base> >
+ ("analog_filter_base", bp::init<filter_info_type, bool, size_t, std::string>())
+
+ // Methods
+ .def("get_analog_type", &analog_filter_base::get_analog_type, bp::return_value_policy<bp::copy_const_reference>())
+ ;
+
+ bp::class_<
+ analog_filter_lp,
+ boost::shared_ptr<analog_filter_lp>,
+ bp::bases<analog_filter_base> >
+ ("analog_filter_lp", bp::init<filter_info_type, bool, size_t, const std::string, double, double>())
+
+ // Methods
+ .def("get_cutoff" , &analog_filter_lp::get_cutoff )
+ .def("get_rolloff", &analog_filter_lp::get_rolloff)
+ .def("set_cutoff" , &analog_filter_lp::set_cutoff )
+ ;
+}
+
+#endif /* INCLUDED_UHD_FILTERS_PYTHON_HPP */
diff --git a/host/lib/types/metadata_python.hpp b/host/lib/types/metadata_python.hpp
new file mode 100644
index 000000000..876756d73
--- /dev/null
+++ b/host/lib/types/metadata_python.hpp
@@ -0,0 +1,111 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_METADATA_PYTHON_HPP
+#define INCLUDED_UHD_METADATA_PYTHON_HPP
+
+#include <uhd/types/ranges.hpp>
+
+void export_metadata()
+{
+ using range_t = uhd::range_t;
+ using meta_range_t = uhd::meta_range_t;
+ using rx_metadata_t = uhd::rx_metadata_t;
+ using error_code_t = rx_metadata_t::error_code_t;
+ using tx_metadata_t = uhd::tx_metadata_t;
+ using async_metadata_t = uhd::async_metadata_t;
+ using event_code_t = async_metadata_t::event_code_t;
+
+ bp::enum_<error_code_t>("rx_metadata_error_code")
+ .value("none" , error_code_t::ERROR_CODE_NONE )
+ .value("timeout" , error_code_t::ERROR_CODE_TIMEOUT )
+ .value("late" , error_code_t::ERROR_CODE_LATE_COMMAND)
+ .value("broken_chain", error_code_t::ERROR_CODE_BROKEN_CHAIN)
+ .value("overflow" , error_code_t::ERROR_CODE_OVERFLOW )
+ .value("alignment" , error_code_t::ERROR_CODE_ALIGNMENT )
+ .value("bad_packet" , error_code_t::ERROR_CODE_BAD_PACKET )
+ ;
+
+ bp::class_<range_t>
+ ("range", bp::init<double>())
+
+ // Constructors
+ .def(bp::init<double, double, double>())
+
+ // Methods
+ .def("start" , &range_t::start )
+ .def("stop" , &range_t::stop )
+ .def("step" , &range_t::step )
+ .def("__str__", &range_t::to_pp_string)
+ ;
+
+ bp::class_<std::vector<range_t> >("range_vector")
+ .def(bp::vector_indexing_suite<std::vector<range_t> >());
+
+ bp::class_<meta_range_t, bp::bases<std::vector<range_t> > >
+ ("meta_range", bp::init<>())
+
+ // Constructors
+ .def(bp::init<double, double, double>())
+
+ // Methods
+ .def("start" , &meta_range_t::start )
+ .def("stop" , &meta_range_t::stop )
+ .def("step" , &meta_range_t::step )
+ .def("clip" , &meta_range_t::clip )
+ .def("__str__", &meta_range_t::to_pp_string)
+ ;
+
+ bp::class_<rx_metadata_t>("rx_metadata", bp::init<>())
+
+ // Methods
+ .def("reset" , &rx_metadata_t::reset )
+ .def("to_pp_string", &rx_metadata_t::to_pp_string)
+ .def("strerror" , &rx_metadata_t::strerror )
+ .def("__str__" , &rx_metadata_t::to_pp_string, bp::args("compact") = false)
+
+ // Properties
+ .def_readonly("has_time_spec" , &rx_metadata_t::has_time_spec )
+ .def_readonly("time_spec" , &rx_metadata_t::time_spec )
+ .def_readonly("more_fragments" , &rx_metadata_t::more_fragments )
+ .def_readonly("start_of_burst" , &rx_metadata_t::start_of_burst )
+ .def_readonly("end_of_burst" , &rx_metadata_t::end_of_burst )
+ .def_readonly("error_code" , &rx_metadata_t::error_code )
+ .def_readonly("out_of_sequence", &rx_metadata_t::out_of_sequence)
+ ;
+
+ bp::class_<tx_metadata_t>("tx_metadata", bp::init<>())
+
+ // Properties
+ .def_readwrite("has_time_spec" , &tx_metadata_t::has_time_spec )
+ .def_readwrite("time_spec" , &tx_metadata_t::time_spec )
+ .def_readwrite("start_of_burst", &tx_metadata_t::start_of_burst)
+ .def_readwrite("end_of_burst" , &tx_metadata_t::end_of_burst )
+ ;
+
+ bp::enum_<event_code_t>("tx_metadata_event_code")
+ .value("burst_ack" , event_code_t::EVENT_CODE_BURST_ACK )
+ .value("underflow" , event_code_t::EVENT_CODE_UNDERFLOW )
+ .value("seq_error" , event_code_t::EVENT_CODE_SEQ_ERROR )
+ .value("time_error" , event_code_t::EVENT_CODE_TIME_ERROR )
+ .value("underflow_in_packet", event_code_t::EVENT_CODE_UNDERFLOW_IN_PACKET)
+ .value("seq_error_in_packet", event_code_t::EVENT_CODE_SEQ_ERROR_IN_BURST )
+ .value("user_payload" , event_code_t::EVENT_CODE_USER_PAYLOAD )
+ ;
+
+ bp::class_<async_metadata_t>("async_metadata", bp::init<>())
+
+ // Properties
+ .def_readwrite("channel" , &async_metadata_t::channel )
+ .def_readwrite("has_time_spec", &async_metadata_t::has_time_spec)
+ .def_readwrite("time_spec" , &async_metadata_t::time_spec )
+ .def_readwrite("event_code" , &async_metadata_t::event_code )
+ // TODO: Expose user payloads
+ //.def_readwrite("user_payload" , &async_metadata_t::user_payload )
+ ;
+}
+
+#endif /* INCLUDED_UHD_METADATA_PYTHON_HPP */
diff --git a/host/lib/types/sensors_python.hpp b/host/lib/types/sensors_python.hpp
new file mode 100644
index 000000000..8fd9da4e3
--- /dev/null
+++ b/host/lib/types/sensors_python.hpp
@@ -0,0 +1,46 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_SENSORS_PYTHON_HPP
+#define INCLUDED_UHD_SENSORS_PYTHON_HPP
+
+#include <uhd/types/sensors.hpp>
+
+void export_sensors()
+{
+ using sensor_value_t = uhd::sensor_value_t;
+ using data_type_t = sensor_value_t::data_type_t;
+
+ bp::enum_<data_type_t>("data_type")
+ .value("b", data_type_t::BOOLEAN)
+ .value("i", data_type_t::INTEGER)
+ .value("r", data_type_t::REALNUM)
+ .value("s", data_type_t::STRING )
+ ;
+
+ bp::class_<sensor_value_t>
+ ("sensor_value", bp::init<const std::string&, bool, const std::string&, const std::string&>())
+
+ // Constructors
+ .def(bp::init<const std::string&, signed, const std::string&, const std::string&>())
+ .def(bp::init<const std::string&, double, const std::string&, const std::string&>())
+ .def(bp::init<const std::string&, const std::string& , const std::string&>())
+
+ // Methods
+ .def("to_bool", &sensor_value_t::to_bool )
+ .def("to_int", &sensor_value_t::to_int )
+ .def("to_real", &sensor_value_t::to_real )
+ .def("__str__", &sensor_value_t::to_pp_string)
+
+ // Properties
+ .add_property("name", &sensor_value_t::name )
+ .add_property("value", &sensor_value_t::value)
+ .add_property("unit", &sensor_value_t::unit )
+ .add_property("type", &sensor_value_t::type )
+ ;
+}
+
+#endif /* INCLUDED_UHD_SENSORS_PYTHON_HPP */
diff --git a/host/lib/types/serial_python.hpp b/host/lib/types/serial_python.hpp
new file mode 100644
index 000000000..441bcc4d7
--- /dev/null
+++ b/host/lib/types/serial_python.hpp
@@ -0,0 +1,32 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_SERIAL_PYTHON_HPP
+#define INCLUDED_UHD_SERIAL_PYTHON_HPP
+
+#include <uhd/types/serial.hpp>
+
+void export_spi_config()
+{
+ using spi_config_t = uhd::spi_config_t;
+ using spi_edge_t = spi_config_t::edge_t;
+
+ bp::enum_<spi_edge_t>("spi_edge")
+ .value("EDGE_RISE" , spi_edge_t::EDGE_RISE)
+ .value("EDGE_FALL", spi_edge_t::EDGE_FALL)
+ ;
+
+ bp::class_<spi_config_t>("spi_config", bp::init<spi_edge_t>())
+
+ // Properties
+ .add_property("mosi_edge" , &spi_config_t::mosi_edge )
+ .add_property("miso_edge" , &spi_config_t::miso_edge )
+ .add_property("use_custom_divider", &spi_config_t::use_custom_divider)
+ .add_property("divider" , &spi_config_t::divider )
+ ;
+}
+
+#endif /* INCLUDED_UHD_SERIAL_PYTHON_HPP */
diff --git a/host/lib/types/time_spec_python.hpp b/host/lib/types/time_spec_python.hpp
new file mode 100644
index 000000000..f411af0b0
--- /dev/null
+++ b/host/lib/types/time_spec_python.hpp
@@ -0,0 +1,35 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_TIME_SPEC_PYTHON_HPP
+#define INCLUDED_UHD_TIME_SPEC_PYTHON_HPP
+
+#include <uhd/types/time_spec.hpp>
+
+void export_time_spec()
+{
+ using time_spec_t = uhd::time_spec_t;
+
+ bp::class_<time_spec_t>("time_spec", bp::init<double>())
+
+ // Methods
+ .def("from_ticks" , &time_spec_t::from_ticks )
+ .staticmethod("from_ticks" )
+
+ .def("get_tick_count" , &time_spec_t::get_tick_count )
+ .def("to_ticks" , &time_spec_t::to_ticks )
+ .def("get_real_secs" , &time_spec_t::get_real_secs )
+ .def("get_frac_secs" , &time_spec_t::get_frac_secs )
+
+ .def(bp::self += time_spec_t())
+ .def(bp::self += double())
+ .def(bp::self + double())
+ .def(bp::self + time_spec_t())
+ .def(bp::self -= time_spec_t())
+ ;
+}
+
+#endif /* INCLUDED_UHD_TIME_SPEC_PYTHON_HPP */
diff --git a/host/lib/types/tune_python.hpp b/host/lib/types/tune_python.hpp
new file mode 100644
index 000000000..532cc2f8e
--- /dev/null
+++ b/host/lib/types/tune_python.hpp
@@ -0,0 +1,39 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_TUNE_PYTHON_HPP
+#define INCLUDED_UHD_TUNE_PYTHON_HPP
+
+#include <uhd/types/tune_result.hpp>
+#include <uhd/types/tune_request.hpp>
+
+void export_tune()
+{
+ using tune_request_t = uhd::tune_request_t;
+ using tune_result_t = uhd::tune_result_t;
+ using policy_t = tune_request_t::policy_t;
+
+ bp::enum_<policy_t>("tune_request_policy")
+ .value("none", tune_request_t::POLICY_NONE )
+ .value("auto", tune_request_t::POLICY_AUTO )
+ .value("manual", tune_request_t::POLICY_MANUAL)
+ ;
+
+ bp::class_<tune_request_t>("tune_request", bp::init<double>())
+ .def(bp::init<double, double>())
+ .def_readwrite("target_freq" , &tune_request_t::target_freq )
+ .def_readwrite("rf_freq_policy" , &tune_request_t::rf_freq_policy )
+ .def_readwrite("dsp_freq_policy", &tune_request_t::dsp_freq_policy)
+ .def_readwrite("rf_freq" , &tune_request_t::rf_freq )
+ .def_readwrite("dsp_freq" , &tune_request_t::dsp_freq )
+ .def_readwrite("args" , &tune_request_t::args )
+ ;
+
+ bp::class_<tune_result_t>("tune_result", bp::init<>())
+ ;
+}
+
+#endif /* INCLUDED_UHD_TUNE_PYTHON_HPP */
diff --git a/host/lib/types/types_python.hpp b/host/lib/types/types_python.hpp
new file mode 100644
index 000000000..4cda00d0d
--- /dev/null
+++ b/host/lib/types/types_python.hpp
@@ -0,0 +1,33 @@
+//
+// Copyright 2017-2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHD_TYPES_PYTHON_HPP
+#define INCLUDED_UHD_TYPES_PYTHON_HPP
+
+#include <uhd/types/stream_cmd.hpp>
+
+void export_types()
+{
+ using stream_cmd_t = uhd::stream_cmd_t;
+ using stream_mode_t = stream_cmd_t::stream_mode_t;
+
+ bp::enum_<stream_mode_t>("stream_mode")
+ .value("start_cont", stream_cmd_t::STREAM_MODE_START_CONTINUOUS )
+ .value("stop_cont" , stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS )
+ .value("num_done" , stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE)
+ .value("num_more" , stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE)
+ ;
+
+ bp::class_<stream_cmd_t>("stream_cmd", bp::init<stream_cmd_t::stream_mode_t>())
+
+ // Properties
+ .def_readwrite("num_samps" , &stream_cmd_t::num_samps )
+ .def_readwrite("time_spec" , &stream_cmd_t::time_spec )
+ .def_readwrite("stream_now", &stream_cmd_t::stream_now)
+ ;
+}
+
+#endif /* INCLUDED_UHD_TYPES_PYTHON_HPP */