Rewrite get_first_ul_slot to use pattern configuration stored in frame_structure
* the function is returning the index of the first full UL slot in tdd_slot_bitmap or the first UL slot (including mixed) if the "mixed" flag is provided
This commit is contained in:
committed by
Guido Casati
parent
bebbc857a0
commit
00f1d52f92
@@ -684,11 +684,6 @@ int get_slot_idx_in_period(const int slot, const frame_structure_t *fs)
|
|||||||
return slot % fs->numb_slots_period;
|
return slot % fs->numb_slots_period;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_first_ul_slot(int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSymbols)
|
|
||||||
{
|
|
||||||
return (nrofDownlinkSlots + (nrofDownlinkSymbols != 0 && nrofUplinkSymbols == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_dmrs_port(int nl, uint16_t dmrs_ports)
|
int get_dmrs_port(int nl, uint16_t dmrs_ports)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,6 @@ void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out);
|
|||||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
||||||
|
|
||||||
int get_first_ul_slot(int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSymbols);
|
|
||||||
int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs);
|
int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs);
|
||||||
int get_SLIV(uint8_t S, uint8_t L);
|
int get_SLIV(uint8_t S, uint8_t L);
|
||||||
void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset);
|
void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset);
|
||||||
|
|||||||
@@ -374,6 +374,28 @@ static void config_tdd_patterns(NR_TDD_UL_DL_ConfigCommon_t *tdd, frame_structur
|
|||||||
nb_slots_p2);
|
nb_slots_p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the first UL slot index in period
|
||||||
|
* @param fs frame structure
|
||||||
|
* @param mixed indicates whether to include in the count also mixed slot with UL symbols or only full UL slot
|
||||||
|
* @return slot index
|
||||||
|
*/
|
||||||
|
int get_first_ul_slot(const frame_structure_t *fs, bool mixed)
|
||||||
|
{
|
||||||
|
DevAssert(fs);
|
||||||
|
|
||||||
|
if (fs->is_tdd) {
|
||||||
|
for (int i = 0; i < fs->numb_slots_period; i++) {
|
||||||
|
bool is_mixed = fs->period_cfg.tdd_slot_bitmap[i].num_ul_symbols && fs->period_cfg.tdd_slot_bitmap[i].slot_type == TDD_NR_MIXED_SLOT;
|
||||||
|
if ((mixed && is_mixed) || fs->period_cfg.tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // FDD
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get number of DL slots per period (full DL slots + mixed slots with DL symbols)
|
* @brief Get number of DL slots per period (full DL slots + mixed slots with DL symbols)
|
||||||
*/
|
*/
|
||||||
@@ -908,7 +930,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
|
|||||||
int nr_ulstart_slot = 0;
|
int nr_ulstart_slot = 0;
|
||||||
if (tdd) {
|
if (tdd) {
|
||||||
nr_dl_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0);
|
nr_dl_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0);
|
||||||
nr_ulstart_slot = get_first_ul_slot(tdd->nrofDownlinkSlots, tdd->nrofDownlinkSymbols, tdd->nrofUplinkSymbols);
|
nr_ulstart_slot = get_first_ul_slot(&nrmac->frame_structure, true);
|
||||||
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
|
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
|
||||||
} else {
|
} else {
|
||||||
// if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration
|
// if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ void set_cset_offset(uint16_t);
|
|||||||
void get_K1_K2(int N1, int N2, int *K1, int *K2, int layers);
|
void get_K1_K2(int N1, int N2, int *K1, int *K2, int layers);
|
||||||
int get_NTN_Koffset(const NR_ServingCellConfigCommon_t *scc);
|
int get_NTN_Koffset(const NR_ServingCellConfigCommon_t *scc);
|
||||||
|
|
||||||
|
int get_first_ul_slot(const frame_structure_t *fs, bool mixed);
|
||||||
int get_ul_slots_per_period(const frame_structure_t *fs);
|
int get_ul_slots_per_period(const frame_structure_t *fs);
|
||||||
int get_ul_slots_per_frame(const frame_structure_t *fs);
|
int get_ul_slots_per_frame(const frame_structure_t *fs);
|
||||||
int get_dl_slots_per_period(const frame_structure_t *fs);
|
int get_dl_slots_per_period(const frame_structure_t *fs);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
#include "constr_TYPE.h"
|
#include "constr_TYPE.h"
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "oai_asn1.h"
|
#include "oai_asn1.h"
|
||||||
|
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||||
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||||
#include "openair3/UTILS/conversions.h"
|
#include "openair3/UTILS/conversions.h"
|
||||||
#include "uper_decoder.h"
|
#include "uper_decoder.h"
|
||||||
@@ -1187,10 +1188,10 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) {
|
|||||||
|
|
||||||
static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig, const NR_ServingCellConfigCommon_t *scc, int scs)
|
static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig, const NR_ServingCellConfigCommon_t *scc, int scs)
|
||||||
{
|
{
|
||||||
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
const frame_structure_t *fs = &RC.nrmac[0]->frame_structure;
|
||||||
int sr_slot = 1; // in FDD SR in slot 1
|
int sr_slot = 1; // in FDD SR in slot 1
|
||||||
if(tdd)
|
if (fs->is_tdd)
|
||||||
sr_slot = get_first_ul_slot(tdd->nrofDownlinkSlots, tdd->nrofDownlinkSymbols, tdd->nrofUplinkSymbols);
|
sr_slot = get_first_ul_slot(fs, true);
|
||||||
|
|
||||||
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
|
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
|
||||||
|
|
||||||
@@ -1650,12 +1651,13 @@ static void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc,
|
|||||||
int curr_bwp,
|
int curr_bwp,
|
||||||
bool is_rsrp)
|
bool is_rsrp)
|
||||||
{
|
{
|
||||||
|
const frame_structure_t *fs = &RC.nrmac[0]->frame_structure;
|
||||||
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
|
||||||
const int n_slots_frame = slotsperframe[*scc->ssbSubcarrierSpacing];
|
const int n_slots_frame = slotsperframe[*scc->ssbSubcarrierSpacing];
|
||||||
const int n_ul_slots_period = tdd ? (tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols > 0)) : n_slots_frame;
|
const int n_ul_slots_period = tdd ? (tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols > 0)) : n_slots_frame;
|
||||||
const int n_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame;
|
const int n_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame;
|
||||||
const int ideal_period = set_ideal_period(n_slots_period, n_ul_slots_period);
|
const int ideal_period = set_ideal_period(n_slots_period, n_ul_slots_period);
|
||||||
const int first_ul_slot_period = tdd ? get_first_ul_slot(tdd->nrofDownlinkSlots, tdd->nrofDownlinkSymbols, tdd->nrofUplinkSymbols) : 0;
|
const int first_ul_slot_period = tdd ? get_first_ul_slot(fs, true) : 0;
|
||||||
const int num_pucch2 = get_nb_pucch2_per_slot(scc, curr_bwp);
|
const int num_pucch2 = get_nb_pucch2_per_slot(scc, curr_bwp);
|
||||||
const int idx = (uid * 2 / num_pucch2) + is_rsrp;
|
const int idx = (uid * 2 / num_pucch2) + is_rsrp;
|
||||||
const int offset = first_ul_slot_period + idx % n_ul_slots_period + (idx / n_ul_slots_period) * n_slots_period;
|
const int offset = first_ul_slot_period + idx % n_ul_slots_period + (idx / n_ul_slots_period) * n_slots_period;
|
||||||
|
|||||||
Reference in New Issue
Block a user