laforge
/
openbts-osmo
Archived
1
0
Fork 0

transceiver: enable adjustable gain settings on non-52MHz

Add gain and attenuation settings that were present
only in the 52MHz transceiver. This patch also
fixes SETRXGAIN failed warnings at startup.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This commit is contained in:
Thomas Tsou 2011-05-23 12:55:45 -07:00
parent db419b17c7
commit dd0ee20c1a
4 changed files with 68 additions and 3 deletions

View File

@ -61,6 +61,9 @@ Transceiver::Transceiver(int wBasePort,
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
sigProcLibSetup(mSamplesPerSymbol);
txFullScale = mRadioInterface->fullScaleInputValue();
rxFullScale = mRadioInterface->fullScaleOutputValue();
// initialize filler tables with dummy bursts, initialize other per-timeslot variables
for (int i = 0; i < 8; i++) {
signalVector* modBurst = modulateBurst(gDummyBurst,*gsmPulse,
@ -484,6 +487,22 @@ void Transceiver::driveControl()
}
}
}
else if (strcmp(command,"SETRXGAIN")==0) {
//set expected maximum time-of-arrival
int newGain;
sscanf(buffer,"%3s %s %d",cmdcheck,command,&newGain);
newGain = mRadioInterface->setRxGain(newGain);
sprintf(response,"RSP SETRXGAIN 0 %d",newGain);
}
else if (strcmp(command,"NOISELEV")==0) {
if (mOn) {
sprintf(response,"RSP NOISELEV 0 %d",
(int) round(20.0*log10(rxFullScale/mEnergyThreshold)));
}
else {
sprintf(response,"RSP NOISELEV 1 0");
}
}
else if (strcmp(command,"SETPOWER")==0) {
// set output power in dB
int dbPwr;
@ -492,6 +511,7 @@ void Transceiver::driveControl()
sprintf(response,"RSP SETPOWER 1 %d",dbPwr);
else {
mPower = dbPwr;
mRadioInterface->setPowerAttenuation(dbPwr);
sprintf(response,"RSP SETPOWER 0 %d",dbPwr);
}
}

View File

@ -68,6 +68,8 @@ private:
GSM::Time mLastClockUpdateTime; ///< last time clock update was sent up to core
RadioInterface *mRadioInterface; ///< associated radioInterface object
double txFullScale; ///< full scale input to radio
double rxFullScale; ///< full scale output to radio
/** Codes for burst types of received bursts*/
typedef enum {

View File

@ -72,6 +72,19 @@ RadioInterface::~RadioInterface(void) {
mReceiveFIFO.clear();
}
double RadioInterface::fullScaleInputValue(void) {
return usrp->fullScaleInputValue();
}
double RadioInterface::fullScaleOutputValue(void) {
return usrp->fullScaleOutputValue();
}
void RadioInterface::setPowerAttenuation(double atten)
{
usrp->setTxGain(usrp->maxTxGain() - atten);
}
short *RadioInterface::USRPifyVector(signalVector &wVector)
{
@ -276,6 +289,22 @@ bool RadioInterface::tuneRx(double freq)
return usrp->setRxFreq(freq);
}
double RadioInterface::setRxGain(double dB)
{
if (usrp)
return usrp->setRxGain(dB);
else
return -1;
}
double RadioInterface::getRxGain(void)
{
if (usrp)
return usrp->getRxGain();
else
return -1;
}
void RadioInterface::start()
{
LOG(INFO) << "starting radio interface...";

View File

@ -189,10 +189,11 @@ public:
/** set receive frequency */
bool tuneRx(double freq);
/** set thread priority */
void setPriority() { usrp->setPriority(); }
/** set receive gain */
double setRxGain(double dB);
protected:
/** get receive gain */
double getRxGain(void);
/** drive transmission of GSM bursts */
void driveTransmitRadio();
@ -200,6 +201,19 @@ protected:
/** drive reception of GSM bursts */
void driveReceiveRadio();
void setPowerAttenuation(double atten);
/** returns the full-scale transmit amplitude **/
double fullScaleInputValue();
/** returns the full-scale receive amplitude **/
double fullScaleOutputValue();
/** set thread priority */
void setPriority() { usrp->setPriority(); }
protected:
/** drive synchronization of Tx/Rx of USRP */
void alignRadio();