diff options
author | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:05 +0000 |
---|---|---|
committer | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:05 +0000 |
commit | ee5347af4004831ed38781b52a62a84ed9d3a076 (patch) | |
tree | e71f3d9b4e034ec6efc539762b8d34e693c9c858 /Transceiver52M/radioInterface.cpp | |
parent | 495d3c8b0cf598ea31f941d1465ba371f73358f8 (diff) |
transceiver: reinsert digital gain scaling
Commit e161523c (transceiver: simplify transmit power control)
changed transmit gain control to RF setting only. This was
appropriate for a WBX board with 25 dB of gain control, but
inappropriate for an RFX with fixed transmit gain.
RFX boards will regain the ability to set transmit
attenuation. Since gain is set on the RF side first,
reintroducing digital gain settings should have limited
overall effect on non-RFX daughterboards.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2660 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'Transceiver52M/radioInterface.cpp')
-rw-r--r-- | Transceiver52M/radioInterface.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 3e654b1..1afa01b 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -84,6 +84,7 @@ RadioInterface::RadioInterface(RadioDevice *wRadio, samplesPerSymbol = wRadioOversampling; mClock.set(wStartTime); loadTest = false; + powerScaling = 1.0; } RadioInterface::~RadioInterface(void) { @@ -102,10 +103,21 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double atten) { - mRadio->setTxGain(mRadio->maxTxGain() - atten); + double rfAtten, digAtten; + + rfAtten = mRadio->setTxGain(mRadio->maxTxGain() - atten); + digAtten = atten - rfAtten; + + if (digAtten < 1.0) + powerScaling = 1.0; + else + powerScaling = 1.0/sqrt(pow(10, (digAtten/10.0))); } -short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, bool zeroOut) +short *RadioInterface::radioifyVector(signalVector &wVector, + short *retVector, + float scale, + bool zeroOut) { signalVector::iterator itr = wVector.begin(); short *shortItr = retVector; @@ -115,8 +127,13 @@ short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, b *shortItr++ = 0; itr++; } - } - else { + } else if (scale != 1.0) { + while (itr < wVector.end()) { + *shortItr++ = (short) (itr->real() * scale); + *shortItr++ = (short) (itr->imag() * scale); + itr++; + } + } else { while (itr < wVector.end()) { *shortItr++ = (short) (itr->real()); *shortItr++ = (short) (itr->imag()); @@ -237,7 +254,7 @@ void RadioInterface::driveTransmitRadio(signalVector &radioBurst, bool zeroBurst if (!mOn) return; - radioifyVector(radioBurst, sendBuffer+sendCursor, zeroBurst); + radioifyVector(radioBurst, sendBuffer+sendCursor, powerScaling, zeroBurst); sendCursor += (radioBurst.size()*2); |