Merge branch 'next' into raa

master
Ismael Gomez 7 years ago
commit 866c422899

@ -291,6 +291,13 @@ private:
// Sync metrics
sync_metrics_t metrics;
// in-sync / out-of-sync counters
uint32_t out_of_sync_cnt;
uint32_t in_sync_cnt;
const static uint32_t NOF_OUT_OF_SYNC_SF = 200;
const static uint32_t NOF_IN_SYNC_SF = 100;
// State for primary cell
enum {
IDLE = 0,

@ -124,6 +124,8 @@ void phch_recv::stop()
void phch_recv::reset()
{
in_sync_cnt = 0;
out_of_sync_cnt = 0;
tx_mutex_cnt = 0;
phy_state = IDLE;
time_adv_sec = 0;
@ -713,6 +715,7 @@ void phch_recv::run_thread()
intra_freq_meas.write(tti, buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb));
break;
case 0:
Warning("SYNC: Out-of-sync detected in PSS/SSS\n");
out_of_sync();
worker->release();
worker_com->reset_ul();
@ -742,11 +745,24 @@ void phch_recv::run_thread()
}
void phch_recv::in_sync() {
out_of_sync_cnt = 0;
in_sync_cnt++;
// Send RRC in-sync signal after 100 ms consecutive subframes
if (in_sync_cnt == NOF_IN_SYNC_SF) {
rrc->in_sync();
in_sync_cnt = 0;
}
}
// Out of sync called by worker or phch_recv every 1 or 5 ms
void phch_recv::out_of_sync() {
in_sync_cnt = 0;
// Send RRC out-of-sync signal after 200 ms consecutive subframes
out_of_sync_cnt++;
if (out_of_sync_cnt >= NOF_OUT_OF_SYNC_SF) {
rrc->out_of_sync();
out_of_sync_cnt = 0;
}
}

@ -241,15 +241,12 @@ void phch_worker::work_imp()
/* Do FFT and extract PDCCH LLR, or quit if no actions are required in this subframe */
bool chest_ok = extract_fft_and_pdcch_llr();
bool snr_th_err = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))<-20.0;
bool snr_th_ok = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))>-15.0;
// Call feedback loop for chest
if (chest_loop && ((1<<(tti%10)) & phy->args->cfo_ref_mask)) {
chest_loop->set_cfo(srslte_chest_dl_get_cfo(&ue_dl.chest));
}
if (chest_ok && !snr_th_err) {
if (chest_ok) {
/***** Downlink Processing *******/
@ -370,12 +367,13 @@ void phch_worker::work_imp()
update_measurements();
if (chest_ok) {
if (snr_th_ok) {
log_h->debug("SNR=%.1f dB sync=in-sync from channel estimator\n", 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
if (phy->avg_rsrp_dbm > -124.0) {
log_h->debug("SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm);
chest_loop->in_sync();
} else if (snr_th_err) {
log_h->info("SNR=%.1f dB sync=out-of-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
} else {
log_h->warning("SNR=%.1f dB RSRP=%.1f dBm, sync=out-of-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm);
chest_loop->out_of_sync();
}
}

Loading…
Cancel
Save