From 1aea23d35ee8f705150ea01a26afeb64c9e318ff Mon Sep 17 00:00:00 2001 From: Rakesh Date: Wed, 27 Nov 2019 16:31:44 +0100 Subject: [PATCH 1/6] nr tdd config --- executables/nr-ru.c | 40 ++++++++++++++++++------- openair1/PHY/INIT/nr_init.c | 22 ++++++++++++-- openair1/PHY/impl_defs_nr.h | 1 + openair1/SCHED_NR/nr_ru_procedures.c | 2 +- openair1/SCHED_NR/phy_frame_config_nr.c | 25 +++++++++------- openair2/LAYER2/NR_MAC_gNB/config.c | 16 ++++++---- 6 files changed, 78 insertions(+), 28 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 56b86fa6cd..dbc2e8a52a 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -721,24 +721,45 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T_INT(0), T_BUFFER(&ru->common.txdata[0][slot * fp->samples_per_slot], fp->samples_per_slot * 4)); - int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); - int sf_extension = 0; + int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); + int prevslot_type = nr_slot_select(ru->nr_frame_parms,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); + int sf_extension = 0; //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); - if ((slot == 0) || + if (slot_type == NR_DOWNLINK_SLOT || + slot_type == NR_S_SLOT) { + int siglen=fp->samples_per_tti,flags=1; + + if(slot_type == NR_S_SLOT) { + int txsymb = fp->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols; + AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + //+ ru->end_of_burst_delay; + flags=3; // end of burst + } + + if (fp->frame_type == TDD && + slot_type == NR_DOWNLINK_SLOT && + prevslot_type == NR_UPLINK_SLOT) { + flags = 2; // start of burst + //sf_extension = ru->sf_extension; + } + + /*if ((slot == 0) || (slot == 1)) { int siglen=fp->samples_per_slot; int flags; if (slot==0) flags = 2; else if (slot==1) - flags=3; + flags=3;*/ - if ((slot_type & NR_UPLINK_SLOT) == 0) { + //if ((slot_type & NR_UPLINK_SLOT) == 0) { - /* - if (SF_type == SF_S) { + + /* if (SF_type == SF_S) { siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0); flags=3; // end of burst } @@ -756,7 +777,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { (nextSF_type == SF_UL)) { flags = 4; // start of burst and end of burst (only one DL SF between two UL) sf_extension = ru->N_TA_offset<<1; - } */ + }*/ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot ); @@ -772,12 +793,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { siglen+sf_extension, ru->nb_tx, flags); - LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, + LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d\n",ru->idx, (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen); } - } } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 4164d25780..61bbfc3cef 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -403,6 +403,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, void nr_phy_config_request(NR_PHY_Config_t *phy_config) { uint8_t Mod_id = phy_config->Mod_id; + int return_tdd; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; nfapi_nr_config_request_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; gNB_config->nfapi_config.rf_bands.rf_band[0] = phy_config->cfg->nfapi_config.rf_bands.rf_band[0]; //22 @@ -415,7 +416,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { gNB_config->sch_config.n_ssb_crb.value = (phy_config->cfg->rf_config.dl_carrier_bandwidth.value-20); gNB_config->sch_config.physical_cell_id.value = phy_config->cfg->sch_config.physical_cell_id.value; gNB_config->sch_config.ssb_scg_position_in_burst.value= phy_config->cfg->sch_config.ssb_scg_position_in_burst.value; - gNB_config->sch_config.ssb_periodicity.value = phy_config->cfg->sch_config.ssb_periodicity.value; + gNB_config->sch_config.ssb_periodicity.value = phy_config->cfg->sch_config.ssb_periodicity.value; + if (phy_config->cfg->subframe_config.duplex_mode.value == 0) { gNB_config->subframe_config.duplex_mode.value = FDD; @@ -424,6 +426,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { } memcpy((void*)&gNB_config->rach_config,(void*)&phy_config->cfg->rach_config,sizeof(phy_config->cfg->rach_config)); + memcpy((void*)&gNB_config->tdd_ul_dl_config,(void*)&phy_config->cfg->tdd_ul_dl_config,sizeof(phy_config->cfg->tdd_ul_dl_config)); RC.gNB[Mod_id]->mac_enabled = 1; fp->dl_CarrierFreq = from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); @@ -441,8 +444,23 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { (unsigned long long)fp->dl_CarrierFreq, (unsigned long long)fp->ul_CarrierFreq); - nr_init_frame_parms(gNB_config, fp); + + if(gNB_config->subframe_config.duplex_mode.value == TDD){ + return_tdd = set_tdd_config_nr(fp, + gNB_config->tdd_ul_dl_config.dl_ul_periodicity.value, + gNB_config->tdd_ul_dl_config.nrofDownlinkSlots.value, + gNB_config->tdd_ul_dl_config.nrofDownlinkSymbols.value, + gNB_config->tdd_ul_dl_config.nrofUplinkSlots.value, + gNB_config->tdd_ul_dl_config.nrofUplinkSymbols.value + ); + + if (return_tdd !=0){ + LOG_E(PHY,"TDD configuration can not be done\n"); + } + else LOG_I(PHY,"TDD has been properly configurated\n"); + } + if (RC.gNB[Mod_id]->configured == 1) { LOG_E(PHY,"Already gNB already configured, do nothing\n"); diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 7b648515f5..bce7903ebf 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -97,6 +97,7 @@ SystemInformationBlockType1_nr_t; #define NR_DOWNLINK_SLOT (0x01) #define NR_UPLINK_SLOT (0x02) +#define NR_S_SLOT (0x03) #define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */ diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index e8203c3c12..05881eb2ea 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -272,7 +272,7 @@ void nr_fep0(RU_t *ru, int first_half) { end_symbol = NR_SYMBOLS_PER_SLOT; } - LOG_D(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol); + LOG_I(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol); // printf("fep0: slot %d\n",slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 1); diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index b171b2ac65..e6733f7e15 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -32,6 +32,8 @@ #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_top.h" /******************************************************************* * @@ -55,8 +57,7 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri { TDD_UL_DL_configCommon_t *p_tdd_ul_dl_configuration; int slot_number = 0; - int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(frame_parms->slots_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); /* allocate buffer for configuration structure */ p_tdd_ul_dl_configuration = calloc( 1, sizeof(TDD_UL_DL_configCommon_t)); @@ -86,26 +87,28 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols); 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 (p_tdd_ul_dl_configuration->nrofDownlinkSymbols != 0) { - LOG_E(PHY,"set_tdd_configuration_nr: downlink symbol for slot is not supported for tdd configuration \n"); - return (-1); + if (p_tdd_ul_dl_configuration->nrofDownlinkSymbols != 0 || p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) { + frame_parms->tdd_uplink_nr[slot_number] = (1<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) { + /*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) { @@ -261,16 +264,18 @@ int nr_slot_select(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti) if (frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_UPLINK_SLOT) { return (NR_UPLINK_SLOT); } - else { + else if(frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_DOWNLINK_SLOT){ return (NR_DOWNLINK_SLOT); } + else return (NR_S_SLOT); } else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_UPLINK_SLOT)) { return (NR_UPLINK_SLOT); } - else { + else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_DOWNLINK_SLOT)) { return (NR_DOWNLINK_SLOT); } + else return (NR_S_SLOT); } /******************************************************************* diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 17948f8b22..775a961f28 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -85,21 +85,27 @@ void config_common(int Mod_idP, // TDD cfg->subframe_config.duplex_mode.value = 1; - cfg->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG; + cfg->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG; cfg->num_tlv++; - + cfg->tdd_ul_dl_config.referenceSubcarrierSpacing.value = scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + cfg->tdd_ul_dl_config.dl_ul_periodicity.value = 5000;//scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;// rakesh:need to configure properly + cfg->tdd_ul_dl_config.nrofDownlinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; + cfg->tdd_ul_dl_config.nrofDownlinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols; + cfg->tdd_ul_dl_config.nrofUplinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + cfg->tdd_ul_dl_config.nrofUplinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; + /// In NR DL and UL will be different band cfg->nfapi_config.rf_bands.number_rf_bands = 1; cfg->nfapi_config.rf_bands.rf_band[0] = *(long*)scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - cfg->nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG; + cfg->nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG; cfg->num_tlv++; cfg->nfapi_config.nrarfcn.value = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - cfg->nfapi_config.nrarfcn.tl.tag = NFAPI_NR_NFAPI_NRARFCN_TAG; + cfg->nfapi_config.nrarfcn.tl.tag = NFAPI_NR_NFAPI_NRARFCN_TAG; cfg->num_tlv++; - cfg->subframe_config.numerology_index_mu.value = mu; + cfg->subframe_config.numerology_index_mu.value = mu; //cfg->subframe_config.tl.tag = //cfg->num_tlv++; From af471c5c3e77ea6ba172d46e5342f5f8b7fdfecd Mon Sep 17 00:00:00 2001 From: Rakesh Date: Wed, 11 Dec 2019 12:59:38 +0100 Subject: [PATCH 2/6] reworked as per the new fapi structures --- executables/nr-ru.c | 36 +++--- openair1/PHY/INIT/nr_init.c | 17 +-- openair1/PHY/defs_common.h | 1 + openair1/PHY/impl_defs_nr.h | 2 +- openair1/SCHED_NR/nr_ru_procedures.c | 16 +-- openair1/SCHED_NR/phy_frame_config_nr.c | 128 ++++++++++++++------- openair1/SCHED_NR/phy_frame_config_nr.h | 4 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SCHED_NR_UE/phy_frame_config_nr.h | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 28 +++-- 10 files changed, 145 insertions(+), 91 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index c1aabb9d3e..d2170c934e 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -309,12 +309,13 @@ void fh_if5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp) // southbound IF4p5 fronthaul void fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp) { + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.tti_tx); - if ((nr_slot_select(ru->nr_frame_parms,ru->proc.frame_tx,ru->proc.tti_tx)&NR_DOWNLINK_SLOT) > 0) + if ((nr_slot_select(cfg,ru->proc.frame_tx,ru->proc.tti_tx)&NR_DOWNLINK_SLOT) > 0) send_IF4p5(ru,frame, slot, IF4p5_PDLFFT); } @@ -517,7 +518,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *slot) { void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config; + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; RU_proc_t *proc = &ru->proc; uint16_t packet_type; uint32_t symbol_number,symbol_mask,symbol_mask_full=0; @@ -530,10 +531,10 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { do { recv_IF4p5(ru, &frame_tx, &slot_tx, &packet_type, &symbol_number); - if (((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); + if (((nr_slot_select(cfg,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", - *slot,nr_slot_select(ru->nr_frame_parms,frame_tx,*slot),frame_tx,slot_tx,symbol_number); + *slot,nr_slot_select(cfg,frame_tx,*slot),frame_tx,slot_tx,symbol_number); if (proc->first_tx != 0) { *frame = frame_tx; @@ -552,7 +553,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { } else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type); } while (symbol_mask != symbol_mask_full); - if ((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT)>0) stop_meas(&ru->rx_fhaul); + if ((nr_slot_select(cfg,frame_tx,slot_tx) & NR_DOWNLINK_SLOT)>0) stop_meas(&ru->rx_fhaul); proc->tti_tx = slot_tx; proc->frame_tx = frame_tx; @@ -715,24 +716,28 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { RU_proc_t *proc = &ru->proc; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - //nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config; + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; void *txp[ru->nb_tx]; unsigned int txs; - int i; + int i,txsymb; T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T_INT(0), T_BUFFER(&ru->common.txdata[0][slot * fp->samples_per_slot], fp->samples_per_slot * 4)); - int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); - int prevslot_type = nr_slot_select(ru->nr_frame_parms,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); + int slot_type = nr_slot_select(cfg,frame,slot%((1<ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)); + int prevslot_type = nr_slot_select(cfg,frame,(slot+(((1<ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)-1))%((1<ssb_config.scs_common.value)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)); int sf_extension = 0; //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); - if (slot_type == NR_DOWNLINK_SLOT || - slot_type == NR_S_SLOT) { + slot_type == NR_MIXED_SLOT) { int siglen=fp->samples_per_tti,flags=1; - if(slot_type == NR_S_SLOT) { - int txsymb = fp->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols; + if(slot_type == NR_MIXED_SLOT) { + txsymb = 0; + for(int symbol_count =0;symbol_counttdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { + txsymb++; + } + } AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); @@ -740,7 +745,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { flags=3; // end of burst } - if (fp->frame_type == TDD && + if (cfg->cell_config.frame_duplex_type.value == TDD && slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT) { flags = 2; // start of burst @@ -812,6 +817,7 @@ void *ru_thread_asynch_rxtx( void *param ) { static int ru_thread_asynch_rxtx_status; RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; int slot=0, frame=0; // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe wait_sync("ru_thread_asynch_rxtx"); @@ -835,7 +841,7 @@ void *ru_thread_asynch_rxtx( void *param ) { // asynchronous receive from north (RRU IF4/IF5) if (ru->fh_north_asynch_in) { - if ((nr_slot_select(ru->nr_frame_parms,frame,slot) & NR_DOWNLINK_SLOT)>0) + if ((nr_slot_select(cfg,frame,slot) & NR_DOWNLINK_SLOT)>0) ru->fh_north_asynch_in(ru,&frame,&slot); } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 0754d4b1c7..4db4c33576 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -390,7 +390,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { } memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config)); - memcpy((void*)&gNB_config->tdd_ul_dl_config,(void*)&phy_config->cfg->tdd_ul_dl_config,sizeof(phy_config->cfg->tdd_ul_dl_config)); + memcpy((void*)&gNB_config->tdd_table,(void*)&phy_config->cfg->tdd_table,sizeof(phy_config->cfg->tdd_table)); RC.gNB[Mod_id]->mac_enabled = 1; fp->dl_CarrierFreq = (gNB_config->carrier_config.dl_frequency.value)*1e3 + (gNB_config->carrier_config.dl_bandwidth.value)*5e5; @@ -411,21 +411,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { nr_init_frame_parms(gNB_config, fp); - if(gNB_config->subframe_config.duplex_mode.value == TDD){ - return_tdd = set_tdd_config_nr(fp, - gNB_config->tdd_ul_dl_config.dl_ul_periodicity.value, - gNB_config->tdd_ul_dl_config.nrofDownlinkSlots.value, - gNB_config->tdd_ul_dl_config.nrofDownlinkSymbols.value, - gNB_config->tdd_ul_dl_config.nrofUplinkSlots.value, - gNB_config->tdd_ul_dl_config.nrofUplinkSymbols.value - ); - - if (return_tdd !=0){ - LOG_E(PHY,"TDD configuration can not be done\n"); - } - else LOG_I(PHY,"TDD has been properly configurated\n"); - } - if (RC.gNB[Mod_id]->configured == 1) { LOG_E(PHY,"Already gNB already configured, do nothing\n"); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index b71e723740..e5cbe4b756 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -88,6 +88,7 @@ #define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH #define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1) #define PBCH_PDU_SIZE 3 //bytes +#define NR_NUMBER_OF_SYMBOLS_PER_SLOT 14 #define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index bce7903ebf..6a5cf76f98 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -97,7 +97,7 @@ SystemInformationBlockType1_nr_t; #define NR_DOWNLINK_SLOT (0x01) #define NR_UPLINK_SLOT (0x02) -#define NR_S_SLOT (0x03) +#define NR_MIXED_SLOT (0x03) #define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */ diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 0bce1676ce..73fcee4b50 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -114,6 +114,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; RU_proc_t *proc = &ru->proc; + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; struct timespec wait; int slot = tti_tx; @@ -122,7 +123,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { start_meas(&ru->ofdm_mod_stats); - if (nr_slot_select(fp,frame_tx,slot) == NR_UPLINK_SLOT) return; + if (nr_slot_select(cfg,frame_tx,slot) == NR_UPLINK_SLOT) return; // this copy should be done in the precoding thread (currently inactive) for (int aa=0;aanb_tx;aa++) @@ -131,7 +132,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); - if (nr_slot_select(fp,frame_tx,slot)==SF_DL) { + if (nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT) { // If this is not an S-tti if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) { printf("[RU] ERROR pthread_mutex_lock for feptx thread (IC %d)\n", proc->instance_cnt_feptx); @@ -161,7 +162,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { } // call first half-slot in this thread - nr_feptx0(ru,slot,0,fp->symbols_per_slot>>1); + nr_feptx0(ru,slot,0,NR_NUMBER_OF_SYMBOLS_PER_SLOT>>1); wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"NR feptx thread"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); @@ -213,6 +214,7 @@ void nr_init_feptx_thread(RU_t *ru) { // seems to be hardcoded to numerology 1 (2 slots=1 subframe) void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { + nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; int cyclic_prefix_type = NFAPI_CP_NORMAL; @@ -230,11 +232,11 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { memcpy((void*)ru->common.txdataF_BF[aa], (void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t)); - if ((nr_slot_select(fp,frame_tx,slot)==SF_DL)|| - ((nr_slot_select(fp,frame_tx,slot)==SF_S))) { + if ((nr_slot_select(cfg,frame_tx,slot)==NR_DOWNLINK_SLOT)|| + ((nr_slot_select(cfg,frame_tx,slot)==NR_MIXED_SLOT))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); - nr_feptx0(ru,slot,0,fp->symbols_per_slot); + nr_feptx0(ru,slot,0,NR_NUMBER_OF_SYMBOLS_PER_SLOT); } @@ -270,7 +272,7 @@ void nr_fep0(RU_t *ru, int first_half) { end_symbol = NR_SYMBOLS_PER_SLOT; } - LOG_I(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol); + LOG_D(PHY,"In fep0 for slot = %d, first_half = %d, start_symbol = %d, end_symbol = %d\n", proc->tti_rx, first_half, start_symbol, end_symbol); // printf("fep0: slot %d\n",slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+proc->tti_rx, 1); diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index e6733f7e15..a60fee11ff 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -51,41 +51,62 @@ * *********************************************************************/ -int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, +int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, + int mu, int dl_UL_TransmissionPeriodicity, int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSlots, int nrofUplinkSymbols) { - TDD_UL_DL_configCommon_t *p_tdd_ul_dl_configuration; int slot_number = 0; - int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(frame_parms->slots_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - /* allocate buffer for configuration structure */ - p_tdd_ul_dl_configuration = calloc( 1, sizeof(TDD_UL_DL_configCommon_t)); - - if (p_tdd_ul_dl_configuration == NULL) { - printf("Error test_frame_configuration: memory allocation problem \n"); - assert(0); - } - else { - frame_parms->frame_type = TDD; - } - - p_tdd_ul_dl_configuration->dl_UL_TransmissionPeriodicity = dl_UL_TransmissionPeriodicity; - p_tdd_ul_dl_configuration->nrofDownlinkSlots = nrofDownlinkSlots; - p_tdd_ul_dl_configuration->nrofDownlinkSymbols = nrofDownlinkSymbols; - p_tdd_ul_dl_configuration->nrofUplinkSlots = nrofUplinkSlots; - p_tdd_ul_dl_configuration->nrofUplinkSymbols = nrofUplinkSymbols; - - frame_parms->p_tdd_UL_DL_Configuration = p_tdd_ul_dl_configuration; + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<numerology_index) * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame; - + 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)); + } + 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 (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++) { frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_DOWNLINK_SLOT; @@ -93,7 +114,7 @@ int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeri slot_number++; } - if (p_tdd_ul_dl_configuration->nrofDownlinkSymbols != 0 || p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) { + if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) { frame_parms->tdd_uplink_nr[slot_number] = (1<nrofUplinkSymbols != 0) { + 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 (0); } @@ -253,29 +274,58 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) * *********************************************************************/ -int nr_slot_select(NR_DL_FRAME_PARMS *frame_parms, 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 */ - if (frame_parms->frame_type == FDD) { + int mu = cfg->ssb_config.scs_common.value,check_slot=0; + + if (cfg->cell_config.frame_duplex_type.value == FDD) { return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT ); } if (nr_frame%2 == 0) { - if (frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_UPLINK_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); } - else if(frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_DOWNLINK_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_S_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_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_UPLINK_SLOT)) { - return (NR_UPLINK_SLOT); - } - else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_DOWNLINK_SLOT)) { - return (NR_DOWNLINK_SLOT); - } - else return (NR_S_SLOT); } /******************************************************************* diff --git a/openair1/SCHED_NR/phy_frame_config_nr.h b/openair1/SCHED_NR/phy_frame_config_nr.h index 0f148cbafe..ec888bdd35 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.h +++ b/openair1/SCHED_NR/phy_frame_config_nr.h @@ -47,7 +47,7 @@ * @param nrofUplinkSymbols number of uplink symbols @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ -int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, +int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, int mu,int dl_UL_TransmissionPeriodicity, int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSlots, int nrofUplinkSymbols); @@ -78,7 +78,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); * @param nr_tti : slot number @returns nr_slot_t : downlink or uplink */ -nr_slot_t nr_slot_select(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti); +nr_slot_t nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti); /** \brief This function frees tdd configuration for nr * @param frame_parms NR DL Frame parameters diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6b05771a6a..9e800a0960 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -159,7 +159,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; // 10ms is the frame length if ((cfg->cell_config.frame_duplex_type.value == TDD) && - ((nr_slot_select(fp,frame,slot)&NR_UPLINK_SLOT) > 0)) return; + ((nr_slot_select(cfg,frame,slot)&NR_UPLINK_SLOT) > 0)) return; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr.h b/openair1/SCHED_NR_UE/phy_frame_config_nr.h index 429dff221b..3ab6b862de 100644 --- a/openair1/SCHED_NR_UE/phy_frame_config_nr.h +++ b/openair1/SCHED_NR_UE/phy_frame_config_nr.h @@ -45,7 +45,7 @@ * @param nrofUplinkSymbols number of uplink symbols @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ -int set_tdd_config_nr(NR_DL_FRAME_PARMS *frame_parms, int dl_UL_TransmissionPeriodicity, +int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, int mu, int dl_UL_TransmissionPeriodicity, int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSlots, int nrofUplinkSymbols); diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 83f422b100..3a5a7911e1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -41,6 +41,7 @@ #include "NR_ServingCellConfigCommon.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "SCHED_NR/phy_frame_config_nr.h" #include "NR_MIB.h" @@ -226,14 +227,6 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc; int i; - // TDD Configuration - cfg->tdd_ul_dl_config.referenceSubcarrierSpacing.value = scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; - cfg->tdd_ul_dl_config.dl_ul_periodicity.value = 5000;//scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;// rakesh:need to configure properly - cfg->tdd_ul_dl_config.nrofDownlinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; - cfg->tdd_ul_dl_config.nrofDownlinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols; - cfg->tdd_ul_dl_config.nrofUplinkSlots.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; - cfg->tdd_ul_dl_config.nrofUplinkSymbols.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; - // Carrier configuration cfg->carrier_config.dl_bandwidth.value = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, @@ -408,9 +401,26 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { cfg->num_tlv++; // TDD Table Configuration - cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; + //cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG; cfg->num_tlv++; + cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; + + if(cfg->cell_config.frame_duplex_type.value == TDD){ + int return_tdd = set_tdd_config_nr(cfg, + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + 5000, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols + ); + + if (return_tdd !=0){ + LOG_E(PHY,"TDD configuration can not be done\n"); + } + else LOG_I(PHY,"TDD has been properly configurated\n"); + } /* From 088652557d1e2e4a4ad999728f2504d4776b8e36 Mon Sep 17 00:00:00 2001 From: Rakesh Date: Wed, 11 Dec 2019 14:04:21 +0100 Subject: [PATCH 3/6] removing unused variable --- openair1/PHY/INIT/nr_init.c | 1 - openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 5dcb13387b..e75f785ab1 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -361,7 +361,6 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, void nr_phy_config_request(NR_PHY_Config_t *phy_config) { uint8_t Mod_id = phy_config->Mod_id; - int return_tdd; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 9e800a0960..d1e061973f 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -158,7 +158,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (cfg->ssb_table.ssb_period.value > 1) ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; // 10ms is the frame length - if ((cfg->cell_config.frame_duplex_type.value == TDD) && + if ((cfg->cell_config.frame_duplex_type.value == TDD) && ((nr_slot_select(cfg,frame,slot)&NR_UPLINK_SLOT) > 0)) return; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); From b398103be97ccf9ba5cb44a90be23fdb792af8ad Mon Sep 17 00:00:00 2001 From: Rakesh Date: Wed, 11 Dec 2019 20:45:44 +0100 Subject: [PATCH 4/6] Fix for dlulperiodicity --- openair1/SCHED_NR/phy_frame_config_nr.c | 35 ++++++++++++++++--- openair1/SCHED_NR/phy_frame_config_nr.h | 2 +- openair1/SCHED_NR_UE/phy_frame_config_nr.h | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 1 - .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index a60fee11ff..738030c903 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -52,14 +52,41 @@ *********************************************************************/ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, - int mu, int dl_UL_TransmissionPeriodicity, + int mu, int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSlots, int nrofUplinkSymbols) { - int slot_number = 0; + 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); + } int nb_slots_per_period = ((1<cell_config.frame_duplex_type.value == TDD){ int return_tdd = set_tdd_config_nr(cfg, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - 5000, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 591d614043..0058f53e2c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -169,7 +169,7 @@ gNBs = # pattern1 # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 0; + dl_UL_TransmissionPeriodicity = 6; nrofDownlinkSlots = 7; nrofDownlinkSymbols = 6; nrofUplinkSlots = 2; From 40ecb3f72b905050f016238bc1952f56c0efbdd0 Mon Sep 17 00:00:00 2001 From: Rakesh Date: Mon, 16 Dec 2019 13:07:08 +0100 Subject: [PATCH 5/6] first test to replicate to transmmit as same as NR_RRCConfiguration branch --- .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 0058f53e2c..5587d608e4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -170,10 +170,10 @@ gNBs = # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; + nrofDownlinkSlots = 2; + nrofDownlinkSymbols = 1; + nrofUplinkSlots = 7; + nrofUplinkSymbols = 7; ssPBCH_BlockPower = 10; } From 4510cd5f8772d355414629fa9ed22218d92d348f Mon Sep 17 00:00:00 2001 From: Rakesh Date: Mon, 16 Dec 2019 15:51:09 +0100 Subject: [PATCH 6/6] bug fix --- executables/nr-ru.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e187ba840c..824d22ed3f 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -727,28 +727,28 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) { - int siglen=fp->samples_per_tti,flags=1; + int siglen=fp->samples_per_slot,flags=1; if(slot_type == NR_MIXED_SLOT) { - txsymb = 0; - for(int symbol_count =0;symbol_counttdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { - txsymb++; - } - } - AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); - siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) - + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + txsymb = 0; + for(int symbol_count =0;symbol_counttdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { + txsymb++; + } + } + AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); //+ ru->end_of_burst_delay; flags=3; // end of burst - } + } - if (cfg->cell_config.frame_duplex_type.value == TDD && - slot_type == NR_DOWNLINK_SLOT && - prevslot_type == NR_UPLINK_SLOT) { - flags = 2; // start of burst - //sf_extension = ru->sf_extension; - } + if (cfg->cell_config.frame_duplex_type.value == TDD && + slot_type == NR_DOWNLINK_SLOT && + prevslot_type == NR_UPLINK_SLOT) { + flags = 2; // start of burst + //sf_extension = ru->sf_extension; + } /*if ((slot == 0) || (slot == 1)) {