commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10005 - openbts/branches/developers/dburgess00/trunk/


From: dburgess00
Subject: [Commit-gnuradio] r10005 - openbts/branches/developers/dburgess00/trunk/Transceiver
Date: Sun, 16 Nov 2008 22:21:22 -0700 (MST)

Author: dburgess00
Date: 2008-11-16 22:21:21 -0700 (Sun, 16 Nov 2008)
New Revision: 10005

Modified:
   openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.cpp
   openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.h
Log:
Hack to mitigate bug #315, but without really fixing it.


Modified: 
openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.cpp
===================================================================
--- openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.cpp    
2008-11-17 04:40:38 UTC (rev 10004)
+++ openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.cpp    
2008-11-17 05:21:21 UTC (rev 10005)
@@ -48,7 +48,7 @@
 
   // generate pulse and setup up signal processing library
   gsmPulse = generateGSMPulse(2,mSamplesPerSymbol);
-  COUT("gsmPulse: " << *gsmPulse);
+  DCOUT("gsmPulse: " << *gsmPulse);
   sigProcLibSetup(mSamplesPerSymbol);
 
   // initialize filler tables with dummy bursts, initialize other per-timeslot 
variables
@@ -107,7 +107,7 @@
                                   *gsmPulse,
                                   mSamplesPerSymbol,
                                   1.0,0.0);
-  COUT("LOGGED BURST: " << *burst);
+  DCOUT("LOGGED BURST: " << *burst);
 
 /*
   unsigned char burstStr[gSlotLen+1];
@@ -117,7 +117,7 @@
     burstStr[i] = (unsigned char) ((*burstItr++)*255.0);
   }
   burstStr[gSlotLen]='\0';
-  COUT("LOGGED BURST: " << burstStr);
+  DCOUT("LOGGED BURST: " << burstStr);
 */
   delete burst;
 }
@@ -127,8 +127,10 @@
 {
   // dump stale bursts, if any
   while ((mTransmitPriorityQueue.size() > 0) && 
-        (mTransmitPriorityQueue.nextTime() < nowTime)) 
+        (mTransmitPriorityQueue.nextTime() < nowTime)) {
+    CERR("WARNING -- dumping STALE burst in TRX->USRP interface");
     delete mTransmitPriorityQueue.read();
+  }
   
   int TN = nowTime.TN();
   int modFN = nowTime.FN() % fillerModulus[nowTime.TN()];
@@ -142,7 +144,6 @@
     mTransmitFIFO->write(next);
 #ifdef TRANSMIT_LOGGING
     if (nowTime.TN()==TRANSMIT_LOGGING) { 
-      COUT("unmodulating time: " << nowTime);
       unModulateVector(fillerTable[modFN][TN]);
     }
 #endif
@@ -313,24 +314,24 @@
                                  &channelResp,
                                  &chanOffset);
     if (success) {
-      COUT("FOUND TSC!!!!!! " << amplitude << " " << TOA);
+      DCOUT("FOUND TSC!!!!!! " << amplitude << " " << TOA);
       mEnergyThreshold -= 1.0F;
       if (mEnergyThreshold < 0.0) mEnergyThreshold = 0.0;
       SNRestimate[timeslot] = 
amplitude.norm2()/(mEnergyThreshold*mEnergyThreshold+1.0); // this is not 
highly accurate
       if (estimateChannel) {
-         COUT("estimating channel...");
+         DCOUT("estimating channel...");
          channelResponse[timeslot] = channelResp;
                 chanRespOffset[timeslot] = chanOffset;
          chanRespAmplitude[timeslot] = amplitude;
         scaleVector(*channelResp, complex(1.0,0.0)/amplitude);
          designDFE(*channelResp, SNRestimate[timeslot], 7, 
&DFEForward[timeslot], &DFEFeedback[timeslot]);
          channelEstimateTime[timeslot] = rxBurst->time();  
-         COUT("SNR: " << SNRestimate[timeslot] << ", DFE forward: " << 
*DFEForward[timeslot] << ", DFE backward: " << *DFEFeedback[timeslot]);
+         DCOUT("SNR: " << SNRestimate[timeslot] << ", DFE forward: " << 
*DFEForward[timeslot] << ", DFE backward: " << *DFEFeedback[timeslot]);
       }
     }
     else {
       double framesElapsed = rxBurst->time()-prevFalseDetectionTime; 
-      COUT("wTime: " << rxBurst->time() << ", pTime: " << 
prevFalseDetectionTime << ", fElapsed: " << framesElapsed);
+      DCOUT("wTime: " << rxBurst->time() << ", pTime: " << 
prevFalseDetectionTime << ", fElapsed: " << framesElapsed);
       mEnergyThreshold += 10.0F*exp(-framesElapsed);
       prevFalseDetectionTime = rxBurst->time();
       channelResponse[timeslot] = NULL;
@@ -344,7 +345,7 @@
                              &amplitude,
                              &TOA);
     if (success) {
-      COUT("FOUND RACH!!!!!! " << amplitude << " " << TOA);
+      DCOUT("FOUND RACH!!!!!! " << amplitude << " " << TOA);
       mEnergyThreshold -= 1.0F;
       if (mEnergyThreshold < 0.0) mEnergyThreshold = 0.0;
       channelResponse[timeslot] = NULL; 
@@ -355,7 +356,7 @@
       prevFalseDetectionTime = rxBurst->time();
     }
   }
-  COUT("energy Threshold = " << mEnergyThreshold); 
+  DCOUT("energy Threshold = " << mEnergyThreshold); 
 
   // demodulate burst
   SoftVector *burst = NULL;
@@ -377,11 +378,11 @@
     wTime = rxBurst->time();
     // FIXME:  what is full scale for the USRP?  we get more that 12 bits of 
resolution...
     RSSI = (int) floor(20.0*log10(9450.0/amplitude.abs()));
-    COUT("RSSI: " << RSSI );
+    DCOUT("RSSI: " << RSSI );
     timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol);
   }
 
-  //if (burst) COUT("burst: " << *burst << '\n');
+  //if (burst) DCOUT("burst: " << *burst << '\n');
 
   delete rxBurst;
 
@@ -558,7 +559,7 @@
   mLock.unlock();
 }
 
-void Transceiver::driveTransmitPriorityQueue() 
+bool Transceiver::driveTransmitPriorityQueue() 
 {
 
   char buffer[gSlotLen+50];
@@ -567,7 +568,8 @@
   size_t msgLen = mDataSocket.read(buffer);
 
   if (msgLen!=gSlotLen+1+4+1) {
-    return;
+    CERR("WARNING -- badly formatted packet on GSM->TRX interface");
+    return false;
   }
 
   int timeSlot = (int) buffer[0];
@@ -584,9 +586,8 @@
 
   if (GSM::Time(frameNum,timeSlot) < mTransmitDeadlineClock) {
     // stale burst from GSM core
-    DCOUT("STALE! "<< GSM::Time(frameNum,timeSlot));
-    writeClockInterface();
-    return;
+    CERR("WARNING -- STALE packet on GSM->TRX interface at time "<< 
GSM::Time(frameNum,timeSlot));
+    return false;
   }
   
   //DCOUT("rcvd. burst at: " << GSM::Time(frameNum,timeSlot));
@@ -604,7 +605,9 @@
   
   DCOUT("added burst - time: " << currTime << ", RSSI: " << RSSI); // << ", 
data: " << newBurst); 
 
+  return true;
 
+
 }
  
 void Transceiver::driveReceiveFIFO() 
@@ -671,7 +674,7 @@
         // only do latency update every 10 frames, so we don't over update
        if (radioClock->get() > mLatencyUpdateTime + GSM::Time(10,0)) {
          mTransmitLatency = mTransmitLatency + GSM::Time(1,0);
-         COUT("new latency: " << mTransmitLatency);
+         DCOUT("new latency: " << mTransmitLatency);
          mLatencyUpdateTime = radioClock->get();
        }
       }
@@ -681,7 +684,7 @@
        if (mTransmitLatency > GSM::Time(1,1)) {
             if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
            mTransmitLatency.decTN();
-           COUT("reduced latency: " << mTransmitLatency);
+           DCOUT("reduced latency: " << mTransmitLatency);
            mLatencyUpdateTime = radioClock->get();
          }
        }
@@ -699,7 +702,9 @@
 void Transceiver::writeClockInterface()
 {
   char command[50];
-  sprintf(command,"IND CLOCK %llu",(unsigned long long) 
(mTransmitDeadlineClock.FN()+10));
+  // FIME -- See tracker #315.
+  //sprintf(command,"IND CLOCK %llu",(unsigned long long) 
(mTransmitDeadlineClock.FN()+10));
+  sprintf(command,"IND CLOCK %llu",(unsigned long long) 
(mTransmitDeadlineClock.FN()+20));
 
   DCOUT("ClockInterface: sending " << command);
 
@@ -740,7 +745,15 @@
 void *TransmitPriorityQueueServiceLoopAdapter(Transceiver *transceiver)
 {
   while (1) {
-    transceiver->driveTransmitPriorityQueue(); 
+    bool stale = false;
+    // Flush the UDP packets until a successful transfer.
+    while (!transceiver->driveTransmitPriorityQueue()) {
+      stale = true; 
+    }
+    if (stale) {
+      // If a packet was stale, remind the GSM stack of the clock.
+      transceiver->writeClockInterface();
+    }
     pthread_testcancel();
   }
   return NULL;

Modified: openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.h
===================================================================
--- openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.h      
2008-11-17 04:40:38 UTC (rev 10004)
+++ openbts/branches/developers/dburgess00/trunk/Transceiver/Transceiver.h      
2008-11-17 05:21:21 UTC (rev 10005)
@@ -177,8 +177,11 @@
   /** drive handling of control messages from GSM core */
   void driveControl();
 
-  /** drive modulation and sorting of GSM bursts from GSM core */
-  void driveTransmitPriorityQueue();
+  /**
+    drive modulation and sorting of GSM bursts from GSM core
+    @return true if a burst was transferred successfully
+  */
+  bool driveTransmitPriorityQueue();
 
   friend void *TransmitFIFOServiceLoopAdapter(Transceiver *);
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]