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.
171 lines
5.5 KiB
C
171 lines
5.5 KiB
C
11 years ago
|
/**
|
||
|
*
|
||
|
* \section COPYRIGHT
|
||
|
*
|
||
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/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
10 years ago
|
/******************************************************************************
|
||
|
* File: prach.h
|
||
|
*
|
||
|
* Description: Physical random access channel.
|
||
|
*
|
||
|
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 5.7
|
||
|
*****************************************************************************/
|
||
|
|
||
11 years ago
|
#ifndef PRACH_
|
||
|
#define PRACH_
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <complex.h>
|
||
|
#include <stdbool.h>
|
||
10 years ago
|
#include "srslte/config.h"
|
||
8 years ago
|
#include "srslte/phy/dft/dft.h"
|
||
|
#include "srslte/phy/common/phy_common.h"
|
||
10 years ago
|
|
||
11 years ago
|
|
||
11 years ago
|
/** Generation and detection of RACH signals for uplink.
|
||
|
* Currently only supports preamble formats 0-3.
|
||
|
* Does not currently support high speed flag.
|
||
|
* Based on 3GPP TS 36.211 version 10.7.0 Release 10.
|
||
|
*/
|
||
|
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
11 years ago
|
// Parameters from higher layers (extracted from SIB2)
|
||
9 years ago
|
uint32_t config_idx;
|
||
11 years ago
|
uint32_t f; // preamble format
|
||
|
uint32_t rsi; // rootSequenceIndex
|
||
|
bool hs; // highSpeedFlag
|
||
|
uint32_t zczc; // zeroCorrelationZoneConfig
|
||
|
uint32_t N_ifft_ul; // IFFT size for uplink
|
||
|
uint32_t N_ifft_prach; // IFFT size for PRACH generation
|
||
|
|
||
|
// Working parameters
|
||
|
uint32_t N_zc; // PRACH sequence length
|
||
|
uint32_t N_cs; // Cyclic shift size
|
||
|
uint32_t N_seq; // Preamble length
|
||
9 years ago
|
float T_seq; // Preamble length in seconds
|
||
8 years ago
|
float T_tot; // Total sequence length in seconds
|
||
11 years ago
|
uint32_t N_cp; // Cyclic prefix length
|
||
|
|
||
|
// Generated tables
|
||
|
cf_t seqs[64][839]; // Our set of 64 preamble sequences
|
||
|
cf_t dft_seqs[64][839]; // DFT-precoded seqs
|
||
|
uint32_t root_seqs_idx[64]; // Indices of root seqs in seqs table
|
||
|
uint32_t N_roots; // Number of root sequences used in this configuration
|
||
9 years ago
|
|
||
11 years ago
|
// Containers
|
||
|
cf_t *ifft_in;
|
||
|
cf_t *ifft_out;
|
||
|
cf_t *prach_bins;
|
||
|
cf_t *corr_spec;
|
||
|
float *corr;
|
||
|
|
||
|
// PRACH IFFT
|
||
10 years ago
|
srslte_dft_plan_t *fft;
|
||
|
srslte_dft_plan_t *ifft;
|
||
11 years ago
|
|
||
|
// ZC-sequence FFT and IFFT
|
||
10 years ago
|
srslte_dft_plan_t *zc_fft;
|
||
|
srslte_dft_plan_t *zc_ifft;
|
||
9 years ago
|
|
||
|
cf_t *signal_fft;
|
||
|
float detect_factor;
|
||
9 years ago
|
|
||
|
uint32_t deadzone;
|
||
|
float peak_values[65];
|
||
|
uint32_t peak_offsets[65];
|
||
|
|
||
10 years ago
|
} srslte_prach_t;
|
||
11 years ago
|
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
|
int nof_sf;
|
||
|
uint32_t sf[5];
|
||
|
} srslte_prach_sf_config_t;
|
||
|
|
||
|
typedef enum SRSLTE_API {
|
||
|
SRSLTE_PRACH_SFN_EVEN = 0,
|
||
|
SRSLTE_PRACH_SFN_ANY,
|
||
|
} srslte_prach_sfn_t;
|
||
|
|
||
9 years ago
|
typedef struct {
|
||
|
uint32_t config_idx;
|
||
|
uint32_t root_seq_idx;
|
||
8 years ago
|
uint32_t zero_corr_zone;
|
||
|
uint32_t freq_offset;
|
||
9 years ago
|
bool hs_flag;
|
||
|
} srslte_prach_cfg_t;
|
||
|
|
||
|
|
||
10 years ago
|
SRSLTE_API uint32_t srslte_prach_get_preamble_format(uint32_t config_idx);
|
||
|
|
||
|
SRSLTE_API srslte_prach_sfn_t srslte_prach_get_sfn(uint32_t config_idx);
|
||
|
|
||
9 years ago
|
SRSLTE_API bool srslte_prach_tti_opportunity(srslte_prach_t *p,
|
||
|
uint32_t current_tti,
|
||
|
int allowed_subframe);
|
||
10 years ago
|
|
||
10 years ago
|
SRSLTE_API void srslte_prach_sf_config(uint32_t config_idx,
|
||
|
srslte_prach_sf_config_t *sf_config);
|
||
|
|
||
10 years ago
|
SRSLTE_API int srslte_prach_init(srslte_prach_t *p,
|
||
|
uint32_t N_ifft_ul,
|
||
9 years ago
|
uint32_t config_idx,
|
||
10 years ago
|
uint32_t root_seq_index,
|
||
|
bool high_speed_flag,
|
||
|
uint32_t zero_corr_zone_config);
|
||
11 years ago
|
|
||
9 years ago
|
SRSLTE_API int srslte_prach_init_cfg(srslte_prach_t* p,
|
||
|
srslte_prach_cfg_t* cfg,
|
||
|
uint32_t nof_prb);
|
||
|
|
||
10 years ago
|
SRSLTE_API int srslte_prach_gen(srslte_prach_t *p,
|
||
|
uint32_t seq_index,
|
||
|
uint32_t freq_offset,
|
||
|
cf_t *signal);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_prach_detect(srslte_prach_t *p,
|
||
|
uint32_t freq_offset,
|
||
|
cf_t *signal,
|
||
|
uint32_t sig_len,
|
||
9 years ago
|
uint32_t *indices,
|
||
10 years ago
|
uint32_t *ind_len);
|
||
11 years ago
|
|
||
9 years ago
|
SRSLTE_API int srslte_prach_detect_offset(srslte_prach_t *p,
|
||
|
uint32_t freq_offset,
|
||
|
cf_t *signal,
|
||
|
uint32_t sig_len,
|
||
|
uint32_t *indices,
|
||
9 years ago
|
float *t_offsets,
|
||
8 years ago
|
float *peak_to_avg,
|
||
9 years ago
|
uint32_t *ind_len);
|
||
|
|
||
9 years ago
|
SRSLTE_API void srslte_prach_set_detect_factor(srslte_prach_t *p,
|
||
|
float factor);
|
||
|
|
||
10 years ago
|
SRSLTE_API int srslte_prach_free(srslte_prach_t *p);
|
||
11 years ago
|
|
||
10 years ago
|
SRSLTE_API int srslte_prach_print_seqs(srslte_prach_t *p);
|
||
11 years ago
|
|
||
|
#endif // PRACH_
|