mirror of https://github.com/pvnis/srsRAN_4G.git
Refactored enb_dl_nr to gnb_dl and initial gnb_ul
parent
eecaccb541
commit
f6fc215541
@ -1,82 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_ENB_DL_NR_H
|
||||
#define SRSRAN_ENB_DL_NR_H
|
||||
|
||||
#include "srsran/phy/common/phy_common_nr.h"
|
||||
#include "srsran/phy/dft/ofdm.h"
|
||||
#include "srsran/phy/phch/pdcch_cfg_nr.h"
|
||||
#include "srsran/phy/phch/pdcch_nr.h"
|
||||
#include "srsran/phy/phch/pdsch_nr.h"
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
srsran_pdsch_nr_args_t pdsch;
|
||||
srsran_pdcch_nr_args_t pdcch;
|
||||
uint32_t nof_tx_antennas;
|
||||
uint32_t nof_max_prb;
|
||||
} srsran_enb_dl_nr_args_t;
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
uint32_t max_prb;
|
||||
uint32_t nof_tx_antennas;
|
||||
srsran_carrier_nr_t carrier;
|
||||
srsran_pdcch_cfg_nr_t pdcch_cfg;
|
||||
|
||||
srsran_ofdm_t fft[SRSRAN_MAX_PORTS];
|
||||
|
||||
cf_t* sf_symbols[SRSRAN_MAX_PORTS];
|
||||
srsran_pdsch_nr_t pdsch;
|
||||
srsran_dmrs_sch_t dmrs;
|
||||
|
||||
srsran_dci_nr_t dci; ///< Stores DCI configuration
|
||||
srsran_pdcch_nr_t pdcch;
|
||||
} srsran_enb_dl_nr_t;
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_enb_dl_nr_init(srsran_enb_dl_nr_t* q, cf_t* output[SRSRAN_MAX_PORTS], const srsran_enb_dl_nr_args_t* args);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_set_carrier(srsran_enb_dl_nr_t* q, const srsran_carrier_nr_t* carrier);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_set_pdcch_config(srsran_enb_dl_nr_t* q,
|
||||
const srsran_pdcch_cfg_nr_t* cfg,
|
||||
const srsran_dci_cfg_nr_t* dci_cfg);
|
||||
|
||||
SRSRAN_API void srsran_enb_dl_nr_free(srsran_enb_dl_nr_t* q);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_base_zero(srsran_enb_dl_nr_t* q);
|
||||
|
||||
SRSRAN_API void srsran_enb_dl_nr_gen_signal(srsran_enb_dl_nr_t* q);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_pdcch_put_dl(srsran_enb_dl_nr_t* q,
|
||||
const srsran_slot_cfg_t* slot_cfg,
|
||||
const srsran_dci_dl_nr_t* dci_dl);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_pdcch_put_ul(srsran_enb_dl_nr_t* q,
|
||||
const srsran_slot_cfg_t* slot_cfg,
|
||||
const srsran_dci_ul_nr_t* dci_ul);
|
||||
|
||||
SRSRAN_API int srsran_enb_dl_nr_pdsch_put(srsran_enb_dl_nr_t* q,
|
||||
const srsran_slot_cfg_t* slot,
|
||||
const srsran_sch_cfg_nr_t* cfg,
|
||||
uint8_t* data[SRSRAN_MAX_TB]);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_enb_dl_nr_pdsch_info(const srsran_enb_dl_nr_t* q, const srsran_sch_cfg_nr_t* cfg, char* str, uint32_t str_len);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_enb_dl_nr_pdcch_dl_info(const srsran_enb_dl_nr_t* q, const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_enb_dl_nr_pdcch_ul_info(const srsran_enb_dl_nr_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len);
|
||||
|
||||
#endif // SRSRAN_ENB_DL_NR_H
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_GNB_DL_H
|
||||
#define SRSRAN_GNB_DL_H
|
||||
|
||||
#include "srsran/phy/common/phy_common_nr.h"
|
||||
#include "srsran/phy/dft/ofdm.h"
|
||||
#include "srsran/phy/phch/pdcch_cfg_nr.h"
|
||||
#include "srsran/phy/phch/pdcch_nr.h"
|
||||
#include "srsran/phy/phch/pdsch_nr.h"
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
srsran_pdsch_nr_args_t pdsch;
|
||||
srsran_pdcch_nr_args_t pdcch;
|
||||
uint32_t nof_tx_antennas;
|
||||
uint32_t nof_max_prb;
|
||||
} srsran_gnb_dl_args_t;
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
uint32_t max_prb;
|
||||
uint32_t nof_tx_antennas;
|
||||
srsran_carrier_nr_t carrier;
|
||||
srsran_pdcch_cfg_nr_t pdcch_cfg;
|
||||
|
||||
srsran_ofdm_t fft[SRSRAN_MAX_PORTS];
|
||||
|
||||
cf_t* sf_symbols[SRSRAN_MAX_PORTS];
|
||||
srsran_pdsch_nr_t pdsch;
|
||||
srsran_dmrs_sch_t dmrs;
|
||||
|
||||
srsran_dci_nr_t dci; ///< Stores DCI configuration
|
||||
srsran_pdcch_nr_t pdcch;
|
||||
} srsran_gnb_dl_t;
|
||||
|
||||
SRSRAN_API int srsran_gnb_dl_init(srsran_gnb_dl_t* q, cf_t* output[SRSRAN_MAX_PORTS], const srsran_gnb_dl_args_t* args);
|
||||
|
||||
SRSRAN_API int srsran_gnb_dl_set_carrier(srsran_gnb_dl_t* q, const srsran_carrier_nr_t* carrier);
|
||||
|
||||
SRSRAN_API int srsran_gnb_dl_set_pdcch_config(srsran_gnb_dl_t* q,
|
||||
const srsran_pdcch_cfg_nr_t* cfg,
|
||||
const srsran_dci_cfg_nr_t* dci_cfg);
|
||||
|
||||
SRSRAN_API void srsran_gnb_dl_free(srsran_gnb_dl_t* q);
|
||||
|
||||
SRSRAN_API int srsran_gnb_dl_base_zero(srsran_gnb_dl_t* q);
|
||||
|
||||
SRSRAN_API void srsran_gnb_dl_gen_signal(srsran_gnb_dl_t* q);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_gnb_dl_pdcch_put_dl(srsran_gnb_dl_t* q, const srsran_slot_cfg_t* slot_cfg, const srsran_dci_dl_nr_t* dci_dl);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_gnb_dl_pdcch_put_ul(srsran_gnb_dl_t* q, const srsran_slot_cfg_t* slot_cfg, const srsran_dci_ul_nr_t* dci_ul);
|
||||
|
||||
SRSRAN_API int srsran_gnb_dl_pdsch_put(srsran_gnb_dl_t* q,
|
||||
const srsran_slot_cfg_t* slot,
|
||||
const srsran_sch_cfg_nr_t* cfg,
|
||||
uint8_t* data[SRSRAN_MAX_TB]);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_gnb_dl_pdsch_info(const srsran_gnb_dl_t* q, const srsran_sch_cfg_nr_t* cfg, char* str, uint32_t str_len);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_gnb_dl_pdcch_dl_info(const srsran_gnb_dl_t* q, const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len);
|
||||
|
||||
SRSRAN_API int
|
||||
srsran_gnb_dl_pdcch_ul_info(const srsran_gnb_dl_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len);
|
||||
|
||||
#endif // SRSRAN_GNB_DL_H
|
@ -0,0 +1,61 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_GNB_UL_H
|
||||
#define SRSRAN_GNB_UL_H
|
||||
|
||||
#include "srsran/phy/common/phy_common_nr.h"
|
||||
#include "srsran/phy/dft/ofdm.h"
|
||||
#include "srsran/phy/phch/pucch_nr.h"
|
||||
#include "srsran/phy/phch/pusch_nr.h"
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
srsran_pusch_nr_args_t pusch;
|
||||
srsran_pucch_nr_args_t pucch;
|
||||
uint32_t nof_max_prb;
|
||||
} srsran_gnb_ul_args_t;
|
||||
|
||||
typedef struct SRSRAN_API {
|
||||
uint32_t max_prb;
|
||||
srsran_carrier_nr_t carrier;
|
||||
|
||||
srsran_ofdm_t fft;
|
||||
|
||||
cf_t* sf_symbols[SRSRAN_MAX_PORTS];
|
||||
srsran_pusch_nr_t pusch;
|
||||
srsran_pucch_nr_t pucch;
|
||||
srsran_dmrs_sch_t dmrs;
|
||||
srsran_chest_dl_res_t chest;
|
||||
} srsran_gnb_ul_t;
|
||||
|
||||
SRSRAN_API int srsran_gnb_ul_init(srsran_gnb_ul_t* q, cf_t* input, const srsran_gnb_ul_args_t* args);
|
||||
|
||||
SRSRAN_API void srsran_gnb_ul_free(srsran_gnb_ul_t* q);
|
||||
|
||||
SRSRAN_API int srsran_gnb_ul_set_carrier(srsran_gnb_ul_t* q, const srsran_carrier_nr_t* carrier);
|
||||
|
||||
SRSRAN_API int srsran_gnb_ul_fft(srsran_gnb_ul_t* q);
|
||||
|
||||
SRSRAN_API int srsran_gnb_ul_get_pusch(srsran_gnb_ul_t* q,
|
||||
const srsran_slot_cfg_t* slot_cfg,
|
||||
const srsran_sch_cfg_nr_t* cfg,
|
||||
const srsran_sch_grant_nr_t* grant,
|
||||
srsran_pusch_res_nr_t* data);
|
||||
|
||||
SRSRAN_API int srsran_gnb_ul_get_pucch(srsran_gnb_ul_t* q,
|
||||
const srsran_slot_cfg_t* slot_cfg,
|
||||
const srsran_pucch_nr_common_cfg_t* cfg,
|
||||
const srsran_pucch_nr_resource_t* resource,
|
||||
const srsran_uci_cfg_nr_t* uci_cfg,
|
||||
srsran_uci_value_nr_t* uci_value);
|
||||
|
||||
#endif // SRSRAN_GNB_UL_H
|
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
file(GLOB SOURCES "*.c")
|
||||
add_library(srsran_gnb OBJECT ${SOURCES})
|
@ -0,0 +1,169 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srsran/phy/gnb/gnb_ul.h"
|
||||
|
||||
/**
|
||||
* @brief Shifts FFT window a fraction of the cyclic prefix. Set to 0.0f for disabling.
|
||||
* @note Increases protection against inter-symbol interference in case of synchronization error in expense of computing
|
||||
* performance
|
||||
*/
|
||||
#define GNB_UL_NR_FFT_WINDOW_OFFSET 0.5f
|
||||
|
||||
static int gnb_ul_alloc_prb(srsran_gnb_ul_t* q, uint32_t new_nof_prb)
|
||||
{
|
||||
if (q->max_prb < new_nof_prb) {
|
||||
q->max_prb = new_nof_prb;
|
||||
|
||||
srsran_chest_dl_res_free(&q->chest);
|
||||
if (srsran_chest_dl_res_init(&q->chest, q->max_prb) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (q->sf_symbols[0] != NULL) {
|
||||
free(q->sf_symbols[0]);
|
||||
}
|
||||
|
||||
q->sf_symbols[0] = srsran_vec_cf_malloc(SRSRAN_SLOT_LEN_RE_NR(q->max_prb));
|
||||
if (q->sf_symbols[0] == NULL) {
|
||||
ERROR("Malloc");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
int srsran_gnb_ul_init(srsran_gnb_ul_t* q, cf_t* input, const srsran_gnb_ul_args_t* args)
|
||||
{
|
||||
if (q == NULL || args == NULL) {
|
||||
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||
}
|
||||
|
||||
if (gnb_ul_alloc_prb(q, args->nof_max_prb) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_pusch_nr_init_gnb(&q->pusch, &args->pusch) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_pucch_nr_init(&q->pucch, &args->pucch) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_dmrs_sch_init(&q->dmrs, true) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
srsran_ofdm_cfg_t ofdm_cfg = {};
|
||||
ofdm_cfg.nof_prb = args->nof_max_prb;
|
||||
ofdm_cfg.in_buffer = input;
|
||||
ofdm_cfg.out_buffer = q->sf_symbols[0];
|
||||
ofdm_cfg.rx_window_offset = GNB_UL_NR_FFT_WINDOW_OFFSET;
|
||||
ofdm_cfg.symbol_sz = srsran_min_symbol_sz_rb(args->nof_max_prb);
|
||||
ofdm_cfg.keep_dc = true;
|
||||
|
||||
if (srsran_ofdm_rx_init_cfg(&q->fft, &ofdm_cfg) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
void srsran_gnb_ul_free(srsran_gnb_ul_t* q)
|
||||
{
|
||||
if (q == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
srsran_ofdm_tx_free(&q->fft);
|
||||
srsran_pusch_nr_free(&q->pusch);
|
||||
srsran_pucch_nr_free(&q->pucch);
|
||||
srsran_dmrs_sch_free(&q->dmrs);
|
||||
srsran_chest_dl_res_free(&q->chest);
|
||||
|
||||
if (q->sf_symbols[0] != NULL) {
|
||||
free(q->sf_symbols[0]);
|
||||
}
|
||||
|
||||
SRSRAN_MEM_ZERO(q, srsran_gnb_ul_t, 1);
|
||||
}
|
||||
|
||||
int srsran_gnb_ul_set_carrier(srsran_gnb_ul_t* q, const srsran_carrier_nr_t* carrier)
|
||||
{
|
||||
if (q == NULL || carrier == NULL) {
|
||||
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||
}
|
||||
|
||||
q->carrier = *carrier;
|
||||
|
||||
if (gnb_ul_alloc_prb(q, carrier->nof_prb) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_pusch_nr_set_carrier(&q->pusch, carrier) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_pucch_nr_set_carrier(&q->pucch, carrier) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_dmrs_sch_set_carrier(&q->dmrs, carrier) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
srsran_ofdm_cfg_t ofdm_cfg = {};
|
||||
ofdm_cfg.nof_prb = carrier->nof_prb;
|
||||
ofdm_cfg.rx_window_offset = GNB_UL_NR_FFT_WINDOW_OFFSET;
|
||||
ofdm_cfg.symbol_sz = srsran_min_symbol_sz_rb(carrier->nof_prb);
|
||||
ofdm_cfg.keep_dc = true;
|
||||
|
||||
if (srsran_ofdm_rx_init_cfg(&q->fft, &ofdm_cfg) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
int srsran_gnb_ul_fft(srsran_gnb_ul_t* q)
|
||||
{
|
||||
if (q == NULL) {
|
||||
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||
}
|
||||
|
||||
srsran_ofdm_rx_sf(&q->fft);
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
int srsran_gnb_ul_get_pusch(srsran_gnb_ul_t* q,
|
||||
const srsran_slot_cfg_t* slot_cfg,
|
||||
const srsran_sch_cfg_nr_t* cfg,
|
||||
const srsran_sch_grant_nr_t* grant,
|
||||
srsran_pusch_res_nr_t* data)
|
||||
{
|
||||
if (q == NULL || cfg == NULL || grant == NULL || data == NULL) {
|
||||
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||
}
|
||||
|
||||
if (srsran_dmrs_sch_estimate(&q->dmrs, slot_cfg, cfg, grant, q->sf_symbols[0], &q->chest) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (srsran_pusch_nr_decode(&q->pusch, cfg, grant, &q->chest, q->sf_symbols, data) < SRSRAN_SUCCESS) {
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue