diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e8758cea3..2fa870ed69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -709,6 +709,7 @@ target_link_libraries(SCHED_LIB PRIVATE asn1_lte_rrc_hdrs) set(SCHED_NR_SRC ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_gNB.c ${OPENAIR1_DIR}/SCHED_NR/nr_prach_procedures.c + ${OPENAIR1_DIR}/SCHED_NR/nr_ru_procedures.c ${OPENAIR1_DIR}/SCHED_NR/phy_frame_config_nr.c ) add_library(SCHED_NR_LIB ${SCHED_NR_SRC}) @@ -716,7 +717,6 @@ target_link_libraries(SCHED_NR_LIB PRIVATE asn1_nr_rrc_hdrs UTIL) set(SCHED_SRC_RU ${OPENAIR1_DIR}/SCHED/ru_procedures.c - ${OPENAIR1_DIR}/SCHED_NR/nr_ru_procedures.c ${OPENAIR1_DIR}/SCHED/prach_procedures.c ) add_library(SCHED_RU_LIB ${SCHED_SRC_RU}) @@ -877,6 +877,10 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c @@ -893,22 +897,22 @@ set(PHY_SRC ) set(PHY_SRC_RU - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c + ${OPENAIR1_DIR}/PHY/if4_tools.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c - ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_nr.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c ${OPENAIR1_DIR}/PHY/MODULATION/gen_75KHz.cpp ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c - ${OPENAIR1_DIR}/PHY/INIT/nr_init_ru.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c + ) +set(NR_PHY_SRC_RU + ${OPENAIR1_DIR}/PHY/MODULATION/nr_beamforming.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_nr.c + ${OPENAIR1_DIR}/PHY/INIT/nr_init_ru.c + ${OPENAIR1_DIR}/PHY/if4_tools.c ) set(PHY_SRC_UE @@ -1080,6 +1084,8 @@ target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common add_library(PHY_RU ${PHY_SRC_RU}) target_link_libraries(PHY_RU PRIVATE asn1_lte_rrc_hdrs UTIL) +add_library(NR_PHY_RU ${NR_PHY_SRC_RU}) + #Layer 2 library ##################### set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC) @@ -1757,6 +1763,10 @@ add_executable(oairu ${OPENAIR_DIR}/executables/lte-ru.c ${OPENAIR_DIR}/executables/ru_control.c ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c ${OPENAIR_DIR}/executables/main_ru.c ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ) @@ -1808,11 +1818,12 @@ add_executable(nr-oru ${OPENAIR_DIR}/openair1/PHY/INIT/nr_parms.c ${OPENAIR_DIR}/openair1/SCHED_NR/phy_frame_config_nr.c ${OPENAIR_DIR}/openair1/SCHED_NR/nr_prach_procedures.c + ${OPENAIR_DIR}/openair1/SCHED_NR/nr_ru_procedures.c ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c ${OPENAIR_DIR}/executables/main_nr_ru.c ) target_link_libraries(nr-oru PRIVATE - UTIL SCHED_RU_LIB PHY_COMMON PHY_RU PHY_NR shlib_loader z dl + UTIL NR_PHY_RU PHY_NR shlib_loader z dl radio_common softmodem_common) target_link_libraries(nr-oru PRIVATE pthread m CONFIG_LIB rt ${T_LIB} utils barrier actor) @@ -1836,8 +1847,8 @@ add_executable(nr-softmodem target_link_libraries(nr-softmodem PRIVATE -Wl,--start-group - UTIL SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECURITY - ITTI ${NAS_UE_LIB} lte_rrc nr_rrc + UTIL SCTP_CLIENT SCHED_LIB SCHED_NR_LIB PHY_NR PHY PHY_NR_COMMON NR_PHY_RU GTPV1U SECURITY + ITTI ${NAS_UE_LIB} nr_rrc ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU x2ap f1ap m2ap m3ap e1ap radio_common time_management softmodem_common @@ -1905,8 +1916,8 @@ add_executable(nr-uesoftmodem target_link_libraries(nr-uesoftmodem PRIVATE -Wl,--start-group - nr_rrc SECURITY UTIL SCHED_RU_LIB SCHED_NR_UE_LIB - PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE MAC_NR_COMMON NFAPI_LIB + nr_rrc SECURITY UTIL SCHED_NR_UE_LIB + PHY_NR_COMMON PHY_NR_UE NR_L2_UE MAC_NR_COMMON NFAPI_LIB ITTI SIMU radio_common time_management softmodem_common -Wl,--end-group z dl) @@ -1983,14 +1994,14 @@ target_link_libraries(physim_common PRIVATE UTIL) add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c) 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 + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common ) target_link_libraries(nr_dlschsim PRIVATE asn1_nr_rrc_hdrs) add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c) 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 + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common ) target_link_libraries(nr_pbchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2000,14 +2011,14 @@ add_executable(nr_psbchsim ${NFAPI_USER_DIR}/nfapi.c ) target_link_libraries(nr_psbchsim PRIVATE - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common softmodem_common ) target_link_libraries(nr_psbchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_executable(nr_pucchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c) 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 + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common ) target_link_libraries(nr_pucchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2019,7 +2030,7 @@ add_executable(nr_dlsim ${PHY_INTERFACE_DIR}/queue_t.c ) 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_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common softmodem_common ) @@ -2027,7 +2038,7 @@ 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) 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 CONFIG_LIB -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR NR_PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common) target_link_libraries(nr_prachsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2035,7 +2046,7 @@ add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c ) 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 + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${T_LIB} ITTI dl physim_common ) target_link_libraries(nr_ulschsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2048,7 +2059,7 @@ add_executable(nr_ulsim ) 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_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common softmodem_common ) target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2059,7 +2070,7 @@ add_executable(nr_srssim ) target_link_libraries(nr_srssim PRIVATE - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON -Wl,--end-group + -Wl,--start-group UTIL SIMU PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON -Wl,--end-group m pthread ITTI dl nr_ue_phy_meas physim_common softmodem_common ) @@ -2128,7 +2139,7 @@ if (${T_TRACER}) SECURITY SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU + PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU NR_PHY_RU L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_UE_NR ngap GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE SIMU dfts config_internals nr_common crc_byte) diff --git a/common/platform_constants.h b/common/platform_constants.h index d7cf6f9ed6..26894fd82b 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -66,7 +66,6 @@ #define RETURNok (0) #define RETURNerror (-1) #define DEFAULT_NAS_PATH "PWD" -#define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE) #define NUM_PRACH_RX_FOR_NOISE_ESTIMATE 100 // SDAP diff --git a/common/utils/actor/actor.h b/common/utils/actor/actor.h index 3d7760356c..d49bd88c65 100644 --- a/common/utils/actor/actor.h +++ b/common/utils/actor/actor.h @@ -4,7 +4,7 @@ #ifndef ACTOR_H #define ACTOR_H -#include "notified_fifo.h" +#include "common/utils/threadPool/notified_fifo.h" #define INIT_ACTOR(ptr, name, core_affinity) init_actor((Actor_t *)ptr, name, core_affinity); diff --git a/doc/Doxyfile b/doc/Doxyfile index fad5807544..7c09e6272e 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -1967,7 +1967,7 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/group_hopping.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/if4_tools.h \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/if4_tools.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/uci_tools.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/prach.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_TRANSPORT/edci.c \ diff --git a/executables/lte-enb.c b/executables/lte-enb.c index b62815b70a..c735934c1a 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -20,7 +20,7 @@ #include "nfapi/oai_integration/vendor_ext.h" #include "radio/COMMON/common_lib.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/phy_extern.h" diff --git a/executables/lte-ru.c b/executables/lte-ru.c index 91470d8f63..a0a82deabd 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -28,7 +28,7 @@ #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" +#include "PHY/if4_tools.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "SCHED/sched_common.h" #include "common/utils/LOG/log.h" diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 7554c8a9a6..ad2425f358 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -20,7 +20,7 @@ #include "radio/COMMON/common_lib.h" #include "radio/ETHERNET/ethernet_lib.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "PHY/defs_nr_common.h" #include "PHY/phy_extern.h" diff --git a/executables/ru_control.c b/executables/ru_control.c index 11a3ef0f14..1852a67afb 100644 --- a/executables/ru_control.c +++ b/executables/ru_control.c @@ -27,7 +27,7 @@ #include "radio/COMMON/common_lib.h" #include "radio/ETHERNET/ethernet_lib.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "SCHED/sched_eNB.h" diff --git a/nfapi/oai_integration/wls_integration/wls_pnf.c b/nfapi/oai_integration/wls_integration/wls_pnf.c index 42c09b4845..738f15a1a1 100644 --- a/nfapi/oai_integration/wls_integration/wls_pnf.c +++ b/nfapi/oai_integration/wls_integration/wls_pnf.c @@ -183,7 +183,7 @@ bool wls_pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t *msg bool wls_pnf_nr_send_p7_message(pnf_p7_t *pnf_p7, nfapi_nr_p7_message_header_t *msg, uint32_t msg_len) { - UNUSED_VARIABLE(msg_len); + UNUSED(msg_len); if (pnf_p7->terminate) { // don't send any further P7 messages after terminating return false; diff --git a/nfapi/oai_integration/wls_integration/wls_vnf.c b/nfapi/oai_integration/wls_integration/wls_vnf.c index a250188c78..7249bae551 100644 --- a/nfapi/oai_integration/wls_integration/wls_vnf.c +++ b/nfapi/oai_integration/wls_integration/wls_vnf.c @@ -410,7 +410,7 @@ int wls_fapi_nr_vnf_start(nfapi_vnf_config_t *cfg) bool wls_vnf_nr_send_p5_message(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len) { - UNUSED_VARIABLE(p5_idx); + UNUSED(p5_idx); int packed_len = vnf->_public.pack_func(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config); diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 0cbb679f82..71ad18ab62 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -3,7 +3,6 @@ */ #include "PHY/phy_extern.h" -#include "SCHED/sched_common.h" #include "assertions.h" #include #include "openair1/PHY/defs_RU.h" diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index b821aa758e..6751f68da0 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -7,9 +7,7 @@ */ #include "PHY/sse_intrin.h" #include "PHY/defs_eNB.h" -//#include "PHY/phy_extern.h" -//#include "prach.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "SCHED/sched_eNB.h" #include "common/utils/LOG/vcd_signal_dumper.h" diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index 2f04a0eeaf..b85b05277d 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -4255,7 +4255,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, LOG_D(PHY,"Format 0 DCI :ulsch (ue): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2); LOG_D(PHY,"Format 0 DCI :ulsch (ue): phich status %d\n",ulsch->harq_processes[harq_pid]->status); #else - UNUSED_VARIABLE(dai); + UNUSED(dai); #endif return(0); } else { @@ -4889,7 +4889,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, printf("ulsch (eNB): Nsymb_pusch %d\n",ulsch->harq_processes[harq_pid]->Nsymb_pusch); printf("ulsch (eNB): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2); #else - UNUSED_VARIABLE(dai); + UNUSED(dai); #endif return(0); } else { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 62268ef930..b5abfdea92 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -10,7 +10,7 @@ #include "executables/lte-softmodem.h" #include "PHY/phy_extern_ue.h" //#include "prach.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "SCHED_UE/sched_UE.h" #include "SCHED/sched_common_extern.h" diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 56def37b41..f65a1bac48 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -9,7 +9,6 @@ #include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "modulation_eNB.h" -#include "nr_modulation.h" #include "common/utils/LOG/vcd_signal_dumper.h" int beam_precoding(int32_t **txdataF, @@ -80,25 +79,3 @@ int beam_precoding_one_eNB(int32_t **txdataF, } return 0; } - - -void nr_beam_precoding(c16_t **txdataF, - c16_t **txdataF_BF, - NR_DL_FRAME_PARMS *frame_parms, - int32_t ***beam_weights, - int symbol, - int aa, - int nb_antenna_ports, - int offset) -{ - // clear txdata_BF[aa][re] for each call of ue_spec_beamforming - memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, sizeof(c16_t) *(frame_parms->ofdm_symbol_size)); - - for (int p = 0; p < nb_antenna_ports; p++) { - multadd_cpx_vector((c16_t *)&txdataF[p][(symbol * frame_parms->ofdm_symbol_size) + offset], - (c16_t *)beam_weights[p][aa], - (c16_t *)&txdataF_BF[aa][symbol * frame_parms->ofdm_symbol_size], - frame_parms->ofdm_symbol_size, - 15); - } -} diff --git a/openair1/PHY/MODULATION/nr_beamforming.c b/openair1/PHY/MODULATION/nr_beamforming.c new file mode 100644 index 0000000000..a10b95d6d2 --- /dev/null +++ b/openair1/PHY/MODULATION/nr_beamforming.c @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: LicenseRef-CSSL-1.0 + */ + +#include "nr_modulation.h" +#include "openair1/PHY/TOOLS/tools_defs.h" + +void nr_beam_precoding(c16_t **txdataF, + c16_t **txdataF_BF, + NR_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int symbol, + int aa, + int nb_antenna_ports, + int offset) +{ + // clear txdata_BF[aa][re] for each call of ue_spec_beamforming + memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, sizeof(c16_t) *(frame_parms->ofdm_symbol_size)); + + for (int p = 0; p < nb_antenna_ports; p++) { + multadd_cpx_vector((c16_t *)&txdataF[p][(symbol * frame_parms->ofdm_symbol_size) + offset], + (c16_t *)beam_weights[p][aa], + (c16_t *)&txdataF_BF[aa][symbol * frame_parms->ofdm_symbol_size], + frame_parms->ofdm_symbol_size, + 15); + } +} diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index e3afd9b93f..8a1349b648 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -3,6 +3,7 @@ */ #include "nr_modulation.h" +#include "openair1/PHY/TOOLS/tools_defs.h" #include "PHY/NR_REFSIG/nr_mod_table.h" #include "executables/softmodem-common.h" #include @@ -688,12 +689,12 @@ c16_t nr_layer_precoder_cm(int n_layers, int symSz, c16_t datatx_F_precoding[n_layers][symSz], int ap, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset) { c16_t precodatatx_F = {0}; for (int al = 0; al < n_layers; al++) { - c16_t prec_weight = pmi_pdu->weights[al][ap]; + c16_t prec_weight = weights[al][ap]; precodatatx_F = c16maddShift(datatx_F_precoding[al][offset], prec_weight, precodatatx_F, 15); } return precodatatx_F; @@ -803,15 +804,15 @@ static inline __attribute__((always_inline)) __m128i cmac_prec128(__m128i y, __m #endif #define load_consts(Type, Instruct, Rank) \ - const Type w_c##Rank = Instruct(c16toI32(c16conj(pmi_pdu->weights[Rank][ant]))); \ - const Type w_s##Rank = Instruct(c16toI32(c16swap(pmi_pdu->weights[Rank][ant]))); \ + const Type w_c##Rank = Instruct(c16toI32(c16conj(weights[Rank][ant]))); \ + const Type w_s##Rank = Instruct(c16toI32(c16swap(weights[Rank][ant]))); \ const Type *in##Rank = (Type *)(txdataF_res_mapped[Rank] + sc_offset + (out-beginning)); void nr_layer_precoder_simd(const int n_layers, const int symSz, const c16_t txdataF_res_mapped[n_layers][symSz], const int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], const int sc_offset, const int re_cnt, c16_t *txdataF_precoded) diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index ef834db509..769bf43da1 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -7,7 +7,6 @@ #include #include "PHY/defs_nr_common.h" -#include "PHY/defs_gNB.h" #define DMRS_MOD_ORDER 2 /*Precoding matices: W[pmi][antenna_port][layer]*/ @@ -127,7 +126,7 @@ c16_t nr_layer_precoder_cm(int n_layers, int symSz, c16_t datatx_F_precoding[n_layers][symSz], int ap, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset); /*! \brief Precoding with SIMDe, txdataF_precoded[] = prec_matrix[] * txdataF_res_mapped[] @@ -140,7 +139,7 @@ void nr_layer_precoder_simd(const int n_layers, const int symSz, const c16_t txdataF_res_mapped[n_layers][symSz], const int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], const int sc_offset, const int re_cnt, c16_t *txdataF_precoded); diff --git a/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp b/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp index d232c442bf..7a66696384 100644 --- a/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp +++ b/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp @@ -15,7 +15,6 @@ extern "C" { #endif #include "openair1/PHY/TOOLS/tools_defs.h" // c16_t -#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h" // nfapi_nr_pm_pdu_t #include "nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h" // fapi_nr_dl_config_dci_dl_pdu_rel15_t //#include "openair1/PHY/MODULATION/nr_modulation.h" // nr_layer_precoder_simd_[cm, simd] @@ -25,7 +24,7 @@ c16_t nr_layer_precoder_cm(int n_layers, int symbol_size, c16_t (*dataF_in)[/*symbol_size*/], // c16_t dataF_in[n_layers][symbol_size] int ant, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset); // Forward declare the function but hide the Variable-Length Array (VLA) feature from C not available in C++ @@ -33,7 +32,7 @@ void nr_layer_precoder_simd(int n_layers, int symbol_size, const c16_t (*dataF_in)[/*symbol_size*/], // c16_t dataF_in[n_layers][symbol_size] int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset, int re_cnt, c16_t *dataF_out); @@ -65,15 +64,15 @@ TEST(NrLayerPrecoderTest, Basic) c16_t(*dataF_in)[symbol_size] = reinterpret_cast(buffer_in.data()); c16_t(*dataF_out)[symbol_size] = reinterpret_cast(buffer_out.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { - pmi_pdu.weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; + weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; } // Call the C function for (int symbol = 0; symbol < re_cnt; symbol++) - dataF_out[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, symbol); + dataF_out[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, weights, symbol); // You can calculate the expected value manually or test rough correctness for (int symbol = 0; symbol < re_cnt; symbol++) { @@ -110,14 +109,14 @@ TEST(NrLayerPrecoderTest, SIMD) c16_t(*dataF_in)[symbol_size] = reinterpret_cast(buffer_in.data()); c16_t(*dataF_out)[symbol_size] = reinterpret_cast(buffer_out.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { - pmi_pdu.weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; + weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; } // Call the C function - nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, 0, re_cnt, dataF_out[ant]); + nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, weights, 0, re_cnt, dataF_out[ant]); // You can calculate the expected value manually or test rough correctness for (int symbol = 0; symbol < re_cnt; symbol++) { @@ -156,15 +155,14 @@ TEST(NrLayerPrecoderTest, Compare_CM_SIMD) c16_t(*dataF_out_cm)[symbol_size] = reinterpret_cast(buffer_out_cm.data()); c16_t(*dataF_out_simd)[symbol_size] = reinterpret_cast(buffer_out_simd.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; - pmi_pdu.pm_idx = 4; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { // Could not use convert_precoder_weight() as complex.h could not be used in googletest // Use the logic in convert_precoder_weight() // precoder [−1,−j] - pmi_pdu.weights[layer][0] = (c16_t){-SHRT_MAX, 0}; - pmi_pdu.weights[layer][1] = (c16_t){0, -SHRT_MAX}; + weights[layer][0] = (c16_t){-SHRT_MAX, 0}; + weights[layer][1] = (c16_t){0, -SHRT_MAX}; } // Get the results for all the antenna @@ -172,10 +170,10 @@ TEST(NrLayerPrecoderTest, Compare_CM_SIMD) // Call the C function for (int symbol = 0; symbol < re_cnt; symbol++) - dataF_out_cm[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, symbol); + dataF_out_cm[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, weights, symbol); // Call the C function - nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, 0, re_cnt, dataF_out_simd[ant]); + nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, weights, 0, re_cnt, dataF_out_simd[ant]); // Compare the result from both C function for (int symbol = 0; symbol < re_cnt; symbol++) { diff --git a/openair1/PHY/NR_ESTIMATION/nr_freq_equalization.c b/openair1/PHY/NR_ESTIMATION/nr_freq_equalization.c index fd7530b0d9..75589c75f8 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_freq_equalization.c +++ b/openair1/PHY/NR_ESTIMATION/nr_freq_equalization.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: LicenseRef-CSSL-1.0 */ -#include "PHY/defs_eNB.h" #include "PHY/sse_intrin.h" #include "PHY/NR_ESTIMATION/nr_ul_estimation.h" diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index d227148353..8f1bb827be 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -438,7 +438,7 @@ static inline void do_txdataF(c16_t **txdataF, symbol_sz, txdataF_precoding, ant, - pmi_pdu, + pmi_pdu->weights, subCarrier, re_cnt, &txdataF[ant][txdataF_offset_per_symbol]); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 63771f7125..c0326693a2 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -28,8 +28,8 @@ #include "common_lib.h" #include "fapi_nr_ue_interface.h" #include "assertions.h" -#include "barrier.h" -#include "actor.h" +#include "common/utils/barrier/barrier.h" +#include "common/utils/actor/actor.h" //#include "openair1/SCHED_NR_UE/defs.h" #define msg(aRGS...) LOG_D(PHY, ##aRGS) diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/if4_tools.c similarity index 99% rename from openair1/PHY/LTE_TRANSPORT/if4_tools.c rename to openair1/PHY/if4_tools.c index 66097fc87f..5c5428db90 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/if4_tools.c @@ -3,7 +3,6 @@ */ #include -//#include "PHY/defs_eNB.h" #include "PHY/defs_RU.h" #include "PHY/TOOLS/alaw_lut.h" //#include "PHY/phy_extern.h" diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.h b/openair1/PHY/if4_tools.h similarity index 96% rename from openair1/PHY/LTE_TRANSPORT/if4_tools.h rename to openair1/PHY/if4_tools.h index 3cc30f7710..367ccfa859 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.h +++ b/openair1/PHY/if4_tools.h @@ -4,7 +4,7 @@ #ifndef __IF4_TOOLS_H__ #define __IF4_TOOLS_H__ -#include "PHY/defs_eNB.h" +#include "openair1/PHY/defs_RU.h" /// Macro for IF4 packet type #define IF4p5_PACKET_TYPE 0x080A diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 065c66d14c..8162d11699 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -10,7 +10,7 @@ #include "PHY/defs_eNB.h" #include "SCHED/sched_eNB.h" #include "PHY/MODULATION/modulation_eNB.h" -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" diff --git a/openair1/SIMULATION/TOOLS/channel_sim.c b/openair1/SIMULATION/TOOLS/channel_sim.c index 80f933db69..0e6e7404d0 100644 --- a/openair1/SIMULATION/TOOLS/channel_sim.c +++ b/openair1/SIMULATION/TOOLS/channel_sim.c @@ -256,9 +256,9 @@ void do_DL_sig(sim_t *sim, LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (ADC out) %f dB/RE (%d) for subframe %d, writing to %p, length %d\n",UE_id, 10*log10((double)rx_pwr2),rx_pwr2,subframe,rxdata,lengthN_RB_DL) ,subframe); #else - UNUSED_VARIABLE(rx_pwr2); - UNUSED_VARIABLE(tx_pwr); - UNUSED_VARIABLE(rx_pwr); + UNUSED(rx_pwr2); + UNUSED(tx_pwr); + UNUSED(rx_pwr); #endif } // RU_output_mask @@ -434,8 +434,8 @@ void do_UL_sig(sim_t *sim, uint16_t subframe, uint8_t abstraction_flag, LTE_DL_F rx_pwr2 = signal_energy(rxdata[0]+sf_offset_tdd,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL); LOG_D(OCM,"[SIM][UL] RU %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d) = %p\n",ru_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset,rxdata[0]+sf_offset_tdd); #else - UNUSED_VARIABLE(tx_pwr); - UNUSED_VARIABLE(rx_pwr); - UNUSED_VARIABLE(rx_pwr2); + UNUSED(tx_pwr); + UNUSED(rx_pwr); + UNUSED(rx_pwr2); #endif } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 6b2c9e23ac..3341455e45 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -7,7 +7,6 @@ */ #include "common/platform_types.h" -#include "uper_decoder.h" /* MAC */ #include "nr_mac_gNB.h" @@ -24,8 +23,6 @@ #include -static void nr_fill_rar(NR_UE_info_t *UE, uint8_t *dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu); - static const float ssb_per_rach_occasion[8] = {0.125, 0.25, 0.5, 1, 2, 4, 8}; static int16_t ssb_index_from_prach(module_id_t module_idP, @@ -1027,6 +1024,126 @@ static bool get_feasible_msg3_tda(const NR_ServingCellConfigCommon_t *scc, return false; } +///////////////////////////////////// +// Random Access Response PDU // +// TS 38.213 ch 8.2 // +// TS 38.321 ch 6.2.3 // +///////////////////////////////////// +//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise +//| E | T | R A P I D |// +//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// +//| R | T A |// +//| T A | UL grant |// +//| UL grant |// +//| UL grant |// +//| UL grant |// +//| T C - R N T I |// +//| T C - R N T I |// +///////////////////////////////////// +// UL grant (27 bits) // +///////////////////////////////////// +//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise +//|-------------------|FHF|F_alloc|// +//| Freq allocation |// +//| F_alloc |Time allocation|// +//| MCS | TPC |CSI|// +///////////////////////////////////// +// WIP +// todo: +// - handle MAC RAR BI subheader +// - sending only 1 RAR subPDU +// - UL Grant: hardcoded CSI, TPC, time alloc +// - padding +static void nr_fill_rar(NR_UE_info_t *UE, uint8_t *dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu) +{ + NR_RA_t *ra = UE->ra; + LOG_D(NR_MAC, + "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", + ra->Msg2_frame, + ra->Msg2_slot, + ra->preamble_index, + ra->timing_offset); + NR_RA_HEADER_BI *rarbi = (NR_RA_HEADER_BI *) dlsch_buffer; + NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) (dlsch_buffer + 1); + NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 2); + unsigned char csi_req = 0; + + /// E/T/R/R/BI subheader /// + // E = 1, MAC PDU includes another MAC sub-PDU (RAPID) + // T = 0, Back-off indicator subheader + // R = 2, Reserved + // BI = 0, 5ms + rarbi->E = 1; + rarbi->T = 0; + rarbi->R = 0; + rarbi->BI = 0; + + /// E/T/RAPID subheader /// + // E = 0, one only RAR, first and last + // T = 1, RAPID + rarh->E = 0; + rarh->T = 1; + rarh->RAPID = ra->preamble_index; + + /// RAR MAC payload /// + rar->R = 0; + + // TA command + rar->TA1 = (uint8_t) (ra->timing_offset >> 5); // 7 MSBs of timing advance + rar->TA2 = (uint8_t) (ra->timing_offset & 0x1f); // 5 LSBs of timing advance + + // TC-RNTI + rar->TCRNTI_1 = (uint8_t) (UE->rnti >> 8); // 8 MSBs of rnti + rar->TCRNTI_2 = (uint8_t) (UE->rnti & 0xff); // 8 LSBs of rnti + + // UL grant + + if (pusch_pdu->frequency_hopping) + AssertFatal(1==0,"PUSCH with frequency hopping currently not supported"); + + int bwp_size = pusch_pdu->bwp_size; + int prb_alloc = PRBalloc_to_locationandbandwidth0(ra->msg3_nb_rb, ra->msg3_first_rb, bwp_size); + int valid_bits = 14; + int f_alloc = prb_alloc & ((1 << valid_bits) - 1); + + uint32_t ul_grant = csi_req | (ra->msg3_TPC << 1) | (pusch_pdu->mcs_index << 4) | (ra->Msg3_tda_id << 8) | (f_alloc << 12) | (pusch_pdu->frequency_hopping << 26); + + rar->UL_GRANT_1 = (uint8_t) (ul_grant >> 24) & 0x07; + rar->UL_GRANT_2 = (uint8_t) (ul_grant >> 16) & 0xff; + rar->UL_GRANT_3 = (uint8_t) (ul_grant >> 8) & 0xff; + rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff; + +#ifdef DEBUG_RAR + LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); + LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); + LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); + LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); + LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); + LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); + LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); + LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); + LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); + LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); + LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); + LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); +#endif + LOG_D(NR_MAC, + "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti " + "%x \n", + __FUNCTION__, + rar->UL_GRANT_3 & 0x0f, + (rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12), + rar->TA2 + (rar->TA1 << 5), + rar->UL_GRANT_4 >> 4, + rar->UL_GRANT_1 >> 2, + ra->msg3_TPC, + csi_req, + rar->TCRNTI_2 + (rar->TCRNTI_1 << 8)); + + // resetting msg3 TPC to 0dB for possible retransmissions + ra->msg3_TPC = 1; +} + static bool nr_get_Msg3alloc(gNB_MAC_INST *mac, int CC_id, int current_slot, frame_t current_frame, NR_UE_info_t *UE) { NR_RA_t *ra = UE->ra; @@ -1964,126 +2081,6 @@ bool nr_check_Msg4_MsgB_Ack(module_id_t module_id, frame_t frame, slot_t slot, N return false; } -///////////////////////////////////// -// Random Access Response PDU // -// TS 38.213 ch 8.2 // -// TS 38.321 ch 6.2.3 // -///////////////////////////////////// -//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise -//| E | T | R A P I D |// -//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// -//| R | T A |// -//| T A | UL grant |// -//| UL grant |// -//| UL grant |// -//| UL grant |// -//| T C - R N T I |// -//| T C - R N T I |// -///////////////////////////////////// -// UL grant (27 bits) // -///////////////////////////////////// -//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise -//|-------------------|FHF|F_alloc|// -//| Freq allocation |// -//| F_alloc |Time allocation|// -//| MCS | TPC |CSI|// -///////////////////////////////////// -// WIP -// todo: -// - handle MAC RAR BI subheader -// - sending only 1 RAR subPDU -// - UL Grant: hardcoded CSI, TPC, time alloc -// - padding -static void nr_fill_rar(NR_UE_info_t *UE, uint8_t *dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu) -{ - NR_RA_t *ra = UE->ra; - LOG_D(NR_MAC, - "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", - ra->Msg2_frame, - ra->Msg2_slot, - ra->preamble_index, - ra->timing_offset); - NR_RA_HEADER_BI *rarbi = (NR_RA_HEADER_BI *) dlsch_buffer; - NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) (dlsch_buffer + 1); - NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 2); - unsigned char csi_req = 0; - - /// E/T/R/R/BI subheader /// - // E = 1, MAC PDU includes another MAC sub-PDU (RAPID) - // T = 0, Back-off indicator subheader - // R = 2, Reserved - // BI = 0, 5ms - rarbi->E = 1; - rarbi->T = 0; - rarbi->R = 0; - rarbi->BI = 0; - - /// E/T/RAPID subheader /// - // E = 0, one only RAR, first and last - // T = 1, RAPID - rarh->E = 0; - rarh->T = 1; - rarh->RAPID = ra->preamble_index; - - /// RAR MAC payload /// - rar->R = 0; - - // TA command - rar->TA1 = (uint8_t) (ra->timing_offset >> 5); // 7 MSBs of timing advance - rar->TA2 = (uint8_t) (ra->timing_offset & 0x1f); // 5 LSBs of timing advance - - // TC-RNTI - rar->TCRNTI_1 = (uint8_t) (UE->rnti >> 8); // 8 MSBs of rnti - rar->TCRNTI_2 = (uint8_t) (UE->rnti & 0xff); // 8 LSBs of rnti - - // UL grant - - if (pusch_pdu->frequency_hopping) - AssertFatal(1==0,"PUSCH with frequency hopping currently not supported"); - - int bwp_size = pusch_pdu->bwp_size; - int prb_alloc = PRBalloc_to_locationandbandwidth0(ra->msg3_nb_rb, ra->msg3_first_rb, bwp_size); - int valid_bits = 14; - int f_alloc = prb_alloc & ((1 << valid_bits) - 1); - - uint32_t ul_grant = csi_req | (ra->msg3_TPC << 1) | (pusch_pdu->mcs_index << 4) | (ra->Msg3_tda_id << 8) | (f_alloc << 12) | (pusch_pdu->frequency_hopping << 26); - - rar->UL_GRANT_1 = (uint8_t) (ul_grant >> 24) & 0x07; - rar->UL_GRANT_2 = (uint8_t) (ul_grant >> 16) & 0xff; - rar->UL_GRANT_3 = (uint8_t) (ul_grant >> 8) & 0xff; - rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff; - -#ifdef DEBUG_RAR - LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); - LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); - LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); - LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); - LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); - LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); - LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); - LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); - LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); - LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); - LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); - LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); -#endif - LOG_D(NR_MAC, - "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti " - "%x \n", - __FUNCTION__, - rar->UL_GRANT_3 & 0x0f, - (rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12), - rar->TA2 + (rar->TA1 << 5), - rar->UL_GRANT_4 >> 4, - rar->UL_GRANT_1 >> 2, - ra->msg3_TPC, - csi_req, - rar->TCRNTI_2 + (rar->TCRNTI_1 << 8)); - - // resetting msg3 TPC to 0dB for possible retransmissions - ra->msg3_TPC = 1; -} - /** @brief remove the UE with RNTI rnti from list of UEs doing RA. * * The corresponding function to add is add_new_UE_RA(). */ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 81e1ab1819..8a02933663 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -16,16 +16,12 @@ #include "UTIL/OPT/opt.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "F1AP_CauseRadioNetwork.h" - #include "intertask_interface.h" #include "openair2/F1AP/f1ap_ids.h" #include "F1AP_CauseRadioNetwork.h" #include "T.h" - #include "uper_encoder.h" -#include "uper_decoder.h" #include "SIMULATION/TOOLS/sim.h" // for taus @@ -96,11 +92,6 @@ static const uint16_t cqi_table3[16][2] = {{0, 0}, {6, 6660}, {6, 7720}}; -static void determine_aggregation_level_search_order(int agg_level_search_order[NUM_PDCCH_AGG_LEVELS], - float pdcch_cl_adjust); - -static int nr_mac_interrupt_ue_transmission(gNB_MAC_INST *mac, NR_UE_info_t *UE, int slots, int slots_per_frame); - int get_ssbidx_from_beam(gNB_MAC_INST *mac, int beam_idx) { for (int i = 0; i < MAX_NUM_OF_SSB; i++) @@ -570,6 +561,21 @@ int find_pdcch_candidate(const gNB_MAC_INST *mac, return -1; } +/// @brief Orders PDCCH aggregation levels so that we first check desired aggregation level according to +/// pdcch_cl_adjust +/// @param agg_level_search_order in/out 5-element array of aggregation levels from 0 to 4 +/// @param pdcch_cl_adjust value from 0 to 1 indication channel impariments (0 - good channel, 1 - bad channel) +static void determine_aggregation_level_search_order(int agg_level_search_order[NUM_PDCCH_AGG_LEVELS], float pdcch_cl_adjust) +{ + int desired_agg_level_index = round(4 * pdcch_cl_adjust); + int agg_level_search_index = 0; + for (int i = desired_agg_level_index; i < NUM_PDCCH_AGG_LEVELS; i++) { + agg_level_search_order[agg_level_search_index++] = i; + } + for (int i = desired_agg_level_index - 1; i >= 0; i--) { + agg_level_search_order[agg_level_search_index++] = i; + } +} int get_cce_index(const gNB_MAC_INST *nrmac, const int CC_id, @@ -3448,6 +3454,25 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, slot_t slot, nfapi_nr_dl_tt } } +static void nr_mac_interrupt_ue_transmission(gNB_MAC_INST *mac, NR_UE_info_t *UE, int slots, int slots_per_frame) +{ + DevAssert(mac != NULL); + DevAssert(UE != NULL); + NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); + + nr_timer_setup(&UE->UE_sched_ctrl.transm_interrupt, slots, 1); + nr_timer_start(&UE->UE_sched_ctrl.transm_interrupt); + + // it might happen that timing advance command should be sent during the UE inactivity time. + // To prevent this, delay next TA command just after the UE inactivity time. + const int inactive_frames = slots / slots_per_frame + 1; + if ((UE->UE_sched_ctrl.ta_frame - mac->frame + MAX_FRAME_NUMBER) % MAX_FRAME_NUMBER < inactive_frames) + UE->UE_sched_ctrl.ta_frame = (mac->frame + inactive_frames) % MAX_FRAME_NUMBER; + + LOG_D(NR_MAC, "UE %04x: Interrupt UE transmission (%d slots)\n", UE->rnti, slots); +} + + void nr_measgap_scheduling(gNB_MAC_INST *nr_mac, frame_t frame, sub_frame_t slot) { NR_SCHED_ENSURE_LOCKED(&nr_mac->sched_lock); @@ -3517,25 +3542,6 @@ int nr_mac_get_reconfig_delay_slots(NR_SubcarrierSpacing_t scs) return (delay_ms << scs) + sl_ahead; } -static int nr_mac_interrupt_ue_transmission(gNB_MAC_INST *mac, NR_UE_info_t *UE, int slots, int slots_per_frame) -{ - DevAssert(mac != NULL); - DevAssert(UE != NULL); - NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); - - nr_timer_setup(&UE->UE_sched_ctrl.transm_interrupt, slots, 1); - nr_timer_start(&UE->UE_sched_ctrl.transm_interrupt); - - // it might happen that timing advance command should be sent during the UE inactivity time. - // To prevent this, delay next TA command just after the UE inactivity time. - const int inactive_frames = slots / slots_per_frame + 1; - if ((UE->UE_sched_ctrl.ta_frame - mac->frame + MAX_FRAME_NUMBER) % MAX_FRAME_NUMBER < inactive_frames) - UE->UE_sched_ctrl.ta_frame = (mac->frame + inactive_frames) % MAX_FRAME_NUMBER; - - LOG_D(NR_MAC, "UE %04x: Interrupt UE transmission (%d slots)\n", UE->rnti, slots); - return 0; -} - static void nr_mac_ue_transmission_timeout(gNB_MAC_INST *mac, NR_UE_info_t *UE, int slots) { DevAssert(mac != NULL); @@ -4120,22 +4126,6 @@ bool nr_mac_get_new_rnti(NR_UEs_t *UEs, rnti_t *rnti) return loop < 100; // nothing found: loop count 100 } -/// @brief Orders PDCCH aggregation levels so that we first check desired aggregation level according to -/// pdcch_cl_adjust -/// @param agg_level_search_order in/out 5-element array of aggregation levels from 0 to 4 -/// @param pdcch_cl_adjust value from 0 to 1 indication channel impariments (0 - good channel, 1 - bad channel) -static void determine_aggregation_level_search_order(int agg_level_search_order[NUM_PDCCH_AGG_LEVELS], float pdcch_cl_adjust) -{ - int desired_agg_level_index = round(4 * pdcch_cl_adjust); - int agg_level_search_index = 0; - for (int i = desired_agg_level_index; i < NUM_PDCCH_AGG_LEVELS; i++) { - agg_level_search_order[agg_level_search_index++] = i; - } - for (int i = desired_agg_level_index - 1; i >= 0; i--) { - agg_level_search_order[agg_level_search_index++] = i; - } -} - /// @brief Update PDCCH closed loop adjust for UE depending on detection of feedback. /// @param sched_ctrl UE scheduling control info /// @param feedback_not_detected Whether feedback (PUSCH or HARQ) was detected diff --git a/radio/ETHERNET/if_defs.h b/radio/ETHERNET/if_defs.h index e357858137..9e5ec6818e 100644 --- a/radio/ETHERNET/if_defs.h +++ b/radio/ETHERNET/if_defs.h @@ -9,7 +9,7 @@ #include #ifndef LITE_COMPILATION -#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "PHY/if4_tools.h" #endif // ETH transport preference modes diff --git a/radio/fhi_72/oran_isolate.c b/radio/fhi_72/oran_isolate.c index ed330ed30e..a7624f92c5 100644 --- a/radio/fhi_72/oran_isolate.c +++ b/radio/fhi_72/oran_isolate.c @@ -205,7 +205,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot) .prach_buf = NULL, }; - prach_item_t *prach_id = find_nr_prach(&ru->gNB_list[0]->prach_list, *frame, *slot, ru->nr_frame_parms->nb_antennas_rx, SEARCH_EXIST); + prach_item_t *prach_id = find_nr_prach(&ru->gNB_list[0]->prach_list, *frame, *slot, ru->nr_frame_parms->nb_antennas_rx, NR_SEARCH_EXIST); if (prach_id) { struct xran_fh_config *fh_cfg = get_xran_fh_config(0); int slots_per_subframe = 1 << fh_cfg->frame_conf.nNumerology; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml index b5b5708811..735c15ca1c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml @@ -21,7 +21,7 @@ gNBs: # Physical parameters: do_CSIRS: 1 do_SRS: 1 - first_active_bwp: 1; + first_active_bwp: 1 bwp_list: - scs: 1