Change in osmo-trx[master]: radioInterface: forward errors from RadioDevice to Transceiver in rec...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Sep 4 17:35:49 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10741 )

Change subject: radioInterface: forward errors from RadioDevice to Transceiver in recv path
......................................................................

radioInterface: forward errors from RadioDevice to Transceiver in recv path

Change-Id: Id7b08b19d6575c79b4d57db656a17ff05bb61ee9
---
M Transceiver52M/radioInterface.cpp
M Transceiver52M/radioInterface.h
M Transceiver52M/radioInterfaceMulti.cpp
M Transceiver52M/radioInterfaceResamp.cpp
4 files changed, 22 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index f74897f..b9c6672 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -218,14 +218,15 @@
   while (pushBuffer());
 }
 
-bool RadioInterface::driveReceiveRadio()
+int RadioInterface::driveReceiveRadio()
 {
   radioVector *burst = NULL;
 
   if (!mOn)
-    return false;
+    return 0;
 
-  pullBuffer();
+  if (pullBuffer() < 0)
+    return  -1;
 
   GSM::Time rcvClock = mClock.get();
   rcvClock.decTN(receiveOffset);
@@ -270,7 +271,7 @@
       burstSize = (symbolsPerSlot + (tN % 4 == 0)) * mSPSRx;
   }
 
-  return true;
+  return 1;
 }
 
 bool RadioInterface::isUnderrun()
@@ -300,13 +301,13 @@
 }
 
 /* Receive a timestamped chunk from the device */
-void RadioInterface::pullBuffer()
+int RadioInterface::pullBuffer()
 {
   bool local_underrun;
   size_t numRecv, segmentLen = recvBuffer[0]->getSegmentLen();
 
   if (recvBuffer[0]->getFreeSegments() <= 0)
-    return;
+    return -1;
 
   /* Outer buffer access size is fixed */
   numRecv = mRadio->readSamples(convertRecvBuffer,
@@ -317,7 +318,7 @@
 
   if (numRecv != segmentLen) {
           LOG(ALERT) << "Receive error " << numRecv;
-          return;
+          return -1;
   }
 
   for (size_t i = 0; i < mChans; i++) {
@@ -328,6 +329,7 @@
 
   underrun |= local_underrun;
   readTimestamp += numRecv;
+  return 0;
 }
 
 /* Send timestamped chunk to the device with arbitrary size */
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index 54ffc31..f19a8dc 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -71,7 +71,7 @@
   virtual bool pushBuffer(void);
 
   /** pull GSM bursts from the receive buffer */
-  virtual void pullBuffer(void);
+  virtual int pullBuffer(void);
 
 public:
 
@@ -116,8 +116,8 @@
   void driveTransmitRadio(std::vector<signalVector *> &bursts,
                           std::vector<bool> &zeros);
 
-  /** drive reception of GSM bursts */
-  bool driveReceiveRadio();
+  /** drive reception of GSM bursts. -1: Error. 0: Radio off. 1: Received something. */
+  int driveReceiveRadio();
 
   int setPowerAttenuation(int atten, size_t chan = 0);
 
@@ -149,7 +149,7 @@
   signalVector *outerRecvBuffer;
 
   bool pushBuffer();
-  void pullBuffer();
+  int pullBuffer();
 
 public:
   RadioInterfaceResamp(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps);
@@ -162,7 +162,7 @@
 class RadioInterfaceMulti : public RadioInterface {
 private:
   bool pushBuffer();
-  void pullBuffer();
+  int pullBuffer();
 
   signalVector *outerSendBuffer;
   signalVector *outerRecvBuffer;
diff --git a/Transceiver52M/radioInterfaceMulti.cpp b/Transceiver52M/radioInterfaceMulti.cpp
index b3add21..67ccb25 100644
--- a/Transceiver52M/radioInterfaceMulti.cpp
+++ b/Transceiver52M/radioInterfaceMulti.cpp
@@ -225,14 +225,14 @@
 }
 
 /* Receive a timestamped chunk from the device */
-void RadioInterfaceMulti::pullBuffer()
+int RadioInterfaceMulti::pullBuffer()
 {
 	bool local_underrun;
 	size_t num;
 	float *buf;
 
 	if (recvBuffer[0]->getFreeSegments() <= 0)
-		return;
+		return -1;
 
 	/* Outer buffer access size is fixed */
 	num = mRadio->readSamples(convertRecvBuffer,
@@ -242,7 +242,7 @@
 				  &local_underrun);
 	if (num != channelizer->inputLen()) {
 		LOG(ALERT) << "Receive error " << num << ", " << channelizer->inputLen();
-		return;
+		return -1;
 	}
 
 	convert_short_float((float *) outerRecvBuffer->begin(),
@@ -288,6 +288,7 @@
 			LOG(ALERT) << "Sample rate upsampling error";
 		}
 	}
+	return 0;
 }
 
 /* Send a timestamped chunk to the device */
diff --git a/Transceiver52M/radioInterfaceResamp.cpp b/Transceiver52M/radioInterfaceResamp.cpp
index b0f799e..8ae4aa1 100644
--- a/Transceiver52M/radioInterfaceResamp.cpp
+++ b/Transceiver52M/radioInterfaceResamp.cpp
@@ -160,13 +160,13 @@
 }
 
 /* Receive a timestamped chunk from the device */
-void RadioInterfaceResamp::pullBuffer()
+int RadioInterfaceResamp::pullBuffer()
 {
 	bool local_underrun;
 	int rc, num_recv;
 
 	if (recvBuffer[0]->getFreeSegments() <= 0)
-		return;
+		return -1;
 
 	/* Outer buffer access size is fixed */
 	num_recv = mRadio->readSamples(convertRecvBuffer,
@@ -176,7 +176,7 @@
 				       &local_underrun);
 	if (num_recv != (int) resamp_outchunk) {
 		LOG(ALERT) << "Receive error " << num_recv;
-		return;
+		return -1;
 	}
 
 	convert_short_float((float *) outerRecvBuffer->begin(),
@@ -196,6 +196,7 @@
 
 	/* Set history for the next chunk */
 	outerRecvBuffer->updateHistory();
+	return 0;
 }
 
 /* Send a timestamped chunk to the device */

-- 
To view, visit https://gerrit.osmocom.org/10741
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id7b08b19d6575c79b4d57db656a17ff05bb61ee9
Gerrit-Change-Number: 10741
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180904/6bf0c338/attachment.htm>


More information about the gerrit-log mailing list