diff options
-rw-r--r-- | Transceiver52M/device/common/radioDevice.h | 22 | ||||
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.h | 4 | ||||
-rw-r--r-- | Transceiver52M/device/uhd/UHDDevice.h | 4 | ||||
-rw-r--r-- | Transceiver52M/device/usrp1/USRPDevice.cpp | 31 | ||||
-rw-r--r-- | Transceiver52M/device/usrp1/USRPDevice.h | 9 |
5 files changed, 20 insertions, 50 deletions
diff --git a/Transceiver52M/device/common/radioDevice.h b/Transceiver52M/device/common/radioDevice.h index e51527d..cfe65da 100644 --- a/Transceiver52M/device/common/radioDevice.h +++ b/Transceiver52M/device/common/radioDevice.h @@ -151,17 +151,8 @@ class RadioDevice { virtual double getRxFreq(size_t chan = 0) = 0; virtual double getSampleRate()=0; - /* Default backward-compatible implementation based on TxGain APIs. New - implementations should be based on getNominalTxPower() once implemented for - the specific backend. */ - virtual double setPowerAttenuation(int atten, size_t chan) { - double rfGain; - rfGain = setTxGain(maxTxGain() - atten, chan); - return maxTxGain() - rfGain; - } - virtual double getPowerAttenuation(size_t chan=0) { - return maxTxGain() - getTxGain(chan); - } + virtual double setPowerAttenuation(int atten, size_t chan) = 0; + virtual double getPowerAttenuation(size_t chan=0) = 0; protected: size_t tx_sps, rx_sps; @@ -171,15 +162,6 @@ class RadioDevice { std::vector<std::string> tx_paths, rx_paths; std::vector<struct device_counters> m_ctr; - /** sets the transmit chan gain, returns the gain setting **/ - virtual double setTxGain(double dB, size_t chan = 0) = 0; - - /** get transmit gain */ - virtual double getTxGain(size_t chan = 0) = 0; - - /** return maximum Tx Gain **/ - virtual double maxTxGain(void) = 0; - RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t chan_num, double offset, const std::vector<std::string>& tx_paths, const std::vector<std::string>& rx_paths): diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h index b6a6ab9..7af09e2 100644 --- a/Transceiver52M/device/lms/LMSDevice.h +++ b/Transceiver52M/device/lms/LMSDevice.h @@ -86,10 +86,6 @@ private: bool do_clock_src_freq(enum ReferenceType ref, double freq); void get_dev_band_desc(dev_band_desc& desc); - double setTxGain(double db, size_t chan) {OSMO_ASSERT(false); return 0.0f; } - double getTxGain(size_t chan = 0) { OSMO_ASSERT(false); return 0.0f; }; - double maxTxGain(void) { OSMO_ASSERT(false); return 0.0f; }; - public: /** Object constructor */ diff --git a/Transceiver52M/device/uhd/UHDDevice.h b/Transceiver52M/device/uhd/UHDDevice.h index 2c428ca..22a0948 100644 --- a/Transceiver52M/device/uhd/UHDDevice.h +++ b/Transceiver52M/device/uhd/UHDDevice.h @@ -134,10 +134,6 @@ public: }; private: - double setTxGain(double db, size_t chan) {OSMO_ASSERT(false); return 0.0f; } - double getTxGain(size_t chan = 0) { OSMO_ASSERT(false); return 0.0f; }; - double maxTxGain(void) { OSMO_ASSERT(false); return 0.0f; }; - uhd::usrp::multi_usrp::sptr usrp_dev; uhd::tx_streamer::sptr tx_stream; uhd::rx_streamer::sptr rx_stream; diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp index 73117d2..5c40aa8 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.cpp +++ b/Transceiver52M/device/usrp1/USRPDevice.cpp @@ -205,8 +205,8 @@ bool USRPDevice::start() writeLock.unlock(); // Set gains to midpoint - setTxGain((minTxGain() + maxTxGain()) / 2); - setRxGain((minRxGain() + maxRxGain()) / 2); + setTxGain((m_dbTx->gain_min() + m_dbTx->gain_max()) / 2); + setRxGain((m_dbTx->gain_min() + m_dbTx->gain_max()) / 2); data = new short[currDataSize]; dataStart = 0; @@ -243,16 +243,6 @@ bool USRPDevice::stop() #endif } -double USRPDevice::maxTxGain() -{ - return m_dbTx->gain_max(); -} - -double USRPDevice::minTxGain() -{ - return m_dbTx->gain_min(); -} - double USRPDevice::maxRxGain() { return m_dbRx->gain_max(); @@ -271,10 +261,10 @@ double USRPDevice::setTxGain(double dB, size_t chan) } writeLock.lock(); - if (dB > maxTxGain()) - dB = maxTxGain(); - if (dB < minTxGain()) - dB = minTxGain(); + if (dB > m_dbTx->gain_max()) + dB = m_dbTx->gain_max(); + if (dB < m_dbTx->gain_min()) + dB = m_dbTx->gain_min(); LOGC(DDEV, NOTICE) << "Setting TX gain to " << dB << " dB."; @@ -314,6 +304,15 @@ double USRPDevice::setRxGain(double dB, size_t chan) return rxGain; } +double USRPDevice::setPowerAttenuation(int atten, size_t chan) { + double rfGain; + rfGain = setTxGain(m_dbTx->gain_max() - atten, chan); + return m_dbTx->gain_max() - rfGain; +} +double USRPDevice::getPowerAttenuation(size_t chan) { + return m_dbTx->gain_max() - getTxGain(chan); +} + int USRPDevice::getNominalTxPower(size_t chan) { /* TODO: return value based on some experimentally generated table depending on diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h index 1c1b3be..f761dc0 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.h +++ b/Transceiver52M/device/usrp1/USRPDevice.h @@ -91,12 +91,6 @@ private: /** get transmit gain */ double getTxGain(size_t chan = 0) { return txGain; } - /** return maximum Tx Gain **/ - double maxTxGain(void); - - /** return minimum Rx Gain **/ - double minTxGain(void); - #ifdef SWLOOPBACK short loopbackBuffer[1000000]; int loopbackBufferSize; @@ -180,6 +174,9 @@ private: /** return minimum Rx Gain **/ double minRxGain(void); + double setPowerAttenuation(int atten, size_t chan); + double getPowerAttenuation(size_t chan=0); + int getNominalTxPower(size_t chan = 0); /** sets the RX path to use, returns true if successful and false otherwise */ |