From f2bdd1a24ca4f512b0d90f7cac55f5246238b5ce Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Fri, 12 Jun 2015 00:15:31 -0400 Subject: transceiver: Add a debug option to dump selected timeslots to disk. --- Transceiver52M/Transceiver.cpp | 27 ++++++++++++++++++++++++++- Transceiver52M/Transceiver.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index f572987..8a53895 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -23,6 +23,7 @@ #include #include // std::setprecision +#include #include "Transceiver.h" #include @@ -151,7 +152,7 @@ Transceiver::Transceiver(int wBasePort, mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface), rssiOffset(wRssiOffset), mSPSTx(wSPS), mSPSRx(1), mChans(wChans), mOn(false), - mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0) + mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0), mWriteBurstToDiskMask(0) { txFullScale = mRadioInterface->fullScaleInputValue(); rxFullScale = mRadioInterface->fullScaleOutputValue(); @@ -616,6 +617,16 @@ SoftVector *Transceiver::demodulate(TransceiverState *state, return demodulateBurst(burst, mSPSRx, amp, toa); } +void writeToFile(radioVector *radio_burst, size_t chan) +{ + GSM::Time time = radio_burst->getTime(); + std::ostringstream fname; + fname << chan << "_" << time.FN() << "_" << time.TN() << ".fc"; + std::ofstream outfile (fname.str().c_str(), std::ofstream::binary); + outfile.write((char*)radio_burst->getVector()->begin(), radio_burst->getVector()->size() * 2 * sizeof(float)); + outfile.close(); +} + /* * Pull bursts from the FIFO and handle according to the slot * and burst correlation type. Equalzation is currently disabled. @@ -643,6 +654,12 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &i GSM::Time time = radio_burst->getTime(); CorrType type = expectedCorrType(time, chan); + /* Debug: dump bursts to disk */ + /* bits 0-7 - chan 0 timeslots + * bits 8-15 - chan 1 timeslots */ + if (mWriteBurstToDiskMask & ((1< mStates; -- cgit v1.2.3