aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/lib/mykonos/ad937x_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/lib/mykonos/ad937x_device.cpp')
-rw-r--r--mpm/lib/mykonos/ad937x_device.cpp88
1 files changed, 86 insertions, 2 deletions
diff --git a/mpm/lib/mykonos/ad937x_device.cpp b/mpm/lib/mykonos/ad937x_device.cpp
index 4b7addc80..1d4a80c48 100644
--- a/mpm/lib/mykonos/ad937x_device.cpp
+++ b/mpm/lib/mykonos/ad937x_device.cpp
@@ -19,6 +19,8 @@
#include "adi/mykonos.h"
#include "adi/mykonos_gpio.h"
#include "adi/mykonos_debug/mykonos_dbgjesd.h"
+#include "config/ad937x_config_t.hpp"
+#include "config/ad937x_default_config.hpp"
#include <boost/format.hpp>
#include <functional>
@@ -643,7 +645,6 @@ void ad937x_device::set_agc_mode(const direction_t direction, const gain_mode_t
void ad937x_device::set_fir(
const direction_t direction,
- const chain_t chain,
int8_t gain,
const std::vector<int16_t> & fir)
{
@@ -778,7 +779,6 @@ double ad937x_device::get_gain(const direction_t direction, const chain_t chain)
std::vector<int16_t> ad937x_device::get_fir(
const direction_t direction,
- const chain_t chain,
int8_t &gain)
{
switch (direction)
@@ -800,3 +800,87 @@ int16_t ad937x_device::get_temperature()
return status.tempCode;
}
+
+void ad937x_device::set_master_clock_rate(const double rate)
+{
+ if (rate == 125000000)
+ {
+ mykonos_config.device->clocks->deviceClock_kHz = 125000;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 10000000;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_2;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR,
+ ad937x_config_t::DEFAULT_TX_FIR + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 125000;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 20000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 102000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 722000;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 51000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR,
+ ad937x_config_t::DEFAULT_RX_FIR + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 125000;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 102000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 125000;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 102000;
+ } else if (rate == 122880000){
+ mykonos_config.device->clocks->deviceClock_kHz = 122880;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 9830400;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_2;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR,
+ ad937x_config_t::DEFAULT_TX_FIR + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 122880;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 20000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 100000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 710539;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 50000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR,
+ ad937x_config_t::DEFAULT_RX_FIR + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 122880;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 100000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 122880;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 100000;
+ } else if (rate == 153660000){
+ mykonos_config.device->clocks->deviceClock_kHz = 153600;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 6144000;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_1;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR_15366,
+ ad937x_config_t::DEFAULT_TX_FIR_15366 + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 153600;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 10000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 100000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 100000;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 100000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR_15366,
+ ad937x_config_t::DEFAULT_RX_FIR_15366 + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 153600;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 100000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 153600;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 225000;
+ } else {
+ MPM_THROW_INVALID_CODE_PATH();
+ }
+}