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:
parent
db419b17c7
commit
dd0ee20c1a
|
@ -61,6 +61,9 @@ Transceiver::Transceiver(int wBasePort,
|
||||||
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
|
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
|
||||||
sigProcLibSetup(mSamplesPerSymbol);
|
sigProcLibSetup(mSamplesPerSymbol);
|
||||||
|
|
||||||
|
txFullScale = mRadioInterface->fullScaleInputValue();
|
||||||
|
rxFullScale = mRadioInterface->fullScaleOutputValue();
|
||||||
|
|
||||||
// initialize filler tables with dummy bursts, initialize other per-timeslot variables
|
// initialize filler tables with dummy bursts, initialize other per-timeslot variables
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
signalVector* modBurst = modulateBurst(gDummyBurst,*gsmPulse,
|
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) {
|
else if (strcmp(command,"SETPOWER")==0) {
|
||||||
// set output power in dB
|
// set output power in dB
|
||||||
int dbPwr;
|
int dbPwr;
|
||||||
|
@ -492,6 +511,7 @@ void Transceiver::driveControl()
|
||||||
sprintf(response,"RSP SETPOWER 1 %d",dbPwr);
|
sprintf(response,"RSP SETPOWER 1 %d",dbPwr);
|
||||||
else {
|
else {
|
||||||
mPower = dbPwr;
|
mPower = dbPwr;
|
||||||
|
mRadioInterface->setPowerAttenuation(dbPwr);
|
||||||
sprintf(response,"RSP SETPOWER 0 %d",dbPwr);
|
sprintf(response,"RSP SETPOWER 0 %d",dbPwr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,8 @@ private:
|
||||||
GSM::Time mLastClockUpdateTime; ///< last time clock update was sent up to core
|
GSM::Time mLastClockUpdateTime; ///< last time clock update was sent up to core
|
||||||
|
|
||||||
RadioInterface *mRadioInterface; ///< associated radioInterface object
|
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*/
|
/** Codes for burst types of received bursts*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -72,6 +72,19 @@ RadioInterface::~RadioInterface(void) {
|
||||||
mReceiveFIFO.clear();
|
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)
|
short *RadioInterface::USRPifyVector(signalVector &wVector)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -276,6 +289,22 @@ bool RadioInterface::tuneRx(double freq)
|
||||||
return usrp->setRxFreq(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()
|
void RadioInterface::start()
|
||||||
{
|
{
|
||||||
LOG(INFO) << "starting radio interface...";
|
LOG(INFO) << "starting radio interface...";
|
||||||
|
|
|
@ -189,10 +189,11 @@ public:
|
||||||
/** set receive frequency */
|
/** set receive frequency */
|
||||||
bool tuneRx(double freq);
|
bool tuneRx(double freq);
|
||||||
|
|
||||||
/** set thread priority */
|
/** set receive gain */
|
||||||
void setPriority() { usrp->setPriority(); }
|
double setRxGain(double dB);
|
||||||
|
|
||||||
protected:
|
/** get receive gain */
|
||||||
|
double getRxGain(void);
|
||||||
|
|
||||||
/** drive transmission of GSM bursts */
|
/** drive transmission of GSM bursts */
|
||||||
void driveTransmitRadio();
|
void driveTransmitRadio();
|
||||||
|
@ -200,6 +201,19 @@ protected:
|
||||||
/** drive reception of GSM bursts */
|
/** drive reception of GSM bursts */
|
||||||
void driveReceiveRadio();
|
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 */
|
/** drive synchronization of Tx/Rx of USRP */
|
||||||
void alignRadio();
|
void alignRadio();
|
||||||
|
|
||||||
|
|
Reference in New Issue