diff --git a/ci-scripts/docker/Dockerfile.cppcheck.xenial b/ci-scripts/docker/Dockerfile.cppcheck.xenial index 0aecc62037..f69d4a8402 100644 --- a/ci-scripts/docker/Dockerfile.cppcheck.xenial +++ b/ci-scripts/docker/Dockerfile.cppcheck.xenial @@ -18,6 +18,7 @@ RUN make WORKDIR /oai-ran RUN mkdir -p cmake_targets/log && \ cppcheck --enable=warning --force --xml --xml-version=2 \ + --inline-suppr \ -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c \ --suppressions-list=ci-scripts/cppcheck_suppressions.list \ -I common/utils \ diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index dd86aaf42a..76808cf59f 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -395,11 +395,9 @@ void write_parsedcfg(configmodule_interface_t *cfgptr) cfgptr->status->emptyla, cfgptr->status->num_write); } - if (cfgptr != NULL) { - if (cfgptr->write_parsedcfg != NULL) { - printf("[CONFIG] calling config module write_parsedcfg function...\n"); - cfgptr->write_parsedcfg(cfgptr); - } + if (cfgptr->write_parsedcfg != NULL) { + printf("[CONFIG] calling config module write_parsedcfg function...\n"); + cfgptr->write_parsedcfg(cfgptr); } } @@ -407,8 +405,8 @@ void write_parsedcfg(configmodule_interface_t *cfgptr) /* config module could be initialized again after this call */ void end_configmodule(configmodule_interface_t *cfgptr) { - write_parsedcfg(cfgptr); if (cfgptr != NULL) { + write_parsedcfg(cfgptr); if (cfgptr->end != NULL) { printf ("[CONFIG] calling config module end function...\n"); cfgptr->end(cfgptr); @@ -426,13 +424,12 @@ void end_configmodule(configmodule_interface_t *cfgptr) cfgptr->numptrs=0; pthread_mutex_unlock(&cfgptr->memBlocks_mutex); - if ( cfgptr->cfgmode ) + if (cfgptr->cfgmode) free(cfgptr->cfgmode); - if ( cfgptr->argv_info ) - free( cfgptr->argv_info ); + if (cfgptr->argv_info) + free(cfgptr->argv_info); free(cfgptr); - cfgptr=NULL; } } diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c index 60e5092600..6ead65d87a 100644 --- a/common/utils/T/tracer/textlog.c +++ b/common/utils/T/tracer/textlog.c @@ -122,6 +122,8 @@ int main(int n, char **v) socket = connect_to(ip, port); if (socket == -1) { printf("fatal: connection failed\n"); + free(on_off_name); + free(on_off_action); return 1; } diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 7b790978a3..fb3abd1247 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -169,12 +169,18 @@ uint32_t nr_timer_elapsed_time(NR_timer_t timer); extern const nr_bandentry_t nr_bandtable[]; -static inline int get_num_dmrs(uint16_t dmrs_mask ) { +static inline int get_num_dmrs(uint16_t dmrs_mask ) +{ int num_dmrs=0; for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1); return(num_dmrs); } +static __attribute__((always_inline)) inline int count_bits_set(uint64_t v) +{ + return __builtin_popcountll(v); +} + uint64_t reverse_bits(uint64_t in, int n_bits); void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out); diff --git a/executables/create_tasks_ue.c b/executables/create_tasks_ue.c index 728e4546b5..4cffef909d 100644 --- a/executables/create_tasks_ue.c +++ b/executables/create_tasks_ue.c @@ -34,7 +34,8 @@ #include "RRC/LTE/rrc_defs.h" # include "enb_app.h" -int create_tasks_ue(uint32_t ue_nb) { +int create_tasks_ue(uint32_t ue_nb) +{ LOG_D(ENB_APP, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb); itti_wait_ready(1); @@ -50,6 +51,7 @@ int create_tasks_ue(uint32_t ue_nb) { ittiTask_parms_t parms = {users, NULL}; if (itti_create_task(TASK_NAS_UE, nas_ue_task, &parms) < 0) { LOG_E(NAS, "Create task for NAS UE failed\n"); + free(users); return -1; } } diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 1a93df1657..bbdbe29747 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -592,7 +592,7 @@ static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) nb_id = rrc->node_id; } else if (node_type == ngran_gNB_DU) { const gNB_MAC_INST* mac = RC.nrmac[0]; - AssertFatal(mac != NULL, "MAC not initialized\n"); + AssertFatal(mac, "MAC not initialized\n"); cu_du_id = mac->f1_config.gnb_id; nb_id = mac->f1_config.setup_req->gNB_DU_id; } else if (node_type == ngran_gNB_CU || node_type == ngran_gNB_CUCP) { diff --git a/nfapi/oai_integration/aerial/fapi_vnf_p7.c b/nfapi/oai_integration/aerial/fapi_vnf_p7.c index f2046aa456..1d85113956 100644 --- a/nfapi/oai_integration/aerial/fapi_vnf_p7.c +++ b/nfapi/oai_integration/aerial/fapi_vnf_p7.c @@ -423,7 +423,7 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { if (NFAPI_MODE == NFAPI_MODE_AERIAL) { nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind)); - AssertFatal(uci_ind != NULL, "Memory not allocated for uci_ind in phy_nr_uci_indication."); + AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication."); *uci_ind = *ind; uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t)); @@ -997,6 +997,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, nfapi_p7_codec_config_t *config, uint32_t *data_len) { + if (pMessageBuf == NULL || pPackedBuf == NULL) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; uint8_t *end = pPackedBuf + packedBufLen; uint8_t *data_end = pDataBuf + dataBufLen; @@ -1009,11 +1014,6 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, uint8_t *pPackedDataField = &pDataPackedMessage[0]; uint8_t *pPackedDataFieldStart = &pDataPackedMessage[0]; - if (pMessageBuf == NULL || pPackedBuf == NULL) { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - // PHY API message header // Number of messages [0] // Opaque handle [1] @@ -1136,6 +1136,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf, int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config) { + if (pMessageBuf == NULL || pPackedBuf == NULL) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; uint8_t *end = pPackedBuf + packedBufLen; uint8_t *pWritePackedMessage = pPackedBuf; @@ -1144,11 +1149,6 @@ int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packed uint8_t *pPacketBodyField = &pWritePackedMessage[8]; uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[8]; - if (pMessageBuf == NULL || pPackedBuf == NULL) { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - // PHY API message header // Number of messages [0] // Opaque handle [1] diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index b3e34ee1b7..a70b52c08c 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -759,7 +759,7 @@ int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) if(NFAPI_MODE == NFAPI_MODE_VNF) { nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind)); - AssertFatal(uci_ind != NULL, "Memory not allocated for uci_ind in phy_nr_uci_indication."); + AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication."); *uci_ind = *ind; uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t)); diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c index 2f05e93f32..6cc500cfa7 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c @@ -344,7 +344,7 @@ static int add_dev(uint8_t dev_id, struct rte_bbdev_info *info) for (queue_id = 0; queue_id < nb_queues; ++queue_id) { ret = rte_bbdev_queue_configure(dev_id, queue_id, &qconf); if (ret == 0) { - printf("Found LDCP encoding queue (id=%u) at prio%u on dev%u\n", queue_id, qconf.priority, dev_id); + printf("Found LDCP encoding queue (id=%d) at prio%u on dev%u\n", queue_id, qconf.priority, dev_id); qconf.priority++; //ret = rte_bbdev_queue_configure(ad->dev_id, queue_id, &qconf); ad->enc_queue = queue_id; @@ -359,7 +359,7 @@ static int add_dev(uint8_t dev_id, struct rte_bbdev_info *info) for (queue_id++; queue_id < nb_queues; ++queue_id) { ret = rte_bbdev_queue_configure(dev_id, queue_id, &qconf); if (ret == 0) { - printf("Found LDCP decoding queue (id=%u) at prio%u on dev%u\n", queue_id, qconf.priority, dev_id); + printf("Found LDCP decoding queue (id=%d) at prio%u on dev%u\n", queue_id, qconf.priority, dev_id); qconf.priority++; //ret = rte_bbdev_queue_configure(ad->dev_id, queue_id, &qconf); ad->dec_queue = queue_id; @@ -957,8 +957,8 @@ int32_t LDPCinit() // Set number of queues based on number of initialized cores (-l option) and driver // capabilities TEST_ASSERT_SUCCESS(add_dev(dev_id, &info), "Failed to setup bbdev"); - TEST_ASSERT_SUCCESS(rte_bbdev_stats_reset(dev_id), "Failed to reset stats of bbdev %u", dev_id); - TEST_ASSERT_SUCCESS(rte_bbdev_start(dev_id), "Failed to start bbdev %u", dev_id); + TEST_ASSERT_SUCCESS(rte_bbdev_stats_reset(dev_id), "Failed to reset stats of bbdev %d", dev_id); + TEST_ASSERT_SUCCESS(rte_bbdev_start(dev_id), "Failed to start bbdev %d", dev_id); //the previous calls have populated this global variable (beurk) // One more global to remove, not thread safe global op_params diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/bnProcPc_gen_BG1_128.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/bnProcPc_gen_BG1_128.c index 5dc665a8b9..abcb30f879 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/bnProcPc_gen_BG1_128.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/bnProcPc_gen_BG1_128.c @@ -80,10 +80,10 @@ void nrLDPC_bnProcPc_BG1_generator_128(const char *dir, int R) fprintf(fd," // Process group with 1 CN\n"); fprintf(fd," uint32_t M = (%d*Z + 15)>>4;\n",lut_numBnInBnGroups[0]); - fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%d];\n",lut_startAddrBnGroups [idxBnGroup]); - fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%d];\n",lut_startAddrBnGroups [idxBnGroup]); - fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); - fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); fprintf(fd," simde__m128i ymm0, ymm1, ymmRes0, ymmRes1;\n"); @@ -114,9 +114,9 @@ void nrLDPC_bnProcPc_BG1_generator_128(const char *dir, int R) cnOffsetInGroup = (lut_numBnInBnGroups[cnidx]*NR_LDPC_ZMAX)>>4; // Set pointers to start of group 2 - fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%d];\n",lut_startAddrBnGroups[idxBnGroup]); - fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); - fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); // Loop over BNs fprintf(fd," for (int i=0;i>4;\n",lut_numBnInBnGroups[0]); - fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%d];\n",lut_startAddrBnGroups [idxBnGroup]); - fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%d];\n",lut_startAddrBnGroups [idxBnGroup]); - fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); - fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); fprintf(fd," simde__m128i ymm0, ymm1, ymmRes0, ymmRes1;\n"); @@ -115,9 +115,9 @@ void nrLDPC_bnProcPc_BG2_generator_128(const char *dir, int R) cnOffsetInGroup = (lut_numBnInBnGroups[cnidx]*NR_LDPC_ZMAX)>>4; // Set pointers to start of group 2 - fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%d];\n",lut_startAddrBnGroups[idxBnGroup]); - fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); - fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]); + fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); + fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]); // Loop over BNs fprintf(fd," for (int i=0;i #include #include diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 3d6d7848da..b3e29322b3 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -110,10 +110,9 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui // printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams); //Else, initialize and add node to the end of the linked list. t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1); - newPolarInitNode->busy=true; + AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created"); + newPolarInitNode->busy = true; pthread_mutex_unlock(&PolarListMutex); - - AssertFatal(newPolarInitNode != NULL, "[nr_polar_init] New t_nrPolar_params * could not be created"); // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); newPolarInitNode->idx = PolarKey; diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c index 935a6f1f01..855116ca6b 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c @@ -491,6 +491,7 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { break; case 4: // even: 4->1, odd: 4->4 ret= ((3*odd_slot) + 1)%6; + break; case 5: // even: 5->4, odd: 5->1 ret= ((3*odd_slot) + 4)%6; break; diff --git a/openair1/PHY/LTE_TRANSPORT/power_control.c b/openair1/PHY/LTE_TRANSPORT/power_control.c index 5744c6b35b..d2414222b2 100644 --- a/openair1/PHY/LTE_TRANSPORT/power_control.c +++ b/openair1/PHY/LTE_TRANSPORT/power_control.c @@ -41,8 +41,8 @@ double get_pa_dB(uint8_t pa) } -double computeRhoA_eNB(uint8_t pa, - LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){ +double computeRhoA_eNB(uint8_t pa, LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port) +{ double rho_a_dB; double sqrt_rho_a_lin; @@ -59,10 +59,10 @@ double computeRhoA_eNB(uint8_t pa, if (dlsch_eNB) { dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13)); dlsch_eNB->pa = pa; - } #if DEBUG_PC - printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a); + printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n", p_a, pa_values[pdsch_config_dedicated->p_a], dlsch_eNB->sqrt_rho_a); #endif + } return(rho_a_dB); } @@ -89,12 +89,12 @@ double computeRhoB_eNB(uint8_t pa, sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB)); if (dlsch_eNB) { - dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13)); + dlsch_eNB->sqrt_rho_b = (short) (sqrt_rho_b_lin * pow(2, 13)); dlsch_eNB->pb = pb; - } #ifdef DEBUG_PC - printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pb,ratioPB[1][pb],dlsch_eNB->sqrt_rho_b); + printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n", n_antenna_port, pb, ratioPB[1][pb], dlsch_eNB->sqrt_rho_b); #endif + } return(rho_b_dB); } diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 666d92a87d..fb41d61623 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -805,8 +805,28 @@ void nr_layer_precoder_simd(const int n_layers, #ifdef DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // Print simd and trivial result, TODO: To be removed c16_t *y_simd = (c16_t*) &y; - printf("debug_to_be_removed re_cnt=%d, sc=%d, y_simd=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n", re_cnt, sc, y_simd[0].r, y_simd[0].i, y_simd[1].r, y_simd[1].i, y_simd[2].r, y_simd[2].i, y_simd[3].r, y_simd[3].i); - printf("debug_to_be_removed re_cnt=%d, sc=%d, y_triv=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n", re_cnt, sc, y_triv[0].r, y_triv[0].i, y_triv[1].r, y_triv[1].i, y_triv[2].r, y_triv[2].i, y_triv[3].r, y_triv[3].i); + printf("debug_to_be_removed re_cnt=%d, sc=%u, y_simd=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n", + re_cnt, + sc, + y_simd[0].r, + y_simd[0].i, + y_simd[1].r, + y_simd[1].i, + y_simd[2].r, + y_simd[2].i, + y_simd[3].r, + y_simd[3].i); + printf("debug_to_be_removed re_cnt=%d, sc=%u, y_triv=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n", + re_cnt, + sc, + y_triv[0].r, + y_triv[0].i, + y_triv[1].r, + y_triv[1].i, + y_triv[2].r, + y_triv[2].i, + y_triv[3].r, + y_triv[3].i); #endif } } diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index 82c55a1465..e9a90fc011 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -292,8 +292,14 @@ int nr_pusch_lowpaprtype1_dmrs_rx(PHY_VARS_gNB *gNB, nb_pusch_rb, nb_dmrs); printf("NR_DMRS_RX: wf[%d] = %d wt[%d]= %d\n", i & 1, wf1[p - 1000][i & 1], lp, wt1[p - 1000][lp]); - printf("NR_DMRS_RX: i %d dmrs_offset %d k %d pusch dmrsseq[i<<1] %d, dmrsseq[(i<<1)+1] %d pilots[k<<1] %d pilots[(k<<1)+1] %d\n", i, dmrs_offset, k, - dmrs_seq[i].r, dmrs_seq[i].i, output[k].r, output[(k].i); + printf("NR_DMRS_RX: i %d dmrs_offset %d k %d pusch dmrsseq.r %d, dmrsseq.i %d pilots.r %d pilots.i %d\n", + i, + dmrs_offset, + k, + dmrs_seq[i].r, + dmrs_seq[i].i, + output[k].r, + output[k].i); #endif } } else { diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 514f284e4c..5fe7a90da8 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -175,7 +175,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION, 0); stop_meas(dlsch_modulation_stats); #ifdef DEBUG_DLSCH - printf("PDSCH Modulation: Qm %d(%u)\n", Qm, nb_re); + printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re); for (int i = 0; i < nb_re; i += 8) { for (int j=0; j<8; j++) { printf("%d %d\t", mod_symbs[codeWord][i + j].r, mod_symbs[codeWord][i + j].i); @@ -213,8 +213,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) c16_t txdataF_precoding[rel15->nrOfLayers][NR_NUMBER_OF_SYMBOLS_PER_SLOT][frame_parms->ofdm_symbol_size] __attribute__((aligned(64)));; #ifdef DEBUG_DLSCH_MAPPING - printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %u,nb_layers %d)\n", - start_sc, rel15->StartSymbolIndex, rel15->rbSize, nb_re,rel15->nrOfLayers); + printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", + start_sc, + rel15->StartSymbolIndex, + rel15->rbSize, + nb_re, + rel15->nrOfLayers); #endif start_meas(&gNB->dlsch_resource_mapping_stats); diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index dd2493984e..8c2ab883c2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -265,10 +265,10 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, pbch->pbch_a |= n_hf<<28; // half frame index bit if (Lmax == 64) - for (int i=0; i<3; i++) - pbch->pbch_a |= ((ssb_index>>(5-i))&1)<<(29+i); // resp. 6th, 5th and 4th bits of ssb_index + for (int i = 0; i < 3; i++) + pbch->pbch_a |= (uint32_t)((ssb_index >> (5 - i)) & 1) << (29 + i); // resp. 6th, 5th and 4th bits of ssb_index else - pbch->pbch_a |= ((ssb_sc_offset>>4)&1)<<29; //MSB of k_SSB (bit index 4) + pbch->pbch_a |= ((ssb_sc_offset >> 4) & 1) << 29; //MSB of k_SSB (bit index 4) LOG_D(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index bc3046c578..2d98662813 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -42,7 +42,7 @@ static NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid) for (int i = 0; i < gNB->max_nb_pusch; i++) { ulsch = &gNB->ulsch[i]; - AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i); + AssertFatal(ulsch, "gNB->ulsch[%d] is null\n", i); if (!ulsch->active) { if (first_free_index == -1) first_free_index = i; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 118c828519..64ce300ae4 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -587,7 +587,7 @@ void nr_decode_pucch1(c16_t **rxdataF, printf( "\t [nr_generate_pucch1] mapping %s to RE \t amp=%d " "\tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d " - "\tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", + "\tz_pucch[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", l % 2 ? "PUCCH" : "DM-RS", amp, frame_parms->ofdm_symbol_size, 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 7b3f2f3f3d..f7806aa504 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -647,7 +647,7 @@ c32_t nr_pbch_dmrs_correlation(const PHY_VARS_NR_UE *ue, unsigned int k = ue->frame_parms.Nid_cell % 4; - DEBUG_PBCH("PBCH DMRS Correlation : gNB_id %d , OFDM size %d, Ncp=%d, k=%d symbol %d\n", + DEBUG_PBCH("PBCH DMRS Correlation : gNB_id %d , OFDM size %d, Ncp=%d, k=%u symbol %d\n", proc->gNB_id, ue->frame_parms.ofdm_symbol_size, ue->frame_parms.Ncp, @@ -666,7 +666,7 @@ c32_t nr_pbch_dmrs_correlation(const PHY_VARS_NR_UE *ue, const c16_t *rxF = &rxdataF[aarx][symbol_offset + k]; DEBUG_PBCH("pbch ch est pilot RB_DL %d\n", ue->frame_parms.N_RB_DL); - DEBUG_PBCH("k %d, first_carrier %d\n", k, ue->frame_parms.first_carrier_offset); + DEBUG_PBCH("k %u, first_carrier %d\n", k, ue->frame_parms.first_carrier_offset); // Treat first 2 pilots specially (left edge) computed_val = c32x16maddShift(*pil, rxF[re_offset], computed_val, 15); @@ -1336,7 +1336,6 @@ void NFAPI_NR_DMRS_TYPE1_average_prb(NR_DL_FRAME_PARMS *frame_parms, for (int i = 0; i < 2 * P_average; i++) { dl_ch[i] = ch; } - dl_ch += 2 * P_average; #else dl_ch[3].r += (ch.r * 1365) >> 15; // 1/12*16384 dl_ch[3].i += (ch.i * 1365) >> 15; // 1/12*16384 @@ -1488,7 +1487,6 @@ void NFAPI_NR_DMRS_TYPE2_average_prb(NR_DL_FRAME_PARMS *frame_parms, for (int i = 0; i < 3 * P_average; i++) { dl_ch[i] = ch; } - dl_ch += 3 * P_average; #else dl_ch[3].r += (ch.r * 1365) >> 15; // 1/12*16384 dl_ch[3].i += (ch.i * 1365) >> 15; // 1/12*16384 diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 52c9ec5394..ba5590d9f6 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -42,8 +42,6 @@ //#define DEBUG_PBCH //#define DEBUG_PBCH_ENCODING -//#include "PHY_INTERFACE/defs.h" - #define PBCH_A 24 #define PBCH_MAX_RE_PER_SYMBOL (20*12) #define PBCH_MAX_RE (PBCH_MAX_RE_PER_SYMBOL*4) @@ -69,15 +67,17 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz, for (aarx=0; aarxnb_antennas_rx; aarx++) { unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; rx_offset = (rx_offset)%(frame_parms->ofdm_symbol_size); - struct complex16 *rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; - struct complex16 *rxF_ext = rxdataF_ext[aarx]; + struct complex16 *rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; + struct complex16 *rxF_ext = rxdataF_ext[aarx]; #ifdef DEBUG_PBCH - printf("extract_rbs (nushift %d): rx_offset=%d, symbol %u\n",frame_parms->nushift, - (rx_offset + ((symbol+s_offset)*(frame_parms->ofdm_symbol_size))),symbol); + printf("extract_rbs (nushift %d): rx_offset=%d, symbol %u\n", + nushiftmod4, + (rx_offset + ((symbol+s_offset) * (frame_parms->ofdm_symbol_size))), + symbol); int16_t *p = (int16_t *)rxF; for (int i =0; i<8; i++) { - printf("rxF [%d]= %d\n",i,rxF[i]); + printf("rxF.r [%d]= %d rxF.i [%d]= %d\n", i, rxF[i].r, i, rxF[i].i); printf("pbch extract rxF %d %d addr %p\n", p[2*i], p[2*i+1], &p[2*i]); } @@ -94,10 +94,12 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz, rxF_ext[j]=rxF[rx_offset]; #ifdef DEBUG_PBCH printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n", - (9*rb) + j, - rxF_ext[j].r, rxF_ext[j].i, + (9 * rb) + j, + rxF_ext[j].r, + rxF_ext[j].i, rx_offset, - rxF[rx_offset].r,rxF[rx_offset].j; + rxF[rx_offset].r, + rxF[rx_offset].i); #endif j++; } @@ -115,10 +117,13 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz, (i!=(nushiftmod4+8))) { rxF_ext[j]=rxF[rx_offset]; #ifdef DEBUG_PBCH - printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(rb<4) ? (9*rb) + j : (9*(rb-12))+j, - rxF_ext[j].r, rxF_ext[j].i, + printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n", + (rb < 4) ? (9 * rb) + j : (9 * (rb - 12)) + j, + rxF_ext[j].r, + rxF_ext[j].i, rx_offset, - rxF[rx_offset].r,rxF[rx_offset].j; + rxF[rx_offset].r, + rxF[rx_offset].i); #endif j++; } @@ -149,11 +154,14 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz, (i!=(nushiftmod4+8))) { dl_ch0_ext[j]=dl_ch0[i]; #ifdef DEBUG_PBCH - if ((rb==0) && (i<2)) - printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j, - dl_ch0_ext[j].r, dl_ch0_ext[j].i, + if ((rb == 0) && (i < 2)) + printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n", + j, + dl_ch0_ext[j].r, + dl_ch0_ext[j].i, i, - dl_ch0[j].r, dl_ch0[j].i, + dl_ch0[j].r, + dl_ch0[j].i); #endif j++; } @@ -169,10 +177,13 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz, (i!=(nushiftmod4+8))) { dl_ch0_ext[j]=dl_ch0[i]; #ifdef DEBUG_PBCH - printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j, - dl_ch0_ext[j].r, dl_ch0_ext[j].i, + printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n", + j, + dl_ch0_ext[j].r, + dl_ch0_ext[j].i, i, - dl_ch0[j].r, dl_ch0[j].i, + dl_ch0[j].r, + dl_ch0[j].i); #endif j++; } @@ -425,7 +436,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, } #ifdef DEBUG_PBCH - LOG_I(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n", log2_maxh, max_h); + LOG_I(PHY,"[PHY] PBCH log2_maxh = %f (%d)\n", log2_maxh, max_h); #endif __attribute__ ((aligned(32))) struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; nr_pbch_channel_compensation(rxdataF_ext, @@ -452,12 +463,8 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, UEscopeCopy(ue, pbchRxdataF_comp, pbch_unClipped, sizeof(struct complex16), frame_parms->nb_antennas_rx, pbch_e_rx_idx / 2, 0); UEscopeCopy(ue, pbchLlr, pbch_e_rx, sizeof(int16_t), frame_parms->nb_antennas_rx, pbch_e_rx_idx, 0); #ifdef DEBUG_PBCH - write_output("rxdataF_comp.m","rxFcomp",rxdataF_comp[0],240*3,1,1); - short *p = (short *)rxdataF_comp[0]); - for (int cnt = 0; cnt < 864 ; cnt++) - printf("pbch rx llr %d\n",*(pbch_e_rx+cnt)); - + printf("pbch rx llr %d\n", *(pbch_e_rx + cnt)); #endif // un-scrambling uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041; @@ -527,7 +534,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot; #ifdef DEBUG_PBCH - printf("xtra_byte %x payload %x\n", xtra_byte, payload); + printf("xtra_byte %x payload %x\n", result->xtra_byte, payload); for (int i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++) { // printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index 768099ebe5..b89c7cbb95 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -126,7 +126,7 @@ void nr_generate_pucch0(const PHY_VARS_NR_UE *ue, //txptr = &txdataF[0][re_offset]; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch0] symbol %d PRB %d (%u)\n",l,prb_offset[l],re_offset); + printf("\t [nr_generate_pucch0] symbol %d PRB %d (%d)\n",l,prb_offset[l], re_offset); #endif c16_t *txdataFptr = txdataF[0] + l2 * frame_parms->ofdm_symbol_size; const int32_t amp = amp16; @@ -777,7 +777,7 @@ void nr_generate_pucch2(const PHY_VARS_NR_UE *ue, #ifdef DEBUG_NR_PUCCH_TX printf( "\t [nr_generate_pucch2] (n=%d,i=%d) mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d " - "\tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", + "\tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", n, i, amp, @@ -801,7 +801,7 @@ void nr_generate_pucch2(const PHY_VARS_NR_UE *ue, #ifdef DEBUG_NR_PUCCH_TX printf( "\t [nr_generate_pucch2] (n=%d,i=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d " - "\tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", + "\tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", n, i, amp, diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c index 0ec5f23b40..08f234483b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c @@ -496,14 +496,14 @@ bool rx_sss_nr(PHY_VARS_NR_UE *ue, } //#ifdef DEBUG_SSS_NR - #define SSS_METRIC_FLOOR_NR (30000) if (*tot_metric > SSS_METRIC_FLOOR_NR) { Nid2 = GET_NID2(frame_parms->Nid_cell); Nid1 = GET_NID1(frame_parms->Nid_cell); LOG_D(PHY,"Nid2 %d Nid1 %d tot_metric %d, phase_max %d \n", Nid2, Nid1, *tot_metric, *phase_max); } - // #endif +// #endif + int re = 0; int im = 0; if (Nid1 == N_ID_1_NUMBER) { diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 3b8a6f8a68..233590b51f 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -1647,7 +1647,7 @@ void dft64(int16_t *x,int16_t *y,unsigned char scale) #ifdef D64STATS stop_meas(&ts_b); - printf("t: %llu cycles, d: %llu cycles, b: %llu cycles\n",ts_t.diff,ts_d.diff,ts_b.diff); + printf("t: %lld cycles, d: %lld cycles, b: %lld cycles\n",ts_t.diff, ts_d.diff, ts_b.diff); #endif @@ -1746,7 +1746,7 @@ void idft64(int16_t *x,int16_t *y,unsigned char scale) #ifdef D64STATS stop_meas(&ts_b); - printf("t: %llu cycles, d: %llu cycles, b: %llu cycles\n",ts_t.diff,ts_d.diff,ts_b.diff); + printf("t: %lld cycles, d: %lld cycles, b: %lld cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); #endif diff --git a/openair1/PHY/TOOLS/oai_dfts_neon.c b/openair1/PHY/TOOLS/oai_dfts_neon.c index 8b2dcd9aa7..058d4601b3 100644 --- a/openair1/PHY/TOOLS/oai_dfts_neon.c +++ b/openair1/PHY/TOOLS/oai_dfts_neon.c @@ -1013,7 +1013,11 @@ void dft64(int16_t *x,int16_t *y,unsigned char scale) #ifdef D64STATS stop_meas(&ts_b); - printf("t: %llu cycles, d: %llu cycles, b: %llu cycles\n",ts_t.diff,ts_d.diff,ts_b.diff); +#if defined(__x86_64__) || defined(__i386__) + printf("t: %lld cycles, d: %lld cycles, b: %lld cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#elif defined(__arm__) || defined(__aarch64__) + printf("t: %u cycles, d: %u cycles, b: %u cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#endif #endif @@ -1102,7 +1106,11 @@ void idft64(int16_t *x,int16_t *y,unsigned char scale) #ifdef D64STATS stop_meas(&ts_b); - printf("t: %llu cycles, d: %llu cycles, b: %llu cycles\n",ts_t.diff,ts_d.diff,ts_b.diff); +#if defined(__x86_64__) || defined(__i386__) + printf("t: %lld cycles, d: %lld cycles, b: %lld cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#elif defined(__arm__) || defined(__aarch64__) + printf("t: %u cycles, d: %u cycles, b: %u cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#endif #endif @@ -1433,7 +1441,11 @@ void dft256(int16_t *x,int16_t *y,unsigned char scale) #ifdef D256STATS stop_meas(&ts_b); - printf("t: %llu cycles, d: %llu cycles, b: %llu cycles\n",ts_t.diff,ts_d.diff,ts_b.diff); +#if defined(__x86_64__) || defined(__i386__) + printf("t: %lld cycles, d: %lld cycles, b: %lld cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#elif defined(__arm__) || defined(__aarch64__) + printf("t: %u cycles, d: %u cycles, b: %u cycles\n", ts_t.diff, ts_d.diff, ts_b.diff); +#endif #endif if (scale>0) { diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 06e31542d5..4a418d43b1 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -813,11 +813,6 @@ double interp(double x, double *xs, double *ys, int count); void simde_mm128_separate_real_imag_parts(simde__m128i *out_re, simde__m128i *out_im, simde__m128i in0, simde__m128i in1); void simde_mm256_separate_real_imag_parts(simde__m256i *out_re, simde__m256i *out_im, simde__m256i in0, simde__m256i in1); -static __attribute__((always_inline)) inline int count_bits_set(uint64_t v) -{ - return __builtin_popcountll(v); -} - #ifdef __cplusplus } #endif diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index a85e9afea0..6936fc81b1 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -549,13 +549,14 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { int rb2 = 0; int prbpos = 0; - for (int symbol=0;symbol<14;symbol++) { - for (int m=0;m<9;m++) { + for (int symbol = 0; symbol < 14; symbol++) { + for (int m = 0; m < 9; m++) { gNB->rb_mask_ul[symbol][m] = 0; - for (int i=0;i<32;i++) { - prbpos = (m*32)+i; - if (prbpos>gNB->frame_parms.N_RB_UL) break; - gNB->rb_mask_ul[symbol][m] |= (gNB->ulprbbl[prbpos]>0 ? 1 : 0)<gNB->frame_parms.N_RB_UL) + break; + gNB->rb_mask_ul[symbol][m] |= (gNB->ulprbbl[prbpos] > 0 ? 1U : 0) << i; } } } diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index fe36aa3425..369c388ad3 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -97,7 +97,6 @@ static void free_uci_inds(nfapi_nr_uci_indication_t *uci_ind) free(uci_ind->uci_list); uci_ind->uci_list = NULL; free(uci_ind); - uci_ind = NULL; } int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index 91037410ee..ba21bf8ec1 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -688,9 +688,8 @@ int main(int argc, char **argv) { else { while(fgets(buf, 63, proc_fd)) printf("%s", buf); + fclose(proc_fd); } - - fclose(proc_fd); cpu_freq_GHz = ((double)atof(buf))/1e6; #else cpu_freq_GHz = get_cpu_freq_GHz(); diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c index 0a041258c2..e8976ea898 100644 --- a/openair1/SIMULATION/LTE_PHY/syncsim.c +++ b/openair1/SIMULATION/LTE_PHY/syncsim.c @@ -312,7 +312,7 @@ int main(int argc, char **argv) { #ifdef IFFT_FPGA int **txdataF2; #endif - int **txdata,**txdata1 = NULL,**txdata2 = NULL; + int **txdata, **txdata1 = NULL, **txdata2 = NULL; double **s_re,**s_im,**s_re1,**s_im1,**s_re2,**s_im2,**r_re,**r_im,**r_re1,**r_im1,**r_re2,**r_im2; double iqim = 0.0; unsigned char pbch_pdu[6]; @@ -1180,12 +1180,12 @@ int main(int argc, char **argv) { s_re[aa][i] = tmp_re; s_im[aa][i] = tmp_im; - if (interf1>-20) { + if (interf1 >- 20 && txdata1) { s_re1[aa][i] = ((double)(((short *)txdata1[aa]))[(i<<1)]); s_im1[aa][i] = ((double)(((short *)txdata1[aa]))[(i<<1)+1]); } - if (interf2>-20) { + if (interf2 >- 20 && txdata2) { s_re2[aa][i] = ((double)(((short *)txdata2[aa]))[(i<<1)]); s_im2[aa][i] = ((double)(((short *)txdata2[aa]))[(i<<1)+1]); } diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index ac2c453fc5..e095f9aeb3 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -917,6 +917,11 @@ int main(int argc, char **argv) csv_file = fopen(filename_csv, "a"); if (csv_file == NULL) { printf("Can't open file \"%s\", errno %d\n", filename_csv, errno); + free(s_re); + free(s_im); + free(r_re); + free(r_im); + free(txdata); return 1; } // adding name of parameters into file diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 1a5bf3bb19..091b1ad4ab 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -902,6 +902,10 @@ int main(int argc, char *argv[]) csv_file = fopen(filename_csv, "a"); if (csv_file == NULL) { printf("Can't open file \"%s\", errno %d\n", filename_csv, errno); + free(s_re); + free(s_im); + free(r_re); + free(r_im); return 1; } // adding name of parameters into file diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c index 04445af3dc..cc754942a1 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c @@ -115,7 +115,7 @@ void display_data(int pss_sequence_number, int16_t *rxdata, int position) { int16_t *pss_sequence[pss_sequence] = {primary_synch0_time, primary_synch1_time, primary_synch2_time}; int16_t *pss_sequence_sl[pss_sequence] = {primary_synch0_time, primary_synch1_time}; int16_t *pss_sequence_time = pss_sequence[pss_sequence_number];; - if (get_softmodem_params()->sl_mode != 0) { + if (get_softmodem_params()->sl_mode != 0) pss_sequence_time = pss_sequence_sl[pss_sequence_number]; printf(" pss %6d data \n", pss_sequence_number); for (int i = 0; i < 4; i++) { diff --git a/openair1/SIMULATION/RF/dac.c b/openair1/SIMULATION/RF/dac.c index d5cb985c4f..dc4c09827b 100644 --- a/openair1/SIMULATION/RF/dac.c +++ b/openair1/SIMULATION/RF/dac.c @@ -107,6 +107,7 @@ double dac_fixed_gain(double *s_re[2], *amp1p=sqrt(*amp1p); } + AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n"); #ifdef DEBUG_DAC LOG_I(OCM,"DAC: amp %f, amp1 %f dB (%d,%d), tx_power target %f (actual %f %f),length %d,pos %d\n", @@ -122,7 +123,6 @@ double dac_fixed_gain(double *s_re[2], #endif - AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n"); for (i=0; icommon_vars.txdata; - AssertFatal(txdata != NULL,"txdata is null\n"); + AssertFatal(txdata,"txdata is null\n"); sf_offset = subframe*frame_parms->samples_per_tti; if (subframe>0) sf_offset_tdd = sf_offset - PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset; diff --git a/openair1/SIMULATION/TOOLS/gauss.c b/openair1/SIMULATION/TOOLS/gauss.c index cc4b1fb793..fe4c684e66 100644 --- a/openair1/SIMULATION/TOOLS/gauss.c +++ b/openair1/SIMULATION/TOOLS/gauss.c @@ -25,28 +25,24 @@ #include "defs.h" -unsigned int *generate_gauss_LUT(unsigned char Nbits, - unsigned char L - ) { - unsigned int *LUT_ptr,i; - LUT_ptr = (unsigned int *)malloc((1<<(Nbits-1))*sizeof(int)); +unsigned int *generate_gauss_LUT(unsigned char Nbits, unsigned char L) +{ + unsigned int *LUT_ptr = calloc((1U << (Nbits - 1)), sizeof(int)); assert(LUT_ptr); - for (i=0; i<(1<<(Nbits-1)); i++) { - LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1<<31))*erf(i*L/(double)(1<<(Nbits-1)))); + for (int i = 0; i < (1 << (Nbits - 1)); i++) { + LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1U << 31)) * erf(i * L / (double)(1 << (Nbits - 1)))); #ifdef LUTDEBUG - printf("pos %u : LUT_ptr[%u]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1))))); + printf("pos %d : LUT_ptr[%d]=%x (%f)\n", i, i, LUT_ptr[i], (double)(erf(i * L / (double)(1 << (Nbits -1 ))))); #endif //LUTDEBUG } - return(LUT_ptr); } -int gauss(unsigned int *gauss_LUT, - unsigned char Nbits - ) { +int gauss(unsigned int *gauss_LUT, unsigned char Nbits) +{ unsigned int search_pos,step_size,u,tmp,tmpm1,tmpp1,s; // Get a 32-bit uniform random-variable u = taus(); @@ -127,8 +123,10 @@ void main(int argc,char **argv) { // printf("%d\n",gauss(gauss_LUT_ptr,Nbits)); } - printf("Tail probability = %e(%x)\n",2*erfc((double)L*gauss_LUT_ptr[(1<<(Nbits-1))-1]/(unsigned int)(1<<31)),gauss_LUT_ptr[(1<<(Nbits-1))-1]); - printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n",maxg,ming,meang,sqrt(varg),(double)maxnum/Ntrials,maxnum); + printf("Tail probability = %e(%x)\n", + 2 * erfc((double)L * gauss_LUT_ptr[(1U << (Nbits - 1)) - 1] / (unsigned int)(1U << 31)), + gauss_LUT_ptr[(1U << (Nbits - 1)) - 1]); + printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n", maxg, ming, meang, sqrt(varg), (double)maxnum / Ntrials, maxnum); // for (i=0;i<(1<numlines++; } + return tdata->numlines; } - return tdata->numlines; } /* show */ else if (strstr(buf, "set") == buf) { char cmdbuf[TELNET_MAX_MSGLENGTH]; int sst = sscanf(tdata->tblname, "%*[^=]=%i", &chanidx); @@ -2229,11 +2229,12 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p if (debug) LOG_I(UTIL, "%s received %s\n", __FUNCTION__, buf); webdatadef_t *tdata = (webdatadef_t *)vdata; - tdata->numlines = 0; if (strncmp(buf, "set", 3) == 0) { return get_channel_params(buf, debug, vdata, prnt); } + int numlines = 0; if (tdata != NULL) { + tdata->numlines = 0; for (int i = 0; i < max_chan; i++) { if (defined_channels[i] != NULL) { tdata->numlines++; @@ -2245,8 +2246,9 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p else { snprintf(tdata->tblname, sizeof(tdata->tblname) - 1, "No running model in the system"); } + numlines = tdata->numlines; } - return tdata->numlines; + return numlines; } /* get_currentchannel_type */ /*------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/E1AP/e1ap.c b/openair2/E1AP/e1ap.c index 1c9ff19bff..a073ddddca 100644 --- a/openair2/E1AP/e1ap.c +++ b/openair2/E1AP/e1ap.c @@ -2030,21 +2030,21 @@ void *E1AP_CUUP_task(void *arg) case E1AP_BEARER_CONTEXT_SETUP_RESP: { const e1ap_bearer_setup_resp_t *resp = &E1AP_BEARER_CONTEXT_SETUP_RESP(msg); const e1ap_upcp_inst_t *inst = getCxtE1(myInstance); - AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance); + AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance); e1apCUUP_send_BEARER_CONTEXT_SETUP_RESPONSE(inst->cuup.assoc_id, resp); } break; case E1AP_BEARER_CONTEXT_MODIFICATION_RESP: { const e1ap_bearer_modif_resp_t *resp = &E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg); const e1ap_upcp_inst_t *inst = getCxtE1(myInstance); - AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance); + AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance); e1apCUUP_send_BEARER_CONTEXT_MODIFICATION_RESPONSE(inst->cuup.assoc_id, resp); } break; case E1AP_BEARER_CONTEXT_RELEASE_CPLT: { const e1ap_bearer_release_cplt_t *cplt = &E1AP_BEARER_CONTEXT_RELEASE_CPLT(msg); const e1ap_upcp_inst_t *inst = getCxtE1(myInstance); - AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance); + AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance); e1apCUUP_send_BEARER_CONTEXT_RELEASE_COMPLETE(inst->cuup.assoc_id, cplt); } break; diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c index dcc6ff13c3..77dc12ba24 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c @@ -179,10 +179,10 @@ static void capture_sst_sd(test_cond_value_t* test_cond_value, uint8_t *sst, uin static bool nssai_matches(nssai_t a_nssai, uint8_t b_sst, const uint32_t *b_sd) { - AssertFatal(b_sd == NULL || *b_sd <= 0xffffff, "illegal SD %d\n", *b_sd); if (b_sd == NULL) { return a_nssai.sst == b_sst && a_nssai.sd == 0xffffff; } else { + AssertFatal(*b_sd <= 0xffffff, "illegal SD %d\n", *b_sd); return a_nssai.sst == b_sst && a_nssai.sd == *b_sd; } } diff --git a/openair2/ENB_APP/NB_IoT_config.c b/openair2/ENB_APP/NB_IoT_config.c index 35e3ade4a4..e6fe6e5d71 100644 --- a/openair2/ENB_APP/NB_IoT_config.c +++ b/openair2/ENB_APP/NB_IoT_config.c @@ -155,11 +155,11 @@ int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nb NBIoTParams[i].chkPptr = &(NBIoTCheckParams[i]); } - for (int i=0; (ivalue.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - ie11->value.choice.CriticalityDiagnostics.procedureCode = 0L; + *ie11->value.choice.CriticalityDiagnostics.procedureCode = 0L; } /* optional */ @@ -1330,7 +1330,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(sctp_assoc_t assoc_id, f1ap_ue_cont /* transactionID */ if (0) { ie11->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - ie11->value.choice.CriticalityDiagnostics.transactionID = 0L; + *ie11->value.choice.CriticalityDiagnostics.transactionID = 0L; } /* optional */ diff --git a/openair2/F1AP/f1ap_ids.c b/openair2/F1AP/f1ap_ids.c index e467e074fd..64d4b0b938 100644 --- a/openair2/F1AP/f1ap_ids.c +++ b/openair2/F1AP/f1ap_ids.c @@ -53,7 +53,7 @@ bool cu_add_f1_ue_data(uint32_t ue_id, const f1_ue_data_t *data) return false; } f1_ue_data_t *idata = malloc(sizeof(*idata)); - AssertFatal(idata != NULL, "cannot allocate memory\n"); + AssertFatal(idata, "cannot allocate memory\n"); *idata = *data; hashtable_rc_t ret = hashtable_insert(cu2du_ue_mapping, key, idata); pthread_mutex_unlock(&cu2du_mutex); @@ -116,7 +116,7 @@ bool du_add_f1_ue_data(uint32_t ue_id, const f1_ue_data_t *data) return false; } f1_ue_data_t *idata = malloc(sizeof(*idata)); - AssertFatal(idata != NULL, "cannot allocate memory\n"); + AssertFatal(idata, "cannot allocate memory\n"); *idata = *data; hashtable_rc_t ret = hashtable_insert(du2cu_ue_mapping, key, idata); pthread_mutex_unlock(&du2cu_mutex); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index b8a64558d3..0d0c86513a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1544,7 +1544,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal (i 0) { @@ -1566,18 +1566,18 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - printf("NRRRC %u: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + printf("NRRRC %d: Southbound Transport %s\n", i, *(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); rrc->node_type = get_node_type(); rrc->node_id = gnb_id; if (NODE_IS_CU(rrc->node_type)) { paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - sprintf(aprefix,"%s.[%u].%s",GNB_CONFIG_STRING_GNB_LIST,i,GNB_CONFIG_STRING_SCTP_CONFIG); + sprintf(aprefix,"%s.[%d].%s", GNB_CONFIG_STRING_GNB_LIST, i, GNB_CONFIG_STRING_SCTP_CONFIG); config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix); - LOG_I(GNB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id); + LOG_I(GNB_APP,"F1AP: gNB_CU_id[%d] %d\n", k, rrc->node_id); rrc->node_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); - LOG_I(GNB_APP,"F1AP: gNB_CU_name[%d] %s\n",k,rrc->node_name); + LOG_I(GNB_APP,"F1AP: gNB_CU_name[%d] %s\n", k, rrc->node_name); rrc->eth_params_s.local_if_name = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_IF_NAME_IDX].strptr)); rrc->eth_params_s.my_addr = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_ADDRESS_IDX].strptr)); rrc->eth_params_s.remote_addr = strdup(*(GNBParamList.paramarray[i][GNB_REMOTE_S_ADDRESS_IDX].strptr)); diff --git a/openair2/LAYER2/MAC/slicing/slicing.c b/openair2/LAYER2/MAC/slicing/slicing.c index 48dd99afeb..cd31671c02 100644 --- a/openair2/LAYER2/MAC/slicing/slicing.c +++ b/openair2/LAYER2/MAC/slicing/slicing.c @@ -201,7 +201,7 @@ int addmod_static_slice_ul(slice_info_t *si, int index = _exists_slice(si->num, si->s, id); if (index >= 0) { for (int s = 0; s < si->num; ++s) { - static_slice_param_t *su = ul && si->s[s]->id == id && ul ? ul : si->s[s]->algo_data; + static_slice_param_t *su = ul && si->s[s]->id == id? ul : si->s[s]->algo_data; for (int i = su->posLow; i <= su->posHigh; ++i) { if (rbMap[i]) RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 176b5b8e7b..c5f3daf88f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1677,28 +1677,24 @@ void set_monitoring_periodicity_offset(NR_SearchSpace_t *ss, int get_nr_prach_occasion_info_from_index(uint8_t index, - uint32_t pointa, - uint8_t mu, - uint8_t unpaired, - uint16_t *format, - uint8_t *start_symbol, - uint8_t *N_t_slot, - uint8_t *N_dur, - uint8_t *N_RA_slot, - uint16_t *N_RA_sfn, - uint8_t *max_association_period) { - + uint32_t pointa, + uint8_t mu, + uint8_t unpaired, + uint16_t *format, + uint8_t *start_symbol, + uint8_t *N_t_slot, + uint8_t *N_dur, + uint8_t *N_RA_slot, + uint16_t *N_RA_sfn, + uint8_t *max_association_period) +{ int x; - int64_t s_map; + uint64_t s_map; uint8_t format2 = 0xff; if (pointa > 2016666) { //FR2 x = table_6_3_3_2_4_prachConfig_Index[index][2]; s_map = table_6_3_3_2_4_prachConfig_Index[index][5]; - for(int i = 0; i < 64 ;i++) { - if ( (s_map >> i) & 0x01) { - (*N_RA_sfn)++; - } - } + *N_RA_sfn += count_bits_set(s_map); *N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe *max_association_period = 160/(x * 10); if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ @@ -1722,15 +1718,10 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, return 1; } else { - if (unpaired) { x = table_6_3_3_2_3_prachConfig_Index[index][2]; s_map = table_6_3_3_2_3_prachConfig_Index[index][4]; - for(int i = 0; i < 64 ;i++) { - if ( (s_map >> i) & 0x01) { - (*N_RA_sfn)++; - } - } + *N_RA_sfn += count_bits_set(s_map); *N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe *max_association_period = 160/(x * 10); if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ @@ -1748,18 +1739,14 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, *start_symbol, *N_t_slot, *N_dur, - *N_RA_sfn); + *N_RA_sfn); } - return 1; - } + return 1; + } else { // FDD x = table_6_3_3_2_2_prachConfig_Index[index][2]; s_map = table_6_3_3_2_2_prachConfig_Index[index][4]; - for(int i = 0; i < 64 ; i++) { - if ( (s_map >> i) & 0x01) { - (*N_RA_sfn)++; - } - } + *N_RA_sfn += count_bits_set(s_map); *N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *start_symbol = table_6_3_3_2_2_prachConfig_Index[index][5]; @@ -2656,13 +2643,19 @@ uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset) { // - "UE procedure for applying transform precoding on PUSCH" long get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, nr_dci_format_t dci_format, uint8_t configuredGrant) { - if (configuredGrant && current_UL_BWP->configuredGrantConfig && current_UL_BWP->configuredGrantConfig->transformPrecoder) + if (configuredGrant + && current_UL_BWP + && current_UL_BWP->configuredGrantConfig + && current_UL_BWP->configuredGrantConfig->transformPrecoder) return *current_UL_BWP->configuredGrantConfig->transformPrecoder; - if (dci_format == NR_UL_DCI_FORMAT_0_1 && current_UL_BWP && current_UL_BWP->pusch_Config && current_UL_BWP->pusch_Config->transformPrecoder) + if (dci_format == NR_UL_DCI_FORMAT_0_1 + && current_UL_BWP + && current_UL_BWP->pusch_Config + && current_UL_BWP->pusch_Config->transformPrecoder) return *current_UL_BWP->pusch_Config->transformPrecoder; - if (current_UL_BWP->rach_ConfigCommon && current_UL_BWP->rach_ConfigCommon->msg3_transformPrecoder) + if (current_UL_BWP && current_UL_BWP->rach_ConfigCommon && current_UL_BWP->rach_ConfigCommon->msg3_transformPrecoder) return NR_PUSCH_Config__transformPrecoder_enabled; return NR_PUSCH_Config__transformPrecoder_disabled; @@ -2670,8 +2663,8 @@ long get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, nr_dci_format_ uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config, NR_SRS_Config_t *srs_config, - dci_field_t srs_resource_indicator) { - + dci_field_t srs_resource_indicator) +{ uint8_t n_antenna_port = 1; if (get_softmodem_params()->phy_test == 1) { // temporary hack to allow UL-MIMO in phy-test mode without SRS @@ -2687,7 +2680,7 @@ uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config, // shall be configured with the same value for all these SRS resources. if (srs_resource_set->usage == NR_SRS_ResourceSet__usage_codebook) { NR_SRS_Resource_t *srs_resource = srs_config->srs_ResourceToAddModList->list.array[sri]; - AssertFatal(srs_resource != NULL, "SRS resource indicated by DCI does not exist\n"); + AssertFatal(srs_resource, "SRS resource indicated by DCI does not exist\n"); n_antenna_port = 1 << srs_resource->nrofSRS_Ports; break; } @@ -2819,8 +2812,8 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config, dci_field_t srs_resource_indicator, nr_srs_feedback_t *srs_feedback, const uint8_t *nrOfLayers, - uint32_t *val) { - + uint32_t *val) +{ // It is only applicable to codebook based transmission. This field occupies 0 bits for non-codebook based // transmission. It also occupies 0 bits for codebook based transmission using a single antenna port. uint8_t nbits = 0; @@ -2829,8 +2822,9 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config, } uint8_t pusch_antenna_ports = get_pusch_nb_antenna_ports(pusch_Config, srs_config, srs_resource_indicator); - if ((pusch_Config && pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) || - pusch_antenna_ports == 1) { + if (!pusch_Config + || (pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) + || pusch_antenna_ports == 1) { return nbits; } @@ -3054,7 +3048,6 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config, } } - return nbits; } @@ -3612,8 +3605,7 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config, AssertFatal(startSymbol <= l0, "Wrong config, Start symbol %d cannot be later than dmrs_TypeA_Position %d \n", startSymbol, l0); // Section 7.4.1.1.2 in Spec 38.211 - AssertFatal(l0 == 2 || (l0 == 3 && (ld != 3 || ld != 4)), "ld 3 or 4 symbols only possible with dmrs_TypeA_Position POS2 \n"); - + AssertFatal(l0 == 2 || (l0 == 3 && (ld != 3 && ld != 4)), "ld 3 or 4 symbols only possible with dmrs_TypeA_Position POS2 \n"); } // number of front loaded symbols @@ -4274,11 +4266,8 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - if (coreset0 == NULL) - coreset0 = calloc(1,sizeof(*coreset0)); - - AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n"); - + AssertFatal(type0_PDCCH_CSS_config, "No type0 CSS configuration\n"); + AssertFatal(coreset0, "Coreset0 should have been allocated outside of this function\n"); coreset0->controlResourceSetId = 0; int duration = type0_PDCCH_CSS_config->num_symbols; @@ -4327,8 +4316,7 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0, int slots_per_frame, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - if(ss0 == NULL) - ss0 = calloc(1, sizeof(*ss0)); + AssertFatal(ss0, "SearchSpace0 should have been allocated outside of this function\n"); if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId = calloc(1, sizeof(*ss0->controlResourceSetId)); if(ss0->monitoringSymbolsWithinSlot == NULL) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c index 0a8a20dd74..73fb6782ae 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c @@ -181,7 +181,7 @@ static void sl_prepare_phy_config(int module_id, phycfg->sl_bwp_config.sl_ssb_offset_point_a = diff/scs_scaling; #ifdef SL_DEBUG - printf("diff:%d, scaling:%d, pointa:%d, ssb:%d\n", diff, scs_scaling, pointA_ARFCN, SSB_ARFCN); + printf("diff:%u, scaling:%d, pointa:%u, ssb:%u\n", diff, scs_scaling, pointA_ARFCN, SSB_ARFCN); #endif phycfg->sl_bwp_config.sl_dc_location = (bwp_generic->sl_TxDirectCurrentLocation_r16) ? diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 526a406d9c..e89e68f317 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -74,6 +74,7 @@ void init_RA(NR_UE_MAC_INST_t *mac, fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; prach_resources->RA_PREAMBLE_BACKOFF = 0; + AssertFatal(nr_rach_ConfigCommon, "Cannot handle scenario without nr_rach_ConfigCommon\n"); NR_SubcarrierSpacing_t prach_scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing; int n_prbs = get_N_RA_RB(prach_scs, mac->current_UL_BWP->scs); int start_prb = rach_ConfigGeneric->msg1_FrequencyStart + mac->current_UL_BWP->BWPStart; @@ -100,12 +101,10 @@ void init_RA(NR_UE_MAC_INST_t *mac, } else { LOG_E(NR_MAC, "Config not handled\n"); } - } else if (nr_rach_ConfigCommon){ + } else { LOG_I(NR_MAC, "Initialization of 4-step contention-based random access procedure\n"); prach_resources->RA_TYPE = RA_4STEP; ra->cfra = 0; - } else { - LOG_E(NR_MAC, "Config not handled\n"); } switch (rach_ConfigGeneric->powerRampingStep){ // in dB diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 3f59d64bd1..be7f9dfc1f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3731,13 +3731,10 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : long_bsr size %d Lcgbit 0x%02x Buffer_size %d %d %d %d %d %d %d %d\n", mac_ce_size, *((uint8_t*) mac_ce), ((NR_BSR_LONG *) mac_ce)->Buffer_size0, ((NR_BSR_LONG *) mac_ce)->Buffer_size1, ((NR_BSR_LONG *) mac_ce)->Buffer_size2, ((NR_BSR_LONG *) mac_ce)->Buffer_size3, ((NR_BSR_LONG *) mac_ce)->Buffer_size4, ((NR_BSR_LONG *) mac_ce)->Buffer_size5, ((NR_BSR_LONG *) mac_ce)->Buffer_size6, ((NR_BSR_LONG *) mac_ce)->Buffer_size7); - // update pointer and length - mac_ce = Buffer_size_ptr; mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_SHORT); } return mac_ce_len; - } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c index d514558b3e..c485461e56 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c @@ -510,13 +510,15 @@ uint8_t sl_determine_sci_1a_len(uint16_t *num_subchannels, ? *pscch_config->sl_NumReservedBits_r16 : 0; } - AssertFatal((num_reservedbits>=2) || (num_reservedbits<=4) , - "Num Reserved bits can only be 2or3or4. Resource Pool Configuration Error.\n"); + AssertFatal((num_reservedbits >= 2) && (num_reservedbits <= 4), + "Num Reserved bits can only be 2 or 3 or 4. Resource Pool Configuration Error.\n"); sci_1a_len += num_reservedbits; sci_1a->reserved_bits.nbits = num_reservedbits; - LOG_D(NR_MAC,"sci 1A - reserved_bits:%d, sci 1a len:%d, sci_1a->reserved_bits.nbits:%d\n", - num_reservedbits, sci_1a_len, sci_1a->reserved_bits.nbits); - + LOG_D(NR_MAC, + "sci 1A - reserved_bits:%d, sci 1a len:%d, sci_1a->reserved_bits.nbits:%d\n", + num_reservedbits, + sci_1a_len, + sci_1a->reserved_bits.nbits); LOG_D(NR_MAC,"sci 1A Length in bits: %d \n",sci_1a_len); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 1e92d08344..29feb0c4f4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -3084,7 +3084,9 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, if (mac_ce_p->tot_mac_ce_len > 0) { LOG_D(NR_MAC, "In %s copying %d bytes of MAC CEs to the UL PDU \n", __FUNCTION__, mac_ce_p->tot_mac_ce_len); - nr_write_ce_ulsch_pdu(pdu, mac, 0, NULL, mac_ce_p->bsr_t, mac_ce_p->bsr_s, mac_ce_p->bsr_l); + int size = nr_write_ce_ulsch_pdu(pdu, mac, 0, NULL, mac_ce_p->bsr_t, mac_ce_p->bsr_s, mac_ce_p->bsr_l); + if (size != mac_ce_p->tot_mac_ce_len) + LOG_E(NR_MAC, "MAC CE size computed by nr_write_ce_ulsch_pdu is %d while the one assumed before is %d\n", size, mac_ce_p->tot_mac_ce_len); pdu += (unsigned char) mac_ce_p->tot_mac_ce_len; #ifdef ENABLE_MAC_PAYLOAD_DEBUG diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 4c84d88680..1cca125300 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -652,7 +652,7 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP, // generation of DCI 0_0 to schedule msg3 retransmission NR_SearchSpace_t *ss = ra->ra_ss; NR_ControlResourceSet_t *coreset = ra->coreset; - AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg3 retransmission\n"); + AssertFatal(coreset, "Coreset cannot be null for RA-Msg3 retransmission\n"); const int coresetid = coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][coresetid]; @@ -1251,7 +1251,7 @@ static void nr_generate_Msg2(module_id_t module_idP, } NR_ControlResourceSet_t *coreset = ra->coreset; - AssertFatal(coreset != NULL, "Coreset cannot be null for RA-Msg2\n"); + AssertFatal(coreset, "Coreset cannot be null for RA-Msg2\n"); const int coresetid = coreset->controlResourceSetId; // Calculate number of symbols int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 20e8a6d624..e617184edd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1071,9 +1071,8 @@ void nr_schedule_ue_spec(module_id_t module_id, if (nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx) != R) { pdsch_pdu->mcsTable[0] = 0; } - AssertFatal(harq!=NULL,"harq is null\n"); - AssertFatal(harq->rounddl_bler.harq_round_max,"%d",harq->round); - pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round%4]; + AssertFatal(harq->round < gNB_mac->dl_bler.harq_round_max,"%d", harq->round); + pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round % 4]; pdsch_pdu->TBSize[0] = TBS; pdsch_pdu->dataScramblingId = *scc->physCellId; pdsch_pdu->nrOfLayers = nrOfLayers; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index ada64a4189..fa3e8f9e15 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -954,10 +954,10 @@ static uint8_t get_max_tpmi(const NR_PUSCH_Config_t *pusch_Config, { uint8_t max_tpmi = 0; - if ((pusch_Config && pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) || - num_ue_srs_ports == 1) { + if (!pusch_Config + || (pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) + || num_ue_srs_ports == 1) return max_tpmi; - } long max_rank = *pusch_Config->maxRank; long *ul_FullPowerTransmission = pusch_Config->ext1 ? pusch_Config->ext1->ul_FullPowerTransmission_r16 : NULL; @@ -1963,7 +1963,7 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_ const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_ServingCellConfigCommonSIB_t *scc_sib1 = sib1 ? sib1->servingCellConfigCommon : NULL; - AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n"); + AssertFatal(scc || scc_sib1, "We need one serving cell config common\n"); // no UEs if (nr_mac->UE_info.list[0] == NULL) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index f0d5b7ce18..2f1a05370e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -260,7 +260,7 @@ static int handle_ue_context_drbs_release(int rnti, newGtpuDeleteOneTunnel(f1inst, rnti, drb->rb_id); asn_sequence_del(&cellGroupConfig->rlc_BearerToAddModList->list, idx, 1); long *plcid = malloc(sizeof(*plcid)); - AssertFatal(plcid != NULL, "out of memory\n"); + AssertFatal(plcid, "out of memory\n"); *plcid = lcid; int ret = ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToReleaseList->list, plcid); DevAssert(ret == 0); @@ -392,7 +392,7 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) NR_SCHED_LOCK(&mac->sched_lock); NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id); - AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id); + AssertFatal(UE, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id); NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index bcf7c26ae6..d3320c9ac2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -45,17 +45,17 @@ static void f1_setup_request_direct(const f1ap_setup_req_t *req) if (req->cell[n].sys_info) { f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); - AssertFatal(copy_sys_info != NULL, "out of memory\n"); + AssertFatal(copy_sys_info, "out of memory\n"); f1ap_msg->cell[n].sys_info = copy_sys_info; copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); - AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + AssertFatal(copy_sys_info->mib, "out of memory\n"); memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); copy_sys_info->mib_length = orig_sys_info->mib_length; if (orig_sys_info->sib1_length > 0) { copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); - AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + AssertFatal(copy_sys_info->sib1, "out of memory\n"); memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); copy_sys_info->sib1_length = orig_sys_info->sib1_length; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index fea829f61e..6229d40bbf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -77,17 +77,17 @@ static void f1_setup_request_f1ap(const f1ap_setup_req_t *req) if (req->cell[n].sys_info) { f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); - AssertFatal(copy_sys_info != NULL, "out of memory\n"); + AssertFatal(copy_sys_info, "out of memory\n"); f1ap_setup->cell[n].sys_info = copy_sys_info; copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); - AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + AssertFatal(copy_sys_info->mib, "out of memory\n"); memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); copy_sys_info->mib_length = orig_sys_info->mib_length; if (orig_sys_info->sib1_length > 0) { copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); - AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + AssertFatal(copy_sys_info->sib1, "out of memory\n"); memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); copy_sys_info->sib1_length = orig_sys_info->sib1_length; } diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c index e18c8eddfb..cc10a9d7c3 100644 --- a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -116,7 +116,7 @@ static int drb_gtpu_create(instance_t instance, static instance_t get_n3_gtp_instance(void) { const e1ap_upcp_inst_t *inst = getCxtE1(0); - AssertFatal(inst != NULL, "need to have E1 instance\n"); + AssertFatal(inst, "need to have E1 instance\n"); return inst->gtpInstN3; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c index 45133dc2f4..497ed154d5 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c @@ -36,7 +36,7 @@ void *nr_pdcp_integrity_nia2_init(uint8_t integrity_key[16]) // No. The overhead is x8 times more. Don't change before measuring // return integrity_key; cbc_cmac_ctx_t* ctx = calloc(1, sizeof(cbc_cmac_ctx_t)); - AssertFatal(ctx != NULL, "Memory exhausted"); + AssertFatal(ctx, "Memory exhausted"); *ctx = init_aes_128_cbc_cmac(integrity_key); return ctx; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index b12142a881..55d245dd38 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -962,7 +962,7 @@ void nr_rlc_activate_srb0(int ue_id, void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data)) { struct srb0_data *srb0_data = calloc(1, sizeof(struct srb0_data)); - AssertFatal(srb0_data != NULL, "out of memory\n"); + AssertFatal(srb0_data, "out of memory\n"); srb0_data->ue_id = ue_id; srb0_data->data = data; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 92b8bd49aa..10b09a4dd2 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1148,10 +1148,11 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info) { uint32_t ret_mask = 0x0; + DevAssert(dl_info != NULL); NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); // DL indication after reception of DCI or DL PDU - if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) { + if (dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) { LOG_T(MAC, "[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) { LOG_T(MAC, ">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n", i, dl_info->dci_ind->number_of_dcis); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 387c03d4d7..f631563044 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1351,8 +1351,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, bwp->bwp_Common->pdcch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon)); bwp->bwp_Common->pdcch_ConfigCommon->present = NR_SetupRelease_PDCCH_ConfigCommon_PR_setup; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup)); - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL; - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet)); + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = NULL; int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); @@ -1400,7 +1399,6 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, NR_ControlResourceSet_t *coreset2 = get_coreset_config(bwp->bwp_Id, curr_bwp, ssb_bitmap); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset2); - bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); NR_SearchSpace_t *ss2 = rrc_searchspace_config(false, 10+bwp->bwp_Id, coreset2->controlResourceSetId); asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss2); @@ -1657,9 +1655,6 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int rep_id, int uid) { - NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); - csirep->reportConfigId = rep_id; - csirep->carrier = NULL; int resource_id = -1; int im_id = -1; for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { @@ -1678,6 +1673,9 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, // if there are no associated resources, do not configure if (resource_id < 0 || im_id < 0) return; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; csirep->resourcesForChannelMeasurement = resource_id; csirep->csi_IM_ResourcesForInterference = calloc(1, sizeof(*csirep->csi_IM_ResourcesForInterference)); *csirep->csi_IM_ResourcesForInterference = im_id; @@ -1721,9 +1719,6 @@ static void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int uid, int num_antenna_ports) { - NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); - csirep->reportConfigId = rep_id; - csirep->carrier = NULL; int resource_id = -1; for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; @@ -1740,6 +1735,9 @@ static void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, // if there are no associated resources, do not configure if (resource_id < 0) return; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; csirep->resourcesForChannelMeasurement = resource_id; csirep->csi_IM_ResourcesForInterference = NULL; csirep->nzp_CSI_RS_ResourcesForInterference = NULL; @@ -1881,7 +1879,7 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { - AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %ld\n", cellID); + AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %lu\n", cellID); NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); AssertFatal(sib1_message != NULL, "out of memory\n"); @@ -2027,7 +2025,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, c asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, Z8); asn1cSequenceAdd(Z8->list, long, ZoneEight); - asn1cCallocOne(ZoneEight, 0); + *ZoneEight = 0; asn1cCalloc(ServCellCom->uplinkConfigCommon, UL); asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); @@ -2289,9 +2287,6 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset); - bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = - calloc(1, sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); - NR_SearchSpace_t *ss2 = rrc_searchspace_config(false, 5, coreset->controlResourceSetId); asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss2); @@ -2585,7 +2580,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; - struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig->uplinkBWP_ToAddModList; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig ? uplinkConfig->uplinkBWP_ToAddModList : NULL; if (DL_BWP_list) { for (int i = 0; i < DL_BWP_list->list.count; i++) { NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i]; @@ -2680,7 +2675,8 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const int dl_antenna_ports = pdschap->N1 * pdschap->N2 * pdschap->XP; const int do_csirs = configuration->do_CSIRS; - AssertFatal(servingcellconfigcommon != NULL, "servingcellconfigcommon is null\n"); + AssertFatal(servingcellconfigcommon, "servingcellconfigcommon is null\n"); + AssertFatal(servingcellconfigdedicated, "servingcellconfigdedicated is null\n"); if (uecap == NULL) LOG_E(RRC, "No UE Capabilities available when programming default CellGroup in NSA\n"); @@ -2808,7 +2804,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC // Downlink BWPs int n_dl_bwp = 1; - if (servingcellconfigdedicated && servingcellconfigdedicated->downlinkBWP_ToAddModList) { + if (servingcellconfigdedicated->downlinkBWP_ToAddModList) { n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count; } if (n_dl_bwp > 0) { @@ -2838,8 +2834,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC // Uplink BWPs int n_ul_bwp = 1; - if (servingcellconfigdedicated && servingcellconfigdedicated->uplinkConfig - && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) { + if (servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) { n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; } if (n_ul_bwp > 0) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index edd3f1d7cb..0d745fb798 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -225,7 +225,7 @@ static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_ else if (dl_arfcn >= 2016667 && dl_arfcn < 2795832) freqssb = freqpointa + 60000 * offsetToPointA * 12 + (1 << scs) * 15000 * (kssb + 10ll * 12); else - AssertFatal(false, "Invalid absoluteFrequencyPointA: %d\n", dl_arfcn); + AssertFatal(false, "Invalid absoluteFrequencyPointA: %u\n", dl_arfcn); int bw_index = get_supported_band_index(scs, band > 256 ? FR2 : FR1, get_dl_bw(cell_info)); int band_size_hz = get_supported_bw_mhz(band > 256 ? FR2 : FR1, bw_index) * 1000 * 1000; @@ -253,7 +253,7 @@ static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_ const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; uint32_t scc_ssb_arfcn = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; AssertFatal(ssb_arfcn == scc_ssb_arfcn, - "mismatch of SCC SSB ARFCN original %d vs. computed %d! Note: you can remove this Assert, the gNB might run but UE " + "mismatch of SCC SSB ARFCN original %u vs. computed %u! Note: you can remove this Assert, the gNB might run but UE " "connection instable\n", scc_ssb_arfcn, ssb_arfcn); @@ -729,7 +729,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList = CALLOC(1, sizeof(*dedicatedNAS_MessageList)); - NR_DRB_ToAddMod_t *DRB_config = NULL; for (int i = 0; i < ue_p->nb_of_pdusessions; i++) { // bypass the new and already configured pdu sessions @@ -784,13 +783,11 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( ue_p->pduSession[i].cause_value = NGAP_CauseRadioNetwork_not_supported_5QI_value; continue; } - LOG_I(NR_RRC, - "PDU SESSION ID %ld, DRB ID %ld (index %d), QOS flow %d, 5QI %ld \n", - DRB_config->cnAssociation->choice.sdap_Config->pdu_Session, - DRB_config->drb_Identity, - i, - qos_flow_index, - ue_p->pduSession[i].param.qos[qos_flow_index].fiveQI); + LOG_I(NR_RRC, + "index %d, QOS flow %d, 5QI %ld \n", + i, + qos_flow_index, + ue_p->pduSession[i].param.qos[qos_flow_index].fiveQI); } ue_p->pduSession[i].status = PDU_SESSION_STATUS_DONE; @@ -954,7 +951,7 @@ static void cuup_notify_reestablishment(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p) pdu_session_to_mod_t *pdu_e1 = find_or_next_pdu_session(&req, pdu->param.pdusession_id); AssertError(pdu != NULL, continue, - "UE %d: E1 Bearer Context Modification: PDU session %d to setup is null\n", + "UE %u: E1 Bearer Context Modification: PDU session %d to setup is null\n", ue_p->rrc_ue_id, pdu->param.pdusession_id); /* Prepare PDU for E1 Bearear Context Modification Request */ @@ -2305,7 +2302,7 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc) f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_ctxt->rrc_ue_id); fprintf(f, - "UE %d CU UE ID %d DU UE ID %d RNTI %04x random identity %016lx", + "UE %d CU UE ID %u DU UE ID %d RNTI %04x random identity %016lx", i, ue_ctxt->rrc_ue_id, ue_data.secondary_ue, diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index cb2de0bf4c..b83a3f268e 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -146,14 +146,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) // we accept the DU nr_rrc_du_container_t *du = calloc(1, sizeof(*du)); - AssertFatal(du != NULL, "out of memory\n"); + AssertFatal(du, "out of memory\n"); du->assoc_id = assoc_id; /* ITTI will free the setup request message via free(). So the memory * "inside" of the message will remain, but the "outside" container no, so * allocate memory and copy it in */ du->setup_req = calloc(1,sizeof(*du->setup_req)); - AssertFatal(du->setup_req != NULL, "out of memory\n"); + AssertFatal(du->setup_req, "out of memory\n"); *du->setup_req = *req; if (mib != NULL && sib1 != NULL) { du->mib = mib->message.choice.mib; diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index f48ad83083..0aad9ea503 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -138,7 +138,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a FILE *f = NULL; if (uecap_file) f = fopen(uecap_file, "r"); - if(f){ + if (f) { size_t size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f); if (size == 0 || size == sizeof UE_NR_Capability_xer) LOG_E(NR_RRC,"UE Capabilities XER file %s is too large (%ld)\n", uecap_file, size); @@ -148,6 +148,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a assert(dec_rval.code == RC_OK); xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,(void *)UE_Capability_nr); } + fclose(f); } else LOG_E(NR_RRC,"Could not open UE Capabilities input file. Not handling OAI UE Capabilities.\n"); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 9e09db1a72..6db1582072 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -315,7 +315,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst) FILE *f = NULL; if (uecap_file) f = fopen(uecap_file, "r"); - if(f) { + if (f) { char UE_NR_Capability_xer[65536]; size_t size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f); if (size == 0 || size == sizeof UE_NR_Capability_xer) { @@ -326,6 +326,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst) xer_decode(0, &asn_DEF_NR_UE_NR_Capability, (void *)&rrc->UECap.UE_NR_Capability, UE_NR_Capability_xer, size); assert(dec_rval.code == RC_OK); } + fclose(f); } memset(&rrc->timers_and_constants, 0, sizeof(rrc->timers_and_constants)); diff --git a/openair3/NAS/UE/nas_proc.c b/openair3/NAS/UE/nas_proc.c index 81e11c87ec..65b531342a 100644 --- a/openair3/NAS/UE/nas_proc.c +++ b/openair3/NAS/UE/nas_proc.c @@ -1014,8 +1014,7 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid) ** Others: _nas_proc_data ** ** ** ***************************************************************************/ -int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t AcT, - uint8_t rsrq, uint8_t rsrp) +int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t AcT, uint8_t rsrq, uint8_t rsrp) { LOG_FUNC_IN; diff --git a/openair3/NAS/UE/nas_proc.h b/openair3/NAS/UE/nas_proc.h index bd88691de8..1f8a88d46d 100644 --- a/openair3/NAS/UE/nas_proc.h +++ b/openair3/NAS/UE/nas_proc.h @@ -111,9 +111,7 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid); * NAS procedures triggered by the network * -------------------------------------------------------------------------- */ - -int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t rat, uint8_t rsrp, - uint8_t rsrq); +int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t AcT, uint8_t rsrq, uint8_t rsrp); int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len); int nas_proc_establish_rej(nas_user_t *user); diff --git a/radio/IRIS/iris_lib.cpp b/radio/IRIS/iris_lib.cpp index 44cea81b4e..927c63d72d 100644 --- a/radio/IRIS/iris_lib.cpp +++ b/radio/IRIS/iris_lib.cpp @@ -133,7 +133,8 @@ static void trx_iris_end(openair0_device *device) { static int -trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { +trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) +{ using namespace std::chrono; int flag = 0; @@ -158,7 +159,7 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf return nsamps; } - if (flags == TX_BURST_START || flags == TX_BURST_MIDDLE) + if (flags == TX_BURST_START || flags == TX_BURST_MIDDLE) { } else if (flags == TX_BURST_END || flags == TX_BURST_START_AND_END) { flag |= SOAPY_SDR_END_BURST; diff --git a/radio/fhi_72/oran-config.c b/radio/fhi_72/oran-config.c index ec7eabc459..853d2cefc4 100644 --- a/radio/fhi_72/oran-config.c +++ b/radio/fhi_72/oran-config.c @@ -34,7 +34,7 @@ static void print_fh_eowd_cmn(unsigned index, const struct xran_ecpri_del_meas_cmn *eowd_cmn) { printf("\ - eowd_cmn[%d]:\n\ + eowd_cmn[%u]:\n\ initiator_en %d\n\ numberOfSamples %d\n\ filterType %d\n\ @@ -61,7 +61,7 @@ static void print_fh_eowd_cmn(unsigned index, const struct xran_ecpri_del_meas_c static void print_fh_eowd_port(unsigned index, unsigned vf, const struct xran_ecpri_del_meas_port *eowd_port) { printf("\ - eowd_port[%d][%d]:\n\ + eowd_port[%u][%u]:\n\ t1 %ld\n\ t2 %ld\n\ tr %ld\n\ diff --git a/radio/fhi_72/oran-init.c b/radio/fhi_72/oran-init.c index f05ae260c5..2fbca36d56 100644 --- a/radio/fhi_72/oran-init.c +++ b/radio/fhi_72/oran-init.c @@ -135,7 +135,7 @@ static uint32_t oran_allocate_uplane_buffers( uint32_t numBufs = XRAN_N_FE_BUF_LEN * ant * XRAN_NUM_OF_SYMBOL_PER_SLOT; status = xran_bm_init(instHandle, &pool, numBufs, bufSize); AssertFatal(XRAN_STATUS_SUCCESS == status, "Failed at xran_bm_init(), status %d\n", status); - printf("xran_bm_init() hInstance %p poolIdx %d elements %d size %d\n", instHandle, pool, numBufs, bufSize); + printf("xran_bm_init() hInstance %p poolIdx %u elements %u size %u\n", instHandle, pool, numBufs, bufSize); int count = 0; for (uint32_t a = 0; a < ant; ++a) { for (uint32_t j = 0; j < XRAN_N_FE_BUF_LEN; ++j) { @@ -158,7 +158,7 @@ static uint32_t oran_allocate_uplane_buffers( } } } - printf("xran_bm_allocate_buffer() hInstance %p poolIdx %d count %d\n", instHandle, pool, count); + printf("xran_bm_allocate_buffer() hInstance %p poolIdx %u count %d\n", instHandle, pool, count); return pool; } @@ -215,14 +215,14 @@ static void oran_allocate_cplane_buffers(void *instHandle, uint32_t bufSizeSec = sizeof(struct xran_section_desc); status = xran_bm_init(instHandle, &poolSec, numBufsSec, bufSizeSec); AssertFatal(XRAN_STATUS_SUCCESS == status, "Failed at xran_bm_init(), status %d\n", status); - printf("xran_bm_init() hInstance %p poolIdx %d elements %d size %d\n", instHandle, poolSec, numBufsSec, bufSizeSec); + printf("xran_bm_init() hInstance %p poolIdx %u elements %u size %u\n", instHandle, poolSec, numBufsSec, bufSizeSec); uint32_t poolPrb; uint32_t numBufsPrb = XRAN_N_FE_BUF_LEN * ant * XRAN_NUM_OF_SYMBOL_PER_SLOT; uint32_t bufSizePrb = size_of_prb_map; status = xran_bm_init(instHandle, &poolPrb, numBufsPrb, bufSizePrb); AssertFatal(XRAN_STATUS_SUCCESS == status, "Failed at xran_bm_init(), status %d\n", status); - printf("xran_bm_init() hInstance %p poolIdx %d elements %d size %d\n", instHandle, poolPrb, numBufsPrb, bufSizePrb); + printf("xran_bm_init() hInstance %p poolIdx %u elements %u size %u\n", instHandle, poolPrb, numBufsPrb, bufSizePrb); uint32_t count1 = 0; uint32_t count2 = 0; @@ -273,8 +273,8 @@ static void oran_allocate_cplane_buffers(void *instHandle, } } } - printf("xran_bm_allocate_buffer() hInstance %p poolIdx %d count %d\n", instHandle, poolPrb, count1); - printf("xran_bm_allocate_buffer() hInstance %p poolIdx %d count %d\n", instHandle, poolSec, count2); + printf("xran_bm_allocate_buffer() hInstance %p poolIdx %u count %u\n", instHandle, poolPrb, count1); + printf("xran_bm_allocate_buffer() hInstance %p poolIdx %u count %u\n", instHandle, poolSec, count2); } /* callback not actively used */