diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-06-19 14:48:09 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-06-25 11:05:36 +0000 |
commit | f68f19b1101ea0bf25913cdb4c7c3d236f01a806 (patch) | |
tree | a1054e8f67954f2d415ba5f27dc5f665db9bcc82 /Transceiver52M/device/lms/LMSDevice.h | |
parent | 8ac169f7ed0e45ab630109a72c2ee039b49e2866 (diff) |
LMSDevice: Compute TxGain on LimeSuite API based on expected Tx output power
Right now, according to a few measurements taken on LimeMicro devices, we
expect the Tx Gain at UHD level to relate 1:1 with the slope in Tx output
power given a specific band.
If more fine-grained results are wanted or some device doesn't follow a
1:1 slope relationship, functions TxGain2TxPower and TxPower2TxGain need
to be adapted/improved.
This patch is basically doing the same thing as was done previously for
UHDDevice in 992c9bd1cea410e2dd42ce7566299104b5648aff.
Related: OS#4583
Change-Id: If154fe4d4cd118aa30ea43c22ee7119117b77da6
Diffstat (limited to 'Transceiver52M/device/lms/LMSDevice.h')
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h index c83fed2..b6a6ab9 100644 --- a/Transceiver52M/device/lms/LMSDevice.h +++ b/Transceiver52M/device/lms/LMSDevice.h @@ -32,6 +32,10 @@ #include <iostream> #include <lime/LimeSuite.h> +extern "C" { +#include <osmocom/gsm/gsm_utils.h> +} + /* Definition of LIMESDR_TX_AMPL limits maximum amplitude of I and Q * channels separately. Hence LIMESDR_TX_AMPL value must be 1/sqrt(2) = * 0.7071.... to get an amplitude of 1 of the complex signal: @@ -48,6 +52,8 @@ enum lms_dev_type { LMS_DEV_UNKNOWN, }; +struct dev_band_desc; + /** A class to handle a LimeSuite supported device */ class LMSDevice:public RadioDevice { @@ -66,6 +72,7 @@ private: TIMESTAMP ts_initial, ts_offset; std::vector<double> tx_gains, rx_gains; + enum gsm_band band; enum lms_dev_type m_dev_type; @@ -77,19 +84,11 @@ private: void update_stream_stats_rx(size_t chan, bool *overrun); void update_stream_stats_tx(size_t chan, bool *underrun); bool do_clock_src_freq(enum ReferenceType ref, double freq); - /** sets the transmit chan gain, returns the gain setting **/ - double setTxGain(double dB, size_t chan = 0); - - /** get transmit gain */ - double getTxGain(size_t chan = 0) { - return tx_gains[chan]; - } + void get_dev_band_desc(dev_band_desc& desc); - /** return maximum Tx Gain **/ - double maxTxGain(void); - - /** return minimum Rx Gain **/ - double minTxGain(void); + 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: @@ -178,6 +177,10 @@ public: /** 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 */ |