radioInterface: forward errors from RadioDevice to Transceiver in recv path
Change-Id: Id7b08b19d6575c79b4d57db656a17ff05bb61ee9
This commit is contained in:
parent
46444637c6
commit
8e498bfd35
|
@ -218,14 +218,15 @@ void RadioInterface::driveTransmitRadio(std::vector<signalVector *> &bursts,
|
|||
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 @@ bool RadioInterface::driveReceiveRadio()
|
|||
burstSize = (symbolsPerSlot + (tN % 4 == 0)) * mSPSRx;
|
||||
}
|
||||
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool RadioInterface::isUnderrun()
|
||||
|
@ -300,13 +301,13 @@ double RadioInterface::getRxGain(size_t chan)
|
|||
}
|
||||
|
||||
/* 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 @@ void RadioInterface::pullBuffer()
|
|||
|
||||
if (numRecv != segmentLen) {
|
||||
LOG(ALERT) << "Receive error " << numRecv;
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mChans; i++) {
|
||||
|
@ -328,6 +329,7 @@ void RadioInterface::pullBuffer()
|
|||
|
||||
underrun |= local_underrun;
|
||||
readTimestamp += numRecv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send timestamped chunk to the device with arbitrary size */
|
||||
|
|
|
@ -71,7 +71,7 @@ private:
|
|||
virtual bool pushBuffer(void);
|
||||
|
||||
/** pull GSM bursts from the receive buffer */
|
||||
virtual void pullBuffer(void);
|
||||
virtual int pullBuffer(void);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -116,8 +116,8 @@ public:
|
|||
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 @@ private:
|
|||
signalVector *outerRecvBuffer;
|
||||
|
||||
bool pushBuffer();
|
||||
void pullBuffer();
|
||||
int pullBuffer();
|
||||
|
||||
public:
|
||||
RadioInterfaceResamp(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps);
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
class RadioInterfaceMulti : public RadioInterface {
|
||||
private:
|
||||
bool pushBuffer();
|
||||
void pullBuffer();
|
||||
int pullBuffer();
|
||||
|
||||
signalVector *outerSendBuffer;
|
||||
signalVector *outerRecvBuffer;
|
||||
|
|
|
@ -225,14 +225,14 @@ bool RadioInterfaceMulti::init(int type)
|
|||
}
|
||||
|
||||
/* 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 @@ void RadioInterfaceMulti::pullBuffer()
|
|||
&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 @@ void RadioInterfaceMulti::pullBuffer()
|
|||
LOG(ALERT) << "Sample rate upsampling error";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send a timestamped chunk to the device */
|
||||
|
|
|
@ -160,13 +160,13 @@ bool RadioInterfaceResamp::init(int type)
|
|||
}
|
||||
|
||||
/* 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 @@ void RadioInterfaceResamp::pullBuffer()
|
|||
&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 @@ void RadioInterfaceResamp::pullBuffer()
|
|||
|
||||
/* Set history for the next chunk */
|
||||
outerRecvBuffer->updateHistory();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send a timestamped chunk to the device */
|
||||
|
|
Loading…
Reference in New Issue