From b2b5148923ef841a03613591c81af42dfb22b601 Mon Sep 17 00:00:00 2001 From: WANG Tsu-Han Date: Thu, 19 Dec 2019 12:06:35 +0100 Subject: [PATCH 1/2] adding txdataF offset for gNB switch buffer --- openair1/SCHED_NR/nr_ru_procedures.c | 7 ++++--- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 5738da9690..c01b65c19a 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -135,7 +135,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { start_meas(&ru->ofdm_total_stats); - if (nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT) { + //if (nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT) { if(ru->num_gNB != 0){//L1 RU on same machine VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); @@ -229,7 +229,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { } }//jsymbols_per_slot }//else (RU only machine) - } + //} // wait all process to finish AssertFatal((ret=pthread_mutex_lock(&proc->mutex_feptx))==0,"mutex_lock return %d\n",ret); while (proc->feptx_mask != ofdm_mask_full) { @@ -432,6 +432,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { int32_t ***bw; int i=0; int slot_tx = tti_tx; + int txdataF_offset = ((tti_tx%2)*fp->samples_per_slot_wCP); start_meas(&ru->precoding_stats); if (ru->num_gNB == 1){ @@ -441,7 +442,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { for(i=0; iLmax; ++i) memcpy((void*)ru->common.txdataF[i], - (void*)gNB->common_vars.txdataF[i], + (void*)&gNB->common_vars.txdataF[i][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)); if (ru->nb_tx == 1) { diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6b68f08ce5..6157f5955c 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -127,18 +127,18 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); if (fp->Lmax == 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch(&gNB->pbch, &gNB->ssb_pdu, gNB->nr_pbch_interleaver, - txdataF[ssb_index], + &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, n_hf,fp->Lmax, @@ -192,7 +192,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (gNB->pdcch_pdu || gNB->ul_dci_pdu) nr_generate_dci_top(gNB->pdcch_pdu, gNB->ul_dci_pdu, gNB->nr_gold_pdcch_dmrs[slot], - gNB->common_vars.txdataF[0], + &gNB->common_vars.txdataF[0][txdataF_offset], AMP, *fp); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); From 9662363db12eda89b9283c702279b6954ba046ef Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 19 Dec 2019 14:39:28 +0100 Subject: [PATCH 2/2] allowing no mixed slot and astyle of phy_frame_config_nr.c --- openair1/SCHED_NR/phy_frame_config_nr.c | 267 ++++++++++++------------ 1 file changed, 139 insertions(+), 128 deletions(-) diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index 738030c903..fa22e43661 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -32,7 +32,7 @@ #include "SCHED_NR_UE/defs.h" #include "PHY/defs_nr_UE.h" #include "SCHED_NR_UE/phy_frame_config_nr.h" -#include "PHY/defs_common.h" +#include "PHY/impl_defs_nr.h" #include "PHY/impl_defs_top.h" /******************************************************************* @@ -52,87 +52,105 @@ *********************************************************************/ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, - int mu, + int mu, int nrofDownlinkSlots, int nrofDownlinkSymbols, - int nrofUplinkSlots, int nrofUplinkSymbols) -{ - int slot_number = 0,nb_periods_per_frame; - int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<tdd_table.tdd_period.value) { - case 0: - nb_periods_per_frame = 20; // 10ms/0p5ms - break; - case 1: - nb_periods_per_frame = 16; // 10ms/0p625ms - break; - case 2: - nb_periods_per_frame = 10; // 10ms/1ms - break; - case 3: - nb_periods_per_frame = 8; // 10ms/1p25ms - break; - case 4: - nb_periods_per_frame = 5; // 10ms/2ms - break; - case 5: - nb_periods_per_frame = 4; // 10ms/2p5ms - break; - case 6: - nb_periods_per_frame = 2; // 10ms/5ms - break; - case 7: - nb_periods_per_frame = 1; // 10ms/10ms - break; - default: - AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period.value); + case 0: + nb_periods_per_frame = 20; // 10ms/0p5ms + break; + + case 1: + nb_periods_per_frame = 16; // 10ms/0p625ms + break; + + case 2: + nb_periods_per_frame = 10; // 10ms/1ms + break; + + case 3: + nb_periods_per_frame = 8; // 10ms/1p25ms + break; + + case 4: + nb_periods_per_frame = 5; // 10ms/2ms + break; + + case 5: + nb_periods_per_frame = 4; // 10ms/2p5ms + break; + + case 6: + nb_periods_per_frame = 2; // 10ms/5ms + break; + + case 7: + nb_periods_per_frame = 1; // 10ms/10ms + break; + + default: + AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period.value); + } + + int nb_slots_per_period = ((1<tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(nfapi_nr_max_tdd_periodicity_t)); - for(int memory_alloc =0 ; memory_alloctdd_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 memory_alloc =0 ; memory_alloctdd_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)); 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; - if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0) { - slot_number++; - } - } - } + 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; - 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 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 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; - } - slot_number++; - } + if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0) + 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((number_of_symbol+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 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 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; + } + + 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((number_of_symbol+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++) { @@ -142,7 +160,7 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, } if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) { - frame_parms->tdd_uplink_nr[slot_number] = (1<tdd_uplink_nr[slot_number] = (1<p_TDD_UL_DL_ConfigDedicated; TDD_UL_DL_SlotConfig_t *p_previous_TDD_UL_DL_ConfigDedicated; int next = 0; @@ -196,6 +212,7 @@ void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slot } p_TDD_UL_DL_ConfigDedicated = calloc( 1, sizeof(TDD_UL_DL_SlotConfig_t)); + //printf("allocate pt %p \n", p_TDD_UL_DL_ConfigDedicated); if (p_TDD_UL_DL_ConfigDedicated == NULL) { printf("Error test_frame_configuration: memory allocation problem \n"); @@ -204,8 +221,7 @@ void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slot if (next == 0) { frame_parms->p_TDD_UL_DL_ConfigDedicated = p_TDD_UL_DL_ConfigDedicated; - } - else { + } else { p_previous_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig = (struct TDD_UL_DL_SlotConfig_t *)p_TDD_UL_DL_ConfigDedicated; } @@ -230,55 +246,48 @@ void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slot * *********************************************************************/ -int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) -{ +int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_SlotConfig; - p_current_TDD_UL_DL_SlotConfig = frame_parms->p_TDD_UL_DL_ConfigDedicated; - NR_TST_PHY_PRINTF("\nSet tdd dedicated configuration\n "); 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->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) { + + if (slot_index < TDD_CONFIG_NB_FRAMES*(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_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) { frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_DOWNLINK_SLOT; NR_TST_PHY_PRINTF(" DL[%d] ", slot_index); - } - else { + } else { LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink & uplink symbol configuration is not supported \n"); return (-1); } - } - else { + } else { LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink symbol configuration is not supported \n"); return (-1); } - } - else if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols != 0) { + } else if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols != 0) { if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == NR_TDD_SET_ALL_SYMBOLS) { frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_UPLINK_SLOT; NR_TST_PHY_PRINTF(" UL[%d] ", slot_index); - } - else { + } else { LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd uplink symbol configuration is not supported \n"); return (-1); } - } - else { + } else { LOG_E(PHY,"set_tdd_configuration_dedicated_nr: no tdd symbol configuration is specified \n"); return (-1); } - } - else { + } else { LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd slot index exceeds maximum value \n"); return (-1); } p_current_TDD_UL_DL_SlotConfig = (TDD_UL_DL_SlotConfig_t *)(p_current_TDD_UL_DL_SlotConfig->p_next_TDD_UL_DL_SlotConfig); } + NR_TST_PHY_PRINTF("\n"); return (0); } @@ -301,56 +310,61 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) * *********************************************************************/ -int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) -{ +int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) { /* for FFD all slot can be considered as an uplink */ int mu = cfg->ssb_config.scs_common.value,check_slot=0; - if (cfg->cell_config.frame_duplex_type.value == FDD) { + if (cfg->cell_config.frame_duplex_type.value == FDD) { return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT ); } if (nr_frame%2 == 0) { - for(int symbol_count=0;symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) { - check_slot++; - } + for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].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_counttdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { - check_slot++; - } + + check_slot = 0; + + for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].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); + } else { + return (NR_MIXED_SLOT); } } else { - for(int symbol_count=0;symbol_counttdd_table.max_tdd_periodicity_list[((1<tdd_table.max_tdd_periodicity_list[((1<tdd_table.max_tdd_periodicity_list[((1<tdd_table.max_tdd_periodicity_list[((1<p_tdd_UL_DL_Configuration; - free_tdd_configuration_dedicated_nr(frame_parms); if (p_tdd_UL_DL_Configuration != NULL) { @@ -395,11 +407,11 @@ void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms) * *********************************************************************/ -void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) -{ +void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_ConfigDedicated = frame_parms->p_TDD_UL_DL_ConfigDedicated; TDD_UL_DL_SlotConfig_t *p_next_TDD_UL_DL_ConfigDedicated; int next = 0; + if (p_current_TDD_UL_DL_ConfigDedicated != NULL) { do { if (p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig != NULL) { @@ -409,8 +421,7 @@ void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated); free(p_current_TDD_UL_DL_ConfigDedicated); p_current_TDD_UL_DL_ConfigDedicated = p_next_TDD_UL_DL_ConfigDedicated; - } - else { + } else { if (p_current_TDD_UL_DL_ConfigDedicated != NULL) { frame_parms->p_TDD_UL_DL_ConfigDedicated = NULL; //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated);