aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2014-04-16 20:02:06 -0400
committerThomas Tsou <tom@tsou.cc>2014-10-06 10:35:29 -0700
commitf31e4bb089453c18d42f998d8aa45b9c7947ff8a (patch)
tree6c4c77bc9b524d9599ad0dff19c821585ffd01b4
parent1189019c30c1208c95868cb6998f6b7af25d2c45 (diff)
Transceiver52M: Setup TRX mode for MS acquisition
On receipt of a SYNC command on the socket interface, set the mode to TRX_MODE_MS_ACQUIRE, which attempts to synchronize against a remote BTS signal by detecting the SCH burst and timing offset. The transceiver defaults to TRX_MODE_OFF, which implies no BTS or MS capability has been enabled. There is currently no command to enable the BTS mode. The MS mode also disables uplink transmission since no such capability is implemented. Signed-off-by: Thomas Tsou <tom@tsou.cc>
-rw-r--r--Transceiver52M/Transceiver.cpp44
-rw-r--r--Transceiver52M/Transceiver.h9
2 files changed, 42 insertions, 11 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index af10a7a..c6042eb 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -43,7 +43,8 @@ using namespace GSM;
#define NOISE_CNT 20
TransceiverState::TransceiverState()
- : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT)
+ : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT),
+ mode(Transceiver::TRX_MODE_OFF)
{
for (int i = 0; i < 8; i++) {
chanType[i] = Transceiver::NONE;
@@ -194,6 +195,9 @@ void Transceiver::addRadioVector(size_t chan, BitVector &bits,
return;
}
+ if (mStates[0].mode != TRX_MODE_BTS)
+ return;
+
burst = modulateBurst(bits, 8 + (wTime.TN() % 4 == 0), mSPSTx);
scaleVector(*burst, txFullScale * pow(10, -RSSI / 10));
@@ -496,9 +500,16 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
GSM::Time time = radio_burst->getTime();
CorrType type = expectedCorrType(time, chan);
- if ((type == OFF) || (type == IDLE)) {
- delete radio_burst;
- return NULL;
+ switch (state->mode) {
+ case TRX_MODE_MS_ACQUIRE:
+ type = SCH;
+ break;
+ case TRX_MODE_BTS:
+ if ((type == TSC) || (type == RACH))
+ break;
+ case TRX_MODE_OFF:
+ default:
+ goto release;
}
/* Select the diversity channel with highest energy */
@@ -513,8 +524,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
if (max_i < 0) {
LOG(ALERT) << "Received empty burst";
- delete radio_burst;
- return NULL;
+ goto release;
}
/* Average noise on diversity paths and update global levels */
@@ -525,13 +535,16 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
/* Detect normal or RACH bursts */
if (type == TSC)
success = detectTSC(state, *burst, amp, toa, time);
- else
+ else if (type == RACH)
success = detectRACH(state, *burst, amp, toa);
+ else if (type == SCH)
+ success = detectSCH(state, *burst, amp, toa);
+ else
+ success = false;
if (!success) {
state->mNoises.insert(avg);
- delete radio_burst;
- return NULL;
+ goto release;
}
/* Demodulate and set output info */
@@ -548,6 +561,10 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
delete radio_burst;
return bits;
+
+release:
+ delete bits;
+ return NULL;
}
void Transceiver::start()
@@ -733,7 +750,10 @@ void Transceiver::driveControl(size_t chan)
mStates[chan].chanType[timeslot] = (ChannelCombination) corrCode;
setModulus(timeslot, chan);
sprintf(response,"RSP SETSLOT 0 %d %d",timeslot,corrCode);
-
+ }
+ else if (!strcmp(command, "SYNC")) {
+ mStates[0].mode = TRX_MODE_MS_ACQUIRE;
+ sprintf(response,"RSP SYNC 0");
}
else {
LOG(WARNING) << "bogus command " << command << " on control interface.";
@@ -872,7 +892,9 @@ void Transceiver::driveTxFIFO()
}
}
// time to push burst to transmit FIFO
- pushRadioVector(mTransmitDeadlineClock);
+ if (mStates[0].mode == TRX_MODE_BTS)
+ pushRadioVector(mTransmitDeadlineClock);
+
mTransmitDeadlineClock.incTN();
}
}
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 8433406..c167519 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -81,6 +81,9 @@ struct TransceiverState {
/* Received noise energy levels */
float mNoiseLev;
noiseVector mNoises;
+
+ /* Transceiver mode */
+ int mode;
};
/** The Transceiver class, responsible for physical layer of basestation */
@@ -231,6 +234,12 @@ public:
LOOPBACK ///< similar go VII, used in loopback testing
} ChannelCombination;
+ enum {
+ TRX_MODE_OFF,
+ TRX_MODE_BTS,
+ TRX_MODE_MS_ACQUIRE,
+ };
+
protected:
/** drive lower receive I/O and burst generation */
void driveReceiveRadio();