Transceiver: Support pulling idle frames in pullRadioVector()

This logic will be used once we support TRXDv1, where idle indications
are sent through the socket.

Related: OS#4006
Change-Id: I46404f6e4055b6d3af3afffb0dfe4a19502917aa
This commit is contained in:
Pau Espin 2019-07-03 16:01:12 +02:00
parent 9bb24a1103
commit 95c8318d5d
2 changed files with 20 additions and 11 deletions

View File

@ -591,8 +591,6 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
/* Set time and determine correlation type */ /* Set time and determine correlation type */
burstTime = radio_burst->getTime(); burstTime = radio_burst->getTime();
bi->fn = burstTime.FN();
bi->tn = burstTime.TN();
CorrType type = expectedCorrType(burstTime, chan); CorrType type = expectedCorrType(burstTime, chan);
/* Enable 8-PSK burst detection if EDGE is enabled */ /* Enable 8-PSK burst detection if EDGE is enabled */
@ -612,6 +610,15 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
return false; return false;
} }
/* Initialize struct bi */
bi->nbits = 0;
bi->fn = burstTime.FN();
bi->tn = burstTime.TN();
bi->rssi = 0.0;
bi->toa = 0.0;
bi->noise = 0.0;
bi->idle = false;
/* Select the diversity channel with highest energy */ /* Select the diversity channel with highest energy */
for (size_t i = 0; i < radio_burst->chans(); i++) { for (size_t i = 0; i < radio_burst->chans(); i++) {
float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx); float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx);
@ -624,8 +631,7 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
if (max_i < 0) { if (max_i < 0) {
LOG(ALERT) << "Received empty burst"; LOG(ALERT) << "Received empty burst";
delete radio_burst; goto ret_idle;
return false;
} }
/* Average noise on diversity paths and update global levels */ /* Average noise on diversity paths and update global levels */
@ -641,10 +647,8 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
bi->rssi = 20.0 * log10(rxFullScale / avg) + rssiOffset; bi->rssi = 20.0 * log10(rxFullScale / avg) + rssiOffset;
bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssiOffset; bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssiOffset;
if (type == IDLE) { if (type == IDLE)
delete radio_burst; goto ret_idle;
return false;
}
max_toa = (type == RACH || type == EXT_RACH) ? max_toa = (type == RACH || type == EXT_RACH) ?
mMaxExpectedDelayAB : mMaxExpectedDelayNB; mMaxExpectedDelayAB : mMaxExpectedDelayNB;
@ -656,8 +660,7 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
LOG(WARNING) << "Clipping detected on received RACH or Normal Burst"; LOG(WARNING) << "Clipping detected on received RACH or Normal Burst";
else if (rc != SIGERR_NONE) else if (rc != SIGERR_NONE)
LOG(WARNING) << "Unhandled RACH or Normal Burst detection error"; LOG(WARNING) << "Unhandled RACH or Normal Burst detection error";
delete radio_burst; goto ret_idle;
return false;
} }
type = (CorrType) rc; type = (CorrType) rc;
@ -676,6 +679,11 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
delete rxBurst; delete rxBurst;
delete radio_burst; delete radio_burst;
return true; return true;
ret_idle:
bi->idle = true;
delete radio_burst;
return false;
} }
void Transceiver::reset() void Transceiver::reset()
@ -968,7 +976,7 @@ void Transceiver::driveReceiveFIFO(size_t chan)
struct trx_ul_burst_ind bi; struct trx_ul_burst_ind bi;
if (!pullRadioVector(chan, &bi)) if (!pullRadioVector(chan, &bi) || bi.idle)
return; return;
logRxBurst(chan, &bi); logRxBurst(chan, &bi);

View File

@ -44,6 +44,7 @@ struct trx_ul_burst_ind {
double rssi; // in dBFS double rssi; // in dBFS
double toa; // in symbols double toa; // in symbols
double noise; // noise level in dBFS double noise; // noise level in dBFS
bool idle; // true if no valid burst is included
}; };
class Transceiver; class Transceiver;