From 2f09d69063196a2352262b1981d6de178ac10bd4 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Sat, 19 Mar 2016 21:16:22 +0300 Subject: transceiver: Properly handle MAXDLY. Previously MAXDLY value was applied to Normal Bursts, which was nice when working with sloppy test equipment like CMD57, but useless for real world usage. At the same time documentation and de facto usage of MAXDLY in OsmoBTS and OpenBTS assumed that it actually applies to Access Bursts (RACH). So this patch changes osmo-rx behavior to apply MAXDLY to RACH bursts and introduces a new command MAXDLYNB for the old behavior. --- Transceiver52M/Transceiver.cpp | 19 ++++++++++++++----- Transceiver52M/Transceiver.h | 3 ++- Transceiver52M/sigProcLib.cpp | 9 +++++---- Transceiver52M/sigProcLib.h | 4 +++- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 18e2927..43b62ff 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -119,7 +119,8 @@ Transceiver::Transceiver(int wBasePort, mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface), rssiOffset(wRssiOffset), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mOn(false), - mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0), mWriteBurstToDiskMask(0) + mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0), + mWriteBurstToDiskMask(0) { txFullScale = mRadioInterface->fullScaleInputValue(); rxFullScale = mRadioInterface->fullScaleOutputValue(); @@ -535,18 +536,19 @@ int Transceiver::detectBurst(TransceiverState *state, signalVector &burst, switch (type) { case EDGE: rc = detectEdgeBurst(burst, mTSC, threshold, mSPSRx, - amp, toa, mMaxExpectedDelay); + amp, toa, mMaxExpectedDelayNB); if (rc > 0) break; else type = TSC; case TSC: rc = analyzeTrafficBurst(burst, mTSC, threshold, mSPSRx, - amp, toa, mMaxExpectedDelay); + amp, toa, mMaxExpectedDelayNB); break; case RACH: threshold = 6.0; - rc = detectRACHBurst(burst, threshold, mSPSRx, amp, toa); + rc = detectRACHBurst(burst, threshold, mSPSRx, amp, toa, + mMaxExpectedDelayAB); break; default: LOG(ERR) << "Invalid correlation type"; @@ -753,9 +755,16 @@ void Transceiver::driveControl(size_t chan) //set expected maximum time-of-arrival int maxDelay; sscanf(buffer,"%3s %s %d",cmdcheck,command,&maxDelay); - mMaxExpectedDelay = maxDelay; // 1 GSM symbol is approx. 1 km + mMaxExpectedDelayAB = maxDelay; // 1 GSM symbol is approx. 1 km sprintf(response,"RSP SETMAXDLY 0 %d",maxDelay); } + else if (strcmp(command,"SETMAXDLYNB")==0) { + //set expected maximum time-of-arrival + int maxDelay; + sscanf(buffer,"%3s %s %d",cmdcheck,command,&maxDelay); + mMaxExpectedDelayNB = maxDelay; // 1 GSM symbol is approx. 1 km + sprintf(response,"RSP SETMAXDLYNB 0 %d",maxDelay); + } else if (strcmp(command,"SETRXGAIN")==0) { //set expected maximum time-of-arrival int newGain; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index b53a8b1..5c15109 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -227,7 +227,8 @@ private: double mTxFreq; ///< the transmit frequency double mRxFreq; ///< the receive frequency unsigned mTSC; ///< the midamble sequence code - unsigned mMaxExpectedDelay; ///< maximum expected time-of-arrival offset in GSM symbols + unsigned mMaxExpectedDelayAB; ///< maximum expected time-of-arrival offset in GSM symbols for Access Bursts (RACH) + unsigned mMaxExpectedDelayNB; ///< maximum expected time-of-arrival offset in GSM symbols for Normal Bursts unsigned mWriteBurstToDiskMask; ///< debug: bitmask to indicate which timeslots to dump to disk std::vector mStates; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index f3fa4f0..9674aa8 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1816,21 +1816,22 @@ int detectGeneralBurst(signalVector &rxBurst, * * Correlation window parameters: * target: Tail bits + RACH length (reduced from 41 to a multiple of 4) - * head: Search 4 symbols before target - * tail: Search 10 symbols after target + * head: Search 4 symbols before target + * tail: Search 4 symbols + maximum expected delay */ int detectRACHBurst(signalVector &rxBurst, float thresh, int sps, complex &, - float &toa) + float &toa, + unsigned maxTOA) { int rc, target, head, tail; CorrelationSequence *sync; target = 8 + 40; head = 4; - tail = 10; + tail = 4 + maxTOA; sync = gRACHSequence; rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 870eb1a..93251b5 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -192,13 +192,15 @@ bool energyDetect(signalVector &rxBurst, @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received RACH burst. @param TOA The estimate time-of-arrival of received RACH burst. + @param maxTOA The maximum expected time-of-arrival @return positive if threshold value is reached, negative on error, zero otherwise */ int detectRACHBurst(signalVector &rxBurst, float detectThreshold, int sps, complex &litude, - float &TOA); + float &TOA, + unsigned maxTOA); /** Normal burst correlator, detector, channel estimator. -- cgit v1.2.3