int srslte_pss_init_fft_offset(srslte_pss_t *q, uint32_t frame_size, uint32_t fft_size, int offset) { return srslte_pss_init_fft_offset_decim(q, frame_size, fft_size, offset, 1); }
int srslte_sync_init_decim(srslte_sync_t *q, uint32_t frame_size, uint32_t max_offset, uint32_t fft_size, int decimate) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && fft_size_isvalid(fft_size)) { ret = SRSLTE_ERROR; bzero(q, sizeof(srslte_sync_t)); q->N_id_2 = 1000; q->N_id_1 = 1000; q->cfo_ema_alpha = CFO_EMA_ALPHA; q->sss_alg = SSS_FULL; q->detect_cp = true; q->sss_en = true; q->cfo_pss_enable = false; q->cfo_cp_enable = false; q->cfo_i_initiated = false; q->pss_filtering_enabled = false; q->cfo_cp_nsymbols = 3; q->fft_size = fft_size; q->frame_size = frame_size; q->max_offset = max_offset; q->max_frame_size = frame_size; srslte_sync_cfo_reset(q); if (srslte_cfo_init(&q->cfo_corr_frame, q->frame_size)) { fprintf(stderr, "Error initiating CFO\n"); goto clean_exit; } if (srslte_cfo_init(&q->cfo_corr_symbol, q->fft_size)) { fprintf(stderr, "Error initiating CFO\n"); goto clean_exit; } // Set default CFO tolerance srslte_sync_set_cfo_tol(q, DEFAULT_CFO_TOL); for (int i=0;i<2;i++) { q->cfo_i_corr[i] = srslte_vec_malloc(sizeof(cf_t)*q->frame_size); if (!q->cfo_i_corr[i]) { perror("malloc"); goto clean_exit; } } q->temp = srslte_vec_malloc(sizeof(cf_t)*2*q->frame_size); if (!q->temp) { perror("malloc"); goto clean_exit; } srslte_sync_set_cp(q, SRSLTE_CP_NORM); q->decimate = decimate; if(!decimate) { decimate = 1; } if (srslte_pss_init_fft_offset_decim(&q->pss, max_offset, fft_size, 0, decimate)) { fprintf(stderr, "Error initializing PSS object\n"); goto clean_exit; } if (srslte_sss_init(&q->sss, fft_size)) { fprintf(stderr, "Error initializing SSS object\n"); goto clean_exit; } if (srslte_cp_synch_init(&q->cp_synch, fft_size)) { fprintf(stderr, "Error initiating CFO\n"); goto clean_exit; } DEBUG("SYNC init with frame_size=%d, max_offset=%d and fft_size=%d\n", frame_size, max_offset, fft_size); ret = SRSLTE_SUCCESS; } else { fprintf(stderr, "Invalid parameters frame_size: %d, fft_size: %d\n", frame_size, fft_size); } clean_exit: if (ret == SRSLTE_ERROR) { srslte_sync_free(q); } return ret; }