diff options
author | Trung N Tran <trung.tran@ettus.com> | 2017-11-16 16:17:11 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:57 -0800 |
commit | b9a0cf1467e89000658f69089bb773722e41ea89 (patch) | |
tree | 80ce5beb47c1a93694b16a7bbed365d1a0175c4c /mpm/lib/mykonos/ad937x_ctrl.cpp | |
parent | 73eb899e533d29c456eed1bc0ae72ff65676daf1 (diff) | |
download | uhd-b9a0cf1467e89000658f69089bb773722e41ea89.tar.gz uhd-b9a0cf1467e89000658f69089bb773722e41ea89.tar.bz2 uhd-b9a0cf1467e89000658f69089bb773722e41ea89.zip |
mpm: Enable TX external LO set through args, simplify code
Simplify the process of setting external LO without calling through many API
layers.
Reviewed-By: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'mpm/lib/mykonos/ad937x_ctrl.cpp')
-rw-r--r-- | mpm/lib/mykonos/ad937x_ctrl.cpp | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/mpm/lib/mykonos/ad937x_ctrl.cpp b/mpm/lib/mykonos/ad937x_ctrl.cpp index d6062c228..2642e3858 100644 --- a/mpm/lib/mykonos/ad937x_ctrl.cpp +++ b/mpm/lib/mykonos/ad937x_ctrl.cpp @@ -189,23 +189,6 @@ public: { /* nop */ } - virtual void update_rx_lo_source(uint8_t rx_lo_source){ - std::lock_guard<std::mutex> lock(*spi_mutex); - device.update_rx_lo_source(rx_lo_source); - } - virtual void update_tx_lo_source(uint8_t tx_lo_source){ - std::lock_guard<std::mutex> lock(*spi_mutex); - device.update_tx_lo_source(tx_lo_source); - } - - virtual uint8_t get_rx_lo_source(){ - std::lock_guard<std::mutex> lock(*spi_mutex); - return device.get_rx_lo_source(); - } - virtual uint8_t get_tx_lo_source(){ - std::lock_guard<std::mutex> lock(*spi_mutex); - return device.get_tx_lo_source(); - } virtual void begin_initialization() { std::lock_guard<std::mutex> lock(*spi_mutex); @@ -223,6 +206,46 @@ public: std::lock_guard<std::mutex> lock(*spi_mutex); device.setup_cal(init_cals_mask, tracking_cals_mask, timeout); } + + virtual std::string set_lo_source(const std::string &which, const std::string &source){ + auto dir = _get_direction_from_antenna(which); + + uint8_t pll_source = 0 ; + if (source == "internal"){ + pll_source = 0; + } + else if (source == "external") { + pll_source = 1; + } + else { + throw mpm::runtime_error("invalid LO source"); + } + + std::lock_guard<std::mutex> lock(*spi_mutex); + uint8_t retval = device.set_lo_source(dir, pll_source); + if (retval == 0){ + return "internal"; + } else if (retval == 1){ + return "external"; + }else{ + throw mpm::runtime_error("invalid return from set LO source"); + } + } + + virtual std::string get_lo_source(const std::string &which){ + auto dir = _get_direction_from_antenna(which); + + std::lock_guard<std::mutex> lock(*spi_mutex); + uint8_t retval = device.get_lo_source(dir); + if (retval == 0){ + return "internal"; + } else if (retval == 1){ + return "external"; + }else{ + throw mpm::runtime_error("invalid return from get LO source"); + } + } + virtual void start_jesd_rx() { std::lock_guard<std::mutex> lock(*spi_mutex); |