aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/Transceiver.cpp
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2013-08-20 16:10:01 -0400
committerThomas Tsou <tom@tsou.cc>2013-10-18 13:10:04 -0400
commit83e0689e76b0c00ab5d40d04063b7eb50677af64 (patch)
treef684a5e943e1c4b90b2fe6ae6d2e150bb89894d1 /Transceiver52M/Transceiver.cpp
parentd24cc2cd9647c56c0103490c3a0bfc1dd13d6cd2 (diff)
Transceiver52M: Make GSM pulse filter internal to implementation
There is no reason expose the pulse shaping filter outside of the signal processing calls. The main transceiver object makes no use of the filter and there's no reason to pass it around. Initialize the pulse shape with the signal processing library, and maintain an internal static member like many of the other library variables. Similarly destroy the object when the library is closed. Signed-off-by: Thomas Tsou <tom@tsou.cc>
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) {