aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/Transceiver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/Transceiver.cpp')
-rw-r--r--Transceiver52M/Transceiver.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index b60496a..a7c629e 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -57,15 +57,12 @@ Transceiver::Transceiver(int wBasePort,
mControlSocket(wBasePort+1,TRXAddress,wBasePort+101),
mClockSocket(wBasePort,TRXAddress,wBasePort+100)
{
- //GSM::Time startTime(0,0);
- //GSM::Time startTime(gHyperframe/2 - 4*216*60,0);
GSM::Time startTime(random() % gHyperframe,0);
mFIFOServiceLoopThread = new Thread(32768); ///< thread to push bursts into transmit FIFO
mControlServiceLoopThread = new Thread(32768); ///< thread to process control messages from GSM core
mTransmitPriorityQueueServiceLoopThread = new Thread(32768);///< thread to process transmit bursts from GSM core
-
mSPS = wSPS;
mRadioInterface = wRadioInterface;
mTransmitLatency = wTransmitLatency;
@@ -75,54 +72,65 @@ Transceiver::Transceiver(int wBasePort,
mRadioInterface->getClock()->set(startTime);
mMaxExpectedDelay = 0;
- // generate pulse and setup up signal processing library
- gsmPulse = generateGSMPulse(2, mSPS);
- LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
- sigProcLibSetup(mSPS);
-
txFullScale = mRadioInterface->fullScaleInputValue();
rxFullScale = mRadioInterface->fullScaleOutputValue();
- // initialize filler tables with dummy bursts, initialize other per-timeslot variables
+ mOn = false;
+ mTxFreq = 0.0;
+ mRxFreq = 0.0;
+ mPower = -10;
+ mEnergyThreshold = INIT_ENERGY_THRSHD;
+ prevFalseDetectionTime = startTime;
+
+}
+
+Transceiver::~Transceiver()
+{
+ sigProcLibDestroy();
+ mTransmitPriorityQueue.clear();
+}
+
+bool Transceiver::init()
+{
+ if (!sigProcLibSetup(mSPS)) {
+ LOG(ALERT) << "Failed to initialize signal processing library";
+ return false;
+ }
+
+ // initialize filler tables with dummy bursts
for (int i = 0; i < 8; i++) {
- signalVector* modBurst = modulateBurst(gDummyBurst,*gsmPulse,
+ signalVector* modBurst = modulateBurst(gDummyBurst,
8 + (i % 4 == 0),
mSPS);
+ if (!modBurst) {
+ sigProcLibDestroy();
+ LOG(ALERT) << "Failed to initialize filler table";
+ return false;
+ }
+
scaleVector(*modBurst,txFullScale);
fillerModulus[i]=26;
for (int j = 0; j < 102; j++) {
fillerTable[j][i] = new signalVector(*modBurst);
}
+
delete modBurst;
mChanType[i] = NONE;
channelResponse[i] = NULL;
DFEForward[i] = NULL;
DFEFeedback[i] = NULL;
- channelEstimateTime[i] = startTime;
+ channelEstimateTime[i] = mTransmitDeadlineClock;
}
- mOn = false;
- mTxFreq = 0.0;
- mRxFreq = 0.0;
- mPower = -10;
- mEnergyThreshold = INIT_ENERGY_THRSHD;
- prevFalseDetectionTime = startTime;
-}
-
-Transceiver::~Transceiver()
-{
- delete gsmPulse;
- sigProcLibDestroy();
- mTransmitPriorityQueue.clear();
+ return true;
}
-
void Transceiver::addRadioVector(BitVector &burst,
int RSSI,
GSM::Time &wTime)
{
// modulate and stick into queue
- signalVector* modBurst = modulateBurst(burst,*gsmPulse,
+ signalVector* modBurst = modulateBurst(burst,
8 + (wTime.TN() % 4 == 0),
mSPS);
scaleVector(*modBurst,txFullScale * pow(10,-RSSI/10));
@@ -135,10 +143,7 @@ void Transceiver::addRadioVector(BitVector &burst,
#ifdef TRANSMIT_LOGGING
void Transceiver::unModulateVector(signalVector wVector)
{
- SoftVector *burst = demodulateBurst(wVector,
- *gsmPulse,
- mSPS,
- 1.0,0.0);
+ SoftVector *burst = demodulateBurst(wVector, mSPS, 1.0, 0.0);
LOG(DEBUG) << "LOGGED BURST: " << *burst;
/*
@@ -415,7 +420,6 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
if ((rxBurst) && (success)) {
if ((corrType==RACH) || (!needDFE)) {
burst = demodulateBurst(*vectorBurst,
- *gsmPulse,
mSPS,
amplitude,TOA);
}
@@ -497,7 +501,7 @@ void Transceiver::driveControl()
// Prepare for thread start
mPower = -20;
mRadioInterface->start();
- generateRACHSequence(*gsmPulse, mSPS);
+ generateRACHSequence(mSPS);
// Start radio interface threads.
mFIFOServiceLoopThread->start((void * (*)(void*))FIFOServiceLoopAdapter,(void*) this);
@@ -589,8 +593,8 @@ void Transceiver::driveControl()
sprintf(response,"RSP SETTSC 1 %d",TSC);
else {
mTSC = TSC;
- generateMidamble(*gsmPulse, mSPS, TSC);
- sprintf(response,"RSP SETTSC 0 %d",TSC);
+ generateMidamble(mSPS, TSC);
+ sprintf(response,"RSP SETTSC 0 %d", TSC);
}
}
else if (strcmp(command,"SETSLOT")==0) {