egprs: Enable 8-PSK burst detection when EDGE is enabled

The command line EDGE option will enable 8-PSK burst
detection on any slot where a normal burst is expected.
The burst search order is 8-PSK first followed by GMSK.

EDGE will force 4 SPS sampling on Tx and Rx. Along with
twice the search correlation from 8-PSK and GMSK, EDGE
will increase CPU utilization. Whether the increase is
notable or not is dependent on the particular machine.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index aafeaba..a1d0f49 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -130,7 +130,7 @@
     mClockSocket(wBasePort, wTRXAddress, mBasePort + 100),
     mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
     rssiOffset(wRssiOffset),
-    mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mOn(false),
+    mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false),
     mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0),
     mWriteBurstToDiskMask(0)
 {
@@ -169,7 +169,7 @@
  * are still expected to report clock indications through control channel
  * activity.
  */
-bool Transceiver::init(int filler, size_t rtsc, unsigned rach_delay)
+bool Transceiver::init(int filler, size_t rtsc, unsigned rach_delay, bool edge)
 {
   int d_srcport, d_dstport, c_srcport, c_dstport;
 
@@ -183,6 +183,8 @@
     return false;
   }
 
+  mEdge = edge;
+
   mDataSockets.resize(mChans);
   mCtrlSockets.resize(mChans);
   mControlServiceLoopThreads.resize(mChans);
@@ -620,6 +622,10 @@
   GSM::Time time = radio_burst->getTime();
   CorrType type = expectedCorrType(time, chan);
 
+  /* Enable 8-PSK burst detection if EDGE is enabled */
+  if (mEdge && (type == TSC))
+    type = EDGE;
+
   /* Debug: dump bursts to disk */
   /* bits 0-7  - chan 0 timeslots
    * bits 8-15 - chan 1 timeslots */
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index f6f4526..d9a9708 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -107,7 +107,7 @@
   ~Transceiver();
 
   /** Start the control loop */
-  bool init(int filler, size_t rtsc, unsigned rach_delay);
+  bool init(int filler, size_t rtsc, unsigned rach_delay, bool edge);
 
   /** attach the radioInterface receive FIFO */
   bool receiveFIFO(VectorFIFO *wFIFO, size_t chan)
@@ -223,6 +223,7 @@
   int mSPSRx;                          ///< number of samples per Rx symbol
   size_t mChans;
 
+  bool mEdge;
   bool mOn;	                           ///< flag to indicate that transceiver is powered on
   bool mHandover[8][8];                ///< expect handover to the timeslot/subslot
   double mTxFreq;                      ///< the transmit frequency
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index ac9cc48..29f0488 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -284,7 +284,8 @@
 	trx = new Transceiver(config->port, config->addr.c_str(),
 			      config->tx_sps, config->rx_sps, config->chans,
 			      GSM::Time(3,0), radio, config->rssi_offset);
-	if (!trx->init(config->filler, config->rtsc, config->rach_delay)) {
+	if (!trx->init(config->filler, config->rtsc,
+		       config->rach_delay, config->edge)) {
 		LOG(ALERT) << "Failed to initialize transceiver";
 		delete trx;
 		return NULL;
@@ -422,7 +423,6 @@
 			break;
 		case 'e':
 			config->edge = true;
-			config->rx_sps = 4;
 			break;
 		default:
 			print_help();