aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2013-09-02 13:24:13 +0800
committerThomas Tsou <tom@tsou.cc>2013-09-02 13:27:11 +0800
commite01e1b3fa825cf7d80d5f0bb35062cb6db7cdc49 (patch)
tree2123a7ea2e4707c55e7c1a9aa890b75b6abac832
parentdbd27a60b6ed99fd6fd2339ffafccc0d759fa2fc (diff)
Transceiver52M: Rename samples-per-symbol variable names
Because repeatedly typing mSamplesPerSymbol is giving me carpal tunnel syndrome. Replace with the much shorter, easier to type, and just as clear name of 'sps'. Signed-off-by: Thomas Tsou <tom@tsou.cc>
-rw-r--r--Transceiver52M/DriveLoop.cpp10
-rw-r--r--Transceiver52M/DriveLoop.h6
-rw-r--r--Transceiver52M/Transceiver.cpp24
-rw-r--r--Transceiver52M/Transceiver.h6
-rw-r--r--Transceiver52M/radioInterface.cpp6
-rw-r--r--Transceiver52M/radioInterface.h6
-rw-r--r--Transceiver52M/sigProcLib.cpp98
-rw-r--r--Transceiver52M/sigProcLib.h35
-rw-r--r--Transceiver52M/sigProcLibTest.cpp22
9 files changed, 109 insertions, 104 deletions
diff --git a/Transceiver52M/DriveLoop.cpp b/Transceiver52M/DriveLoop.cpp
index f2e81c6..e50c5cd 100644
--- a/Transceiver52M/DriveLoop.cpp
+++ b/Transceiver52M/DriveLoop.cpp
@@ -29,13 +29,13 @@ using namespace GSM;
DriveLoop::DriveLoop(int wBasePort, const char *TRXAddress,
RadioInterface *wRadioInterface,
- int wChanM, int wC0, int wSamplesPerSymbol,
+ int wChanM, int wC0, int wSPS,
GSM::Time wTransmitLatency)
:mClockSocket(wBasePort, TRXAddress, wBasePort + 100), mC0(wC0)
{
mChanM = wChanM;
mRadioDriveLoopThread = NULL;
- mSamplesPerSymbol = wSamplesPerSymbol;
+ mSPS = wSPS;
mRadioInterface = wRadioInterface;
mStartTime = (random() % gHyperframe, 0);
@@ -48,16 +48,16 @@ DriveLoop::DriveLoop(int wBasePort, const char *TRXAddress,
mRadioInterface->getClock()->set(mStartTime);
// generate pulse and setup up signal processing library
- gsmPulse = generateGSMPulse(2, mSamplesPerSymbol);
+ gsmPulse = generateGSMPulse(2, mSPS);
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
- sigProcLibSetup(mSamplesPerSymbol);
+ sigProcLibSetup(mSPS);
txFullScale = mRadioInterface->fullScaleInputValue();
// initialize filler tables with dummy bursts on C0, empty bursts otherwise
for (int i = 0; i < 8; i++) {
signalVector* modBurst = modulateBurst(gDummyBurst, *gsmPulse,
- 8 + (i % 4 == 0), mSamplesPerSymbol);
+ 8 + (i % 4 == 0), mSPS);
scaleVector(*modBurst, txFullScale);
for (int j = 0; j < 102; j++) {
for (int n = 0; n < mChanM; n++) {
diff --git a/Transceiver52M/DriveLoop.h b/Transceiver52M/DriveLoop.h
index 7a2dfc3..0e7dc3c 100644
--- a/Transceiver52M/DriveLoop.h
+++ b/Transceiver52M/DriveLoop.h
@@ -81,7 +81,7 @@ private:
signalVector *gsmPulse; ///< the GSM shaping pulse for modulation
- int mSamplesPerSymbol; ///< number of samples per GSM symbol
+ int mSPS; ///< number of samples per GSM symbol
bool mOn; ///< flag to indicate that transceiver is powered on
int fillerModulus[CHAN_MAX][8]; ///< modulus values of all timeslots, in frames
@@ -99,14 +99,14 @@ public:
/** Transceiver constructor
@param wBasePort base port number of UDP sockets
@param TRXAddress IP address of the TRX manager, as a string
- @param wSamplesPerSymbol number of samples per GSM symbol
+ @param wSPS number of samples per GSM symbol
@param wTransmitLatency initial setting of transmit latency
@param radioInterface associated radioInterface object
*/
DriveLoop(int wBasePort, const char *TRXAddress,
RadioInterface *wRadioInterface,
int wChanM = 1, int wC0 = 0,
- int wSamplesPerSymbol = SAMPSPERSYM,
+ int wSPS = SAMPSPERSYM,
GSM::Time wTransmitLatency = GSM::Time(3, 0));
/** Destructor */
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 67f6822..055dd26 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -50,11 +50,11 @@ using namespace GSM;
Transceiver::Transceiver(int wBasePort, const char *TRXAddress,
DriveLoop *wDriveLoop, RadioInterface *wRadioInterface,
- int wSamplesPerSymbol, int wChannel, bool wPrimary)
+ int wSPS, int wChannel, bool wPrimary)
:mDataSocket(wBasePort+2,TRXAddress,wBasePort+102),
mControlSocket(wBasePort+1,TRXAddress,wBasePort+101),
mDriveLoop(wDriveLoop), mRadioInterface(wRadioInterface),
- mSamplesPerSymbol(wSamplesPerSymbol), mTransmitPriorityQueue(NULL),
+ mSPS(wSPS), mTransmitPriorityQueue(NULL),
mChannel(wChannel), mPrimary(wPrimary)
{
mFIFOServiceLoopThread = NULL;
@@ -63,7 +63,7 @@ Transceiver::Transceiver(int wBasePort, const char *TRXAddress,
mMaxExpectedDelay = 0;
// generate pulse and setup up signal processing library
- gsmPulse = generateGSMPulse(2,mSamplesPerSymbol);
+ gsmPulse = generateGSMPulse(2,mSPS);
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
mTransmitPriorityQueue = mDriveLoop->priorityQueue(mChannel);
@@ -109,7 +109,7 @@ void Transceiver::addRadioVector(BitVector &burst,
// modulate and stick into queue
signalVector* modBurst = modulateBurst(burst,*gsmPulse,
8 + (wTime.TN() % 4 == 0),
- mSamplesPerSymbol);
+ mSPS);
scaleVector(*modBurst,txFullScale * pow(10,-RSSI/10));
radioVector *newVec = new radioVector(*modBurst,wTime);
mTransmitPriorityQueue->write(newVec);
@@ -144,7 +144,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
float TOA = 0.0;
float avgPwr = 0.0;
- if (!energyDetect(*vectorBurst,20*mSamplesPerSymbol,mEnergyThreshold,&avgPwr)) {
+ if (!energyDetect(*vectorBurst,20*mSPS,mEnergyThreshold,&avgPwr)) {
LOG(DEBUG) << "Estimated Energy: " << sqrt(avgPwr) << ", at time " << rxBurst->getTime();
double framesElapsed = rxBurst->getTime()-prevFalseDetectionTime;
if (framesElapsed > 50) { // if we haven't had any false detections for a while, lower threshold
@@ -181,7 +181,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
success = analyzeTrafficBurst(*vectorBurst,
mTSC,
3.0,
- mSamplesPerSymbol,
+ mSPS,
&amplitude,
&TOA,
mMaxExpectedDelay,
@@ -216,7 +216,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
// RACH burst
success = detectRACHBurst(*vectorBurst,
5.0, // detection threshold
- mSamplesPerSymbol,
+ mSPS,
&amplitude,
&TOA);
if (success) {
@@ -239,21 +239,21 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
if ((corrType == DriveLoop::RACH) || (!needDFE)) {
burst = demodulateBurst(*vectorBurst,
*gsmPulse,
- mSamplesPerSymbol,
+ mSPS,
amplitude,TOA);
}
else { // TSC
scaleVector(*vectorBurst,complex(1.0,0.0)/amplitude);
burst = equalizeBurst(*vectorBurst,
TOA-chanRespOffset[timeslot],
- mSamplesPerSymbol,
+ mSPS,
*DFEForward[timeslot],
*DFEFeedback[timeslot]);
}
wTime = rxBurst->getTime();
RSSI = (int) floor(20.0*log10(rxFullScale/amplitude.abs()));
LOG(DEBUG) << "RSSI: " << RSSI;
- timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol);
+ timingOffset = (int) round(TOA*256.0/mSPS);
}
//if (burst) LOG(DEBUG) << "burst: " << *burst << '\n';
@@ -385,7 +385,7 @@ void Transceiver::driveControl()
mDriveLoop->start();
mDriveLoop->writeClockInterface();
- generateRACHSequence(*gsmPulse,mSamplesPerSymbol);
+ generateRACHSequence(*gsmPulse,mSPS);
// Start radio interface threads.
mOn = true;
@@ -477,7 +477,7 @@ void Transceiver::driveControl()
sprintf(response,"RSP SETTSC 1 %d",TSC);
else {
mTSC = TSC;
- generateMidamble(*gsmPulse,mSamplesPerSymbol,TSC);
+ generateMidamble(*gsmPulse,mSPS,TSC);
sprintf(response,"RSP SETTSC 0 %d",TSC);
}
}
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index c58ca8c..847a3c6 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -88,7 +88,7 @@ private:
signalVector *gsmPulse; ///< the GSM shaping pulse for modulation
- int mSamplesPerSymbol; ///< number of samples per GSM symbol
+ int mSPS; ///< number of samples per GSM symbol
bool mOn; ///< flag to indicate that transceiver is powered on
bool mRunning; ///< flag to indicate control loop is running
@@ -116,13 +116,13 @@ public:
/** Transceiver constructor
@param wBasePort base port number of UDP sockets
@param TRXAddress IP address of the TRX manager, as a string
- @param wSamplesPerSymbol number of samples per GSM symbol
+ @param wSPS number of samples per GSM symbol
@param wTransmitLatency initial setting of transmit latency
@param radioInterface associated radioInterface object
*/
Transceiver(int wBasePort, const char *TRXAddress,
DriveLoop *wDriveLoop, RadioInterface *wRadioInterface,
- int wSamplesPerSymbol = SAMPSPERSYM,
+ int wSPS = SAMPSPERSYM,
int wChannel = 0, bool wPrimary = true);
/** Destructor */
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index 719a8ff..15a6b28 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -55,7 +55,7 @@ RadioInterface::RadioInterface(RadioDevice *wRadio,
int wReceiveOffset,
GSM::Time wStartTime)
: mChanM(wChanM), underrun(false), sendCursor(0), rcvCursor(0), mOn(false),
- mRadio(wRadio), receiveOffset(wReceiveOffset), samplesPerSymbol(wSPS),
+ mRadio(wRadio), receiveOffset(wReceiveOffset), sps(wSPS),
powerScaling(1.0), loadTest(false)
{
mClock.set(wStartTime);
@@ -259,7 +259,7 @@ void RadioInterface::driveReceiveRadio()
int rcvSz = rcvCursor;
int readSz = 0;
const int symbolsPerSlot = gSlotLen + 8;
- int samplesPerBurst = (symbolsPerSlot + (tN % 4 == 0)) * samplesPerSymbol;
+ int samplesPerBurst = (symbolsPerSlot + (tN % 4 == 0)) * sps;
// while there's enough data in receive buffer, form received
// GSM bursts and pass up to Transceiver
@@ -276,7 +276,7 @@ void RadioInterface::driveReceiveRadio()
rcvSz -= samplesPerBurst;
tN = rcvClock.TN();
- samplesPerBurst = (symbolsPerSlot + (tN % 4 == 0)) * samplesPerSymbol;
+ samplesPerBurst = (symbolsPerSlot + (tN % 4 == 0)) * sps;
}
if (readSz > 0) {
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index 05ac299..624da02 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -56,7 +56,7 @@ protected:
RadioClock mClock; ///< the basestation clock!
- int samplesPerSymbol; ///< samples per GSM symbol
+ int sps; ///< samples per GSM symbol
int receiveOffset; ///< offset b/w transmit and receive GSM timestamps, in timeslots
bool mOn; ///< indicates radio is on
@@ -110,9 +110,9 @@ public:
/** destructor */
~RadioInterface();
- void setSamplesPerSymbol(int wSamplesPerSymbol) {if (!mOn) samplesPerSymbol = wSamplesPerSymbol;}
+ void setSamplesPerSymbol(int sps) {if (!mOn) this->sps = sps;}
- int getSamplesPerSymbol() { return samplesPerSymbol;}
+ int getSamplesPerSymbol() { return sps;}
/** return the receive FIFO */
VectorFIFO* receiveFIFO(int num) { return &mReceiveFIFO[num];}
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index cf72cae..b7f3511 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -216,22 +216,24 @@ void initTrigTables() {
}
}
-void initGMSKRotationTables(int samplesPerSymbol) {
- GMSKRotation = new signalVector(157*samplesPerSymbol);
- GMSKReverseRotation = new signalVector(157*samplesPerSymbol);
+void initGMSKRotationTables(int sps)
+{
+ GMSKRotation = new signalVector(157 * sps);
+ GMSKReverseRotation = new signalVector(157 * sps);
signalVector::iterator rotPtr = GMSKRotation->begin();
signalVector::iterator revPtr = GMSKReverseRotation->begin();
float phase = 0.0;
while (rotPtr != GMSKRotation->end()) {
*rotPtr++ = expjLookup(phase);
*revPtr++ = expjLookup(-phase);
- phase += M_PI_F/2.0F/(float) samplesPerSymbol;
+ phase += M_PI_F / 2.0F / (float) sps;
}
}
-void sigProcLibSetup(int samplesPerSymbol) {
+void sigProcLibSetup(int sps)
+{
initTrigTables();
- initGMSKRotationTables(samplesPerSymbol);
+ initGMSKRotationTables(sps);
}
void GMSKRotate(signalVector &x) {
@@ -437,20 +439,19 @@ signalVector* convolve(const signalVector *a,
}
-signalVector* generateGSMPulse(int symbolLength,
- int samplesPerSymbol)
+signalVector* generateGSMPulse(int sps, int symbolLength)
{
- int numSamples = samplesPerSymbol*symbolLength + 1;
+ int numSamples = sps * symbolLength + 1;
signalVector *x = new signalVector(numSamples);
signalVector::iterator xP = x->begin();
int centerPoint = (numSamples-1)/2;
for (int i = 0; i < numSamples; i++) {
- float arg = (float) (i-centerPoint)/(float) samplesPerSymbol;
+ float arg = (float) (i - centerPoint) / (float) sps;
*xP++ = 0.96*exp(-1.1380*arg*arg-0.527*arg*arg*arg*arg); // GSM pulse approx.
}
- float avgAbsval = sqrtf(vectorNorm2(*x)/samplesPerSymbol);
+ float avgAbsval = sqrtf(vectorNorm2(*x) / sps);
xP = x->begin();
for (int i = 0; i < numSamples; i++)
*xP++ /= avgAbsval;
@@ -566,12 +567,12 @@ bool vectorSlicer(signalVector *x)
signalVector *modulateBurst(const BitVector &wBurst,
const signalVector &gsmPulse,
int guardPeriodLength,
- int samplesPerSymbol)
+ int sps)
{
//static complex staticBurst[157];
- int burstSize = samplesPerSymbol*(wBurst.size()+guardPeriodLength);
+ int burstSize = sps * (wBurst.size() + guardPeriodLength);
//signalVector modBurst((complex *) staticBurst,0,burstSize);
signalVector modBurst(burstSize);// = new signalVector(burstSize);
modBurst.isRealOnly(true);
@@ -584,7 +585,7 @@ signalVector *modulateBurst(const BitVector &wBurst,
*modBurstItr = 2.0*(wBurst[0] & 0x01)-1.0;
signalVector::iterator prevVal = modBurstItr;
for (unsigned int i = 1; i < wBurst.size(); i++) {
- modBurstItr += samplesPerSymbol;
+ modBurstItr += sps;
if (wBurst[i] & 0x01)
*modBurstItr = *prevVal * complex(0.0,1.0);
else
@@ -595,7 +596,7 @@ signalVector *modulateBurst(const BitVector &wBurst,
// if wBurst are the raw bits
for (unsigned int i = 0; i < wBurst.size(); i++) {
*modBurstItr = 2.0*(wBurst[i] & 0x01)-1.0;
- modBurstItr += samplesPerSymbol;
+ modBurstItr += sps;
}
// shift up pi/2
@@ -837,7 +838,7 @@ void offsetVector(signalVector &x,
}
bool generateMidamble(signalVector &gsmPulse,
- int samplesPerSymbol,
+ int sps,
int TSC)
{
@@ -856,11 +857,11 @@ bool generateMidamble(signalVector &gsmPulse,
signalVector *middleMidamble = modulateBurst(gTrainingSequence[TSC].segment(5,16),
emptyPulse,
0,
- samplesPerSymbol);
+ sps);
signalVector *midamble = modulateBurst(gTrainingSequence[TSC],
gsmPulse,
0,
- samplesPerSymbol);
+ sps);
if (midamble == NULL) return false;
if (middleMidamble == NULL) return false;
@@ -886,7 +887,7 @@ bool generateMidamble(signalVector &gsmPulse,
LOG(DEBUG) << "TOA: " << gMidambles[TSC]->TOA;
- //gMidambles[TSC]->TOA -= 5*samplesPerSymbol;
+ //gMidambles[TSC]->TOA -= 5*sps;
delete autocorr;
delete midamble;
@@ -895,7 +896,7 @@ bool generateMidamble(signalVector &gsmPulse,
}
bool generateRACHSequence(signalVector &gsmPulse,
- int samplesPerSymbol)
+ int sps)
{
if (gRACHSequence) {
@@ -906,7 +907,7 @@ bool generateRACHSequence(signalVector &gsmPulse,
signalVector *RACHSeq = modulateBurst(gRACHSynchSequence,
gsmPulse,
0,
- samplesPerSymbol);
+ sps);
assert(RACHSeq);
@@ -928,7 +929,7 @@ bool generateRACHSequence(signalVector &gsmPulse,
bool detectRACHBurst(signalVector &rxBurst,
float detectThreshold,
- int samplesPerSymbol,
+ int sps,
complex *amplitude,
float* TOA)
{
@@ -954,7 +955,7 @@ bool detectRACHBurst(signalVector &rxBurst,
LOG(DEBUG) << "RACH corr: " << correlatedRACH;
float numSamples = 0.0;
- for (int i = 57*samplesPerSymbol; i <= 107*samplesPerSymbol;i++) {
+ for (int i = 57 * sps; i <= 107 * sps; i++) {
if (peakPtr+i >= correlatedRACH.end())
break;
valleyPower += (peakPtr+i)->norm2();
@@ -972,7 +973,7 @@ bool detectRACHBurst(signalVector &rxBurst,
LOG(DEBUG) << "RACH peakAmpl=" << peakAmpl << " RMS=" << RMS << " peakToMean=" << peakToMean;
*amplitude = peakAmpl/(gRACHSequence->gain);
- *TOA = (*TOA) - gRACHSequence->TOA - 8*samplesPerSymbol;
+ *TOA = (*TOA) - gRACHSequence->TOA - 8 * sps;
LOG(DEBUG) << "RACH thresh: " << peakToMean;
@@ -1002,7 +1003,7 @@ bool energyDetect(signalVector &rxBurst,
bool analyzeTrafficBurst(signalVector &rxBurst,
unsigned TSC,
float detectThreshold,
- int samplesPerSymbol,
+ int sps,
complex *amplitude,
float *TOA,
unsigned maxTOA,
@@ -1016,12 +1017,12 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
assert(TOA);
assert(gMidambles[TSC]);
- if (maxTOA < 3*samplesPerSymbol) maxTOA = 3*samplesPerSymbol;
+ if (maxTOA < 3*sps) maxTOA = 3*sps;
unsigned spanTOA = maxTOA;
- if (spanTOA < 5*samplesPerSymbol) spanTOA = 5*samplesPerSymbol;
+ if (spanTOA < 5*sps) spanTOA = 5*sps;
- unsigned startIx = 66*samplesPerSymbol-spanTOA;
- unsigned endIx = (66+16)*samplesPerSymbol+spanTOA;
+ unsigned startIx = 66*sps-spanTOA;
+ unsigned endIx = (66+16)*sps+spanTOA;
unsigned windowLen = endIx - startIx;
unsigned corrLen = 2*maxTOA+1;
@@ -1048,7 +1049,7 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
}
int numRms = 0;
- for (int i = 2*samplesPerSymbol; i <= 5*samplesPerSymbol;i++) {
+ for (int i = 2*sps; i <= 5*sps;i++) {
if (peakPtr - i >= correlatedBurst.begin()) {
valleyPower += (peakPtr-i)->norm2();
numRms++;
@@ -1081,30 +1082,36 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
LOG(DEBUG) << "autocorr: " << correlatedBurst;
if (requestChannel && (peakToMean > detectThreshold)) {
- float TOAoffset = maxTOA; //gMidambles[TSC]->TOA+(66*samplesPerSymbol-startIx);
+ float TOAoffset = maxTOA;
delayVector(correlatedBurst,-(*TOA));
// midamble only allows estimation of a 6-tap channel
- signalVector channelVector(6*samplesPerSymbol);
+ signalVector chanVector(6 * sps);
float maxEnergy = -1.0;
int maxI = -1;
for (int i = 0; i < 7; i++) {
- if (TOAoffset+(i-5)*samplesPerSymbol + channelVector.size() > correlatedBurst.size()) continue;
- if (TOAoffset+(i-5)*samplesPerSymbol < 0) continue;
- correlatedBurst.segmentCopyTo(channelVector,(int) floor(TOAoffset+(i-5)*samplesPerSymbol),channelVector.size());
- float energy = vectorNorm2(channelVector);
+ if (TOAoffset + (i-5) * sps + chanVector.size() > correlatedBurst.size())
+ continue;
+ if (TOAoffset + (i-5) * sps < 0)
+ continue;
+ correlatedBurst.segmentCopyTo(chanVector,
+ (int) floor(TOAoffset + (i - 5) * sps),
+ chanVector.size());
+ float energy = vectorNorm2(chanVector);
if (energy > 0.95*maxEnergy) {
maxI = i;
maxEnergy = energy;
}
}
- *channelResponse = new signalVector(channelVector.size());
- correlatedBurst.segmentCopyTo(**channelResponse,(int) floor(TOAoffset+(maxI-5)*samplesPerSymbol),(*channelResponse)->size());
- scaleVector(**channelResponse,complex(1.0,0.0)/gMidambles[TSC]->gain);
+ *channelResponse = new signalVector(chanVector.size());
+ correlatedBurst.segmentCopyTo(**channelResponse,
+ (int) floor(TOAoffset + (maxI - 5) * sps),
+ (*channelResponse)->size());
+ scaleVector(**channelResponse, complex(1.0, 0.0) / gMidambles[TSC]->gain);
LOG(DEBUG) << "channelResponse: " << **channelResponse;
if (channelResponseOffset)
- *channelResponseOffset = 5*samplesPerSymbol-maxI;
+ *channelResponseOffset = 5 * sps - maxI;
}
@@ -1131,7 +1138,7 @@ signalVector *decimateVector(signalVector &wVector,
SoftVector *demodulateBurst(signalVector &rxBurst,
const signalVector &gsmPulse,
- int samplesPerSymbol,
+ int sps,
complex channel,
float TOA)
@@ -1146,8 +1153,8 @@ SoftVector *demodulateBurst(signalVector &rxBurst,
GMSKReverseRotate(*shapedBurst);
// run through slicer
- if (samplesPerSymbol > 1) {
- signalVector *decShapedBurst = decimateVector(*shapedBurst,samplesPerSymbol);
+ if (sps > 1) {
+ signalVector *decShapedBurst = decimateVector(*shapedBurst, sps);
shapedBurst = decShapedBurst;
}
@@ -1162,7 +1169,8 @@ SoftVector *demodulateBurst(signalVector &rxBurst,
for (; shapedItr < shapedBurst->end(); shapedItr++)
*burstItr++ = shapedItr->real();
- if (samplesPerSymbol > 1) delete shapedBurst;
+ if (sps > 1)
+ delete shapedBurst;
return burstBits;
@@ -1456,7 +1464,7 @@ bool designDFE(signalVector &channelResponse,
// Assumes symbol-rate sampling!!!!
SoftVector *equalizeBurst(signalVector &rxBurst,
float TOA,
- int samplesPerSymbol,
+ int sps,
signalVector &w, // feedforward filter
signalVector &b) // feedback filter
{
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index 8e8c48f..e91644c 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -100,7 +100,7 @@ float vectorNorm2(const signalVector &x);
float vectorPower(const signalVector &x);
/** Setup the signal processing library */
-void sigProcLibSetup(int samplesPerSymbol);
+void sigProcLibSetup(int sps);
/** Destroy the signal processing library */
void sigProcLibDestroy(void);
@@ -121,12 +121,11 @@ signalVector* convolve(const signalVector *a,
/**
Generate the GSM pulse.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@param symbolLength The size of the pulse.
@return The GSM pulse.
*/
-signalVector* generateGSMPulse(int samplesPerSymbol,
- int symbolLength);
+signalVector* generateGSMPulse(int sps, int symbolLength);
/**
Frequency shift a vector.
@@ -165,7 +164,7 @@ bool vectorSlicer(signalVector *x);
signalVector *modulateBurst(const BitVector &wBurst,
const signalVector &gsmPulse,
int guardPeriodLength,
- int samplesPerSymbol);
+ int sps);
/** Sinc function */
float sinc(float x);
@@ -226,21 +225,19 @@ void offsetVector(signalVector &x,
/**
Generate a modulated GSM midamble, stored within the library.
@param gsmPulse The GSM pulse used for modulation.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@param TSC The training sequence [0..7]
@return Success.
*/
-bool generateMidamble(signalVector &gsmPulse,
- int samplesPerSymbol,
- int TSC);
+bool generateMidamble(signalVector &gsmPulse, int sps, int tsc);
/**
Generate a modulated RACH sequence, stored within the library.
@param gsmPulse The GSM pulse used for modulation.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@return Success.
*/
bool generateRACHSequence(signalVector &gsmPulse,
- int samplesPerSymbol);
+ int sps);
/**
Energy detector, checks to see if received burst energy is above a threshold.
@@ -259,14 +256,14 @@ bool energyDetect(signalVector &rxBurst,
RACH correlator/detector.
@param rxBurst The received GSM burst of interest.
@param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @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.
@return True if burst SNR is larger that the detectThreshold value.
*/
bool detectRACHBurst(signalVector &rxBurst,
float detectThreshold,
- int samplesPerSymbol,
+ int sps,
complex *amplitude,
float* TOA);
@@ -275,7 +272,7 @@ bool detectRACHBurst(signalVector &rxBurst,
@param rxBurst The received GSM burst of interest.
@param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@param amplitude The estimated amplitude of received TSC burst.
@param TOA The estimate time-of-arrival of received TSC burst.
@param maxTOA The maximum expected time-of-arrival
@@ -287,7 +284,7 @@ bool detectRACHBurst(signalVector &rxBurst,
bool analyzeTrafficBurst(signalVector &rxBurst,
unsigned TSC,
float detectThreshold,
- int samplesPerSymbol,
+ int sps,
complex *amplitude,
float *TOA,
unsigned maxTOA,
@@ -308,14 +305,14 @@ signalVector *decimateVector(signalVector &wVector,
Demodulates a received burst using a soft-slicer.
@param rxBurst The burst to be demodulated.
@param gsmPulse The GSM pulse.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@param channel The amplitude estimate of the received burst.
@param TOA The time-of-arrival of the received burst.
@return The demodulated bit sequence.
*/
SoftVector *demodulateBurst(signalVector &rxBurst,
const signalVector &gsmPulse,
- int samplesPerSymbol,
+ int sps,
complex channel,
float TOA);
@@ -372,14 +369,14 @@ bool designDFE(signalVector &channelResponse,
Equalize/demodulate a received burst via a decision-feedback equalizer.
@param rxBurst The received burst to be demodulated.
@param TOA The time-of-arrival of the received burst.
- @param samplesPerSymbol The number of samples per GSM symbol.
+ @param sps The number of samples per GSM symbol.
@param w The feed forward filter of the DFE.
@param b The feedback filter of the DFE.
@return The demodulated bit sequence.
*/
SoftVector *equalizeBurst(signalVector &rxBurst,
float TOA,
- int samplesPerSymbol,
+ int sps,
signalVector &w,
signalVector &b);
diff --git a/Transceiver52M/sigProcLibTest.cpp b/Transceiver52M/sigProcLibTest.cpp
index 4f92717..f673fcd 100644
--- a/Transceiver52M/sigProcLibTest.cpp
+++ b/Transceiver52M/sigProcLibTest.cpp
@@ -44,13 +44,13 @@ int main(int argc, char **argv) {
gLogInit("sigProcLibTest","DEBUG");
- int samplesPerSymbol = 1;
+ int sps = 1;
int TSC = 2;
- sigProcLibSetup(samplesPerSymbol);
+ sigProcLibSetup(sps);
- signalVector *gsmPulse = generateGSMPulse(2,samplesPerSymbol);
+ signalVector *gsmPulse = generateGSMPulse(2,sps);
cout << *gsmPulse << endl;
BitVector RACHBurstStart = "01010101";
@@ -62,12 +62,12 @@ int main(int argc, char **argv) {
signalVector *RACHSeq = modulateBurst(RACHBurst,
*gsmPulse,
9,
- samplesPerSymbol);
+ sps);
- generateRACHSequence(*gsmPulse,samplesPerSymbol);
+ generateRACHSequence(*gsmPulse,sps);
complex a; float t;
- detectRACHBurst(*RACHSeq, 5, samplesPerSymbol,&a,&t);
+ detectRACHBurst(*RACHSeq, 5, sps,&a,&t);
//cout << *RACHSeq << endl;
//signalVector *autocorr = correlate(RACHSeq,RACHSeq,NULL,NO_DELAY);
@@ -95,11 +95,11 @@ int main(int argc, char **argv) {
BitVector normalBurst(BitVector(normalBurstSeg,gTrainingSequence[TSC]),normalBurstSeg);
- generateMidamble(*gsmPulse,samplesPerSymbol,TSC);
+ generateMidamble(*gsmPulse,sps,TSC);
signalVector *modBurst = modulateBurst(normalBurst,*gsmPulse,
- 0,samplesPerSymbol);
+ 0,sps);
//delayVector(*rsVector2,6.932);
@@ -127,13 +127,13 @@ int main(int argc, char **argv) {
signalVector *noise = gaussianNoise(modBurst->size(),noisePwr);
*/
float chanRespOffset;
- analyzeTrafficBurst(*modBurst,TSC,8.0,samplesPerSymbol,&ampl,&TOA,1,true,&chanResp,&chanRespOffset);
+ analyzeTrafficBurst(*modBurst,TSC,8.0,sps,&ampl,&TOA,1,true,&chanResp,&chanRespOffset);
//addVector(*modBurst,*noise);
cout << "ampl:" << ampl << endl;
cout << "TOA: " << TOA << endl;
//cout << "chanResp: " << *chanResp << endl;
- SoftVector *demodBurst = demodulateBurst(*modBurst,*gsmPulse,samplesPerSymbol,(complex) ampl, TOA);
+ SoftVector *demodBurst = demodulateBurst(*modBurst,*gsmPulse,sps,(complex) ampl, TOA);
cout << *demodBurst << endl;
@@ -146,7 +146,7 @@ int main(int argc, char **argv) {
COUT("b: " << *b);
- SoftSig *DFEBurst = equalizeBurst(*modBurst,TOA-chanRespOffset,samplesPerSymbol,*w,*b);
+ SoftSig *DFEBurst = equalizeBurst(*modBurst,TOA-chanRespOffset,sps,*w,*b);
COUT("DFEBurst: " << *DFEBurst);
delete gsmPulse;