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.
117 lines
4.0 KiB
C
117 lines
4.0 KiB
C
4 years ago
|
/**
|
||
5 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
5 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
5 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
5 years ago
|
*
|
||
|
*/
|
||
|
|
||
|
/******************************************************************************
|
||
|
* File: sync_nbiot.h
|
||
|
*
|
||
|
* Description: Time and frequency synchronization using the NPSS and NSSS signals.
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
* Correlation peak is detected comparing the maximum at the output
|
||
|
* of the correlator with a threshold.
|
||
|
*
|
||
|
* Reference: 3GPP TS 36.211 version 13.2.0 Release 13
|
||
|
*****************************************************************************/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_SYNC_NBIOT_H
|
||
|
#define SRSRAN_SYNC_NBIOT_H
|
||
5 years ago
|
|
||
|
#include <math.h>
|
||
|
#include <stdbool.h>
|
||
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
|
#include "srsran/phy/sync/npss.h"
|
||
|
#include "srsran/phy/sync/nsss.h"
|
||
|
#include "srsran/phy/sync/sync.h"
|
||
|
#include "srsran/phy/ue/ue_sync.h"
|
||
5 years ago
|
|
||
|
#define MAX_NUM_CFO_CANDITATES 50
|
||
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
|
srsran_npss_synch_t npss;
|
||
|
srsran_nsss_synch_t nsss;
|
||
|
srsran_cp_synch_t cp_synch;
|
||
5 years ago
|
uint32_t n_id_ncell;
|
||
|
|
||
|
float threshold;
|
||
|
float peak_value;
|
||
|
uint32_t fft_size;
|
||
|
uint32_t frame_size;
|
||
|
uint32_t max_frame_size;
|
||
|
uint32_t max_offset;
|
||
|
bool enable_cfo_estimation;
|
||
|
bool enable_cfo_cand_test;
|
||
|
float cfo_cand[MAX_NUM_CFO_CANDITATES];
|
||
|
int cfo_num_cand;
|
||
|
int cfo_cand_idx;
|
||
|
float mean_cfo;
|
||
|
float current_cfo_tol;
|
||
|
cf_t* shift_buffer;
|
||
|
cf_t* cfo_output;
|
||
|
int cfo_i;
|
||
|
bool find_cfo_i;
|
||
|
bool find_cfo_i_initiated;
|
||
|
float cfo_ema_alpha;
|
||
|
uint32_t nof_symbols;
|
||
|
uint32_t cp_len;
|
||
4 years ago
|
srsran_cfo_t cfocorr;
|
||
|
srsran_cp_t cp;
|
||
|
} srsran_sync_nbiot_t;
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_sync_nbiot_init(srsran_sync_nbiot_t* q, uint32_t frame_size, uint32_t max_offset, uint32_t fft_size);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_free(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_sync_nbiot_resize(srsran_sync_nbiot_t* q, uint32_t frame_size, uint32_t max_offset, uint32_t fft_size);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API srsran_sync_find_ret_t srsran_sync_nbiot_find(srsran_sync_nbiot_t* q,
|
||
5 years ago
|
cf_t* input,
|
||
|
uint32_t find_offset,
|
||
|
uint32_t* peak_position);
|
||
|
|
||
4 years ago
|
SRSRAN_API float cfo_estimate_nbiot(srsran_sync_nbiot_t* q, cf_t* input);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_threshold(srsran_sync_nbiot_t* q, float threshold);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_cfo_enable(srsran_sync_nbiot_t* q, bool enable);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_cfo_cand_test_enable(srsran_sync_nbiot_t* q, bool enable);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_sync_nbiot_set_cfo_cand(srsran_sync_nbiot_t* q, const float* cand, const int num);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_cfo_tol(srsran_sync_nbiot_t* q, float tol);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_cfo_ema_alpha(srsran_sync_nbiot_t* q, float alpha);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_npss_ema_alpha(srsran_sync_nbiot_t* q, float alpha);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_sync_nbiot_find_cell_id(srsran_sync_nbiot_t* q, cf_t* input);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_sync_nbiot_get_cell_id(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API float srsran_sync_nbiot_get_cfo(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_set_cfo(srsran_sync_nbiot_t* q, float cfo);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API bool srsran_sync_nbiot_nsss_detected(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API float srsran_sync_nbiot_get_peak_value(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_sync_nbiot_reset(srsran_sync_nbiot_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_SYNC_NBIOT_H
|