1 // 2 // Copyright 2017 Ettus Research, a National Instruments Company 3 // 4 // SPDX-License-Identifier: GPL-3.0-or-later 5 // 6 7 #pragma once 8 9 #include "../adi/t_mykonos.h" 10 #include "ad937x_fir.hpp" 11 #include <boost/noncopyable.hpp> 12 // Allocates and links the entire mykonos config struct in a single class 13 class ad937x_config_t : public boost::noncopyable 14 { 15 public: 16 ad937x_config_t(spiSettings_t* sps, const size_t deserializer_lane_xbar); 17 mykonosDevice_t* device; 18 19 ad937x_fir rx_fir_config; 20 ad937x_fir tx_fir_config; 21 22 static const size_t DEFAULT_TX_FIR_SIZE = 32; 23 static const size_t DEFAULT_RX_FIR_SIZE = 48; 24 25 static const int32_t DEFAULT_TX_FIR_GAIN = 6; 26 static const int32_t DEFAULT_RX_FIR_GAIN = -6; 27 28 static const int16_t DEFAULT_TX_FIR[DEFAULT_TX_FIR_SIZE]; 29 static const int16_t DEFAULT_TX_FIR_15366[DEFAULT_TX_FIR_SIZE]; 30 static const int16_t DEFAULT_RX_FIR[DEFAULT_RX_FIR_SIZE]; 31 static const int16_t DEFAULT_RX_FIR_15366[DEFAULT_RX_FIR_SIZE]; 32 static const int16_t DEFAULT_OBSRX_FIR[DEFAULT_RX_FIR_SIZE]; 33 static const int16_t DEFAULT_OBSRX_FIR_15366[DEFAULT_RX_FIR_SIZE]; 34 static const int16_t DEFAULT_SNIFFER_FIR[DEFAULT_RX_FIR_SIZE]; 35 static const int16_t DEFAULT_SNIFFER_FIR_15366[DEFAULT_RX_FIR_SIZE]; 36 37 private: 38 // The top level device struct is non-const and contains all other structs, so 39 // everything is "public" a user could technically modify the pointers in the structs, 40 // but we have no way of preventing that 41 mykonosDevice_t _device; 42 43 ad937x_fir _orx_fir_config; 44 ad937x_fir _sniffer_rx_fir_config; 45 46 // General structs 47 mykonosRxSettings_t _rx; 48 mykonosTxSettings_t _tx; 49 mykonosObsRxSettings_t _obsRx; 50 mykonosAuxIo_t _auxIo; 51 mykonosDigClocks_t _clocks; 52 53 // RX structs 54 mykonosRxProfile_t _rxProfile; 55 mykonosJesd204bFramerConfig_t _framer; 56 mykonosRxGainControl_t _rxGainCtrl; 57 mykonosAgcCfg_t _rxAgcCtrl; 58 mykonosPeakDetAgcCfg_t _rxPeakAgc; 59 mykonosPowerMeasAgcCfg_t _rxPowerAgc; 60 61 // TX structs 62 mykonosTxProfile_t _txProfile; 63 mykonosJesd204bDeframerConfig_t _deframer; 64 65 // ObsRX structs 66 mykonosRxProfile_t _orxProfile; 67 mykonosORxGainControl_t _orxGainCtrl; 68 mykonosAgcCfg_t _orxAgcCtrl; 69 mykonosPeakDetAgcCfg_t _orxPeakAgc; 70 mykonosPowerMeasAgcCfg_t _orxPowerAgc; 71 72 // Sniffer RX structs 73 mykonosRxProfile_t _snifferProfile; 74 mykonosSnifferGainControl_t _snifferGainCtrl; 75 mykonosJesd204bFramerConfig_t _orxFramer; 76 77 // GPIO structs 78 mykonosGpio3v3_t _gpio3v3; 79 mykonosGpioLowVoltage_t _gpio; 80 mykonosArmGpioConfig_t _armGpio; 81 82 // private initialization helper functions 83 void _init_pointers(); 84 }; 85