From bd9498062ad205768966c06a7c9bc8310189d5aa Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 17 Jan 2024 09:49:41 +0100 Subject: [PATCH] Add some parameters for split 7 in split 8 openair0 config For the initialization of the xran library (split 7.2), we need some parameters such as PRACH or frame config. However, to date, initialization of split at level 7 use the split 8 openair0_config structure, which does not have the necessary information. Hence, add a single structure that contains that information. --- executables/nr-ru.c | 25 +++++++++++++++++++++++++ radio/COMMON/common_lib.h | 23 ++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 5a5e80358b..c32fc0dc2f 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -936,6 +936,30 @@ static void fill_rf_config(RU_t *ru, char *rf_config_file) } } +static void fill_split7_2_config(split7_config_t *split7, const nfapi_nr_config_request_scf_t *config, int slots_per_frame) +{ + const nfapi_nr_prach_config_t *prach_config = &config->prach_config; + const nfapi_nr_tdd_table_t *tdd_table = &config->tdd_table; + const nfapi_nr_cell_config_t *cell_config = &config->cell_config; + + DevAssert(prach_config->prach_ConfigurationIndex.tl.tag == NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG); + split7->prach_index = prach_config->prach_ConfigurationIndex.value; + AssertFatal(prach_config->num_prach_fd_occasions.value == 1, "cannot handle more than one PRACH occasion\n"); + split7->prach_freq_start = prach_config->num_prach_fd_occasions_list[0].k1.value; + + DevAssert(cell_config->frame_duplex_type.tl.tag == NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG); + if (cell_config->frame_duplex_type.value == 1 /* TDD */) { + DevAssert(tdd_table->tdd_period.tl.tag == NFAPI_NR_CONFIG_TDD_PERIOD_TAG); + int nb_periods_per_frame = get_nb_periods_per_frame(tdd_table->tdd_period.value); + split7->n_tdd_period = slots_per_frame / nb_periods_per_frame; + for (int slot = 0; slot < split7->n_tdd_period; ++slot) { + for (int sym = 0; sym < 14; ++sym) { + split7->slot_dirs[slot].sym_dir[sym] = tdd_table->max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[sym].slot_config.value; + } + } + } +} + /* this function maps the RU tx and rx buffers to the available rf chains. Each rf chain is is addressed by the card number and the chain on the card. The rf_map specifies for each antenna port, on which rf chain the mapping should start. Multiple @@ -1154,6 +1178,7 @@ void *ru_thread( void *param ) { nr_dump_frame_parms(fp); nr_phy_init_RU(ru); fill_rf_config(ru, ru->rf_config_file); + fill_split7_2_config(&ru->openair0_cfg.split7, &ru->config, fp->slots_per_frame); if(!emulate_rf) { // Start IF device if any diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index d735fab4f0..4a3ab9d083 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -178,8 +178,27 @@ typedef enum { RU_GPIO_CONTROL_INTERDIGITAL, } gpio_control_t; +/*! \brief defines the direction of each symbol. Int values intentional and + * analogous to FAPI/FHI 7.2 */ +typedef enum { SYMBOL_DIR_DL = 0, SYMBOL_DIR_UL = 1, SYMBOL_DIR_GU = 2 } symbol_direction_t; +/*! \brief Contains information about PRACH and Frame structure, for + * initialization of split 7 radios which reuses the interface of split 8. + */ +typedef struct split7_config { + /*! PRACH index used for PRACH */ + int prach_index; + /*! PRACH frequency start, from RRC's msg1-FrequencyStart */ + int prach_freq_start; + /*! the TDD period length, if TDD indicated in parent struct */ + int n_tdd_period; + /*! TDD frame structure, if TDD indicated */ + struct { + symbol_direction_t sym_dir[14]; + } slot_dirs[160]; +} split7_config_t; + /*! \brief RF frontend parameters set by application */ -typedef struct { +typedef struct openair0_config { //! Module ID for this configuration int Mod_id; //! device log level @@ -281,6 +300,8 @@ typedef struct { int txfh_cores[4]; //! select the GPIO control method gpio_control_t gpio_controller; + //! this interface is reused for split 7, so split 7 options provided below + split7_config_t split7; } openair0_config_t; /*! \brief RF mapping */