diff options
-rw-r--r-- | mpm/include/mpm/ad937x/ad937x_ctrl.hpp | 6 | ||||
-rw-r--r-- | mpm/lib/mykonos/ad937x_ctrl.cpp | 98 | ||||
-rw-r--r-- | mpm/lib/mykonos/ad937x_device.hpp | 1 | ||||
-rw-r--r-- | mpm/lib/mykonos/adi_ctrl.cpp | 5 |
4 files changed, 51 insertions, 59 deletions
diff --git a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp index 663424b06..10cbb0717 100644 --- a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp +++ b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp @@ -19,7 +19,6 @@ #include "mpm/spi/spi_lock.hpp" -// TODO: fix path of UHD includes #include <uhd/types/direction.hpp> #include <uhd/types/ranges.hpp> #include <uhd/exception.hpp> @@ -29,7 +28,6 @@ #include <memory> #include <functional> #include <set> -class ad937x_device; class ad937x_ctrl : public boost::noncopyable { @@ -63,10 +61,6 @@ public: virtual std::vector<int16_t> get_fir(const std::string &which, int8_t &gain) = 0; virtual int16_t get_temperature() = 0; - -protected: - static uhd::direction_t _get_direction_from_antenna(const std::string& antenna); - static std::set<size_t> _get_valid_fir_lengths(const std::string& which); }; #ifdef LIBMPM_PYTHON diff --git a/mpm/lib/mykonos/ad937x_ctrl.cpp b/mpm/lib/mykonos/ad937x_ctrl.cpp index 71cd251e8..047c8ba46 100644 --- a/mpm/lib/mykonos/ad937x_ctrl.cpp +++ b/mpm/lib/mykonos/ad937x_ctrl.cpp @@ -16,18 +16,65 @@ // #include "ad937x_device.hpp" -#include "mpm/mykonos/ad937x_ctrl.hpp" #include "adi/mykonos.h" +#include <mpm/mykonos/ad937x_ctrl.hpp> + #include <sstream> #include <set> #include <functional> +static uhd::direction_t _get_direction_from_antenna(const std::string& antenna) +{ + auto sub = antenna.substr(0, 2); + if (sub == "RX") { + return uhd::direction_t::RX_DIRECTION; + } + else if (sub == "TX") { + return uhd::direction_t::TX_DIRECTION; + } + else { + throw uhd::runtime_error("ad937x_ctrl got an invalid channel string."); + } + return uhd::direction_t::RX_DIRECTION; +} + +static ad937x_device::chain_t _get_chain_from_antenna(const std::string& antenna) +{ + auto sub = antenna.substr(2, 1); + if (sub == "1") { + return ad937x_device::chain_t::ONE; + } + else if (sub == "2") { + return ad937x_device::chain_t::TWO; + } + else { + throw uhd::runtime_error("ad937x_ctrl got an invalid channel string."); + } + return ad937x_device::chain_t::ONE; +} + +std::set<size_t> _get_valid_fir_lengths(const std::string& which) +{ + auto dir = _get_direction_from_antenna(which); + switch (dir) + { + case uhd::direction_t::RX_DIRECTION: + return{ 24, 48, 72 }; + case uhd::direction_t::TX_DIRECTION: + return{ 16, 32, 48, 64, 80, 96 }; + default: + UHD_THROW_INVALID_CODE_PATH(); + return std::set<size_t>(); + } +} + uhd::meta_range_t ad937x_ctrl::get_rf_freq_range(void) { return uhd::meta_range_t(ad937x_device::MIN_FREQ, ad937x_device::MAX_FREQ); } + uhd::meta_range_t ad937x_ctrl::get_bw_filter_range(void) { // TODO: fix @@ -55,36 +102,6 @@ uhd::meta_range_t ad937x_ctrl::get_gain_range(const std::string &which) } } -std::set<size_t> ad937x_ctrl::_get_valid_fir_lengths(const std::string& which) -{ - auto dir = _get_direction_from_antenna(which); - switch (dir) - { - case uhd::direction_t::RX_DIRECTION: - return { 24, 48, 72 }; - case uhd::direction_t::TX_DIRECTION: - return { 16, 32, 48, 64, 80, 96 }; - default: - UHD_THROW_INVALID_CODE_PATH(); - return std::set<size_t>(); - } -} - -uhd::direction_t ad937x_ctrl::_get_direction_from_antenna(const std::string& antenna) -{ - auto sub = antenna.substr(0, 2); - if (sub == "RX") { - return uhd::direction_t::RX_DIRECTION; - } - else if (sub == "TX") { - return uhd::direction_t::TX_DIRECTION; - } - else { - throw uhd::runtime_error("ad937x_ctrl got an invalid channel string."); - } - return uhd::direction_t::RX_DIRECTION; -} - class ad937x_ctrl_impl : public ad937x_ctrl { public: @@ -95,23 +112,6 @@ public: } - static ad937x_device::chain_t _get_chain_from_antenna(const std::string& antenna) - { - auto sub = antenna.substr(2, 1); - if (sub == "1") { - return ad937x_device::chain_t::ONE; - } - else if (sub == "2") { - return ad937x_device::chain_t::TWO; - } - else { - throw uhd::runtime_error("ad937x_ctrl got an invalid channel string."); - } - return ad937x_device::chain_t::ONE; - } - - - virtual uint8_t get_product_id() { std::lock_guard<spi_lock> lock(*spi_l); @@ -241,7 +241,7 @@ public: device.set_fir(dir, chain, gain, fir); } - std::vector<int16_t> get_fir(const std::string &which, int8_t &gain) + virtual std::vector<int16_t> get_fir(const std::string &which, int8_t &gain) { auto dir = _get_direction_from_antenna(which); auto chain = _get_chain_from_antenna(which); diff --git a/mpm/lib/mykonos/ad937x_device.hpp b/mpm/lib/mykonos/ad937x_device.hpp index 704c84e21..f3b192a01 100644 --- a/mpm/lib/mykonos/ad937x_device.hpp +++ b/mpm/lib/mykonos/ad937x_device.hpp @@ -23,7 +23,6 @@ #include "adi/t_mykonos_gpio.h" #include "mpm/spi/adi_ctrl.hpp" -// TODO: fix path of UHD includes #include <uhd/types/direction.hpp> #include <uhd/types/ranges.hpp> #include <uhd/exception.hpp> diff --git a/mpm/lib/mykonos/adi_ctrl.cpp b/mpm/lib/mykonos/adi_ctrl.cpp index fb781ea4c..287d17f5f 100644 --- a/mpm/lib/mykonos/adi_ctrl.cpp +++ b/mpm/lib/mykonos/adi_ctrl.cpp @@ -15,12 +15,11 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // - #include "adi/common.h" + #include <mpm/spi/adi_ctrl.hpp> +#include <uhd/exception.hpp> -// TODO: fix path of UHD includes -#include <../../host/include/uhd/exception.hpp> #include <iostream> #include <chrono> #include <thread> |