diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:30:29 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 476dccd6c383e4c0eccf0f42242137f863cda136 (patch) | |
tree | b2de8a55e3e63374fc05f94dbe82cc9fcb4691aa /mpm | |
parent | 876d4150aa3da531ddd687b48afada6e43f79146 (diff) | |
download | uhd-476dccd6c383e4c0eccf0f42242137f863cda136.tar.gz uhd-476dccd6c383e4c0eccf0f42242137f863cda136.tar.bz2 uhd-476dccd6c383e4c0eccf0f42242137f863cda136.zip |
mpm: Apply clang-format against all .cpp and .hpp files
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/include/mpm/ad9361/ad9361_ctrl.hpp | 61 | ||||
-rw-r--r-- | mpm/include/mpm/ad9361/e31x_defaults.hpp | 33 | ||||
-rw-r--r-- | mpm/include/mpm/ad937x/ad937x_ctrl.hpp | 37 | ||||
-rw-r--r-- | mpm/include/mpm/types/types_python.hpp | 4 | ||||
-rw-r--r-- | mpm/lib/dboards/e31x_db_manager.cpp | 14 | ||||
-rw-r--r-- | mpm/lib/dboards/neon_manager.cpp | 4 | ||||
-rw-r--r-- | mpm/lib/mykonos/ad937x_device.cpp | 5 | ||||
-rw-r--r-- | mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp | 6 |
8 files changed, 81 insertions, 83 deletions
diff --git a/mpm/include/mpm/ad9361/ad9361_ctrl.hpp b/mpm/include/mpm/ad9361/ad9361_ctrl.hpp index 2405317fd..2c3de0187 100644 --- a/mpm/include/mpm/ad9361/ad9361_ctrl.hpp +++ b/mpm/include/mpm/ad9361/ad9361_ctrl.hpp @@ -12,9 +12,9 @@ #include <boost/make_shared.hpp> #include <boost/noncopyable.hpp> #include <functional> +#include <future> #include <string> #include <vector> -#include <future> namespace mpm { namespace chips { using uhd::usrp::ad9361_ctrl; @@ -64,47 +64,30 @@ void export_catalina(py::module& top_module) .def("set_filter", &ad9361_ctrl::set_filter) .def("output_digital_test_tone", &ad9361_ctrl::output_digital_test_tone); - m.def("async__tune", +[]( - ad9361_ctrl& catalina, - const std::string &which, - const double value - ){ - handle_tune = std::async(std::launch::async, - &ad9361_ctrl::tune, - &catalina, - which, - value - ); + m.def("async__tune", + +[](ad9361_ctrl& catalina, const std::string& which, const double value) { + handle_tune = std::async( + std::launch::async, &ad9361_ctrl::tune, &catalina, which, value); + }); + m.def("await__tune", +[]() -> bool { + if (handle_tune.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { + handle_tune.get(); + return true; + } + return false; }); - m.def("await__tune", +[]( - )->bool{ - if (handle_tune.wait_for(std::chrono::seconds(0)) - == std::future_status::ready){ - handle_tune.get(); - return true; - } - return false; + m.def("async__set_clock_rate", +[](ad9361_ctrl& catalina, const double value) { + handle_set_clock_rate = std::async( + std::launch::async, &ad9361_ctrl::set_clock_rate, &catalina, value); }); - m.def("async__set_clock_rate", +[]( - ad9361_ctrl& catalina, - const double value - ){ - handle_set_clock_rate = std::async(std::launch::async, - &ad9361_ctrl::set_clock_rate, - &catalina, - value - ); + m.def("await__set_clock_rate", +[]() -> bool { + if (handle_set_clock_rate.wait_for(std::chrono::seconds(0)) + == std::future_status::ready) { + handle_set_clock_rate.get(); + return true; + } + return false; }); - m.def("await__set_clock_rate", +[]( - )->bool{ - if (handle_set_clock_rate.wait_for(std::chrono::seconds(0)) - == std::future_status::ready){ - handle_set_clock_rate.get(); - return true; - } - return false; - }); - } #endif diff --git a/mpm/include/mpm/ad9361/e31x_defaults.hpp b/mpm/include/mpm/ad9361/e31x_defaults.hpp index c2188af8b..0dec39361 100644 --- a/mpm/include/mpm/ad9361/e31x_defaults.hpp +++ b/mpm/include/mpm/ad9361/e31x_defaults.hpp @@ -13,33 +13,42 @@ namespace mpm { namespace types { namespace e31x { using namespace uhd::usrp; -class e31x_ad9361_client_t : public uhd::usrp::ad9361_params { +class e31x_ad9361_client_t : public uhd::usrp::ad9361_params +{ public: ~e31x_ad9361_client_t() {} - double get_band_edge(frequency_band_t band) { + double get_band_edge(frequency_band_t band) + { switch (band) { - case AD9361_RX_BAND0: return 1.2e9; - case AD9361_RX_BAND1: return 2.6e9; - case AD9361_TX_BAND0: return 2940.0e6; - default: return 0; + case AD9361_RX_BAND0: + return 1.2e9; + case AD9361_RX_BAND1: + return 2.6e9; + case AD9361_TX_BAND0: + return 2940.0e6; + default: + return 0; } } - clocking_mode_t get_clocking_mode() { + clocking_mode_t get_clocking_mode() + { return clocking_mode_t::AD9361_XTAL_N_CLK_PATH; } - digital_interface_mode_t get_digital_interface_mode() { + digital_interface_mode_t get_digital_interface_mode() + { return AD9361_DDR_FDD_LVCMOS; } - digital_interface_delays_t get_digital_interface_timing() { + digital_interface_delays_t get_digital_interface_timing() + { digital_interface_delays_t delays; - delays.rx_clk_delay = 0; + delays.rx_clk_delay = 0; delays.rx_data_delay = 0xF; - delays.tx_clk_delay = 0; + delays.tx_clk_delay = 0; delays.tx_data_delay = 0xF; return delays; } }; -}}} // namespace +}}} // namespace mpm::types::e31x #endif // INCLUDED_E31X_DEFAULTS_HPP diff --git a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp index 44e814e60..787bc41b5 100644 --- a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp +++ b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp @@ -360,30 +360,27 @@ void export_mykonos(py::module& top_module) .def("set_clock_rate", &ad937x_ctrl::set_clock_rate) .def("enable_channel", &ad937x_ctrl::enable_channel) .def("set_freq", &ad937x_ctrl::set_freq) - .def("async__set_freq", +[]( - ad937x_ctrl& self, - const std::string &which, - const double value, - const bool wait_for_lock - ){ + .def("async__set_freq", + +[](ad937x_ctrl& self, + const std::string& which, + const double value, + const bool wait_for_lock) { self.handle_set_freq = std::async(std::launch::async, &ad937x_ctrl::set_freq, &self, which, value, - wait_for_lock - ); - }) - .def("await__set_freq", +[]( - ad937x_ctrl& self - )->bool{ + wait_for_lock); + }) + .def("await__set_freq", + +[](ad937x_ctrl& self) -> bool { if (self.handle_set_freq.wait_for(std::chrono::seconds(0)) - == std::future_status::ready){ + == std::future_status::ready) { self.handle_set_freq.get(); return true; } return false; - }) + }) .def("get_freq", &ad937x_ctrl::get_freq) .def("get_lo_locked", &ad937x_ctrl::get_lo_locked) .def("set_fir", &ad937x_ctrl::set_fir) @@ -397,11 +394,14 @@ void export_mykonos(py::module& top_module) .def_readonly_static("RX_GAIN_DELAY", &ad937x_ctrl::RX_GAIN_DELAY) .def_readonly_static("FLASH_CAL", &ad937x_ctrl::FLASH_CAL) .def_readonly_static("PATH_DELAY", &ad937x_ctrl::PATH_DELAY) - .def_readonly_static("TX_LO_LEAKAGE_INTERNAL", &ad937x_ctrl::TX_LO_LEAKAGE_INTERNAL) - .def_readonly_static("TX_LO_LEAKAGE_EXTERNAL", &ad937x_ctrl::TX_LO_LEAKAGE_EXTERNAL) + .def_readonly_static( + "TX_LO_LEAKAGE_INTERNAL", &ad937x_ctrl::TX_LO_LEAKAGE_INTERNAL) + .def_readonly_static( + "TX_LO_LEAKAGE_EXTERNAL", &ad937x_ctrl::TX_LO_LEAKAGE_EXTERNAL) .def_readonly_static("TX_QEC_INIT", &ad937x_ctrl::TX_QEC_INIT) .def_readonly_static("LOOPBACK_RX_LO_DELAY", &ad937x_ctrl::LOOPBACK_RX_LO_DELAY) - .def_readonly_static("LOOPBACK_RX_RX_QEC_INIT", &ad937x_ctrl::LOOPBACK_RX_RX_QEC_INIT) + .def_readonly_static( + "LOOPBACK_RX_RX_QEC_INIT", &ad937x_ctrl::LOOPBACK_RX_RX_QEC_INIT) .def_readonly_static("RX_LO_DELAY", &ad937x_ctrl::RX_LO_DELAY) .def_readonly_static("RX_QEC_INIT", &ad937x_ctrl::RX_QEC_INIT) .def_readonly_static("DPD_INIT", &ad937x_ctrl::DPD_INIT) @@ -424,7 +424,8 @@ void export_mykonos(py::module& top_module) .def_readonly_static("TRACK_ORX1_QEC_SNLO", &ad937x_ctrl::TRACK_ORX1_QEC_SNLO) .def_readonly_static("TRACK_ORX2_QEC_SNLO", &ad937x_ctrl::TRACK_ORX2_QEC_SNLO) .def_readonly_static("TRACK_SRX_QEC", &ad937x_ctrl::TRACK_SRX_QEC) - .def_readonly_static("DEFAULT_INIT_CALS_MASKS", &ad937x_ctrl::DEFAULT_INIT_CALS_MASKS) + .def_readonly_static( + "DEFAULT_INIT_CALS_MASKS", &ad937x_ctrl::DEFAULT_INIT_CALS_MASKS) .def_readonly_static( "DEFAULT_TRACKING_CALS_MASKS", &ad937x_ctrl::DEFAULT_TRACKING_CALS_MASKS) .def_readonly_static( diff --git a/mpm/include/mpm/types/types_python.hpp b/mpm/include/mpm/types/types_python.hpp index b934605ad..cb2af5c4b 100644 --- a/mpm/include/mpm/types/types_python.hpp +++ b/mpm/include/mpm/types/types_python.hpp @@ -30,9 +30,7 @@ void export_types(py::module& top_module) py::class_<log_buf, std::shared_ptr<log_buf>>(m, "log_buf") .def_static("make_singleton", &log_buf::make_singleton) .def("set_notify_callback", - +[](log_buf& self, py::object object) { - self.set_notify_callback(object); - }) + +[](log_buf& self, py::object object) { self.set_notify_callback(object); }) .def("pop", [](log_buf& self) { auto log_msg = self.pop(); return py::make_tuple(static_cast<int>(std::get<0>(log_msg)), diff --git a/mpm/lib/dboards/e31x_db_manager.cpp b/mpm/lib/dboards/e31x_db_manager.cpp index 3c6346bd3..9965db280 100644 --- a/mpm/lib/dboards/e31x_db_manager.cpp +++ b/mpm/lib/dboards/e31x_db_manager.cpp @@ -28,9 +28,9 @@ constexpr uint32_t AD9361_SPI_DATA_MASK = 0x000000FF; constexpr uint32_t AD9361_SPI_DATA_SHIFT = 0; constexpr uint32_t AD9361_SPI_NUM_BITS = 24; constexpr uint32_t AD9361_SPI_SPEED_HZ = 2000000; -constexpr int AD9361_SPI_MODE = 1; +constexpr int AD9361_SPI_MODE = 1; -} // namespace /*anon*/ +} // namespace /*! MPM-style E310 SPI Iface for AD9361 CTRL * @@ -38,10 +38,14 @@ constexpr int AD9361_SPI_MODE = 1; class e310_ad9361_io_spi : public ad9361_io { public: - e310_ad9361_io_spi(regs_iface::sptr regs_iface, uint32_t slave_num) : - _regs_iface(regs_iface), _slave_num(slave_num) { } + e310_ad9361_io_spi(regs_iface::sptr regs_iface, uint32_t slave_num) + : _regs_iface(regs_iface), _slave_num(slave_num) + { + } - ~e310_ad9361_io_spi() {/*nop*/} + ~e310_ad9361_io_spi() + { /*nop*/ + } uint8_t peek8(uint32_t reg) { diff --git a/mpm/lib/dboards/neon_manager.cpp b/mpm/lib/dboards/neon_manager.cpp index 31ecf7291..395a1c6b2 100644 --- a/mpm/lib/dboards/neon_manager.cpp +++ b/mpm/lib/dboards/neon_manager.cpp @@ -73,6 +73,6 @@ neon_manager::neon_manager(const std::string& catalina_spidev) // Make the SPI interface auto spi_io_iface = std::make_shared<e320_ad9361_io_spi>(spi_iface, 0); // Make the actual Catalina Ctrl object - _catalina_ctrl = ad9361_ctrl::make_spi( - std::make_shared<e320_ad9361_client_t>(), spi_io_iface); + _catalina_ctrl = + ad9361_ctrl::make_spi(std::make_shared<e320_ad9361_client_t>(), spi_io_iface); } diff --git a/mpm/lib/mykonos/ad937x_device.cpp b/mpm/lib/mykonos/ad937x_device.cpp index 5d089601e..b476922f2 100644 --- a/mpm/lib/mykonos/ad937x_device.cpp +++ b/mpm/lib/mykonos/ad937x_device.cpp @@ -47,7 +47,7 @@ static const uint32_t PLL_LOCK_TIMEOUT_MS = 200; // Fewer discontinuities at lower signal frequencies // Minimum value is 0.8 ms, enforced by ADI's API static constexpr double RX_DC_OFFSET_AVERAGING_WINDOW_MS = 1.0; -static_assert(RX_DC_OFFSET_AVERAGING_WINDOW_MS >= 0.8, +static_assert(RX_DC_OFFSET_AVERAGING_WINDOW_MS >= 0.8, "RX DC offset averaging window must be greater than 0.8 ms"); /****************************************************** @@ -305,7 +305,8 @@ void ad937x_device::setup_cal(const uint32_t init_cals_mask, uint16_t window = std::ceil((RX_DC_OFFSET_AVERAGING_WINDOW_MS * (mykonos_config.device->rx->rxProfile->iqRate_kHz)) / 1024); - CALL_API(MYKONOS_setRfDcOffsetCnt(mykonos_config.device, MYK_DC_OFFSET_RX_CHN, window)); + CALL_API( + MYKONOS_setRfDcOffsetCnt(mykonos_config.device, MYK_DC_OFFSET_RX_CHN, window)); CALL_API(MYKONOS_enableTrackingCals(mykonos_config.device, tracking_cals_mask)); // ready for radioOn diff --git a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp index 12851af92..79c24abd5 100644 --- a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp +++ b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp @@ -15,7 +15,8 @@ // C++14 requires std::hash includes a specialization for enums, but gcc doesn't do that // yet Remove this when that happens namespace std { -template <> struct hash<uhd::direction_t> +template <> +struct hash<uhd::direction_t> { size_t operator()(const uhd::direction_t& x) const { @@ -23,7 +24,8 @@ template <> struct hash<uhd::direction_t> } }; -template <> struct hash<mpm::ad937x::device::chain_t> +template <> +struct hash<mpm::ad937x::device::chain_t> { size_t operator()(const mpm::ad937x::device::chain_t& x) const { |