diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 708932d322..7209595b41 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1586,11 +1586,13 @@ void *ru_thread( void *param ) { for(i = 0;i < NUMBER_OF_NR_RU_PRACH_MAX; i++) { int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); if (prach_id>=0) { + for(int td_index = 0;td_index < ru->prach_list[prach_id].num_prach_ocas; td_index++) { rx_nr_prach_ru(ru, ru->prach_list[prach_id].fmt, ru->prach_list[prach_id].numRA, - ru->prach_list[prach_id].prachStartSymbol, + ru->prach_list[prach_id].prachStartSymbol + td_index * 4,/*TODO Change the start symbol as needed for each RO*/ proc->frame_rx,proc->tti_rx); + } free_nr_ru_prach_entry(ru,prach_id); } } diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 90af0bc869..9fbd37ad3c 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -321,6 +321,7 @@ typedef enum { #define NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG 0x1012 #define NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG 0x1013 #define NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG 0x1014 +#define NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG 0x1029 #define NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG 0x1015 #define NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG 0x1016 #define NFAPI_NR_CONFIG_K1_TAG 0x1017 @@ -400,6 +401,7 @@ typedef struct nfapi_uint8_tlv_t prach_sub_c_spacing;//Subcarrier spacing of PRACH. [38.211 sec 4.2] Value:0->4 nfapi_uint8_tlv_t restricted_set_config;//PRACH restricted set config Value: 0: unrestricted 1: restricted set type A 2: restricted set type B nfapi_uint8_tlv_t num_prach_fd_occasions;//Corresponds to the parameter 𝑀 in [38.211, sec 6.3.3.2] which equals the higher layer parameter msg1FDM Value: 1,2,4,8 + nfapi_uint8_tlv_t prach_ConfigurationIndex;//PRACH configuration index. Value:0->255 nfapi_nr_num_prach_fd_occasions_t* num_prach_fd_occasions_list; nfapi_uint8_tlv_t ssb_per_rach;//SSB-per-RACH-occasion Value: 0: 1/8 1:1/4, 2:1/2 3:1 4:2 5:4, 6:8 7:16 nfapi_uint8_tlv_t prach_multiple_carriers_in_a_band;//0 = disabled 1 = enabled diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 44084b6da5..f8e0cb3008 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -140,6 +140,7 @@ void nr_fill_prach_ru(RU_t *ru, ru->prach_list[prach_id].fmt = prach_pdu->prach_format; ru->prach_list[prach_id].numRA = prach_pdu->num_ra; ru->prach_list[prach_id].prachStartSymbol = prach_pdu->prach_start_symbol; + ru->prach_list[prach_id].num_prach_ocas = prach_pdu->num_prach_ocas; pthread_mutex_unlock(&ru->prach_list_mutex); } diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index b8083b5ecf..79a738ada1 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -191,6 +191,7 @@ typedef struct { int fmt; int numRA; int prachStartSymbol; + int num_prach_ocas; } RU_PRACH_list_t; #define NUMBER_OF_NR_RU_PRACH_MAX 8 diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 7a9a501cde..09cafd92bf 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -81,6 +81,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { int prach_id=find_nr_prach(gNB,frame,slot,SEARCH_EXIST); if (prach_id>=0) { prach_pdu = &gNB->prach_vars.list[prach_id].pdu; + for(int td_index = 0; td_index < prach_pdu->num_prach_ocas; td_index++) { rx_nr_prach(gNB, prach_pdu, @@ -119,7 +120,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { gNB->UL_INFO.rach_ind.number_of_pdus += 1; gNB->prach_pdu_indication_list[pdu_index].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value; - gNB->prach_pdu_indication_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol; + gNB->prach_pdu_indication_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol + td_index * 4;/*TODO Need to add duration based on prach config index*/ gNB->prach_pdu_indication_list[pdu_index].slot_index = slot; gNB->prach_pdu_indication_list[pdu_index].freq_index = prach_pdu->num_ra; gNB->prach_pdu_indication_list[pdu_index].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254; @@ -136,6 +137,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++; } + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0); } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 0139131f42..f9855f1949 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -194,6 +194,10 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions.tl.tag = NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG; cfg->num_tlv++; + cfg->prach_config.prach_ConfigurationIndex.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; + cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; + cfg->num_tlv++; + cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions.value*sizeof(nfapi_nr_num_prach_fd_occasions_t)); for (i=0; iprach_config.num_prach_fd_occasions.value; i++) { // cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 49ae2cdf6a..9b778ad562 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -205,7 +205,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; - uint8_t mu,N_dur,N_t_slot,start_symbol = 0,temp_start_symbol = 0,N_RA_slot; + uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint16_t RA_sfn_index = -1; uint8_t config_period = 1; uint16_t format; @@ -237,30 +237,23 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP if (N_RA_slot > 1) { //more than 1 PRACH slot in a subframe if (slotP%2 == 1){ - N_RA_slot = 1; //Even PRACH slot slot_index = 1; } else { slot_index = 0; - N_RA_slot = 0; //Odd PRACH slot } }else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe - N_RA_slot = 0; slot_index = 0; - if((mu == 1) || (mu == 3)) - N_RA_slot = 1; //For scs = 30khz and 120khz } -// start_symbol = start_symbol_from_configuration + N_t_slot * N_dur + 14 * N_RA_slot; - for (int index=0; indexSFN = frameP; UL_tti_req->Slot = slotP; - for (int n=0; n < fdm; n++) { // one structure per frequency domain occasion + for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion + for (int td_index=0; td_indexmax_association_period * config_period))/config_period) * cc->total_prach_occasions_per_config_period) + (RA_sfn_index + slot_index) * N_t_slot * fdm + index * fdm + n; - if(prach_occasion_id < cc->total_prach_occasions){ + prach_occasion_id = (((frameP % (cc->max_association_period * config_period))/config_period) * cc->total_prach_occasions_per_config_period) + (RA_sfn_index + slot_index) * N_t_slot * fdm + td_index * fdm + fdm_index; + if((prach_occasion_id < cc->total_prach_occasions) && (td_index == 0)){ UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE; UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_prach_pdu_t); @@ -271,8 +264,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP // filling the prach fapi structure prach_pdu->phys_cell_id = *scc->physCellId; prach_pdu->num_prach_ocas = N_t_slot; - prach_pdu->prach_start_symbol = temp_start_symbol; - prach_pdu->num_ra = n; + prach_pdu->prach_start_symbol = start_symbol; + prach_pdu->num_ra = fdm_index; prach_pdu->num_cs = get_NCS(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig, format0, scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig);