harmonize the use of definition for number of symbols per slot (no need to have two of them)

This commit is contained in:
francescomani
2026-03-06 18:38:55 +01:00
parent 582ce818d7
commit 803d87ef54
33 changed files with 81 additions and 84 deletions
+5 -5
View File
@@ -96,28 +96,28 @@ static void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table, const frame_str
for (int i = 0; i < fs->numb_slots_period; i++) {
fapi_nr_max_tdd_periodicity_t *period_list = &tdd_table->max_tdd_periodicity_list[i];
period_list->max_num_of_symbol_per_slot_list =
malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT * sizeof(*period_list->max_num_of_symbol_per_slot_list));
malloc(NR_SYMBOLS_PER_SLOT * sizeof(*period_list->max_num_of_symbol_per_slot_list));
if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_DOWNLINK_SLOT) {
for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) {
for (int s = 0; s < NR_SYMBOLS_PER_SLOT; s++) {
period_list->max_num_of_symbol_per_slot_list[s].slot_config = 0;
}
}
if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) {
for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++) {
for (int s = 0; s < NR_SYMBOLS_PER_SLOT; s++) {
period_list->max_num_of_symbol_per_slot_list[s].slot_config = 1;
}
}
if (pc->tdd_slot_bitmap[i].slot_type == TDD_NR_MIXED_SLOT) {
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;
int g_symb = NR_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;
}
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++) {
for (int s = dl_symb + g_symb; s < NR_SYMBOLS_PER_SLOT; s++) {
period_list->max_num_of_symbol_per_slot_list[s].slot_config = 1;
}
}
+5 -5
View File
@@ -77,19 +77,19 @@ void sl_set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table,
for(int memory_alloc = 0 ; memory_alloc < nb_slots_per_period; memory_alloc++)
tdd_table->max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list =
(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_num_of_symbol_per_slot_t *) malloc(NR_SYMBOLS_PER_SLOT*sizeof(fapi_nr_max_num_of_symbol_per_slot_t));
int slot_number = (nb_slots_per_period - nrofUplinkSlots) - (nrofUplinkSymbols ? 1 : 0);
if (nrofUplinkSymbols != 0) {
for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT - nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
for(int number_of_symbol = NR_SYMBOLS_PER_SLOT - nrofUplinkSymbols; number_of_symbol < NR_SYMBOLS_PER_SLOT; number_of_symbol++) {
tdd_table->max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config = 1;
}
slot_number++;
}
while(slot_number < nb_slots_per_period) {
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)
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots * NR_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_SYMBOLS_PER_SLOT].slot_config = 1;
if((number_of_symbol + 1) % NR_SYMBOLS_PER_SLOT == 0)
slot_number++;
}
}
+2 -2
View File
@@ -425,8 +425,8 @@ static bool check_mixed_slot_prach(frame_structure_t *fs, int slot, int start_pr
tdd_bitmap_t *bitmap = &fs->period_cfg.tdd_slot_bitmap[slot % fs->numb_slots_period];
if (bitmap->num_ul_symbols == 0)
return false;
int ul_end = NR_NUMBER_OF_SYMBOLS_PER_SLOT - 1;
int ul_start = NR_NUMBER_OF_SYMBOLS_PER_SLOT - bitmap->num_ul_symbols;
int ul_end = NR_SYMBOLS_PER_SLOT - 1;
int ul_start = NR_SYMBOLS_PER_SLOT - bitmap->num_ul_symbols;
if (start_prach < ul_start || end_prach > ul_end)
return false;
}
@@ -63,9 +63,9 @@ static uint8_t sl_get_elapsed_slots(uint32_t slot, uint32_t sl_slot_bitmap)
*/
static uint8_t sl_determine_if_sidelink_slot(uint8_t sl_startsym, uint8_t sl_lensym, uint8_t num_ulsym)
{
uint8_t ul_startsym = NR_NUMBER_OF_SYMBOLS_PER_SLOT - num_ulsym;
uint8_t ul_startsym = NR_SYMBOLS_PER_SLOT - num_ulsym;
if ((sl_startsym >= ul_startsym) && (sl_lensym <= NR_NUMBER_OF_SYMBOLS_PER_SLOT)) {
if ((sl_startsym >= ul_startsym) && (sl_lensym <= NR_SYMBOLS_PER_SLOT)) {
LOG_D(MAC,
"MIXED SLOT is a SIDELINK SLOT. Sidelink Symbols: %d-%d, Uplink Symbols: %d-%d\n",
sl_startsym,
@@ -107,13 +107,13 @@ int sl_nr_ue_slot_select(const sl_nr_phy_config_request_t *cfg, int slot, uint8_
const fapi_nr_max_tdd_periodicity_t *current_slot = &tdd_table->max_tdd_periodicity_list[rel_slot];
for (int symbol_count = 0; symbol_count < NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
for (int symbol_count = 0; symbol_count < NR_SYMBOLS_PER_SLOT; symbol_count++) {
if (current_slot->max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) {
ul_sym++;
}
}
if (ul_sym == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
if (ul_sym == NR_SYMBOLS_PER_SLOT) {
slot_type = NR_SIDELINK_SLOT;
} else if (ul_sym) {
slot_type = sl_determine_if_sidelink_slot(cfg->sl_bwp_config.sl_start_symbol, cfg->sl_bwp_config.sl_num_symbols, ul_sym);
@@ -1024,7 +1024,7 @@ static bool get_feasible_msg3_tda(const NR_ServingCellConfigCommon_t *scc,
int s = get_slot_idx_in_period(temp_slot, fs);
const tdd_bitmap_t *bm = &fs->period_cfg.tdd_slot_bitmap[s];
bool is_mixed = is_mixed_slot(s, fs);
uint16_t slot_mask = is_mixed ? SL_to_bitmap(NR_NUMBER_OF_SYMBOLS_PER_SLOT - bm->num_ul_symbols, bm->num_ul_symbols) : 0x3fff;
uint16_t slot_mask = is_mixed ? SL_to_bitmap(NR_SYMBOLS_PER_SLOT - bm->num_ul_symbols, bm->num_ul_symbols) : 0x3fff;
long startSymbolAndLength = tda_list->list.array[i]->startSymbolAndLength;
int start, nr;
SLIV2SL(startSymbolAndLength, &start, &nr);
@@ -101,7 +101,7 @@ static void fill_ssb_vrb_map(NR_COMMON_channels_t *cc,
uint16_t *vrb_map = cc[CC_id].vrb_map[beam];
const int extra_prb = ssb_subcarrier_offset > 0;
for (int rb = 0; rb < 20 + extra_prb; rb++)
vrb_map[rbStart + rb] = SL_to_bitmap(symStart % NR_NUMBER_OF_SYMBOLS_PER_SLOT, 4);
vrb_map[rbStart + rb] = SL_to_bitmap(symStart % NR_SYMBOLS_PER_SLOT, 4);
}
static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer, int buf_size)
@@ -104,7 +104,7 @@ void nr_preprocessor_phytest(gNB_MAC_INST *mac, post_process_pdsch_t *pp_pdsch)
const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
uint16_t ssb_start_symbol = get_ssb_start_symbol(band, scs, i_ssb);
// select beam for PDSCH in current slot based on SSB beam
if ((ssb_start_symbol / NR_NUMBER_OF_SYMBOLS_PER_SLOT) == (slot % mac->frame_structure.numb_slots_period)) {
if ((ssb_start_symbol / NR_SYMBOLS_PER_SLOT) == (slot % mac->frame_structure.numb_slots_period)) {
ssb_idx_beam = i_ssb;
break;
}
@@ -479,7 +479,7 @@ static void nr_configure_srs(gNB_MAC_INST *nrmac,
AssertFatal(beam.idx >= 0, "Cannot allocate SRS in any available beam\n");
uint16_t *vrb_map_UL = &nrmac->common_channels[CC_id].vrb_map_UL[beam.idx][buffer_index * MAX_BWP_SIZE];
uint16_t num = 1 << srs_pdu->num_symbols; // 0,1,2 means 1,2,4 symbols, see 222.10.04 table 3-105
const uint8_t l0 = NR_NUMBER_OF_SYMBOLS_PER_SLOT - 1 - srs_pdu->time_start_position;
const uint8_t l0 = NR_SYMBOLS_PER_SLOT - 1 - srs_pdu->time_start_position;
uint16_t mask = SL_to_bitmap(l0, num);
DevAssert(mask != 0);
for (int i = 0; i < srs_pdu->bwp_size; ++i) {
+1 -1
View File
@@ -1145,7 +1145,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay, i
int nb_slots_per_period = ((1 << mu) * 10) / nb_periods_per_frame;
// make TDA for the mixed slot
long mixed_sliv = get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1);
long mixed_sliv = get_SLIV(NR_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1);
int mixed_min_ul_symb = 3; // need at least two symbols PUSCH + PUCCH
bool has_ul_mixed = ul_symb >= mixed_min_ul_symb;
if (has_ul_mixed && (k2 <= N_dl1 || (p2 && N_ul2 == 0))) {
+2 -2
View File
@@ -252,9 +252,9 @@ static bool check_srs_config(NR_SRS_Config_t *srs_Config)
if (srs_Config->srs_ResourceToAddModList) {
for (int i = 0; i < srs_Config->srs_ResourceToAddModList->list.count; i++) {
NR_SRS_Resource_t *res = srs_Config->srs_ResourceToAddModList->list.array[i];
int start = NR_NUMBER_OF_SYMBOLS_PER_SLOT - res->resourceMapping.startPosition - 1;
int start = NR_SYMBOLS_PER_SLOT - res->resourceMapping.startPosition - 1;
int num = 1 << res->resourceMapping.nrofSymbols;
if (start + num > NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
if (start + num > NR_SYMBOLS_PER_SLOT) {
LOG_E(NR_RRC, "The configured SRS resource exceeds the slot boundary\n");
return false;
}