mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
5.4 KiB
C
154 lines
5.4 KiB
C
11 years ago
|
/**
|
||
11 years ago
|
*
|
||
11 years ago
|
* \section COPYRIGHT
|
||
11 years ago
|
*
|
||
9 years ago
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||
11 years ago
|
*
|
||
|
* \section LICENSE
|
||
|
*
|
||
10 years ago
|
* This file is part of the srsLTE library.
|
||
11 years ago
|
*
|
||
10 years ago
|
* srsLTE is free software: you can redistribute it and/or modify
|
||
10 years ago
|
* it under the terms of the GNU Affero General Public License as
|
||
11 years ago
|
* published by the Free Software Foundation, either version 3 of
|
||
|
* the License, or (at your option) any later version.
|
||
|
*
|
||
10 years ago
|
* srsLTE is distributed in the hope that it will be useful,
|
||
11 years ago
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
10 years ago
|
* GNU Affero General Public License for more details.
|
||
11 years ago
|
*
|
||
10 years ago
|
* A copy of the GNU Affero General Public License can be found in
|
||
11 years ago
|
* the LICENSE file in the top-level directory of this distribution
|
||
|
* and at http://www.gnu.org/licenses/.
|
||
|
*
|
||
11 years ago
|
*/
|
||
|
|
||
10 years ago
|
/******************************************************************************
|
||
|
* File: pss.h
|
||
|
*
|
||
|
* Description: Primary synchronization signal (PSS) generation and detection.
|
||
|
*
|
||
|
* The srslte_pss_synch_t object provides functions for fast
|
||
|
* computation of the crosscorrelation between the PSS and received
|
||
|
* signal and CFO estimation. Also, the function srslte_pss_synch_tperiodic()
|
||
|
* is designed to be called periodically every subframe, taking
|
||
|
* care of the correct data alignment with respect to the PSS sequence.
|
||
|
*
|
||
|
* The object is designed to work with signals sampled at 1.92 Mhz
|
||
|
* centered at the carrier frequency. Thus, downsampling is required
|
||
|
* if the signal is sampled at higher frequencies.
|
||
|
*
|
||
|
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.11.1
|
||
|
*****************************************************************************/
|
||
11 years ago
|
|
||
11 years ago
|
#ifndef PSS_
|
||
|
#define PSS_
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include <stdbool.h>
|
||
11 years ago
|
|
||
10 years ago
|
#include "srslte/config.h"
|
||
8 years ago
|
#include "srslte/phy/common/phy_common.h"
|
||
|
#include "srslte/phy/utils/convolution.h"
|
||
|
#include "srslte/phy/utils/filter.h"
|
||
11 years ago
|
|
||
|
#define CONVOLUTION_FFT
|
||
|
|
||
10 years ago
|
#define SRSLTE_PSS_LEN 62
|
||
|
#define SRSLTE_PSS_RE (6*12)
|
||
11 years ago
|
|
||
|
|
||
10 years ago
|
/* PSS processing options */
|
||
|
|
||
10 years ago
|
#define SRSLTE_PSS_ACCUMULATE_ABS // If enabled, accumulates the correlation absolute value on consecutive calls to srslte_pss_synch_find_pss
|
||
10 years ago
|
|
||
10 years ago
|
#define SRSLTE_PSS_ABS_SQUARE // If enabled, compute abs square, otherwise computes absolute value only
|
||
10 years ago
|
|
||
10 years ago
|
#define SRSLTE_PSS_RETURN_PSR // If enabled returns peak to side-lobe ratio, otherwise returns absolute peak value
|
||
11 years ago
|
|
||
|
|
||
|
/* Low-level API */
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
10 years ago
|
|
||
10 years ago
|
srslte_dft_plan_t dftp_input;
|
||
10 years ago
|
|
||
11 years ago
|
#ifdef CONVOLUTION_FFT
|
||
10 years ago
|
srslte_conv_fft_cc_t conv_fft;
|
||
8 years ago
|
srslte_filt_cc_t filter;
|
||
11 years ago
|
|
||
8 years ago
|
#endif
|
||
|
int decimate;
|
||
11 years ago
|
uint32_t frame_size;
|
||
|
uint32_t N_id_2;
|
||
|
uint32_t fft_size;
|
||
8 years ago
|
cf_t *pss_signal_freq_full[3];
|
||
8 years ago
|
|
||
9 years ago
|
cf_t *pss_signal_time[3];
|
||
8 years ago
|
|
||
9 years ago
|
cf_t pss_signal_freq[3][SRSLTE_PSS_LEN]; // One sequence for each N_id_2
|
||
11 years ago
|
cf_t *tmp_input;
|
||
|
cf_t *conv_output;
|
||
10 years ago
|
float *conv_output_abs;
|
||
10 years ago
|
float ema_alpha;
|
||
10 years ago
|
float *conv_output_avg;
|
||
10 years ago
|
float peak_value;
|
||
10 years ago
|
}srslte_pss_synch_t;
|
||
11 years ago
|
|
||
11 years ago
|
typedef enum { PSS_TX, PSS_RX } pss_direction_t;
|
||
|
|
||
11 years ago
|
/* Basic functionality */
|
||
10 years ago
|
SRSLTE_API int srslte_pss_synch_init_fft(srslte_pss_synch_t *q,
|
||
|
uint32_t frame_size,
|
||
|
uint32_t fft_size);
|
||
11 years ago
|
|
||
9 years ago
|
SRSLTE_API int srslte_pss_synch_init_fft_offset(srslte_pss_synch_t *q,
|
||
|
uint32_t frame_size,
|
||
|
uint32_t fft_size,
|
||
|
int cfo_i);
|
||
|
|
||
8 years ago
|
SRSLTE_API int srslte_pss_synch_init_fft_offset_decim(srslte_pss_synch_t *q,
|
||
8 years ago
|
uint32_t frame_size,
|
||
|
uint32_t fft_size,
|
||
|
int cfo_i,
|
||
|
int decimate);
|
||
|
|
||
10 years ago
|
SRSLTE_API int srslte_pss_synch_init(srslte_pss_synch_t *q,
|
||
|
uint32_t frame_size);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API void srslte_pss_synch_free(srslte_pss_synch_t *q);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API void srslte_pss_synch_reset(srslte_pss_synch_t *q);
|
||
10 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_pss_generate(cf_t *signal,
|
||
|
uint32_t N_id_2);
|
||
11 years ago
|
|
||
9 years ago
|
SRSLTE_API void srslte_pss_get_slot(cf_t *slot,
|
||
|
cf_t *pss_signal,
|
||
|
uint32_t nof_prb,
|
||
|
srslte_cp_t cp);
|
||
|
|
||
10 years ago
|
SRSLTE_API void srslte_pss_put_slot(cf_t *pss_signal,
|
||
|
cf_t *slot,
|
||
|
uint32_t nof_prb,
|
||
|
srslte_cp_t cp);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API void srslte_pss_synch_set_ema_alpha(srslte_pss_synch_t *q,
|
||
|
float alpha);
|
||
10 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_pss_synch_set_N_id_2(srslte_pss_synch_t *q,
|
||
|
uint32_t N_id_2);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_pss_synch_find_pss(srslte_pss_synch_t *q,
|
||
|
cf_t *input,
|
||
|
float *corr_peak_value);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_pss_synch_chest(srslte_pss_synch_t *q,
|
||
|
cf_t *input,
|
||
|
cf_t ce[SRSLTE_PSS_LEN]);
|
||
10 years ago
|
|
||
10 years ago
|
SRSLTE_API float srslte_pss_synch_cfo_compute(srslte_pss_synch_t* q,
|
||
|
cf_t *pss_recv);
|
||
11 years ago
|
|
||
11 years ago
|
#endif // PSS_
|