aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2016-03-19 21:16:22 +0300
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2016-03-19 21:16:22 +0300
commit83d2b7e034709376f7d98af7bbf5b0036f173220 (patch)
treeecb222a85fe38567c76c25b5bf8e49d5e1f19049
parent511a662394ff939ae6a8a8623515543199c3c69a (diff)
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.
-rw-r--r--Transceiver52M/Transceiver.cpp16
-rw-r--r--Transceiver52M/Transceiver.h3
-rw-r--r--Transceiver52M/sigProcLib.cpp9
-rw-r--r--Transceiver52M/sigProcLib.h4
4 files changed, 22 insertions, 10 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 526153e..959bb56 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -152,7 +152,8 @@ Transceiver::Transceiver(int wBasePort,
mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
rssiOffset(wRssiOffset),
mSPSTx(wSPS), mSPSRx(1), mChans(wChans), 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();
@@ -565,7 +566,7 @@ int Transceiver::detectRACH(TransceiverState *state,
{
float threshold = 6.0;
- return detectRACHBurst(burst, threshold, mSPSRx, amp, toa);
+ return detectRACHBurst(burst, threshold, mSPSRx, amp, toa, mMaxExpectedDelayAB);
}
/*
@@ -595,7 +596,7 @@ int Transceiver::detectTSC(TransceiverState *state, signalVector &burst,
/* Detect normal burst midambles */
success = analyzeTrafficBurst(burst, mTSC, threshold, mSPSRx, amp,
- toa, mMaxExpectedDelay, estimateChan,
+ toa, mMaxExpectedDelayNB, estimateChan,
&chanResp, &chanOffset);
if (success <= 0) {
return success;
@@ -829,9 +830,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 bd8ec4f..aa62439 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -232,7 +232,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<TransceiverState> mStates;
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index b5160ca..a19053c 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1446,21 +1446,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 &amp,
- 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 8685f2d..958698a 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -187,13 +187,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 &amplitude,
- float &TOA);
+ float &TOA,
+ unsigned maxTOA);
/**
Normal burst correlator, detector, channel estimator.