diff --git a/CMakeLists.txt b/CMakeLists.txt index 9061f2f71c..fd64284007 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,7 +289,6 @@ add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"") add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") - # Debug related options ######################################### add_boolean_option(DEBUG_ASN1 False "ASN1 coder/decoder Debug" OFF) @@ -301,7 +300,7 @@ add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace" ON) set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI ${OCP_ITTI}/intertask_interface.cpp) -target_link_libraries(ITTI PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(ITTI PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # asn1c skeletons have hardcoded this flag to make customized debug logs # OAI uses this feature to re-use OAI LOG_I(ASN, ...) @@ -348,7 +347,7 @@ add_library(s1ap ${S1AP_DIR}/s1ap_eNB_ue_context.c ) target_link_libraries(s1ap PUBLIC asn1_s1ap) -target_link_libraries(s1ap PRIVATE nr_rrc asn1_nr_rrc lte_rrc) +target_link_libraries(s1ap PRIVATE nr_rrc asn1_nr_rrc_hdrs lte_rrc) # NGAP ############## @@ -368,8 +367,8 @@ add_library(ngap ${NGAP_DIR}/ngap_gNB_trace.c ${NGAP_DIR}/ngap_gNB_ue_context.c ) -target_link_libraries(ngap PUBLIC asn1_ngap lte_rrc) -target_link_libraries(ngap PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(ngap PUBLIC asn1_ngap) +target_link_libraries(ngap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) #M2AP ############## @@ -417,7 +416,7 @@ add_library(m3ap ) target_link_libraries(m3ap PUBLIC asn1_m3ap) target_link_libraries(m3ap PRIVATE m2ap) -target_link_libraries(m3ap PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(m3ap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) target_include_directories(m3ap PUBLIC "${M3AP_DIR}") #X2AP @@ -437,7 +436,7 @@ add_library(x2ap ${X2AP_DIR}/x2ap_timers.c ) target_link_libraries(x2ap PUBLIC asn1_x2ap) -target_link_libraries(x2ap PRIVATE nr_rrc lte_rrc) +target_link_libraries(x2ap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # F1AP @@ -566,7 +565,6 @@ set_target_properties(benetel_4g PROPERTIES COMPILE_FLAGS "-fvisibility=hidden - SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive") target_link_libraries(benetel_4g PRIVATE ${DPDK_LIBS}) target_link_libraries(benetel_4g PRIVATE pthread dl rt m numa) -target_link_libraries(benetel_4g PRIVATE asn1_nr_rrc asn1_lte_rrc) # Benetel 5G library ###################################################################### @@ -585,7 +583,6 @@ set_target_properties(benetel_5g PROPERTIES COMPILE_FLAGS "-fvisibility=hidden - SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive") target_link_libraries(benetel_5g PRIVATE ${DPDK_LIBS}) target_link_libraries(benetel_5g PRIVATE pthread dl rt m numa) -target_link_libraries(benetel_5g PRIVATE asn1_nr_rrc asn1_lte_rrc) ########################################################## @@ -655,11 +652,6 @@ add_boolean_option(NAS_BUILT_IN_UE True "UE NAS layer present in this e add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)" ON) -########################## -# ACCESS STRATUM LAYER2 OPTIONS -########################## -add_boolean_option(JUMBO_FRAME True "ENABLE LARGE SDU in ACCESS STRATUM (larger than common MTU)" ON) - ########################## # PDCP LAYER OPTIONS ########################## @@ -783,7 +775,6 @@ add_library(UTIL ${OPENAIR_DIR}/common/utils/time_meas.c ${OPENAIR_DIR}/common/utils/time_stat.c ) -target_link_libraries(UTIL PRIVATE asn1_nr_rrc asn1_lte_rrc) set(SECU_OSA_SRC ${OPENAIR2_DIR}/UTIL/OSA/osa_key_deriver.c @@ -822,7 +813,7 @@ set(SCHED_SRC ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c ) add_library(SCHED_LIB ${SCHED_SRC}) -target_link_libraries(SCHED_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCHED_LIB PRIVATE asn1_lte_rrc_hdrs) set(SCHED_NR_SRC ${OPENAIR1_DIR}/SCHED_NR/fapi_nr_l1.c @@ -831,7 +822,7 @@ set(SCHED_NR_SRC ${OPENAIR1_DIR}/SCHED_NR/phy_frame_config_nr.c ) add_library(SCHED_NR_LIB ${SCHED_NR_SRC}) -target_link_libraries(SCHED_NR_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCHED_NR_LIB PRIVATE asn1_nr_rrc_hdrs) set(SCHED_SRC_RU ${OPENAIR1_DIR}/SCHED/ru_procedures.c @@ -839,7 +830,7 @@ set(SCHED_SRC_RU ${OPENAIR1_DIR}/SCHED/prach_procedures.c ) add_library(SCHED_RU_LIB ${SCHED_SRC_RU}) -target_link_libraries(SCHED_RU_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCHED_RU_LIB PRIVATE asn1_lte_rrc_hdrs) set(SCHED_SRC_UE ${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c @@ -849,7 +840,7 @@ set(SCHED_SRC_UE ${OPENAIR1_DIR}/SCHED_UE/srs_pc.c ) add_library(SCHED_UE_LIB ${SCHED_SRC_UE}) -target_link_libraries(SCHED_UE_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCHED_UE_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) set(SCHED_SRC_NR_UE ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -859,7 +850,7 @@ set(SCHED_SRC_NR_UE ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c ) add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE}) -target_link_libraries(SCHED_NR_UE_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCHED_NR_UE_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # nFAPI @@ -889,7 +880,7 @@ set(NFAPI_PNF_SRC ${NFAPI_DIR}/pnf/src/pnf_p7_interface.c ) add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC}) -target_link_libraries(NFAPI_PNF_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(NFAPI_PNF_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) include_directories(${NFAPI_DIR}/pnf/public_inc) include_directories(${NFAPI_DIR}/pnf/inc) @@ -901,7 +892,7 @@ set(NFAPI_VNF_SRC ${NFAPI_DIR}/vnf/src/vnf_p7_interface.c ) add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC}) -target_link_libraries(NFAPI_VNF_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(NFAPI_VNF_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) include_directories(${NFAPI_DIR}/vnf/public_inc) include_directories(${NFAPI_DIR}/vnf/inc) @@ -915,7 +906,7 @@ set(NFAPI_USER_SRC ${NFAPI_USER_DIR}/gnb_ind_vars.c ) add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC}) -target_link_libraries(NFAPI_USER_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(NFAPI_USER_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) include_directories(${NFAPI_USER_DIR}) # Layer 1 @@ -1017,7 +1008,6 @@ add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} ) target_link_libraries(ldpc PRIVATE ldpc_gen_HEADERS) add_library(coding MODULE ${PHY_TURBOSRC} ) -target_link_libraries(coding PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(dfts MODULE ${OPENAIR1_DIR}/PHY/TOOLS/oai_dfts.c ) @@ -1274,27 +1264,23 @@ set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_comp set(PHY_NR_UE_SRC ${PHY_NR_UE_SRC} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c) add_library(PHY_COMMON ${PHY_SRC_COMMON}) -target_link_libraries(PHY_COMMON PRIVATE lte_rrc) add_dependencies(PHY_COMMON dfts) -target_link_libraries(PHY_COMMON PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(PHY_COMMON PRIVATE asn1_lte_rrc_hdrs) add_library(PHY ${PHY_SRC}) -target_link_libraries(PHY PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(PHY PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(PHY_UE ${PHY_SRC_UE}) -target_link_libraries(PHY_UE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(PHY_UE PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(PHY_NR_COMMON ${PHY_NR_SRC_COMMON}) -target_link_libraries(PHY_NR_COMMON PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(PHY_NR ${PHY_NR_SRC}) -target_link_libraries(PHY_NR PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(PHY_NR_UE ${PHY_NR_UE_SRC}) -target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(PHY_RU ${PHY_SRC_RU}) -target_link_libraries(PHY_RU PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(PHY_RU PRIVATE asn1_lte_rrc_hdrs) #Library for mex functions #########################3 @@ -1318,7 +1304,7 @@ set(PHY_MEX_UE ${OPENAIR_DIR}/common/utils/T/local_tracer.c ) add_library(PHY_MEX ${PHY_MEX_UE} ${CONFIG_LIB}) -target_link_libraries(PHY_MEX PRIVATE asn1_lte_rrc) +target_link_libraries(PHY_MEX PRIVATE asn1_lte_rrc_hdrs) #Layer 2 library ##################### @@ -1559,14 +1545,12 @@ set (MISC_NFAPI_LTE ) add_library(MISC_NFAPI_LTE_LIB ${MISC_NFAPI_LTE}) -target_link_libraries(MISC_NFAPI_LTE_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) set (MISC_NFAPI_NR ${OPENAIR1_DIR}/SCHED/nfapi_nr_dummy.c ) add_library(MISC_NFAPI_NR_LIB ${MISC_NFAPI_NR}) -target_link_libraries(MISC_NFAPI_NR_LIB PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(L2 ${L2_SRC} @@ -1575,16 +1559,16 @@ add_library(L2 ${MCE_APP_SRC} ) target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap) -target_link_libraries(L2 PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(MAC_NR ${MAC_NR_SRC}) -target_link_libraries(MAC_NR PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(MAC_NR PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(MAC_UE_NR ${MAC_NR_SRC_UE}) -target_link_libraries(MAC_UE_NR PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(MAC_UE_NR PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(L2_LTE ${L2_LTE_SRC}) -target_link_libraries(L2_LTE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(L2_LTE PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_library(L2_NR ${L2_NR_SRC} @@ -1597,13 +1581,13 @@ add_library(e1_if ${NR_RRC_DIR}/cucp_cuup_e1ap.c ) -target_link_libraries(e1_if PRIVATE asn1_nr_rrc asn1_lte_rrc asn1_f1ap e1ap GTPV1U) +target_link_libraries(e1_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap e1ap GTPV1U) add_library(e1_pdcp_if ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_e1_api.c ) -target_link_libraries(e1_pdcp_if PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(e1_pdcp_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap) @@ -1620,29 +1604,29 @@ add_library(L2_UE ${L2_SRC_UE} ${MAC_SRC_UE} ) -target_link_libraries(L2_UE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(L2_UE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(L2_UE_LTE_NR ${L2_RRC_SRC_UE} ${MAC_SRC_UE} ) -target_link_libraries(L2_UE_LTE_NR PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(L2_UE_LTE_NR PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) if (NOT ${NOS1}) target_compile_definitions(L2_UE PUBLIC -DPDCP_USE_NETLINK) endif() -target_link_libraries(L2_UE PRIVATE lte_rrc) +target_link_libraries(L2_UE PRIVATE asn1_lte_rrc_hdrs) add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} ) target_link_libraries(NR_L2_UE PRIVATE f1ap) -target_link_libraries(NR_L2_UE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(NR_L2_UE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(MAC_NR_COMMON ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c ) -target_link_libraries(MAC_NR_COMMON PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(MAC_NR_COMMON PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) include_directories("${OPENAIR2_DIR}/NR_UE_PHY_INTERFACE") include_directories("${OPENAIR2_DIR}/LAYER2") @@ -1660,7 +1644,7 @@ add_library (GTPV1U ${RRC_DIR}/rrc_eNB_GTPV1U.c ${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp ) -target_link_libraries(GTPV1U PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(GTPV1U PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) target_link_libraries(GTPV1U PRIVATE SIMU) include_directories(${OPENAIR3_DIR}/ocp-gtp) @@ -1670,7 +1654,7 @@ set (MME_APP_SRC ) add_library(MME_APP ${MME_APP_SRC}) target_link_libraries(MME_APP PRIVATE m2ap m3ap) -target_link_libraries(MME_APP PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(MME_APP PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) set(SCTP_SRC ${OPENAIR3_DIR}/SCTP/sctp_common.c @@ -1678,7 +1662,7 @@ set(SCTP_SRC ${OPENAIR3_DIR}/SCTP/sctp_eNB_itti_messaging.c ) add_library(SCTP_CLIENT ${SCTP_SRC}) -target_link_libraries(SCTP_CLIENT PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(SCTP_CLIENT PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) set(NAS_SRC ${OPENAIR3_DIR}/NAS/) set(libnas_api_OBJS @@ -1960,7 +1944,7 @@ target_link_libraries(LIB_NAS_SIMUE PRIVATE lte_rrc) set(NAS_SIM_LIB LIB_NAS_SIMUE) -target_link_libraries(LIB_NAS_SIMUE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(LIB_NAS_SIMUE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(LIB_NAS_UE ${NAS_SRC}UE/nas_itti_messaging.c @@ -1981,9 +1965,8 @@ add_library(LIB_NAS_UE $ ) target_include_directories(LIB_NAS_UE PRIVATE ${OPENAIR_DIR}/common/utils/ds/) -target_link_libraries(LIB_NAS_UE PRIVATE lte_rrc) set(NAS_UE_LIB LIB_NAS_UE) -target_link_libraries(LIB_NAS_UE PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(LIB_NAS_UE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) include_directories(${NAS_SRC}NR_UE) include_directories(${NAS_SRC}UE) @@ -2015,7 +1998,7 @@ add_library(LIB_5GNAS_GNB target_include_directories(LIB_5GNAS_GNB PRIVATE ${OPENAIR_DIR}/common/utils/ds/) target_link_libraries(LIB_5GNAS_GNB PRIVATE SECU_CN ${CRYPTO_LIBRARIES}) -target_link_libraries(LIB_5GNAS_GNB PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(LIB_5GNAS_GNB PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) # Simulation library ########################## @@ -2034,7 +2017,6 @@ set (SIMUSRC ) add_library(SIMU STATIC ${SIMUSRC} ) target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAIR1_DIR}/SIMULATION/RF) -target_link_libraries(SIMU PRIVATE asn1_nr_rrc asn1_lte_rrc) # Qt-based scope add_boolean_option(ENABLE_NRQTSCOPE OFF "Build the Qt-Scope" OFF) @@ -2046,16 +2028,15 @@ if (ENABLE_NRQTSCOPE) qt5_wrap_cpp(QTSCOPE_SOURCE_NR ${OPENAIR1_DIR}/PHY/TOOLS/nr_phy_qt_scope.h) add_library(nrqtscope MODULE ${QTSCOPE_SOURCE_NR}) target_link_libraries(nrqtscope PRIVATE Qt5::Widgets Qt5::Charts) - target_link_libraries(nrqtscope PRIVATE asn1_nr_rrc asn1_lte_rrc) + target_link_libraries(nrqtscope PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) endif() -add_library(SIMU_ETH -${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c -${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c -${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c -${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c -#${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c +add_library(SIMU_ETH STATIC + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c ) +target_link_libraries(SIMU_ETH PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) include_directories("${NFAPI_DIR}/nfapi/public_inc") include_directories("${NFAPI_DIR}/common/public_inc") @@ -2073,7 +2054,6 @@ add_library(rfsimulator MODULE ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c ) target_link_libraries(rfsimulator PRIVATE SIMU ${ATLAS_LIBRARIES}) -target_link_libraries(rfsimulator PRIVATE asn1_nr_rrc asn1_lte_rrc) add_library(oai_iqplayer MODULE ${OPENAIR_DIR}/radio/iqplayer/iqplayer_lib.c @@ -2166,9 +2146,6 @@ add_executable(lte-softmodem ${OPENAIR_DIR}/radio/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${PHY_INTERFACE_DIR}/queue_t.c ${OPENAIR_DIR}/common/utils/lte/ue_power.c @@ -2183,13 +2160,13 @@ target_link_libraries(lte-softmodem PRIVATE -Wl,--start-group lte_rrc nr_rrc s1ap m2ap x2ap m3ap GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${NAS_UE_LIB} ITTI SIMU + ${NAS_UE_LIB} ITTI SIMU SIMU_ETH -Wl,--end-group z dl) target_link_libraries(lte-softmodem PRIVATE ${LIBXML2_LIBRARIES}) target_link_libraries(lte-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp) target_link_libraries(lte-softmodem PRIVATE ${T_LIB}) -target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(oairu @@ -2211,7 +2188,7 @@ target_link_libraries(oairu PRIVATE -Wl,--end-group z dl) target_link_libraries(oairu PRIVATE pthread m CONFIG_LIB rt ${T_LIB}) -target_link_libraries(oairu PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(oairu PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) # force the generation of ASN.1 so that we don't need to wait during the build target_link_libraries(lte-softmodem PRIVATE @@ -2230,9 +2207,6 @@ add_executable(lte-uesoftmodem ${OPENAIR_DIR}/radio/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/lte/ue_power.c ${OPENAIR_DIR}/common/utils/lte/prach_utils.c @@ -2248,14 +2222,14 @@ target_link_libraries(lte-uesoftmodem PRIVATE -Wl,--start-group lte_rrc nr_rrc s1ap x2ap m2ap m3ap SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON - PHY_UE PHY_RU L2_UE L2_LTE SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB + PHY_UE PHY_RU L2_UE L2_LTE SIMU SIMU_ETH NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${NAS_UE_LIB} ITTI ${ATLAS_LIBRARIES} -Wl,--end-group z dl) target_link_libraries(lte-uesoftmodem PRIVATE ${LIBXML2_LIBRARIES}) target_link_libraries(lte-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${ATLAS_LIBRARIES}) target_link_libraries(lte-uesoftmodem PRIVATE ${T_LIB}) -target_link_libraries(lte-uesoftmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(lte-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) # force the generation of ASN.1 so that we don't need to wait during the build target_link_libraries(lte-uesoftmodem PRIVATE @@ -2277,7 +2251,6 @@ add_executable(nr-softmodem ${OPENAIR_DIR}/radio/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/lte/ue_power.c ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c @@ -2291,14 +2264,14 @@ target_link_libraries(nr-softmodem PRIVATE -Wl,--start-group UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECU_CN SECU_OSA ITTI ${NAS_UE_LIB} lte_rrc nr_rrc - ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU + ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH x2ap f1ap m2ap m3ap e1ap -Wl,--end-group z dl) target_link_libraries(nr-softmodem PRIVATE ${LIBXML2_LIBRARIES}) target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${ATLAS_LIBRARIES}) target_link_libraries(nr-softmodem PRIVATE ${T_LIB}) -target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_dependencies(nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc) @@ -2313,7 +2286,6 @@ target_link_libraries(nr-softmodem PRIVATE add_executable(nr-cuup executables/nr-cuup.c executables/softmodem-common.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${NR_RRC_DIR}/rrc_gNB_UE_context.c ${OPENAIR2_DIR}/E1AP/e1ap_setup.c @@ -2325,9 +2297,9 @@ add_executable(nr-cuup target_link_libraries(nr-cuup PRIVATE CONFIG_LIB ITTI SCTP_CLIENT - GTPV1U e1ap e1_pdcp_if f1ap + GTPV1U e1ap e1_pdcp_if f1ap SIMU_ETH SECU_OSA SECU_CN ${OPENSSL_LIBRARIES} crypt z sctp dl pthread) -target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc asn1_nr_rrc) +target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # nr-uesoftmodem is UE implementation ####################################### @@ -2344,7 +2316,6 @@ add_executable(nr-uesoftmodem ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c @@ -2357,13 +2328,13 @@ target_link_libraries(nr-uesoftmodem PRIVATE nr_rrc SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB - ITTI ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU + ITTI ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU SIMU_ETH -Wl,--end-group z dl) target_link_libraries(nr-uesoftmodem PRIVATE ${LIBXML2_LIBRARIES}) target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB}) -target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) if (ENABLE_LDPC_CUDA) @@ -2402,7 +2373,7 @@ add_executable(rftest ${SHLIB_LOADER_SOURCES} ) target_link_libraries(rftest PRIVATE minimal_lib CONFIG_LIB PHY_NR_COMMON UTIL pthread dl m ${T_LIB} ) -target_link_libraries(rftest PRIVATE asn1_lte_rrc asn1_nr_rrc) +target_link_libraries(rftest PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c @@ -2414,7 +2385,6 @@ target_link_libraries(polartest PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) -target_link_libraries(polartest PRIVATE asn1_nr_rrc asn1_lte_rrc) add_executable(smallblocktest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/smallblocktest.c @@ -2427,7 +2397,6 @@ target_link_libraries(smallblocktest PRIVATE -Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) -target_link_libraries(smallblocktest PRIVATE asn1_nr_rrc asn1_lte_rrc) add_executable(ldpctest @@ -2445,12 +2414,11 @@ target_link_libraries(ldpctest PRIVATE -Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) -target_link_libraries(ldpctest PRIVATE asn1_nr_rrc asn1_lte_rrc) add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${OPENAIR_DIR}/executables/softmodem-common.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} ) @@ -2458,10 +2426,11 @@ target_link_libraries(nr_dlschsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI dl ) -target_link_libraries(nr_dlschsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_dlschsim PRIVATE asn1_nr_rrc_hdrs) add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -2470,14 +2439,14 @@ target_link_libraries(nr_pbchsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI dl ) -target_link_libraries(nr_pbchsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_pbchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) #PUCCH ---> Prashanth add_executable(nr_pucchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${OPENAIR_DIR}/executables/softmodem-common.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} ) @@ -2485,45 +2454,42 @@ target_link_libraries(nr_pucchsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI dl ) -target_link_libraries(nr_pucchsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_pucchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(nr_dlsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${NR_UE_RRC_DIR}/rrc_nsa.c ${NFAPI_USER_DIR}/nfapi.c + ${NFAPI_USER_DIR}/gnb_ind_vars.c ${PHY_INTERFACE_DIR}/queue_t.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_dlsim PRIVATE - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON lte_rrc nr_rrc CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE x2ap SECU_CN ngap NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group + -Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECU_CN ngap -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) -target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(nr_prachsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${NR_UE_RRC_DIR}/rrc_nsa.c - ${NFAPI_USER_DIR}/nfapi.c - ${PHY_INTERFACE_DIR}/queue_t.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim PRIVATE - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON lte_rrc nr_rrc CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE x2ap SECU_CN ngap NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB CONFIG_LIB -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl) -target_link_libraries(nr_prachsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_prachsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${OPENAIR_DIR}/executables/softmodem-common.c ${PHY_INTERFACE_DIR}/queue_t.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -2532,16 +2498,17 @@ target_link_libraries(nr_ulschsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI dl ) -target_link_libraries(nr_ulschsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_ulschsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(nr_ulsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c + ${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${NR_UE_RRC_DIR}/rrc_nsa.c ${NFAPI_USER_DIR}/nfapi.c + ${NFAPI_USER_DIR}/gnb_ind_vars.c ${PHY_INTERFACE_DIR}/queue_t.c ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -2552,10 +2519,10 @@ if (ENABLE_LDPC_T1) endif() target_link_libraries(nr_ulsim PRIVATE - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON lte_rrc nr_rrc CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE x2ap SECU_CN ngap NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group + -Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECU_CN ngap -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) -target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) @@ -2572,7 +2539,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU ITTI -Wl,--end-group pthread m rt CONFIG_LIB ${ATLAS_LIBRARIES} ${T_LIB} dl ) - target_link_libraries(${myExe} PRIVATE asn1_nr_rrc asn1_lte_rrc) + target_link_libraries(${myExe} PRIVATE asn1_lte_rrc_hdrs) endforeach(myExe) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 23d6aee785..c51be6652c 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -22,15 +22,15 @@ nrmodule2_quectel: adb_ue_1: Host: nano - InitScript: /home/oaicicd/ci_ctl_adb.sh initialize 5200a933fee93521 - TermScript: /home/oaicicd/ci_ctl_adb.sh terminate 5200a933fee93521 - AttachScript: /home/oaicicd/ci_ctl_adb.sh attach 5200a933fee93521 - DetachScript: /home/oaicicd/ci_ctl_adb.sh detach 5200a933fee93521 - CheckStatusScript: /home/oaicicd/ci_ctl_adb.sh check 5200a933fee93521 - DataEnableScript: adb -s 5200a933fee93521 shell "svc data enable" - DataDisableScript: adb -s 5200a933fee93521 shell "svc data disable" - UENetworkScript: adb -s 5200a933fee93521 shell "ip address show | grep rmnet" - CmdPrefix: adb -s 5200a933fee93521 shell + InitScript: /home/oaicicd/ci_ctl_adb.sh initialize R3CM40LZPHT + TermScript: /home/oaicicd/ci_ctl_adb.sh terminate R3CM40LZPHT + AttachScript: /home/oaicicd/ci_ctl_adb.sh attach R3CM40LZPHT + DetachScript: /home/oaicicd/ci_ctl_adb.sh detach R3CM40LZPHT + CheckStatusScript: /home/oaicicd/ci_ctl_adb.sh check R3CM40LZPHT + DataEnableScript: adb -s R3CM40LZPHT shell "svc data enable" + DataDisableScript: adb -s R3CM40LZPHT shell "svc data disable" + UENetworkScript: adb -s R3CM40LZPHT shell "ip address show | grep rmnet_data0" + CmdPrefix: adb -s R3CM40LZPHT shell MTU: 1500 LogStore: /media/usb-drive/ci_adb_1-logs adb_ue_2: diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 3d15361430..1088563091 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -351,17 +351,18 @@ - nr_ulsim Test cases. (Test1: MCS 9 106 PRBs), - (Test2: MCS 16 50 PRBs), - (Test3: MCS 28 50 PRBs), - (Test4: MCS 9 217 PRBs), - (Test5: MCS 9 273 PRBs), + nr_ulsim Test cases. (Test1: MCS 9, 106 PRBs), + (Test2: MCS 16, 50 PRBs), + (Test3: MCS 28, 50 PRBs), + (Test4: MCS 9, 217 PRBs), + (Test5: MCS 9, 273 PRBs), (Test6: PUSCH Type A, 2 DMRS Symbols), (Test7: PUSCH Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), (Test8: PUSCH Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), (Test9: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), (Test10: 25 PRBs, 15 kHz SCS), - (Test11: MCS 0, low SNR performance) + (Test11: MCS 0, low SNR performance) + (Test12: MCS 28, 106 PRBs, Time shift 8) nr_ulsim -n100 -m9 -r106 -s5 -n100 -m16 -s10 @@ -373,8 +374,9 @@ -n100 -s5 -T 2,2 -U 1,2,1,1 -n100 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1 -n100 -u0 -m0 -R25 -r25 -i 1,0 - -n100 -m0 -S -0.6 -i 1,0 - test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 + -n100 -m0 -S -0.6 -i 1,0 + -n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8 + test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 1886c46052..1d4c55da20 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -56,7 +56,7 @@ CMAKE_CMD="$CMAKE" MAKE_CMD=make BUILD_ECLIPSE=0 NR="False" -OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope nrqtscope ldpc_cuda ldpc_t1 websrv" +OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope nrqtscope ldpc_cuda ldpc_t1 websrv oai_iqplayer" RU=0 CMAKE_C_FLAGS=() CMAKE_CXX_FLAGS=() @@ -300,10 +300,6 @@ function main() { SIMUS_PHY=1 echo_info "Will compile dlsim, ulsim, ..." shift;; - -S | --core_simulators) - SIMUS_CORE=1 - echo_info "Will compile security unitary tests" - shift;; -s | --check) OAI_TEST=1 echo_info "Will run auto-tests" @@ -466,17 +462,6 @@ function main() { cecho "OPENAIR_DIR = $OPENAIR_DIR" $green - # for conf files copy in this bash script - if [ -d /usr/lib/freeDiameter ]; then - export FREEDIAMETER_PREFIX=/usr - else - if [ -d /usr/local/lib/freeDiameter ]; then - export FREEDIAMETER_PREFIX=/usr/local - else - echo_warning "FreeDiameter prefix not found, install freeDiameter if EPC, HSS" - fi - fi - if [ "$CLEAN_ALL" = "1" ] ; then clean_all_files echo_info "Erased all previously producted files" @@ -517,25 +502,15 @@ function main() { fi execlist="" - if [ "$eNB" = "1" ] ; then - execlist="$execlist lte-softmodem" - fi - if [ "$gNB" = "1" ] ; then - execlist="$execlist nr-softmodem nr-cuup" - fi - if [ "$RU" = "1" ] ; then - execlist="$execlist oairu" - fi - if [ "$UE" = 1 ] ; then - execlist="$execlist lte-uesoftmodem" - fi - if [ "$nrUE" = 1 ] ; then - execlist="$execlist nr-uesoftmodem" - fi - - if [[ "$execlist" == "" && "$SIMUS_PHY" != "1" && "$HW" == "None" ]]; then - SKIP_SHARED_LIB_FLAG="True" - fi + [[ "$eNB" == "1" ]] && execlist="$execlist lte-softmodem" + [[ "$gNB" == "1" ]] && execlist="$execlist nr-softmodem nr-cuup" + [[ "$RU" == "1" ]] && execlist="$execlist oairu" + [[ "$UE" == 1 ]] && execlist="$execlist lte-uesoftmodem" + [[ "$nrUE" == 1 ]] && execlist="$execlist nr-uesoftmodem" + # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim + [[ "$SIMUS_PHY" == "1" ]] && execlist="$execlist dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim" + [[ "$BUILD_OPTLIB" != "" ]] && execlist="$execlist $BUILD_OPTLIB" + [[ "$execlist" != "" ]] && execlist="$execlist params_libconfig coding rfsimulator" DIR=$OPENAIR_DIR/cmake_targets @@ -552,34 +527,19 @@ function main() { echo_info "running $CMAKE_CMD" eval $CMAKE_CMD - for f in $execlist ; do - echo_info "Compiling $f..." - compilations $BUILD_DIR $f - done - - - # mandatory shared libraries common to UE and (e/g)NB - - if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then - echo_info "Building shared libraries common to UE and gNB" - - # configuration module libraries, one currently available, using libconfig - config_libconfig_shlib=params_libconfig - - compilations $BUILD_DIR $config_libconfig_shlib - - compilations $BUILD_DIR coding - + if [[ "$execlist" != "" ]]; then + echo_info "Compiling $execlist..." + compilations $BUILD_DIR all.txt $execlist fi if [ "$UE" = 1 ] ; then echo_info "Compiling UE specific part" - if [ $UE_ip -eq 1 ] + if [ "$UE_ip" = 1 ] then echo_info "Building ue_ip module" - compilations $BUILD_DIR ue_ip + compilations $BUILD_DIR ue_ip.txt ue_ip else echo_info "Bypassing ue_ip build" fi #IS_CONTAINER @@ -594,9 +554,9 @@ function main() { cd $DIR/nas_sim_tools/build eval $CMAKE_CMD .. - compilations nas_sim_tools usim - compilations nas_sim_tools nvram - compilations nas_sim_tools conf2uedata + compilations nas_sim_tools usim.txt usim + compilations nas_sim_tools nvram.txt nvram + compilations nas_sim_tools conf2uedata.txt conf2uedata # generate USIM data if [ -f conf2uedata ]; then @@ -606,42 +566,6 @@ function main() { fi fi - cd $DIR/$BUILD_DIR/build - - ################## - # PHY simulators # - ################## - if [ "$SIMUS_PHY" = "1" ] ; then - echo_info "Compiling physical unitary tests simulators" - # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim - simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim" - # simlist="ldpctest" - for f in $simlist ; do - compilations $BUILD_DIR $f - done - compilations $BUILD_DIR coding - fi - - ################### - # Core simulators # - ################### - if [ "$SIMUS_CORE" = "1" ] ; then - echo_info "Compiling security unitary tests simulators" - simlist="secu_knas_encrypt_eia1 secu_kenb aes128_ctr_encrypt aes128_ctr_decrypt secu_knas_encrypt_eea2 secu_knas secu_knas_encrypt_eea1 kdf aes128_cmac_encrypt secu_knas_encrypt_eia2" - for f in $simlist ; do - compilations $BUILD_DIR test_$f - done - fi - - ###################### - # Optional libraries # - ###################### - if [ ! -z "$BUILD_OPTLIB" ] ; then - for oklib in $BUILD_OPTLIB ; do - compilations $BUILD_DIR $oklib - done - fi - #################################################### # Build RF device and transport protocol libraries # #################################################### @@ -652,31 +576,31 @@ function main() { rm -f liboai_device.so if [ "$HW" == "OAI_USRP" ] ; then - compilations $BUILD_DIR oai_usrpdevif + compilations $BUILD_DIR oai_usrpdevif.txt oai_usrpdevif ln -sf liboai_usrpdevif.so liboai_device.so echo_info "liboai_device.so is linked to USRP device library" elif [ "$HW" == "OAI_BLADERF" ] ; then if [ -f "/usr/include/libbladeRF.h" ] ; then - compilations $BUILD_DIR oai_bladerfdevif + compilations $BUILD_DIR oai_bladerfdevif.txt oai_bladerfdevif fi ln -sf liboai_bladerfdevif.so liboai_device.so echo_info "liboai_device.so is linked to BLADERF device library" elif [ "$HW" == "OAI_LMSSDR" ] ; then # if [ -f "/usr/include/libbladeRF.h" ] ; then - compilations $BUILD_DIR oai_lmssdrdevif + compilations $BUILD_DIR oai_lmssdrdevif.txt oai_lmssdrdevif # fi ln -sf liboai_lmssdrdevif.so liboai_device.so echo_info "liboai_device.so is linked to LMSSDR device library" elif [ "$HW" == "OAI_IRIS" ] ; then - compilations $BUILD_DIR oai_irisdevif + compilations $BUILD_DIR oai_irisdevif.txt oai_irisdevif ln -s liboai_irisdevif.so liboai_device.so echo_info "liboai_device.so is linked to IRIS device library" elif [ "$HW" == "OAI_AW2SORI" ] ; then - compilations $BUILD_DIR aw2sori_transpro + compilations $BUILD_DIR aw2sori_transpro.txt aw2sori_transpro ln -sf libaw2sori_transpro.so libthirdparty_transpro.so echo_info "build libthirdparty_transpro.so for AW2SORI fronthaul" @@ -685,28 +609,22 @@ function main() { fi fi - #build simulators devices - if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then - echo_info "Compiling rfsimulator" - compilations $BUILD_DIR rfsimulator - fi - #build transport protocol libraries (currently only ETHERNET is available) if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then echo_info "Building transport protocol libraries" rm -f liboai_transpro.so if [ "$TP" == "Ethernet" ]; then - compilations $BUILD_DIR oai_eth_transpro + compilations $BUILD_DIR oai_eth_transpro.txt oai_eth_transpro ln -sf liboai_eth_transpro.so liboai_transpro.so echo_info "liboai_transpro.so is linked to ETHERNET transport" fi if [ "$TP" == "benetel4g" ]; then - compilations $BUILD_DIR benetel_4g + compilations $BUILD_DIR benetel_4g.txt benetel4g ln -sf libbenetel_4g.so liboai_transpro.so echo_info "liboai_transpro.so is linked to BENETEL4G transport" fi if [ "$TP" == "benetel5g" ]; then - compilations $BUILD_DIR benetel_5g + compilations $BUILD_DIR benetel_5g.txt benetel_5g ln -sf libbenetel_5g.so liboai_transpro.so echo_info "liboai_transpro.so is linked to BENETEL4G transport" fi diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index b8ff564ae8..a32f9afb26 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -207,8 +207,13 @@ check_errors() { } compilations() { - cd $OPENAIR_DIR/cmake_targets/$1/build - echo_info "Log file for compilation is being written to: $dlog/$2.txt" + local dir=$1 + shift 1 + local logfile=$1 + shift 1 + local targets=$@ + cd $OPENAIR_DIR/cmake_targets/$dir/build + echo_info "Log file for compilation is being written to: $dlog/$logfile" set +e { if [ "$BUILD_COVERITY_SCAN" == "1" ]; then @@ -217,28 +222,27 @@ compilations() { COV_SCAN_PREFIX="" fi if [ "$MAKE_CMD" != "" ]; then - $MAKE_CMD $2 + $MAKE_CMD $targets else if [ "$VERBOSE_COMPILE" == "1" ]; then - $COV_SCAN_PREFIX make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE + $COV_SCAN_PREFIX make -j`nproc` $targets VERBOSE=$VERBOSE_COMPILE else - $COV_SCAN_PREFIX make -j`nproc` $2 + $COV_SCAN_PREFIX make -j`nproc` $targets fi fi ret=$? - } > $dlog/$2.txt 2>&1 - set -e + } > $dlog/$logfile 2>&1 if [ "$VERBOSE_CI" == "1" ]; then - echo_info "====== Start of log for $2.txt ======" - cat $dlog/$2.txt - echo_info "====== End of log for $2.txt ======" + echo_info "====== Start of log for $logfile ======" + cat $dlog/$logfile + echo_info "====== End of log for $logfile ======" fi - check_warnings "$dlog/$2.txt" + check_warnings "$dlog/$logfile" if [[ $ret -eq 0 ]]; then - echo_success "$2 compiled" + echo_success "$targets compiled" else - check_errors "$dlog/$2.txt" - echo_error "$2 compilation failed" + check_errors "$dlog/$logfile" + echo_error "compilation of $targets failed" exit 1 fi } diff --git a/common/platform_constants.h b/common/platform_constants.h index 38ec11d49e..8fc8d9c237 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -19,26 +19,11 @@ * contact@openairinterface.org */ -/* - platform_constants.h - ------------------- - AUTHOR : Lionel GAUTHIER and Navid Nikaein - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - ***************************************************************************/ #ifndef __PLATFORM_CONSTANTS_H__ #define __PLATFORM_CONSTANTS_H__ -#include "LTE_asn_constant.h" -#include "NR_asn_constant.h" -#define NR_MAXDRB 14 -#ifdef JUMBO_FRAME #define NL_MAX_PAYLOAD 18000 /* this should cover the max mtu size*/ -#else -#define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/ -#endif #ifdef LARGE_SCALE #define NB_MODULES_MAX 128 @@ -48,19 +33,7 @@ #define NB_NODE_MAX 32 #endif -#ifdef JUMBO_FRAME #define MAX_IP_PACKET_SIZE 10000 // 9000 -#else -#if defined(OAI_NW_DRIVER_TYPE_ETHERNET) -/* SR: When using ethernet network driver the packet size is 1512 : - * 1500 bytes IP packet + 14 bytes ethernet header - */ -#define MAX_IP_PACKET_SIZE 1514 -#else -#define MAX_IP_PACKET_SIZE 1500 // 3000 -#endif -#endif -// overwrite the previous deinitions #define MAX_MODULES NB_MODULES_MAX #define MAX_NR_RRC_UE_CONTEXTS 64 @@ -89,62 +62,29 @@ #define MAX_MANAGED_GNB_PER_MOBILE 2 /// NB-IOT -#define NB_RB_MAX_NB_IOT (LTE_maxDRB_NB_r13 + 3) // MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5 +#define NB_RB_MAX_NB_IOT (2 + 3) /* 2 from LTE_maxDRB_NB_r13 in LTE_asn_constant.h + 3 SRBs */ #define DEFAULT_RAB_ID 1 -#define NB_RB_MAX (LTE_maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */ -#define NR_NB_RB_MAX (NR_maxDRB + 3) +#define NB_RB_MAX (11 + 3) /* LTE_maxDRB from LTE_asn_constant.h + 3 SRBs */ +#define NR_NB_RB_MAX (29 + 3) /* NR_maxDRB from NR_asn_constant.hm + 3 SRBs */ #define NGAP_MAX_PDU_SESSION (256) /* As defined in TS 38.413 9.2.1.1 Range Bound for PDU Sessions. */ #define NGAP_MAX_DRBS_PER_UE (32) /* As defined in TS 38.413 9.2.1.1 - maxnoofDRBs */ -#define NB_RB_MBMS_MAX (LTE_maxSessionPerPMCH * LTE_maxServiceCount) +#define NB_RB_MBMS_MAX (29 * 16) /* 29 = LTE_maxSessionPerPMCH + 16 = LTE_maxServiceCount from LTE_asn_constant.h */ -#define NB_RAB_MAX LTE_maxDRB /* was 8, now 11 */ -#define RAB_SHIFT1 9 -#define RAB_SHIFT2 3 -//#define RAB_OFFSET 0x0007 +#define NB_RAB_MAX 11 /* from LTE_maxDRB in LTE_asn_constant.h */ #define RAB_OFFSET 0x000F -#define RAB_OFFSET1 0x7E00 -#define RAB_OFFSET2 0x01F8 -#define DIR_OFFSET 0x8000 -#define DIR_SHIFT 15 -#define CH_OFFSET 0x0004 -#define CH_SHIFT 2 // RLC Entity #define RLC_TX_MAXSIZE 10000000 #define RLC_RX_MAXSIZE 10000000 - -// RLC_AM_SEND_MRW -#define SEND_MRW_OFF 15 #define SEND_MRW_ON 240 -// RLC_SEGMENTATION_INDICATION -#define SEGMENTATION_NOT_ALLOWED 0 -#define SEGMENTATION_ALLOWED 1 - -// RLC_DELIVERY_OF_ERRONEOUS_SDU -#define DELIVERY_OF_ERRONEOUS_SDU_NO 0 -#define DELIVERY_OF_ERRONEOUS_SDU_YES 1 -#define DELIVERY_OF_ERRONEOUS_SDU_NO_DETECT 2 - // CBA constant #define NUM_MAX_CBA_GROUP 4 -#ifndef __cplusplus -#ifndef NULL -#define NULL 0 -#endif -#ifndef null -#define null 0 -#endif -#endif - -#define UNUSED_PARAM_MBMS_SESSION_ID 0 -#define UNUSED_PARAM_MBMS_SERVICE_ID 0 - #define printk printf #define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE) diff --git a/common/ran_context.h b/common/ran_context.h index 320d431e73..244e6fd30d 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -34,17 +34,18 @@ #define __RAN_CONTEXT_H__ #include -#include "common/platform_constants.h" -#include "PHY/defs_eNB.h" -#include "PHY/types.h" -#include "PHY/impl_defs_top.h" - -#include "PHY/defs_L1_NB_IoT.h" -#include "RRC/LTE/defs_NB_IoT.h" -#include "RRC/LTE/rrc_defs.h" -#include "RRC/NR/nr_rrc_defs.h" -#include +#include +// forward declarations to avoid including the full typess ***eNB; +struct PHY_VARS_gNB_s; +struct PHY_VARS_eNB_NB_IoT_s; +struct eNB_RRC_INST_s; +struct gNB_RRC_INST_s; +struct eNB_MAC_INST_s; +struct eNB_MAC_INST_NB_IoT_s; +struct gNB_MAC_INST_s; +struct gtpv1u_data_s; +struct RU_t_s; typedef struct { /// RAN context config file name @@ -98,7 +99,7 @@ typedef struct { /// NR MAC context variables struct gNB_MAC_INST_s **nrmac; /// GTPu descriptor - gtpv1u_data_t *gtpv1u_data_g; + struct gtpv1u_data_s *gtpv1u_data_g; /// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces struct RU_t_s **ru; /// Mask to indicate fronthaul setup status of RU (hard-limit to 64 RUs) diff --git a/common/utils/T/check_vcd.c b/common/utils/T/check_vcd.c index 1460d7e20a..4a21e4d2f5 100644 --- a/common/utils/T/check_vcd.c +++ b/common/utils/T/check_vcd.c @@ -19,7 +19,19 @@ #define ENABLE_USE_CPU_EXECUTION_TIME #include "../LOG/vcd_signal_dumper.c" -void err(char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +/* + * Dummy needed by assertions.h + */ +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + if (assert) { + abort(); + } else { + exit(EXIT_SUCCESS); + } +} + +void err(char *fmt, ...) __attribute__((format(printf, 1, 2))); void err(char *fmt, ...) { va_list ap; diff --git a/common/utils/assertions.h b/common/utils/assertions.h index b2916139e0..3424392e7a 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -29,6 +29,9 @@ #include #include +#define OAI_EXIT_NORMAL 0 +#define OAI_EXIT_ASSERT 1 + #define _Assert_Exit_ \ if (getenv("gdbStacks")) { \ char tmp [1000]; \ @@ -38,7 +41,8 @@ fprintf(stderr, "\nExiting execution\n"); \ fflush(stdout); \ fflush(stderr); \ - abort(); + exit_function(__FILE__, __FUNCTION__, __LINE__, "_Assert_Exit_", OAI_EXIT_ASSERT); \ + abort(); // to avoid gcc warnings - never executed unless app-specific exit_function() does not exit() nor abort() #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ diff --git a/common/utils/minimal_stub.c b/common/utils/minimal_stub.c index 79e35bf7a6..be9c1b399d 100644 --- a/common/utils/minimal_stub.c +++ b/common/utils/minimal_stub.c @@ -2,5 +2,11 @@ int T_stdout; #endif -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + if (assert) { + abort(); + } else { + exit(EXIT_SUCCESS); + } } diff --git a/common/utils/telnetsrv/CMakeLists.txt b/common/utils/telnetsrv/CMakeLists.txt index f87a65b509..7994a1d151 100644 --- a/common/utils/telnetsrv/CMakeLists.txt +++ b/common/utils/telnetsrv/CMakeLists.txt @@ -35,7 +35,7 @@ add_library(telnetsrv MODULE telnetsrv_measurements.c ) target_link_libraries(telnetsrv PRIVATE history) -target_link_libraries(telnetsrv PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(telnetsrv PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) message(STATUS "Add enb specific telnet functions in libtelnetsrv_enb.so") add_library(telnetsrv_enb MODULE @@ -43,7 +43,7 @@ add_library(telnetsrv_enb MODULE telnetsrv_enb_phycmd.c ) add_dependencies(telnetsrv telnetsrv_enb) -target_link_libraries(telnetsrv_enb PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(telnetsrv_enb PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) message(STATUS "No specific telnet functions for gnb") @@ -52,7 +52,7 @@ message(STATUS "No specific telnet functions for 4Gue") message(STATUS "Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so") add_library(telnetsrv_5Gue MODULE telnetsrv_5Gue_measurements.c) add_dependencies(telnetsrv telnetsrv_5Gue) -target_link_libraries(telnetsrv_5Gue PRIVATE asn1_nr_rrc asn1_lte_rrc) +target_link_libraries(telnetsrv_5Gue PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) # all libraries should be written to root build dir set_target_properties(telnetsrv telnetsrv_enb telnetsrv_5Gue diff --git a/common/utils/telnetsrv/telnetsrv_enb_measurements.c b/common/utils/telnetsrv/telnetsrv_enb_measurements.c index b3f52a5e27..b8898b665e 100644 --- a/common/utils/telnetsrv/telnetsrv_enb_measurements.c +++ b/common/utils/telnetsrv/telnetsrv_enb_measurements.c @@ -51,6 +51,8 @@ #include "telnetsrv_cpumeasur_def.h" #include "openair2/LAYER2/MAC/mac.h" #include "openair1/PHY/phy_extern.h" +#include "openair2/LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/PDCP_v10.1.0/pdcp.c" void measurcmd_display_macstats(telnet_printfunc_t prnt); void measurcmd_display_macstats_ue(telnet_printfunc_t prnt); diff --git a/common/utils/telnetsrv/telnetsrv_enb_phycmd.c b/common/utils/telnetsrv/telnetsrv_enb_phycmd.c index f7deec1801..f3b40980f1 100644 --- a/common/utils/telnetsrv/telnetsrv_enb_phycmd.c +++ b/common/utils/telnetsrv/telnetsrv_enb_phycmd.c @@ -38,6 +38,10 @@ #include "telnetsrv.h" #define TELNETSRV_PHYCMD_MAIN #include "telnetsrv_phycmd.h" + +#include "PHY/defs_eNB.h" +#include "LAYER2/MAC/mac_proto.h" + char *prnbuff; extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char *buffer, int length); diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index 3cd18fab02..b351a667b5 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -176,7 +176,13 @@ void initFloatingCoresTpool(int nbThreads,tpool_t *pool, bool performanceMeas, c #ifdef TEST_THREAD_POOL volatile int oai_exit=0; -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + if (assert) { + abort(); + } else { + exit(EXIT_SUCCESS); + } } struct testData { diff --git a/common/utils/websrv/CMakeLists.txt b/common/utils/websrv/CMakeLists.txt index dd5576ae79..fd1b216c88 100644 --- a/common/utils/websrv/CMakeLists.txt +++ b/common/utils/websrv/CMakeLists.txt @@ -62,7 +62,6 @@ add_library(websrv MODULE websrv_utils.c ../../../openair1/PHY/TOOLS/nr_phy_scope.c ) -target_link_libraries(websrv PRIVATE asn1_lte_rrc asn1_nr_rrc) target_link_libraries(websrv PRIVATE ulfius jansson) target_compile_definitions(websrv PUBLIC WEBSRVSCOPE) # put websrv into build root and not under build/common/utils/websrv/ diff --git a/doc/Doxyfile b/doc/Doxyfile index 51492143d7..198bede607 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -2244,7 +2244,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/defs_L1_NB_IoT.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/phy_extern_ue.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/defs_gNB.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/primary_synch.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/defs_NB_IoT.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/lte_refsig.h \ diff --git a/executables/lte-ru.c b/executables/lte-ru.c index 8d5f4254ee..a784ee5a09 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -51,6 +51,7 @@ #include "PHY/defs_common.h" #include "PHY/types.h" #include "PHY/INIT/phy_init.h" +#include "PHY/phy_extern.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" @@ -105,13 +106,6 @@ void wait_eNBs(void); const char ru_states[6][9] = {"RU_IDLE","RU_CONFIG","RU_READY","RU_RUN","RU_ERROR","RU_SYNC"}; -extern const char NB_functions[7][20]; -extern const char NB_timing[2][20]; - - -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; - - #if defined(PRE_SCD_THREAD) #include "common/ran_context.h" #include "nfapi/oai_integration/vendor_ext.h" diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c index 7c25548349..6d75f0acbd 100644 --- a/executables/lte-softmodem.c +++ b/executables/lte-softmodem.c @@ -77,6 +77,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "create_tasks.h" +#include "pdcp.h" #include "PHY/INIT/phy_init.h" @@ -241,8 +242,8 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) { return (dcoff_i_rxfe + (dcoff_q_rxfe<<8)); } - -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ int ru_id; if (s != NULL) { @@ -266,8 +267,12 @@ void exit_function(const char *file, const char *function, const int line, const } } - sleep(1); //allow lte-softmodem threads to exit first - exit(1); + if (assert) { + abort(); + } else { + sleep(1); // allow lte-softmodem threads to exit first + exit(EXIT_SUCCESS); + } } diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c index 04358c7ec9..4fe94f0b80 100644 --- a/executables/lte-uesoftmodem.c +++ b/executables/lte-uesoftmodem.c @@ -39,6 +39,7 @@ #include "assertions.h" #include "PHY/types.h" +#include "pdcp.h" #include "PHY/defs_UE.h" #include "common/ran_context.h" @@ -244,7 +245,7 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) { } -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { int CC_id; logClean(); printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, ((s==NULL)?"":s)); @@ -258,12 +259,15 @@ void exit_function(const char *file, const char *function, const int line, const PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); } - sleep(1); //allow lte-softmodem threads to exit first - if(PHY_vars_UE_g != NULL ) itti_terminate_tasks (TASK_UNKNOWN); - exit(1); + if (assert) { + abort(); + } else { + sleep(1); // allow lte-softmodem threads to exit first + exit(EXIT_SUCCESS); + } } extern int16_t dlsch_demod_shift; diff --git a/executables/main_ru.c b/executables/main_ru.c index ee2e6dc39c..2de9ba5d12 100644 --- a/executables/main_ru.c +++ b/executables/main_ru.c @@ -49,12 +49,14 @@ #include "radio/ETHERNET/USERSPACE/LIB/if_defs.h" #include "PHY/phy_vars.h" +#include "PHY/phy_extern.h" #include "PHY/TOOLS/phy_scope_interface.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "PHY/INIT/phy_init.h" #include "openair2/ENB_APP/enb_paramdef.h" #include "system.h" +#include "nfapi/oai_integration/vendor_ext.h" #include #include @@ -85,7 +87,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; void nfapi_setmode(nfapi_mode_t nfapi_mode) { return; } -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { if (s != NULL) { printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s); @@ -102,11 +104,15 @@ void exit_function(const char *file, const char *function, const int line, const ru_m.ifdevice.trx_end_func(&ru_m.ifdevice); ru_m.ifdevice.trx_end_func = NULL; } - + pthread_mutex_destroy(ru_m.ru_mutex); - pthread_cond_destroy(ru_m.ru_cond); - sleep(1); //allow lte-softmodem threads to exit first - exit(1); + pthread_cond_destroy(ru_m.ru_cond); + if (assert) { + abort(); + } else { + sleep(1); // allow lte-softmodem threads to exit first + exit(EXIT_SUCCESS); + } } diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 14fff00a70..99229e6a13 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -28,6 +28,7 @@ #include "nfapi/oai_integration/vendor_ext.h" #include "openair2/F1AP/f1ap_common.h" #include "openair2/GNB_APP/gnb_config.h" +#include "pdcp.h" RAN_CONTEXT_t RC; THREAD_STRUCT thread_struct; @@ -36,10 +37,15 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int asn1_xer_print; int oai_exit = 0; instance_t CUuniqInstance = 0; -RRC_release_list_t rrc_release_info; -void exit_function(const char *file, const char *function, const int line, const char *s) +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { + if (assert) { + abort(); + } else { + sleep(1); // allow other threads to exit first + exit(EXIT_SUCCESS); + } } nfapi_mode_t nfapi_mod = -1; diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index d958e772a9..041c85bb76 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -42,7 +42,7 @@ #include "PHY/types.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/defs_gNB.h" #include "SCHED/sched_eNB.h" diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 48cf6ebe31..ebe6fbbb74 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -46,7 +46,7 @@ #include "PHY/defs_nr_common.h" #include "PHY/phy_extern.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "SCHED_NR/sched_nr.h" #include "common/utils/LOG/log.h" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 7d75dfbe36..5255769730 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -59,10 +59,11 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" +#include "pdcp.h" #include "intertask_interface.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "system.h" #include @@ -249,8 +250,8 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) { #define KBLU "\x1B[34m" #define RESET "\033[0m" - -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ int ru_id; if (s != NULL) { @@ -274,8 +275,12 @@ void exit_function(const char *file, const char *function, const int line, const } } - sleep(1); //allow lte-softmodem threads to exit first - exit(1); + if (assert) { + abort(); + } else { + sleep(1); // allow nr-softmodem threads to exit first + exit(EXIT_SUCCESS); + } } diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 61e12a158f..26ccec80b4 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -24,7 +24,7 @@ #include #include "executables/nr-uesoftmodem.h" #include "PHY/phy_extern_nr_ue.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "NR_MAC_UE/mac_proto.h" #include "RRC/NR_UE/rrc_proto.h" #include "SCHED_NR_UE/phy_frame_config_nr.h" @@ -33,6 +33,7 @@ #include "executables/softmodem-common.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "radio/COMMON/common_lib.h" +#include "pdcp.h" /* * NR SLOT PROCESSING SEQUENCE @@ -687,21 +688,33 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); - *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); - for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { - int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ; - // we write before read because gNB waits for UE to write and both executions halt - // this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot - if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer); - AssertFatal(unitTransfer == - UE->rfdevice.trx_read_func(&UE->rfdevice, - timestamp, - (void **)UE->common_vars.rxdata, - unitTransfer, - UE->frame_parms.nb_antennas_rx),""); - *timestamp += unitTransfer; // this does not affect the read but needed for RFSIM write + if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { + // Resynchonize by slot (will work with numerology 1 only) + for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe/2 ) { + int unitTransfer=size>UE->frame_parms.samples_per_subframe/2 ? UE->frame_parms.samples_per_subframe/2 : size ; + AssertFatal(unitTransfer == + UE->rfdevice.trx_read_func(&UE->rfdevice, + timestamp, + (void **)UE->common_vars.rxdata, + unitTransfer, + UE->frame_parms.nb_antennas_rx),""); + } + } else { + *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); + for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { + int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ; + // we write before read because gNB waits for UE to write and both executions halt + // this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot + if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer); + AssertFatal(unitTransfer == + UE->rfdevice.trx_read_func(&UE->rfdevice, + timestamp, + (void **)UE->common_vars.rxdata, + unitTransfer, + UE->frame_parms.nb_antennas_rx),""); + *timestamp += unitTransfer; // this does not affect the read but needed for RFSIM write + } } - } int computeSamplesShift(PHY_VARS_NR_UE *UE) { @@ -773,6 +786,11 @@ void *UE_thread(void *arg) { syncRunning=false; syncData_t *tmp=(syncData_t *)NotifiedFifoData(res); if (UE->is_synchronized) { + LOG_I(PHY,"UE synchronized decoded_frame_rx=%d UE->init_sync_frame=%d trashed_frames=%d\n", + decoded_frame_rx, + UE->init_sync_frame, + trashed_frames); + decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); // shift the frame index with all the frames we trashed meanwhile we perform the synch search decoded_frame_rx=(decoded_frame_rx + UE->init_sync_frame + trashed_frames) % MAX_FRAME_NUMBER; @@ -780,8 +798,16 @@ void *UE_thread(void *arg) { delNotifiedFIFO_elt(res); start_rx_stream=0; } else { - readFrame(UE, ×tamp, true); - trashed_frames+=2; + if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { + // For IQ recorder/player we force synchronization to happen in 280 ms + while (trashed_frames != 28) { + readFrame(UE, ×tamp, true); + trashed_frames+=2; + } + } else { + readFrame(UE, ×tamp, true); + trashed_frames+=2; + } continue; } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index d64d2cdb2e..d3d8090be5 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -59,10 +59,11 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "UTIL/OPT/opt.h" #include "enb_config.h" +#include "pdcp.h" #include "intertask_interface.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "system.h" #include #include @@ -213,7 +214,8 @@ int create_tasks_nrue(uint32_t ue_nb) { return 0; } -void exit_function(const char *file, const char *function, const int line, const char *s) { +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ int CC_id; if (s != NULL) { @@ -229,8 +231,12 @@ void exit_function(const char *file, const char *function, const int line, const } } - sleep(1); //allow lte-softmodem threads to exit first - exit(1); + if (assert) { + abort(); + } else { + sleep(1); // allow lte-softmodem threads to exit first + exit(EXIT_SUCCESS); + } } uint64_t get_nrUE_optmask(void) { diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 2b289b5352..825faf6cf9 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -219,7 +219,7 @@ void signal_handler(int sig) { softmodem_printresources(sig,(telnet_printfunc_t)printf); if (sig != SOFTMODEM_RTSIGNAL) { printf("Linux signal %s...\n",strsignal(sig)); - exit_function(__FILE__, __FUNCTION__, __LINE__,"softmodem starting exit procedure\n"); + exit_function(__FILE__, __FUNCTION__, __LINE__, "softmodem starting exit procedure\n", OAI_EXIT_NORMAL); } } } diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 09eaea1c92..2b022b6a9e 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -258,6 +258,7 @@ extern int usrp_tx_thread; #define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) #define SOFTMODEM_TELNETCLT_BIT (1<<17) +#define SOFTMODEM_RECRECORD_BIT (1<<18) #define SOFTMODEM_ENB_BIT (1<<20) #define SOFTMODEM_GNB_BIT (1<<21) #define SOFTMODEM_4GUE_BIT (1<<22) @@ -278,6 +279,7 @@ extern int usrp_tx_thread; #define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_DOSCOPE_QT ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_QT_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) +#define IS_SOFTMODEM_IQRECORDER ( get_softmodem_optmask() & SOFTMODEM_RECRECORD_BIT) #define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) #define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) #define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) diff --git a/nfapi/oai_integration/gnb_ind_vars.c b/nfapi/oai_integration/gnb_ind_vars.c index 148c28a5c4..f1f22bcc66 100644 --- a/nfapi/oai_integration/gnb_ind_vars.c +++ b/nfapi/oai_integration/gnb_ind_vars.c @@ -1,3 +1,24 @@ +/* + * 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 + */ + #include "gnb_ind_vars.h" queue_t gnb_rach_ind_queue; diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 559c90f3dc..4dfdb2291a 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -52,6 +52,7 @@ #include "common/utils/LOG/log.h" #include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair1/SCHED_NR/fapi_nr_l1.h" diff --git a/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h index be37f06b8d..23d02ef197 100644 --- a/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h +++ b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h @@ -28,7 +28,7 @@ PHY_VARS_UE ***PHY_vars_UE_g; #include "common/ran_context.h" RAN_CONTEXT_t RC; -void exit_function(const char* file, const char* function, const int line, const char *s) { +void exit_function(const char* file, const char* function, const int line, const char* s, const int assert) { const char * msg= s==NULL ? "no comment": s; printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); exit(-1); diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c index a856c33999..c07c9230d8 100644 --- a/openair1/PHY/INIT/lte_init_ru.c +++ b/openair1/PHY/INIT/lte_init_ru.c @@ -20,6 +20,7 @@ */ #include "phy_init.h" +#include "PHY/phy_extern.h" #include "SCHED/sched_eNB.h" #include "PHY/LTE_REFSIG/lte_refsig.h" //#include "SIMULATION/TOOLS/sim.h" @@ -33,8 +34,6 @@ void init_7_5KHz(void); -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; - int phy_init_RU(RU_t *ru) { LTE_DL_FRAME_PARMS *fp = ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index d30e7e8af8..2e6e85f1d5 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -24,7 +24,7 @@ #include "common/ran_context.h" #include "PHY/defs_gNB.h" #include "PHY/NR_REFSIG/nr_refsig.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" @@ -66,6 +66,17 @@ int l1_north_init_gNB() { return(0); } +void init_ul_delay_table(NR_DL_FRAME_PARMS *fp) +{ + for (int delay = -MAX_UL_DELAY_COMP; delay <= MAX_UL_DELAY_COMP; delay++) { + for (int k = 0; k < fp->ofdm_symbol_size; k++) { + double complex delay_cexp = cexp(I * (2.0 * M_PI * k * delay / fp->ofdm_symbol_size)); + fp->ul_delay_table[MAX_UL_DELAY_COMP + delay][k].r = (int16_t)round(256 * creal(delay_cexp)); + fp->ul_delay_table[MAX_UL_DELAY_COMP + delay][k].i = (int16_t)round(256 * cimag(delay_cexp)); + } + } +} + int init_codebook_gNB(PHY_VARS_gNB *gNB) { if(gNB->frame_parms.nb_antennas_tx>1){ @@ -500,6 +511,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) load_nrLDPClib_offload(); init_codebook_gNB(gNB); + init_ul_delay_table(fp); // PBCH DMRS gold sequences generation nr_init_pbch_dmrs(gNB); @@ -981,7 +993,7 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) { int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int i = 0; i < NUMBER_OF_NR_DLSCH_MAX; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n", i, NUMBER_OF_NR_DLSCH_MAX); + LOG_D(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n", i, NUMBER_OF_NR_DLSCH_MAX); for (int j=0; jdlsch[i][j] = new_gNB_dlsch(fp, grid_size); AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i); @@ -1036,21 +1048,21 @@ void init_nr_transport(PHY_VARS_gNB *gNB) gNB->pucch = (NR_gNB_PUCCH_t **) malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t*)); for (int i = 0; i < gNB->max_nb_pucch; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch); + LOG_D(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch); gNB->pucch[i] = new_gNB_pucch(); AssertFatal(gNB->pucch[i] != NULL,"Can't initialize pucch %d \n", i); } gNB->srs = (NR_gNB_SRS_t **) malloc16(gNB->max_nb_srs * sizeof(NR_gNB_SRS_t*)); for (int i = 0; i < gNB->max_nb_srs; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for SRS %d/%d\n", i, gNB->max_nb_srs); + LOG_D(PHY,"Allocating Transport Channel Buffers for SRS %d/%d\n", i, gNB->max_nb_srs); gNB->srs[i] = new_gNB_srs(); AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i); } for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n", i, NUMBER_OF_NR_ULSCH_MAX); + LOG_D(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n", i, NUMBER_OF_NR_ULSCH_MAX); gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL); diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index f1810e5541..6b433f17d1 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -20,6 +20,7 @@ */ #include "phy_init.h" +#include "PHY/phy_extern.h" #include "SCHED/sched_common.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" @@ -28,8 +29,6 @@ void init_prach_ru_list(RU_t *ru); -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; - int nr_phy_init_RU(RU_t *ru) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index ac7d1ceed9..ef0674d150 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "phy_init.h" +#include "nr_phy_init.h" #include "PHY/phy_extern_nr_ue.h" #include "openair1/PHY/defs_RU.h" #include "openair1/PHY/impl_defs_nr.h" diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index b3613c9d62..678036ecc9 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "phy_init.h" +#include "nr_phy_init.h" #include "common/utils/nr/nr_common.h" #include "common/utils/LOG/log.h" diff --git a/openair1/PHY/INIT/nr_phy_init.h b/openair1/PHY/INIT/nr_phy_init.h new file mode 100644 index 0000000000..4c035d13d8 --- /dev/null +++ b/openair1/PHY/INIT/nr_phy_init.h @@ -0,0 +1,59 @@ +/* + * 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 + */ + +#ifndef NR_PHY_INIT_H_ +#define NR_PHY_INIT_H_ + +#include "PHY/defs_gNB.h" +#include "PHY/defs_nr_UE.h" + +int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb); +int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); +int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); +void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band); +int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB); +void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB); +void init_nr_ue_transport(PHY_VARS_NR_UE *ue); +void init_N_TA_offset(PHY_VARS_NR_UE *ue); +void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); +int phy_init_nr_gNB(PHY_VARS_gNB *gNB); +int init_codebook_gNB(PHY_VARS_gNB *gNB); +void nr_phy_config_request(NR_PHY_Config_t *gNB); +void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); +void phy_free_nr_gNB(PHY_VARS_gNB *gNB); +int l1_north_init_gNB(void); +void init_nr_transport(PHY_VARS_gNB *gNB); +void reset_nr_transport(PHY_VARS_gNB *gNB); + +void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg); +void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg); + +void RCconfig_nrUE_prs(void *cfg); +void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue); +void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); +void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); +void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); +void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); + +void phy_init_nr_top(PHY_VARS_NR_UE *ue); +void phy_term_nr_top(void); + +#endif diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index 5ec47c1dae..2116ba9c02 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -56,9 +56,6 @@ int l1_north_init_eNB(void); */ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms); -void phy_init_nr_top(PHY_VARS_NR_UE *ue); -void phy_term_nr_top(void); - /*! \brief Allocate and Initialize the PHY variables relevant to the LTE ue signal buffers. @@ -392,37 +389,6 @@ void phy_config_update_sib13_request(PHY_Config_t *phy_config); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); -int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb); -int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); -int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); -void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band); -int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB); -void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB); -void init_nr_ue_transport(PHY_VARS_NR_UE *ue); -void init_N_TA_offset(PHY_VARS_NR_UE *ue); -void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); -int phy_init_nr_gNB(PHY_VARS_gNB *gNB); -int init_codebook_gNB(PHY_VARS_gNB *gNB); -void nr_phy_config_request(NR_PHY_Config_t *gNB); -void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); -void phy_free_nr_gNB(PHY_VARS_gNB *gNB); -int l1_north_init_gNB(void); -void init_nr_transport(PHY_VARS_gNB *gNB); -void reset_nr_transport(PHY_VARS_gNB *gNB); - -void init_dfts(void); - void fill_subframe_mask(PHY_VARS_eNB *eNB); -void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg); -void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg); -void RCconfig_nrUE_prs(void *cfg); -void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue); -void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); -void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); -void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PROCESSES], int number_of_processes, int num_rb); -void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES], int number_of_processes, int num_rb, int num_ant_tx); - -/** @} */ #endif - diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index d699e7ebd9..8587bf1f70 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -28,7 +28,7 @@ //#include #include #include "PHY/defs_UE.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/LTE_REFSIG/lte_refsig.h" // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c index 524b200e1a..780c3955cf 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c @@ -38,6 +38,7 @@ //#include "defs.h" #include "PHY/defs_UE.h" #include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #if defined(__x86_64__) || defined(__i386__) #include "pss6144.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 16b818e90f..340da97d48 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -23,6 +23,7 @@ #include "PHY/defs_UE.h" #include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "common/utils/LOG/log.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 152a298398..5d5e9c5d56 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -20,7 +20,7 @@ */ #include "PHY/defs_eNB.h" -//#include "PHY/phy_extern.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" //#define DEBUG_CH #include "common/utils/LOG/log.h" @@ -35,8 +35,6 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32 #define SCALE 0x3FFF -static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; - int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, L1_rxtx_proc_t *proc, LTE_eNB_ULSCH_t * ulsch, diff --git a/openair1/PHY/LTE_REFSIG/README.txt b/openair1/PHY/LTE_REFSIG/README.txt index eae92fb389..8d0014f39b 100644 --- a/openair1/PHY/LTE_REFSIG/README.txt +++ b/openair1/PHY/LTE_REFSIG/README.txt @@ -5,7 +5,6 @@ lte_gold.c : Generators for LTE gold sequences (used for pilots and scr lte_ul_ref.c : UL DRS signal generation for TX and RX defs.h : data structures and function prototypes mod_table.h : lookup tables for QAM modulation (CBMIMO1 tables) -primary_synch.h : 3 PSS sequences primary_synch.m : MATLAB/OCTAVE generator for PSS gen_mod_table.m : MATLAB/OCTAVE generator for CBMIMO1 mod_table.h lte_ul.m : MATLAB/OCTAVE generator for UL (SC-FDMA) DFT sizes diff --git a/openair1/PHY/LTE_REFSIG/primary_synch.h b/openair1/PHY/LTE_REFSIG/primary_synch.h deleted file mode 100644 index 8152722df3..0000000000 --- a/openair1/PHY/LTE_REFSIG/primary_synch.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 - */ - -short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0}; -short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0}; -short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0}; -unsigned char primary_synch0_tab[72] = {0,0,0,0,0,85,110,97,109,146,145,106,92,103,139,137,97,145,92,127,124,146,130,139,110,106,127,110,118,88,146,103,85,92,124,118,118,124,92,85,103,146,88,118,110,127,106,110,139,130,146,124,127,92,145,97,137,139,103,92,106,145,146,109,97,110,85,0,0,0,0,0}; -unsigned char primary_synch1_tab[72] = {0,0,0,0,0,85,114,109,133,123,142,127,141,121,130,105,109,142,141,106,100,123,112,130,114,127,106,114,88,91,123,121,85,141,100,88,88,100,141,85,121,123,91,88,114,106,127,114,130,112,123,100,106,141,142,109,105,130,121,141,127,142,123,133,109,114,85,0,0,0,0,0}; -unsigned char primary_synch2_tab[72] = {0,0,0,0,0,85,119,124,100,110,91,106,92,112,103,128,124,91,92,127,133,110,121,103,119,106,127,119,145,142,110,112,85,92,133,145,145,133,92,85,112,110,142,145,119,127,106,119,103,121,110,133,127,92,91,124,128,103,112,92,106,91,110,100,124,119,85,0,0,0,0,0}; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index 015a95a862..7075b74fe1 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -163,8 +163,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_OUT); } - - +uint8_t scrambling_lut[65536*16] __attribute__((aligned(32))); void init_scrambling_lut(void) { uint32_t s; int i=0,j; @@ -215,6 +214,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, } } +int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); void init_unscrambling_lut(void) { uint32_t s; int i=0,j; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h index 3a18924fe4..863eb33d34 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef DLSCH_TBS_H_ +#define DLSCH_TBS_H_ + static const unsigned int dlsch_tbs25[27][25] = { {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680}, {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904}, @@ -47,3 +50,5 @@ static const unsigned int dlsch_tbs25[27][25] = { {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264}, {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840}, {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336}}; + +#endif /* DLSCH_TBS_H_ */ diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c deleted file mode 100644 index 856e392070..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/print_stats.c +++ /dev/null @@ -1,753 +0,0 @@ -/* - * 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 PHY/LTE_TRANSPORT/print_stats.c -* \brief PHY statstic logging function -* \author R. Knopp, F. Kaltenberger, navid nikaein -* \date 2011 -* \version 0.1 -* \company Eurecom -* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr -* \note -* \warning -*/ - -#include "PHY/LTE_TRANSPORT/proto.h" -#include "executables/lte-softmodem.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/extern.h" - - #include "openair2/LAYER2/MAC/proto.h" - #include "openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h" - -extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index); - -#include "common_lib.h" -extern openair0_config_t openair0_cfg[]; - - -int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char *buffer, int length, runmode_t mode, int input_level_dBm) { - uint8_t eNB=0; - uint32_t RRC_status; - int len=length; - int harq_pid,round; - - if (ue==NULL) - return 0; - - if ((mode == normal_txrx) || (mode == no_L2_connect)) { - len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",ue->Mod_id, ue->pdcch_vars[0][0]->crnti); - len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE (NF %.1f dB)\n", - 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rsrq[0]), - ue->measurements.n0_power_tot_dBm, - (double)ue->measurements.n0_power_tot_dBm+132.24); - /* - len += sprintf(&buffer[len], - "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n", - proc->frame_rx, - ue->measurements.rx_rssi_dBm[0], - ue->measurements.rx_power_dB[0][0], - ue->measurements.rx_power_dB[0][1], - ue->measurements.rx_rssi_dBm[1], - ue->measurements.rx_power_dB[1][0], - ue->measurements.rx_power_dB[1][1], - ue->measurements.rx_rssi_dBm[2], - ue->measurements.rx_power_dB[2][0], - ue->measurements.rx_power_dB[2][1], - ue->measurements.n0_power_tot_dBm, - ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL), - ue->frame_parms.N_RB_DL, - ue->measurements.n0_power_dB[0], - ue->measurements.n0_power_dB[1]); - */ - len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",ue->rx_total_gain_dB); - len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz, estimated carrier frequency %f Hz\n",ue->common_vars.freq_offset,openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset); - len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[ue->UE_mode[0]],ue->UE_mode[0]); - len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",ue->timing_advance); - - if (ue->UE_mode[0]==PUSCH) { - len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n", - ue->ulsch[0]->Po_PUSCH, - get_PL(ue->Mod_id,ue->CC_id,0), - ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH, - ue->ulsch[0]->PHR); - len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n", - get_PL(ue->Mod_id,ue->CC_id,0)+ - ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH+ - ue->dlsch[0][0][0]->g_pucch, - ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH, - ue->dlsch[0][0][0]->g_pucch); - } - - //for (eNB=0;eNBmeasurements.rx_spatial_power_dB[eNB][0][0], - ue->measurements.rx_spatial_power_dB[eNB][0][1], - ue->measurements.rx_spatial_power_dB[eNB][1][0], - ue->measurements.rx_spatial_power_dB[eNB][1][1]); - len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB],ue->measurements.rx_power_avg_dB[eNB]); - len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",ue->measurements.rx_power_tot[eNB], - ue->measurements.rx_power_avg[eNB], ue->measurements.n0_power_tot, ue->measurements.n0_power_avg); - len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff); - len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]); - - switch (ue->frame_parms.N_RB_DL) { - case 6: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5]); - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1]); - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5]); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,6))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,6))); - break; - - case 25: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6]); - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1]); - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6]); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,7))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7))); - break; - - case 50: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6], - ue->measurements.subband_cqi_dB[eNB][0][7], - ue->measurements.subband_cqi_dB[eNB][0][8]); - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6], - ue->measurements.subband_cqi_dB[eNB][1][7], - ue->measurements.subband_cqi_dB[eNB][1][8]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0], - ue->measurements.subband_pmi_re[eNB][7][0], - ue->measurements.subband_pmi_im[eNB][7][0], - ue->measurements.subband_pmi_re[eNB][8][0], - ue->measurements.subband_pmi_im[eNB][8][0]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1], - ue->measurements.subband_pmi_re[eNB][7][1], - ue->measurements.subband_pmi_im[eNB][7][1], - ue->measurements.subband_pmi_re[eNB][8][1], - ue->measurements.subband_pmi_im[eNB][8][1]); - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6], - ue->measurements.selected_rx_antennas[eNB][7], - ue->measurements.selected_rx_antennas[eNB][8]); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,9))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,9)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,9))); - break; - - case 100: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6], - ue->measurements.subband_cqi_dB[eNB][0][7], - ue->measurements.subband_cqi_dB[eNB][0][8], - ue->measurements.subband_cqi_dB[eNB][0][9], - ue->measurements.subband_cqi_dB[eNB][0][10], - ue->measurements.subband_cqi_dB[eNB][0][11], - ue->measurements.subband_cqi_dB[eNB][0][12]); - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6], - ue->measurements.subband_cqi_dB[eNB][1][7], - ue->measurements.subband_cqi_dB[eNB][1][8], - ue->measurements.subband_cqi_dB[eNB][1][9], - ue->measurements.subband_cqi_dB[eNB][1][10], - ue->measurements.subband_cqi_dB[eNB][1][11], - ue->measurements.subband_cqi_dB[eNB][1][12]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0], - ue->measurements.subband_pmi_re[eNB][7][0], - ue->measurements.subband_pmi_im[eNB][7][0], - ue->measurements.subband_pmi_re[eNB][8][0], - ue->measurements.subband_pmi_im[eNB][8][0], - ue->measurements.subband_pmi_re[eNB][9][0], - ue->measurements.subband_pmi_im[eNB][9][0], - ue->measurements.subband_pmi_re[eNB][10][0], - ue->measurements.subband_pmi_im[eNB][10][0], - ue->measurements.subband_pmi_re[eNB][11][0], - ue->measurements.subband_pmi_im[eNB][11][0], - ue->measurements.subband_pmi_re[eNB][12][0], - ue->measurements.subband_pmi_im[eNB][12][0]); - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1], - ue->measurements.subband_pmi_re[eNB][7][1], - ue->measurements.subband_pmi_im[eNB][7][1], - ue->measurements.subband_pmi_re[eNB][8][1], - ue->measurements.subband_pmi_im[eNB][8][1], - ue->measurements.subband_pmi_re[eNB][9][1], - ue->measurements.subband_pmi_im[eNB][9][1], - ue->measurements.subband_pmi_re[eNB][10][1], - ue->measurements.subband_pmi_im[eNB][10][1], - ue->measurements.subband_pmi_re[eNB][11][1], - ue->measurements.subband_pmi_im[eNB][11][1], - ue->measurements.subband_pmi_re[eNB][12][1], - ue->measurements.subband_pmi_im[eNB][12][1]); - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6], - ue->measurements.selected_rx_antennas[eNB][7], - ue->measurements.selected_rx_antennas[eNB][8], - ue->measurements.selected_rx_antennas[eNB][9], - ue->measurements.selected_rx_antennas[eNB][10], - ue->measurements.selected_rx_antennas[eNB][11], - ue->measurements.selected_rx_antennas[eNB][12]); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,13))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,13)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,13))); - break; - } - - RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0); - len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status); - len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d \n",ue->transmission_mode[eNB]); - len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n", - ue->pbch_vars[eNB]->pdu_errors_conseq, - ue->pbch_vars[eNB]->pdu_errors, - ue->pbch_vars[eNB]->pdu_fer); - - if (ue->transmission_mode[eNB] == 6) - len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,ue->measurements.precoded_cqi_dB[eNB][0]); - - for (harq_pid=0; harq_pid<8; harq_pid++) { - len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 0 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][0]->harq_processes[harq_pid]->mcs); - - for (round=0; round<8; round++) - len+=sprintf(&buffer[len],"%d/%d ", - ue->dlsch[0][0][0]->harq_processes[harq_pid]->errors[round], - ue->dlsch[0][0][0]->harq_processes[harq_pid]->trials[round]); - - len+=sprintf(&buffer[len],"\n"); - } - - if (ue->dlsch[0][0] && ue->dlsch[0][0][0] && ue->dlsch[0][0][1]) { - len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(ue->dlsch[0][0][0]->pmi_alloc),ue->dlsch[0][0][0]); - len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,ue->dlsch[0][0][0]->harq_processes[0]->dl_power_off); - - for (harq_pid=0; harq_pid<8; harq_pid++) { - len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 1 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][1]->harq_processes[0]->mcs); - - for (round=0; round<8; round++) - len+=sprintf(&buffer[len],"%d/%d ", - ue->dlsch[0][0][1]->harq_processes[harq_pid]->errors[round], - ue->dlsch[0][0][1]->harq_processes[harq_pid]->trials[round]); - - len+=sprintf(&buffer[len],"\n"); - } - } - - len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]); - len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]); - len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]); - int i=0; - - //len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", ue->dlsch_mch_received[0]); - for(i=0; i frame_parms.num_MBSFN_config; i++ ) { - len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n", - i, ue->dlsch_mcch_received[i][0],ue->dlsch_mcch_errors[i][0],ue->dlsch_mcch_trials[i][0]); - len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n", - i, ue->dlsch_mtch_received[i][0],ue->dlsch_mtch_errors[i][0],ue->dlsch_mtch_trials[i][0]); - } - - len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(ue->bitrate[0]/1000)); - len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(ue->total_received_bits[0]/1000)); - len += sprintf(&buffer[len], "[UE PROC] IA receiver %d\n",ue->use_ia_receiver); - } - } else { - len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n", - proc->frame_rx, - 10*log10(ue->measurements.rssi), - ue->measurements.rx_power_dB[0][0], - ue->measurements.rx_power_dB[0][1], - 10*log10(ue->measurements.n0_power_tot), - ue->measurements.n0_power_dB[0], - ue->measurements.n0_power_dB[1]); - } - - len += sprintf(&buffer[len],"EOF\n"); - return len; -} // is_clusterhead - -/* -int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length) -{ - - unsigned int success=0; - uint8_t eNB_id,UE_id,i,j,number_of_cards_l=1; - uint32_t ulsch_errors=0,dlsch_errors=0; - uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0}; - uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0}; - uint32_t UE_id_mac, RRC_status; - eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0]; - if (eNB==NULL) - return 0; - - int len = length; - - // if(eNB->frame==0){ - eNB->total_dlsch_bitrate = 0;//eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate; - eNB->total_transmitted_bits = 0;// eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_transmitted_bits; - eNB->total_system_throughput = 0;//eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput; - // } - - for (eNB_id=0; eNB_idframe_tx, - eNB->rx_total_gain_dB, - eNB->measurements.n0_power_tot_dBm, - eNB->measurements.n0_power_dB[0], - eNB->measurements.n0_power_dB[1]); - - len += sprintf(&buffer[len],"PRB I0 (%X.%X.%X.%X): ", - eNB->rb_mask_ul[0], - eNB->rb_mask_ul[1],eNB->rb_mask_ul[2],eNB->rb_mask_ul[3]); - - for (i=0; iframe_parms.N_RB_UL; i++) { - len += sprintf(&buffer[len],"%4d ", - eNB->measurements.n0_subband_power_tot_dBm[i]); - if ((i>0) && ((i%25) == 0)) - len += sprintf(&buffer[len],"\n"); - } - len += sprintf(&buffer[len],"\n"); - len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n"); - - for (UE_id=0; UE_iddlsch!=NULL) && - (eNB->dlsch[(uint8_t)UE_id]!=NULL) && - (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&& - (eNB->UE_stats[UE_id].mode == PUSCH)) { - - eNB->total_dlsch_bitrate = eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate; - eNB->total_transmitted_bits = eNB->UE_stats[UE_id].total_TBS + eNB->total_transmitted_bits; - - //eNB->total_system_throughput = eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput; - - for (i=0; i<8; i++) - success = success + (eNB->UE_stats[UE_id].dlsch_trials[i][0] - eNB->UE_stats[UE_id].dlsch_l2_errors[i]); - - - - len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),proc->frame_tx+1); - len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000)); - len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,proc->frame_tx+1); - //len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions); - //len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions); - //len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions); - - len += sprintf(&buffer[len],"UE %d (%x) Power: (%d,%d) dB, Po_PUSCH: (%d,%d) dBm, Po_PUCCH (%d/%d) dBm, Po_PUCCH1 (%d,%d) dBm, PUCCH1 Thres %d dBm \n", - UE_id, - eNB->UE_stats[UE_id].crnti, - dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[0]), - dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[1]), - eNB->UE_stats[UE_id].UL_rssi[0], - eNB->UE_stats[UE_id].UL_rssi[1], - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - eNB->frame_parms.ul_power_control_config_common.p0_NominalPUCCH, - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_below/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_above/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - PUCCH1_THRES+eNB->measurements.n0_power_tot_dBm-dB_fixed(eNB->frame_parms.N_RB_UL)); - - len+= sprintf(&buffer[len],"DL mcs %d, UL mcs %d, UL rb %d, delta_TF %d, ", - eNB->dlsch[(uint8_t)UE_id][0]->harq_processes[0]->mcs, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->mcs, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->nb_rb, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->delta_TF); - - len += sprintf(&buffer[len],"Wideband CQI: (%d,%d) dB\n", - eNB->measurements.wideband_cqi_dB[UE_id][0], - eNB->measurements.wideband_cqi_dB[UE_id][1]); - - len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ", - eNB->transmission_mode[UE_id], - eNB->UE_stats[UE_id].DL_cqi[0], - pmi2hex_2Ar1(eNB->UE_stats[UE_id].DL_pmi_single)); - - len += sprintf(&buffer[len],"Timing advance %d samples (%d 16Ts), update %d ", - eNB->UE_stats[UE_id].UE_timing_offset, - eNB->UE_stats[UE_id].UE_timing_offset>>2, - eNB->UE_stats[UE_id].timing_advance_update); - - len += sprintf(&buffer[len],"Mode = %s(%d) ", - mode_string[eNB->UE_stats[UE_id].mode], - eNB->UE_stats[UE_id].mode); - UE_id_mac = find_UE_id(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti); - - if (UE_id_mac != -1) { - RRC_status = mac_eNB_get_rrc_status(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti); - len += sprintf(&buffer[len],"UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status); - } else - len += sprintf(&buffer[len],"UE_id_mac = -1\n"); - - len += sprintf(&buffer[len],"SR received/total: %d/%d (diff %d)\n", - eNB->UE_stats[UE_id].sr_received, - eNB->UE_stats[UE_id].sr_total, - eNB->UE_stats[UE_id].sr_total-eNB->UE_stats[UE_id].sr_received); - - len += sprintf(&buffer[len],"DL Subband CQI: "); - - int nb_sb; - switch (eNB->frame_parms.N_RB_DL) { - case 6: - nb_sb=0; - break; - case 15: - nb_sb = 4; - case 25: - nb_sb = 7; - break; - case 50: - nb_sb = 9; - break; - case 75: - nb_sb = 10; - break; - case 100: - nb_sb = 13; - break; - default: - nb_sb=0; - break; - } - for (i=0; iUE_stats[UE_id].DL_subband_cqi[0][i]); - len += sprintf(&buffer[len],"\n"); - - - - ulsch_errors = 0; - - for (j=0; j<4; j++) { - ulsch_round_attempts[j]=0; - ulsch_round_errors[j]=0; - } - - len += sprintf(&buffer[len],"ULSCH errors/attempts per harq (per round): \n"); - - for (i=0; i<8; i++) { - len += sprintf(&buffer[len]," harq %d: %d/%d (fer %d) (%d/%d, %d/%d, %d/%d, %d/%d) ", - i, - eNB->UE_stats[UE_id].ulsch_errors[i], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0], - eNB->UE_stats[UE_id].ulsch_round_fer[i][0], - eNB->UE_stats[UE_id].ulsch_round_errors[i][0], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0], - eNB->UE_stats[UE_id].ulsch_round_errors[i][1], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][1], - eNB->UE_stats[UE_id].ulsch_round_errors[i][2], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][2], - eNB->UE_stats[UE_id].ulsch_round_errors[i][3], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][3]); - if ((i&1) == 1) - len += sprintf(&buffer[len],"\n"); - - ulsch_errors+=eNB->UE_stats[UE_id].ulsch_errors[i]; - - for (j=0; j<4; j++) { - ulsch_round_attempts[j]+=eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][j]; - ulsch_round_errors[j]+=eNB->UE_stats[UE_id].ulsch_round_errors[i][j]; - } - } - - len += sprintf(&buffer[len],"ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n", - ulsch_errors,ulsch_round_attempts[0], - - ulsch_round_errors[0],ulsch_round_attempts[0], - ulsch_round_errors[1],ulsch_round_attempts[1], - ulsch_round_errors[2],ulsch_round_attempts[2], - ulsch_round_errors[3],ulsch_round_attempts[3]); - - dlsch_errors = 0; - - for (j=0; j<4; j++) { - dlsch_round_attempts[j]=0; - dlsch_round_errors[j]=0; - } - - len += sprintf(&buffer[len],"DLSCH errors/attempts per harq (per round): \n"); - - for (i=0; i<8; i++) { - len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d) ", - i, - eNB->UE_stats[UE_id].dlsch_l2_errors[i], - eNB->UE_stats[UE_id].dlsch_trials[i][0], - eNB->UE_stats[UE_id].dlsch_ACK[i][0], - eNB->UE_stats[UE_id].dlsch_NAK[i][0], - eNB->UE_stats[UE_id].dlsch_trials[i][0], - eNB->UE_stats[UE_id].dlsch_ACK[i][1], - eNB->UE_stats[UE_id].dlsch_NAK[i][1], - eNB->UE_stats[UE_id].dlsch_trials[i][1], - eNB->UE_stats[UE_id].dlsch_ACK[i][2], - eNB->UE_stats[UE_id].dlsch_NAK[i][2], - eNB->UE_stats[UE_id].dlsch_trials[i][2], - eNB->UE_stats[UE_id].dlsch_ACK[i][3], - eNB->UE_stats[UE_id].dlsch_NAK[i][3], - eNB->UE_stats[UE_id].dlsch_trials[i][3]); - if ((i&1) == 1) - len += sprintf(&buffer[len],"\n"); - - - dlsch_errors+=eNB->UE_stats[UE_id].dlsch_l2_errors[i]; - - for (j=0; j<4; j++) { - dlsch_round_attempts[j]+=eNB->UE_stats[UE_id].dlsch_trials[i][j]; - dlsch_round_errors[j]+=eNB->UE_stats[UE_id].dlsch_NAK[i][j]; - } - } - - len += sprintf(&buffer[len],"DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n", - dlsch_errors,dlsch_round_attempts[0], - dlsch_round_errors[0],dlsch_round_attempts[0], - dlsch_round_errors[1],dlsch_round_attempts[1], - dlsch_round_errors[2],dlsch_round_attempts[2], - dlsch_round_errors[3],dlsch_round_attempts[3]); - - - len += sprintf(&buffer[len],"DLSCH total bits from MAC: %dkbit ",(eNB->UE_stats[UE_id].total_TBS_MAC)/1000); - len += sprintf(&buffer[len],"DLSCH total bits ack'ed: %dkbit ",(eNB->UE_stats[UE_id].total_TBS)/1000); - len += sprintf(&buffer[len],"DLSCH Average throughput (100 frames): %dkbps\n",(eNB->UE_stats[UE_id].dlsch_bitrate/1000)); - // len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",eNB->transmission_mode[UE_id]); - } - } - - len += sprintf(&buffer[len],"\n"); - } - - len += sprintf(&buffer[len],"EOF\n"); - - return len; -} -*/ diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c index 34a7ba7007..8d95001c0e 100644 --- a/openair1/PHY/LTE_TRANSPORT/pss.c +++ b/openair1/PHY/LTE_TRANSPORT/pss.c @@ -48,7 +48,7 @@ int generate_pss(int32_t **txdataF, unsigned int Nsymb; unsigned short k,m,aa,a; uint8_t Nid2; - short *primary_sync; + const short *primary_sync; Nid2 = frame_parms->Nid_cell % 3; switch (Nid2) { diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 39d1a86e5b..190e3c47c0 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -40,8 +40,6 @@ #include "T.h" -//extern char* namepointer_chMag ; -//eren //extern int **ulchmag_eren; //eren @@ -1044,7 +1042,6 @@ void rx_ulsch(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, uint8_t UE_id) { LTE_eNB_ULSCH_t **ulsch = eNB->ulsch; - // flagMag = 0; LTE_eNB_COMMON *common_vars = &eNB->common_vars; LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id]; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index b5e5b490a3..42a83a2cda 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -37,6 +37,7 @@ #include "PHY/phy_vars.h" #endif #include "assertions.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" //#define DEBUG_HARQ @@ -60,10 +61,67 @@ #define LOG_I(A,B...) printf(B) */ +int flag_LA=0; + extern uint16_t beta_cqi[16]; extern uint16_t beta_ri[16]; extern uint16_t beta_ack[16]; +static const double p_qpsk[8] = {5982.42405670359, + -21568.1135917693, + 31293.9987036905, + -23394.6795043871, + 9608.34750585489, + -2158.15802349899, + 267.731968719036, + -20.6145324295965}; +static const double p_qam16[8] = {7862.12690694170, + -28510.3207048338, + 41542.2150287122, + -31088.3036957379, + 12690.1982361016, + -2785.66604739984, + 326.595462489375, + -18.9911849872089}; +static const double p_qam64[8] = {8832.57933013696, + -32119.1802555952, + 46914.2578990397, + -35163.8150557183, + 14343.7419388853, + -3126.61025510092, + 360.954930562237, + -18.0358548533343}; +static const double q_qpsk[8] = {1.94491167814437e-09, + 8.40494123817774e-08, + 4.75527131198034e-07, + -2.48946285301621e-05, + -0.000347614016158364, + 0.00209252225437100, + 0.0742986115462510, + 0.488297879889425}; +static const double q_qam16[8] = {3.21151853033897e-10, + 5.55435952230651e-09, + -2.30760065362117e-07, + -6.25587743817859e-06, + 4.62251036452795e-06, + 0.00224150813158937, + 0.0393723140344367, + 0.245486379182639}; +static const double q_qam64[8] = {2.25934026232206e-11, + -1.45992206328306e-10, + -3.70861183071900e-08, + -1.22206071019319e-06, + 6.49115500399637e-06, + 0.00129828997837433, + 0.0259669554914859, + 0.166602901214898}; +static const double sinr_to_cqi[4][16] = { + {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, + {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, + {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, + { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} +}; + static int errorRB(int rb, char * table, int line) { LOG_E(PHY,"Received %d rb, impossble in table %s, at line %d\n", rb, table, line); return 0; @@ -2926,7 +2984,6 @@ uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) uint8_t sinr2cqi(double sinr,uint8_t trans_mode) { - // int flag_LA=0; uint8_t retValue = 0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 096c0fd442..8c0681e162 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -30,7 +30,7 @@ * \warning */ #include "PHY/defs_UE.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "SCHED_UE/sched_UE.h" #include "transport_ue.h" #include "transport_proto_ue.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c index ad7bb6c8bf..108680c640 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c @@ -36,7 +36,7 @@ #include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "transport_ue.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" #include "PHY/LTE_REFSIG/lte_refsig.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index ae5a608da1..eb9e3bc742 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -32,7 +32,7 @@ #include "PHY/defs_UE.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c index 9427ec3a5b..6df56d6c53 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c @@ -32,6 +32,7 @@ #include "PHY/defs_UE.h" #include "PHY/phy_extern_ue.h" #include "PHY/LTE_REFSIG/lte_refsig.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c index b4273095ba..b856976638 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c @@ -35,6 +35,7 @@ #include "LAYER2/MAC/mac.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "transport_proto_ue.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" #include "assertions.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c index 9c0edb467c..534228a935 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c @@ -30,20 +30,22 @@ * \warning */ #include "PHY/defs_UE.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "common/utils/LOG/log.h" -unsigned short msrsb_6_40[8][4] = {{36,12,4,4}, - {32,16,8,4}, - {24,4,4,4}, - {20,4,4,4}, - {16,4,4,4}, - {12,4,4,4}, - {8,4,4,4}, - {4,4,4,4} +static unsigned short msrsb_6_40[8][4] = { + {36, 12, 4, 4}, + {32, 16, 8, 4}, + {24, 4, 4, 4}, + {20, 4, 4, 4}, + {16, 4, 4, 4}, + {12, 4, 4, 4}, + {8, 4, 4, 4}, + {4, 4, 4, 4} }; -unsigned short msrsb_41_60[8][4] = {{48,24,12,4}, +static unsigned short msrsb_41_60[8][4] = { + {48,24,12,4}, {48,16,8,4}, {40,20,4,4}, {36,12,4,4}, @@ -53,47 +55,8 @@ unsigned short msrsb_41_60[8][4] = {{48,24,12,4}, {16,4,4,4} }; -unsigned short msrsb_61_80[8][4] = {{72,24,12,4}, - {64,32,16,4}, - {60,20,4,4}, - {48,24,12,4}, - {48,16,8,4}, - {40,20,4,4}, - {36,12,4,4}, - {32,16,8,4} -}; - -unsigned short msrsb_81_110[8][4] = {{96,48,24,4}, - {96,32,16,4}, - {80,40,20,4}, +static unsigned short msrsb_61_80[8][4] = { {72,24,12,4}, - {64,32,16,4}, - {60,20,4,4}, - {48,24,12,4}, - {48,16,8,4} -}; - -unsigned short Nb_6_40[8][4] = {{36,12,4,4}, - {32,16,8,4}, - {24,4,4,4}, - {20,4,4,4}, - {16,4,4,4}, - {12,4,4,4}, - {8,4,4,4}, - {4,4,4,4} -}; - -unsigned short Nb_41_60[8][4] = {{48,24,12,4}, - {48,16,8,4}, - {40,20,4,4}, - {36,12,4,4}, - {32,16,8,4}, - {24,4,4,4}, - {20,4,4,4}, - {16,4,4,4} -}; - -unsigned short Nb_61_80[8][4] = {{72,24,12,4}, {64,32,16,4}, {60,20,4,4}, {48,24,12,4}, @@ -103,7 +66,8 @@ unsigned short Nb_61_80[8][4] = {{72,24,12,4}, {32,16,8,4} }; -unsigned short Nb_81_110[8][4] = {{96,48,24,4}, +static unsigned short msrsb_81_110[8][4] = { + {96,48,24,4}, {96,32,16,4}, {80,40,20,4}, {72,24,12,4}, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c index 7087b83bca..79b20dc10c 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c @@ -31,7 +31,7 @@ */ #include "PHY/defs_UE.h" #include "transport_ue.h" -#include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/MODULATION/modulation_UE.h" //#define DEBUG_SSS @@ -44,7 +44,7 @@ int pss_ch_est(PHY_VARS_UE *ue, int32_t sss_ext[4][72]) { - int16_t *pss; + const int16_t *pss; int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2; uint8_t aarx,i; LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c index e687ccfd04..642659f674 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c @@ -56,7 +56,6 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL) switch(uci_format) { case wideband_cqi_rank1_2A: #ifdef DEBUG_UCI - LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA); switch(N_RB_DL) { case 6: LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c index f7566abebf..293ebc2a4f 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c @@ -38,6 +38,7 @@ #include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/LTE_UE_TRANSPORT/transport_ue.h" #include "common/utils/LOG/vcd_signal_dumper.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" //#define DEBUG_ULSCH_CODING //#define DEBUG_ULSCH_FREE 1 diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c index 341e1e90b6..838da36289 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c @@ -38,6 +38,7 @@ #include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "PHY/LTE_REFSIG/lte_refsig.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" //#define DEBUG_ULSCH_MODULATION diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 5d55cb142d..251955ee99 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -618,7 +618,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { for (uint8_t ll = 0; ll < 2; ll++){ double f0 = f[ll]; - LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); + LOG_D(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); c16_t *symbol_rotation = fp->symbol_rotation[ll]; double tl = 0.0; @@ -641,7 +641,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { symbol_rotation[l].r = (int16_t)floor(exp_re * 32767); symbol_rotation[l].i = (int16_t)floor(exp_im * 32767); - LOG_I(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n", + LOG_D(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n", l, nsymb, tl, @@ -666,7 +666,7 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp) fp->timeshift_symbol_rotation[i].i = (int16_t)round(exp_im * 32767); if (i < 10) - LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i, + LOG_D(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i, fp->timeshift_symbol_rotation[i].r, fp->timeshift_symbol_rotation[i].i, poff); diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 0c73d3cd1d..c443fabb3c 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -38,34 +38,28 @@ extern openair0_config_t openair0_cfg[MAX_CARDS]; -int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) +void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms, const int32_t *ul_ch_estimates_time, struct delay_s *delay) { - int max_pos = 0, max_val = 0; - - NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id]; - int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time; - + int max_pos = delay->pusch_delay_max_pos; + int max_val = delay->pusch_delay_max_val; const int sync_pos = 0; for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) { - int temp = 0; - - for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { - int Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; - int Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; - temp += (Re*Re/2) + (Im*Im/2); - } + int Re = ((int16_t *)ul_ch_estimates_time)[(i << 1)]; + int Im = ((int16_t *)ul_ch_estimates_time)[1 + (i << 1)]; + int temp = (Re * Re / 2) + (Im * Im / 2); if (temp > max_val) { max_pos = i; max_val = temp; } } - if (max_pos > frame_parms->ofdm_symbol_size/2) + if (max_pos > frame_parms->ofdm_symbol_size / 2) max_pos = max_pos - frame_parms->ofdm_symbol_size; - return max_pos - sync_pos; + delay->pusch_delay_max_pos = max_pos; + delay->pusch_delay_max_val = max_val; + delay->pusch_est_delay = max_pos - sync_pos; } int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index ebc225d82b..d10beb9807 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -100,6 +100,17 @@ __attribute__((always_inline)) inline c16_t c32x16cumulVectVectWithSteps(c16_t * return c16x32div(cumul, N); } +int get_delay_idx(int delay) { + int delay_idx = MAX_UL_DELAY_COMP + delay; + if (delay_idx < 0) { + delay_idx = 0; + } + if (delay_idx > MAX_UL_DELAY_COMP<<1) { + delay_idx = MAX_UL_DELAY_COMP<<1; + } + return delay_idx; +} + int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, unsigned char Ns, unsigned short p, @@ -172,6 +183,10 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, #endif + c16_t ul_ls_est[symbolSize]; + memset(ul_ls_est, 0, sizeof(c16_t) * symbolSize); + memset(&gNB->measurements.delay[ul_id], 0, sizeof(gNB->measurements.delay[ul_id])); + for (int aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset]; c16_t *ul_ch = &ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset]; @@ -193,29 +208,51 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int pilot_cnt = 0; int delta = nr_pusch_dmrs_delta(pusch_dmrs_type1, p); - for (int n = 0; n < 3*nb_rb_pusch; n++) { + for (int n = 0; n < 3 * nb_rb_pusch; n++) { // LS estimation c32_t ch = {0}; for (int k_line = 0; k_line <= 1; k_line++) { re_offset = (k0 + (n << 2) + (k_line << 1) + delta) % symbolSize; - ch=c32x16maddShift(*pil, - rxdataF[soffset + re_offset], - ch, - 16); + ch = c32x16maddShift(*pil, rxdataF[soffset + re_offset], ch, 16); pil++; } - c16_t ch16= {.r=(int16_t)ch.r, .i=(int16_t)ch.i}; + c16_t ch16 = {.r = (int16_t)ch.r, .i = (int16_t)ch.i}; *max_ch = max(*max_ch, max(abs(ch.r), abs(ch.i))); + for (int k = pilot_cnt << 1; k < (pilot_cnt << 1) + 4; k++) { + ul_ls_est[k] = ch16; + } + pilot_cnt += 2; + } + + freq2time(symbolSize, + (int16_t *) ul_ls_est, + (int16_t *) gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]); + + nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], &gNB->measurements.delay[ul_id]); + int delay = gNB->measurements.delay[ul_id].pusch_est_delay; + int delay_idx = get_delay_idx(delay); + c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; + +#ifdef DEBUG_PUSCH + printf("Estimated delay = %i\n", delay >> 1); +#endif + + pilot_cnt = 0; + for (int n = 0; n < 3*nb_rb_pusch; n++) { // Channel interpolation for (int k_line = 0; k_line <= 1; k_line++) { + + // Apply delay + int k = pilot_cnt << 1; + c16_t ch16 = c16mulShift(ul_ls_est[k], ul_delay_table[k], 8); + #ifdef DEBUG_PUSCH re_offset = (k0 + (n << 2) + (k_line << 1)) % symbolSize; c16_t *rxF = &rxdataF[soffset + re_offset]; - printf("pilot %4u: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d)\n", - pilot_cnt, pil->r, pil->i, rxF->r, rxF->i, ch.r, ch.i); + printf("ch -> (%4d,%4d), ch_delay_comp -> (%4d,%4d)\n", ul_ls_est[k].r, ul_ls_est[k].i, ch16.r, ch16.i); #endif if (pilot_cnt == 0) { @@ -235,19 +272,24 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, } } + // Revert delay + pilot_cnt = 0; + ul_ch = &ul_ch_estimates[p * gNB->frame_parms.nb_antennas_rx + aarx][ch_offset]; + int inv_delay_idx = get_delay_idx(-delay); + c16_t *ul_inv_delay_table = gNB->frame_parms.ul_delay_table[inv_delay_idx]; + for (int n = 0; n < 3 * nb_rb_pusch; n++) { + for (int k_line = 0; k_line <= 1; k_line++) { + int k = pilot_cnt << 1; + ul_ch[k] = c16mulShift(ul_ch[k], ul_inv_delay_table[k], 8); + ul_ch[k + 1] = c16mulShift(ul_ch[k + 1], ul_inv_delay_table[k + 1], 8); #ifdef DEBUG_PUSCH - ul_ch = &ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset]; - - for(uint16_t idxP=0; idxP (%4d,%4d), ch_inter -> (%4d,%4d)\n", ul_ls_est[k].r, ul_ls_est[k].i, ul_ch[k].r, ul_ch[k].i); #endif + pilot_cnt++; + } + } } else if (pusch_pdu->dmrs_config_type == pusch_dmrs_type2 && chest_freq == 0) { // pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d| LOG_D(PHY, "PUSCH estimation DMRS type 2, Freq-domain interpolation\n"); @@ -260,10 +302,21 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, pil++; c16_t ch = c16addShift(ch0, ch1, 1); *max_ch = max(*max_ch, max(abs(ch.r), abs(ch.i))); - multadd_real_four_symbols_vector_complex_scalar(filt8_rep4, &ch, &ul_ch[n]); - ul_ch[n + 4] = ch; - ul_ch[n + 5] = ch; + multadd_real_four_symbols_vector_complex_scalar(filt8_rep4, &ch, &ul_ls_est[n]); + ul_ls_est[n + 4] = ch; + ul_ls_est[n + 5] = ch; } + + // Delay compensation + freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]); + nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], &gNB->measurements.delay[ul_id]); + int delay = gNB->measurements.delay[ul_id].pusch_est_delay; + int delay_idx = get_delay_idx(-delay); + c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; + for (int n = 0; n < nb_rb_pusch * NR_NB_SC_PER_RB; n++) { + ul_ch[n] = c16mulShift(ul_ls_est[n], ul_delay_table[n % 6], 8); + } + } else if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1) { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB @@ -432,21 +485,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, } #ifdef DEBUG_PUSCH - ul_ch = &ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset]; - - for(int idxP=0; idxPframe_parms.nb_antennas_rx + aarx][ch_offset]; + for (int idxP = 0; idxP < ceil((float)nb_rb_pusch * 12 / 8); idxP++) { + for (int idxI = 0; idxI < 8; idxI++) { + printf("%d\t%d\t", ul_ch[idxP * 8 + idxI].r, ul_ch[idxP * 8 + idxI].i); } - - printf("%d\n",idxP); + printf("%d\n", idxP); } #endif - // Convert to time domain - freq2time(symbolSize, - (int16_t *) &ul_ch_estimates[aarx][symbol_offset], - (int16_t *) gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]); } #ifdef DEBUG_CH diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h index 9801e72e87..fb43e83827 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h @@ -55,7 +55,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb) void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol, uint8_t nrOfLayers); -int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id); +void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms, const int32_t *ul_ch_estimates_time, struct delay_s *delay); int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 61249369e2..63fbf20d0d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -108,7 +108,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, a_segments = a_segments/273 +1; } - LOG_I(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB); + LOG_D(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB); uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t)); AssertFatal(dlsch, "cannot allocate dlsch\n"); diff --git a/openair1/PHY/NR_TRANSPORT/srs_rx.c b/openair1/PHY/NR_TRANSPORT/srs_rx.c index 7c0e241af8..94f1e29993 100644 --- a/openair1/PHY/NR_TRANSPORT/srs_rx.c +++ b/openair1/PHY/NR_TRANSPORT/srs_rx.c @@ -30,7 +30,7 @@ #include #include -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/impl_defs_nr.h" #include "PHY/defs_nr_common.h" #include "PHY/defs_gNB.h" diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index eaa1f5be7b..78dc616d07 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -33,7 +33,7 @@ #include "executables/softmodem-common.h" #include "executables/nr-softmodem-common.h" #include "PHY/defs_nr_UE.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/phy_extern_nr_ue.h" #include "common/utils/LOG/log.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index d4ffb66b65..5a7bd8a020 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -38,7 +38,7 @@ #include "executables/softmodem-common.h" #include "nr_transport_proto_ue.h" #include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h" -#include "PHY/phy_extern_nr_ue.h" +#include "PHY/phy_extern.h" #include "PHY/CODING/coding_extern.h" #include "PHY/sse_intrin.h" #include "common/utils/nr/nr_common.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index d568172153..942c6befdf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -29,7 +29,7 @@ * \warning */ #include "PHY/defs_nr_UE.h" -#include "PHY/phy_extern_nr_ue.h" +#include "PHY/phy_extern.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "nr_transport_proto_ue.h" #include "PHY/sse_intrin.h" @@ -197,7 +197,7 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, int32_t rxdataF_comp[][nbRx][rx_size_symbol * NR_SYMBOLS_PER_SLOT], int ***rho, NR_DL_FRAME_PARMS *frame_parms, - uint8_t nb_aatx, + uint8_t n_layers, unsigned char symbol, int length, uint8_t first_symbol_flag, @@ -263,17 +263,18 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, c16_t ptrs_phase_per_slot[][NR_SYMBOLS_PER_SLOT], int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT]) { - const int matrixSz = ue->frame_parms.nb_antennas_rx * ue->frame_parms.nb_antennas_tx; + const int nl = dlsch[0].Nl; + const int matrixSz = ue->frame_parms.nb_antennas_rx * nl; __attribute__((aligned(32))) int32_t dl_ch_estimates_ext[matrixSz][rx_size_symbol]; memset(dl_ch_estimates_ext, 0, sizeof(dl_ch_estimates_ext)); - __attribute__((aligned(32))) int32_t dl_ch_mag[ue->frame_parms.nb_antennas_tx][ue->frame_parms.nb_antennas_rx][rx_size_symbol]; + __attribute__((aligned(32))) int32_t dl_ch_mag[nl][ue->frame_parms.nb_antennas_rx][rx_size_symbol]; memset(dl_ch_mag, 0, sizeof(dl_ch_mag)); - __attribute__((aligned(32))) int32_t dl_ch_magb[ue->frame_parms.nb_antennas_tx][nbRx][rx_size_symbol]; + __attribute__((aligned(32))) int32_t dl_ch_magb[nl][nbRx][rx_size_symbol]; memset(dl_ch_magb, 0, sizeof(dl_ch_magb)); - __attribute__((aligned(32))) int32_t dl_ch_magr[ue->frame_parms.nb_antennas_tx][nbRx][rx_size_symbol]; + __attribute__((aligned(32))) int32_t dl_ch_magr[nl][nbRx][rx_size_symbol]; memset(dl_ch_magr, 0, sizeof(dl_ch_magr)); NR_UE_COMMON *common_vars = &ue->common_vars; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; @@ -405,7 +406,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //--------------------- RBs extraction --------------------- //---------------------------------------------------------- const int n_rx = frame_parms->nb_antennas_rx; - const int nl = dlsch[0].Nl; start_meas(&ue->generic_stat_bis[slot]); { @@ -425,7 +425,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_rb + dlsch[0].dlsch_config.BWPStart, nb_rb_pdsch, dlsch[0].dlsch_config.n_dmrs_cdm_groups, - dlsch[0].Nl, + nl, frame_parms, dlsch[0].dlsch_config.dlDmrsSymbPos, ue->chest_time); @@ -465,7 +465,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); median[(aatx*n_rx)+aarx] = avg[(aatx*n_rx)+aarx]; } - if (dlsch[0].Nl > 1) { + if (nl > 1) { nr_dlsch_channel_level_median(rx_size_symbol, dl_ch_estimates_ext, median, nl, n_rx, nb_re_pdsch); for (aatx = 0; aatx < nl; aatx++) { for (aarx = 0; aarx < n_rx; aarx++) { @@ -743,7 +743,7 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, int32_t rxdataF_comp[][nbRx][rx_size_symbol * NR_SYMBOLS_PER_SLOT], int ***rho, NR_DL_FRAME_PARMS *frame_parms, - uint8_t nb_aatx, + uint8_t n_layers, unsigned char symbol, int length, uint8_t first_symbol_flag, @@ -756,12 +756,12 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, #if defined(__i386) || defined(__x86_64) unsigned short rb; - unsigned char aatx,aarx,atx; + unsigned char aarx,atx; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*dl_ch_mag128r,*rxdataF128,*rxdataF_comp128,*rho128; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0},QAM_amp128r={0}; - uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); - for (aatx=0; aatxnb_antennas_rx; aarx++) { - dl_ch128 = (__m128i *)dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx]; - dl_ch_mag128 = (__m128i *)dl_ch_mag[aatx][aarx]; - dl_ch_mag128b = (__m128i *)dl_ch_magb[aatx][aarx]; - dl_ch_mag128r = (__m128i *)dl_ch_magr[aatx][aarx]; + dl_ch128 = (__m128i *)dl_ch_estimates_ext[(l * frame_parms->nb_antennas_rx) + aarx]; + dl_ch_mag128 = (__m128i *)dl_ch_mag[l][aarx]; + dl_ch_mag128b = (__m128i *)dl_ch_magb[l][aarx]; + dl_ch_mag128r = (__m128i *)dl_ch_magr[l][aarx]; rxdataF128 = (__m128i *)rxdataF_ext[aarx]; - rxdataF_comp128 = (__m128i *)(rxdataF_comp[aatx][aarx] + symbol * nb_rb * 12); + rxdataF_comp128 = (__m128i *)(rxdataF_comp[l][aarx] + symbol * nb_rb * 12); for (rb=0; rb2) { @@ -868,12 +868,12 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); #ifdef DEBUG_DLSCH_DEMOD - printf("%%arx%d atx%d rb_index %d symbol %d shift %d\n",aarx,aatx,rb,symbol,output_shift); + printf("%%arx%d atx%d rb_index %d symbol %d shift %d\n",aarx,l,rb,symbol,output_shift); printf("rx_%d(%d,:)",aarx+1,rb+1); print_shorts(" ",(int16_t *)&rxdataF128[0]); - printf("ch_%d%d(%d,:)",aarx+1,aatx+1,rb+1); + printf("ch_%d%d(%d,:)",aarx+1,l+1,rb+1); print_shorts(" ",(int16_t *)&dl_ch128[0]); - printf("rx_comp_%d%d(%d,:)",aarx+1,aatx+1,rb+1); + printf("rx_comp_%d%d(%d,:)",aarx+1,l+1,rb+1); print_shorts(" ",(int16_t *)&rxdataF_comp128[0]); #endif @@ -929,22 +929,22 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, if (rho) { //we compute the Tx correlation matrix for each Rx antenna //As an example the 2x2 MIMO case requires - //rho[aarx][nb_aatx*nb_aatx] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1) + //rho[aarx][nl*nl] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1) // cov(H_aarx_1,H_aarx_0) cov(H_aarx_1,H_aarx_1)], aarx=0,...,nb_antennas_rx-1 - //int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; - //int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; + //int avg_rho_re[frame_parms->nb_antennas_rx][nl*nl]; + //int avg_rho_im[frame_parms->nb_antennas_rx][nl*nl]; for (aarx=0; aarxnb_antennas_rx; aarx++) { - for (aatx=0; aatxnb_antennas_rx+aarx]; - dl_ch128_2 = (__m128i *)dl_ch_estimates_ext[atx*frame_parms->nb_antennas_rx+aarx]; + for (atx = 0; atx < n_layers; atx++) { + //avg_rho_re[aarx][l*n_layers+atx] = 0; + //avg_rho_im[aarx][l*n_layers+atx] = 0; + rho128 = (__m128i *)&rho[aarx][l * n_layers + atx][symbol * nb_rb * 12]; + dl_ch128 = (__m128i *)dl_ch_estimates_ext[l * frame_parms->nb_antennas_rx + aarx]; + dl_ch128_2 = (__m128i *)dl_ch_estimates_ext[atx * frame_parms->nb_antennas_rx + aarx]; for (rb=0; rbrx_correlation[0][aarx][aatx*nb_aatx+atx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],length); - //avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/length; - //avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/length; - //printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aarx][aatx*nb_aatx+atx], avg_rho_im[aarx][aatx*nb_aatx+atx]); - //printf("rho_corr[rx]%d tx%d tx%d = %d ...\n",aarx, aatx,atx, measurements->rx_correlation[0][aarx][aatx*nb_aatx+atx]); + //rho_rx_corr[arx][nm] = |H_arx_n|^2.|H_arx_m|^2 &rho[aarx][l*n_layers+atx][symbol*nb_rb*12] + measurements->rx_correlation[0][aarx][l * n_layers + atx] = signal_energy(&rho[aarx][l * n_layers + atx][symbol * nb_rb * 12],length); + //avg_rho_re[aarx][l*n_layers+atx] = 16*avg_rho_re[aarx][l*n_layers+atx]/length; + //avg_rho_im[aarx][l*n_layers+atx] = 16*avg_rho_im[aarx][l*n_layers+atx]/length; + //printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, l,atx, avg_rho_re[aarx][l*n_layers+atx], avg_rho_im[aarx][l*n_layers+atx]); + //printf("rho_corr[rx]%d tx%d tx%d = %d ...\n",aarx, l,atx, measurements->rx_correlation[0][aarx][l*n_layers+atx]); } } } @@ -1055,7 +1055,6 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, #elif defined(__arm__) || defined(__aarch64__) unsigned short rb; - unsigned char aatx,aarx,symbol_mod; int16x4_t *dl_ch128,*dl_ch128_2,*rxdataF128; int32x4_t mmtmpD0,mmtmpD1,mmtmpD0b,mmtmpD1b; @@ -1066,11 +1065,11 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + unsigned char symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); - for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) { + for (int l = 0; l < n_layers; l++) { if (mod_order == 4) { QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = vmovq_n_s16(0); @@ -1080,12 +1079,12 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, } // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); - for (aarx=0; aarxnb_antennas_rx; aarx++) { - dl_ch128 = (int16x4_t*)dl_ch_estimates_ext[(aatx<<1)+aarx]; - dl_ch_mag128 = (int16x8_t *)dl_ch_mag[aatx][aarx]; - dl_ch_mag128b = (int16x8_t *)dl_ch_magb[aatx][aarx]; + for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { + dl_ch128 = (int16x4_t*)dl_ch_estimates_ext[(l << 1) + aarx]; + dl_ch_mag128 = (int16x8_t *)dl_ch_mag[l][aarx]; + dl_ch_mag128b = (int16x8_t *)dl_ch_magb[l][aarx]; rxdataF128 = (int16x4_t *)rxdataF_ext[aarx]; - rxdataF_comp128 = (int16x4x2_t *)(rxdataF_comp[aatx][aarx] + symbol * nb_rb * 12); + rxdataF_comp128 = (int16x4x2_t *)(rxdataF_comp[l][aarx] + symbol * nb_rb * 12); for (rb=0; rb2) { @@ -1238,13 +1237,13 @@ void nr_dlsch_channel_compensation(uint32_t rx_size_symbol, void nr_dlsch_scale_channel(uint32_t rx_size_symbol, int32_t dl_ch_estimates_ext[][rx_size_symbol], - NR_DL_FRAME_PARMS *frame_parms, - uint8_t n_tx, - uint8_t n_rx, - uint8_t symbol, - uint8_t pilots, - uint32_t len, - unsigned short nb_rb) + NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, + uint8_t n_rx, + uint8_t symbol, + uint8_t pilots, + uint32_t len, + unsigned short nb_rb) { #if defined(__x86_64__)||defined(__i386__) @@ -1530,13 +1529,13 @@ static void nr_dlsch_extract_rbs(uint32_t rxdataF_sz, c16_t *rxF_ext = rxdataF_ext[aarx]; c16_t *rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; - for (unsigned char aatx = 0; aatx < Nl; aatx++) { + for (unsigned char l = 0; l < Nl; l++) { - int32_t *dl_ch0 = &dl_ch_estimates[(aatx*frame_parms->nb_antennas_rx)+aarx][validDmrsEst * frame_parms->ofdm_symbol_size]; - int32_t *dl_ch0_ext = dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx]; + int32_t *dl_ch0 = &dl_ch_estimates[(l * frame_parms->nb_antennas_rx) + aarx][validDmrsEst * frame_parms->ofdm_symbol_size]; + int32_t *dl_ch0_ext = dl_ch_estimates_ext[(l * frame_parms->nb_antennas_rx) + aarx]; if (pilots == 0) { //data symbol only - if (aatx == 0) { + if (l == 0) { if (start_re + nb_rb_pdsch * NR_NB_SC_PER_RB <= frame_parms->ofdm_symbol_size) { memcpy(rxF_ext, &rxF[start_re], nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); } else { @@ -1550,7 +1549,7 @@ static void nr_dlsch_extract_rbs(uint32_t rxdataF_sz, } else if (config_type == NFAPI_NR_DMRS_TYPE1){ if (n_dmrs_cdm_groups == 1) { //data is multiplexed - if (aatx == 0) { + if (l == 0) { unsigned short k = start_re; for (unsigned short j = 0; j < 6*nb_rb_pdsch; j += 3) { rxF_ext[j] = rxF[k+1]; @@ -1571,7 +1570,7 @@ static void nr_dlsch_extract_rbs(uint32_t rxdataF_sz, } else {//NFAPI_NR_DMRS_TYPE2 if (n_dmrs_cdm_groups == 1) { //data is multiplexed - if (aatx == 0) { + if (l == 0) { unsigned short k = start_re; for (unsigned short j = 0; j < 8*nb_rb_pdsch; j += 4) { rxF_ext[j] = rxF[k+2]; @@ -1592,7 +1591,7 @@ static void nr_dlsch_extract_rbs(uint32_t rxdataF_sz, } } else if (n_dmrs_cdm_groups == 2) { //data is multiplexed - if (aatx == 0) { + if (l == 0) { unsigned short k = start_re; for (unsigned short j = 0; j < 4*nb_rb_pdsch; j += 2) { rxF_ext[j] = rxF[k+4]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 1d9d30ec33..0c2149e997 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -34,7 +34,7 @@ #include "PHY/phy_extern_nr_ue.h" #include "PHY/sse_intrin.h" #include "PHY/LTE_REFSIG/lte_refsig.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "openair1/SCHED_NR_UE/defs.h" #include #include diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index e67adafe3f..9031ad3f12 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -572,7 +572,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) #ifndef NR_UNIT_TEST - printf("PSS execution duration %4d microseconds \n", duration_ms); + LOG_I(PHY,"PSS execution duration %4d microseconds \n", duration_ms); #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h index 5feea8d9ce..803aada84a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h @@ -33,6 +33,8 @@ #ifndef SRS_MODULATION_NR_H #define SRS_MODULATION_NR_H +#include "PHY/defs_nr_UE.h" + #ifdef DEFINE_VARIABLES_SRS_MODULATION_NR_H #define EXTERN #define INIT_VARIABLES_SRS_MODULATION_NR_H diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c index 41829b68f2..3056315999 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c @@ -541,7 +541,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, #ifdef DEBUG_SSS_NR - printf("(phase,Nid1) (%d,%d), metric_phase %d tot_metric %d, phase_max %d \n",phase, Nid1, metric, *tot_metric, *phase_max); + LOG_D(PHY,"(phase,Nid1) (%d,%d), metric_phase %d tot_metric %d, phase_max %d \n",phase, Nid1, metric, *tot_metric, *phase_max); #endif } @@ -554,7 +554,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, if (*tot_metric > SSS_METRIC_FLOOR_NR) { Nid2 = GET_NID2(frame_parms->Nid_cell); Nid1 = GET_NID1(frame_parms->Nid_cell); - printf("Nid2 %d Nid1 %d tot_metric %d, phase_max %d \n", Nid2, Nid1, *tot_metric, *phase_max); + LOG_D(PHY,"Nid2 %d Nid1 %d tot_metric %d, phase_max %d \n", Nid2, Nid1, *tot_metric, *phase_max); } //#endif @@ -564,7 +564,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, int re = 0; int im = 0; if (Nid1 == N_ID_1_NUMBER) { - LOG_I(PHY,"Failled to detect SSS after PSS\n"); + LOG_I(PHY,"Failed to detect SSS after PSS\n"); return -1; } d = (int16_t *)&d_sss[Nid2][Nid1]; diff --git a/openair1/PHY/TOOLS/CMakeLists.txt b/openair1/PHY/TOOLS/CMakeLists.txt index 0a6026fb25..0def967792 100644 --- a/openair1/PHY/TOOLS/CMakeLists.txt +++ b/openair1/PHY/TOOLS/CMakeLists.txt @@ -33,16 +33,16 @@ include_directories ("/usr/include/X11") add_library(xforms_common OBJECT lte_phy_scope.c ../../../executables/stats.c) -target_link_libraries(xforms_common PRIVATE asn1_nr_rrc PRIVATE asn1_lte_rrc) +target_link_libraries(xforms_common PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(enbscope MODULE lte_enb_scope.c $) -target_link_libraries(enbscope PUBLIC forms PRIVATE asn1_nr_rrc PRIVATE asn1_lte_rrc) +target_link_libraries(enbscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(uescope MODULE lte_ue_scope.c $) -target_link_libraries(uescope PUBLIC forms PRIVATE asn1_nr_rrc PRIVATE asn1_lte_rrc) +target_link_libraries(uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_library(nrscope MODULE nr_phy_scope.c) -target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc PRIVATE asn1_lte_rrc) +target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) # all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources) set_target_properties(enbscope uescope nrscope diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 60bf49796b..9c338b5d3f 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -545,6 +545,16 @@ typedef struct { int subband_cqi_tot_dB[NUMBER_OF_NR_ULSCH_MAX][275]; /// PRACH background noise level int prach_I0; + + struct delay_s { + /// Time shift in number of samples estimated based on DMRS-PUSCH + int pusch_est_delay; + /// Max position in OFDM symbol related to time shift estimation based on DMRS-PUSCH + int pusch_delay_max_pos; + /// Max value related to time shift estimation based on DMRS-PUSCH + int pusch_delay_max_val; + } delay[NUMBER_OF_NR_ULSCH_MAX]; + } PHY_MEASUREMENTS_gNB; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 9e87116a4a..8d9de8976d 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -95,6 +95,8 @@ #define NR_NB_NSCID 2 +#define MAX_UL_DELAY_COMP 20 + typedef enum { NR_MU_0=0, NR_MU_1, @@ -219,6 +221,8 @@ struct NR_DL_FRAME_PARMS { /// sequence used to compensate the phase rotation due to timeshifted OFDM symbols /// First dimenstion is for different CP lengths c16_t timeshift_symbol_rotation[4096*2] __attribute__ ((aligned (16))); + /// Table used to apply the delay compensation in UL + c16_t ul_delay_table[2 * MAX_UL_DELAY_COMP + 1][NR_MAX_OFDM_SYMBOL_SIZE * 2]; /// shift of pilot position in one RB uint8_t nushift; /// SRS configuration from TS 38.331 RRC diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index 71db7df2bd..97a0046bc4 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -24,80 +24,107 @@ #include "PHY/defs_common.h" -extern char* namepointer_chMag ; -extern char* namepointer_log2; -extern char fmageren_name2[512]; - -extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; -extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; - #include "PHY/LTE_TRANSPORT/transport_vars.h" #include "PHY/defs_RU.h" -extern unsigned int DAQ_MBOX; extern int number_of_cards; -extern const short conjugate[8],conjugate2[8]; +static const short conjugate[8] __attribute__((aligned(16))) = {-1, 1, -1, 1, -1, 1, -1, 1}; +static const short conjugate2[8] __attribute__((aligned(16))) = {1, -1, 1, -1, 1, -1, 1, -1}; - -extern short primary_synch0[144]; -extern short primary_synch1[144]; -extern short primary_synch2[144]; -extern unsigned char primary_synch0_tab[72]; -extern unsigned char primary_synch1_tab[72]; -extern unsigned char primary_synch2_tab[72]; - -extern int flagMag; -//extern short **txdataF_rep_tmp; - -extern char mode_string[4][20]; +static const short primary_synch0[144] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32767, 0, -26120, -19785, 11971, -30502, + -24020, -22288, 32117, 6492, 31311, 9658, -16384, -28378, 25100, -21063, -7292, -31946, 20429, 25618, 14948, 29158, + 11971, -30502, 31311, 9658, 25100, -21063, -16384, 28377, -24020, 22287, 32117, 6492, -7292, 31945, 20429, 25618, + -26120, -19785, -16384, -28378, -16384, 28377, -26120, -19785, -32402, 4883, 31311, -9659, 32117, 6492, -7292, -31946, + 32767, -1, 25100, -21063, -24020, 22287, -32402, 4883, -32402, 4883, -24020, 22287, 25100, -21063, 32767, -1, + -7292, -31946, 32117, 6492, 31311, -9659, -32402, 4883, -26120, -19785, -16384, 28377, -16384, -28378, -26120, -19785, + 20429, 25618, -7292, 31945, 32117, 6492, -24020, 22287, -16384, 28377, 25100, -21063, 31311, 9658, 11971, -30502, + 14948, 29158, 20429, 25618, -7292, -31946, 25100, -21063, -16384, -28378, 31311, 9658, 32117, 6492, -24020, -22288, + 11971, -30502, -26120, -19785, 32767, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const short primary_synch1[144] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32767, 0, -31754, -8086, -24020, -22288, + 2448, 32675, -26120, 19784, 27073, 18458, -16384, 28377, 25100, 21062, -29523, 14217, -7292, 31945, -13477, -29868, + -24020, -22288, 27073, 18458, 25100, 21062, -16384, -28378, 2448, -32676, -26120, 19784, -29523, -14218, -7292, 31945, + -31754, -8086, -16384, 28377, -16384, -28378, -31754, -8086, 31311, -9659, 27073, -18459, -26120, 19784, -29523, 14217, + 32767, -1, 25100, 21062, 2448, -32676, 31311, -9659, 31311, -9659, 2448, -32676, 25100, 21062, 32767, 0, + -29523, 14217, -26120, 19784, 27073, -18459, 31311, -9659, -31754, -8086, -16384, -28378, -16384, 28377, -31754, -8086, + -7292, 31945, -29523, -14218, -26120, 19784, 2448, -32676, -16384, -28378, 25100, 21062, 27073, 18458, -24020, -22288, + -13477, -29868, -7292, 31945, -29523, 14217, 25100, 21062, -16384, 28377, 27073, 18458, -26120, 19784, 2448, 32675, + -24020, -22288, -31754, -8086, 32767, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const short primary_synch2[144] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32767, 0, -31754, 8085, -24020, 22287, + 2448, -32676, -26120, -19785, 27073, -18459, -16384, -28378, 25100, -21063, -29523, -14218, -7292, -31946, -13477, 29867, + -24020, 22287, 27073, -18459, 25100, -21063, -16384, 28377, 2448, 32675, -26120, -19785, -29523, 14217, -7292, -31946, + -31754, 8085, -16384, -28378, -16384, 28377, -31754, 8085, 31311, 9658, 27073, 18458, -26120, -19785, -29523, -14218, + 32767, 0, 25100, -21063, 2448, 32675, 31311, 9658, 31311, 9658, 2448, 32675, 25100, -21063, 32767, 0, + -29523, -14218, -26120, -19785, 27073, 18458, 31311, 9658, -31754, 8085, -16384, 28377, -16384, -28378, -31754, 8085, + -7292, -31946, -29523, 14217, -26120, -19785, 2448, 32675, -16384, 28377, 25100, -21063, 27073, -18459, -24020, 22287, + -13477, 29867, -7292, -31946, -29523, -14218, 25100, -21063, -16384, -28378, 27073, -18459, -26120, -19785, 2448, -32676, + -24020, 22287, -31754, 8085, 32767, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; extern unsigned char NB_RU; -extern int flag_LA; -extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; -extern double sinr_bler_map_up[MCS_COUNT][2][16]; -extern int table_length[MCS_COUNT]; -extern const double sinr_to_cqi[4][16]; -extern const int cqi_to_mcs[16]; - -//for MU-MIMO abstraction using MIESM -//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively -extern double MI_map_4qam[3][162]; -extern double MI_map_16qam[3][197]; -extern double MI_map_64qam[3][227]; - -extern const double beta1_dlsch_MI[6][MCS_COUNT]; -extern const double beta2_dlsch_MI[6][MCS_COUNT]; - -extern const double q_qpsk[8]; -extern const double q_qam16[8]; -extern const double q_qam64[8]; -extern const double p_qpsk[8]; -extern const double p_qam16[8]; -extern const double p_qam64[8]; - -extern const double beta1_dlsch[6][MCS_COUNT]; -extern const double beta2_dlsch[6][MCS_COUNT]; - -extern const char NB_functions[7][20]; -extern const char NB_timing[2][20]; -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; +static const char NB_functions[7][20] = { + "eNodeB_3GPP", + "eNodeB_3GPP_BBU", + "NGFI_RAU_IF4p5", + "NGFI_RRU_IF5", + "NGFI_RRU_IF4p5", + "gNodeB_3GPP", +}; +static const char NB_timing[2][20] = {"synch_to_ext_device", "synch_to_other"}; +static const char ru_if_types[MAX_RU_IF_TYPES][20] = {"local RF", "IF5 RRU", "IF5 Mobipass", "IF4p5 RRU", "IF1pp RRU"}; extern int16_t unscrambling_lut[65536*16]; extern uint8_t scrambling_lut[65536*16]; -extern unsigned short msrsb_6_40[8][4]; -extern unsigned short msrsb_41_60[8][4]; -extern unsigned short msrsb_61_80[8][4]; -extern unsigned short msrsb_81_110[8][4]; -extern unsigned short Nb_6_40[8][4]; -extern unsigned short Nb_41_60[8][4]; -extern unsigned short Nb_61_80[8][4]; -extern unsigned short Nb_81_110[8][4]; +static const unsigned short Nb_6_40[8][4] = { + {36,12,4,4}, + {32,16,8,4}, + {24,4,4,4}, + {20,4,4,4}, + {16,4,4,4}, + {12,4,4,4}, + {8,4,4,4}, + {4,4,4,4} +}; +static const unsigned short Nb_41_60[8][4] = { + {48,24,12,4}, + {48,16,8,4}, + {40,20,4,4}, + {36,12,4,4}, + {32,16,8,4}, + {24,4,4,4}, + {20,4,4,4}, + {16,4,4,4} +}; +static const unsigned short Nb_61_80[8][4] = { + {72,24,12,4}, + {64,32,16,4}, + {60,20,4,4}, + {48,24,12,4}, + {48,16,8,4}, + {40,20,4,4}, + {36,12,4,4}, + {32,16,8,4} +}; +static const unsigned short Nb_81_110[8][4] = { + {96,48,24,4}, + {96,32,16,4}, + {80,40,20,4}, + {72,24,12,4}, + {64,32,16,4}, + {60,20,4,4}, + {48,24,12,4}, + {48,16,8,4} +}; + +static const uint8_t alpha_lut[8] = {0, 40, 50, 60, 70, 80, 90, 100}; -extern uint8_t alpha_lut[8]; extern uint8_t max_turbo_iterations; +extern double cpuf; + #endif /*__PHY_EXTERN_H__ */ diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h index 4701a16012..98765730bb 100644 --- a/openair1/PHY/phy_extern_nr_ue.h +++ b/openair1/PHY/phy_extern_nr_ue.h @@ -23,90 +23,7 @@ #define __PHY_EXTERN_NR_UE__H__ #include "PHY/defs_nr_UE.h" -//#include "common/ran_context.h" - -#ifdef XFORMS - #include "PHY/TOOLS/nr_phy_scope.h" - extern uint32_t do_forms; -#endif - -extern char* namepointer_chMag ; -extern char* namepointer_log2; -extern char fmageren_name2[512]; - -extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; -extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; - -extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; -extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; - -extern const short conjugate[8],conjugate2[8]; -extern int number_of_cards; - - extern PHY_VARS_NR_UE ***PHY_vars_UE_g; -extern short primary_synch0[144]; -extern short primary_synch1[144]; -extern short primary_synch2[144]; -extern unsigned char primary_synch0_tab[72]; -extern unsigned char primary_synch1_tab[72]; -extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ - -extern int flagMag; -//extern short **txdataF_rep_tmp; - -extern char mode_string[4][20]; - -extern unsigned char NB_RU; - -extern int flag_LA; -extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; -extern double sinr_bler_map_up[MCS_COUNT][2][16]; -extern int table_length[MCS_COUNT]; -extern const double sinr_to_cqi[4][16]; -extern const int cqi_to_mcs[16]; - -//for MU-MIMO abstraction using MIESM -//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively -extern double MI_map_4qam[3][162]; -extern double MI_map_16qam[3][197]; -extern double MI_map_64qam[3][227]; - -extern const double beta1_dlsch_MI[6][MCS_COUNT]; -extern const double beta2_dlsch_MI[6][MCS_COUNT]; - -extern const double q_qpsk[8]; -extern const double q_qam16[8]; -extern const double q_qam64[8]; - -extern const double beta1_dlsch[6][MCS_COUNT]; -extern const double beta2_dlsch[6][MCS_COUNT]; - -extern const char NB_functions[7][20]; -extern const char NB_timing[2][20]; -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; - -extern int16_t unscrambling_lut[65536*16]; -extern uint8_t scrambling_lut[65536*16]; - -extern unsigned short msrsb_6_40[8][4]; -extern unsigned short msrsb_41_60[8][4]; -extern unsigned short msrsb_61_80[8][4]; -extern unsigned short msrsb_81_110[8][4]; -extern unsigned short Nb_6_40[8][4]; -extern unsigned short Nb_41_60[8][4]; -extern unsigned short Nb_61_80[8][4]; -extern unsigned short Nb_81_110[8][4]; - -extern uint16_t hundred_times_log10_NPRB[100]; -extern uint8_t alpha_lut[8]; -extern uint8_t max_turbo_iterations; - -extern double cpuf; - #endif /*__PHY_EXTERN_H__ */ diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h index 0249ed0147..dd4740e27a 100644 --- a/openair1/PHY/phy_extern_ue.h +++ b/openair1/PHY/phy_extern_ue.h @@ -24,79 +24,9 @@ #include "PHY/defs_UE.h" -extern char* namepointer_chMag ; -extern char* namepointer_log2; -extern char fmageren_name2[512]; - -extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; -extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; - -#include "PHY/LTE_TRANSPORT/transport_vars.h" - -extern int number_of_cards; - -extern const short conjugate[8],conjugate2[8]; - - extern PHY_VARS_UE ***PHY_vars_UE_g; -extern short primary_synch0[144]; -extern short primary_synch1[144]; -extern short primary_synch2[144]; -extern unsigned char primary_synch0_tab[72]; -extern unsigned char primary_synch1_tab[72]; -extern unsigned char primary_synch2_tab[72]; - -extern int flagMag; -//extern short **txdataF_rep_tmp; - -extern char mode_string[4][20]; - - -extern int flag_LA; -extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; -extern double sinr_bler_map_up[MCS_COUNT][2][16]; -extern int table_length[MCS_COUNT]; -extern const double sinr_to_cqi[4][16]; -extern const int cqi_to_mcs[16]; - -//for MU-MIMO abstraction using MIESM -//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively -extern double MI_map_4qam[3][162]; -extern double MI_map_16qam[3][197]; -extern double MI_map_64qam[3][227]; - -extern const double beta1_dlsch_MI[6][MCS_COUNT]; -extern const double beta2_dlsch_MI[6][MCS_COUNT]; - -extern const double q_qpsk[8]; -extern const double q_qam16[8]; -extern const double q_qam64[8]; - -extern const double p_qpsk[8]; -extern const double p_qam16[8]; -extern const double p_qam64[8]; - -extern const double beta1_dlsch[6][MCS_COUNT]; -extern const double beta2_dlsch[6][MCS_COUNT]; - -extern const char NB_functions[7][20]; -extern const char NB_timing[2][20]; -extern const char ru_if_types[MAX_RU_IF_TYPES][20]; - -extern int16_t unscrambling_lut[65536*16]; -extern uint8_t scrambling_lut[65536*16]; - -extern unsigned short msrsb_6_40[8][4]; -extern unsigned short msrsb_41_60[8][4]; -extern unsigned short msrsb_61_80[8][4]; -extern unsigned short msrsb_81_110[8][4]; -extern unsigned short Nb_6_40[8][4]; -extern unsigned short Nb_41_60[8][4]; -extern unsigned short Nb_61_80[8][4]; -extern unsigned short Nb_81_110[8][4]; - -extern uint8_t alpha_lut[8]; extern uint8_t max_turbo_iterations; + #endif /*__PHY_EXTERN_H__ */ diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index b1899639fb..89063c5be2 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -22,104 +22,18 @@ #ifndef __PHY_VARS_H__ #define __PHY_VARS_H__ -#include "PHY/types.h" -#include "PHY/defs_eNB.h" -#include "PHY/defs_gNB.h" #include "PHY/defs_UE.h" -char* namepointer_chMag ; -char fmageren_name2[512]; -char* namepointer_log2; - - -#include "PHY/LTE_REFSIG/primary_synch.h" - -#include "PHY/LTE_TRANSPORT/transport_vars.h" - -#include "nfapi/oai_integration/vendor_ext.h" +#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" +#include "openair2/PHY_INTERFACE/IF_Module.h" PHY_VARS_UE ***PHY_vars_UE_g; UL_RCC_IND_t UL_RCC_INFO; NR_UL_IND_t UL_INFO; -unsigned short rev[2048],rev_times4[8192],rev_half[1024]; -unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; - - -const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; - unsigned char NB_RU=0; - int number_of_cards; - - -int flag_LA=0; -int flagMag; -//extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; -//extern double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9]; -//extern double ABS_beta[MCS_COUNT];odi -double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; -int table_length[MCS_COUNT]; -//double sinr_bler_map_up[MCS_COUNT][2][16]; - -//for MU-MIMO abstraction using MIESM -//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively -double MI_map_4qam[3][162]; -double MI_map_16qam[3][197]; -double MI_map_64qam[3][227]; - -// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs -const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, - {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, - {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, - { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} -}; - -const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; - -//for SNR to MI conversion 7 th order Polynomial coeff -const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; -const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; -const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; - -//for MI to SNR conversion 7 th order Polynomial coeff -const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; -const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; -const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; - -// ideal CE MIESM - -const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; -const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; - -//real CE MIESM -/* -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}}; -*/ -//ideal channel estimation values -//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; -const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; - -//real channel estimation valus -/* -double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}}; -double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}}; - -*/ - -const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; -const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; - -/// lookup table for unscrambling in RX -int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); -/// lookup table for scrambling in TX -uint8_t scrambling_lut[65536*16] __attribute__((aligned(32))); - uint8_t max_turbo_iterations=4; + #endif /*__PHY_VARS_H__ */ diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h index 99b22ab69d..2201091270 100644 --- a/openair1/PHY/phy_vars_nr_ue.h +++ b/openair1/PHY/phy_vars_nr_ue.h @@ -22,16 +22,8 @@ #ifndef __PHY_VARS_NR_UE_H__ #define __PHY_VARS_NR_UE_H__ -#include "PHY/types.h" #include "PHY/defs_nr_UE.h" -#include "common/ran_context.h" - PHY_VARS_NR_UE ***PHY_vars_UE_g; -const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; - -const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; - #endif diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index 92a135b44e..12f49d6b0a 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -22,95 +22,11 @@ #ifndef __PHY_VARS_UE__H__ #define __PHY_VARS_UE__H__ -#include "PHY/types.h" #include "PHY/defs_UE.h" -#include "common/ran_context.h" - -char *namepointer_chMag ; -char fmageren_name2[512]; -char *namepointer_log2; - - -#include "PHY/LTE_REFSIG/primary_synch.h" - PHY_VARS_UE ***PHY_vars_UE_g; -unsigned short rev[2048],rev_times4[8192],rev_half[1024]; -unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; - - -const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; - int number_of_cards; - - -int flag_LA=0; -int flagMag; -//extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; -//extern double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9]; -//extern double ABS_beta[MCS_COUNT];odi -double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; -int table_length[MCS_COUNT]; -//double sinr_bler_map_up[MCS_COUNT][2][16]; - -//for MU-MIMO abstraction using MIESM -//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively -double MI_map_4qam[3][162]; -double MI_map_16qam[3][197]; -double MI_map_64qam[3][227]; - -// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs -const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, - {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, - {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, - { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} -}; - -const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; - -//for SNR to MI conversion 7 th order Polynomial coeff -const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; -const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; -const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; - -//for MI to SNR conversion 7 th order Polynomial coeff -const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; -const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; -const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; - -// ideal CE MIESM - -const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; -const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; - -//real CE MIESM -/* -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}}; -*/ -//ideal channel estimation values -//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; -const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; - -//real channel estimation valus -/* -double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}}; -double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}}; - -*/ - -const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; -const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; - -/// lookup table for unscrambling in RX -int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); -/// lookup table for scrambling in TX -uint8_t scrambling_lut[65536*16] __attribute__((aligned(32))); - uint8_t max_turbo_iterations=4; + #endif /* __PHY_VARS_UE__H__ */ diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index f7aa81c199..7dfd14c158 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -1014,7 +1014,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, void *arg) { UL_req->ul_config_request_body.number_of_pdus=0; number_ul_pdu=0; }else if (RC.mac[Mod_id]->scheduler_mode == SCHED_MODE_FAIR_RR) { - if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){ + if(ulsch_pdu_num <= fp->ue_multiple_max){ UL_req->sfn_sf = frame << 4 | subframe; oai_nfapi_ul_config_req(UL_req); UL_req->ul_config_request_body.number_of_pdus=0; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index ebc3b76ec7..e48d9f30a4 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -46,10 +46,6 @@ #include -#include "intertask_interface.h" - -#define MBMS_NFAPI_SCHEDULER - #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -122,7 +118,6 @@ lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subfr return(subframe_select(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)); } -#ifdef MBMS_NFAPI_SCHEDULER void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int fembms_flag) { int subframe = proc->subframe_tx; // This is DL-Cell spec pilots in Control region @@ -151,46 +146,6 @@ void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int fembms_flag) { } eNB->dlsch_MCH->active = 0; } -#else -void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { - MCH_PDU *mch_pduP=NULL; - // uint8_t sync_area=255; - int subframe = proc->subframe_tx; - AssertFatal (1 == 1, "pmch not tested for the moment, exiting\n"); - // This is DL-Cell spec pilots in Control region - generate_pilots_slot (eNB, eNB->common_vars.txdataF, AMP, subframe << 1, 1); - - // if mcch is active, send regardless of the node type: eNB or RN - // when mcch is active, MAC sched does not allow MCCH and MTCH multiplexing - /* - mch_pduP = mac_xface->get_mch_sdu(eNB->Mod_id, - eNB->CC_id, - proc->frame_tx, - subframe); - */ - mch_pduP= &RC.mac[eNB->Mod_id]->common_channels[eNB->CC_id].MCH_pdu; - if ((mch_pduP->Pdu_size > 0) && (mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0 - LOG_D(PHY,"[eNB%"PRIu8"] Frame %d subframe %d : Got MCH pdu for MBSFN (MCS %"PRIu8", TBS %d) \n", - eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->mcs, - eNB->dlsch_MCH->harq_processes[0]->TBS>>3); - else { - LOG_D(PHY,"[DeNB %"PRIu8"] Frame %d subframe %d : Do not transmit MCH pdu for MBSFN sync area %"PRIu8" (%s)\n", - eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->sync_area, - (mch_pduP->Pdu_size == 0)? "Empty MCH PDU":"Let RN transmit for the moment"); - mch_pduP = NULL; - } - - if (mch_pduP) { - fill_eNB_dlsch_MCH (eNB, mch_pduP->mcs, 1, 0); - eNB->dlsch_MCH->harq_ids[proc->frame_tx%2][subframe] = 0; - eNB->dlsch_MCH->harq_processes[0]->pdu=(uint8_t *) mch_pduP->payload; - // Generate PMCH - generate_mch (eNB, proc, NULL/*(uint8_t *) mch_pduP->payload*/); - } else { - LOG_D (PHY, "[eNB/RN] Frame %d subframe %d: MCH not generated \n", proc->frame_tx, subframe); - } -} -#endif void common_signal_procedures_fembms (PHY_VARS_eNB *eNB,int frame, int subframe) { LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; @@ -507,11 +462,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) { if (is_fembms_pmch_subframe(frame,subframe,fp)) { -#ifdef MBMS_NFAPI_SCHEDULER pmch_procedures(eNB,proc,1); LOG_D(MAC,"frame %d, subframe %d -> PMCH\n",frame,subframe); return; -#endif }else if(is_fembms_cas_subframe(frame,subframe,fp) || is_fembms_nonMBSFN_subframe(frame,subframe,fp)){ LOG_D(MAC,"frame %d, subframe %d -> CAS\n",frame,subframe); common_signal_procedures_fembms(eNB,proc->frame_tx, proc->subframe_tx); @@ -520,11 +473,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, if((!is_fembms_cas_subframe(frame,subframe,fp)) && (!is_fembms_nonMBSFN_subframe(frame,subframe,fp))){ if (is_pmch_subframe(frame,subframe,fp)) { -#ifdef MBMS_NFAPI_SCHEDULER pmch_procedures(eNB,proc,0); -#else - pmch_procedures(eNB,proc); -#endif } else { // this is not a pmch subframe, so generate PSS/SSS/PBCH common_signal_procedures(eNB,proc->frame_tx, proc->subframe_tx); @@ -617,10 +566,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) { if (is_fembms_pmch_subframe(frame,subframe,fp)) { -#ifdef MBMS_NFAPI_SCHEDULER pmch_procedures(eNB,proc,1); return; -#endif }else if(is_fembms_cas_subframe(frame,subframe,fp)){ common_signal_procedures_fembms(eNB,proc->frame_tx, proc->subframe_tx); } diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 9aca5b48e1..b0167dce9e 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -43,8 +43,6 @@ #include -#include "intertask_interface.h" - extern uint8_t nfapi_mode; uint8_t get_nr_prach_duration(uint8_t prach_format){ diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6a1a8f7b36..df6e1cb88d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -31,20 +31,19 @@ #include "fapi_nr_l1.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/MODULATION/nr_modulation.h" #include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" #include "T.h" #include "executables/nr-softmodem.h" #include "executables/softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" +#include "NR_SRS-ResourceSet.h" #include "assertions.h" #include -#include "intertask_interface.h" - //#define DEBUG_RXDATA //#define SRS_IND_DEBUG @@ -401,8 +400,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu; - // pdu->data = gNB->ulsch[ULSCH_id+1]->harq_processes[harq_pid]->b; - int sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC + // Get estimated timing advance for MAC + int sync_pos = gNB->measurements.delay[ULSCH_id].pusch_est_delay; // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048; diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index 909459f652..eb9a790e45 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -29,7 +29,6 @@ #define __openair_SCHED_NR_DEFS_H__ #include "PHY/defs_gNB.h" -#include "PHY_INTERFACE/phy_interface.h" #include "PHY/NR_TRANSPORT/nr_dci.h" #include "phy_frame_config_nr.h" diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 57b3dff776..f88b81ad52 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -39,7 +39,7 @@ #include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/phy_extern_nr_ue.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" @@ -588,7 +588,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, memset(ptrs_re_per_slot, 0, sizeof(ptrs_re_per_slot)); const uint32_t rx_size_symbol = dlsch[0].dlsch_config.number_rbs * NR_NB_SC_PER_RB; - __attribute__((aligned(32))) int32_t rxdataF_comp[ue->frame_parms.nb_antennas_tx][ue->frame_parms.nb_antennas_rx][rx_size_symbol * NR_SYMBOLS_PER_SLOT]; + __attribute__((aligned(32))) int32_t rxdataF_comp[dlsch[0].Nl][ue->frame_parms.nb_antennas_rx][rx_size_symbol * NR_SYMBOLS_PER_SLOT]; memset(rxdataF_comp, 0, sizeof(rxdataF_comp)); for (m = s0; m < (s0 +s1); m++) { diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 7cff63b4bb..47ab3c7a91 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -68,7 +68,7 @@ #define NS_PER_SLOT 500000 -char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; +static const char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; extern double cpuf; diff --git a/openair1/SCHED_UE/pusch_pc.c b/openair1/SCHED_UE/pusch_pc.c index 55c8c7c547..831007c138 100644 --- a/openair1/SCHED_UE/pusch_pc.c +++ b/openair1/SCHED_UE/pusch_pc.c @@ -35,6 +35,7 @@ #include "PHY/defs_UE.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "nfapi/oai_integration/vendor_ext.h" @@ -62,8 +63,6 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_p -uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100}; - void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) { uint8_t harq_pid = subframe2harq_pid(&ue->frame_parms, proc->frame_tx, diff --git a/openair1/SCHED_UE/srs_pc.c b/openair1/SCHED_UE/srs_pc.c index 8026eb8307..ad3cde7609 100644 --- a/openair1/SCHED_UE/srs_pc.c +++ b/openair1/SCHED_UE/srs_pc.c @@ -33,6 +33,7 @@ #include "PHY/defs_UE.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #include "PHY/phy_extern_ue.h" +#include "PHY/phy_extern.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "openair1/SCHED/sched_common_extern.h" diff --git a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c deleted file mode 100644 index a64e02abf7..0000000000 --- a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c +++ /dev/null @@ -1,580 +0,0 @@ -/* - * 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 bypass_session_layer.h - * \brief implementation of emultor tx and rx - * \author Navid Nikaein and Raymond Knopp - * \date 2011 - 2014 - * \version 1.0 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr - */ - -#include "PHY/defs.h" -#include "defs.h" -#include "proto.h" -#include "extern.h" - -#include "assertions.h" -#include "UTIL/OCG/OCG.h" -#include "UTIL/OCG/OCG_extern.h" -#include "UTIL/LOG/log.h" - -#include "multicast_link.h" -#include "openair1/SIMULATION/ETH_TRANSPORT/extern.h" -char rx_bufferP[BYPASS_RX_BUFFER_SIZE]; -unsigned int num_bytesP = 0; -int N_P = 0, N_R = 0; -char bypass_tx_buffer[BYPASS_TX_BUFFER_SIZE]; -static unsigned int byte_tx_count; -unsigned int Master_list_rx; -static uint64_t seq_num_tx = 0; - -mapping transport_names[] = { - {"WAIT PM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_PM}, - {"WAIT SM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_SM}, - {"SYNC TRANSPORT INFO", EMU_TRANSPORT_INFO_SYNC}, - {"ENB_TRANSPORT INFO", EMU_TRANSPORT_INFO_ENB}, - {"UE TRANSPORT INFO", EMU_TRANSPORT_INFO_UE}, - {"RELEASE TRANSPORT INFO", EMU_TRANSPORT_INFO_RELEASE}, - {NULL, -1} -}; -static pthread_mutex_t emul_low_mutex; -static pthread_mutex_t emul_low_mutex; -static pthread_cond_t emul_low_cond; -static char emul_low_mutex_var; - -void init_bypass (void) -{ - LOG_I(EMU, "[PHYSIM] INIT BYPASS\n"); - -#if !defined(ENABLE_NEW_MULTICAST) - pthread_mutex_init (&Tx_mutex, NULL); - pthread_cond_init (&Tx_cond, NULL); - Tx_mutex_var = 1; - pthread_mutex_init (&emul_low_mutex, NULL); - pthread_cond_init (&emul_low_cond, NULL); - emul_low_mutex_var = 1; -#endif - bypass_init (emul_tx_handler, emul_rx_handler); -} - -/***************************************************************************/ -void bypass_init (tx_handler_t tx_handlerP, rx_handler_t rx_handlerP) -{ - /***************************************************************************/ - multicast_link_start (bypass_rx_handler, oai_emulation.info.multicast_group, - oai_emulation.info.multicast_ifname); - tx_handler = tx_handlerP; - rx_handler = rx_handlerP; - Master_list_rx=0; - emu_tx_status = WAIT_SYNC_TRANSPORT; - emu_rx_status = WAIT_SYNC_TRANSPORT; -} - -int emu_transport_handle_sync(bypass_msg_header_t *messg) -{ - int m_id; - - DevAssert(messg != NULL); - - // determite the total number of remote enb & ue - oai_emulation.info.nb_enb_remote += messg->nb_enb; - oai_emulation.info.nb_ue_remote += messg->nb_ue; - - // determine the index of local enb and ue wrt the remote ones - if (messg->master_id < oai_emulation.info.master_id) { - oai_emulation.info.first_enb_local +=messg->nb_enb; - oai_emulation.info.first_ue_local +=messg->nb_ue; - } - - // store param for enb per master - if ((oai_emulation.info.master[messg->master_id].nb_enb = messg->nb_enb) > 0) { - for (m_id=0; m_id < messg->master_id; m_id++ ) { - oai_emulation.info.master[messg->master_id].first_enb+=oai_emulation.info.master[m_id].nb_enb; - } - - LOG_I(EMU, - "[ENB] WAIT_SYNC_TRANSPORT state: for master %d (first enb %d, totan enb %d)\n", - messg->master_id, - oai_emulation.info.master[messg->master_id].first_enb, - oai_emulation.info.master[messg->master_id].nb_enb); - } - - // store param for ue per master - if ((oai_emulation.info.master[messg->master_id].nb_ue = messg->nb_ue) > 0) { - for (m_id=0; m_id < messg->master_id; m_id++ ) { - oai_emulation.info.master[messg->master_id].first_ue+=oai_emulation.info.master[m_id].nb_ue; - } - - LOG_I(EMU, - "[UE] WAIT_SYNC_TRANSPORT state: for master %d (first ue %d, total ue%d)\n", - messg->master_id, - oai_emulation.info.master[messg->master_id].first_ue, - oai_emulation.info.master[messg->master_id].nb_ue ); - } - - Master_list_rx=((Master_list_rx) |(1<< messg->master_id)); - - if (Master_list_rx == oai_emulation.info.master_list) { - emu_rx_status = SYNCED_TRANSPORT; - } - - LOG_I(EMU, - "WAIT_SYNC_TRANSPORT state: m_id %d total enb remote %d total ue remote %d \n", - messg->master_id,oai_emulation.info.nb_enb_remote, - oai_emulation.info.nb_ue_remote ); - return 0; -} - -int emu_transport_handle_wait_sm(bypass_msg_header_t *messg) -{ - DevAssert(messg != NULL); - Master_list_rx = ((Master_list_rx) | (1 << messg->master_id)); - - return 0; -} - -int emu_transport_handle_wait_pm(bypass_msg_header_t *messg) -{ - DevAssert(messg != NULL); - - if (messg->master_id == 0) { - Master_list_rx = ((Master_list_rx) | (1 << messg->master_id)); - } - - return 0; -} - -static -int emu_transport_handle_enb_info(bypass_msg_header_t *messg, - unsigned int next_slot, - int bytes_read) -{ - eNB_transport_info_t *eNB_info; - int total_header = 0, total_tbs = 0; - int n_dci, n_enb, enb_info_ix = 0,CC_id; - - DevAssert(bytes_read >= 0); - DevAssert(messg != NULL); - -#ifdef DEBUG_EMU - LOG_D(EMU," RX ENB_TRANSPORT INFO from master %d \n",messg->master_id); -#endif - clear_eNB_transport_info(oai_emulation.info.nb_enb_local+ - oai_emulation.info.nb_enb_remote); - - if (oai_emulation.info.master[messg->master_id].nb_enb > 0 ) { - total_header += sizeof(eNB_transport_info_t)-MAX_TRANSPORT_BLOCKS_BUFFER_SIZE; - - eNB_info = (eNB_transport_info_t *) (&rx_bufferP[bytes_read]); - - for (n_enb = oai_emulation.info.master[messg->master_id].first_enb; - n_enb < oai_emulation.info.master[messg->master_id].first_enb+ - oai_emulation.info.master[messg->master_id].nb_enb; - n_enb ++) { - for (n_dci = 0; n_dci < (eNB_info[enb_info_ix].num_ue_spec_dci + eNB_info[enb_info_ix].num_common_dci); n_dci ++) { - total_tbs += eNB_info[enb_info_ix].tbs[n_dci]; - } - - enb_info_ix++; - - if ((total_tbs + total_header) > MAX_TRANSPORT_BLOCKS_BUFFER_SIZE ) { - LOG_W(EMU,"RX eNB Transport buffer total size %d (header%d,tbs %d) \n", - total_header+total_tbs, total_header,total_tbs); - } - - memcpy(&eNB_transport_info[n_enb], eNB_info, total_header + total_tbs); - - /* Go to the next eNB info */ - eNB_info = (eNB_transport_info_t *)((uintptr_t)eNB_info + total_header+ - total_tbs); - bytes_read += (total_header + total_tbs); - } - - for (n_enb = oai_emulation.info.master[messg->master_id].first_enb; - n_enb < oai_emulation.info.master[messg->master_id].first_enb + - oai_emulation.info.master[messg->master_id].nb_enb; n_enb ++) - for (CC_id=0; CC_idmaster_id); - } - - Master_list_rx=((Master_list_rx) |(1<< messg->master_id)); - - if (Master_list_rx == oai_emulation.info.master_list) { - emu_rx_status = SYNCED_TRANSPORT; - } - - return 0; -} - -static -int emu_transport_handle_ue_info(bypass_msg_header_t *messg, - unsigned int last_slot, - int bytes_read) -{ - UE_transport_info_t *UE_info; - int n_ue, n_enb,CC_id=0; - int total_tbs = 0, total_header = 0, ue_info_ix =0; - - DevAssert(bytes_read >= 0); - DevAssert(messg != NULL); - -#ifdef DEBUG_EMU - LOG_D(EMU," RX UE TRANSPORT INFO from master %d\n",messg->master_id); -#endif - clear_UE_transport_info(oai_emulation.info.nb_ue_local+ - oai_emulation.info.nb_ue_remote); - - if (oai_emulation.info.master[messg->master_id].nb_ue > 0 ) { - total_header += sizeof(UE_transport_info_t)-MAX_TRANSPORT_BLOCKS_BUFFER_SIZE; - - UE_info = (UE_transport_info_t *) (&rx_bufferP[bytes_read]); - - // get the total size of the transport blocks - for (n_ue = oai_emulation.info.master[messg->master_id].first_ue; - n_ue < oai_emulation.info.master[messg->master_id].first_ue + - oai_emulation.info.master[messg->master_id].nb_ue; n_ue ++) { - total_tbs = 0; - - for (n_enb = 0; n_enb < UE_info[ue_info_ix].num_eNB; n_enb ++) { - total_tbs += UE_info[ue_info_ix].tbs[n_enb]; - } - - ue_info_ix++; - - if (total_tbs + total_header > MAX_TRANSPORT_BLOCKS_BUFFER_SIZE ) { - LOG_W(EMU,"RX [UE %d] Total size of buffer is %d (header%d,tbs %d) \n", - n_ue, total_header+total_tbs,total_header,total_tbs); - } - -//#warning "CC id should be adjusted, set to zero for the moment" - memcpy(&UE_transport_info[n_ue][CC_id], UE_info, total_header + total_tbs); - - /* Go to the next UE info */ - UE_info = (UE_transport_info_t *)((uintptr_t)UE_info + total_header+ - total_tbs); - bytes_read += (total_header + total_tbs); - } - - for (n_ue = oai_emulation.info.master[messg->master_id].first_ue; - n_ue < oai_emulation.info.master[messg->master_id].first_ue + - oai_emulation.info.master[messg->master_id].nb_ue; - n_ue ++) - for (CC_id=0; CC_idmaster_id); - } - - Master_list_rx=((Master_list_rx) |(1<< messg->master_id)); - - if (Master_list_rx == oai_emulation.info.master_list) { - emu_rx_status = SYNCED_TRANSPORT; - } - - return 0; -} - -int bypass_rx_data(unsigned int frame, unsigned int last_slot, - unsigned int next_slot, uint8_t is_master) -{ - bypass_msg_header_t *messg; - bypass_proto2multicast_header_t *bypass_read_header; - int bytes_read = 0; - - LOG_D(EMU, "Entering bypass_rx for frame %d next_slot %d is_master %u\n", - frame, next_slot, is_master); - -#if defined(ENABLE_NEW_MULTICAST) - - if (multicast_link_read_data_from_sock(is_master) == 1) { - /* We got a timeout */ - return -1; - } - -#else - pthread_mutex_lock(&emul_low_mutex); - - if(emul_low_mutex_var) { - pthread_cond_wait(&emul_low_cond, &emul_low_mutex); - } - - if(num_bytesP==0) { - pthread_mutex_unlock(&emul_low_mutex); - } else { -#endif - bypass_read_header = (bypass_proto2multicast_header_t *) ( - &rx_bufferP[bytes_read]); - bytes_read += sizeof (bypass_proto2multicast_header_t); - - if (num_bytesP != bytes_read + bypass_read_header->size) { - LOG_W(EMU, "WARNINIG BYTES2READ # DELIVERED BYTES!!! (%d != %d)\n", - num_bytesP, bytes_read + bypass_read_header->size); - exit(EXIT_FAILURE); - } else { - messg = (bypass_msg_header_t *) (&rx_bufferP[bytes_read]); - bytes_read += sizeof (bypass_msg_header_t); -#if defined(ENABLE_NEW_MULTICAST) - LOG_D(EMU, "Received %d bytes [%s] from master_id %d with seq %"PRIuMAX"\n", - num_bytesP, map_int_to_str(transport_names, messg->Message_type), - messg->master_id, - messg->seq_num); - DevCheck4((messg->frame == frame) && (messg->subframe == (next_slot>>1)), - messg->frame, frame, messg->subframe, next_slot>>1); - -#else - - if ((messg->frame != frame) || (messg->subframe != next_slot>>1)) - LOG_W(EMU, - "Received %s from master %d for (frame %d,subframe %d) " - "currently (frame %d,subframe %d)\n", - map_int_to_str(transport_names,messg->Message_type), - messg->master_id, - messg->frame, messg->subframe, - frame, next_slot>>1); - -#endif - - //chek if MASTER in my List - switch(messg->Message_type) { - case EMU_TRANSPORT_INFO_WAIT_PM: - emu_transport_handle_wait_pm(messg); - break; - - case EMU_TRANSPORT_INFO_WAIT_SM: - emu_transport_handle_wait_sm(messg); - break; - - case EMU_TRANSPORT_INFO_SYNC: - emu_transport_handle_sync(messg); - break; - - case EMU_TRANSPORT_INFO_ENB: - emu_transport_handle_enb_info(messg, next_slot, bytes_read); - break; - - case EMU_TRANSPORT_INFO_UE: - emu_transport_handle_ue_info(messg, last_slot, bytes_read); - break; - - case EMU_TRANSPORT_INFO_RELEASE : - Master_list_rx = oai_emulation.info.master_list; - LOG_E(EMU, "RX EMU_TRANSPORT_INFO_RELEASE\n"); - break; - - default: - LOG_E(EMU, "[MAC][BYPASS] ERROR RX UNKNOWN MESSAGE\n"); - //mac_xface->macphy_exit(""); - break; - } - } - - num_bytesP=0; - -#if !defined(ENABLE_NEW_MULTICAST) - emul_low_mutex_var=1; - - pthread_cond_signal(&emul_low_cond); - pthread_mutex_unlock(&emul_low_mutex); -#endif - bypass_signal_mac_phy(frame, last_slot, next_slot, is_master); -#if !defined(ENABLE_NEW_MULTICAST) -} - -#endif - -return bytes_read; -} - -/******************************************************************************************************/ -void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer) -{ - /******************************************************************************************************/ - if(Num_bytes >0) { -#if !defined(ENABLE_NEW_MULTICAST) - pthread_mutex_lock(&emul_low_mutex); - - while(!emul_low_mutex_var) { - pthread_cond_wait(&emul_low_cond, &emul_low_mutex); - } - -#endif - num_bytesP=Num_bytes; - memcpy(rx_bufferP, Rx_buffer, Num_bytes); -#if !defined(ENABLE_NEW_MULTICAST) - emul_low_mutex_var=0; - - /* on ne peut que signaler depuis un context linux - * (rtf_handler); pas de wait, jamais!!!!!! - */ - pthread_cond_signal(&emul_low_cond); - pthread_mutex_unlock(&emul_low_mutex); -#endif - } -} - -/******************************************************************************************************/ -void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot, - unsigned int next_slot, uint8_t is_master) -{ - /******************************************************************************************************/ - if (Master_list_rx != oai_emulation.info.master_list) { - bypass_rx_data(frame, last_slot, next_slot, is_master); - } else { - Master_list_rx = 0; - } -} - -/***************************************************************************/ -void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int next_slot) -{ - /***************************************************************************/ - unsigned int num_flows; - bypass_msg_header_t *messg; - - LOG_D(EMU, "Entering bypass_tx [%s] for frame %d next_slot %d\n", - map_int_to_str(transport_names, Type), frame, next_slot); - - int n_enb,n_ue, CC_id,n_dci,total_tbs=0,total_size=0; - messg = (bypass_msg_header_t *) ( - &bypass_tx_buffer[sizeof (bypass_proto2multicast_header_t)]); - num_flows = 0; - messg->master_id = oai_emulation.info.master_id; //Master_id; - - messg->nb_enb = oai_emulation.info.nb_enb_local; //Master_id; - messg->nb_ue = oai_emulation.info.nb_ue_local; //Master_id; - messg->nb_flow = num_flows; - messg->frame = frame; - messg->subframe = next_slot>>1; - messg->seq_num = seq_num_tx; - messg->failing_master_id = 0; - - seq_num_tx++; - - byte_tx_count = sizeof (bypass_msg_header_t) + sizeof ( - bypass_proto2multicast_header_t); - - if (Type == WAIT_PM_TRANSPORT) { - messg->Message_type = EMU_TRANSPORT_INFO_WAIT_PM; - LOG_T(EMU,"[TX_DATA] WAIT SYNC PM TRANSPORT\n"); - } else if (Type == WAIT_SM_TRANSPORT) { - messg->Message_type = EMU_TRANSPORT_INFO_WAIT_SM; - LOG_T(EMU,"[TX_DATA] WAIT SYNC SM TRANSPORT\n"); - } else if (Type == SYNC_TRANSPORT) { - messg->Message_type = EMU_TRANSPORT_INFO_SYNC; - /* make sure that sync messages from the masters are received in - * increasing order of master id - */ - sleep(oai_emulation.info.master_id+1); - LOG_T(EMU,"[TX_DATA] SYNC TRANSPORT\n"); - } else if(Type==ENB_TRANSPORT) { - - messg->Message_type = EMU_TRANSPORT_INFO_ENB; - total_size=0; - total_tbs=0; - - for (n_enb=oai_emulation.info.first_enb_local; - n_enb<(oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local); - n_enb++) - for (CC_id=0; CC_id>1, CC_id, - eNB_transport_info[n_enb][CC_id].num_pmch + - eNB_transport_info[n_enb][CC_id].num_ue_spec_dci + - eNB_transport_info[n_enb][CC_id].num_common_dci ); - - for (n_dci = 0; n_dci < (eNB_transport_info[n_enb][CC_id].num_pmch + - eNB_transport_info[n_enb][CC_id].num_ue_spec_dci + - eNB_transport_info[n_enb][CC_id].num_common_dci); - n_dci++) { - total_tbs +=eNB_transport_info[n_enb][CC_id].tbs[n_dci]; - } - - if (total_tbs <= MAX_TRANSPORT_BLOCKS_BUFFER_SIZE) { - total_size = sizeof(eNB_transport_info_t) + total_tbs - - MAX_TRANSPORT_BLOCKS_BUFFER_SIZE; - } else { - LOG_E(EMU, - "[eNB]running out of memory for the eNB emulation transport buffer of size %d\n", - MAX_TRANSPORT_BLOCKS_BUFFER_SIZE); - } - - memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&eNB_transport_info[n_enb][CC_id], - total_size); - byte_tx_count += total_size; - } - } else if (Type == UE_TRANSPORT) { - LOG_D(EMU,"[TX_DATA] UE TRANSPORT\n"); - messg->Message_type = EMU_TRANSPORT_INFO_UE; - total_size=0; - total_tbs=0; // compute the actual size of transport_blocks - - for (n_ue = oai_emulation.info.first_ue_local; - n_ue < (oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local); - n_ue++) { - for (CC_id=0; CC_idMessage_type = EMU_TRANSPORT_INFO_RELEASE; - } else { - LOG_E(EMU,"[TX_DATA] UNKNOWN MSG \n"); - } - - ((bypass_proto2multicast_header_t *) bypass_tx_buffer)->size = byte_tx_count - - sizeof (bypass_proto2multicast_header_t); - - multicast_link_write_sock(oai_emulation.info.multicast_group, - bypass_tx_buffer, byte_tx_count); - - LOG_D(EMU, "Frame %d, subframe %d (%d): Sent %d bytes [%s] with master_id %d and seq %"PRIuMAX"\n", - frame, next_slot>>1, next_slot,byte_tx_count, map_int_to_str(transport_names, Type), - messg->master_id, messg->seq_num); -} - diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 05e4273577..dc83ce57bf 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -54,6 +54,7 @@ #include "executables/lte-softmodem.h" #include "common/ran_context.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h" const char *__asan_default_options() { @@ -69,10 +70,8 @@ channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX]; node_desc_t *enb_data[NUMBER_OF_eNB_MAX]; node_desc_t *ue_data[NUMBER_OF_UE_MAX]; -//double sinr_bler_map[MCS_COUNT][2][16]; extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16]; -//extern char* namepointer_chMag ; THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; @@ -1005,14 +1004,11 @@ int main(int argc, char **argv) { if (abstx) { if (trials==0 && round==0 && SNR==snr0) { //generate a new channel hold_channel = 0; - flagMag=0; } else { hold_channel = 1; - flagMag = 1; } } else { hold_channel = 0; - flagMag=1; } /////////////////////////////////////// diff --git a/openair1/SIMULATION/LTE_PHY/unitary_defs.h b/openair1/SIMULATION/LTE_PHY/unitary_defs.h index d77682c89e..f0c3f32b1b 100644 --- a/openair1/SIMULATION/LTE_PHY/unitary_defs.h +++ b/openair1/SIMULATION/LTE_PHY/unitary_defs.h @@ -22,7 +22,7 @@ openair0_device openair0; int oai_exit=0; -void exit_function(const char* file, const char* function, const int line,const char *s) { +void exit_function(const char* file, const char* function, const int line,const char* s, const int assert) { const char * msg= s==NULL ? "no comment": s; printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); exit(-1); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index f5de60a297..42a5fc2dcc 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -35,7 +35,7 @@ #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" #include "PHY/types.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" @@ -46,10 +46,9 @@ #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_COMMON/nr_mac_common.h" #include "executables/nr-uesoftmodem.h" - +#include "nfapi/oai_integration/vendor_ext.h" //#define DEBUG_NR_DLSCHSIM @@ -73,8 +72,14 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; +uint64_t get_softmodem_optmask(void) {return 0;} +static softmodem_params_t softmodem_params; +softmodem_params_t *get_softmodem_params(void) { + return &softmodem_params; +} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} - +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } +nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } nrUE_params_t nrUE_params={0}; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index ed171523de..e939a27d1b 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -38,7 +38,7 @@ #include "PHY/defs_nr_UE.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/types.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_UE.h" @@ -89,7 +89,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; double cpuf; char *uecap_file; -uint16_t sf_ahead=4 ; uint16_t sl_ahead=0; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; @@ -104,21 +103,7 @@ int nr_derive_key_ng_ran_star(uint16_t pci, uint64_t nr_arfcn_dl, const uint8_t return 0; } -// dummy functions -int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } - -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const frame_t frame, - const sub_frame_t sub_frame, - const rnti_t rnti, - const channel_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) -{ - return 0; -} +int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { @@ -135,70 +120,16 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, return 0; } -void -rrc_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const sdu_size_t sdu_sizeP, - const uint8_t *const buffer_pP -) -{ -} - int nr_derive_key(int alg_type, uint8_t alg_id, const uint8_t key[32], uint8_t **out) { return 0; } -void config_common(int Mod_idP, - int pdsch_AntennaPorts, - int pusch_AntennaPorts, - NR_ServingCellConfigCommon_t *scc); - -int generate_dlsch_header(unsigned char *mac_header, - unsigned char num_sdus, - unsigned short *sdu_lengths, - unsigned char *sdu_lcids, - unsigned char drx_cmd, - unsigned short timing_advance_cmd, - unsigned char *ue_cont_res_id, - unsigned char short_padding, - unsigned short post_padding){return 0;} - -// Dummy function to avoid linking error at compilation of nr-dlsim -int is_x2ap_enabled(void) -{ - return 0; -} - -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - const uint8_t *sduP, - sdu_size_t sdu_lenP, - const uint8_t *sdu2P, - sdu_size_t sdu2_lenP) { - return 0; -} - void processSlotTX(void *arg) {} nr_bler_struct nr_bler_data[NR_NUM_MCS]; -//nFAPI P7 dummy functions to avoid linking errors - -int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); } -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } - // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg); diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index dd5082d756..5a1c2be6e8 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -1,89 +1,45 @@ #include "nfapi/oai_integration/vendor_ext.h" +#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h" +#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" +#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" +#include "openair1/PHY/defs_nr_UE.h" -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_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) -{ - return (0); -} -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req) -{ - return (0); -} -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) -{ - return (0); -} -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) -{ - return (0); -} -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) -{ - return (0); -} -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) -{ - return (0); -} -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) -{ - return (0); -} -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) -{ - return (0); -} -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) -{ - return (0); -} +int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return (0); } +int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req) { return (0); } +int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) { return (0); } +int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) { return (0); } +int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return (0); } +int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return (0); } +int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return (0); } +int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return (0); } +int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return 0; } -int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen) -{ - return 0; -} -int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen) -{ - return 0; -} +int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen) { return 0; } +int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen) { return 0; } +int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen) { return 0; } +int unpack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen) { 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); -} -nfapi_mode_t nfapi_mod; -nfapi_mode_t nfapi_getmode(void) -{ - return nfapi_mod; -} -void nfapi_setmode(nfapi_mode_t nfapi_mode) -{ -} +int32_t get_uldl_offset(int nr_bandP) { return (0); } -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); } -void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, - fapi_nr_dci_indication_t *dci_ind, - fapi_nr_rx_indication_t *rx_ind, - UE_nr_rxtx_proc_t *proc, - PHY_VARS_NR_UE *ue, - void *phy_data) {} -void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, - uint8_t pdu_type, - PHY_VARS_NR_UE *ue, - NR_UE_DLSCH_t *dlsch0, - NR_UE_DLSCH_t *dlsch1, - uint16_t n_pdus, - UE_nr_rxtx_proc_t *proc, - void *typeSpecific ) {} +void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {} +void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {} +int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) { return 0; } +int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) { return 0; } +int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t *config) { return 0; } + +void rrc_data_ind(const protocol_ctxt_t *const ctxt_pP, + const rb_id_t Srb_id, + const sdu_size_t sdu_sizeP, + const uint8_t *const buffer_pP) { } + +typedef uint32_t channel_t; +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) { return 0; } diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c deleted file mode 100644 index 71e2577ec3..0000000000 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c +++ /dev/null @@ -1,20 +0,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_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); } -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { 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 index c556f66361..e5ed3aaf00 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h @@ -33,9 +33,12 @@ #ifndef __NR_UNITARY_DEFS__H__ #define __NR_UNITARY_DEFS__H__ +#include "NR_ServingCellConfigCommon.h" +#include "NR_ServingCellConfig.h" + int oai_exit=0; -void exit_function(const char* file, const char* function, const int line, const char *s) { +void exit_function(const char* file, const char* function, const int line, const char *s, const int assert) { const char * msg= s==NULL ? "no comment": s; printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); exit(-1); @@ -64,9 +67,5 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap); void prepare_scc(NR_ServingCellConfigCommon_t *scc); void prepare_scd(NR_ServingCellConfig_t *scd); uint32_t ngap_generate_gNB_id(void) {return 0;} -void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;} -void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;} -void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;} -void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { return;} #endif diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 42fa279018..f127c74818 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -38,7 +38,7 @@ #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/nr_modulation.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" @@ -47,10 +47,10 @@ #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 "openair1/PHY/MODULATION/nr_modulation.h" #include #include +#include "nfapi/oai_integration/vendor_ext.h" //#define DEBUG_NR_PBCHSIM PHY_VARS_gNB *gNB; @@ -80,6 +80,23 @@ nrUE_params_t *get_nrUE_params(void) { } void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } +nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } + +void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, + fapi_nr_dci_indication_t *dci_ind, + fapi_nr_rx_indication_t *rx_ind, + UE_nr_rxtx_proc_t *proc, + PHY_VARS_NR_UE *ue, + void *phy_data) {} +void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, + uint8_t pdu_type, + PHY_VARS_NR_UE *ue, + NR_UE_DLSCH_t *dlsch0, + NR_UE_DLSCH_t *dlsch1, + uint16_t n_pdus, + UE_nr_rxtx_proc_t *proc, + void *typeSpecific ) {} int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index cb7094fe77..59e8a988a2 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -41,7 +41,7 @@ #include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" @@ -51,9 +51,9 @@ #include #include #include -//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include #include "executables/nr-uesoftmodem.h" +#include "nfapi/oai_integration/vendor_ext.h" #define NR_PRACH_DEBUG 1 #define PRACH_WRITE_OUTPUT_DEBUG 1 @@ -76,20 +76,13 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint16_t sl_ahead = 0; uint32_t N_RB_DL = 106; -//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } +nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } +void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) { } /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} -int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); } -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } //Fixme: Uniq dirty DU instance, by global var, datamodel need better management instance_t DUuniqInstance=0; instance_t CUuniqInstance=0; @@ -99,29 +92,6 @@ int nr_derive_key_ng_ran_star(uint16_t pci, uint64_t nr_arfcn_dl, const uint8_t return 0; } -void -rrc_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const sdu_size_t sdu_sizeP, - const uint8_t *const buffer_pP -) -{ -} - -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const frame_t frame, - const sub_frame_t sub_frame, - const rnti_t rnti, - const channel_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) -{ - return 0; -} - void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { return; @@ -137,29 +107,12 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, return 0; } -// Dummy function to avoid linking error at compilation of nr-prachsim -int is_x2ap_enabled(void) -{ - return 0; -} - int nr_derive_key(int alg_type, uint8_t alg_id, const uint8_t key[32], uint8_t **out) { return 0; } -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - const uint8_t *sduP, - sdu_size_t sdu_lenP, - const uint8_t *sdu2P, - sdu_size_t sdu2_lenP) { - return 0; -} - nrUE_params_t nrUE_params; nrUE_params_t *get_nrUE_params(void) { diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 498b31ec8f..57575f18ef 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -38,7 +38,7 @@ #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/NR_ESTIMATION/nr_ul_estimation.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/pucch_nr.h" @@ -46,8 +46,8 @@ #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 "executables/nr-uesoftmodem.h" +#include "nfapi/oai_integration/vendor_ext.h" THREAD_STRUCT thread_struct; PHY_VARS_gNB *gNB; @@ -66,7 +66,12 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; // needed for some functions PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}}; +uint64_t get_softmodem_optmask(void) {return 0;} +softmodem_params_t *get_softmodem_params(void) {return 0;} + void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } +nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } nrUE_params_t nrUE_params={0}; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 0227788877..325611d68d 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -33,7 +33,7 @@ #include "PHY/defs_nr_common.h" #include "PHY/defs_nr_UE.h" #include "PHY/defs_gNB.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" @@ -45,10 +45,10 @@ #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 "common/utils/threadPool/thread-pool.h" #include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "executables/nr-uesoftmodem.h" +#include "nfapi/oai_integration/vendor_ext.h" //#define DEBUG_NR_ULSCHSIM @@ -59,7 +59,14 @@ RAN_CONTEXT_t RC; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +uint64_t get_softmodem_optmask(void) {return 0;} +static softmodem_params_t softmodem_params; +softmodem_params_t *get_softmodem_params(void) { + return &softmodem_params; +} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } +nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 8685626284..85aef02336 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -35,7 +35,7 @@ #include "PHY/defs_nr_UE.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/types.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/nr_modulation.h" #include "PHY/NR_REFSIG/dmrs_nr.h" @@ -54,7 +54,6 @@ #include "openair1/SIMULATION/RF/rf.h" #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair2/RRC/NR/MESSAGES/asn1_msg.h" -//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/threadPool/thread-pool.h" @@ -102,46 +101,6 @@ int nr_derive_key_ng_ran_star(uint16_t pci, uint64_t nr_arfcn_dl, const uint8_t extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const frame_t frame, - const sub_frame_t sub_frame, - const rnti_t rnti, - const channel_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) -{ - return 0; -} - -int generate_dlsch_header(unsigned char *mac_header, - unsigned char num_sdus, - unsigned short *sdu_lengths, - unsigned char *sdu_lcids, - unsigned char drx_cmd, - unsigned short timing_advance_cmd, - unsigned char *ue_cont_res_id, - unsigned char short_padding, - unsigned short post_padding){return 0;} - -void -rrc_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const sdu_size_t sdu_sizeP, - const uint8_t *const buffer_pP -) -{ -} - - -// Dummy function to avoid linking error at compilation of nr-ulsim -int is_x2ap_enabled(void) -{ - return 0; -} - void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { return; @@ -170,18 +129,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, nr_bler_struct nr_bler_data[NR_NUM_MCS]; -//nFAPI P7 dummy functions - -int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); } -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } - int nr_derive_key(int alg_type, uint8_t alg_id, const uint8_t key[32], uint8_t **out) { @@ -1040,6 +987,12 @@ int main(int argc, char **argv) double berStats[16] = {0}; clear_pusch_stats(gNB); + + uint64_t sum_pusch_delay = 0; + int min_pusch_delay = INT_MAX; + int max_pusch_delay = INT_MIN; + int delay_pusch_est_count = 0; + for (trial = 0; trial < n_trials; trial++) { uint8_t round = 0; @@ -1552,6 +1505,12 @@ int main(int argc, char **argv) roundStats += ((float)round); if (!crc_status) effRate += ((double)TBS) / (double)round; + + sum_pusch_delay += gNB->measurements.delay[UE_id].pusch_est_delay; + min_pusch_delay = gNB->measurements.delay[UE_id].pusch_est_delay < min_pusch_delay ? gNB->measurements.delay[UE_id].pusch_est_delay : min_pusch_delay; + max_pusch_delay = gNB->measurements.delay[UE_id].pusch_est_delay > max_pusch_delay ? gNB->measurements.delay[UE_id].pusch_est_delay : max_pusch_delay; + delay_pusch_est_count++; + } // trial loop roundStats/=((float)n_trials); @@ -1581,6 +1540,12 @@ int main(int argc, char **argv) printf(",%e", berStats[r]); printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats,effRate,effTP,TBS); + printf("DMRS-PUSCH delay estimation: min %i, max %i, average %f\n", + min_pusch_delay >> 1, max_pusch_delay >> 1, (double)sum_pusch_delay / (2 * delay_pusch_est_count)); + + printf("*****************************************\n"); + printf("\n"); + FILE *fd=fopen("nr_ulsim.log","w"); if (fd == NULL) { printf("Problem with filename %s\n", "nr_ulsim.log"); @@ -1589,9 +1554,6 @@ int main(int argc, char **argv) dump_pusch_stats(fd,gNB); fclose(fd); - printf("*****************************************\n"); - printf("\n"); - if (print_perf==1) { printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx"); printStatIndent(&gNB->rx_pusch_stats,"RX PUSCH time"); diff --git a/openair1/SIMULATION/TOOLS/channel_sim.c b/openair1/SIMULATION/TOOLS/channel_sim.c index 7a1a77d3e1..9cf08fa5a3 100644 --- a/openair1/SIMULATION/TOOLS/channel_sim.c +++ b/openair1/SIMULATION/TOOLS/channel_sim.c @@ -33,13 +33,11 @@ #include "PHY/phy_extern.h" #include "PHY/phy_extern_ue.h" -#include "LAYER2/MAC/mac.h" -#include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "RRC/LTE/rrc_extern.h" #include "PHY_INTERFACE/phy_interface_extern.h" #include "UTIL/OCG/OCG.h" #include "UTIL/OPT/opt.h" // to test OPT +#include "common/ran_context.h" #define RF diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 06876ecf4c..c3d5999b62 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -280,12 +280,12 @@ typedef struct protocol_ctxt_s { #define CHECK_CTXT_ARGS(CTXT_Pp) -#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg) +#define exit_fun(msg) exit_function(__FILE__, __FUNCTION__, __LINE__, "exit_fun", OAI_EXIT_NORMAL) #ifdef __cplusplus extern "C" { #endif -void exit_function(const char *file, const char *function, const int line, const char *s); +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert); #ifdef __cplusplus } #endif diff --git a/openair2/E1AP/CMakeLists.txt b/openair2/E1AP/CMakeLists.txt index e9d43d8702..01a969de7e 100644 --- a/openair2/E1AP/CMakeLists.txt +++ b/openair2/E1AP/CMakeLists.txt @@ -3,5 +3,5 @@ add_subdirectory(MESSAGES) add_library(e1ap e1ap.c e1ap_common.c e1ap_api.c) target_link_libraries(e1ap PUBLIC asn1_e1ap f1ap - PRIVATE asn1_nr_rrc asn1_lte_rrc asn1_f1ap UTIL e1_pdcp_if e1_if asn1_ngap) + PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap UTIL e1_pdcp_if e1_if) target_include_directories(e1ap PUBLIC ${CMAKE_CURRENT_DIR}) diff --git a/openair2/E1AP/e1ap.c b/openair2/E1AP/e1ap.c index 52043602e2..3b413beb18 100644 --- a/openair2/E1AP/e1ap.c +++ b/openair2/E1AP/e1ap.c @@ -32,6 +32,7 @@ #include "common/utils/LOG/log.h" #include "openair2/F1AP/f1ap_common.h" #include "e1ap_default_values.h" +#include "gtp_itf.h" #define E1AP_NUM_MSG_HANDLERS 14 typedef int (*e1ap_message_processing_t)(e1ap_upcp_inst_t *inst, const E1AP_E1AP_PDU_t *message_p); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index ed61ad794b..52ad64989b 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -37,6 +37,7 @@ #include "f1ap_cu_rrc_message_transfer.h" #include "common/ran_context.h" #include "openair3/UTILS/conversions.h" +#include "pdcp.h" /* Initial UL RRC Message Transfer diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index d8ad164971..ec592ac9af 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -43,6 +43,7 @@ #include "rrc_eNB_GTPV1U.h" #include "openair2/RRC/NR/rrc_gNB_NGAP.h" #include +#include "pdcp.h" static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) { asn1cCalloc(toFill, tmp); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index c1fa1d49b9..ef8743dd39 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -50,10 +50,11 @@ // #include "SystemInformationBlockType2.h" // #include "LAYER2/MAC/extern.h" // #include "LAYER2/MAC/proto.h" -#include "PHY/INIT/phy_init.h" +#include "PHY/INIT/nr_phy_init.h" #include "radio/ETHERNET/USERSPACE/LIB/ethernet_lib.h" #include "nfapi_vnf.h" #include "nfapi_pnf.h" +#include "pdcp.h" //#include "L1_paramdef.h" #include "prs_nr_paramdef.h" diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index c958d7cf85..c1f9a51335 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -162,6 +162,8 @@ #define U_PLANE_INACTIVITY_VALUE 0 /* defined 10ms order (zero means infinity) */ +static const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; + /* * eNB part */ diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index db4d51a92f..e9ed99160e 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -806,6 +806,7 @@ void rr_ul_unset(void **data) { free(*data); *data = NULL; } +#define MAX(a, b) (((a)>(b))?(a):(b)) int rr_ul_run(module_id_t Mod_id, int CC_id, int frame, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 5b5587a7e7..89346dfeda 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -37,6 +37,7 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "common/utils/nr/nr_common.h" #include "executables/softmodem-common.h" +#include "SCHED_NR/phy_frame_config_nr.h" void set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 66397b20a3..fe458ba644 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -61,6 +61,7 @@ #include "NR_CellGroupConfig.h" #include "NR_ServingCellConfig.h" #include "NR_MeasConfig.h" +#include "NR_ServingCellConfigCommonSIB.h" // ========== diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index e9eb77b9c1..662548231b 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -38,6 +38,7 @@ #include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "executables/softmodem-common.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp.h" +#include "openair2/LAYER2/PDCP_v10.1.0/pdcp.h" #include static NR_UE_MAC_INST_t *nr_ue_mac_inst; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index f871796230..a0d683a8d9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -482,8 +482,14 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t long deltaPreamble_Msg3 = 0; uint8_t noGroupB = 0; // Random seed generation - long long tmp = rdtsc_oai(); - unsigned short int *seed = (unsigned short int*)&tmp; + unsigned int seed; + + if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { + // Overwrite seed with non-random seed for IQ player/recorder + seed = 1; + } else { + seed=(unsigned int) (rdtsc_oai() && ~0); + } RA_config_t *ra = &mac->ra; NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; @@ -580,28 +586,28 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) { if (noGroupB) { // use Group A preamble - ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r((unsigned int *)seed) % ra->cb_preambles_per_ssb); + ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r(&seed) % ra->cb_preambles_per_ssb); ra->RA_usedGroupA = 1; } else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) { // Group B is configured and RA preamble Group A is used // - todo add condition on CCCH_sdu_size for initiation by CCCH - ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r((unsigned int *)seed) % sizeOfRA_PreamblesGroupA); + ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r(&seed) % sizeOfRA_PreamblesGroupA); ra->RA_usedGroupA = 1; } else { // Group B preamble is configured and used // the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A // the remaining belong to RA Preambles Group B - ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (rand_r((unsigned int *)seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (rand_r(&seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); ra->RA_usedGroupA = 0; } } } else { // Msg3 is being retransmitted if (ra->RA_usedGroupA && noGroupB) { - ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r((unsigned int *)seed) % ra->cb_preambles_per_ssb); + ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r(&seed) % ra->cb_preambles_per_ssb); } else if (ra->RA_usedGroupA && !noGroupB){ - ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r((unsigned int *)seed) % sizeOfRA_PreamblesGroupA); + ra->ra_PreambleIndex = ra->starting_preamble_nb + (rand_r(&seed) % sizeOfRA_PreamblesGroupA); } else { - ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (rand_r((unsigned int *)seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (rand_r(&seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); } } } @@ -1033,9 +1039,15 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; // Random seed generation - long long tmp = rdtsc_oai(); - unsigned short int *seed = (unsigned short int*)&tmp; + unsigned int seed; + if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { + // Overwrite seed with non-random seed for IQ player/recorder + seed = 1; + } else { + seed=(unsigned int) (rdtsc_oai() && ~0); + } + ra->first_Msg3 = 1; ra->ra_PreambleIndex = -1; ra->ra_state = RA_UE_IDLE; @@ -1047,7 +1059,7 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res LOG_D(MAC, "In %s: [UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...\n", __FUNCTION__, mod_id, frame, slot, ra->preambleTransMax); - ra->RA_backoff_cnt = rand_r((unsigned int *)seed) % (prach_resources->RA_PREAMBLE_BACKOFF + 1); + ra->RA_backoff_cnt = rand_r(&seed) % (prach_resources->RA_PREAMBLE_BACKOFF + 1); prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP += 2; // 2 dB increment prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 02ad48a655..f9bc506102 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3236,12 +3236,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]); bool ra_success = true; - for(int i = 0; icont_res_id[i] != pduP[i+1]) { - ra_success = false; - break; - } - } + if (!IS_SOFTMODEM_IQPLAYER) { // Control is bypassed when replaying IQs (BMC) + for(int i = 0; icont_res_id[i] != pduP[i+1]) { + ra_success = false; + break; + } + } + } if ( (ra->RA_active == 1) && ra_success) { nr_ra_succeeded(module_idP, frameP, slot); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index a6acf1fa77..ae068fb333 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -35,6 +35,9 @@ /* exe */ #include +/* PHY */ +#include "openair1/PHY/impl_defs_top.h" + /* MAC */ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_COMMON/nr_mac_common.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index ff74e34c4a..a07c38bbcb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -33,6 +33,8 @@ #include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "NR_TAG-Id.h" +#include "common/ngran_types.h" +#include "rrc_messages_types.h" void set_cset_offset(uint16_t); 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 25ee7feb14..ace8b17f49 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -20,6 +20,7 @@ */ #include "nr_mac_gNB.h" +#include "intertask_interface.h" #include "mac_rrc_ul.h" 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 65e7f10405..13547c5291 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -20,6 +20,7 @@ */ #include "nr_mac_gNB.h" +#include "intertask_interface.h" #include "mac_rrc_ul.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index e9d41986c5..c5b35982b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -33,6 +33,7 @@ #include "NR_MAC_gNB/mac_proto.h" #include "NR_MAC_COMMON/nr_mac_extern.h" #include "assertions.h" +#include "pdcp.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "RRC/NR/nr_rrc_defs.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index b4fa43c40f..aff1d2c060 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -51,6 +51,7 @@ /* RRC */ #include "NR_BCCH-BCH-Message.h" #include "NR_CellGroupConfig.h" +#include "NR_BCCH-DL-SCH-Message.h" /* PHY */ #include "time_meas.h" @@ -63,6 +64,7 @@ /* MAC */ #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include "LAYER2/MAC/mac.h" #include "NR_TAG.h" #include diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index f1fefc6973..c5eadf0a34 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -57,6 +57,7 @@ #include "intertask_interface.h" #include "openair3/S1AP/s1ap_eNB.h" #include +#include "pdcp.h" # include "openair3/ocp-gtpu/gtp_itf.h" #include diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h index 1fb08d6ba8..47e961da2b 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h @@ -33,6 +33,7 @@ #ifndef __NR_IF_MODULE__H__ #define __NR_IF_MODULE__H__ +#include #include #include "nfapi_nr_interface.h" #include "nfapi_nr_interface_scf.h" diff --git a/openair2/RRC/LTE/MESSAGES/CMakeLists.txt b/openair2/RRC/LTE/MESSAGES/CMakeLists.txt index 1b85c3ce66..b7e7f3ead6 100644 --- a/openair2/RRC/LTE/MESSAGES/CMakeLists.txt +++ b/openair2/RRC/LTE/MESSAGES/CMakeLists.txt @@ -14,8 +14,23 @@ add_custom_command(OUTPUT ${lte_rrc_source} ${lte_rrc_headers} COMMENT "Generating LTE RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}" ) +# Many other targets include LTE RRC ASN.1 headers, without actually needing +# the actual library (asn1_lte_rrc). Therefore, below we create the INTERFACE +# library asn1_lte_rrc_hdrs that only contains these headers. To actually wait +# that the headers are created in add_custom_command, we use an intermediary +# add_custom_target which create a target that waits for the headers, and make +# a dependency from asn1_lte_rrc_hdrs to gen_lte_rrc_hdrs, which is the +# recommended way, see https://gitlab.kitware.com/cmake/cmake/-/issues/17366. +# In newer cmake version (e.g., 3.20), it is also possible to have +# ${lte_rrc_headers} directly in the add_library(asn1_lte_rrc_hdrs) statement, +# without the need for asn1_lte_rrc_hdrs +add_custom_target(gen_lte_rrc_hdrs DEPENDS ${lte_rrc_headers}) +add_library(asn1_lte_rrc_hdrs INTERFACE) +add_dependencies(asn1_lte_rrc_hdrs gen_lte_rrc_hdrs) +target_include_directories(asn1_lte_rrc_hdrs INTERFACE "${CMAKE_CURRENT_BINARY_DIR}") + add_library(asn1_lte_rrc ${lte_rrc_source}) -target_include_directories(asn1_lte_rrc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") +target_link_libraries(asn1_lte_rrc PUBLIC asn1_lte_rrc_hdrs) target_compile_options(asn1_lte_rrc PRIVATE -DASN_DISABLE_OER_SUPPORT -w PUBLIC -DLTE_RRC_VERSION=${LTE_RRC_RELEASE}) diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index ca051194db..c67e2c243c 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -63,6 +63,10 @@ #include "LTE_TDD-Config.h" #include "LTE_UECapabilityEnquiry.h" #include "LTE_UE-CapabilityRequest.h" + +#include "NR_RAT-Type.h" +#include "NR_UE-CapabilityRAT-Container.h" + #include "RRC/NAS/nas_config.h" #include "RRC/NAS/rb_config.h" #if ENABLE_RAL diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4c82f0b8f3..5f123f649c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -65,6 +65,12 @@ #include "LTE_SystemInformationBlockType1-MBMS-r14.h" #include "LTE_NonMBSFN-SubframeConfig-r14.h" +#include "NR_UE-CapabilityRAT-ContainerList.h" +#include "NR_UE-CapabilityRAT-Container.h" +#include "NR_CG-ConfigInfo.h" +#include "NR_CG-Config.h" +#include "NR_RadioBearerConfig.c" + #include "common/utils/LOG/vcd_signal_dumper.h" #include "x2ap_eNB.h" diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 647be50252..7010c7c831 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -36,6 +36,7 @@ #include "oai_asn1.h" #include "intertask_interface.h" +#include "pdcp.h" # include "common/ran_context.h" diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h index f991cbd5f6..aff86729be 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h @@ -30,6 +30,7 @@ #ifndef RRC_ENB_GTPV1U_H_ #define RRC_ENB_GTPV1U_H_ +#include "rrc_defs.h" /*! \fn rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(const protocol_ctxt_t* const ctxt_pP, const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP) *\brief Process GTPV1U_ENB_CREATE_TUNNEL_RESP message received from GTPV1U, retrieve the enb teid created. diff --git a/openair2/RRC/LTE/rrc_eNB_M2AP.c b/openair2/RRC/LTE/rrc_eNB_M2AP.c index 3b4818d534..16c003d471 100644 --- a/openair2/RRC/LTE/rrc_eNB_M2AP.c +++ b/openair2/RRC/LTE/rrc_eNB_M2AP.c @@ -35,6 +35,7 @@ # include "oai_asn1.h" # include "intertask_interface.h" # include "common/ran_context.h" +#include "pdcp.h" extern RAN_CONTEXT_t RC; diff --git a/openair2/RRC/NR/MESSAGES/CMakeLists.txt b/openair2/RRC/NR/MESSAGES/CMakeLists.txt index c43b846c82..666f528c37 100644 --- a/openair2/RRC/NR/MESSAGES/CMakeLists.txt +++ b/openair2/RRC/NR/MESSAGES/CMakeLists.txt @@ -14,8 +14,23 @@ add_custom_command(OUTPUT ${nr_rrc_source} ${nr_rrc_headers} COMMENT "Generating NR RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}" ) +# Many other targets include NR RRC ASN.1 headers, without actually needing the +# actual library (asn1_nr_rrc). Therefore, below we create the INTERFACE +# library asn1_nr_rrc_hdrs that only contains these headers. To actually wait +# that the headers are created in add_custom_command, we use an intermediary +# add_custom_target which create a target that waits for the headers, and make +# a dependency from asn1_nr_rrc_hdrs to gen_nr_rrc_hdrs, which is the +# recommended way, see https://gitlab.kitware.com/cmake/cmake/-/issues/17366. +# In newer cmake version (e.g., 3.20), it is also possible to have +# ${nr_rrc_headers} directly in the add_library(asn1_nr_rrc_hdrs) statement, +# without the need for asn1_lte_rrc_hdrs +add_custom_target(gen_nr_rrc_hdrs DEPENDS ${nr_rrc_headers}) +add_library(asn1_nr_rrc_hdrs INTERFACE) +add_dependencies(asn1_nr_rrc_hdrs gen_nr_rrc_hdrs) +target_include_directories(asn1_nr_rrc_hdrs INTERFACE "${CMAKE_CURRENT_BINARY_DIR}") + add_library(asn1_nr_rrc ${nr_rrc_source}) -target_include_directories(asn1_nr_rrc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") +target_link_libraries(asn1_nr_rrc PUBLIC asn1_nr_rrc_hdrs) target_compile_options(asn1_nr_rrc PRIVATE -DASN_DISABLE_OER_SUPPORT -w PUBLIC -DNR_RRC_VERSION=${NR_RRC_RELEASE}) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 62d609f10e..9f846f9594 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -478,7 +478,7 @@ uint16_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, UL->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; UL->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; UL->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; - UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null; + UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = NULL; UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 2c999a663b..b909d46baf 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -43,6 +43,7 @@ #include #include "UTIL/OSA/osa_defs.h" #include +#include "pdcp.h" void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) { diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 9c6174fb53..fe50cb4177 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -194,10 +194,10 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id, size, 0, 0); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - printf("NR_CellGroupConfig decode error\n"); + LOG_E(NR_RRC, "NR_CellGroupConfig decode error\n"); for (i=0; ischedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) { - printf("SIB%li ", sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type + 2); + LOG_D(RRC, "SIB%li ", sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type + 2); } - printf("\n"); + LOG_D(RRC, "\n"); LOG_D(RRC, "SIBs needed by UE: "); for(int j = 0; j < 8*requested_SI_List.size; j++) { if( ((requested_SI_List.buf[j/8]>>(j%8))&1) == 1) { - printf("SIB%i ", j + 2); + LOG_D(RRC, "SIB%i ", j + 2); SIB_to_request[j] = true; for(int i = 0; i < sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) { @@ -1045,17 +1045,17 @@ static int8_t check_requested_SI_List(module_id_t module_id, BIT_STRING_t reques } } - printf("\n"); + LOG_D(RRC, "\n"); LOG_D(RRC, "SIBs to request by UE: "); bool do_ra = false; for(int j = 0; j < 8*requested_SI_List.size; j++) { if(SIB_to_request[j]) { - printf("SIB%i ", j + 2); + LOG_D(RRC, "SIB%i ", j + 2); do_ra = true; } } - printf("\n"); + LOG_D(RRC, "\n"); if(do_ra) { @@ -1458,8 +1458,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { for (i=0; irecplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state)); - if ( openair0_cfg->recplay_mode == RECPLAY_REPLAYMODE ) { + if (openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { + set_softmodem_optmask(SOFTMODEM_RECRECORD_BIT); // softmodem has to know we use the iqrecorder to workaround randomized algorithms + } + if (openair0_cfg->recplay_mode == RECPLAY_REPLAYMODE) { deflibname=OAI_IQPLAYER_LIBNAME; shlib_fdesc[0].fname="device_init"; set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT); // softmodem has to know we use the iqplayer to workaround randomized algorithms diff --git a/radio/COMMON/record_player.c b/radio/COMMON/record_player.c index 37f985b6b2..2041ab29e1 100644 --- a/radio/COMMON/record_player.c +++ b/radio/COMMON/record_player.c @@ -40,13 +40,11 @@ * recplay_state: store recorder or player data while the device runs */ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) { - unsigned int u_sf_record = 0; // record mode - unsigned int u_sf_replay = 0; // replay mode *recplay_conf = calloc(sizeof(recplay_conf_t),1); paramdef_t device_recplay_params[]=DEVICE_RECPLAY_PARAMS_DESC ; config_get(device_recplay_params,sizeof(device_recplay_params)/sizeof(paramdef_t),DEVICE_RECPLAY_SECTION); - if (u_sf_record || u_sf_replay ) { + if ((*recplay_conf)->u_sf_record || (*recplay_conf)->u_sf_replay ) { struct sysinfo systeminfo; *recplay_state = calloc(sizeof(recplay_state_t),1); @@ -62,17 +60,18 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ LOG_W(HW,"System with %f GB of mem (<6GB), mmap usage disabled\n",systeminfo.totalram/10E9); (*recplay_conf)->use_mmap = 0; } - } else { /* record player enabled */ + } else { /* player-recorder disable */ free(*recplay_conf); *recplay_conf=NULL; + return RECPLAY_DISABLED; } - if (u_sf_replay == 1) + if ((*recplay_conf)->u_sf_replay == 1) return RECPLAY_REPLAYMODE; - else if (u_sf_record == 1) + else if ((*recplay_conf)->u_sf_record == 1) return RECPLAY_RECORDMODE; - return 0; + return RECPLAY_DISABLED; } /*! \brief Terminate operation of the oai iq recorder. to be called by any device @@ -81,21 +80,15 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ */ void iqrecorder_end(openair0_device *device) { if (device->recplay_state != NULL) { // subframes store - iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID}; + iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID}; recplay_state_t *rs = device->recplay_state; - recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf; + recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf; rs->pFile = fopen (rc->u_sf_filename,"wb+"); if (rs->pFile == NULL) { LOG_E(HW,"Cannot open %s\n", rc->u_sf_filename); } else { unsigned int i = 0; - unsigned int modu = 0; - - if ((modu = rs->nbSamplesBlocks % 10) != 0) { - rs->nbSamplesBlocks -= modu; // store entire number of frames - } - fh.nbSamplesBlocks=rs->nbSamplesBlocks; LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename ); fwrite(&fh, sizeof(fh), 1, rs->pFile); @@ -103,7 +96,7 @@ void iqrecorder_end(openair0_device *device) { uint8_t *ptr=(uint8_t *)rs->ms_sample; for (i = 0; i < rs->nbSamplesBlocks; i++) { - int blockBytes=sizeof(iqrec_t)+((iqrec_t *)ptr)->nbBytes; + int blockBytes=sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF; fwrite(ptr, sizeof(unsigned char), blockBytes, rs->pFile); ptr+=blockBytes; } diff --git a/radio/COMMON/record_player.h b/radio/COMMON/record_player.h index 2f5a6fa57b..1f76e5cf58 100644 --- a/radio/COMMON/record_player.h +++ b/radio/COMMON/record_player.h @@ -44,9 +44,8 @@ extern "C" #define RECPLAY_REPLAYMODE 2 #define BELL_LABS_IQ_HEADER 0xabababababababab -#define BELL_LABS_IQ_PER_SF 46080 // 7680 => 5MHz bw for now; 46080 => 3/4 40MHz (106 PRBs) +#define BELL_LABS_IQ_PER_SF 23040 // 23040 => 46080/2 slots => 3/4 40MHz (106 PRBs) #define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4) -#define MAX_BELL_LABS_IQ_BYTES_PER_SF BELL_LABS_IQ_BYTES_PER_SF*10 #define OAIIQFILE_ID {'O', 'I','Q','F'} typedef struct { @@ -61,7 +60,9 @@ typedef struct { int64_t header; int64_t ts; int64_t nbBytes; - int64_t rfu2; // pad for 256 bits alignement required by AVX2 + int64_t tv_sec; // nb of secs since EPOCH + int64_t tv_usec; // nb of µsecs since EPOCH + int64_t rfu2; // pad for 256 bits alignement required by AVX2 } iqrec_t; #define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz) #define DEF_SF_FILE "/tmp/iqfile" // default subframes file name @@ -95,29 +96,31 @@ typedef struct { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define DEVICE_RECPLAY_PARAMS_DESC { \ - {CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:&((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 0}, \ - {CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_conf)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_conf)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_conf)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \ - {CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:&((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 0}, \ + {CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->u_sf_record), defuintval:0, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->u_sf_replay), defuintval:0, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_conf)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_conf)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_conf)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \ + {CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \ }/*! \brief Record Player Configuration and state */ typedef struct { - char *u_sf_filename; // subframes file path - unsigned int u_sf_max ; // max number of recorded subframes - unsigned int u_sf_loops ; // number of loops in replay mode + char *u_sf_filename; // subframes file path + unsigned int u_sf_max ; // max number of recorded subframes + unsigned int u_sf_loops ; // number of loops in replay mode unsigned int u_sf_read_delay; // read delay in replay mode unsigned int u_sf_write_delay ; // write delay in replay mode - unsigned int use_mmap; // default is to use mmap + unsigned int use_mmap; // default is to use mmap + unsigned int u_sf_replay; // replay mode (if 1) + unsigned int u_sf_record; // record mode (if 1) } recplay_conf_t; typedef struct { size_t mapsize; FILE *pFile; int fd; - iqrec_t *ms_sample; // memory for all subframes + iqrec_t *ms_sample; // memory for all subframes unsigned int nbSamplesBlocks; uint8_t *currentPtr; uint64_t currentTs; diff --git a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp index 227c2f461c..a51ed53b8d 100644 --- a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -658,7 +658,12 @@ int trx_usrp_write_init(openair0_device *device){ printf("end of tx write thread\n"); pthread_mutex_init(&write_thread->mutex_write, NULL); pthread_cond_init(&write_thread->cond_write, NULL); - pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); + threadCreate(&write_thread->pthread_write, + trx_usrp_write_thread, + (void *)device, + (char*)"trx_usrp_write_thread", + -1, + OAI_PRIORITY_RT_MAX); return(0); } @@ -698,7 +703,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp nsamps2 = (nsamps+3)>>2; int16x8_t buff_tmp[cc<2 ? 2 : cc][nsamps2]; #endif - + static int read_count = 0; int rxshift; switch (device->type) { case USRP_B200_DEV: @@ -769,25 +774,30 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp recplay_state_t *recPlay=device->recplay_state; - if ( recPlay != NULL) { // record mode + if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { // record mode // Copy subframes to memory (later dump on a file) - if (recPlay->nbSamplesBlocks < device->openair0_cfg->recplay_conf->u_sf_max && - recPlay->maxSizeBytes > (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) + - sizeof(iqrec_t) + nsamps*4 ) { + // The number of read samples might differ from BELL_LABS_IQ_BYTES_PER_SF + // The number of read samples is always stored in nbBytes but the record is always of BELL_LABS_IQ_BYTES_PER_SF size + if (recPlay->nbSamplesBlocks <= device->openair0_cfg->recplay_conf->u_sf_max && + recPlay->maxSizeBytes >= (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) + + sizeof(iqrec_t) + BELL_LABS_IQ_BYTES_PER_SF) { iqrec_t *hdr=(iqrec_t *)recPlay->currentPtr; + struct timespec trec; + (void) clock_gettime(CLOCK_REALTIME, &trec); hdr->header = BELL_LABS_IQ_HEADER; hdr->ts = *ptimestamp; - hdr->nbBytes=nsamps*4; + hdr->nbBytes=nsamps*4; // real number of samples bytes + hdr->tv_sec = trec.tv_sec; // record secs + hdr->tv_usec = trec.tv_nsec/1000; // record µsecs memcpy(hdr+1, buff[0], nsamps*4); - recPlay->currentPtr+=sizeof(iqrec_t)+nsamps*4; + recPlay->currentPtr+=sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF; // record size is constant (BELL_LABS_IQ_BYTES_PER_SF) recPlay->nbSamplesBlocks++; -#if 0 // BMC: this is too verbose - LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample); -#endif + LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld nbBytes %d nbSamplesBlocks %d\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample, (int)hdr->nbBytes, (int)recPlay->nbSamplesBlocks); } else - exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n"); + exit_function(__FILE__, __FUNCTION__, __LINE__, "Recording reaches max iq limit\n", OAI_EXIT_NORMAL); } - + read_count++; + LOG_D(HW,"usrp_lib: returning %d samples at ts %lu read_count %d\n", samples_received, *ptimestamp, read_count); return samples_received; } diff --git a/radio/iqplayer/iqplayer_lib.c b/radio/iqplayer/iqplayer_lib.c index 8fd3da5ed1..7ac587bb95 100644 --- a/radio/iqplayer/iqplayer_lib.c +++ b/radio/iqplayer/iqplayer_lib.c @@ -35,10 +35,33 @@ #include #include #include +#include +#include #include "common_lib.h" #include "assertions.h" #include "common/utils/LOG/log.h" +static void busy_wait(uint32_t usecs) { + uint32_t elapsed_usecs; + double temp; + int j; + struct timespec requestStart, requestEnd; + + // Active wait + clock_gettime(CLOCK_REALTIME, &requestStart); + temp = 0; + while (1) { + for (j=0; j < 40; j++) + temp += sin(j); + clock_gettime(CLOCK_REALTIME, &requestEnd); + elapsed_usecs = ( requestEnd.tv_sec - requestStart.tv_sec ) / 1e-6 + + ( requestEnd.tv_nsec - requestStart.tv_nsec ) / 1e3; + if (elapsed_usecs >= usecs) + break; + } + //LOG_I(HW, "Expected: %d Elapsed: %d us\n", usecs, elapsed_usecs); +} + static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) { char tmp[4]=OAIIQFILE_ID; AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0), @@ -92,8 +115,8 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair fstat(s->fd, &sb); s->mapsize=sb.st_size; LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nbSamplesBlocks, c->u_sf_filename,(uint64_t)sb.st_size); - // allocate buffer for 1 sample at a time - s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+MAX_BELL_LABS_IQ_BYTES_PER_SF*4); + // allocate buffer for 1 subframe at a time + s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF); if (s->ms_sample == NULL) { LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" ); @@ -120,6 +143,56 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair return 0; } +/*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ +static int trx_iqplayer_get_stats(openair0_device *device) +{ + LOG_I(HW, "trx_iqplayer_get_stats() called, not implemented\n"); + return 0; +} + +/*! \brief Reset device statistics + * \param device the hardware to use + * \returns 0 in success + */ +static int trx_iqplayer_reset_stats(openair0_device *device) +{ + LOG_I(HW, "trx_iqplayer_reset_stats() called, not implemented\n"); + return 0; +} + +/*! \brief Stop operation of the transceiver + */ +static int trx_iqplayer_stop(openair0_device *device) +{ + LOG_I(HW, "trx_iqplayer_stop() called, not implemented\n"); + return 0; +} + +/*! \brief Set RX frequencies + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ +static int trx_iqplayer_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +{ + LOG_I(HW, "trx_iqplayer_set_freq() called, not implemented\n"); + return 0; +} + +/*! \brief Set gains + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ +static int trx_iqplayer_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) +{ + LOG_I(HW, "trx_iqplayer_set_gains() called, not implemented\n"); + return 0; +} + /*! \brief start the oai iq player * \param device, the hardware used */ @@ -181,24 +254,28 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest */ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { recplay_state_t *s = device->recplay_state; + static struct timeval tprev; + static int read_count = 0; if (s->curSamplesBlock==0 && s->wrap_count==0) { s->currentTs=s->ms_sample->ts; + tprev.tv_sec = s->ms_sample->tv_sec; + tprev.tv_usec = s->ms_sample->tv_usec; LOG_I(HW, "First timestamp=%lu s->nbSamplesBlocks=%u\n", s->currentTs, s->nbSamplesBlocks); } if (s->curSamplesBlock == s->nbSamplesBlocks) { - LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count); - s->curSamplesBlock = 0; - s->wrap_count++; - if (s->wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) { LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n", device->openair0_cfg->recplay_conf->u_sf_loops); - exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n"); + exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n", OAI_EXIT_NORMAL); } - LOG_I(HW,"go back at the beginning of IQ file"); + if (s->wrap_count > 0) { + LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count); + } + s->curSamplesBlock = 0; + s->wrap_count++; device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample; if (!(device->openair0_cfg->recplay_conf->use_mmap) ) { @@ -210,20 +287,23 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes if (!(device->openair0_cfg->recplay_conf->use_mmap)) { // read sample from file if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { - LOG_E(HW,"pb reading iqfile at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); + LOG_E(HW,"pb reading iq record header at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); exit(-1); } else { - if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) { - LOG_E(HW,"pb reading iqfile at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); + if (read(s->fd, s->ms_sample+1, BELL_LABS_IQ_BYTES_PER_SF) != BELL_LABS_IQ_BYTES_PER_SF) { + LOG_E(HW,"pb reading iq record data at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); exit(-1); } } } iqrec_t *curHeader=(iqrec_t *)s->currentPtr; - AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" ); + if (curHeader->header != BELL_LABS_IQ_HEADER) { + LOG_I(HW,"Problem iq header nsamps %d\n", nsamps); + AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" ); + } // the current timestamp is the stored timestamp until we wrap on input - AssertFatal(nsamps*4==curHeader->nbBytes,""); + AssertFatal(nsamps*4==curHeader->nbBytes,"nsamps=%d curHeader->nbBytes=%d", (int)nsamps, (int)curHeader->nbBytes); *ptimestamp = s->currentTs; memcpy(buff[0], curHeader+1, nsamps*4); s->curSamplesBlock++; @@ -231,33 +311,40 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes s->currentTs+=nsamps; if (device->openair0_cfg->recplay_conf->use_mmap) - s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes; + s->currentPtr+=sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF; - // BMC TODO: support 1 second or more subframe read delay - struct timespec req; - req.tv_sec = 0; - req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000; - nanosleep(&req, NULL); - LOG_D(HW, "returning %d samples at ts %lu\n", nsamps, *ptimestamp); + // subframe read delay is not taken into account + // Real time interval is handle to mimic RF board latcency + struct timeval tcur, tdiff; + tcur.tv_sec = curHeader->tv_sec; + tcur.tv_usec = curHeader->tv_usec; + timersub(&tcur, &tprev, &tdiff); + if (tdiff.tv_usec > 0) { + busy_wait(tdiff.tv_usec); + } + tprev = tcur; + + read_count++; + LOG_D(HW, "returning %d samples at ts %lu read_count %d\n", nsamps, *ptimestamp, read_count); return nsamps; } int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->openair0_cfg = openair0_cfg; device->trx_start_func = trx_iqplayer_start; - device->trx_get_stats_func = NULL; - device->trx_reset_stats_func = NULL; - device->trx_end_func = trx_iqplayer_end; - device->trx_stop_func = NULL; - device->trx_set_freq_func = NULL; - device->trx_set_gains_func = NULL; + device->trx_get_stats_func = trx_iqplayer_get_stats; + device->trx_reset_stats_func = trx_iqplayer_reset_stats; + device->trx_end_func = trx_iqplayer_end; + device->trx_stop_func = trx_iqplayer_stop; + device->trx_set_freq_func = trx_iqplayer_set_freq; + device->trx_set_gains_func = trx_iqplayer_set_gains; // Replay subframes from from file // openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38; // bw_gain_adjust=1; device->trx_write_func = trx_iqplayer_write; device->trx_read_func = trx_iqplayer_read; iqplayer_loadfile(device, openair0_cfg); - LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops); + LOG_UI(HW,"iqplayer device initialized, replay %s for %i iteration(s)\n",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops); return 0; } /*@}*/