iface: Add inner ring-buffer implementation

Two buffers, inner and outer, are used in the transceiver
implementation. The outer buffer interfaces with the device receive
interface to guarantee timestamp aligned and contiguously allocated
sample buffers. The inner buffer absorbs vector size differences between
GSM bursts (156 or 157 samples) and the resampler interface (typically
fixed multiples of 65).

Reimplement the inner buffer with a ring buffer that allows fixed size
segments on the outer (resampler) portion and variable lengths (GSM
side) on the inner side. Compared to the previous stack-like version,
this implementation removes unnecessary copying of buffer contents.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index ce06578..1f225a2 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -20,6 +20,7 @@
 #include "radioDevice.h"
 #include "radioVector.h"
 #include "radioClock.h"
+#include "radioBuffer.h"
 #include "Resampler.h"
 
 static const unsigned gSlotLen = 148;      ///< number of symbols per slot, not counting guard periods
@@ -40,10 +41,8 @@
   size_t mChans;
   size_t mMIMO;
 
-  std::vector<signalVector *> sendBuffer;
-  std::vector<signalVector *> recvBuffer;
-  unsigned sendCursor;
-  unsigned recvCursor;
+  std::vector<RadioBuffer *> sendBuffer;
+  std::vector<RadioBuffer *> recvBuffer;
 
   std::vector<short *> convertRecvBuffer;
   std::vector<short *> convertSendBuffer;
@@ -61,16 +60,14 @@
 
 private:
 
-  /** format samples to USRP */ 
-  int radioifyVector(signalVector &wVector,
-                     float *floatVector,
-                     bool zero);
+  /** format samples to USRP */
+  int radioifyVector(signalVector &wVector, size_t chan, bool zero);
 
   /** format samples from USRP */
-  int unRadioifyVector(float *floatVector, signalVector &wVector);
+  int unRadioifyVector(signalVector *wVector, size_t chan);
 
   /** push GSM bursts into the transmit buffer */
-  virtual void pushBuffer(void);
+  virtual bool pushBuffer(void);
 
   /** pull GSM bursts from the receive buffer */
   virtual void pullBuffer(void);
@@ -152,20 +149,15 @@
 #endif
 
 class RadioInterfaceResamp : public RadioInterface {
-
 private:
-  signalVector *innerSendBuffer;
   signalVector *outerSendBuffer;
-  signalVector *innerRecvBuffer;
   signalVector *outerRecvBuffer;
 
-  void pushBuffer();
+  bool pushBuffer();
   void pullBuffer();
 
 public:
-
   RadioInterfaceResamp(RadioDevice* wRadio, size_t wSPS = 4, size_t chans = 1);
-
   ~RadioInterfaceResamp();
 
   bool init(int type);
@@ -184,7 +176,7 @@
   bool tuneRx(double freq, size_t chan);
 
 private:
-  std::vector<Resampler *> dnsamplers;
+  Resampler *dnsampler;
   std::vector<float> phases;
   signalVector *outerRecvBuffer;