diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-11-21 16:52:20 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:07 -0800 |
commit | 688247e5451216e82c3817e75d0c2bcfb70488c9 (patch) | |
tree | 447396892013a6cd5c1dec8591e2ebf7b569a614 | |
parent | 67010257063f24052ee130e01b8f64ac0daa5a7e (diff) | |
download | uhd-688247e5451216e82c3817e75d0c2bcfb70488c9.tar.gz uhd-688247e5451216e82c3817e75d0c2bcfb70488c9.tar.bz2 uhd-688247e5451216e82c3817e75d0c2bcfb70488c9.zip |
mpm: ad937x: Add LO lock API
Reviewed-By: Steven Bingler <steven.bingler@ni.com>
Reviewed-By: Trung Tran <trung.tran@ettus.com>
-rw-r--r-- | mpm/include/mpm/ad937x/ad937x_ctrl.hpp | 10 | ||||
-rw-r--r-- | mpm/lib/mykonos/ad937x_ctrl.cpp | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp index 4710af445..21a6b2892 100644 --- a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp +++ b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp @@ -238,6 +238,15 @@ public: */ virtual double get_freq(const std::string &which) = 0; + /*! \brief Returns the LO lock status + * + * Note there's only one LO per direction, so the channel doesn't really + * matter here. + * This does not check the PLL lock status for the main clock, the sniffer, + * or the CAL PLL. + */ + virtual bool get_lo_locked(const std::string &which) = 0; + //! set the FIR filter for the frontend which virtual void set_fir(const std::string &which, int8_t gain, const std::vector<int16_t> & fir) = 0; @@ -300,6 +309,7 @@ void export_mykonos(){ .def("enable_channel", &ad937x_ctrl::enable_channel) .def("set_freq", &ad937x_ctrl::set_freq) .def("get_freq", &ad937x_ctrl::get_freq) + .def("get_lo_locked", &ad937x_ctrl::get_lo_locked) .def("set_fir", &ad937x_ctrl::set_fir) .def("get_fir", &ad937x_ctrl::get_fir) .def("get_temperature", &ad937x_ctrl::get_temperature) diff --git a/mpm/lib/mykonos/ad937x_ctrl.cpp b/mpm/lib/mykonos/ad937x_ctrl.cpp index 2594ac920..8aeb5b599 100644 --- a/mpm/lib/mykonos/ad937x_ctrl.cpp +++ b/mpm/lib/mykonos/ad937x_ctrl.cpp @@ -417,6 +417,17 @@ public: return device.get_freq(dir); } + virtual bool get_lo_locked(const std::string &which) + { + const auto dir = _get_direction_from_antenna(which); + const uint8_t pll_select = (dir == uhd::RX_DIRECTION) ? + ad937x_device::RX_SYNTH : + ad937x_device::TX_SYNTH; + + std::lock_guard<std::mutex> lock(*spi_mutex); + return device.get_pll_lock_status(pll_select); + } + virtual void set_fir(const std::string &which, int8_t gain, const std::vector<int16_t> & fir) { auto dir = _get_direction_from_antenna(which); |