From 0b8aa00bc7b8233fad019fb92d63066b1be9b8e4 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Fri, 6 Sep 2013 00:35:57 +0400 Subject: conditional load testing (selected at compile time), turned on by default. --- Transceiver52M/DriveLoop.cpp | 8 ++++++++ Transceiver52M/Makefile.am | 3 ++- Transceiver52M/Transceiver.cpp | 18 +++++++++++++++++- Transceiver52M/sigProcLib.cpp | 9 ++++++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Transceiver52M/DriveLoop.cpp b/Transceiver52M/DriveLoop.cpp index b4541f6..ea79673 100644 --- a/Transceiver52M/DriveLoop.cpp +++ b/Transceiver52M/DriveLoop.cpp @@ -83,10 +83,14 @@ bool DriveLoop::init() scaleVector(*modBurst, txFullScale); for (int j = 0; j < 102; j++) { for (int n = 0; n < mChanM; n++) { +#ifndef TRX_LOAD_TESTING if (n == mC0) fillerTable[n][j][i] = new signalVector(*modBurst); else fillerTable[n][j][i] = new signalVector(modBurst->size()); +#else + fillerTable[n][j][i] = new signalVector(*modBurst); +#endif } } delete modBurst; @@ -129,7 +133,11 @@ void DriveLoop::pushRadioVector(GSM::Time &nowTime) mTxBursts[i] = fillerTable[i][modFN][TN]; mIsFiller[i] = true; +#ifndef TRX_LOAD_TESTING mIsZero[i] = (mChanType[i][TN] == NONE); +#else + mIsZero[i] = false; +#endif // if queue contains data at the desired timestamp, stick it into FIFO if (next = (radioVector*) mTransmitPriorityQueue[i].getCurrentBurst(nowTime)) { diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am index a7da44e..d54356e 100644 --- a/Transceiver52M/Makefile.am +++ b/Transceiver52M/Makefile.am @@ -21,9 +21,10 @@ include $(top_srcdir)/Makefile.common +LOAD_TEST_FLAGS = -DTRX_LOAD_TESTING AM_CFLAGS = $(STD_DEFINES_AND_INCLUDES) -std=gnu99 -march=native AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) -AM_CXXFLAGS = -ldl -lpthread +AM_CXXFLAGS = -ldl -lpthread $(LOAD_TEST_FLAGS) #UHD wins if both are defined if UHD diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 103c46c..b104aac 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -60,7 +60,11 @@ Transceiver::Transceiver(int wBasePort, const char *TRXAddress, mFIFOServiceLoopThread = NULL; mControlServiceLoopThread = NULL; mTransmitPriorityQueueServiceLoopThread = NULL; +#ifndef TRX_LOAD_TESTING mMaxExpectedDelay = 0; +#else + mMaxExpectedDelay = 10; +#endif mTransmitPriorityQueue = mDriveLoop->priorityQueue(mChannel); mReceiveFIFO = mRadioInterface->receiveFIFO(mChannel); @@ -131,11 +135,13 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, DriveLoop::CorrType corrType = mDriveLoop->expectedCorrType(mChannel, rxBurst->getTime()); +#ifndef TRX_LOAD_TESTING if ((corrType == DriveLoop::OFF) || (corrType == DriveLoop::IDLE)) { delete rxBurst; return NULL; } - +#endif + // check to see if received burst has sufficient signalVector *vectorBurst = rxBurst; complex amplitude = 0.0; @@ -152,8 +158,10 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, prevFalseDetectionTime = rxBurst->getTime(); } +#ifndef TRX_LOAD_TESTING delete rxBurst; return NULL; +#endif } LOG(DEBUG) << "Estimated Energy: " << sqrt(avgPwr) << ", at time " << rxBurst->getTime(); #endif @@ -186,6 +194,9 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, estimateChannel, &channelResp, &chanOffset); +#ifdef TRX_LOAD_TESTING + success = true; +#endif if (success) { LOG(DEBUG) << "FOUND TSC!!!!!! " << amplitude << " " << TOA; mEnergyThreshold -= 1.0F/10.0F; @@ -217,6 +228,9 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, mSPS, &litude, &TOA); +#ifdef TRX_LOAD_TESTING + success = true; +#endif if (success) { LOG(DEBUG) << "FOUND RACH!!!!!! " << amplitude << " " << TOA; mEnergyThreshold -= (1.0F/10.0F); @@ -396,7 +410,9 @@ void Transceiver::driveControl() //set expected maximum time-of-arrival int maxDelay; sscanf(buffer,"%3s %s %d",cmdcheck,command,&maxDelay); +#ifndef TRX_LOAD_TESTING mMaxExpectedDelay = maxDelay; // 1 GSM symbol is approx. 1 km +#endif sprintf(response,"RSP SETMAXDLY 0 %d",maxDelay); } else if (strcmp(command,"SETRXGAIN")==0) { diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index eaad898..be8b180 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1143,18 +1143,25 @@ static int detectBurst(signalVector &burst, /* Correlate */ if (!convolve(&burst, sync->sequence, &corr, CUSTOM, start, len, sps, 0)) { +#ifndef TRX_LOAD_TESTING return -1; +#endif } /* Peak detection - place restrictions at correlation edges */ *amp = fastPeakDetect(corr, toa); +#ifndef TRX_LOAD_TESTING if ((*toa < 3 * sps) || (*toa > len - 3 * sps)) return 0; +#endif /* Peak -to-average ratio */ - if (computePeakRatio(&corr, sps, *toa, *amp) < thresh) + if (computePeakRatio(&corr, sps, *toa, *amp) < thresh) { +#ifndef TRX_LOAD_TESTING return 0; +#endif + } /* Run the full peak detection when we have a burst */ *amp = peakDetect(corr, toa, NULL); -- cgit v1.2.3