|
|
@ -549,9 +549,11 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
|
|
|
|
srslte_vec_prod_ccc(input_cfo, q->cfo_i_corr[q->cfo_i<0?0:1], input_cfo, q->frame_size);
|
|
|
|
srslte_vec_prod_ccc(input_cfo, q->cfo_i_corr[q->cfo_i<0?0:1], input_cfo, q->frame_size);
|
|
|
|
INFO("Compensating cfo_i=%d\n", q->cfo_i);
|
|
|
|
INFO("Compensating cfo_i=%d\n", q->cfo_i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
srslte_pss_synch_set_N_id_2(&q->pss, q->N_id_2);
|
|
|
|
srslte_pss_synch_set_N_id_2(&q->pss, q->N_id_2);
|
|
|
|
peak_pos = srslte_pss_synch_find_pss(&q->pss, &input_cfo[find_offset], &q->peak_value);
|
|
|
|
peak_pos = srslte_pss_synch_find_pss(&q->pss, &input_cfo[find_offset], &q->peak_value);
|
|
|
|
|
|
|
|
|
|
|
|
// this compensates for the constant time shift caused by the low pass filter
|
|
|
|
// this compensates for the constant time shift caused by the low pass filter
|
|
|
|
if(q->decimate && peak_pos < 0)
|
|
|
|
if(q->decimate && peak_pos < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -561,7 +563,6 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
|
|
|
|
fprintf(stderr, "Error calling finding PSS sequence at : %d \n", peak_pos);
|
|
|
|
fprintf(stderr, "Error calling finding PSS sequence at : %d \n", peak_pos);
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (peak_position) {
|
|
|
|
if (peak_position) {
|
|
|
|
*peak_position = (uint32_t) peak_pos;
|
|
|
|
*peak_position = (uint32_t) peak_pos;
|
|
|
@ -580,11 +581,14 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
|
|
|
|
/* If peak is over threshold, compute CFO and SSS */
|
|
|
|
/* If peak is over threshold, compute CFO and SSS */
|
|
|
|
if (q->peak_value >= q->threshold) {
|
|
|
|
if (q->peak_value >= q->threshold) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = SRSLTE_SYNC_FOUND;
|
|
|
|
|
|
|
|
|
|
|
|
if (q->detect_cp) {
|
|
|
|
if (q->detect_cp) {
|
|
|
|
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
|
|
|
|
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
|
|
|
|
srslte_sync_set_cp(q, srslte_sync_detect_cp(q, input_cfo, peak_pos + find_offset));
|
|
|
|
srslte_sync_set_cp(q, srslte_sync_detect_cp(q, input_cfo, peak_pos + find_offset));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
DEBUG("Not enough room to detect CP length. Peak position: %d\n", peak_pos);
|
|
|
|
DEBUG("Not enough room to detect CP length. Peak position: %d\n", peak_pos);
|
|
|
|
|
|
|
|
ret = SRSLTE_SYNC_FOUND_NOSPACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -597,8 +601,6 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
q->mean_cfo2 = SRSLTE_VEC_EMA(cfo2, q->mean_cfo2, q->cfo_ema_alpha);
|
|
|
|
q->mean_cfo2 = SRSLTE_VEC_EMA(cfo2, q->mean_cfo2, q->cfo_ema_alpha);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ret = SRSLTE_SYNC_FOUND;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = SRSLTE_SYNC_FOUND_NOSPACE;
|
|
|
|
ret = SRSLTE_SYNC_FOUND_NOSPACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|