diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_defs.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_defs.h index 940d842550ea116aa496d3d81a1449e43dd7bb6b..597e27cb08390af29a183ddf821aa065f0642b8b 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_defs.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_defs.h @@ -97,7 +97,7 @@ #define NR_LDPC_SIZE_BN_PROC_BUF NR_LDPC_NUM_EDGE_BG1*NR_LDPC_ZMAX /** Maximum number of possible input LLR = NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX */ -#define NR_LDPC_MAX_NUM_LLR 26112 +#define NR_LDPC_MAX_NUM_LLR 27000 // ============================================================================== // GLOBAL CONSTANT VARIABLES diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 96919325184c21c384c00af0f83be70075f90584..0cffc2d85200d7783381e4739884d5960665b671 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -334,7 +334,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, uint8_t rvidx, uint32_t E) { - uint32_t Ncb,ind,k,Nref,N; + uint32_t Ncb,ind,k=0,Nref,N; if (C==0) { printf("nr_rate_matching: invalid parameters (C %d\n",C); diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 49e14c4c3141b26086ab57d30f22d68576d6d075..268f2f5fcf6231da599bf8d2f386a998ad87424e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -32,6 +32,7 @@ #include "PHY/defs_gNB.h" #include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" extern uint16_t NCS_unrestricted_delta_f_RA_125[16]; extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15]; @@ -381,7 +382,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, int16_t **rxsigF = gNB->prach_vars.rxsigF; uint8_t preamble_index; - uint16_t NCS,NCS2; + uint16_t NCS=99,NCS2; uint16_t preamble_offset=0,preamble_offset_old; int16_t preamble_shift=0; uint32_t preamble_shift2; @@ -393,7 +394,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, uint16_t u; int16_t *Xu=0; uint16_t offset; - int16_t Ncp; uint16_t first_nonzero_root_idx=0; uint8_t new_dft=0; uint8_t aa; @@ -454,6 +454,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, NCS = NCS_unrestricted_delta_f_RA_15[Ncs_config]; } + AssertFatal(NCS!=99,"NCS has not been set\n"); + if (gNB) start_meas(&gNB->rx_prach); diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c index cd7a83dc15e973ab933c9d035daaecd8c911f951..e1b80a87a2f16e0d279997e3d512c4caa92366db 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c @@ -40,6 +40,8 @@ #include "T.h" +void init_nr_prach_tables(int N_ZC); + void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { FILE *fd; diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport.h b/openair1/PHY/NR_TRANSPORT/nr_transport.h index a485351cd3ace79c7eca793493191a7834da2b1d..c40b8efdb42af78c8d4bf0ba6e53bf7a5b9adb76 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport.h @@ -23,6 +23,7 @@ #define __NR_TRANSPORT__H__ #include "PHY/defs_gNB.h" +#include "LAYER2/NR_MAC_gNB/mac_proto.h" #define NR_PBCH_PDU_BITS 24 diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 8d220a76bb84d3419b8d1d1e9b6f195ccb8e3c65..971018e734d3abd39ace6418a62c0024808fee36 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -206,3 +206,11 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx); uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx); uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx); + +void rx_nr_prach(PHY_VARS_gNB *gNB, + int frame, + int subframe, + uint16_t *max_preamble, + uint16_t *max_preamble_energy, + uint16_t *max_preamble_delay + ); diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h index 15e66477c3ab80aa7c19aa945c1af900b455ce37..dd37455e2629898363ed1184151f7959200da1cd 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h @@ -1648,6 +1648,8 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); */ uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint16_t get_nr_prach_fmt(int prach_ConfigIndex,lte_frame_type_t frame_type, nr_frequency_range_e fr); + /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @param frame_parms Pointer to NR_DL_FRAME_PARMS structure diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 34fff12148d9e6e9e47cd0c2f9b8631eac31d45a..c86ad2ab03a6bdd6674734235f0d3990ae9cb2dd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -46,7 +46,7 @@ //#define DEBUG_DLSCH_DECODING 1 //#define ENABLE_PHY_PAYLOAD_DEBUG 1 -#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX +//#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX static uint64_t nb_total_decod =0; static uint64_t nb_error_decod =0; @@ -85,13 +85,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) for (r=0; r<a_segments; r++) if (dlsch->harq_processes[i]->d[r]) { - free16(dlsch->harq_processes[i]->d[r],(3*8448)*sizeof(short)); + free16(dlsch->harq_processes[i]->d[r],(5*8448)*sizeof(short)); dlsch->harq_processes[i]->d[r] = NULL; } for (r=0; r<a_segments; r++) if (dlsch->harq_processes[i]->w[r]) { - free16(dlsch->harq_processes[i]->w[r],(3*8448)*sizeof(short)); + free16(dlsch->harq_processes[i]->w[r],(5*8448)*sizeof(short)); dlsch->harq_processes[i]->w[r] = NULL; } @@ -122,7 +122,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint if (N_RB_DL != 273) { a_segments = a_segments*N_RB_DL; - a_segments = a_segments/273; + a_segments = (a_segments/273)+1; } uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment @@ -161,17 +161,17 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint else exit_flag=2; - dlsch->harq_processes[i]->d[r] = (short*)malloc16((3*8448)*sizeof(short)); + dlsch->harq_processes[i]->d[r] = (short*)malloc16((5*8448)*sizeof(short)); if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,(3*8448)*sizeof(short)); + memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short)); else exit_flag=2; - dlsch->harq_processes[i]->w[r] = (short*)malloc16((3*8448)*sizeof(short)); + dlsch->harq_processes[i]->w[r] = (short*)malloc16((5*8448)*sizeof(short)); if (dlsch->harq_processes[i]->w[r]) - memset(dlsch->harq_processes[i]->w[r],0,(3*8448)*sizeof(short)); + memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short)); else exit_flag=2; } @@ -238,7 +238,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int32_t no_iteration_ldpc, length_dec; uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0; uint8_t crc_type; - int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); + int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_time_stats procTime; @@ -782,7 +782,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats* p_procTime =&procTime ; - int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); + int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); if (!harq_process) { printf("dlsch_decoding.c: NULL harq_process pointer\n"); return(dlsch->max_ldpc_iterations); @@ -1349,7 +1349,7 @@ void *nr_dlsch_decoding_process(void *arg) t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats* p_procTime =&procTime ; - int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); + int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); t_nrLDPC_procBuf* p_nrLDPC_procBuf; int16_t z [68*384]; int8_t l [68*384]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 8f02464119c3a08f2b8d4a1d39b9c65358894335..b60843fab8c6d91a1b2a2bf9c56fb957584a3156 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -234,7 +234,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_rb = dlsch0_harq->start_rb; nb_rb_pdsch = dlsch0_harq->nb_rb; - int lbar; DevAssert(dlsch0_harq); round = dlsch0_harq->round; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index f976da0a3a83adaf1d069ea70a49e2cf2b5111a0..ca87ed1faeca78d04d94bb8ea4963d879ef3ff45 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -42,6 +42,8 @@ #include "UTIL/LISTS/list.h" #endif +#include "LAYER2/NR_MAC_gNB/mac_proto.h" + //#include "../LTE_TRANSPORT/transport_common.h" // structures below implement 36-211 and 36-212 diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 00485476242acf26df90f12fcb84d1307542c559..20357aeb4e13a7f27d832979ee9fe661b8cd358f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -39,7 +39,7 @@ #include "PHY/CODING/nrLDPC_encoder/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "common/utils/LOG/vcd_signal_dumper.h" - +#include "LAYER2/NR_MAC_gNB/mac_proto.h" void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL) diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index e8f7b2bba4d4a2516236b3ccb87ded981f74b8f2..5c145a32302575038f71d269950e8a2f2685a90d 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -132,7 +132,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ PHY_VARS_gNB *gNB; // copy data from L2 interface into L1 structures module_id_t Mod_id = Sched_INFO->module_id; - uint8_t CC_id = Sched_INFO->CC_id; nfapi_nr_dl_tti_request_t *DL_req = Sched_INFO->DL_req; nfapi_nr_tx_data_request_t *TX_req = Sched_INFO->TX_req; nfapi_nr_ul_tti_request_t *UL_tti_req = Sched_INFO->UL_tti_req; @@ -146,18 +145,16 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ gNB = RC.gNB[Mod_id]; uint8_t number_dl_pdu = DL_req->dl_tti_request_body.nPDUs; - uint8_t number_ul_pdu = 0; + // uint8_t number_ul_pdu = 0; uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus; - if (UL_tti_req != NULL) number_ul_pdu = UL_tti_req->n_pdus; + // if (UL_tti_req != NULL) number_ul_pdu = UL_tti_req->n_pdus; LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d%d DL_req:SFN/SLO:%04d%d:dl_pdu:%d tx_req:SFN/SLOT:%04d%d:pdus:%d;\n", frame,slot, DL_req->SFN,DL_req->Slot,number_dl_pdu, TX_req->SFN,TX_req->Slot,TX_req->Number_of_PDUs); - int do_oai =0; - int dont_send =0; int pdcch_received=0; gNB->num_pdsch_rnti=0; gNB->pdcch_pdu = NULL; @@ -169,7 +166,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ switch (dl_tti_pdu->PDUType) { case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: gNB->pbch_configured=1; - do_oai=1; handle_nr_nfapi_ssb_pdu(gNB,frame,slot, dl_tti_pdu); @@ -183,19 +179,17 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ &dl_tti_pdu->pdcch_pdu); pdcch_received = 1; - do_oai=1; + break; case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: { nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel15; uint16_t pduIndex = pdsch_pdu_rel15->pduIndex; - uint16_t tx_pdus = TX_req->Number_of_PDUs; AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n", pduIndex,TX_req->pdu_list[pduIndex].num_TLV); - uint8_t *sdu = TX_req->pdu_list[pduIndex].TLVs[0].value.direct; + uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu); - do_oai=1; } } } diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 2c8abc42136de6e68ff45515aceb0a16053eaa0c..b9a8ba94f1eefa6559da89beff7ece19282345cb 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -30,9 +30,9 @@ * \warning */ -#include "PHY/defs_eNB.h" +#include "PHY/defs_gNB.h" #include "PHY/phy_extern.h" -#include "SCHED/sched_eNB.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "nfapi_nr_interface_scf.h" #include "fapi_nr_l1.h" #include "nfapi_pnf.h" @@ -71,12 +71,13 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int subframe) { for (i=0;i<gNB->num_RU;i++) { ru=gNB->RU_list[i]; for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) { - gNB->prach_vars.rxsigF[0][aa] = gNB->RU_list[i]->prach_rxsigF[ru_aa]; + gNB->prach_vars.rxsigF[aa] = gNB->RU_list[i]->prach_rxsigF[ru_aa]; } } rx_nr_prach(gNB, - 0, + frame, + subframe, &max_preamble[0], &max_preamble_energy[0], &max_preamble_delay[0] diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 8cab8a5292670116420b72f3dd5ec6a2902c0cab..cd0599c3a16d9532b2d142f57bc68a1445e48848 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -3273,7 +3273,7 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB if (!dlsch1) { int harq_pid = dlsch0->current_harq_pid; uint16_t BWPStart = dlsch0->harq_processes[harq_pid]->BWPStart; - uint16_t BWPSize = dlsch0->harq_processes[harq_pid]->BWPSize; + // uint16_t BWPSize = dlsch0->harq_processes[harq_pid]->BWPSize; uint16_t pdsch_start_rb = dlsch0->harq_processes[harq_pid]->start_rb; uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index e44e8b4e2e3105f8dada540c34fa814c43b229c6..07b6b296675b2e7b5eff73ad1808fac811a7276b 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -621,7 +621,7 @@ int main(int argc, char **argv) - nr_l2_init_ue(); + nr_l2_init_ue(NULL); UE_mac = get_mac_inst(0); UE->if_inst = nr_ue_if_module_init(0); @@ -658,7 +658,7 @@ int main(int argc, char **argv) rrc.carrier.MIB = (uint8_t*) malloc(4); rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0); - nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,scc,secondaryCellGroup->spCellConfig); + nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,secondaryCellGroup->spCellConfig); nr_dcireq_t dcireq; diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index b142d54642b5c27e3b08b1badae4deea77fb88e8..be1e85236087a4a84e3827dcba529f345480fc52 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -44,17 +44,18 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) //init mac here nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST); - - nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config->spCellConfig); - - if (IS_SOFTMODEM_NOS1){ + if (rrc_inst) { + nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config->spCellConfig); + + if (IS_SOFTMODEM_NOS1){ if (rlc_module_init(0) != 0) { - LOG_I(RLC, "Problem at RLC initiation \n"); + LOG_I(RLC, "Problem at RLC initiation \n"); } pdcp_layer_init(); nr_ip_over_LTE_DRB_preconfiguration(); + } } - + else LOG_I(MAC,"Running without RRC instance\n"); return (nr_ue_mac_inst); }