Commit bec43f01 authored by francescomani's avatar francescomani

use frame_structure in set_tdd_config_nr_ue function

parent ad66c75a
...@@ -655,21 +655,18 @@ typedef struct ...@@ -655,21 +655,18 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t slot_config;//For each symbol in each slot a uint8_t value is provided indicating: 0: DL slot 1: UL slot 2: Guard slot uint8_t slot_config; //For each symbol in each slot a uint8_t value is provided indicating: 0: DL slot 1: UL slot 2: Guard slot
} fapi_nr_max_num_of_symbol_per_slot_t; } fapi_nr_max_num_of_symbol_per_slot_t;
typedef struct typedef struct
{ {
fapi_nr_max_num_of_symbol_per_slot_t *max_num_of_symbol_per_slot_list; fapi_nr_max_num_of_symbol_per_slot_t *max_num_of_symbol_per_slot_list;
} fapi_nr_max_tdd_periodicity_t; } fapi_nr_max_tdd_periodicity_t;
typedef struct typedef struct
{ {
uint8_t tdd_period_in_slots; uint8_t tdd_period_in_slots;
fapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list; fapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list;
} fapi_nr_tdd_table_t; } fapi_nr_tdd_table_t;
typedef struct typedef struct
...@@ -709,8 +706,7 @@ typedef struct { ...@@ -709,8 +706,7 @@ typedef struct {
fapi_nr_cell_config_t cell_config; fapi_nr_cell_config_t cell_config;
fapi_nr_ssb_config_t ssb_config; fapi_nr_ssb_config_t ssb_config;
fapi_nr_ssb_table_t ssb_table; fapi_nr_ssb_table_t ssb_table;
fapi_nr_tdd_table_t tdd_table_1; fapi_nr_tdd_table_t tdd_table;
fapi_nr_tdd_table_t *tdd_table_2;
fapi_nr_prach_config_t prach_config; fapi_nr_prach_config_t prach_config;
} fapi_nr_config_request_t; } fapi_nr_config_request_t;
......
...@@ -44,14 +44,8 @@ int nr_ue_slot_select(const fapi_nr_config_request_t *cfg, int nr_slot) ...@@ -44,14 +44,8 @@ int nr_ue_slot_select(const fapi_nr_config_request_t *cfg, int nr_slot)
if (cfg->cell_config.frame_duplex_type == FDD) if (cfg->cell_config.frame_duplex_type == FDD)
return NR_UPLINK_SLOT | NR_DOWNLINK_SLOT; return NR_UPLINK_SLOT | NR_DOWNLINK_SLOT;
int period = cfg->tdd_table_1.tdd_period_in_slots + const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table;
(cfg->tdd_table_2 ? cfg->tdd_table_2->tdd_period_in_slots : 0); int rel_slot = nr_slot % tdd_table->tdd_period_in_slots;
int rel_slot = nr_slot % period;
const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table_1;
if (cfg->tdd_table_2 && rel_slot >= tdd_table->tdd_period_in_slots) {
rel_slot -= tdd_table->tdd_period_in_slots;
tdd_table = cfg->tdd_table_2;
}
if (tdd_table->max_tdd_periodicity_list == NULL) // this happens before receiving TDD configuration if (tdd_table->max_tdd_periodicity_list == NULL) // this happens before receiving TDD configuration
return NR_DOWNLINK_SLOT; return NR_DOWNLINK_SLOT;
......
...@@ -44,63 +44,38 @@ ...@@ -44,63 +44,38 @@
#include "oai_asn1.h" #include "oai_asn1.h"
#include "executables/position_interface.h" #include "executables/position_interface.h"
void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table, static void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table, const frame_structure_t *fs)
int mu,
NR_TDD_UL_DL_Pattern_t *pattern)
{ {
const int nrofDownlinkSlots = pattern->nrofDownlinkSlots; tdd_table->tdd_period_in_slots = fs->numb_slots_period;
const int nrofDownlinkSymbols = pattern->nrofDownlinkSymbols; tdd_table->max_tdd_periodicity_list = malloc(fs->numb_slots_period * sizeof(*tdd_table->max_tdd_periodicity_list));
const int nrofUplinkSlots = pattern->nrofUplinkSlots;
const int nrofUplinkSymbols = pattern->nrofUplinkSymbols;
const int nb_periods_per_frame = get_nb_periods_per_frame(pattern->dl_UL_TransmissionPeriodicity);
const int nb_slots_per_period = ((1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) / nb_periods_per_frame;
tdd_table->tdd_period_in_slots = nb_slots_per_period;
if ((nrofDownlinkSymbols + nrofUplinkSymbols) == 0)
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots),
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n",
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
else {
AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols);
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1),
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nrofMixed slots 1, nb_slots_per_period %d \n",
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
}
tdd_table->max_tdd_periodicity_list = (fapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_per_period * sizeof(fapi_nr_max_tdd_periodicity_t));
for(int memory_alloc = 0 ; memory_alloc < nb_slots_per_period; memory_alloc++) const tdd_period_config_t *pc = &fs->period_cfg;
tdd_table->max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = for (int i = 0; i < fs->numb_slots_period; i++) {
(fapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(fapi_nr_max_num_of_symbol_per_slot_t)); fapi_nr_max_tdd_periodicity_t *period_list = &tdd_table->max_tdd_periodicity_list[i];
period_list->max_num_of_symbol_per_slot_list =
int slot_number = 0; malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT * sizeof(*period_list->max_num_of_symbol_per_slot_list));
while(slot_number != nb_slots_per_period) { if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_DOWNLINK_SLOT) {
if(nrofDownlinkSlots != 0) { for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) {
for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots * NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) { period_list->max_num_of_symbol_per_slot_list[s].slot_config = 0;
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol % NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config = 0;
if((number_of_symbol + 1) % NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
slot_number++;
} }
} }
if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) {
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) { for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) {
for(int number_of_symbol = 0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++) { period_list->max_num_of_symbol_per_slot_list[s].slot_config = 1;
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config = 0;
} }
for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT - nrofUplinkSymbols; number_of_symbol++) {
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config = 2;
} }
for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT - nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) { if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_MIXED_SLOT) {
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config = 1; int dl_symb = pc->tdd_slot_bitmap[i].num_dl_symbols;
int ul_symb = pc->tdd_slot_bitmap[i].num_ul_symbols;
int g_symb = NR_NUMBER_OF_SYMBOLS_PER_SLOT - dl_symb - ul_symb;
for (int s = 0; s < dl_symb; s++) {
period_list->max_num_of_symbol_per_slot_list[s].slot_config = 0;
} }
slot_number++; for (int s = dl_symb; s < dl_symb + g_symb; s++) {
period_list->max_num_of_symbol_per_slot_list[s].slot_config = 2;
} }
for (int s = dl_symb + g_symb; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) {
if(nrofUplinkSlots != 0) { period_list->max_num_of_symbol_per_slot_list[s].slot_config = 1;
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots * NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config = 1;
if((number_of_symbol + 1) % NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
slot_number++;
} }
} }
} }
...@@ -197,16 +172,10 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo ...@@ -197,16 +172,10 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
&mac->frame_structure); &mac->frame_structure);
// TDD Table Configuration // TDD Table Configuration
if (cfg->cell_config.frame_duplex_type == TDD){ if (cfg->cell_config.frame_duplex_type == TDD)
set_tdd_config_nr_ue(&cfg->tdd_table_1, cfg->ssb_config.scs_common, &mac->tdd_UL_DL_ConfigurationCommon->pattern1); set_tdd_config_nr_ue(&cfg->tdd_table, &mac->frame_structure);
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t));
set_tdd_config_nr_ue(cfg->tdd_table_2, cfg->ssb_config.scs_common, mac->tdd_UL_DL_ConfigurationCommon->pattern2);
}
}
// PRACH configuration // PRACH configuration
uint8_t nb_preambles = 64; uint8_t nb_preambles = 64;
NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL)
...@@ -425,13 +394,8 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t ...@@ -425,13 +394,8 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
&mac->frame_structure); &mac->frame_structure);
// TDD Table Configuration // TDD Table Configuration
if (cfg->cell_config.frame_duplex_type == TDD){ if (cfg->cell_config.frame_duplex_type == TDD)
set_tdd_config_nr_ue(&cfg->tdd_table_1, cfg->ssb_config.scs_common, &mac->tdd_UL_DL_ConfigurationCommon->pattern1); set_tdd_config_nr_ue(&cfg->tdd_table, &mac->frame_structure);
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t));
set_tdd_config_nr_ue(cfg->tdd_table_2, cfg->ssb_config.scs_common, mac->tdd_UL_DL_ConfigurationCommon->pattern2);
}
}
// PRACH configuration // PRACH configuration
uint8_t nb_preambles = 64; uint8_t nb_preambles = 64;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment