diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index d8a16312ad..8580a0491b 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -25,6 +25,9 @@ #define NR_NB_SC_PER_RB 12 #define NR_MAX_NUM_LCID 32 #define NR_MAX_NUM_QFI 64 +#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 36 +#define MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER 34 +#define NR_MAX_SLOTS_PER_FRAME 160 #define RNTI_NAMES /* see 38.321 Table 7.1-2 RNTI usage */ \ R(TYPE_C_RNTI_) /* Cell RNTI */ \ R(TYPE_CS_RNTI_) /* Configured Scheduling RNTI */ \ @@ -41,6 +44,11 @@ R(TYPE_TPC_SRS_RNTI_) \ R(TYPE_MCS_C_RNTI_) +/* FFS_NR_TODO it defines ue capability which is the number of slots */ +/* - between reception of pdsch and transmission of its acknowlegment (k1) */ +/* - between reception of un uplink grant and its related transmission (k2) */ +#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (3) + #define R(k) k , typedef enum { RNTI_NAMES } nr_rnti_type_t; #undef R diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f6e73b9e6a..8a10fade9a 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -982,7 +982,7 @@ void *ru_thread(void *param) // Do PRACH RU processing prach_item_t *p = - find_nr_prach(&gNB->prach_list, proc->frame_rx, proc->tti_rx, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST); + find_nr_prach(&gNB->prach_list, proc->frame_rx, proc->tti_rx, gNB->frame_parms.nb_antennas_rx, NR_SEARCH_EXIST); if (p) { // need to extract RACH data for later processing by rx_nr_prach() rx_nr_prach_ru(p, ru->common.rxdata, ru->nr_frame_parms, ru->N_TA_offset); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index cf5762e8c7..ac7dace077 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -5,7 +5,6 @@ #include "PHY/defs_nr_common.h" #define _GNU_SOURCE // For pthread_setname_np #include -#include #include "executables/nr-ue-ru.h" #include "executables/nr-uesoftmodem.h" #include "PHY/INIT/nr_phy_init.h" diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index dd10a86a59..187580cd94 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1090,14 +1090,13 @@ void pnf_nr_phy_deallocate_p7_vendor_ext(void *header) } -int pnf_phy_hi_dci0_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_hi_dci0_request_t *req) { +int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_hi_dci0_request_t *req) { if (req->hi_dci0_request_body.number_of_dci == 0 && req->hi_dci0_request_body.number_of_hi == 0) LOG_D(PHY,"[PNF] HI_DCI0_REQUEST SFN/SF:%05d dci:%d hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi); //phy_info* phy = (phy_info*)(pnf_p7->user_data); struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - if (proc ==NULL) - proc = &eNB->proc.L1_proc; + L1_rxtx_proc_t *proc = &eNB->proc.L1_proc; for (int i=0; ihi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi; i++) { //LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i); @@ -1119,7 +1118,7 @@ int pnf_phy_hi_dci0_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfa } -int pnf_phy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) { +int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) { if (RC.eNB == 0) { return -2; @@ -1137,8 +1136,7 @@ int pnf_phy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, n int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); int sf = NFAPI_SFNSF2SF(req->sfn_sf); struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - if (proc==NULL) - proc = &eNB->proc.L1_proc; + L1_rxtx_proc_t *proc = &eNB->proc.L1_proc; nfapi_dl_config_request_pdu_t *dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list; LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[sf&1]; pdcch_vars->num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols; @@ -1236,7 +1234,7 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { return 0; } -int pnf_phy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_ul_config_request_t *req) { +int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_ul_config_request_t *req) { if (0)LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), @@ -1262,8 +1260,7 @@ int pnf_phy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, n uint16_t curr_sfn = NFAPI_SFNSF2SFN(req->sfn_sf); uint16_t curr_sf = NFAPI_SFNSF2SF(req->sfn_sf); struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - if (proc==NULL) - proc = &eNB->proc.L1_proc; + L1_rxtx_proc_t *proc = &eNB->proc.L1_proc; nfapi_ul_config_request_pdu_t *ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list; for (int i=0; iul_config_request_body.number_of_pdus; i++) { diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index da0b0ee78b..1ccaf2ee68 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -10,7 +10,6 @@ #include "stddef.h" #include "common/platform_types.h" #include "fapi_nr_ue_constants.h" -#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_nr.h" #include "common/utils/nr/nr_common.h" #include "executables/position_interface.h" diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h index 6cf323da78..7e6926627a 100644 --- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h +++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h @@ -706,7 +706,7 @@ typedef struct nfapi_pnf_p7_config * \return not currently used */ int (*dl_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_dl_tti_request_t* req); - int (*dl_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req); + int (*dl_config_req)(nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req); /*! A callback for the UL_CONFIG.request * \param config A poiner to the PNF P7 config @@ -714,7 +714,7 @@ typedef struct nfapi_pnf_p7_config * \return not currently used */ int (*ul_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req); - int (*ul_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req); + int (*ul_config_req)(nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req); /*! A callback for the HI_DCI0.request * \param config A poiner to the PNF P7 config @@ -722,7 +722,7 @@ typedef struct nfapi_pnf_p7_config * \return not currently used */ int (*ul_dci_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req); - int (*hi_dci0_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req); + int (*hi_dci0_req)(nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req); /*! A callback for the TX_REQ.request * \param config A poiner to the PNF P7 config diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index f935e30fb6..0b3ac77d86 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -639,20 +639,20 @@ void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf) { pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf; //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - enter\n"); - (pnf_p7->_public.dl_config_req)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req); + (pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req); //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - exit\n"); } if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req) { pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf; NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy ul_config_req - enter\n"); - (pnf_p7->_public.ul_config_req)(NULL, &pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req); + (pnf_p7->_public.ul_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req); } if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req) { pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf; NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy hi_dci0 - enter\n"); - (pnf_p7->_public.hi_dci0_req)(NULL, &pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req); + (pnf_p7->_public.hi_dci0_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req); } if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req) { @@ -892,7 +892,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(tx_subframe_buffer->dl_config_req != 0) { if(pnf_p7->_public.dl_config_req) - (pnf_p7->_public.dl_config_req)(NULL, &(pnf_p7->_public), tx_subframe_buffer->dl_config_req); + (pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), tx_subframe_buffer->dl_config_req); //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7); } @@ -902,14 +902,14 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req) { pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf_tx; - (pnf_p7->_public.dl_config_req)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req); + (pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req); } } if(tx_subframe_buffer->hi_dci0_req != 0) { if(pnf_p7->_public.hi_dci0_req) - (pnf_p7->_public.hi_dci0_req)(NULL, &(pnf_p7->_public), tx_subframe_buffer->hi_dci0_req); + (pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), tx_subframe_buffer->hi_dci0_req); //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7); } @@ -919,7 +919,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req) { pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf_tx; - (pnf_p7->_public.hi_dci0_req)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_subframe.hi_dci0_req); + (pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.hi_dci0_req); } } @@ -970,7 +970,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(subframe_buffer->ul_config_req != 0) { if(pnf_p7->_public.ul_config_req) - (pnf_p7->_public.ul_config_req)(NULL, &(pnf_p7->_public), subframe_buffer->ul_config_req); + (pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req); //deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7); } @@ -980,7 +980,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req) { pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf; - (pnf_p7->_public.ul_config_req)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req); + (pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req); } } diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index 7503854c07..b705a1f81f 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -10,6 +10,7 @@ #include #include +#include #include "common/utils/nr/nr_common.h" #define CRC24_A 0 @@ -20,6 +21,37 @@ #define MAX_TURBO_ITERATIONS_MBSFN 8 #define MAX_TURBO_ITERATIONS max_turbo_iterations +typedef struct { + pthread_mutex_t mutex_failure; + bool failed; +} decode_abort_t; + +static inline void init_abort(decode_abort_t *ab) +{ + int ret = pthread_mutex_init(&ab->mutex_failure, NULL); + AssertFatal(ret == 0, "mutex failed with %d\n", ret); + ab->failed = false; +} + +static inline bool check_abort(decode_abort_t *ab) +{ + int ret = pthread_mutex_lock(&ab->mutex_failure); + AssertFatal(ret == 0, "mutex failed with %d\n", ret); + bool failed = ab->failed; + ret = pthread_mutex_unlock(&ab->mutex_failure); + AssertFatal(ret == 0, "mutex failed with %d\n", ret); + return failed; +} + +static inline void set_abort(decode_abort_t *ab, bool v) +{ + int ret = pthread_mutex_lock(&ab->mutex_failure); + AssertFatal(ret == 0, "mutex failed with %d\n", ret); + ab->failed = v; + ret = pthread_mutex_unlock(&ab->mutex_failure); + AssertFatal(ret == 0, "mutex failed with %d\n", ret); +} + static inline int lenWithCrc(int nbSeg, int len) { if (nbSeg > 1) diff --git a/openair1/PHY/CODING/nrLDPC_defs.h b/openair1/PHY/CODING/nrLDPC_defs.h index e63bbf855f..70d4f92761 100644 --- a/openair1/PHY/CODING/nrLDPC_defs.h +++ b/openair1/PHY/CODING/nrLDPC_defs.h @@ -7,6 +7,7 @@ #define __NRLDPC_DEFS__H__ #include #include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" +#include "common/utils/threadPool/task_ans.h" /** \brief LDPC encoder parameter structure diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 865fbc5dc4..ab11be251d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -1,10 +1,9 @@ /* * SPDX-License-Identifier: LicenseRef-CSSL-1.0 */ - +#include #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/sse_intrin.h" -#include "PHY/impl_defs_top.h" // #define DEBUG_NEW_IMPL 1 diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 8fb5c3b124..ed3dbfc75a 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -322,8 +322,8 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue) sl_ue_free(ue); } -void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb) { - +void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb) +{ uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; if (num_rb != 273) { a_segments = a_segments*num_rb; @@ -344,8 +344,8 @@ void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES } } -void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx) { - +void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx) +{ int max_layers = (num_ant_tx < NR_MAX_NB_LAYERS) ? num_ant_tx : NR_MAX_NB_LAYERS; uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated @@ -371,12 +371,12 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) { const int N_RB_DL = ue->frame_parms.N_RB_DL; const int N_RB_UL = ue->frame_parms.N_RB_UL; - free_nr_ue_dl_harq(ue->dl_harq_processes, NR_MAX_DLSCH_HARQ_PROCESSES, N_RB_DL); - free_nr_ue_ul_harq(ue->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, N_RB_UL, ue->frame_parms.nb_antennas_tx); + free_nr_ue_dl_harq(ue->dl_harq_processes, NR_MAX_HARQ_PROCESSES, N_RB_DL); + free_nr_ue_ul_harq(ue->ul_harq_processes, NR_MAX_HARQ_PROCESSES, N_RB_UL, ue->frame_parms.nb_antennas_tx); } -void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb) { - +void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb) +{ int a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated if (num_rb != 273) { a_segments = a_segments*num_rb; @@ -403,8 +403,8 @@ void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PR } } -void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx) { - +void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx) +{ int max_layers = (num_ant_tx < NR_MAX_NB_LAYERS) ? num_ant_tx : NR_MAX_NB_LAYERS; uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated @@ -447,24 +447,21 @@ void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCE } } -void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { - - nr_init_dl_harq_processes(ue->dl_harq_processes, NR_MAX_DLSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_DL); - nr_init_ul_harq_processes(ue->ul_harq_processes, - NR_MAX_ULSCH_HARQ_PROCESSES, - ue->frame_parms.N_RB_UL, - ue->frame_parms.nb_antennas_tx); +void init_nr_ue_transport(PHY_VARS_NR_UE *ue) +{ + nr_init_dl_harq_processes(ue->dl_harq_processes, NR_MAX_HARQ_PROCESSES, ue->frame_parms.N_RB_DL); + nr_init_ul_harq_processes(ue->ul_harq_processes, NR_MAX_HARQ_PROCESSES, ue->frame_parms.N_RB_UL, ue->frame_parms.nb_antennas_tx); } void clean_UE_harq(PHY_VARS_NR_UE *UE) { - for (int harq_pid = 0; harq_pid < NR_MAX_DLSCH_HARQ_PROCESSES; harq_pid++) { + for (int harq_pid = 0; harq_pid < NR_MAX_HARQ_PROCESSES; harq_pid++) { for (int i = 0; i < 2; i++) { NR_DL_UE_HARQ_t *dl_harq_process = &UE->dl_harq_processes[i][harq_pid]; init_downlink_harq_status(dl_harq_process); } } - for (int harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) { + for (int harq_pid = 0; harq_pid < NR_MAX_HARQ_PROCESSES; harq_pid++) { NR_UL_UE_HARQ_t *ul_harq_process = &UE->ul_harq_processes[harq_pid]; ul_harq_process->round = 0; } diff --git a/openair1/PHY/INIT/nr_phy_init.h b/openair1/PHY/INIT/nr_phy_init.h index 38d691f675..d18106c7b9 100644 --- a/openair1/PHY/INIT/nr_phy_init.h +++ b/openair1/PHY/INIT/nr_phy_init.h @@ -24,10 +24,10 @@ void reset_nr_transport(PHY_VARS_gNB *gNB); void RCconfig_nrUE_prs(void *cfg); void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue); -void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); -void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); -void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); -void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); +void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb); +void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); +void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb); +void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); void phy_init_nr_top(PHY_VARS_NR_UE *ue); void phy_term_nr_top(void); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index af1546a43e..210373ad74 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -8,6 +8,7 @@ #ifndef __LTE_TRANSPORT_PROTO_UE__H__ #define __LTE_TRANSPORT_PROTO_UE__H__ #include "PHY/defs_UE.h" +#include "PHY/defs_eNB.h" #include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include #include "nfapi_interface.h" diff --git a/openair1/PHY/MODULATION/modulation_common.h b/openair1/PHY/MODULATION/modulation_common.h index 956e546931..b0b6172175 100644 --- a/openair1/PHY/MODULATION/modulation_common.h +++ b/openair1/PHY/MODULATION/modulation_common.h @@ -10,6 +10,14 @@ * @{ */ +/*! \brief Extension Type */ +typedef enum { + CYCLIC_PREFIX, + CYCLIC_SUFFIX, + ZEROS, + NONE +} Extension_t; + /** \fn void PHY_ofdm_mod(int *input,int *output,int fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype) This function performs OFDM modulation with cyclic extension or zero-padding diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index 32deaf440e..8b55d14a09 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -154,88 +154,6 @@ void pseudo_random_sequence_optimised(unsigned int size, uint32_t *c, uint32_t c } } -/******************************************************************* -* -* NAME : lte_gold_new -* -* PARAMETERS : -* -* RETURN : generate pseudo-random sequence which is a length-31 Gold sequence -* -* DESCRIPTION : This function is the same as "lte_gold" function in file lte_gold.c -* It allows checking that optimization works fine. -* generated sequence is given in an array as a bit map. -* -*********************************************************************/ - -#define CELL_DMRS_LENGTH (224*2) -#define CHECK_GOLD_SEQUENCE - -void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2][14], uint16_t Nid_cell) -{ - unsigned char ns,l,Ncp=1-frame_parms->Ncp; - uint32_t cinit; - -#ifdef CHECK_GOLD_SEQUENCE - - uint32_t dmrs_bitmap[20][2][14]; - uint32_t *dmrs_sequence = calloc(CELL_DMRS_LENGTH, sizeof(uint32_t)); - if (dmrs_sequence == NULL) { - msg("Fatal error: memory allocation problem \n"); - assert(0); - } - else - { - printf("Check of demodulation reference signal of pbch sequence \n"); - } - -#endif - - /* for each slot number */ - for (ns=0; ns<20; ns++) { - - /* for each ofdm position */ - for (l=0; l<2; l++) { - - cinit = Ncp + - (Nid_cell<<1) + - (((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); - - pseudo_random_sequence_optimised(14, &(lte_gold_table[ns][l][0]), cinit); - -#ifdef CHECK_GOLD_SEQUENCE - - pseudo_random_sequence(CELL_DMRS_LENGTH, dmrs_sequence, cinit); - - int j = 0; - int k = 0; - - /* format for getting bitmap from uint32_t */ - for (int i=0; i<14; i++) { - dmrs_bitmap[ns][l][i] = 0; - for (; j < k + 32; j++) { - dmrs_bitmap[ns][l][i] |= (dmrs_sequence[j]<prach_list_mutex); } -prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, int nb_rx, find_type_t type) +prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, int nb_rx, nr_find_type_t type) { pthread_mutex_lock(&l->prach_list_mutex); AssertFatal(nb_rx, "Error! Number of antennas set to 0.\n"); @@ -37,7 +37,7 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, int nb_rx, fin if ((*p) && (*p)->frame == frame && ((*p)->slot + (*p)->num_slots - 1) == slot) break; if (p == end) { - if (type == SEARCH_EXIST) { + if (type == NR_SEARCH_EXIST) { pthread_mutex_unlock(&l->prach_list_mutex); return NULL; } @@ -67,7 +67,7 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, int nb_rx, fin prach_item_t *nr_schedule_rx_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu) { - prach_item_t *prach = find_nr_prach(&gNB->prach_list, SFN, Slot, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST_OR_FREE); + prach_item_t *prach = find_nr_prach(&gNB->prach_list, SFN, Slot, gNB->frame_parms.nb_antennas_rx, NR_SEARCH_EXIST_OR_FREE); if (!prach) { LOG_W(PHY, "no free space for a new detected rach, discarding\n"); return NULL; diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 61d8df03b8..9f0dc43e8d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -178,7 +178,12 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *, int occasion); void rx_nr_prach_ru(prach_item_t *, int32_t **, NR_DL_FRAME_PARMS *frame_parms, int N_TA_offset); -prach_item_t *find_nr_prach(prach_list_t *, int frame, int slot, int nb_rx, find_type_t type); +typedef enum { + NR_SEARCH_EXIST = 0, + NR_SEARCH_EXIST_OR_FREE +} nr_find_type_t; + +prach_item_t *find_nr_prach(prach_list_t *, int frame, int slot, int nb_rx, nr_find_type_t type); void nr_fill_pucch(PHY_VARS_gNB *gNB, int frame, int slot, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 4674800eb6..27d0a25b0f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -5,7 +5,6 @@ #include "PHY/defs_gNB.h" #include "PHY/phy_extern.h" #include "nr_transport_proto.h" -#include "PHY/impl_defs_top.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" #include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/ptrs_nr.h" diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index 9a45ab52de..2029287f08 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -5,8 +5,6 @@ #include "PHY/types.h" #include "PHY/defs_nr_UE.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" -#include "PHY/impl_defs_top.h" - #include "executables/nr-uesoftmodem.h" //#define DEBUG_PHY diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index bda26b0d52..b2e3c276dc 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1393,7 +1393,7 @@ void nr_pdsch_ptrs_processing(int nbRx, uint16_t *nb_rb = NULL; int nscid = 0; - if(dlsch0_harq->status == ACTIVE) { + if(dlsch0_harq->status == NR_ACTIVE) { symbInSlot = dlsch[0].dlsch_config.start_symbol + dlsch[0].dlsch_config.number_symbols; startSymbIndex = &dlsch[0].dlsch_config.start_symbol; nbSymb = &dlsch[0].dlsch_config.number_symbols; @@ -1437,7 +1437,7 @@ void nr_pdsch_ptrs_processing(int nbRx, phase_per_symbol[symbol].r = 0; // Real } - if(dlsch0_harq->status == ACTIVE) { + if(dlsch0_harq->status == NR_ACTIVE) { if(symbol == *startSymbIndex) { *ptrsSymbPos = 0; set_ptrs_symb_idx(ptrsSymbPos, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index dcbf382c98..90e66cfb19 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -293,7 +293,7 @@ void nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, if (harq_process->decodeResult) { LOG_D(PHY, "DLSCH received ok \n"); - harq_process->status = SCH_IDLE; + harq_process->status = NR_SCH_IDLE; dlsch->last_iteration_cnt = dlsch->max_ldpc_iterations - 1; } else { LOG_D(PHY, "DLSCH received nok \n"); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index b7de100b57..bcae6e011b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -994,7 +994,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, dlsch0_harq->status, dlsch1_harq->status); - if ((dlsch0_harq->status == ACTIVE) && (dlsch1_harq->status == ACTIVE)){ + if ((dlsch0_harq->status == NR_ACTIVE) && (dlsch1_harq->status == NR_ACTIVE)){ codeword_TB0 = dlsch0_harq->codeword; // SV: where is this set? revisit for DL MIMO. codeword_TB1 = dlsch1_harq->codeword; dlsch0_harq = &ue->dl_harq_processes[codeword_TB0][harq_pid]; @@ -1002,14 +1002,14 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, DEBUG_HARQ("[DEMOD] I am assuming both TBs are active, in cw0 %d and cw1 %d \n", codeword_TB0, codeword_TB1); - } else if ((dlsch0_harq->status == ACTIVE) && (dlsch1_harq->status != ACTIVE) ) { + } else if ((dlsch0_harq->status == NR_ACTIVE) && (dlsch1_harq->status != NR_ACTIVE) ) { codeword_TB0 = dlsch0_harq->codeword; dlsch0_harq = &ue->dl_harq_processes[codeword_TB0][harq_pid]; dlsch1_harq = NULL; DEBUG_HARQ("[DEMOD] I am assuming only TB0 is active, in cw %d \n", codeword_TB0); - } else if ((dlsch0_harq->status != ACTIVE) && (dlsch1_harq->status == ACTIVE)){ + } else if ((dlsch0_harq->status != NR_ACTIVE) && (dlsch1_harq->status == NR_ACTIVE)){ codeword_TB1 = dlsch1_harq->codeword; dlsch0_harq = NULL; dlsch1_harq = &ue->dl_harq_processes[codeword_TB1][harq_pid]; @@ -1023,7 +1023,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, return (-1); } } else if (dlsch0_harq) { - if (dlsch0_harq->status == ACTIVE) { + if (dlsch0_harq->status == NR_ACTIVE) { codeword_TB0 = dlsch0_harq->codeword; dlsch0_harq = &ue->dl_harq_processes[0][harq_pid]; DEBUG_HARQ("[DEMOD] I am assuming only TB0 is active\n"); @@ -1310,7 +1310,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, int nbSymb = 0; int pduBitmap = 0; - if(dlsch0_harq->status == ACTIVE) { + if(dlsch0_harq->status == NR_ACTIVE) { startSymbIdx = dlsch_config->start_symbol; nbSymb = dlsch_config->number_symbols; pduBitmap = dlsch_config->pduBitmap; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 8d55da9d39..c57d0c74ce 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -8,8 +8,6 @@ #ifndef __NR_TRANSPORT_UE__H__ #define __NR_TRANSPORT_UE__H__ #include -#include "PHY/impl_defs_top.h" - #include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" #include "nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h" #include "../NR_TRANSPORT/nr_transport_common_proto.h" @@ -54,8 +52,13 @@ typedef struct { uint32_t Z; } NR_UL_UE_HARQ_t; +typedef enum { + NR_SCH_IDLE = 0, + NR_ACTIVE +} NR_SCH_status_t; + typedef struct { - SCH_status_t status; + NR_SCH_status_t status; /// NDAPI struct for UE nfapi_nr_ue_pusch_pdu_t pusch_pdu; // UL number of harq processes @@ -72,7 +75,7 @@ typedef struct { /// Indicator of first reception uint8_t first_rx; /// DLSCH status flag indicating - SCH_status_t status; + NR_SCH_status_t status; /// Pointer to the payload (38.212 V15.4.0 section 5.1) uint8_t *b; /// Pointers to transport block segments diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 4806a48bda..8abd67c231 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -1075,7 +1075,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int harq_pid = phy_data->ulsch.pusch_pdu.pusch_data.harq_process_id; - if (phy_data->ulsch.status != ACTIVE) + if (phy_data->ulsch.status != NR_ACTIVE) return; start_meas_nr_ue_phy(UE, PUSCH_PROC_STATS); diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c index 64452fd67a..47a39f9d81 100644 --- a/openair1/PHY/TOOLS/calibration_scope.c +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -3,7 +3,7 @@ */ #include -#include +#include "common/utils/system.h" #include "executables/softmodem-common.h" #include "executables/nr-softmodem-common.h" #include diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 6301f496d5..3e5ae03e50 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -3,7 +3,7 @@ */ #include -#include +#include "openair1/PHY/defs_common.h" #include #include #include diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index dbdcf8693d..8bca3a5b52 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -34,14 +34,6 @@ typedef enum { rx_dump_frame=7, } runmode_t; -/*! \brief Extension Type */ -typedef enum { - CYCLIC_PREFIX, - CYCLIC_SUFFIX, - ZEROS, - NONE -} Extension_t; - enum transmission_access_mode { NO_ACCESS=0, POSTPONED_ACCESS, @@ -569,7 +561,7 @@ typedef struct RU_t_s { /// beamforming weight vectors int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; /// received frequency-domain signal for PRACH (IF4p5 RRU) - int16_t **prach_rxsigF[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX]; + int16_t **prach_rxsigF[12]; /// received frequency-domain signal for PRACH BR (IF4p5 RRU) int16_t **prach_rxsigF_br[4]; /// sequence number for IF5 diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index c90a592305..ab092dc173 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -42,6 +42,7 @@ #include "common/platform_types.h" #include "PHY/LTE_UE_TRANSPORT/transport_ue.h" #include "PHY/LTE_TRANSPORT/transport_eNB.h" // for SIC +#include "PHY/defs_RU.h" #include #include "assertions.h" diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index c362becaae..482fe0c857 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -33,7 +33,6 @@ #include #include "assertions.h" -//#include #include "time_meas.h" #include "common/platform_types.h" #include "softmodem-common.h" @@ -42,7 +41,7 @@ #include #include "TOOLS/tools_defs.h" - +#include "PHY/CODING/coding_defs.h" #include "common/openairinterface5g_limits.h" #include "common/utils/LOG/log.h" @@ -965,39 +964,6 @@ extern int sync_var; #define MBSFN_FDD_SF7 0x08 #define MBSFN_FDD_SF8 0x04 -#define NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX 12 - -typedef struct { - pthread_mutex_t mutex_failure; - bool failed; -} decode_abort_t; - -static inline void init_abort(decode_abort_t *ab) -{ - int ret = pthread_mutex_init(&ab->mutex_failure, NULL); - AssertFatal(ret == 0, "mutex failed with %d\n", ret); - ab->failed = false; -} - -static inline bool check_abort(decode_abort_t *ab) -{ - int ret = pthread_mutex_lock(&ab->mutex_failure); - AssertFatal(ret == 0, "mutex failed with %d\n", ret); - bool failed = ab->failed; - ret = pthread_mutex_unlock(&ab->mutex_failure); - AssertFatal(ret == 0, "mutex failed with %d\n", ret); - return failed; -} - -static inline void set_abort(decode_abort_t *ab, bool v) -{ - int ret = pthread_mutex_lock(&ab->mutex_failure); - AssertFatal(ret == 0, "mutex failed with %d\n", ret); - ab->failed = v; - ret = pthread_mutex_unlock(&ab->mutex_failure); - AssertFatal(ret == 0, "mutex failed with %d\n", ret); -} - typedef uint8_t(decoder_if_t)(int16_t *y, int16_t *y2, uint8_t *decoded_bytes, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index e0cd78509e..d21c9ab07e 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -13,17 +13,46 @@ #include "defs_nr_common.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" -#include "PHY/impl_defs_top.h" #include "PHY/CODING/nrLDPC_coding/nrLDPC_coding_interface.h" #include "PHY/CODING/nrLDPC_extern.h" #include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" #include "nfapi_nr_interface_scf.h" +#include "common/utils/threadPool/task_ans.h" +#include "openair1/PHY/defs_RU.h" #define MAX_NUM_RU_PER_gNB 8 #define MAX_PUCCH0_NID 8 #define NR_SRS_IDFT_OVERSAMP_FACTOR 2 #define NR_SRS_DETECTION_THRESHOLD 10 +#define NUMBER_OF_NR_PRACH_MAX 8 +typedef struct { + int frame; + int slot; + int num_slots; // prach duration in slots + int beams[NFAPI_MAX_NUM_BG_IF]; + nfapi_nr_prach_pdu_t pdu; + int rootSequenceIndex; + int numrootSequenceIndex; + int msg1_frequencystart; + int mu; + int prach_sequence_length; + int restricted_set; + int numerology_index; + int nb_rx; + c16_t (*Xu)[839]; + time_stats_t *rx_prach; + c16_t (*prach_buf)[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX][NR_PRACH_SEQ_LEN_L]; +} prach_item_t; + +typedef struct { + /// prach commands + prach_item_t *list[NUMBER_OF_NR_PRACH_MAX]; + /// mutex for prach_list access + pthread_mutex_t prach_list_mutex; +} prach_list_t; +void init_prach_list(prach_list_t *); + typedef struct { int nb_id; int Nid[MAX_PUCCH0_NID]; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 385fef3a8e..814b95dae9 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -19,7 +19,7 @@ #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/defs_nr_sl_UE.h" #include "openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h" - +#include "common/utils/threadPool/task_ans.h" #include #include #include @@ -59,7 +59,6 @@ // (0 + 0 * 20) % 512 = 0 #define NUM_PROCESS_SLOT_TX_BARRIERS 512 -#include "impl_defs_top.h" #include "impl_defs_nr.h" #include "time_meas.h" #include "PHY/CODING/coding_defs.h" @@ -338,8 +337,8 @@ typedef struct PHY_VARS_NR_UE_s { NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE]; uint8_t prs_active_gNBs; - NR_DL_UE_HARQ_t dl_harq_processes[2][NR_MAX_DLSCH_HARQ_PROCESSES]; - NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES]; + NR_DL_UE_HARQ_t dl_harq_processes[2][NR_MAX_HARQ_PROCESSES]; + NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_HARQ_PROCESSES]; // Scrambling IDs used in PUSCH DMRS c16_t X_u[64][839]; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 44d19045f7..7cd439bcee 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -12,7 +12,7 @@ #include "PHY/impl_defs_top.h" #include "impl_defs_nr.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" - +#include "radio/COMMON/common_lib.h" #include #define MAX_NUM_SUBCARRIER_SPACING 5 @@ -41,15 +41,11 @@ #define NR_MAX_PDCCH_AGG_LEVEL 16 // 3GPP TS 38.211 V15.8 Section 7.3.2 Table 7.3.2.1-1: Supported PDCCH aggregation levels -#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 36 - -#define MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER 34 - #define MAX_NUM_NR_RE (4*14*273*12) #define MAX_NUM_NR_SRS_SYMBOLS 4 #define MAX_NUM_NR_SRS_AP 4 - +#define NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX 12 #define MAX_DELAY_COMP 20 @@ -102,34 +98,6 @@ typedef struct { int resource_type; } nr_srs_info_t; -#define NUMBER_OF_NR_PRACH_MAX 8 -typedef struct { - int frame; - int slot; - int num_slots; // prach duration in slots - int beams[NFAPI_MAX_NUM_BG_IF]; - nfapi_nr_prach_pdu_t pdu; - int rootSequenceIndex; - int numrootSequenceIndex; - int msg1_frequencystart; - int mu; - int prach_sequence_length; - int restricted_set; - int numerology_index; - int nb_rx; - c16_t (*Xu)[839]; - time_stats_t *rx_prach; - c16_t (*prach_buf)[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX][NR_PRACH_SEQ_LEN_L]; -} prach_item_t; - -typedef struct { - /// prach commands - prach_item_t *list[NUMBER_OF_NR_PRACH_MAX]; - /// mutex for prach_list access - pthread_mutex_t prach_list_mutex; -} prach_list_t; -void init_prach_list(prach_list_t *); - typedef struct NR_DL_FRAME_PARMS_s { /// frequency range frequency_range_t freq_range; diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index 71faf25ac7..1af29b4ba5 100644 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -86,7 +86,6 @@ #include #include -#include "defs_eNB.h" #include "types.h" /** @addtogroup _PHY_STRUCTURES_ @@ -205,17 +204,6 @@ #define AMP_OVER_SQRT2 ((AMP*ONE_OVER_SQRT2_Q15)>>15) #define AMP_OVER_2 (AMP>>1) -#define NB_NUMEROLOGIES_NR (5) -#define NR_MAX_SLOTS_PER_FRAME (160) /* number of slots per frame */ - -/* FFS_NR_TODO it defines ue capability which is the number of slots */ -/* - between reception of pdsch and transmission of its acknowlegment (k1) */ -/* - between reception of un uplink grant and its related transmission (k2) */ -#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (3) - -#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */ -#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 5.1 UE procedure for receiving the physical downlink shared channel */ - /// Measurement Variables //#define NUMBER_OF_SUBBANDS_MAX 13 diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 25acac547d..fcaf2f1c1b 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -27,7 +27,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rac rach_ind->slot = slot; rach_ind->number_of_pdus = 0; - prach_item_t *prach_id = find_nr_prach(&gNB->prach_list, frame, slot, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST); + prach_item_t *prach_id = find_nr_prach(&gNB->prach_list, frame, slot, gNB->frame_parms.nb_antennas_rx, NR_SEARCH_EXIST); if (!prach_id) { return; } diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index eb952035aa..0c2d2897c6 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -72,8 +72,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ void processSlotTX(void *arg); -int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); - /*! \brief UL time alignment procedures for TA application @param ue @param slot_tx diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index a39927f4aa..4a521f5613 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -57,7 +57,7 @@ static void configure_dlsch(NR_UE_DLSCH_t *dlsch0, dlsch0_harq->DLround++; } downlink_harq_process(dlsch0_harq, current_harq_pid, dlsch_config_pdu->new_data_indicator, dlsch_config_pdu->rv, dlsch0->rnti_type); - if (dlsch0_harq->status != ACTIVE) { + if (dlsch0_harq->status != NR_ACTIVE) { // dlsch0_harq->status not ACTIVE due to false retransmission // Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status dlsch0->active = false; @@ -305,7 +305,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r pdu->pusch_config_pdu.tx_request_body.pdu_length); } - phy_data->ulsch.status = ACTIVE; + phy_data->ulsch.status = NR_ACTIVE; pdu->pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more } break; diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 590ce42ec7..061e43d831 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -95,7 +95,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) { - dl_harq->status = SCH_IDLE; + dl_harq->status = NR_SCH_IDLE; dl_harq->first_rx = 1; dl_harq->DLround = 0; dl_harq->decodeResult = false; @@ -124,7 +124,7 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int dci_ndi, rnti_type == TYPE_P_RNTI_ || rnti_type == TYPE_RA_RNTI_) { dl_harq->DLround = 0; - dl_harq->status = ACTIVE; + dl_harq->status = NR_ACTIVE; dl_harq->first_rx = 1; } else { LOG_D(PHY, @@ -136,7 +136,7 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int dci_ndi, rnti_type, dci_ndi ? "yes" : "no"); AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv); - dl_harq->status = ACTIVE; + dl_harq->status = NR_ACTIVE; } } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 0b853820f3..3d11c2af3b 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -836,8 +836,8 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, uint8_t is_cw0_active = dl_harq0->status; uint8_t is_cw1_active = dl_harq1->status; int nb_dlsch = 0; - nb_dlsch += (is_cw0_active == ACTIVE) ? 1 : 0; - nb_dlsch += (is_cw1_active == ACTIVE) ? 1 : 0; + nb_dlsch += (is_cw0_active == NR_ACTIVE) ? 1 : 0; + nb_dlsch += (is_cw1_active == NR_ACTIVE) ? 1 : 0; uint16_t nb_symb_sch = dlsch[0].dlsch_config.number_symbols; uint8_t dmrs_type = dlsch[0].dlsch_config.dmrsConfigType; @@ -852,7 +852,7 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx % 1024, nr_slot_rx, harq_pid, is_cw1_active); // exit dlsch procedures as there are no active dlsch - if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE) { + if (is_cw0_active != ACTIVE && is_cw1_active != NR_ACTIVE) { // don't wait anymore LOG_E(NR_PHY, "Internal error nr_ue_dlsch_procedure() called but no active cw on slot %d, harq %d\n", nr_slot_rx, harq_pid); if (dlsch[0].dlsch_config.k1_feedback) { @@ -869,7 +869,7 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, uint8_t *p_b[2] = {NULL}; for (uint8_t DLSCH_id = 0; DLSCH_id < 2; DLSCH_id++) { NR_DL_UE_HARQ_t *dl_harq = &ue->dl_harq_processes[DLSCH_id][harq_pid]; - if (dl_harq->status != ACTIVE) continue; + if (dl_harq->status != NR_ACTIVE) continue; DLSCH_ids[pdsch_id++] = DLSCH_id; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = &dlsch[DLSCH_id].dlsch_config; @@ -950,9 +950,9 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } uint32_t dlsch_bytes = a_segments * 1056; // allocated bytes per segment - if (ue->phy_sim_dlsch_b && is_cw0_active == ACTIVE) + if (ue->phy_sim_dlsch_b && is_cw0_active == NR_ACTIVE) memcpy(ue->phy_sim_dlsch_b, p_b[0], dlsch_bytes); - else if (ue->phy_sim_dlsch_b && is_cw1_active == ACTIVE) + else if (ue->phy_sim_dlsch_b && is_cw1_active == NR_ACTIVE) memcpy(ue->phy_sim_dlsch_b, p_b[1], dlsch_bytes); } diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 3299363c51..f07ad92ca9 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -406,7 +406,7 @@ int main(int argc, char **argv) exit(-1); } - nr_init_ul_harq_processes(UE->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx); + nr_init_ul_harq_processes(UE->ul_harq_processes, NR_MAX_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx); initFloatingCoresTpool(1, &nrUE_params.Tpool, false, "UE-tpool"); @@ -585,7 +585,7 @@ int main(int argc, char **argv) printf("\n"); } - free_nr_ue_ul_harq(UE->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx); + free_nr_ue_ul_harq(UE->ul_harq_processes, NR_MAX_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx); int nb_slots_to_set = (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; for (int i = 0; i < nb_slots_to_set; ++i) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c index f70eb83c32..b0ce4ffb1f 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c @@ -172,10 +172,10 @@ static void sl_prepare_phy_config(int module_id, phycfg->sl_bwp_config.sl_start_symbol = (bwp_generic->sl_StartSymbol_r16) ? *bwp_generic->sl_StartSymbol_r16 : 0; - //0-EXTENDED, 1-NORMAL CP - phycfg->sl_bwp_config.sl_cyclic_prefix = (sl_bwp->cyclicPrefix) ? EXTENDED : NORMAL; + //0-NORMAL CP, 1-EXTENDED + phycfg->sl_bwp_config.sl_cyclic_prefix = (sl_bwp->cyclicPrefix) ? 1 : 0; - AssertFatal(phycfg->sl_bwp_config.sl_cyclic_prefix == NORMAL, "Only NORMAL-CP Supported. Ext CP not yet supported\n"); + AssertFatal(phycfg->sl_bwp_config.sl_cyclic_prefix == 0, "Only NORMAL-CP Supported. Ext CP not yet supported\n"); AssertFatal(phycfg->sl_bwp_config.sl_start_symbol >= 0 && phycfg->sl_bwp_config.sl_start_symbol <=7, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 9d725418ae..224887252d 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -13,6 +13,7 @@ #include #include #include "common/platform_types.h" +#include "common/utils/threadPool/notified_fifo.h" /* IF */ #include "NR_IF_Module.h" @@ -405,7 +406,7 @@ typedef struct { typedef struct { /// SSB RSRP in dBm int ssb_rsrp_dBm; - float_t ssb_sinr_dB; + float ssb_sinr_dB; } NR_SSB_meas_t; typedef struct { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c index d29e0c6bfa..66c5104458 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c @@ -14,7 +14,7 @@ // TODO: This should be part of mac instance /* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ /* this is a counter of number of pucch format 4 per subframe */ -static int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] = {0}; +static int nb_pucch_format_4_in_subframes[NR_NUMBER_OF_SUBFRAMES_PER_FRAME] = {0}; /* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ static const int nb_symbols_excluding_dmrs[11][2][2] diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 035b750745..15c59716be 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2552,7 +2552,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) // Schedule ULSCH only if the current frame and slot match those in ul_config_req // AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus) - uint8_t ulsch_input_buffer_array[NFAPI_MAX_NUM_UL_PDU][MAX_ULSCH_PAYLOAD_BYTES]; + uint8_t ulsch_input_buffer_array[FAPI_NR_UL_CONFIG_LIST_NUM][MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER * NR_MAX_NB_LAYERS * 1056]; int number_of_pdus = 0; fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = lockGet_ul_iterator(mac, frame_tx, slot_tx); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index c0de476ad9..efc0371752 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -12,6 +12,7 @@ #include #include "openair2/PHY_INTERFACE/IF_Module.h" +#include "PHY/defs_eNB.h" #include "nfapi_interface.h" #include "nfapi_pnf_interface.h" #include diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index eb522d4bd4..45743bb9be 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -466,6 +466,7 @@ static void SendFrameNR(guint8 radioType, ws_trace_t *t) #include extern RAN_CONTEXT_t RC; #include +#include "openair1/PHY/defs_eNB.h" /* Remote serveraddress (where Wireshark is running) */ void trace_pdu_implementation(ws_trace_t *t) diff --git a/radio/fhi_72/oran_isolate.h b/radio/fhi_72/oran_isolate.h index bf4ced15ca..afdf443596 100644 --- a/radio/fhi_72/oran_isolate.h +++ b/radio/fhi_72/oran_isolate.h @@ -13,7 +13,7 @@ #include "xran_fh_o_du.h" #include "openair1/PHY/impl_defs_nr.h" #include "openair1/PHY/TOOLS/tools_defs.h" -#include "openair1/PHY/defs_common.h" +#include "openair1/PHY/defs_nr_common.h" /* * Structure added to bear the information needed from OAI RU */