From 920c1452bdf6033f11634aa077c1551e5fb35c98 Mon Sep 17 00:00:00 2001 From: yilmazt <yilmazt@urecom.fr> Date: Wed, 31 Jul 2019 17:40:05 +0200 Subject: [PATCH] Minor changes to the organization of nr_phy simulators --- cmake_targets/autotests/test_case_list.xml | 22 ++-- common/utils/LOG/log.c | 2 +- openair1/SCHED/fapi_l1.c | 40 +++---- openair1/SIMULATION/NR_PHY/dlschsim.c | 84 ++------------ openair1/SIMULATION/NR_PHY/dlsim.c | 108 +++++------------- .../SIMULATION/NR_PHY/nr_dummy_functions.c | 9 ++ openair1/SIMULATION/NR_PHY/nr_unitary_defs.h | 58 ++++++++++ openair1/SIMULATION/NR_PHY/pbchsim.c | 34 +----- openair1/SIMULATION/NR_PHY/pucchsim.c | 31 +---- openair1/SIMULATION/NR_PHY/ulschsim.c | 52 +-------- openair1/SIMULATION/NR_PHY/ulsim.c | 95 ++++----------- 11 files changed, 176 insertions(+), 359 deletions(-) create mode 100644 openair1/SIMULATION/NR_PHY/nr_dummy_functions.c create mode 100644 openair1/SIMULATION/NR_PHY/nr_unitary_defs.h diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 41d9de7ec3..d30537424b 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1203,17 +1203,17 @@ <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec_args></pre_exec_args> <main_exec> $OPENAIR_DIR/cmake_targets/lte-simulators/build/dlsim_tm4</main_exec> - <main_exec_args> -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 - -m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70 - -m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 - -m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 - -m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30 - -m14 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30 - -m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 - -m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70 - -m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 - -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70 - -m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args> + <main_exec_args>-m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 + -m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70 + -m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 + -m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 + -m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30 + -m14 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30 + -m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 + -m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70 + -m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 + -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70 + -m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args> <tags>dlsim_tm4.test1 dlsim_tm4.test5 dlsim_tm4.test6 dlsim_tm4.test6b dlsim_tm4.test7 dlsim_tm4.test7b dlsim_tm4.test10 dlsim_tm4.test10b dlsim_tm4.test11 dlsim_tm4.TM2_test1 dlsim_tm4.TM2_test1b</tags> <search_expr_true>"passed"</search_expr_true> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 1860770351..1108eb46da 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -718,7 +718,7 @@ void logClean (void) } } -extern int oai_exit; +extern volatile int oai_exit;//extern int oai_exit; void flush_mem_to_file(void) { int fp; diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 5f8b4ec3db..e5f2420b03 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -935,27 +935,27 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) { eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_pdcch_symbols=0; } -if (NFAPI_MODE!=NFAPI_MODE_VNF) - for (i=0; i<number_hi_dci0_pdu; i++) { - hi_dci0_req_pdu = &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[i]; - LOG_D(PHY,"NFAPI: hi_dci0_pdu %d : type %d\n",i,hi_dci0_req_pdu->pdu_type); - - switch (hi_dci0_req_pdu->pdu_type) { - case NFAPI_HI_DCI0_DCI_PDU_TYPE: - handle_nfapi_hi_dci0_dci_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu); - eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_dci++; - break; - - case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: - handle_nfapi_hi_dci0_mpdcch_dci_pdu(eNB,proc,hi_dci0_req_pdu); - eNB->mpdcch_vars[subframe&1].num_dci++; - break; - - case NFAPI_HI_DCI0_HI_PDU_TYPE: - handle_nfapi_hi_dci0_hi_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu); - break; + if (NFAPI_MODE!=NFAPI_MODE_VNF) + for (i=0; i<number_hi_dci0_pdu; i++) { + hi_dci0_req_pdu = &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[i]; + LOG_D(PHY,"NFAPI: hi_dci0_pdu %d : type %d\n",i,hi_dci0_req_pdu->pdu_type); + + switch (hi_dci0_req_pdu->pdu_type) { + case NFAPI_HI_DCI0_DCI_PDU_TYPE: + handle_nfapi_hi_dci0_dci_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu); + eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_dci++; + break; + + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + handle_nfapi_hi_dci0_mpdcch_dci_pdu(eNB,proc,hi_dci0_req_pdu); + eNB->mpdcch_vars[subframe&1].num_dci++; + break; + + case NFAPI_HI_DCI0_HI_PDU_TYPE: + handle_nfapi_hi_dci0_hi_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu); + break; + } } - } if (NFAPI_MODE!=NFAPI_MONOLITHIC) { if (number_ul_pdu>0) { diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 59228ef01e..7b5ae806e8 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -25,102 +25,42 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> - +#include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" -#include "common/ran_context.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" -#include "PHY/types.h" +#include "PHY/defs_gNB.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" -#include "PHY/defs_gNB.h" +#include "PHY/types.h" #include "PHY/INIT/phy_init.h" -#include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_REFSIG/nr_mod_table.h" +#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" +#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" - #include "SCHED_NR/sched_nr.h" - -//#include "PHY/MODULATION/modulation_common.h" -//#include "common/config/config_load_configmodule.h" -//#include "UTIL/LISTS/list.h" -//#include "common/ran_context.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#define DEBUG_NR_DLSCHSIM PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; - double cpuf; - -// dummy functions int nfapi_mode = 0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { - return (0); -} -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { - return (0); -} - -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { - return (0); -} - -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { - return (0); -} - -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { - return (0); -} - -//uint32_t from_nrarfcn(int nr_bandP, uint32_t dl_earfcn) { return (0); } - -int32_t get_uldl_offset(int eutra_bandP) { - return (0); -} - -NR_IF_Module_t * -NR_IF_Module_init(int Mod_id) { - return (NULL); -} - -void exit_function(const char *file, const char *function, const int line, const char *s) -{ - const char *msg = s == NULL ? "no comment" : s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; -char quantize(double D, double x, unsigned char B) { - double qxd; - short maxlev; - qxd = floor(x / D); - maxlev = 1 << (B - 1); //(char)(pow(2,B-1)); - - //printf("x=%f,qxd=%f,maxlev=%d\n",x,qxd, maxlev); - - if (qxd <= -maxlev) - qxd = -maxlev; - else if (qxd >= maxlev) - qxd = maxlev - 1; - - return ((char) qxd); -} - -int main(int argc, char **argv) { +int main(int argc, char **argv) +{ char c; int i; //,j,l,aa; double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 0605c07163..b11886501c 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -19,119 +19,65 @@ * contact@openairinterface.org */ -#include <string.h> -#include <math.h> -#include <unistd.h> #include <fcntl.h> +#include <math.h> +#include <string.h> #include <sys/ioctl.h> #include <sys/mman.h> - +#include <unistd.h> +#include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" -#include "common/ran_context.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" -#include "PHY/types.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" +#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h" +#include "openair2/LAYER2/NR_MAC_UE/mac_extern.h" +#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" +#include "PHY/defs_gNB.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" -#include "PHY/defs_gNB.h" -#include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" +#include "PHY/phy_vars.h" +#include "PHY/types.h" +#include "PHY/INIT/phy_init.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/NR_REFSIG/nr_mod_table.h" +#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" -#include "PHY/phy_vars.h" - -#include "SCHED_NR/sched_nr.h" #include "SCHED_NR/fapi_nr_l1.h" +#include "SCHED_NR/sched_nr.h" #include "SCHED_NR_UE/defs.h" #include "SCHED_NR_UE/fapi_nr_ue_l1.h" - -#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" -#include "LAYER2/NR_MAC_UE/mac_defs.h" -#include "LAYER2/NR_MAC_UE/mac_extern.h" -#include "LAYER2/NR_MAC_UE/mac_proto.h" -#include "LAYER2/NR_MAC_gNB/mac_proto.h" - #include "NR_PHY_INTERFACE/NR_IF_Module.h" #include "NR_UE_PHY_INTERFACE/NR_IF_Module.h" - -#include "LAYER2/NR_MAC_UE/mac_proto.h" -//#include "LAYER2/NR_MAC_gNB/mac_proto.h" -//#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" -#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "RRC/NR/MESSAGES/asn1_msg.h" - +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; - - double cpuf; - -// dummy functions int nfapi_mode=0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);} -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } - -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } - -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } - -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) {return(0);} - -int32_t get_uldl_offset(int nr_bandP) {return(0);} - -NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);} - -int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info){return(0);} -int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info){return(0);} - -lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { return(SF_DL);} - -void exit_function(const char* file, const char* function, const int line,const char *s) { - const char * msg= s==NULL ? "no comment": s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} - -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const int8_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) -{ - return 0; -} +//Dummy Functions +lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms, unsigned char subframe) {return(SF_DL);} int rlc_module_init (void) {return(0);} -void pdcp_layer_init(void) {} -int rrc_init_nr_global_param(void){return(0);} - -void config_common(int Mod_idP, - int CC_idP, - int Nid_cell, - int nr_bandP, - uint64_t SSB_positions, - uint16_t ssb_periodicity, - uint64_t dl_CarrierFreqP, - uint32_t dl_BandwidthP - ); - +void pdcp_layer_init (void) {} +int rrc_init_nr_global_param (void) {return(0);} +void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP); +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);} // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; int main(int argc, char **argv) { - char c; - int i,aa;//,l; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; uint8_t snr1set=0; diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c new file mode 100644 index 0000000000..ae47b11b2f --- /dev/null +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -0,0 +1,9 @@ +int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); } +int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } +int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } +int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } +int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); } +int32_t get_uldl_offset(int nr_bandP) { return(0); } +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);} +int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); } +int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h new file mode 100644 index 0000000000..be04bc8213 --- /dev/null +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h @@ -0,0 +1,58 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*!\file openair1/SIMULATION/NR_PHY/nr_unitary_defs.h + * \brief + * \author Turker Yilmaz + * \date 2019 + * \version 0.1 + * \company EURECOM + * \email turker.yilmaz@eurecom.fr + * \note + * \warning +*/ + +#ifndef __NR_UNITARY_DEFS__H__ +#define __NR_UNITARY_DEFS__H__ + +volatile int oai_exit=0; + +void exit_function(const char* file, const char* function, const int line, const char *s) { + const char * msg= s==NULL ? "no comment": s; + printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); + exit(-1); +} + +char quantize(double D, double x, unsigned char B) { + double qxd; + short maxlev; + qxd = floor(x / D); + maxlev = 1 << (B - 1); //(char)(pow(2,B-1)); + + if (qxd <= -maxlev) + qxd = -maxlev; + else if (qxd >= maxlev) + qxd = maxlev - 1; + + return ((char) qxd); +} + +#endif diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 277c442a8c..22abbbcbc2 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -25,13 +25,9 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> - #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" #include "common/ran_context.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" #include "PHY/types.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" @@ -45,48 +41,26 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "PHY/phy_vars.h" - #include "SCHED_NR/sched_nr.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#define DEBUG_NR_PBCHSIM PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; - - double cpuf; - -// dummy functions int nfapi_mode=0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);} -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } - -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } - -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } - -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) {return(0);} - -//uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn) {return(0);} -int32_t get_uldl_offset(int nr_bandP) {return(0);} - -NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);} - -void exit_function(const char* file, const char* function, const int line,const char *s) { - const char * msg= s==NULL ? "no comment": s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; int main(int argc, char **argv) { - char c; - int i,aa;//,l; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double cfo=0; diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index f80734882c..0868bc4a3a 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -25,13 +25,9 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> - #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" #include "common/ran_context.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" #include "PHY/types.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" @@ -43,36 +39,19 @@ #include "PHY/INIT/phy_init.h" #include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" - -#include "SCHED_NR/sched_nr.h" - #include "PHY/NR_UE_TRANSPORT/pucch_nr.h" - +#include "SCHED_NR/sched_nr.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; openair0_config_t openair0_cfg[MAX_CARDS]; - double cpuf; - -// dummy functions int nfapi_mode=0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);} -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) {return(0);} -//uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn) {return(0);} -int32_t get_uldl_offset(int nr_bandP) {return(0);} - -NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);} - -void exit_function(const char* file, const char* function, const int line,const char *s) { - const char * msg= s==NULL ? "no comment": s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} // needed for some functions PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}}; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index db5887d672..b3f769fef0 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -25,14 +25,9 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> - #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" #include "common/ran_context.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" - #include "PHY/types.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" @@ -46,62 +41,27 @@ #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" - #include "SCHED_NR/sched_nr.h" - -//#include "PHY/MODULATION/modulation_common.h" -//#include "common/config/config_load_configmodule.h" -//#include "UTIL/LISTS/list.h" -//#include "common/ran_context.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#define DEBUG_NR_ULSCHSIM PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; - double cpuf; - -// dummy functions int nfapi_mode = 0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return (0); } -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return (0); } -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return (0); } -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return (0); } -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return (0); } -//uint32_t from_nrarfcn(int nr_bandP, uint32_t dl_earfcn) { return (0); } -int32_t get_uldl_offset(int eutra_bandP) { return (0); } -NR_IF_Module_t * NR_IF_Module_init(int Mod_id) { return (NULL); } - -void exit_function(const char *file, const char *function, const int line, const char *s) { - const char *msg = s == NULL ? "no comment" : s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; -char quantize(double D, double x, unsigned char B) { - double qxd; - short maxlev; - qxd = floor(x / D); - maxlev = 1 << (B - 1); //(char)(pow(2,B-1)); - - //printf("x=%f,qxd=%f,maxlev=%d\n",x,qxd, maxlev); - - if (qxd <= -maxlev) - qxd = -maxlev; - else if (qxd >= maxlev) - qxd = maxlev - 1; - - return ((char) qxd); -} - -int main(int argc, char **argv) { - +int main(int argc, char **argv) +{ char c; int i,sf; double SNR, snr0 = -2.0, snr1 = 2.0; //, SNR_lin; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 25ea6dd03f..a5b229ff79 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -25,103 +25,54 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> - +#include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/LOG/log.h" -#include "common/ran_context.h" - -#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" - -#include "SIMULATION/TOOLS/sim.h" -#include "SIMULATION/RF/rf.h" - -#include "PHY/types.h" +#include "PHY/defs_gNB.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" -#include "PHY/defs_gNB.h" +#include "PHY/phy_vars.h" +#include "PHY/types.h" #include "PHY/INIT/phy_init.h" -#include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" -#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/MODULATION/nr_modulation.h" +#include "PHY/NR_REFSIG/dmrs_nr.h" +#include "PHY/NR_REFSIG/nr_mod_table.h" +#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" +#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" +#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" -#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto.h" +#include "PHY/TOOLS/tools_defs.h" #include "SCHED_NR/sched_nr.h" #include "SCHED_NR_UE/defs.h" -#include "PHY/TOOLS/tools_defs.h" -#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" -#include "PHY/phy_vars.h" #include "SCHED_NR_UE/fapi_nr_ue_l1.h" - -//#include "PHY/MODULATION/modulation_common.h" -//#include "common/config/config_load_configmodule.h" -//#include "UTIL/LISTS/list.h" -//#include "common/ran_context.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "openair1/SIMULATION/RF/rf.h" +#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" +#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" //#define DEBUG_ULSIM + PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; - - - double cpuf; - -// dummy functions int nfapi_mode = 0; -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return (0); } -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return (0); } -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return (0); } -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return (0); } -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return (0); } -//uint32_t from_nrarfcn(int nr_bandP, uint32_t dl_earfcn) { return (0); } -int32_t get_uldl_offset(int eutra_bandP) { return (0); } - -NR_IF_Module_t * -NR_IF_Module_init(int Mod_id) { return (NULL); } - -void exit_function(const char *file, const char *function, const int line, const char *s) { - const char *msg = s == NULL ? "no comment" : s; - printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); - exit(-1); -} -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const int8_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) -{ - return 0; -} +// dummy functions +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; } // needed for some functions uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; -char quantize(double D, double x, unsigned char B) { - double qxd; - short maxlev; - qxd = floor(x / D); - maxlev = 1 << (B - 1); //(char)(pow(2,B-1)); - - //printf("x=%f,qxd=%f,maxlev=%d\n",x,qxd, maxlev); - - if (qxd <= -maxlev) - qxd = -maxlev; - else if (qxd >= maxlev) - qxd = maxlev - 1; - - return ((char) qxd); -} - -int main(int argc, char **argv) { - +int main(int argc, char **argv) +{ char c; int i,sf; double SNR, snr0 = -2.0, snr1 = 2.0; -- 2.26.2