aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/lib/mykonos/ad937x_ctrl.cpp
diff options
context:
space:
mode:
authorMark Meserve <mark.meserve@ni.com>2017-03-28 11:48:02 -0500
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:44 -0800
commit59d8fcaff2fcafd9b45adfaf5b25b6b42103f88e (patch)
tree7c3fe1716dba500845d9b547767746f6078ad42e /mpm/lib/mykonos/ad937x_ctrl.cpp
parent24f5eb8ba5fa1e49a54e813c11dc7768a0be58cf (diff)
downloaduhd-59d8fcaff2fcafd9b45adfaf5b25b6b42103f88e.tar.gz
uhd-59d8fcaff2fcafd9b45adfaf5b25b6b42103f88e.tar.bz2
uhd-59d8fcaff2fcafd9b45adfaf5b25b6b42103f88e.zip
ad9371: cleanup ctrl
remove device forward declaration make helper functions local to ad9371_ctrl.cpp fix UHD include paths
Diffstat (limited to 'mpm/lib/mykonos/ad937x_ctrl.cpp')
-rw-r--r--mpm/lib/mykonos/ad937x_ctrl.cpp98
1 files changed, 49 insertions, 49 deletions
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);