use frame_type in frame_structure instead of bool
This commit is contained in:
@@ -142,7 +142,7 @@ typedef struct frame_structure_s {
|
||||
int8_t numb_slots_frame;
|
||||
int8_t numb_slots_period;
|
||||
int8_t numb_period_frame;
|
||||
bool is_tdd;
|
||||
frame_type_t frame_type;
|
||||
} frame_structure_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -395,7 +395,7 @@ void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
|
||||
|
||||
void do_tdd_config_sim(PHY_VARS_gNB *gNB, int mu)
|
||||
{
|
||||
frame_structure_t fs = {.is_tdd = true};
|
||||
frame_structure_t fs = {.frame_type = TDD};
|
||||
fs.numb_slots_frame = (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
fs.numb_period_frame = get_nb_periods_per_frame(gNB->gNB_config.tdd_table.tdd_period.value);
|
||||
fs.numb_slots_period = fs.numb_slots_frame / fs.numb_period_frame;
|
||||
|
||||
@@ -380,7 +380,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed)
|
||||
{
|
||||
DevAssert(fs);
|
||||
|
||||
if (fs->is_tdd) {
|
||||
if (fs->frame_type == TDD) {
|
||||
for (int i = 0; i < fs->numb_slots_period; i++) {
|
||||
if ((mixed && is_ul_slot(i, fs)) || fs->period_cfg.tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) {
|
||||
return i;
|
||||
@@ -396,7 +396,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed)
|
||||
*/
|
||||
int get_dl_slots_per_period(const frame_structure_t *fs)
|
||||
{
|
||||
return fs->is_tdd ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame;
|
||||
return fs->frame_type == TDD ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -404,7 +404,7 @@ int get_dl_slots_per_period(const frame_structure_t *fs)
|
||||
*/
|
||||
int get_ul_slots_per_period(const frame_structure_t *fs)
|
||||
{
|
||||
return fs->is_tdd ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame;
|
||||
return fs->frame_type == TDD ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,7 +416,7 @@ int get_full_ul_slots_per_period(const frame_structure_t *fs)
|
||||
{
|
||||
DevAssert(fs);
|
||||
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return fs->numb_slots_frame;
|
||||
|
||||
int count = 0;
|
||||
@@ -438,7 +438,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs)
|
||||
{
|
||||
DevAssert(fs);
|
||||
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return fs->numb_slots_frame;
|
||||
|
||||
int count = 0;
|
||||
@@ -456,7 +456,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs)
|
||||
*/
|
||||
int get_ul_slots_per_frame(const frame_structure_t *fs)
|
||||
{
|
||||
return fs->is_tdd ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame;
|
||||
return fs->frame_type == TDD ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,7 +471,7 @@ int get_ul_slot_offset(const frame_structure_t *fs, int idx, bool count_mixed)
|
||||
DevAssert(fs);
|
||||
|
||||
// FDD
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return idx;
|
||||
|
||||
// UL slots indexes in period
|
||||
@@ -514,10 +514,10 @@ void config_frame_structure(int mu,
|
||||
if (frame_type == TDD) {
|
||||
fs->numb_period_frame = get_nb_periods_per_frame(tdd_period);
|
||||
fs->numb_slots_period = fs->numb_slots_frame / fs->numb_period_frame;
|
||||
fs->is_tdd = true;
|
||||
fs->frame_type = TDD;
|
||||
config_tdd_patterns(scc->tdd_UL_DL_ConfigurationCommon, fs);
|
||||
} else { // FDD
|
||||
fs->is_tdd = false;
|
||||
fs->frame_type = FDD;
|
||||
fs->numb_period_frame = 1;
|
||||
fs->numb_slots_period = fs->numb_slots_frame;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ static void clear_beam_information(NR_beam_info_t *beam_info, int frame, int slo
|
||||
*/
|
||||
bool is_ul_slot(const slot_t slot, const frame_structure_t *fs)
|
||||
{
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return true;
|
||||
const tdd_period_config_t *pc = &fs->period_cfg;
|
||||
slot_t s = get_slot_idx_in_period(slot, fs);
|
||||
@@ -142,7 +142,7 @@ bool is_ul_slot(const slot_t slot, const frame_structure_t *fs)
|
||||
*/
|
||||
bool is_dl_slot(const slot_t slot, const frame_structure_t *fs)
|
||||
{
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return true;
|
||||
const tdd_period_config_t *pc = &fs->period_cfg;
|
||||
slot_t s = get_slot_idx_in_period(slot, fs);
|
||||
@@ -156,7 +156,7 @@ bool is_dl_slot(const slot_t slot, const frame_structure_t *fs)
|
||||
*/
|
||||
bool is_mixed_slot(const slot_t slot, const frame_structure_t *fs)
|
||||
{
|
||||
if (!fs->is_tdd)
|
||||
if (fs->frame_type == FDD)
|
||||
return false;
|
||||
slot_t s = get_slot_idx_in_period(slot, fs);
|
||||
const tdd_period_config_t *pc = &fs->period_cfg;
|
||||
|
||||
@@ -971,7 +971,7 @@ static bool get_feasible_msg3_tda(const NR_ServingCellConfigCommon_t *scc,
|
||||
int abs_slot = slot + k2 + mu_delta;
|
||||
int temp_frame = (frame + (abs_slot / slots_per_frame)) & 1023;
|
||||
int temp_slot = abs_slot % slots_per_frame; // msg3 slot according to 8.3 in 38.213
|
||||
if (fs->is_tdd && !is_ul_slot(temp_slot, fs))
|
||||
if (fs->frame_type == TDD && !is_ul_slot(temp_slot, fs))
|
||||
continue;
|
||||
|
||||
const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap;
|
||||
|
||||
@@ -61,7 +61,7 @@ int get_dl_tda(const gNB_MAC_INST *nrmac, int slot)
|
||||
if (nrmac->UE_info.sched_csirs > 0)
|
||||
return 1;
|
||||
|
||||
if (fs->is_tdd) {
|
||||
if (fs->frame_type == TDD) {
|
||||
int s = get_slot_idx_in_period(slot, fs);
|
||||
// if there is a mixed slot where we can transmit DL
|
||||
const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap;
|
||||
|
||||
@@ -1036,7 +1036,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
|
||||
continue;
|
||||
const int pucch_slot = (slot + pdsch_to_harq_feedback[f] + NTN_gNB_Koffset) % n_slots_frame;
|
||||
// check if the slot is UL
|
||||
if (fs->is_tdd) {
|
||||
if (fs->frame_type == TDD) {
|
||||
int mod_slot = pucch_slot % fs->numb_slots_period;
|
||||
if (!is_ul_slot(mod_slot, fs))
|
||||
continue;
|
||||
|
||||
@@ -48,7 +48,7 @@ int get_ul_tda(gNB_MAC_INST *nrmac, int frame, int slot)
|
||||
/* there is a mixed slot only when in TDD */
|
||||
frame_structure_t *fs = &nrmac->frame_structure;
|
||||
|
||||
if (fs->is_tdd) {
|
||||
if (fs->frame_type == TDD) {
|
||||
// if there is uplink symbols in mixed slot
|
||||
int s = get_slot_idx_in_period(slot, fs);
|
||||
tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap;
|
||||
@@ -1535,7 +1535,7 @@ static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs,
|
||||
* Force the default transmission in a full slot as early
|
||||
* as possible in the UL portion of TDD period (last_ul_slot) */
|
||||
int num_slots_per_period = fs->numb_slots_period;
|
||||
int last_ul_slot = fs->is_tdd ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot;
|
||||
int last_ul_slot = fs->frame_type == TDD ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot;
|
||||
const int last_ul_sched = sched_ctrl->last_ul_frame * n + last_ul_slot;
|
||||
const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n);
|
||||
/* UE is to be scheduled if
|
||||
|
||||
@@ -1262,7 +1262,7 @@ static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedul
|
||||
{
|
||||
const frame_structure_t *fs = &RC.nrmac[0]->frame_structure;
|
||||
int sr_slot = 1; // in FDD SR in slot 1
|
||||
if (fs->is_tdd)
|
||||
if (fs->frame_type == TDD)
|
||||
sr_slot = get_first_ul_slot(fs, true);
|
||||
|
||||
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
|
||||
|
||||
Reference in New Issue
Block a user