|
|
|
@@ -67,101 +67,84 @@ int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg,
|
|
|
|
|
int nrofUplinkSlots,
|
|
|
|
|
int nrofUplinkSymbols)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int slot_number = 0;
|
|
|
|
|
int nb_periods_per_frame = get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value);
|
|
|
|
|
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
|
|
|
|
int nb_slots_to_set = (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
|
|
|
|
|
|
|
|
|
int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
|
|
|
|
|
int nb_slots_per_period = ((1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) / nb_periods_per_frame;
|
|
|
|
|
|
|
|
|
|
if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 )
|
|
|
|
|
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);
|
|
|
|
|
"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(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);
|
|
|
|
|
"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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(nfapi_nr_max_tdd_periodicity_t));
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list = calloc(nb_slots_to_set, sizeof(nfapi_nr_max_tdd_periodicity_t));
|
|
|
|
|
|
|
|
|
|
for(int memory_alloc =0 ; memory_alloc<nb_slots_to_set; memory_alloc++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(
|
|
|
|
|
nfapi_nr_max_num_of_symbol_per_slot_t));
|
|
|
|
|
for(int number_of_symbol = 0; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++ ){
|
|
|
|
|
//for each symbol, assign the TLV tag for usage when packing
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.tl.tag = NFAPI_NR_CONFIG_SLOT_CONFIG_TAG;
|
|
|
|
|
for (int slot = 0; slot < nb_slots_to_set; slot++) {
|
|
|
|
|
nfapi_nr_max_tdd_periodicity_t *p_list = &cfg->tdd_table.max_tdd_periodicity_list[slot];
|
|
|
|
|
p_list->max_num_of_symbol_per_slot_list =
|
|
|
|
|
calloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT, sizeof(*p_list->max_num_of_symbol_per_slot_list));
|
|
|
|
|
for (int sym = 0; sym < NR_NUMBER_OF_SYMBOLS_PER_SLOT; sym++) {
|
|
|
|
|
// for each symbol, assign the TLV tag for usage when packing
|
|
|
|
|
p_list->max_num_of_symbol_per_slot_list[sym].slot_config.tl.tag = NFAPI_NR_CONFIG_SLOT_CONFIG_TAG;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while(slot_number != nb_slots_to_set) {
|
|
|
|
|
if(nrofDownlinkSlots != 0) {
|
|
|
|
|
for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
|
|
|
|
cfg->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.value= 0;
|
|
|
|
|
while (slot_number != nb_slots_to_set) {
|
|
|
|
|
if (nrofDownlinkSlots != 0) {
|
|
|
|
|
for (int sym = 0; sym < nrofDownlinkSlots * NR_NUMBER_OF_SYMBOLS_PER_SLOT; sym++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number]
|
|
|
|
|
.max_num_of_symbol_per_slot_list[sym % NR_NUMBER_OF_SYMBOLS_PER_SLOT]
|
|
|
|
|
.slot_config.value = 0;
|
|
|
|
|
|
|
|
|
|
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
|
|
|
|
if ((sym + 1) % NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
|
|
|
|
|
for(int number_of_symbol =0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 0;
|
|
|
|
|
for (int sym = 0; sym < nrofDownlinkSymbols; sym++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[sym].slot_config.value = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 2;
|
|
|
|
|
for (int sym = nrofDownlinkSymbols; sym < NR_NUMBER_OF_SYMBOLS_PER_SLOT - nrofUplinkSymbols; sym++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[sym].slot_config.value = 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++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 1;
|
|
|
|
|
for (int sym = NR_NUMBER_OF_SYMBOLS_PER_SLOT - nrofUplinkSymbols; sym < NR_NUMBER_OF_SYMBOLS_PER_SLOT; sym++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[sym].slot_config.value = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(nrofUplinkSlots != 0) {
|
|
|
|
|
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
|
|
|
|
cfg->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.value= 1;
|
|
|
|
|
if (nrofUplinkSlots != 0) {
|
|
|
|
|
for (int sym = 0; sym < nrofUplinkSlots * NR_NUMBER_OF_SYMBOLS_PER_SLOT; sym++) {
|
|
|
|
|
cfg->tdd_table.max_tdd_periodicity_list[slot_number]
|
|
|
|
|
.max_num_of_symbol_per_slot_list[sym % NR_NUMBER_OF_SYMBOLS_PER_SLOT]
|
|
|
|
|
.slot_config.value = 1;
|
|
|
|
|
|
|
|
|
|
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
|
|
|
|
if ((sym + 1) % NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
while(slot_number != nb_slots_to_set) {
|
|
|
|
|
for (int number_of_slot = 0; number_of_slot < nrofDownlinkSlots; number_of_slot++) {
|
|
|
|
|
frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_DOWNLINK_SLOT;
|
|
|
|
|
printf("slot %d set as downlink\n",slot_number);
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
|
|
|
|
|
frame_parms->tdd_uplink_nr[slot_number] = (1<<nrofUplinkSymbols) - 1;
|
|
|
|
|
printf("slot %d set as SL\n",slot_number);
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int number_of_slot = 0; number_of_slot < nrofUplinkSlots; number_of_slot++) {
|
|
|
|
|
frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_UPLINK_SLOT;
|
|
|
|
|
printf("slot %d set as uplink\n",slot_number);
|
|
|
|
|
slot_number++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) {
|
|
|
|
|
LOG_E(PHY,"set_tdd_configuration_nr: uplink symbol for slot is not supported for tdd configuration \n");
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (frame_parms->p_tdd_UL_DL_ConfigurationCommon2 != NULL) {
|
|
|
|
|
LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n");
|
|
|
|
|
return (-1);
|
|
|
|
|
}*/
|
|
|
|
|
return (nb_periods_per_frame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -235,7 +218,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
|
|
|
|
|
while(p_current_TDD_UL_DL_SlotConfig != NULL) {
|
|
|
|
|
int slot_index = p_current_TDD_UL_DL_SlotConfig->slotIndex;
|
|
|
|
|
|
|
|
|
|
if (slot_index < TDD_CONFIG_NB_FRAMES * frame_parms->slots_per_frame) {
|
|
|
|
|
if (slot_index < frame_parms->slots_per_frame) {
|
|
|
|
|
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols != 0) {
|
|
|
|
|
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols == NR_TDD_SET_ALL_SYMBOLS) {
|
|
|
|
|
if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == 0) {
|
|
|
|
@@ -306,62 +289,39 @@ int get_next_downlink_slot(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot) {
|
|
|
|
|
int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot)
|
|
|
|
|
{
|
|
|
|
|
(void) nr_frame;
|
|
|
|
|
|
|
|
|
|
/* for FFD all slot can be considered as an uplink */
|
|
|
|
|
int mu = cfg->ssb_config.scs_common.value,check_slot=0;
|
|
|
|
|
int check_slot = 0;
|
|
|
|
|
|
|
|
|
|
if (cfg->cell_config.frame_duplex_type.value == FDD) {
|
|
|
|
|
return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT );
|
|
|
|
|
return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nr_frame%2 == 0) {
|
|
|
|
|
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
for (int symbol_count = 0; symbol_count < NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 1) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_UPLINK_SLOT);
|
|
|
|
|
if (check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_UPLINK_SLOT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_slot = 0;
|
|
|
|
|
|
|
|
|
|
for (int symbol_count = 0; symbol_count < NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 0) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_slot = 0;
|
|
|
|
|
|
|
|
|
|
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_DOWNLINK_SLOT);
|
|
|
|
|
} else {
|
|
|
|
|
return (NR_MIXED_SLOT);
|
|
|
|
|
}
|
|
|
|
|
if (check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_DOWNLINK_SLOT);
|
|
|
|
|
} else {
|
|
|
|
|
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_UPLINK_SLOT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_slot = 0;
|
|
|
|
|
|
|
|
|
|
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
|
|
|
|
if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
|
|
|
|
|
check_slot++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
|
|
|
|
|
return (NR_DOWNLINK_SLOT);
|
|
|
|
|
} else {
|
|
|
|
|
return (NR_MIXED_SLOT);
|
|
|
|
|
}
|
|
|
|
|
return (NR_MIXED_SLOT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|