diff options
-rw-r--r-- | Transceiver52M/Transceiver.cpp | 59 | ||||
-rw-r--r-- | Transceiver52M/Transceiver.h | 8 | ||||
-rw-r--r-- | Transceiver52M/osmo-trx.cpp | 16 |
3 files changed, 60 insertions, 23 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index e5ab476..724fe8d 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -43,7 +43,7 @@ using namespace GSM; #define NOISE_CNT 20 TransceiverState::TransceiverState() - : mNoiseLev(0.0), mNoises(NOISE_CNT) + : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT) { for (int i = 0; i < 8; i++) { chanType[i] = Transceiver::NONE; @@ -69,10 +69,18 @@ TransceiverState::~TransceiverState() } } -void TransceiverState::init(size_t slot, signalVector *burst) +void TransceiverState::init(size_t slot, signalVector *burst, bool fill) { - for (int i = 0; i < 102; i++) - fillerTable[i][slot] = new signalVector(*burst); + signalVector *filler; + + for (int i = 0; i < 102; i++) { + if (fill) + filler = new signalVector(*burst); + else + filler = new signalVector(burst->size()); + + fillerTable[i][slot] = filler; + } } Transceiver::Transceiver(int wBasePort, @@ -112,7 +120,7 @@ Transceiver::~Transceiver() } } -bool Transceiver::init() +bool Transceiver::init(bool filler) { int d_srcport, d_dstport, c_srcport, c_dstport; signalVector *burst; @@ -158,7 +166,7 @@ bool Transceiver::init() for (size_t n = 0; n < 8; n++) { burst = modulateBurst(gDummyBurst, 8 + (n % 4 == 0), mSPSTx); scaleVector(*burst, txFullScale); - mStates[i].init(n, burst); + mStates[i].init(n, burst, filler && !i); delete burst; } } @@ -190,6 +198,19 @@ void Transceiver::addRadioVector(size_t chan, BitVector &bits, mTxPriorityQueues[chan].write(radio_burst); } +void Transceiver::updateFillerTable(size_t chan, radioVector *burst) +{ + int TN, modFN; + TransceiverState *state = &mStates[chan]; + + TN = burst->getTime().TN(); + modFN = burst->getTime().FN() % state->fillerModulus[TN]; + + delete state->fillerTable[modFN][TN]; + state->fillerTable[modFN][TN] = burst->getVector(); + burst->setVector(NULL); +} + void Transceiver::pushRadioVector(GSM::Time &nowTime) { int TN, modFN; @@ -197,19 +218,15 @@ void Transceiver::pushRadioVector(GSM::Time &nowTime) TransceiverState *state; std::vector<signalVector *> bursts(mChans); std::vector<bool> zeros(mChans); + std::vector<bool> filler(mChans, true); for (size_t i = 0; i < mChans; i ++) { state = &mStates[i]; while ((burst = mTxPriorityQueues[i].getStaleBurst(nowTime))) { LOG(NOTICE) << "dumping STALE burst in TRX->USRP interface"; - - TN = burst->getTime().TN(); - modFN = burst->getTime().FN() % state->fillerModulus[TN]; - - delete state->fillerTable[modFN][TN]; - state->fillerTable[modFN][TN] = burst->getVector(); - burst->setVector(NULL); + if (state->mRetrans) + updateFillerTable(i, burst); delete burst; } @@ -220,17 +237,25 @@ void Transceiver::pushRadioVector(GSM::Time &nowTime) zeros[i] = state->chanType[TN] == NONE; if ((burst = mTxPriorityQueues[i].getCurrentBurst(nowTime))) { - delete state->fillerTable[modFN][TN]; - state->fillerTable[modFN][TN] = burst->getVector(); bursts[i] = burst->getVector(); - burst->setVector(NULL); + + if (state->mRetrans) { + updateFillerTable(i, burst); + } else { + burst->setVector(NULL); + filler[i] = false; + } + delete burst; } } mRadioInterface->driveTransmitRadio(bursts, zeros); - return; + for (size_t i = 0; i < mChans; i++) { + if (!filler[i]) + delete bursts[i]; + } } void Transceiver::setModulus(size_t timeslot, size_t chan) diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index e6b9e12..df029a6 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -54,7 +54,7 @@ struct TransceiverState { ~TransceiverState(); /* Initialize a multiframe slot in the filler table */ - void init(size_t slot, signalVector *burst); + void init(size_t slot, signalVector *burst, bool fill); int chanType[8]; @@ -64,6 +64,7 @@ struct TransceiverState { /* The filler table */ signalVector *fillerTable[102][8]; int fillerModulus[8]; + bool mRetrans; /* Most recent channel estimate of all timeslots */ signalVector *chanResponse[8]; @@ -122,6 +123,9 @@ private: void addRadioVector(size_t chan, BitVector &bits, int RSSI, GSM::Time &wTime); + /** Update filler table */ + void updateFillerTable(size_t chan, radioVector *burst); + /** Push modulated burst into transmit FIFO corresponding to a particular timestamp */ void pushRadioVector(GSM::Time &nowTime); @@ -187,7 +191,7 @@ public: /** start the Transceiver */ void start(); - bool init(); + bool init(bool filler); /** attach the radioInterface receive FIFO */ bool receiveFIFO(VectorFIFO *wFIFO, size_t chan) diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 98112bb..bb2c489 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -66,6 +66,7 @@ struct trx_config { unsigned sps; unsigned chans; bool extref; + bool filler; bool diversity; }; @@ -116,7 +117,7 @@ bool testConfig() */ bool trx_setup_config(struct trx_config *config) { - std::string refstr, divstr; + std::string refstr, fillstr, divstr; if (!testConfig()) return false; @@ -163,6 +164,7 @@ bool trx_setup_config(struct trx_config *config) config->chans = 2; refstr = config->extref ? "Enabled" : "Disabled"; + fillstr = config->filler ? "Enabled" : "Disabled"; divstr = config->diversity ? "Enabled" : "Disabled"; std::ostringstream ost(""); @@ -174,6 +176,7 @@ bool trx_setup_config(struct trx_config *config) ost << " Channels................ " << config->chans << std::endl; ost << " Samples-per-Symbol...... " << config->sps << std::endl; ost << " External Reference...... " << refstr << std::endl; + ost << " C0 Filler Table......... " << fillstr << std::endl; ost << " Diversity............... " << divstr << std::endl; std::cout << ost << std::endl; @@ -231,7 +234,7 @@ Transceiver *makeTransceiver(struct trx_config *config, RadioInterface *radio) trx = new Transceiver(config->port, config->addr.c_str(), config->sps, config->chans, GSM::Time(3,0), radio); - if (!trx->init()) { + if (!trx->init(config->filler)) { LOG(ALERT) << "Failed to initialize transceiver"; delete trx; return NULL; @@ -279,7 +282,8 @@ static void print_help() " -d Enable dual channel diversity receiver\n" " -x Enable external 10 MHz reference\n" " -s Samples-per-symbol (1 or 4)\n" - " -c Number of ARFCN channels (default=1)\n", + " -c Number of ARFCN channels (default=1)\n" + " -f Enable C0 filler table\n", "EMERG, ALERT, CRT, ERR, WARNING, NOTICE, INFO, DEBUG"); } @@ -291,9 +295,10 @@ static void handle_options(int argc, char **argv, struct trx_config *config) config->sps = 0; config->chans = 0; config->extref = false; + config->filler = false; config->diversity = false; - while ((option = getopt(argc, argv, "ha:l:i:p:c:dxs:")) != -1) { + while ((option = getopt(argc, argv, "ha:l:i:p:c:dxfs:")) != -1) { switch (option) { case 'h': print_help(); @@ -320,6 +325,9 @@ static void handle_options(int argc, char **argv, struct trx_config *config) case 'x': config->extref = true; break; + case 'f': + config->filler = true; + break; case 's': config->sps = atoi(optarg); if ((config->sps != 1) && (config->sps != 4)) { |