srsLTE/lib/include/srsran/phy/sync/nsss.h

108 lines
4.9 KiB
C
Raw Normal View History

/**
2019-07-09 10:22:39 -07:00
*
* \section COPYRIGHT
2019-07-09 10:22:39 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2019-07-09 10:22:39 -07:00
*
* 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.
2019-07-09 10:22:39 -07:00
*
*/
/******************************************************************************
* File: nsss.h
*
* Description: Narrowband secondary synchronization signal (NSSS)
* generation and detection.
*
*
* Reference: 3GPP TS 36.211 version 13.2.0 Release 13 Sec. 10.2.7.2
*****************************************************************************/
2021-03-19 03:45:56 -07:00
#ifndef SRSRAN_NSSS_H
#define SRSRAN_NSSS_H
2019-07-09 10:22:39 -07:00
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
2021-03-19 03:45:56 -07:00
#include "srsran/config.h"
#include "srsran/phy/common/phy_common.h"
#include "srsran/phy/dft/dft.h"
#include "srsran/phy/utils/convolution.h"
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_NSSS_NSYMB 11
#define SRSRAN_NSSS_NSC 12
#define SRSRAN_NSSS_LEN (SRSRAN_NSSS_NSYMB * SRSRAN_NSSS_NSC)
#define SRSRAN_NSSS_NUM_SEQ 4
#define SRSRAN_NSSS_TOT_LEN (SRSRAN_NSSS_NUM_SEQ * SRSRAN_NSSS_LEN)
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_NSSS_CORR_FILTER_LEN 1508
#define SRSRAN_NSSS_CORR_OFFSET 412
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_NSSS_PERIOD 2
#define SRSRAN_NSSS_NUM_SF_DETECT (SRSRAN_NSSS_PERIOD)
2019-07-09 10:22:39 -07:00
// b_q_m table from 3GPP TS 36.211 v13.2.0 table 10.2.7.2.1-1
2021-03-19 03:45:56 -07:00
static const int b_q_m[SRSRAN_NSSS_NUM_SEQ][128] = {
2019-07-09 10:22:39 -07:00
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1},
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1,
-1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
-1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1,
-1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1,
1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1},
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1,
-1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
-1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1,
1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
-1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1}};
/* Low-level API */
2021-03-19 03:45:56 -07:00
typedef struct SRSRAN_API {
2019-07-09 10:22:39 -07:00
uint32_t input_size;
uint32_t subframe_sz;
uint32_t fft_size, max_fft_size;
2021-03-19 03:45:56 -07:00
srsran_conv_fft_cc_t conv_fft;
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
cf_t* nsss_signal_time[SRSRAN_NUM_PCI];
2019-07-09 10:22:39 -07:00
cf_t* tmp_input;
cf_t* conv_output;
float* conv_output_abs;
2021-03-19 03:45:56 -07:00
float peak_values[SRSRAN_NUM_PCI];
2019-07-09 10:22:39 -07:00
float corr_peak_threshold;
2021-03-19 03:45:56 -07:00
} srsran_nsss_synch_t;
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_nsss_synch_init(srsran_nsss_synch_t* q, uint32_t input_size, uint32_t fft_size);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API void srsran_nsss_synch_free(srsran_nsss_synch_t* q);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_nsss_synch_resize(srsran_nsss_synch_t* q, uint32_t fft_size);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_nsss_sync_find(srsran_nsss_synch_t* q,
cf_t* input,
float* corr_peak_value,
uint32_t* cell_id,
uint32_t* sfn_partial);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
void srsran_nsss_sync_find_pci(srsran_nsss_synch_t* q, cf_t* input, uint32_t cell_id);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_nsss_corr_init(srsran_nsss_synch_t* q);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API void srsran_nsss_generate(cf_t* signal, uint32_t cell_id);
2019-07-09 10:22:39 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API void srsran_nsss_put_subframe(srsran_nsss_synch_t* q,
2019-07-09 10:22:39 -07:00
cf_t* nsss,
cf_t* subframe,
const int nf,
const uint32_t nof_prb,
const uint32_t nbiot_prb_offset);
2021-03-19 03:45:56 -07:00
#endif // SRSRAN_NSSS_H