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.
108 lines
4.9 KiB
C
108 lines
4.9 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: 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
|
||
|
*****************************************************************************/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_NSSS_H
|
||
|
#define SRSRAN_NSSS_H
|
||
5 years ago
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
|
#include "srsran/phy/common/phy_common.h"
|
||
|
#include "srsran/phy/dft/dft.h"
|
||
|
#include "srsran/phy/utils/convolution.h"
|
||
5 years ago
|
|
||
4 years ago
|
#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)
|
||
5 years ago
|
|
||
4 years ago
|
#define SRSRAN_NSSS_CORR_FILTER_LEN 1508
|
||
|
#define SRSRAN_NSSS_CORR_OFFSET 412
|
||
5 years ago
|
|
||
4 years ago
|
#define SRSRAN_NSSS_PERIOD 2
|
||
|
#define SRSRAN_NSSS_NUM_SF_DETECT (SRSRAN_NSSS_PERIOD)
|
||
5 years ago
|
|
||
|
// b_q_m table from 3GPP TS 36.211 v13.2.0 table 10.2.7.2.1-1
|
||
4 years ago
|
static const int b_q_m[SRSRAN_NSSS_NUM_SEQ][128] = {
|
||
5 years ago
|
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||
|
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
|
||
|
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
|
||
|
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
|
||
|
1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1},
|
||
|
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1,
|
||
|
-1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
|
||
|
-1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1,
|
||
|
-1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1,
|
||
|
1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1},
|
||
|
{1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1,
|
||
|
-1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
|
||
|
-1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1,
|
||
|
1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1,
|
||
|
-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 */
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
uint32_t input_size;
|
||
|
uint32_t subframe_sz;
|
||
|
uint32_t fft_size, max_fft_size;
|
||
4 years ago
|
srsran_conv_fft_cc_t conv_fft;
|
||
5 years ago
|
|
||
4 years ago
|
cf_t* nsss_signal_time[SRSRAN_NUM_PCI];
|
||
5 years ago
|
cf_t* tmp_input;
|
||
|
cf_t* conv_output;
|
||
|
float* conv_output_abs;
|
||
4 years ago
|
float peak_values[SRSRAN_NUM_PCI];
|
||
5 years ago
|
float corr_peak_threshold;
|
||
4 years ago
|
} srsran_nsss_synch_t;
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_nsss_synch_init(srsran_nsss_synch_t* q, uint32_t input_size, uint32_t fft_size);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_nsss_synch_free(srsran_nsss_synch_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_nsss_synch_resize(srsran_nsss_synch_t* q, uint32_t fft_size);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_nsss_sync_find(srsran_nsss_synch_t* q,
|
||
5 years ago
|
cf_t* input,
|
||
|
float* corr_peak_value,
|
||
|
uint32_t* cell_id,
|
||
|
uint32_t* sfn_partial);
|
||
5 years ago
|
|
||
4 years ago
|
void srsran_nsss_sync_find_pci(srsran_nsss_synch_t* q, cf_t* input, uint32_t cell_id);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_nsss_corr_init(srsran_nsss_synch_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_nsss_generate(cf_t* signal, uint32_t cell_id);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_nsss_put_subframe(srsran_nsss_synch_t* q,
|
||
5 years ago
|
cf_t* nsss,
|
||
|
cf_t* subframe,
|
||
|
const int nf,
|
||
|
const uint32_t nof_prb,
|
||
|
const uint32_t nbiot_prb_offset);
|
||
|
|
||
4 years ago
|
#endif // SRSRAN_NSSS_H
|