diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 7b75cf82c5..e2851abc25 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -2535,7 +2535,7 @@ class OaiCiTest(): if (os.path.isfile('iperf_server_' + self.testCase_id + '.log')): os.remove('iperf_server_' + self.testCase_id + '.log') SSH.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log') - filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log' + filename='iperf_server_' + self.testCase_id + '_OAI-UE.log' self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options,filename,0) # copying on the EPC server for logCollection diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 7079773a34..c23541127c 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -130,12 +130,16 @@ class RANManagement(): result = re.search('--eNBocp', self.Build_eNB_args) if result is not None: self.air_interface[self.eNB_instance] = 'ocp-enb' - else: - result = re.search('--gNB', self.Build_eNB_args) + else: + result = re.search('--RU', self.Build_eNB_args) if result is not None: - self.air_interface[self.eNB_instance] = 'nr-softmodem' + self.air_interface[self.eNB_instance] = 'oairu' else: - self.air_interface[self.eNB_instance] = 'lte-softmodem' + result = re.search('--gNB', self.Build_eNB_args) + if result is not None: + self.air_interface[self.eNB_instance] = 'nr-softmodem' + else: + self.air_interface[self.eNB_instance] = 'lte-softmodem' # Worakround for some servers, we need to erase completely the workspace if self.Build_eNB_forced_workspace_cleanup: @@ -296,7 +300,7 @@ class RANManagement(): mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) mySSH.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5) #-qq quiet / -u update orcreate files - mySSH.command('unzip -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5) + mySSH.command('unzip -o -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5) mySSH.command('rm -f tmp_build' + testcaseId + '.zip', '\$', 5) mySSH.close() else: diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index c4fa817b06..105c95786f 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -309,14 +309,14 @@ function report_test { NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG` - if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] + if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] then echo "
" >> ./test_simulator_results.html
- if [ $NB_ENB_GOT_SYNC -eq 1 ]
+ if [ $NB_ENB_GOT_SYNC -gt 0 ]
then
echo "- eNB --> got sync" >> ./test_simulator_results.html
else
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index cb751c3830..fc35370e0a 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -1235,9 +1235,9 @@ function start_rf_sim_gnb {
then
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
then
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
else #RA test => use --do-ra option
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
diff --git a/ci-scripts/xml_files/multi_rru_band38_build.xml b/ci-scripts/xml_files/multi_rru_band38_build.xml
index ba45eab10a..1370a3a396 100644
--- a/ci-scripts/xml_files/multi_rru_band38_build.xml
+++ b/ci-scripts/xml_files/multi_rru_band38_build.xml
@@ -26,7 +26,7 @@
wrench
010101 010102 010103
- 000101 000102 000103
+ 000102 000103 000101
@@ -50,7 +50,7 @@
Build_eNB
Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
True
@@ -59,7 +59,7 @@
WaitEndBuild_eNB
Wait for end of Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
@@ -67,7 +67,7 @@
Build_eNB
Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
True
@@ -76,7 +76,7 @@
WaitEndBuild_eNB
Wait for end of Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 78192fbf56..ea14da19db 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -62,6 +62,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
endif (${RF_BOARD} STREQUAL "OAI_USRP")
+message("RU=${RU}")
+
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
if(NOT ${OPENPGM_FOUND})
message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
@@ -437,6 +439,9 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
+if (${RU} STREQUAL 1)
+add_definitions(-DNO_RRC)
+endif (${RU} STREQUAL 1)
# RRC
######
@@ -448,8 +453,11 @@ add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
- RESULT_VARIABLE ret)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
+ RESULT_VARIABLE ret)
+endif (${RU} STREQUAL 0)
+
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
@@ -477,13 +485,16 @@ add_definitions(-DNR_RRC_VERSION=${NR_RRC_VERSION})
set (NR_RRC_FULL_DIR ${asn1_generated_dir}/RRC_${NR_RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif ()
file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c)
file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h)
+endif (${RU} STREQUAL 0)
+
add_custom_target (
nr_rrc_flag ALL
${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
@@ -511,31 +522,33 @@ set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE})
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
-file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+ file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+endif (${RU} STREQUAL 0)
-add_custom_target (
- s1ap_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
-)
-
-add_library(S1AP_LIB
- ${S1AP_source}
- ${S1AP_DIR}/s1ap_common.c
+ add_custom_target (
+ s1ap_flag ALL
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
+ DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
)
-add_dependencies(S1AP_LIB rrc_flag s1ap_flag)
-include_directories ("${S1AP_C_DIR}")
-include_directories ("${S1AP_DIR}")
+ add_library(S1AP_LIB
+ ${S1AP_source}
+ ${S1AP_DIR}/s1ap_common.c
+ )
+ add_dependencies(S1AP_LIB rrc_flag s1ap_flag)
+
+ include_directories ("${S1AP_C_DIR}")
+ include_directories ("${S1AP_DIR}")
add_library(S1AP_ENB
- ${S1AP_DIR}/s1ap_eNB.c
- ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
+ ${S1AP_DIR}/s1ap_eNB.c
+ ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c
${S1AP_DIR}/s1ap_eNB_encoder.c
${S1AP_DIR}/s1ap_eNB_handlers.c
@@ -631,11 +644,13 @@ set(M2AP_ASN_DIR ${M2AP_DIR}/MESSAGES/ASN1/${M2AP_RELEASE})
set(M2AP_C_DIR ${asn1_generated_dir}/M2AP_${M2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps -DEMIT_ASN_DEBUG=1
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps -DEMIT_ASN_DEBUG=1
RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M2AP_source ${M2AP_C_DIR}/*.c)
@@ -701,11 +716,13 @@ set(M3AP_ASN_DIR ${M3AP_DIR}/MESSAGES/ASN1/${M3AP_RELEASE})
set(M3AP_C_DIR ${asn1_generated_dir}/M3AP_${M3AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M3AP_source ${M3AP_C_DIR}/*.c)
@@ -755,11 +772,13 @@ add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE})
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
@@ -794,7 +813,6 @@ add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag)
# F1AP
##############
-set (F1AP_RELEASE R16)
add_list1_option(F1AP_RELEASE R16 "F1AP ASN.1 grammar version" R16)
set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
if (${F1AP_RELEASE} STREQUAL "R16")
@@ -812,17 +830,18 @@ set(F1AP_ASN_FILES
${F1AP_ASN_DIR}/F1AP-Containers.asn
)
-set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
-message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
-execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
- COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
- RESULT_VARIABLE ret
- OUTPUT_QUIET
- ERROR_QUIET)
+if (${RU} STREQUAL 0)
+ set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
+ message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
+ execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
+ COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ RESULT_VARIABLE ret
+ OUTPUT_QUIET
+ ERROR_QUIET)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "asn1c: error")
-endif (NOT ${ret} STREQUAL 0)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "asn1c: error")
+ endif (NOT ${ret} STREQUAL 0)
file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
add_library(F1AP_LIB
@@ -837,6 +856,8 @@ add_library(F1AP
${F1AP_C_FILES}
)
+endif (${RU} STREQUAL 0)
+
# Hardware dependant options
###################################
@@ -1643,7 +1664,6 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
- ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/dfts_load.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
@@ -2911,6 +2931,8 @@ add_executable(lte-softmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2952,6 +2974,8 @@ add_executable(ocp-enb
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2996,6 +3020,33 @@ target_link_libraries(du_test
${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
)
+add_executable(oairu
+ ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
+ ${OPENAIR_TARGETS}/RT/USER/ru_control.c
+ ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
+ ${OPENAIR_DIR}/executables/softmodem-common.c
+ ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c
+ ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
+ ${OPENAIR_DIR}/executables/main_ru.c
+ ${T_SOURCE}
+ ${OPENAIR_DIR}/common/utils/LOG/log.c
+ ${CONFIG_SOURCES}
+ ${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${SHLIB_LOADER_SOURCES}
+)
+target_link_libraries (oairu
+ -Wl,--start-group
+ SCHED_RU_LIB
+ PHY_COMMON PHY_RU
+ -Wl,--end-group z dl)
+
+target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB})
+
+
# lte-uesoftmodem is UE implementation
#######################################
@@ -3004,9 +3055,6 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
- ${OPENAIR_TARGETS}/RT/USER/ru_control.c
- ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
@@ -3018,6 +3066,8 @@ add_executable(lte-uesoftmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3064,6 +3114,8 @@ add_executable(nr-softmodem
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.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
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
@@ -3411,6 +3463,9 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${XFORMS_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/core.py b/cmake_targets/autotests/core.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/log.py b/cmake_targets/autotests/log.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/index.html b/cmake_targets/autotests/templates/index.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/testcase_report.html b/cmake_targets/autotests/templates/testcase_report.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
old mode 100644
new mode 100755
index b0511f63cc..29257e482f
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1099,8 +1099,9 @@
(Test14: 3 PTRS, 8 Interpolated Symbols),
(Test15: 6 PTRS, 5 Interpolated Symbols),
(Test16: 11 PTRS, 0 Interpolated Symbols),
- (Test17: 2 DMRS Symbols),
- (Test18: 3 DMRS Symbols)
+ (Test17: Mapping type A, 2 DMRS Symbols),
+ (Test18: Mapping type A, 3 DMRS Symbols),
+ (Test19: Mapping type B, 4 DMRS Symbols)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1124,8 +1125,9 @@
-n100 -s5 -T 2 1 2
-n100 -s5 -T 2 0 4
-n100 -s2 -U 2 0 1
- -n100 -s2 -U 2 0 2
- nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18
+ -n100 -s2 -U 2 0 2
+ -n100 -s2 -U 2 1 3
+ nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19
PDSCH test OK
segmentation fault|assertion|exiting|fatal
3
@@ -1287,15 +1289,16 @@
(Test3: MCS 28 50 PRBs),
(Test4: MCS 9 217 PRBs),
(Test5: MCS 9 273 PRBs),
- (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
- (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
- (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
- (Test9: SC-FDMA, 50 PRBs),
- (Test10: SC-FDMA, 75 PRBs),
- (Test11: SC-FDMA, 216 PRBs),
- (Test12: SC-FDMA, 273 PRBs),
- (Test13: SC-FDMA, 3 DMRS),
- (Test14: MCS 16 50 PRBs 2 RX_Antenna)
+ (Test6: DMRS Type A, 2 DMRS Symbols),
+ (Test7: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
+ (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
+ (Test9: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
+ (Test10: SC-FDMA, 50 PRBs),
+ (Test11: SC-FDMA, 75 PRBs),
+ (Test12: SC-FDMA, 216 PRBs),
+ (Test13: SC-FDMA, 273 PRBs),
+ (Test14: SC-FDMA, 3 DMRS),
+ (Test15: MCS 16 50 PRBs 2 RX_Antenna)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1307,6 +1310,7 @@
-n100 -m28 -s20
-n100 -m9 -R217 -r217 -s5
-n100 -m9 -R273 -r273 -s5
+ -n100 -s5 -U 2 0 1
-n100 -s5 -T 2 1 2 -U 2 0 2
-n100 -s5 -T 2 2 2 -U 2 1 2
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
@@ -1317,7 +1321,7 @@
-n100 -s2 -Z -U 2 0 2
-n100 -m16 -s10 -z2
- nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14
+ nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15
PUSCH test OK
segmentation fault|assertion|exiting|fatal
3
diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml b/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest.py b/cmake_targets/autotests/tools/lib_autotest.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/wdial.bandrich.conf b/cmake_targets/autotests/tools/wdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/3276.txt b/cmake_targets/autotests/v2/actions/3276.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc.bash b/cmake_targets/autotests/v2/actions/alu_epc.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc_stop.bash b/cmake_targets/autotests/v2/actions/alu_epc_stop.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_hss.bash b/cmake_targets/autotests/v2/actions/alu_hss.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/bandrich.txt b/cmake_targets/autotests/v2/actions/bandrich.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_tcp.bash b/cmake_targets/autotests/v2/actions/client_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_udp.bash b/cmake_targets/autotests/v2/actions/client_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/clone_repository.bash b/cmake_targets/autotests/v2/actions/clone_repository.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/compilation.bash b/cmake_targets/autotests/v2/actions/compilation.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution.bash b/cmake_targets/autotests/v2/actions/execution.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution_compile.bash b/cmake_targets/autotests/v2/actions/execution_compile.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/modem.py b/cmake_targets/autotests/v2/actions/modem.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/run_enb.bash b/cmake_targets/autotests/v2/actions/run_enb.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_tcp.bash b/cmake_targets/autotests/v2/actions/server_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_udp.bash b/cmake_targets/autotests/v2/actions/server_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.bash b/cmake_targets/autotests/v2/actions/start_3276.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.py b/cmake_targets/autotests/v2/actions/start_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.bash b/cmake_targets/autotests/v2/actions/start_bandrich.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.py b/cmake_targets/autotests/v2/actions/start_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_3276.py b/cmake_targets/autotests/v2/actions/stop_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_bandrich.py b/cmake_targets/autotests/v2/actions/stop_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.3276.conf b/cmake_targets/autotests/v2/actions/wvdial.3276.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf b/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/alu_test.py b/cmake_targets/autotests/v2/alu_test.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/connection.py b/cmake_targets/autotests/v2/connection.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/machine_list.py b/cmake_targets/autotests/v2/machine_list.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/main.py b/cmake_targets/autotests/v2/main.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/task.py b/cmake_targets/autotests/v2/task.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/utils.py b/cmake_targets/autotests/v2/utils.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index d59cada4e0..6277fb1c10 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -66,6 +66,7 @@ UE_DEBUG_TRACE="False"
UE_TIMING_TRACE="False"
USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
+NR="False"
ITTI_SIM="False"
RFSIM_NAS="False"
SANITIZE_ADDRESS="False"
@@ -104,6 +105,8 @@ Options
Makes the NR softmodem
--nrUE
Makes the NR UE softmodem
+--RU
+ Makes the OAI RRU (without full stack)
--UE
Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
--UE-conf-nvram [configuration file]
@@ -241,27 +244,38 @@ function main() {
shift;;
--eNB)
eNB=1
+ RU=0
echo_info "Will compile eNB"
shift;;
--eNBocp)
eNBocp=1
+ RU=0
echo_info "Will compile OCP eNB"
shift;;
--gNB)
gNB=1
+ RU=0
+ NR="True"
echo_info "Will compile gNB"
shift;;
+ --RU)
+ RU=1
+ echo_info "Will compile RRU"
+ shift;;
-a | --agent)
echo_info "FlexRAN support is always compiled into the eNB"
shift;;
--UE)
+ RU=0
UE=1
echo_info "Will compile UE"
shift;;
--nrUE)
+ RU=0
nrUE=1
rfsimNas=1
RFSIM_NAS="True"
+ NR="True"
echo_info "Will compile NR UE"
shift;;
--mu)
@@ -296,6 +310,7 @@ function main() {
shift 2;;
-P | --phy_simulators)
SIMUS_PHY=1
+ RU=0
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-S | --core_simulators)
@@ -464,7 +479,7 @@ function main() {
########################################################
# to be discussed
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" -o "$RU" = "1" ] ; then
if [ "$HW" = "None" -a "$TP" = "None" ] ; then
echo_info "No local radio head and no transport protocol selected"
fi
@@ -591,7 +606,7 @@ function main() {
config_libconfig_shlib=params_libconfig
# first generate the CMakefile in the right directory
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then
# softmodem compilation
@@ -615,6 +630,7 @@ function main() {
echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
+ echo "set ( RU $RU )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
@@ -632,6 +648,9 @@ function main() {
if [ "$gNB" = "1" ] ; then
execlist="$execlist nr-softmodem"
fi
+ if [ "$RU" = "1" ] ; then
+ execlist="$execlist oairu"
+ fi
if [ "$UE" = 1 ] ; then
execlist="$execlist lte-uesoftmodem"
fi
@@ -660,28 +679,29 @@ function main() {
$build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
- compilations \
- $build_dir coding \
- libcoding.so $dbin/libcoding.so
-
-
- #check if we run inside a container or not
- #IS_CONTAINER variable is defined in build_helper file
- #compile nasmesh and rb_tool only if NOT running in a container
- if [ $IS_CONTAINER -eq 0 ]
- then
- compilations \
- $build_dir nasmesh \
- CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ if [ "$RU" = "0" ] ; then
compilations \
- $build_dir rb_tool \
- rb_tool $dbin/rb_tool
+ $build_dir coding \
+ libcoding.so $dbin/libcoding.so
- cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
- fi #IS_CONTAINER
+ #check if we run inside a container or not
+ #IS_CONTAINER variable is defined in build_helper file
+ #compile nasmesh and rb_tool only if NOT running in a container
+ if [ $IS_CONTAINER -eq 0 ]
+ then
+ compilations \
+ $build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+
+ compilations \
+ $build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+
+ cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+ fi #IS_CONTAINER
+ fi
fi
-
fi
if [ "$UE" = 1 ] ; then
@@ -863,7 +883,7 @@ function main() {
####################################################
# Build RF device and transport protocol libraries #
####################################################
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
# build RF device libraries
if [ "$HW" != "None" ] ; then
diff --git a/cmake_targets/doxygen/CMakeLists.txt b/cmake_targets/doxygen/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt
old mode 100644
new mode 100755
index 447e90bcab..f8c659959f
--- a/cmake_targets/phy_simulators/CMakeLists.txt
+++ b/cmake_targets/phy_simulators/CMakeLists.txt
@@ -17,4 +17,5 @@ set ( UE_TIMING_TRACE False )
set ( USRP_REC_PLAY False )
set ( SKIP_SHARED_LIB_FLAG False )
set ( PHYSIM True)
+set ( RU 0)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/Kbuild.cmake b/cmake_targets/tools/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeParseArguments.cmake b/cmake_targets/tools/MODULES/CMakeParseArguments.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake b/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake b/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake b/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindFreeDiameter.cmake b/cmake_targets/tools/MODULES/FindFreeDiameter.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGCCXML.cmake b/cmake_targets/tools/MODULES/FindGCCXML.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGcrypt.cmake b/cmake_targets/tools/MODULES/FindGcrypt.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGnuTLS.cmake b/cmake_targets/tools/MODULES/FindGnuTLS.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindKbuild.cmake b/cmake_targets/tools/MODULES/FindKbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindLibXml2.cmake b/cmake_targets/tools/MODULES/FindLibXml2.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindMySQL.cmake b/cmake_targets/tools/MODULES/FindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindNettle.cmake b/cmake_targets/tools/MODULES/FindNettle.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindPostgreSQL.cmake b/cmake_targets/tools/MODULES/FindPostgreSQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindSCTP.cmake b/cmake_targets/tools/MODULES/FindSCTP.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/Kbuild.cmake b/cmake_targets/tools/MODULES/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/cmake_useful.cmake b/cmake_targets/tools/MODULES/cmake_useful.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kbuild_system.cmake b/cmake_targets/tools/MODULES/kbuild_system.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kmodule.cmake b/cmake_targets/tools/MODULES/kmodule.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/path_prefixes.cmake b/cmake_targets/tools/MODULES/path_prefixes.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 9b8363fc2b..fb3f2e7b9a 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -113,6 +113,7 @@ check_supported_distribution() {
"rhel7.6") return 0 ;;
"rhel7.7") return 0 ;;
"rhel7.8") return 0 ;;
+ "rhel7.9") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
@@ -320,7 +321,7 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd
- git checkout tags/v4.0.0.0
+ git checkout tags/v3.14.0.0
mkdir -p host/build
cd host/build
$CMAKE ../
diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2arxg.lime b/cmake_targets/tools/exmimo2_2arxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2brxg.lime b/cmake_targets/tools/exmimo2_2brxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo_stop_octave.m b/cmake_targets/tools/exmimo_stop_octave.m
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff b/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper
old mode 100644
new mode 100755
diff --git a/common/ran_context.h b/common/ran_context.h
index 3f57c000a0..5a18225329 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -39,7 +39,7 @@
#include "PHY/types.h"
#include "PHY/impl_defs_top.h"
-#include "ENB_APP/enb_config.h"
+//#include "ENB_APP/enb_config.h"
#include "flexran_agent_defs.h"
#include "gtpv1u.h"
diff --git a/common/utils/lte/prach_utils.c b/common/utils/lte/prach_utils.c
new file mode 100644
index 0000000000..9ef29e55a5
--- /dev/null
+++ b/common/utils/lte/prach_utils.c
@@ -0,0 +1,425 @@
+/*
+ * 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 common/utils/lte/prach_utils.c
+ * \brief utils for PRACH common to both PHY and MAC
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include
+
+
+#include "PHY/LTE_TRANSPORT/transport_common.h"
+
+// This is table 5.7.1-4 from 36.211
+PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
+ // TDD Configuration Index 0
+ { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
+ // TDD Configuration Index 1
+ { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
+ // TDD Configuration Index 2
+ { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
+ // TDD Configuration Index 3
+ { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
+ // TDD Configuration Index 4
+ { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
+ // TDD Configuration Index 5
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+ // TDD Configuration Index 6
+ { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 7
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+ // TDD Configuration Index 8
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
+ // TDD Configuration Index 9
+ { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 10
+ { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
+ // TDD Configuration Index 11
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
+ // TDD Configuration Index 12
+ { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
+ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
+ {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 13
+ { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 14
+ { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 15
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
+ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 16
+ { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 17
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 18
+ { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
+ },
+ // TDD Configuration Index 19
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
+ },
+ // TDD Configuration Index 20
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+ // TDD Configuration Index 21
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 22
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 23
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 24
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 25
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 26
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 27
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 28
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 29
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+
+ // TDD Configuration Index 30
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+
+ // TDD Configuration Index 31
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 32
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 33
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 34
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 35
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 36
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 37
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 38
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 39
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+ // TDD Configuration Index 40
+ { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
+ // TDD Configuration Index 41
+ { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
+
+ // TDD Configuration Index 42
+ { {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 43
+ { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 44
+ { {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 45
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
+
+ // TDD Configuration Index 46
+ { {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
+
+ // TDD Configuration Index 47
+ { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
+ }
+};
+
+
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) {
+ if (frame_type == FDD) // FDD
+ return(prach_ConfigIndex>>4);
+ else {
+ if (prach_ConfigIndex < 20)
+ return (0);
+
+ if (prach_ConfigIndex < 30)
+ return (1);
+
+ if (prach_ConfigIndex < 40)
+ return (2);
+
+ if (prach_ConfigIndex < 48)
+ return (3);
+ else
+ return (4);
+ }
+}
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf) {
+ uint8_t n_ra_prb;
+ uint8_t f_ra,t1_ra;
+ uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
+ uint8_t Nsp=2;
+
+ if (frame_type == TDD) { // TDD
+ if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
+ LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
+ return(-1);
+ }
+
+ // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
+ f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
+
+ if (prach_fmt < 4) {
+ if ((f_ra&1) == 0) {
+ n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
+ } else {
+ n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
+ }
+ } else {
+ if ((tdd_config >2) && (tdd_config<6))
+ Nsp = 2;
+
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+
+ if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
+ n_ra_prb = 6*f_ra;
+ } else {
+ n_ra_prb = N_RB_UL - 6*(f_ra+1);
+ }
+ }
+ } else { //FDD
+ n_ra_prb = n_ra_prboffset;
+ }
+
+ return(n_ra_prb);
+}
+
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
+ uint8_t t0_ra;
+ uint8_t t1_ra;
+ uint8_t t2_ra;
+ int prach_mask = 0;
+
+ if (frame_type == FDD) { //FDD
+ //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
+ if ((((frame&1) == 1) && (subframe < 9)) ||
+ (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
+ if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
+ ((prach_ConfigIndex&0x1f)==18) || // 18,50
+ ((prach_ConfigIndex&0xf)==15)) // 15,47
+ return(0);
+
+ switch (prach_ConfigIndex&0x1f) {
+ case 0:
+ case 3:
+ if (subframe==1) prach_mask = 1;
+
+ break;
+
+ case 1:
+ case 4:
+ if (subframe==4) prach_mask = 1;
+
+ break;
+
+ case 2:
+ case 5:
+ if (subframe==7) prach_mask = 1;
+
+ break;
+
+ case 6:
+ if ((subframe==1) || (subframe==6)) prach_mask=1;
+
+ break;
+
+ case 7:
+ if ((subframe==2) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 8:
+ if ((subframe==3) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 9:
+ if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 10:
+ if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 11:
+ if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
+
+ break;
+
+ case 12:
+ if ((subframe&1)==0) prach_mask=1;
+
+ break;
+
+ case 13:
+ if ((subframe&1)==1) prach_mask=1;
+
+ break;
+
+ case 14:
+ prach_mask=1;
+ break;
+
+ case 15:
+ if (subframe==9) prach_mask=1;
+
+ break;
+ }
+ } else { // TDD
+ AssertFatal(prach_ConfigIndex<64,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+ t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
+#ifdef PRACH_DEBUG
+ LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
+ prach_ConfigIndex,
+ subframe,
+ t0_ra,t1_ra,t2_ra);
+#endif
+
+ if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
+ ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
+ (t0_ra == 0)) && // PRACH is in all frames
+ (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
+ (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
+ if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
+ (((subframe%5)-2)==t2_ra)) prach_mask=1;
+ else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
+ }
+ }
+
+ return(prach_mask);
+}
+
diff --git a/common/utils/lte/prach_utils.h b/common/utils/lte/prach_utils.h
new file mode 100644
index 0000000000..995805fbd2
--- /dev/null
+++ b/common/utils/lte/prach_utils.h
@@ -0,0 +1,40 @@
+/*
+ * 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 common/utils/prach_utils.h
+* \brief computation of some PRACH variables used in both MAC and PHY
+* \author R. Knopp
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
+* \note
+* \warning
+*/
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf);
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c
new file mode 100644
index 0000000000..b377abf2ff
--- /dev/null
+++ b/common/utils/lte/ue_power.c
@@ -0,0 +1,108 @@
+/*
+ * 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 ue_power.c
+* \brief Routines to compute UE TX power according to 36.213
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+#include
+#include
+#include "PHY/defs_eNB.h"
+#include "PHY/TOOLS/dB_routines.h"
+
+extern int16_t hundred_times_delta_TF[100];
+extern uint16_t hundred_times_log10_NPRB[100];
+
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
+{
+
+ /// The payload + CRC size in bits, "B"
+ uint32_t B;
+ /// Number of code segments
+ uint32_t C;
+ /// Number of "small" code segments
+ uint32_t Cminus;
+ /// Number of "large" code segments
+ uint32_t Cplus;
+ /// Number of bits in "small" code segments (<6144)
+ uint32_t Kminus;
+ /// Number of bits in "large" code segments (<6144)
+ uint32_t Kplus;
+ /// Total number of bits across all segments
+ uint32_t sumKr;
+ /// Number of "Filler" bits
+ uint32_t F;
+ // num resource elements
+ uint32_t num_re=0.0;
+ // num symbols
+ uint32_t num_symb=0.0;
+ /// effective spectral efficiency of the PUSCH
+ uint32_t MPR_x100=0;
+ /// beta_offset
+ uint16_t beta_offset_pusch_x8=8;
+ /// delta mcs
+ float delta_mcs=0.0;
+ /// bandwidth factor
+ float bw_factor=0.0;
+
+ B= tbs+24;
+ lte_segmentation(NULL,
+ NULL,
+ B,
+ &C,
+ &Cplus,
+ &Cminus,
+ &Kplus,
+ &Kminus,
+ &F);
+
+
+ sumKr = Cminus*Kminus + Cplus*Kplus;
+ num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
+ num_re = num_symb * nb_rb * 12;
+
+ if (num_re == 0)
+ return(0);
+
+ MPR_x100 = 100*sumKr/num_re;
+
+ if (control_only == 1 )
+ beta_offset_pusch_x8=8; // fixme
+
+ //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
+
+ // if deltamcs_enabledm
+ delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
+
+ bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0);
+ LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
+ (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
+ return (int16_t)ceil(delta_mcs + bw_factor);
+
+}
+
diff --git a/targets/RT/USER/rfsim.h b/common/utils/lte/ue_power.h
similarity index 69%
rename from targets/RT/USER/rfsim.h
rename to common/utils/lte/ue_power.h
index 801ab5eb56..caeebec2c8 100644
--- a/targets/RT/USER/rfsim.h
+++ b/common/utils/lte/ue_power.h
@@ -18,23 +18,17 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
-#ifndef __RFSIM__H__
-#define __RFSIM__H__
-#include "lte-softmodem.h"
-#include "openair1/SIMULATION/TOOLS/sim.h"
-#include "platform_constants.h"
-#include "common/ran_context.h"
-#include "PHY/defs_UE.h"
-#include "PHY/defs_eNB.h"
-void init_ocm(void);
+/*! \file ue_power.h
+* \brief support routines used in MAC and PHY
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
-void update_ocm(double snr_dB,double sinr_dB);
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
-//extern pthread_mutex_t async_server_lock;
-//extern pthread_cond_t async_server_notify;
-//extern int async_server_shutdown;
-
-void init_channel_vars(void);
-
-#endif
diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index 5283ce5eaa..438edb4044 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -750,7 +750,7 @@ void phy_procedures_eNB_uespec_RX_fromsplit(uint8_t *bufferZone, int nbBlocks,PH
recvFs6Ul(bufferZone, nbBlocks, eNB, ul_propa);
// dirty memory allocation in OAI...
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++)
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++)
if ( eNB->uci_vars[i].frame == proc->frame_rx &&
eNB->uci_vars[i].subframe == proc->subframe_rx )
eNB->uci_vars[i].active=0;
@@ -1145,7 +1145,7 @@ void appendFs6DLUEcch(uint8_t *bufferZone, PHY_VARS_eNB *eNB, int frame, int sub
commonUDP_t *newUDPheader=(commonUDP_t *) firstFreeByte;
bool first_UE=true;
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) {
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
LTE_eNB_UCI *uci = &(eNB->uci_vars[i]);
if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) {
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index 962b738e25..c5f18419a3 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -205,7 +205,6 @@ void init_eNB_afterRU(void) {
for (int inst=0; instframe_parms.nb_antennas_rx = 0;
eNB->frame_parms.nb_antennas_tx = 0;
eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *));
@@ -231,12 +230,26 @@ void init_eNB_afterRU(void) {
for (int ce_level=0; ce_level<4; ce_level++)
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
- eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
}
}
- AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
- AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
+
+ AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+ AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+
+ phy_init_lte_eNB(eNB,0,0);
+
+ // need to copy rxdataF after L1 variables are allocated
+ for (int inst=0; instnum_RU; ru_id++) {
+ for (int i=0; iRU_list[ru_id]->nb_rx; aa++,i++)
+ eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
+ }
+ }
+ }
+
LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx);
init_transport(eNB);
//init_precoding_weights(RC.eNB[inst][CC_id]);
@@ -803,7 +816,7 @@ int init_rf(RU_t *ru) {
pthread_setname_np(pthread_self(),name);
return ret;
}
-
+
void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) {
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i;
diff --git a/executables/main_ru.c b/executables/main_ru.c
new file mode 100644
index 0000000000..93a580560e
--- /dev/null
+++ b/executables/main_ru.c
@@ -0,0 +1,382 @@
+/*
+ * 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 oairu.c
+ * \brief Top-level threads for radio-unit
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#define _GNU_SOURCE /* See feature_test_macros(7) */
+#include
+
+
+
+
+#include "assertions.h"
+#include "PHY/types.h"
+
+#include "PHY/defs_RU.h"
+#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
+
+
+#include "../../ARCH/COMMON/common_lib.h"
+#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
+
+
+#include "PHY/phy_vars.h"
+#include "SCHED/sched_common_vars.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
+#include
+#include
+
+static int DEFBANDS[] = {7};
+static int DEFENBS[] = {0};
+static int DEFBFW[] = {0x00007fff};
+
+THREAD_STRUCT thread_struct;
+
+pthread_cond_t sync_cond;
+pthread_mutex_t sync_mutex;
+int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
+
+volatile int oai_exit = 0;
+uint16_t sf_ahead = 4;
+RU_t ru_m;
+
+
+extern void init_RU0(RU_t *ru,int ru_id,char *rf_config_file, int send_dmrssync);
+extern void init_RU_proc(RU_t *ru);
+extern void kill_RU_proc(RU_t *ru);
+extern void set_function_spec_param(RU_t *ru);
+
+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) {
+
+ if (s != NULL) {
+ printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
+ }
+ close_log_mem();
+ oai_exit = 1;
+
+ if (ru_m.rfdevice.trx_end_func) {
+ ru_m.rfdevice.trx_end_func(&ru_m.rfdevice);
+ ru_m.rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru_m.ifdevice.trx_end_func) {
+ 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);
+}
+
+
+static void get_options(void) {
+ CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
+ get_common_options(SOFTMODEM_ENB_BIT );
+ CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
+
+ //RCConfig();
+
+}
+
+
+
+
+
+extern void phy_free_RU(RU_t *);
+
+nfapi_mode_t nfapi_getmode(void) {
+ return(NFAPI_MODE_PNF);
+}
+
+void oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
+
+ AssertFatal(1==0,"This is bad ... please check why we get here\n");
+}
+
+void wait_eNBs(void){ return; }
+
+uint64_t downlink_frequency[MAX_NUM_CCs][4];
+
+
+int main ( int argc, char **argv )
+{
+
+ if ( load_configmodule(argc,argv,0) == NULL) {
+ exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+ }
+
+ logInit();
+ printf("Reading in command-line options\n");
+ get_options ();
+
+ if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
+ fprintf(stderr,"Getting configuration failed\n");
+ exit(-1);
+ }
+
+#if T_TRACER
+ T_Config_Init();
+#endif
+ printf("configuring for RRU\n");
+
+#ifndef PACKAGE_VERSION
+# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
+#endif
+ LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
+
+ /* Read configuration */
+
+ printf("About to Init RU threads\n");
+
+
+ RU_t *ru=&ru_m;
+
+ paramdef_t RUParams[] = RUPARAMS_DESC;
+ paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
+ config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
+
+ int j=0;
+ uint64_t ru_mask=1;
+ pthread_mutex_t ru_mutex; pthread_mutex_init(&ru_mutex,NULL);
+ pthread_cond_t ru_cond; pthread_cond_init(&ru_cond,NULL);
+
+ ru->ru_mask= &ru_mask;
+ ru->ru_mutex = &ru_mutex;
+ ru->ru_cond = &ru_cond;
+
+ ru->if_timing = synch_to_ext_device;
+ ru->num_eNB = 0;
+ ru->has_ctrl_prt = 1;
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) {
+ ru->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr));
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.clock_source = internal;
+ LOG_D(PHY, "RU clock source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.clock_source = external;
+ LOG_D(PHY, "RU clock source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.clock_source = gpsdo;
+ LOG_D(PHY, "RU clock source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.clock_source = unset;
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.time_source = internal;
+ LOG_D(PHY, "RU time source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.time_source = external;
+ LOG_D(PHY, "RU time source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.time_source = gpsdo;
+ LOG_D(PHY, "RU time source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.time_source = unset;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
+ if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
+ AssertFatal(1==0,"IF_NAME is required\n");
+ } else {
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ // Check if control port set
+ if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ) {
+ printf("Removing control port for RU %d\n",j);
+ ru->has_ctrl_prt = 0;
+ } else {
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ printf(" Control port %u \n",ru->eth_params.my_portc);
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
+ }
+
+ printf("RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+
+ printf("RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) ru->ota_sync_enable=1;
+ else ru->ota_sync_enable=0;
+ }
+
+ ru->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
+ ru->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
+ ru->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
+ /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
+ ru->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr);
+
+ for (int i=0; inum_bands; i++) ru->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
+ } //strcmp(local_rf, "yes") == 0
+ else {
+ printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+ } /* strcmp(local_rf, "yes") != 0 */
+
+ ru->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
+ ru->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
+ ru->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
+ ru->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
+
+
+ set_worker_conf("WORKER_ENABLE");
+
+ mlockall(MCL_CURRENT | MCL_FUTURE);
+ pthread_cond_init(&sync_cond,NULL);
+ pthread_mutex_init(&sync_mutex, NULL);
+
+ init_RU0(ru,0,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync);
+ ru->rf_map.card=0;
+ ru->rf_map.chain=(get_softmodem_params()->chain_offset);
+
+ LOG_I(PHY, "Initializing RRU descriptor : (%s,%s,%d)\n", ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function);
+ set_function_spec_param(ru);
+ LOG_I(PHY, "Starting ru_thread , is_slave %d, send_dmrs %d\n", ru->is_slave, ru->generate_dmrs_sync);
+ init_RU_proc(ru);
+
+ pthread_mutex_lock(&ru_mutex);
+ while (ru_mask>0)
+ pthread_cond_wait(&ru_cond,&ru_mutex);
+ pthread_mutex_unlock(&ru_mutex);
+ LOG_I(PHY,"RU configured, unlocking threads\n");
+ config_sync_var=0;
+ pthread_mutex_lock(&sync_mutex);
+ sync_var=0;
+ pthread_cond_broadcast(&sync_cond);
+ pthread_mutex_unlock(&sync_mutex);
+
+ while (oai_exit==0) sleep(1);
+ // stop threads
+
+ kill_RU_proc(ru);
+ phy_free_RU(ru);
+
+ free_lte_top();
+ end_configmodule();
+
+ if (ru->rfdevice.trx_end_func) {
+ ru->rfdevice.trx_end_func(&ru->rfdevice);
+ ru->rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru->ifdevice.trx_end_func) {
+ ru->ifdevice.trx_end_func(&ru->ifdevice);
+ ru->ifdevice.trx_end_func = NULL;
+ }
+
+
+
+ logClean();
+ printf("Bye.\n");
+ return 0;
+}
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index d52959f131..89857e98bb 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -163,10 +163,15 @@ int otg_enabled;
uint32_t timing_advance = 0;
uint64_t num_missed_slots=0; // counter for the number of missed slots
+#include
int split73=0;
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
AssertFatal(false, "Must not be called in this context\n");
}
+void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) {
+ AssertFatal(false, "Must not be called in this context\n");
+}
+
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index e4b4f11c0d..b6a2b18215 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -89,6 +89,8 @@ extern "C"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
#define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
#define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
+#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
+
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
@@ -257,6 +259,7 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+extern int usrp_tx_thread;
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
extern volatile int oai_exit;
diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
index fc9cd66077..8520a5d162 100644
--- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
+++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
@@ -27,7 +27,6 @@ extern "C" {
#include
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
-
#include
#include "openair1/PHY/defs_gNB.h"
diff --git a/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h
new file mode 100644
index 0000000000..f77ffff2eb
--- /dev/null
+++ b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h
@@ -0,0 +1,53 @@
+/*
+ * 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 __CODING_UNITARY_DEFS__h__
+#define __CODING_UNITARY_DEFS__h__
+int oai_exit=0;
+unsigned int NB_UE_INST = 1;
+#include "openair1/PHY/defs_UE.h"
+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) {
+ const char * msg= s==NULL ? "no comment": s;
+ printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
+ exit(-1);
+}
+
+signed char quantize(double D, double x, unsigned char B) {
+ double qxd;
+ short maxlev;
+ qxd = floor(x / D);
+ maxlev = 1 << (B - 1); //(char)(pow(2,B-1));
+
+ if (qxd <= -maxlev)
+ qxd = -maxlev;
+ else if (qxd >= maxlev)
+ qxd = maxlev - 1;
+
+ return ((char) qxd);
+}
+
+
+#endif
+
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index f6769251cd..91c5d59611 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -26,9 +26,11 @@
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrLDPC_extern.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
-#define MAX_NUM_DLSCH_SEGMENTS 16
+#include "openair1/PHY/defs_nr_common.h"
+#include "coding_unitary_defs.h"
+
#define MAX_BLOCK_LENGTH 8448
#ifndef malloc16
@@ -81,9 +83,6 @@ typedef struct {
int n_iter_max;
} n_iter_stats_t;
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
nrLDPC_encoderfunc_t encoder_orig;
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
@@ -117,7 +116,7 @@ int test_ldpc(short No_iteration,
sigma = 1.0/sqrt(2*SNR);
opp_enabled=1;
//short test_input[block_length];
- unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
+ unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
//short *c; //padded codeword
unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c
index e43ba507ab..8e7e377542 100644
--- a/openair1/PHY/CODING/TESTBENCH/polartest.c
+++ b/openair1/PHY/CODING/TESTBENCH/polartest.c
@@ -11,16 +11,12 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/coding_defs.h"
#include "SIMULATION/TOOLS/sim.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
//#include "common/utils/LOG/log.h"
-
+#include "coding_unitary_defs.h"
//#define DEBUG_DCI_POLAR_PARAMS
//#define DEBUG_POLAR_TIMING
//#define DEBUG_POLARTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
index f750d24977..c9ed678a8f 100644
--- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
@@ -1,13 +1,10 @@
#include
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+#include "coding_unitary_defs.h"
//#define DEBUG_SMALLBLOCKTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
index 18db8a01fb..8fe115b23a 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
@@ -40,9 +40,9 @@
#include "assertions.h"
int8_t polar_decoder(double *input,
- uint32_t *out,
- t_nrPolar_params *polarParams,
- uint8_t listSize)
+ uint32_t *out,
+ const t_nrPolar_params *polarParams,
+ uint8_t listSize)
{
//Assumes no a priori knowledge.
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
@@ -299,7 +299,7 @@ int8_t polar_decoder(double *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI) {
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
index a44a08a701..c2e9fd9381 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
@@ -138,22 +138,22 @@ typedef struct nrPolar_params t_nrPolar_params;
void polar_encoder(uint32_t *input,
uint32_t *output,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI);
void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
int8_t polar_decoder(double *input,
- uint32_t *output,
- t_nrPolar_params *polarParams,
+ uint32_t *output,
+ const t_nrPolar_params *polarParams,
uint8_t listSize);
uint32_t polar_decoder_int16(int16_t *input,
@@ -163,21 +163,21 @@ uint32_t polar_decoder_int16(int16_t *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI);
void generic_polar_decoder(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyFtoleft(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyGtoright(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void computeBeta(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void build_decoder_tree(t_nrPolar_params *pp);
void build_polar_tables(t_nrPolar_params *polarParams);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 27c062c217..e61b3dff9b 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -43,7 +43,7 @@
void polar_encoder(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
/*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<payloadBits);
@@ -154,7 +154,7 @@ void polar_encoder(uint32_t *in,
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI) {
#ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
@@ -251,9 +251,9 @@ void polar_encoder_dci(uint32_t *in,
#endif
}
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) {
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) {
// handle rate matching with a single 128 bit word using bit shuffling
// can be done with SIMD intrisics if needed
@@ -411,7 +411,7 @@ void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 0990a58266..81fb28cc98 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -73,7 +73,6 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) {
init_unscrambling_lut();
init_scrambling_lut();
//set_taus_seed(1328);
- init_sss();
}
void free_lte_top(void) {
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 2c7e3e88eb..1daeb72187 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -35,7 +35,7 @@
#include "assertions.h"
#include
#include "nfapi/oai_integration/vendor_ext.h"
-
+#include
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
@@ -46,6 +46,17 @@ uint8_t dmrs1_tab[8] = { 0, 2, 3, 4, 6, 8, 9, 10 };
int N_RB_DL_array[6] = { 6, 15, 25, 50, 75, 100 };
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
+void pdsch_procedures(PHY_VARS_eNB *eNB,
+ L1_rxtx_proc_t *proc,
+ int harq_pid,
+ LTE_eNB_DLSCH_t *dlsch,
+ LTE_eNB_DLSCH_t *dlsch1);
+
+void init_sss(void);
+
int
l1_north_init_eNB () {
int i,j;
@@ -347,6 +358,33 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
lte_gold_mbsfn_khz_1dot25 (fp, RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_khz_1dot25_table, fp->Nid_cell_mbsfn);
}
+void fill_subframe_mask(PHY_VARS_eNB *eNB) {
+
+ AssertFatal(eNB->subframe_mask!=NULL,"Subframe mask is null\n");
+ int32_t **dummy_tx=eNB->common_vars.txdataF;
+ eNB->common_vars.txdataF = eNB->subframe_mask;
+
+ for (int sf=0;sf<10;sf++) {
+ if (subframe_select(&eNB->frame_parms,sf)==SF_DL) {
+ LTE_DL_eNB_HARQ_t *dlsch_harq=eNB->dlsch[0][0]->harq_processes[0];
+ L1_rxtx_proc_t proc;
+ proc.frame_tx=0;
+ proc.subframe_tx=sf;
+ eNB->dlsch[0][0]->harq_ids[0][sf]=0;
+ eNB->dlsch[0][0]->rnti=0x1234;
+ dlsch_harq->nb_rb=48;
+ dlsch_harq->rb_alloc[0]=(uint32_t)0xffffffff;
+ dlsch_harq->Qm=2;
+ dlsch_harq->Nl=1;
+ dlsch_harq->pdsch_start=1;
+ dlsch_harq->mimo_mode=(eNB->frame_parms.nb_antenna_ports_eNB>1) ? ALAMOUTI : SISO;
+ dlsch_harq->dl_power_off = 1;
+ computeRhoB_eNB(4,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,eNB->dlsch[0][0],dlsch_harq->dl_power_off);
+ pdsch_procedures(eNB,&proc,0,eNB->dlsch[0][0],NULL);
+ }
+ }
+ eNB->common_vars.txdataF = dummy_tx;
+}
int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
unsigned char is_secondary_eNB,
@@ -385,7 +423,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
lte_gold (fp, eNB->lte_gold_table, fp->Nid_cell);
generate_pcfich_reg_mapping (fp);
generate_phich_reg_mapping (fp);
+ init_sss();
+ init_fde();
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
eNB->first_run_timing_advance[UE_id] =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
@@ -397,9 +437,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
eNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
+ eNB->use_DTX=1;
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
common_vars->rxdata = (int32_t **)NULL;
common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ if (eNB->use_DTX==0) {
+ eNB->subframe_mask = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ }
common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t *));
LOG_I(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB);
@@ -409,17 +453,19 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_I(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
+ if (eNB->use_DTX==0 && inb_antenna_ports_eNB) eNB->subframe_mask[i] = malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
}
}
+ LOG_I(PHY,"[INIT]SRS allocation\n");
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
- srs_vars[UE_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ srs_vars[srs_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
for (i = 0; i < 64; i++) {
- srs_vars[UE_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
- srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
+ srs_vars[srs_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
+ srs_vars[srs_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
}
} //UE_id
@@ -427,10 +473,11 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
init_ulsch_power_LUT ();
// SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
}
+ LOG_I(PHY,"PRACH allocation\n");
// PRACH
prach_vars->prachF = (int16_t *) malloc16_clear (1024 * 2 * sizeof (int16_t));
// assume maximum of 64 RX antennas for PRACH receiver
@@ -461,34 +508,33 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
}*/
- for (UE_id=0; UE_idrxdataF_ext = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_comp = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_mag = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_magb = (int32_t **) malloc16 (2 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id] = (LTE_eNB_PUSCH *) malloc16_clear (NUMBER_OF_ULSCH_MAX * sizeof (LTE_eNB_PUSCH));
+ pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **) malloc16 (4 * sizeof (int32_t *));
AssertFatal (fp->ofdm_symbol_size > 127, "fp->ofdm_symbol_size %d<128\n", fp->ofdm_symbol_size);
AssertFatal (fp->symbols_per_tti > 11, "fp->symbols_per_tti %d < 12\n", fp->symbols_per_tti);
AssertFatal (fp->N_RB_UL > 5, "fp->N_RB_UL %d < 6\n", fp->N_RB_UL);
-
- for (i = 0; i < 2; i++) {
- // RK 2 times because of output format of FFT!
+ AssertFatal (fp->nb_antennas_rx > 0,"fp->nb_antennas_rx = %d\n",fp->nb_antennas_rx);
+ for (i = 0; i < fp->nb_antennas_rx; i++) {
// FIXME We should get rid of this
- pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
- pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
- pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 4*sizeof(int32_t)*fp->ofdm_symbol_size );
+ pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
}
- pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
- } //UE_id
+ pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+ } //ULSCH_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++)
eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id];
@@ -518,19 +564,19 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(common_vars->rxdataF);
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
for (i=0; i<64; i++) {
- free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time[i]);
}
- free_and_zero(srs_vars[UE_id].srs_ch_estimates);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time);
} //UE_id
free_ul_ref_sigs();
- for (UE_id=0; UE_idprachF);
@@ -548,26 +594,26 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(prach_vars_br->prachF);
free_and_zero(prach_vars->rxsigF[0]);
- for (UE_id=0; UE_idrxdataF_ext[i]);
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates[i]);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time[i]);
- free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]);
- free_and_zero(pusch_vars[UE_id]->ul_ch_mag[i]);
- free_and_zero(pusch_vars[UE_id]->ul_ch_magb[i]);
+ for (int ULSCH_id=0; ULSCH_idnb_antennas_rx; i++) {
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]);
}
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext);
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext2);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time);
- free_and_zero(pusch_vars[UE_id]->rxdataF_comp);
- free_and_zero(pusch_vars[UE_id]->ul_ch_mag);
- free_and_zero(pusch_vars[UE_id]->ul_ch_magb);
- free_and_zero(pusch_vars[UE_id]->llr);
- free_and_zero(pusch_vars[UE_id]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb);
+ free_and_zero(pusch_vars[ULSCH_id]->llr);
+ free_and_zero(pusch_vars[ULSCH_id]);
} //UE_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL;
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index 8ad928f8a0..a856c33999 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -21,9 +21,8 @@
#include "phy_init.h"
#include "SCHED/sched_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "SIMULATION/TOOLS/sim.h"
+//#include "SIMULATION/TOOLS/sim.h"
#include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
#include "LTE_TDD-Config.h"
@@ -34,6 +33,8 @@
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;
@@ -44,6 +45,7 @@ int phy_init_RU(RU_t *ru) {
if (ru->is_slave == 1) {
generate_ul_ref_sigs_rx();
}
+ else generate_ul_ref_sigs();
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
// Time-domain signals
@@ -135,14 +137,14 @@ int phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
- RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
- LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
+ AssertFatal(ru->num_eNB <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
+ ru->num_eNB,NUMBER_OF_eNB_MAX);
+ LOG_D(PHY,"[INIT] %s() ru->num_eNB:%d \n", __FUNCTION__, ru->num_eNB);
int starting_antenna_index=0;
for (i=0; iidx; i++) starting_antenna_index+=ru->nb_tx;
- for (i=0; inum_eNB; i++) {
for (p=0; p<15; p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
@@ -240,7 +242,7 @@ void phy_free_RU(RU_t *ru) {
free_and_zero(ru->prach_rxsigF[0]);
/* ru->prach_rxsigF_br is not allocated -> don't free */
- for (i = 0; i < RC.nb_L1_inst; i++) {
+ for (i = 0; i < ru->num_eNB; i++) {
for (p = 0; p < 15; p++) {
if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
index 64a5992a64..b756735816 100644
--- a/openair1/PHY/INIT/lte_init_ue.c
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -39,6 +39,7 @@ void init_7_5KHz(void);
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
+void init_sss(void);
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
uint8_t eNB_id,
@@ -629,6 +630,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
init_frame_parms(&ue->frame_parms,1);
lte_sync_time_init(&ue->frame_parms);
init_lte_top(&ue->frame_parms);
+ init_sss();
init_7_5KHz();
init_ul_hopping(&ue->frame_parms);
// many memory allocation sizes are hard coded
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 1505ee018e..504c8fa80a 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -25,7 +25,6 @@
#include
#include
-#include "SIMULATION/TOOLS/sim.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
@@ -33,7 +32,9 @@
#include "phy_init.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
-#include "targets/RT/USER/lte-softmodem.h"
+#include "executables/softmodem-common.h"
+#include "SIMULATION/TOOLS/sim.h"
+
extern PHY_VARS_eNB *eNB;
extern PHY_VARS_UE *UE;
extern RU_t *ru;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index e05045d3ed..f9be627974 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -110,7 +110,7 @@ int l1_north_init_gNB() {
int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
unsigned char is_secondary_gNB,
- unsigned char abstraction_flag) {
+ unsigned char lowmem_flag) {
// shortcuts
NR_DL_FRAME_PARMS *const fp = &gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
@@ -128,6 +128,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
while(gNB->configured == 0) usleep(10000);
+ if (lowmem_flag == 1) {
+ gNB->number_of_nr_dlsch_max = 2;
+ gNB->number_of_nr_ulsch_max = 2;
+ }
+ else {
+ gNB->number_of_nr_dlsch_max = NUMBER_OF_NR_DLSCH_MAX;
+ gNB->number_of_nr_ulsch_max = NUMBER_OF_NR_ULSCH_MAX;
+ }
+
load_dftslib();
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
@@ -287,7 +296,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
@@ -372,7 +381,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(prach_vars->prach_ifft[0]);
free_and_zero(prach_vars->rxsigF[0]);
*/
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
for (int i = 0; i < 2; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
@@ -563,9 +572,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
}
- for (i=0; inumber_of_nr_dlsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,NUMBER_OF_NR_DLSCH_MAX);
+ LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
for (j=0; j<2; j++) {
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
@@ -573,9 +582,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
}
}
- for (i=0; inumber_of_nr_ulsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
+ LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
for (j=0; j<2; j++) {
// ULSCH for data
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index cb3fd076a7..8189a7ab34 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -21,9 +21,6 @@
#include "phy_init.h"
#include "SCHED/sched_common.h"
-#include "PHY/phy_extern.h"
-#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
-#include "SIMULATION/TOOLS/sim.h"
/*#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
@@ -33,6 +30,10 @@
#include
#include "openair1/PHY/defs_RU.h"
+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;
@@ -44,7 +45,7 @@ int nr_phy_init_RU(RU_t *ru) {
nfapi_nr_config_request_scf_t *cfg;
ru->nb_log_antennas=0;
- for (int n=0;nnum_gNB;n++) {
cfg = &ru->config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
}
@@ -117,10 +118,10 @@ int nr_phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_nr_L1_inst <= NUMBER_OF_eNB_MAX,"gNB instances %d > %d\n",
- RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX);
+ AssertFatal(ru->num_gNB <= NUMBER_OF_gNB_MAX,"gNB instances %d > %d\n",
+ ru->num_gNB,NUMBER_OF_gNB_MAX);
- LOG_I(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
+ LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
int beam_count = 0;
if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
@@ -131,7 +132,7 @@ int nr_phy_init_RU(RU_t *ru) {
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
int l_ind = 0;
- for (i=0; inum_gNB; i++) {
for (p=0;pnb_log_antennas;p++) {
//if ((fp->L_ssb >> (63-p)) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
@@ -199,8 +200,7 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->prach_rxsigF[j][i]);
}
}
-
- for (i = 0; i < RC.nb_nr_L1_inst; i++) {
+ for (i = 0; i < ru->num_gNB; i++) {
for (p = 0; p < 15; p++) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
free_and_zero(ru->beam_weights[i][p]);
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 855acc01ff..a9c71d1582 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -28,6 +28,7 @@
#include "TDD-Config.h"
#include "MBSFN-SubframeConfigList.h"*/
#include "openair1/PHY/defs_RU.h"
+#include "openair1/PHY/impl_defs_nr.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include
@@ -196,7 +197,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
for (i=0;iPDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (NR_PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
+ ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PDSCH_TimeDomainResourceAllocation_t));
ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i]->mappingType = typeA;
}
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index 2db0ccc258..2ab610739d 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -399,7 +399,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstractio
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
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, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
+int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
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);
@@ -408,6 +408,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
void init_dfts(void);
+void fill_subframe_mask(PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
index 3fd58a4989..6d382bdd63 100644
--- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
+++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
@@ -20,11 +20,11 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
-// This is 512/(1:256) in __m128i format
-int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
+// This is 4096/(1:4096) in __m128i format
+__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
256,256,256,256,256,256,256,256,
170,170,170,170,170,170,170,170,
128,128,128,128,128,128,128,128,
@@ -280,7 +280,11 @@ int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
- };
+ };*/
+
+void init_fde() {
+ for (int i=1;i<4096;i++) inv_ch[i] = _mm_set1_epi16(4096/i);
+}
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
@@ -313,12 +317,12 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
amp=(*((int16_t*)&ul_ch_mag128[re]));
- if (amp>255)
- amp=255;
+ if (amp>4095)
+ amp=4095;
- // printf("freq_eq: symbol %d re %d => %d,%d,%d, (%d) (%d,%d) => ",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,inv_ch[8*amp],*((int16_t*)(&ul_ch_mag128[re]))*inv_ch[8*amp],*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
+ //printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
#if defined(__x86_64__) || defined(__i386__)
- rxdataF_comp128[re] = _mm_mullo_epi16(rxdataF_comp128[re],*((__m128i *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = _mm_srai_epi16(_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3);
if (Qm==4)
ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10)
@@ -327,7 +331,7 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42)
}
#elif defined(__arm__)
- rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],*((int16x8_t *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],inv_ch[amp]);
if (Qm==4)
ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
index f85162e095..aac8e71828 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
@@ -21,7 +21,6 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
@@ -118,12 +117,12 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
int temp, i, aa, max_pos=0, max_val=0;
short Re,Im;
- uint8_t cyclic_shift = 0;
- int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
+ // uint8_t cyclic_shift = 0;
+ int sync_pos = 0;//(frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
- AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
- frame_parms->nb_antennas_rx);
+ AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<=4,"frame_parms->nb_antennas_rx %d not in [1...%d]\n",
+ frame_parms->nb_antennas_rx,4);
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
temp = 0;
@@ -142,9 +141,5 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
if (max_pos>frame_parms->ofdm_symbol_size/2)
max_pos = max_pos-frame_parms->ofdm_symbol_size;
- //#ifdef DEBUG_PHY
- LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos);
- //#endif //DEBUG_PHY
-
return max_pos - sync_pos;
}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
index 2d79158920..7eeeb998ba 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
@@ -32,6 +32,30 @@
int32_t rx_power_avg_eNB[3];
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB) {
+
+
+ int min_I0=1000,max_I0=0;
+ int amin=0,amax=0;
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;}
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
+ }
+
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ fprintf(fd,"%2d.",eNB->measurements.n0_subband_power_tot_dB[i]-eNB->measurements.n0_subband_power_avg_dB);
+ if (i%25 == 24) fprintf(fd,"\n");
+ }
+
+ fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
+
+ fprintf(fd,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
+
+
+}
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
int subframe,
module_id_t eNB_id,
@@ -87,46 +111,45 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
nb_rb++;
for (aarx=0; aarxnb_antennas_rx; aarx++) {
measurements->n0_subband_power[aarx][rb] = 0;
- for (int s=0;s<14-(frame_parms->Ncp<<1);s++) {
- // select the 7th symbol in an uplink subframe
- offset = offset0 + (s*frame_parms->ofdm_symbol_size);
- ul_ch = &common_vars->rxdataF[aarx][offset];
- len = 12;
+ for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) {
+ offset = offset0 + (s*frame_parms->ofdm_symbol_size);
+ ul_ch = &common_vars->rxdataF[aarx][offset];
+ len = 12;
// just do first half of middle PRB for odd number of PRBs
- if (((frame_parms->N_RB_UL&1) == 1) &&
- (rb==(frame_parms->N_RB_UL>>1))) {
- len=6;
- }
+ if (((frame_parms->N_RB_UL&1) == 1) &&
+ (rb==(frame_parms->N_RB_UL>>1))) {
+ len=6;
+ }
- AssertFatal(ul_ch, "RX signal buffer (freq) problem");
+ AssertFatal(ul_ch, "RX signal buffer (freq) problem");
- measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
+ measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
- }
+ } // symbol
measurements->n0_subband_power[aarx][rb]/=(14-(frame_parms->Ncp<<1));
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
n0_power_tot += measurements->n0_subband_power[aarx][rb];
- }
+ } //antenna
n0_power_tot/=frame_parms->nb_antennas_rx;
n0_power_tot2 += n0_power_tot;
- measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot/frame_parms->nb_antennas_rx);
+ measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - eNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
- }
- }
+ } //rb not used in subframe
+ } //rb
if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb);
}
void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
module_id_t eNB_id,
- module_id_t UE_id,
+ module_id_t srs_id,
unsigned char init_averaging)
{
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements;
- LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id];
+ LTE_eNB_SRS *srs_vars = &eNB->srs_vars[srs_id];
int32_t aarx,rx_power_correction;
int32_t rx_power;
@@ -136,7 +159,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
//printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id);
if (init_averaging == 1)
- rx_power_avg_eNB[UE_id] = 0;
+ rx_power_avg_eNB[srs_id] = 0;
rx_power = 0;
@@ -152,24 +175,24 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
- measurements->rx_spatial_power[UE_id][0][aarx] =
+ measurements->rx_spatial_power[srs_id][0][aarx] =
((signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset],
(frame_parms->N_RB_DL*6)) +
signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][1],
(frame_parms->N_RB_DL*6)))*rx_power_correction) -
measurements->n0_power[aarx];
- measurements->rx_spatial_power[UE_id][0][aarx]<<=1; // because of noise only in odd samples
+ measurements->rx_spatial_power[srs_id][0][aarx]<<=1; // because of noise only in odd samples
- measurements->rx_spatial_power_dB[UE_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[UE_id][0][aarx]);
+ measurements->rx_spatial_power_dB[srs_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]);
- measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx];
+ measurements->wideband_cqi[srs_id][aarx] = measurements->rx_spatial_power[srs_id][0][aarx];
// measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx;
- measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]);
- rx_power += measurements->wideband_cqi[UE_id][aarx];
+ measurements->wideband_cqi_dB[srs_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[srs_id][aarx]);
+ rx_power += measurements->wideband_cqi[srs_id][aarx];
// measurements->rx_avg_power_dB[UE_id] += measurements->rx_power_dB[UE_id][aarx];
}
@@ -177,14 +200,14 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
// measurements->rx_avg_power_dB[UE_id]/=frame_parms->nb_antennas_rx;
if (init_averaging == 0)
- rx_power_avg_eNB[UE_id] = ((k1*rx_power_avg_eNB[UE_id]) + (k2*rx_power))>>10;
+ rx_power_avg_eNB[srs_id] = ((k1*rx_power_avg_eNB[srs_id]) + (k2*rx_power))>>10;
else
- rx_power_avg_eNB[UE_id] = rx_power;
+ rx_power_avg_eNB[srs_id] = rx_power;
- measurements->wideband_cqi_tot[UE_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
+ measurements->wideband_cqi_tot[srs_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
// times 2 since we have noise only in the odd carriers of the srs comb
- measurements->rx_rssi_dBm[UE_id] = (int32_t)dB_fixed(rx_power_avg_eNB[UE_id])-eNB->rx_total_gain_dB;
+ measurements->rx_rssi_dBm[srs_id] = (int32_t)dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB;
@@ -200,21 +223,21 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
else if (rb>12)
ul_ch = &srs_vars->srs_ch_estimates[aarx][6 + (rb-13)*12];
else {
- measurements->subband_cqi_dB[UE_id][aarx][rb] = 0;
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = 0;
continue;
}
// cqi
if (aarx==0)
- measurements->subband_cqi_tot[UE_id][rb]=0;
+ measurements->subband_cqi_tot[srs_id][rb]=0;
- measurements->subband_cqi[UE_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
+ measurements->subband_cqi[srs_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
- if (measurements->subband_cqi[UE_id][aarx][rb] < 0)
- measurements->subband_cqi[UE_id][aarx][rb]=0;
+ if (measurements->subband_cqi[srs_id][aarx][rb] < 0)
+ measurements->subband_cqi[srs_id][aarx][rb]=0;
- measurements->subband_cqi_tot[UE_id][rb] += measurements->subband_cqi[UE_id][aarx][rb];
- measurements->subband_cqi_dB[UE_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[UE_id][aarx][rb],
+ measurements->subband_cqi_tot[srs_id][rb] += measurements->subband_cqi[srs_id][aarx][rb];
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[srs_id][aarx][rb],
2*measurements->n0_power[aarx]);
// 2*n0_power since we have noise from the odd carriers in the comb of the srs
@@ -225,7 +248,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (rb=0; rbN_RB_DL; rb++) {
- measurements->subband_cqi_tot_dB[UE_id][rb] = dB_fixed2(measurements->subband_cqi_tot[UE_id][rb],
+ measurements->subband_cqi_tot_dB[srs_id][rb] = dB_fixed2(measurements->subband_cqi_tot[srs_id][rb],
measurements->n0_power_tot);
/*
if (measurements->subband_cqi_tot_dB[UE_id][rb] == 65)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
index fc40280853..6ba901e29f 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
+++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
@@ -288,6 +288,8 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
unsigned short Msc_RS,
unsigned char Qm);
+void init_fde(void);
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 57b4c28661..1fbc8b7ef2 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -27,12 +27,9 @@
//#include
#include
-#include "LAYER2/MAC/mac.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
-#include "PHY_INTERFACE/phy_interface.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "RRC/LTE/rrc_extern.h"
// Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs)
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 1d1b16e036..eab9b3f321 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"
@@ -34,12 +34,18 @@ 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};
+static const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
+
+extern unsigned short dftsizes[34];
+extern int16_t *ul_ref_sigs_rx[30][2][34];
+
int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
L1_rxtx_proc_t *proc,
- LTE_eNB_ULSCH_t * ulsch,
- int32_t **ul_ch_estimates,
- int32_t **ul_ch_estimates_time,
- int32_t **rxdataF_ext,
+ LTE_eNB_ULSCH_t * ulsch,
+ int32_t **ul_ch_estimates,
+ int32_t **ul_ch_estimates_time,
+ int32_t **rxdataF_ext,
module_id_t UE_id,
unsigned char l,
unsigned char Ns) {
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 4b06f67bbe..f11a39e249 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -53,14 +53,12 @@
//#undef LOG_D
//#define LOG_D(A,B...) printf(B)
-int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; idlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
- AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
+ for (int i=0; idlsch[i][0] == NULL) continue;
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
if ((eNB->dlsch[i][0]->harq_mask >0) &&
@@ -78,13 +76,12 @@ int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
}
-int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; iulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i);
+ for (int i=0; iulsch[i]==NULL) continue;
if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i;
@@ -301,7 +298,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
- if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) {
+ if( (UE_id<0) || (UE_id>=NUMBER_OF_DLSCH_MAX) ) {
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
return;
}
@@ -476,7 +473,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0;
- // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+ //LOG_D(PHY,"TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,NPRB);
} else {
dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t;
((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1;
@@ -535,7 +532,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
dlsch0->harq_mask |= (1 << rel8->harq_process);
- if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
+ if (rel8->rnti != SI_RNTI) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
break;
@@ -1550,7 +1547,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
dci_alloc->i0 = rel13->initial_transmission_sf_io;
UE_id = find_dlsch (rel13->rnti, eNB, SEARCH_EXIST_OR_FREE);
AssertFatal (UE_id != -1, "no free or exiting dlsch_context\n");
- AssertFatal (UE_id < NUMBER_OF_UE_MAX, "returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
+ AssertFatal (UE_id < NUMBER_OF_DLSCH_MAX, "returned UE_id %d >= %d(NUMBER_OF_DLSCH_MAX)\n", UE_id, NUMBER_OF_DLSCH_MAX);
dlsch0 = eNB->dlsch[UE_id][0];
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
dci_alloc->ra_flag = 0;
@@ -1955,7 +1952,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
if(frame_parms->frame_type == TDD) {
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
- if(UE_id != -1) {
+ if(UE_id >=0 -1 || UE_id < NUMBER_OF_ULSCH_MAX) {
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
}
}
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
index 583d12eedb..64e74ebfbf 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
@@ -32,7 +32,6 @@
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
-#include "SCHED/sched_eNB.h"
#ifdef DEBUG_DCI_TOOLS
#include "PHY/phy_vars.h"
#endif
@@ -43,7 +42,6 @@
//#define DEBUG_HARQ
-#include "LAYER2/MAC/mac.h"
//#define DEBUG_DCI
@@ -100,7 +98,6 @@ uint16_t RIV2nb_rb_LUT100[6000];
uint16_t RIV2first_rb_LUT100[6000];
uint16_t RIV_max100=0;
-extern RAN_CONTEXT_t RC;
extern uint32_t current_dlsch_cqi;
@@ -273,15 +270,6 @@ uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint
-uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe)
-{
-
- // check for eNB only !
- return(get_nCCE(num_pdcch_symbols,
- &RC.eNB[Mod_id][CC_id]->frame_parms,
- get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)));
-}
-
void conv_eMTC_rballoc (uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t * rb_alloc)
{
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
index 3eb44d98fa..b5bcb0848d 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
@@ -96,6 +96,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
}
+
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
unsigned char Mdlharq,
uint32_t Nsoft,
@@ -110,7 +111,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
switch (N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling = 4;
break;
case 25:
@@ -160,7 +161,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
for (i=0; iharq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
- LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
+ LOG_I(PHY, "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]);
if (dlsch->harq_processes[i]) {
@@ -169,9 +170,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
dlsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
if (dlsch->harq_processes[i]->b) {
- bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
+ memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
} else {
- printf("Can't get b\n");
+ AssertFatal(1==0,"Can't get b\n");
exit_flag=1;
}
@@ -181,15 +182,15 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768);
if (dlsch->harq_processes[i]->c[r]) {
- bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
+ memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768);
} else {
- printf("Can't get c\n");
+ AssertFatal(1==0,"Can't get c\n");
exit_flag=2;
}
}
}
} else {
- printf("Can't get harq_p %d\n",i);
+ AssertFatal(1==0,"Can't get harq_p %d\n",i);
exit_flag=3;
}
}
@@ -203,7 +204,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
}
}
- LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
+ LOG_I(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch);
return(NULL);
@@ -360,6 +361,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
proc->nbEncode=0;
+
// if (hadlsch->Ndi == 1) { // this is a new packet
if (hadlsch->round == 0) { // this is a new packet
// Add 24-bit crc (polynomial A) to payload
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 347fbb026b..aba4a464f2 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -2375,16 +2375,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
for (l=num_pdcch_symbols; lmimo_mode,
pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
mod_order0,
mod_order1,
rb_alloc[0]
);
-#endif
}
if (frame_parms->Ncp==0) { // normal prefix
@@ -2980,7 +2978,7 @@ int allocate_REs_in_RB_MCH_khz_1dot25(int32_t **txdataF,
case 2: //QPSK
- LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+ LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&txdataF[0][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
*jj = *jj + 1;
@@ -3082,7 +3080,7 @@ int mch_modulation_khz_1dot25(int32_t **txdataF,
uint8_t skip_dc=0;
uint8_t mod_order = dlsch->harq_processes[0]->Qm;
int16_t qam16_table_a[4],qam64_table_a[8];//,qam16_table_b[4],qam64_table_b[8];
- int16_t *qam_table_s;
+ int16_t *qam_table_s=qam16_table_a;
nsymb_pmch = 1;
nsymb = (frame_parms->Ncp == NORMAL) ? 14 : 12;
@@ -3125,12 +3123,8 @@ int mch_modulation_khz_1dot25(int32_t **txdataF,
}
- if (mod_order == 4)
- qam_table_s = qam16_table_a;
- else if (mod_order == 6)
+ if (mod_order == 6)
qam_table_s = qam64_table_a;
- else
- qam_table_s = NULL;
//LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH_khz_1dot25(txdataF,
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
index b03f59fb78..015a95a862 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
@@ -113,9 +113,6 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 for PMCH
}
-#ifdef DEBUG_SCRAMBLING
- printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
-#endif
s = lte_gold_generic(&x1, &x2, 1);
for (n=0; n<(1+(G>>5)); n++) {
diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
index 95ad420028..09c0b4ba0f 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
@@ -30,10 +30,13 @@
* \warning
*/
-#include "PHY/defs_eNB.h"
+#include
+//#include "PHY/defs_eNB.h"
+#include "PHY/defs_RU.h"
#include "PHY/TOOLS/alaw_lut.h"
-#include "PHY/phy_extern.h"
-#include "SCHED/sched_eNB.h"
+//#include "PHY/phy_extern.h"
+//#include "SCHED/sched_eNB.h"
+lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
index f39f3ef872..e2bec337aa 100644
--- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
@@ -31,11 +31,11 @@
*/
#include
-#include "PHY/defs_eNB.h"
+#include
+#include "PHY/defs_RU.h"
#include "PHY/TOOLS/alaw_lut.h"
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
-#include
#include "common/utils/LOG/vcd_signal_dumper.h"
//#define DEBUG_DL_MOBIPASS
//#define DEBUG_UL_MOBIPASS
@@ -1469,7 +1469,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
// HYPOTHESIS: first packet per subframe has lowest timestamp of subframe
// should detect out of order and act accordingly ....
AssertFatal(aid==0 || aid==1,"aid %d != 0 or 1\n",aid);
- //LOG_I(PHY,"rxp[%d] %p, dest %p, offset %d (%lld,%lld)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(timestamp[packet_id]-timestamp[0]),timestamp[packet_id],timestamp[0]);
+ LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]);
memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])),
(void*)temp_rx,
spp_eth<<2);
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index dfa990269e..8e9a968827 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -72,6 +72,7 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
first_re=0;
last_re=12;
+
for (re=first_re; re
#include
+#include "common/utils/lte/prach_utils.h"
void rx_prach0(PHY_VARS_eNB *eNB,
RU_t *ru,
@@ -84,7 +85,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint8_t aa;
int32_t lev;
int16_t levdB;
- int fft_size,log2_ifft_size;
+ int fft_size=0,log2_ifft_size;
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
int32_t *prach_ifft=(int32_t *)NULL;
int32_t **prach_ifftp=(int32_t **)NULL;
@@ -112,7 +113,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ConfigIndex = fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level];
Ncs_config = fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
restricted_set = fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag;
- n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
+ n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level],
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
tdd_mapindex,Nf);
// update pointers to results for ce_level
@@ -124,7 +125,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag;
- n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
+ n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex,Nf);
}
@@ -140,7 +141,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,
"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
br_flag,ce_level,frame_prach,subframe,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
@@ -153,24 +154,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prachF = eNB->prach_vars.prachF;
rxsigF = eNB->prach_vars.rxsigF[0];
- if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
+ //if (LOG_DEBUGFLAG(PRACH)) {
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
- }
+ //}
}
} else {
if (br_flag == 1) {
rxsigF = ru->prach_rxsigF_br[ce_level];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
}
} else {
rxsigF = ru->prach_rxsigF[0];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
}
}
@@ -299,11 +300,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 6:
if (prach_fmt == 4) {
dft(DFT_256,prach2,rxsigF[aa],1);
+ fft_size=256;
} else {
dft(DFT_1536,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
+ fft_size=1536;
}
break;
@@ -311,13 +314,14 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 15:
if (prach_fmt == 4) {
dft(DFT_256,prach2,rxsigF[aa],1);
+ fft_size=256;
} else {
dft(DFT_3072,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
}
-
+ fft_size=3072;
break;
case 25:
@@ -339,11 +343,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 50:
if (prach_fmt == 4) {
dft(DFT_2048,prach2,rxsigF[aa],1);
+ fft_size=2048;
} else {
dft(DFT_12288,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1);
+ fft_size=12288;
}
break;
@@ -351,11 +357,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 75:
if (prach_fmt == 4) {
dft(DFT_3072,prach2,rxsigF[aa],1);
+ fft_size=3072;
} else {
dft(DFT_18432,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
+ fft_size=18432;
}
break;
@@ -364,20 +372,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (fp->threequarter_fs==0) {
if (prach_fmt == 4) {
dft(DFT_4096,prach2,rxsigF[aa],1);
+ fft_size=2048;
} else {
dft(DFT_24576,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1);
+ fft_size=24576;
}
} else {
if (prach_fmt == 4) {
dft(DFT_3072,prach2,rxsigF[aa],1);
+ fft_size=3072;
} else {
dft(DFT_18432,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
+ fft_size=18432;
}
}
@@ -547,7 +559,6 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
log2_ifft_size = 10;
- fft_size = 6144;
if (new_dft == 1) {
new_dft = 0;
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c
index 393d4ca3f8..e366e8edbc 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c
@@ -34,7 +34,7 @@
#include "PHY/phy_extern.h"
#include "PHY/phy_extern_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
-
+#include "common/utils/lte/prach_utils.h"
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
@@ -44,6 +44,9 @@ int16_t ru[2*839]; // quantized roots of unity
uint32_t ZC_inv[839]; // multiplicative inverse for roots u
uint16_t du[838];
+extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7];
+
+/*
// This is table 5.7.1-4 from 36.211
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
// TDD Configuration Index 0
@@ -254,7 +257,7 @@ PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
}
};
-
+*/
uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779,
2, 837, 1, 838,
@@ -378,192 +381,13 @@ uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) {
return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra);
}
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) {
- if (frame_type == FDD) // FDD
- return(prach_ConfigIndex>>4);
- else {
- if (prach_ConfigIndex < 20)
- return (0);
-
- if (prach_ConfigIndex < 30)
- return (1);
-
- if (prach_ConfigIndex < 40)
- return (2);
-
- if (prach_ConfigIndex < 48)
- return (3);
- else
- return (4);
- }
-}
-
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf) {
- lte_frame_type_t frame_type = frame_parms->frame_type;
- uint8_t tdd_config = frame_parms->tdd_config;
- uint8_t n_ra_prb;
- uint8_t f_ra,t1_ra;
- uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
- uint8_t Nsp=2;
-
- if (frame_type == TDD) { // TDD
- if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
- LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
- return(-1);
- }
-
- // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
- f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
-
- if (prach_fmt < 4) {
- if ((f_ra&1) == 0) {
- n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
- } else {
- n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
- }
- } else {
- if ((tdd_config >2) && (tdd_config<6))
- Nsp = 2;
-
- t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
-
- if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
- n_ra_prb = 6*f_ra;
- } else {
- n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1);
- }
- }
- } else { //FDD
- n_ra_prb = n_ra_prboffset;
- }
-
- return(n_ra_prb);
-}
-
-int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
- // uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
- uint8_t tdd_config = frame_parms->tdd_config;
- uint8_t t0_ra;
- uint8_t t1_ra;
- uint8_t t2_ra;
- int prach_mask = 0;
-
- if (frame_parms->frame_type == FDD) { //FDD
- //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
- if ((((frame&1) == 1) && (subframe < 9)) ||
- (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
- if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
- ((prach_ConfigIndex&0x1f)==18) || // 18,50
- ((prach_ConfigIndex&0xf)==15)) // 15,47
- return(0);
-
- switch (prach_ConfigIndex&0x1f) {
- case 0:
- case 3:
- if (subframe==1) prach_mask = 1;
-
- break;
-
- case 1:
- case 4:
- if (subframe==4) prach_mask = 1;
-
- break;
-
- case 2:
- case 5:
- if (subframe==7) prach_mask = 1;
-
- break;
-
- case 6:
- if ((subframe==1) || (subframe==6)) prach_mask=1;
-
- break;
-
- case 7:
- if ((subframe==2) || (subframe==7)) prach_mask=1;
-
- break;
-
- case 8:
- if ((subframe==3) || (subframe==8)) prach_mask=1;
-
- break;
-
- case 9:
- if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
-
- break;
-
- case 10:
- if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
-
- break;
-
- case 11:
- if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
-
- break;
-
- case 12:
- if ((subframe&1)==0) prach_mask=1;
-
- break;
-
- case 13:
- if ((subframe&1)==1) prach_mask=1;
-
- break;
-
- case 14:
- prach_mask=1;
- break;
-
- case 15:
- if (subframe==9) prach_mask=1;
-
- break;
- }
- } else { // TDD
- AssertFatal(prach_ConfigIndex<64,
- "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
- AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
- "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
- t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
- t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
- t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
-#ifdef PRACH_DEBUG
- LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
- prach_ConfigIndex,
- subframe,
- t0_ra,t1_ra,t2_ra);
-#endif
-
- if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
- ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
- (t0_ra == 0)) && // PRACH is in all frames
- (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
- (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
- if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
- (((subframe%5)-2)==t2_ra)) prach_mask=1;
- else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
- }
- }
-
- return(prach_mask);
-}
-
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) {
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
- int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe);
+ int prach_mask = is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, prach_ConfigIndex, frame, subframe);
for (int i=0; i<4; i++) {
if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1)
- prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
+ prach_mask |= (is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
frame, subframe) << (i+1));
}
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
index 47fbd93ad7..3404646923 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h
+++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
@@ -35,7 +35,7 @@
#include "PHY/sse_intrin.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
+//#include "PHY/phy_extern.h"
//#define PRACH_DEBUG 1
//#define PRACH_WRITE_OUTPUT_DEBUG 1
@@ -74,17 +74,6 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index);
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
-
-
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf);
-
-
-int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
-
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe);
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index c72fa1b480..585a9d92a5 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -65,10 +65,41 @@ int16_t cfo_pucch_ep[24*6] = {24278,-22005,29621,-14010,32412,-4808,32412,4807,2
+void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
+
+ int strpos=0;
+ char output[16384];
+
+ for (int i=0;iuci_stats[i].rnti>0) {
+ eNB_UCI_STATS_t *uci_stats = &eNB->uci_stats[i];
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_trials %d, pucch1_n0 %d dB, pucch1_thres %d dB, current pucch1_stat_pos %d dB, current pucch1_stat_neg %d dB, positive SR count %d\n",
+ i,uci_stats->rnti,uci_stats->pucch1_trials,eNB->measurements.n0_pucch_dB/*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1])*/,uci_stats->pucch1_thres,dB_fixed(uci_stats->current_pucch1_stat_pos),dB_fixed(uci_stats->current_pucch1_stat_neg),uci_stats->pucch1_positive_SR);
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_low (%d,%d)dB pucch1_high (%d,%d)dB\n",
+ i,uci_stats->rnti,
+ dB_fixed(uci_stats->pucch1_low_stat[0]),
+ dB_fixed(uci_stats->pucch1_low_stat[1]),
+ dB_fixed(uci_stats->pucch1_high_stat[0]),
+ dB_fixed(uci_stats->pucch1_high_stat[1]));
+
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1a_trials %d, pucch1a_stat (%d,%d), pucch1b_trials %d, pucch1b_stat (%d,%d) pucch1ab_DTX %d\n",
+ i,uci_stats->rnti,
+ uci_stats->pucch1a_trials,
+ uci_stats->current_pucch1a_stat_re,
+ uci_stats->current_pucch1a_stat_im,
+ uci_stats->pucch1b_trials,
+ uci_stats->current_pucch1b_stat_re,
+ uci_stats->current_pucch1b_stat_im,
+ uci_stats->pucch1ab_DTX);
+ }
+ }
+ if (fd) fprintf(fd,"%s",output);
+ else printf("%s",output);
+}
/* PUCCH format3 >> */
/* SubCarrier Demap */
uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB,
- int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
+ int16_t SubCarrierDeMapData[4][14][12][2],
uint16_t n3_pucch ) {
LTE_eNB_COMMON *eNB_common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
@@ -118,8 +149,8 @@ uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB,
}
/* cyclic shift hopping remove */
-uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
- int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2],
+uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[4][14][12][2],
+ int16_t CshData_fmt3[4][14][12][2],
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
uint8_t ncs_cell[20][7] ) {
@@ -169,9 +200,9 @@ const int16_t TBL_3_SF5_GEN_N_DASH_NS[MAXROW_TBL_SF5_OS_IDX] = {0,3,6,8,10};
const int16_t TBL_3_SF4_GEN_N_DASH_NS[MAXROW_TBL_SF4_OS_IDX] = {0,3,6,9};
/* Channel estimation */
-uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
- double delta_theta[NB_ANTENNAS_RX][12],
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2],
+uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[4][14][12][2],
+ double delta_theta[4][12],
+ int16_t ChestValue[4][2][12][2],
int16_t *Interpw,
uint8_t subframe,
uint8_t shortened_format,
@@ -183,12 +214,12 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
int16_t np, np_n, ip_ind=-1;
//int16_t npucch_sf;
int16_t calctmp[2];
- int16_t BsCshData[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2];
- //int16_t delta_theta_calctmp[NB_ANTENNAS_RX][4][D_NSC1RB][2], delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2];
- int16_t delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2];
- int16_t CsData_allavg[NB_ANTENNAS_RX][14][2];
- int16_t CsData_temp[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2];
- int32_t IP_CsData_allsfavg[NB_ANTENNAS_RX][14][4][2];
+ int16_t BsCshData[4][D_NSYM1SF][D_NSC1RB][2];
+ //int16_t delta_theta_calctmp[4][4][D_NSC1RB][2], delta_theta_comp[4][D_NSC1RB][2];
+ int16_t delta_theta_comp[4][D_NSC1RB][2];
+ int16_t CsData_allavg[4][14][2];
+ int16_t CsData_temp[4][D_NSYM1SF][D_NSC1RB][2];
+ int32_t IP_CsData_allsfavg[4][14][4][2];
int32_t IP_allavg[D_NPUCCH_SF5];
//int16_t temp_ch[2];
int16_t m[NUMBER_OF_UE_MAX], m_self=0, same_m_number;
@@ -432,9 +463,9 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
}
/* Channel Equalization */
-uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2],
- int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2],
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2],
+uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[4][14][12][2],
+ int16_t ChdetAfterValue_fmt3[4][14][12][2],
+ int16_t ChestValue[4][2][12][2],
LTE_DL_FRAME_PARMS *frame_parms) {
int16_t aa, sltNo, symNo, k;
@@ -457,9 +488,9 @@ uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]
}
/* Frequency deviation remove AFC */
-uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2],
- double delta_theta[NB_ANTENNAS_RX][12],
- int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[4][14][12][2],
+ double delta_theta[4][12],
+ int16_t RemoveFrqDev_fmt3[4][2][5][12][2],
LTE_DL_FRAME_PARMS *frame_parms ) {
int16_t aa, sltNo, symNo1slt, k, n;
double calctmp[2];
@@ -509,8 +540,8 @@ const int16_t TBL_3_SF4[MAXROW_TBL_SF4_fmt3][MAXCLM_TBL_SF4][2] = {
};
/* orthogonal sequence remove */
-uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2],
- int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[4][2][5][12][2],
+ int16_t Fmt3xDataRmvOrth[4][2][5][12][2],
uint8_t shortened_format,
uint16_t n3_pucch,
LTE_DL_FRAME_PARMS *frame_parms ) {
@@ -556,7 +587,7 @@ uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5
}
/* averaging antenna */
-uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[4][2][5][12][2],
int16_t Fmt3xDataAvgAnt[2][5][12][2],
uint8_t shortened_format,
LTE_DL_FRAME_PARMS *frame_parms ) {
@@ -856,7 +887,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
PUCCH_FMT_t fmt,
- uint8_t UE_id,
+ uint8_t UCI_id,
uint16_t n1_pucch,
uint16_t n2_pucch,
uint8_t shortened_format,
@@ -871,15 +902,15 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
static int first_call = 1;
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
- int8_t sigma2_dB = eNB->measurements.n0_pucch_dB;
+ int8_t sigma2_dB = /*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]); */eNB->measurements.n0_pucch_dB;
uint32_t u,v,n,aa;
uint32_t z[12*14];
int16_t *zptr;
- int16_t rxcomp[NB_ANTENNAS_RX][2*12*14];
+ int16_t rxcomp[4][2*12*14];
uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1;
uint8_t c = (frame_parms->Ncp==0) ? 3 : 2;
- uint16_t nprime,nprime0,nprime1;
+ int16_t nprime,nprime0,nprime1;
uint16_t i,j,re_offset,thres,h,off;
uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d;
uint8_t m,l,refs,phase,re,l2,phase_max=0;
@@ -887,12 +918,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
int16_t tmp_re,tmp_im,W_re=0,W_im=0;
int16_t *rxptr;
uint32_t symbol_offset;
- int16_t stat_ref_re,stat_ref_im,*cfo;
- int16_t chest0_re[NB_ANTENNAS_RX][12],chest0_im[NB_ANTENNAS_RX][12];
- int16_t chest1_re[NB_ANTENNAS_RX][12],chest1_im[NB_ANTENNAS_RX][12];
+ int16_t stat0_ref_re[4],stat0_ref_im[4],stat1_ref_re[4],stat1_ref_im[4],*cfo;
+ int16_t chest0_re[4][12],chest0_im[4][12];
+ int16_t chest1_re[4][12],chest1_im[4][12];
int32_t chest_mag;
- int32_t stat_re=0,stat_im=0;
- uint32_t stat,stat_max=0;
+ int32_t stat0_re[4],stat1_re[4],stat0_im[4],stat1_im[4];
+ uint32_t stat0[4],stat1[4],stat_max=0,stat0_max[4],stat1_max[4];
uint8_t log2_maxh;
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
@@ -905,13 +936,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
int chL;
/* PUCCH format3 >> */
uint16_t Ret = 0;
- int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- double delta_theta[NB_ANTENNAS_RX][12]; //[Antenna][Subcarrier][Complex]
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2]; //[Antenna][Slot][Subcarrier][Complex]
- int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
- int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
+ int16_t SubCarrierDeMapData[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ int16_t CshData_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ double delta_theta[4][12]; //[Antenna][Subcarrier][Complex]
+ int16_t ChestValue[4][2][12][2]; //[Antenna][Slot][Subcarrier][Complex]
+ int16_t ChdetAfterValue_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ int16_t RemoveFrqDev_fmt3[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
+ int16_t Fmt3xDataRmvOrth[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
int16_t Fmt3xDataAvgAnt[2][5][12][2]; //[Slot][PUCCH_Symbol][Subcarrier][Complex]
int16_t Fmt3xDataAvgSym[2][12][2]; //[Slot][Subcarrier][Complex]
int16_t IFFTOutData_Fmt3[2][12][2]; //[Slot][Subcarrier][Complex]
@@ -941,9 +972,20 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
first_call=0;
}
-
+ eNB_UCI_STATS_t *uci_stats = NULL;
if(fmt!=pucch_format3) { /* PUCCH format3 */
+
+ eNB_UCI_STATS_t *first_uci_stats=NULL;
+ for (int i=0;iuci_stats[i].rnti == eNB->uci_vars[UCI_id].rnti) {
+ uci_stats = &eNB->uci_stats[i];
+ break;
+ } else if (first_uci_stats == NULL && eNB->uci_stats[i].rnti == 0) first_uci_stats = &eNB->uci_stats[i];
+ if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = eNB->uci_vars[UCI_id].rnti;}
+
+ AssertFatal(uci_stats!=NULL,"No stat index found\n");
+ uci_stats->frame = frame;
// TODO
// "SR+ACK/NACK" length is only 7 bits.
// This restriction will be lifted in the future.
@@ -1149,57 +1191,63 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// Do cfo correction and MRC across symbols
if (fmt == pucch_format1) {
+ uci_stats->pucch1_trials++;
#ifdef DEBUG_PUCCH_RX
printf("Doing PUCCH detection for format 1\n");
#endif
stat_max = 0;
for (phase=0; phase<7; phase++) {
- stat=0;
-
+ int stat=0;
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0[aa]=0;stat1[aa]=0;
for (re=0; re<12; re++) {
- stat_re=0;
- stat_im=0;
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
off=re<<1;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
for (l=0; l<(nsymb>>1); l++) {
- stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
- stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
+ stat0_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
+ stat0_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re,
rxcomp[aa][off],rxcomp[aa][1+off],
cfo[l<<1],cfo[1+(l<<1)],
- stat_re,stat_im,stat);
+ stat0_re[aa],stat0_im[aa],stat);
#endif
}
for (l2=0,l=(nsymb>>1); l < nsymb; l++,l2++) {
- stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
- stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
+ stat1_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
+ stat1_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re,
rxcomp[aa][off],rxcomp[aa][1+off],
cfo[l2<<1],cfo[1+(l2<<1)],
- stat_re,stat_im,stat);
+ stat1_re[aa],stat1_im[aa],stat);
#endif
}
-
- stat += ((stat_re*stat_re) + (stat_im*stat_im));
+
+ stat0[aa] += ((stat0_re[aa]*stat0_re[aa]) + (stat0_im[aa]*stat0_im[aa]));
+ stat1[aa] += ((stat1_re[aa]*stat1_re[aa]) + (stat1_im[aa]*stat1_im[aa]));
} //re
+ stat+=(stat0[aa]+stat1[aa]);
} // aa
-
if (stat>stat_max) {
stat_max = stat;
phase_max = phase;
+ for (aa=0;aanb_antennas_rx;aa++) {
+ stat0_max[aa] = stat0[aa];
+ stat1_max[aa] = stat1[aa];
+ }
}
} //phase
- // stat_max *= nsymb; // normalize to energy per symbol
- // stat_max /= (frame_parms->N_RB_UL*12); //
stat_max /= 12;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
@@ -1207,12 +1255,14 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max);
#endif
- eNB->pucch1_stats[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = stat_max;
- eNB->pucch1_stats_thres[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = sigma2_dB+pucch1_thres;
- eNB->pucch1_stats_cnt[UE_id][subframe] = (eNB->pucch1_stats_cnt[UE_id][subframe]+1)&1023;
- T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(frame), T_INT(subframe),
+ eNB->pucch1_stats[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = stat_max;
+ eNB->pucch1_stats_thres[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = sigma2_dB+pucch1_thres;
+ eNB->pucch1_stats_cnt[UCI_id][subframe] = (eNB->pucch1_stats_cnt[UCI_id][subframe]+1)&1023;
+ uci_stats->pucch1_thres = sigma2_dB+pucch1_thres;
+ T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(frame), T_INT(subframe),
T_INT(stat_max), T_INT(sigma2_dB+pucch1_thres));
+
/*
if (eNB->pucch1_stats_cnt[UE_id][subframe] == 0) {
LOG_M("pucch_debug.m","pucch_energy",
@@ -1226,11 +1276,18 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// This is a moving average of the PUCCH1 statistics conditioned on being above or below the threshold
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {
*payload = 1;
+ uci_stats->current_pucch1_stat_pos = stat_max;
+ for (int aa=0;aanb_antennas_rx;aa++) {
+ uci_stats->pucch1_low_stat[aa]=stat0_max[aa];
+ uci_stats->pucch1_high_stat[aa]=stat1_max[aa];
+ uci_stats->pucch1_positive_SR++;
+ }
} else {
+ uci_stats->current_pucch1_stat_neg = stat_max;
*payload = 0;
}
- if (UE_id==0) {
+ if (UCI_id==0) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max));
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,sigma2_dB+pucch1_thres);
}
@@ -1239,29 +1296,30 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_D(PHY,"Doing PUCCH detection for format 1a/1b\n");
#endif
-
+ int stat_re=0,stat_im=0;
for (phase=0; phase<7; phase++) {
- stat=0;
-
+ int stat=0;
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0[aa]=0;
+ stat1[aa]=0;
for (re=0; re<12; re++) {
// compute received energy first slot, seperately for data and reference
// by coherent combining across symbols but not resource elements
// Note: assumption is that channel is stationary over symbols in slot after CFO
- stat_re=0;
- stat_im=0;
- stat_ref_re=0;
- stat_ref_im=0;
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat0_ref_re[aa]=0;
+ stat0_ref_im[aa]=0;
off=re<<1;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
for (l=0; l<(nsymb>>1); l++) {
if ((l<2)||(l>(nsymb>>1) - 3)) { //data symbols
- stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
- stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
+ stat0_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
+ stat0_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
} else { //reference symbols
- stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
- stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
+ stat0_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
+ stat0_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
}
off+=2;
@@ -1274,26 +1332,21 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
}
// this is total energy received, summed over data and reference
- if (fmt==pucch_format1a){
- stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }else{
- stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
- ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }
-
+ stat0[aa] += ((((stat0_re[aa]*stat0_re[aa])) + ((stat0_im[aa]*stat0_im[aa])) +
+ ((stat0_ref_re[aa]*stat0_ref_re[aa])) + ((stat0_ref_im[aa]*stat0_ref_im[aa])))/nsymb);
// now second slot
- stat_re=0;
- stat_im=0;
- stat_ref_re=0;
- stat_ref_im=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
+ stat1_ref_re[aa]=0;
+ stat1_ref_im[aa]=0;
for (l2=0,l=(nsymb>>1); l< nsymb; l++,l2++) {
if ((l2<2) || ((l2>(nsymb>>1) - 3)) ) { // data symbols
- stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
- stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
+ stat1_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
+ stat1_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
} else { //reference_symbols
- stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
- stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
+ stat1_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
+ stat1_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
}
off+=2;
@@ -1308,20 +1361,16 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat);
#endif
- if (fmt==pucch_format1a){
- stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }else{
- stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
- ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }
-
+ stat1[aa] += ((((stat1_re[aa]*stat1_re[aa])) + ((stat1_im[aa]*stat1_im[aa])) +
+ ((stat1_ref_re[aa]*stat1_ref_re[aa])) + ((stat1_ref_im[aa]*stat1_ref_im[aa])))/nsymb);
} //re
+ stat+=(stat0[aa]+stat1[aa]);
} // aa
#ifdef DEBUG_PUCCH_RX
LOG_D(PHY,"Format 1A: phase %d : stat %d\n",phase,stat);
#endif
-
+
if (stat>stat_max) {
stat_max = stat;
phase_max = phase;
@@ -1332,8 +1381,6 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_I(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d (%d : sigma2 %d), phase_max : %d\n",stat_max,dB_fixed(stat_max),sigma2_dB,phase_max);
#endif
- stat_re=0;
- stat_im=0;
// Do detection now
@@ -1341,13 +1388,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// For instance i assume to skip pucch1_thres from the test below.
// Not 100% sure
- if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
+ if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
chL = (nsymb>>1)-4;
chest_mag=0;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
for (aa=0; aanb_antennas_rx; aa++) {
- // channel estimates first
for (re=0; re<12; re++) {
// channel estimate for first slot
chest0_re[aa][re]=0;
@@ -1381,6 +1427,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// now do channel matched filter
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
+
for (re=0; re<12; re++) {
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d chest0[%d][%d] => (%d,%d)\n",subframe,aa,re,
@@ -1392,8 +1443,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l);
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
+ stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
+ stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1409,8 +1460,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l);
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
+ stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
+ stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1431,8 +1482,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l) + (nsymb>>1)*24;
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
+ stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
+ stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1448,8 +1499,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l) + (nsymb>>1)*24;
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
+ stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
+ stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1464,29 +1515,42 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
printf("aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im);
#endif
} //re
+ stat_re+=stat0_re[aa]+stat1_re[aa];
+ stat_im+=stat0_im[aa]+stat1_im[aa];
} // aa
LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im,
- (subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe]));
+ (subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe]));
LOG_D(PHY,"In pucch.c PUCCH 1a/b: ACK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
- eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re);
- eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im);
- eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
+ eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_re);
+ eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_im);
+ eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
/* frame not available here - set to -1 for the moment */
- T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
+ T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
*payload = (stat_re<0) ? 1 : 2; // 1 == ACK, 2 == NAK
- if (fmt==pucch_format1b)
+ if (fmt==pucch_format1b) {
+ uci_stats->pucch1b_trials++;
*(1+payload) = (stat_im<0) ? 1 : 2;
+ uci_stats->current_pucch1b_stat_re = stat_re;
+ uci_stats->current_pucch1b_stat_im = stat_im;
+ }
+ else {
+ uci_stats->pucch1a_trials++;
+ uci_stats->current_pucch1a_stat_re = stat_re;
+ uci_stats->current_pucch1a_stat_im = stat_im;
+ }
+
} else { // insufficient energy on PUCCH so NAK
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
*payload = 4; // DTX
- ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
- ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
- eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
+ ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[0] = (int16_t)(stat_re);
+ ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[1] = (int16_t)(stat_im);
+ eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
if (fmt==pucch_format1b)
*(1+payload) = 4;
+ uci_stats->pucch1ab_DTX++;
}
} else {
LOG_E(PHY,"[eNB] PUCCH fmt2/2a/2b not supported\n");
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch_common.c b/openair1/PHY/LTE_TRANSPORT/pucch_common.c
index 5b939b08d2..d7a500d5f7 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch_common.c
@@ -31,7 +31,6 @@
*/
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
-#include "LAYER2/MAC/mac.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/LOG/log.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h
index ab2921c2b9..7c1065736d 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h
@@ -35,9 +35,9 @@
#include "dci.h"
#include "mdci.h"
//#include "uci.h"
-#ifndef STANDALONE_COMPILE
- #include "UTIL/LISTS/list.h"
-#endif
+//#ifndef STANDALONE_COMPILE
+// #include "UTIL/LISTS/list.h"
+//#endif
#define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5
@@ -57,7 +57,7 @@
// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
-#define MAX_NUM_DLSCH_SEGMENTS 16
+#define MAX_NUM_DLSCH_SEGMENTS 13
#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
index 1944f06fab..622f37b3bc 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
@@ -223,7 +223,9 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
@param frame_type 0-FDD, 1-TDD
@returns 0-1 accordingly
*/
+/*
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+*/
/*!
\brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
@@ -306,12 +308,12 @@ void init_scrambling_lut(void);
void init_unscrambling_lut(void);
-
+/*
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t prach_ConfigIndex,
uint8_t n_ra_prboffset,
uint8_t tdd_mapindex, uint16_t Nf);
-
+*/
uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe);
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
@@ -319,6 +321,6 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL);
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2);
-int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
index 5e446db5fd..b3985e973a 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
@@ -36,9 +36,9 @@
#include "dci.h"
#include "mdci.h"
#include "uci_common.h"
-#ifndef STANDALONE_COMPILE
- #include "UTIL/LISTS/list.h"
-#endif
+//#ifndef STANDALONE_COMPILE
+// #include "UTIL/LISTS/list.h"
+//#endif
// structures below implement 36-211 and 36-212
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 9e37821b05..19af50056c 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -520,6 +520,9 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round);
+void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
+void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
+
@@ -691,13 +694,11 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
uint32_t N_RB_DL,
uint32_t *rb_alloc);
-int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
-int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
-int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
-
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
index f8ade9afc8..ae039bec2a 100644
--- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
@@ -37,12 +37,11 @@
//#define DEBUG_UCI 1
-int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; iuci_vars[i].active >0) &&
(eNB->uci_vars[i].rnti==rnti) &&
(eNB->uci_vars[i].frame==frame) &&
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index 476d7028b1..ae8c666d18 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -468,6 +468,35 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
ulsch_harq->Nsymb_pusch,
nb_rb);
//#endif
+
+ eNB_SCH_STATS_t *stats=NULL;
+ int first_free=-1;
+ for (int i=0;iulsch_stats[i].rnti == 0 && first_free == -1) {
+ first_free = i;
+ stats=&eNB->ulsch_stats[i];
+ }
+ if (eNB->ulsch_stats[i].rnti == ulsch->rnti) {
+ stats=&eNB->ulsch_stats[i];
+ break;
+ }
+ }
+ if (stats) {
+ stats->rnti = ulsch->rnti;
+ stats->round_trials[ulsch_harq->round]++;
+ stats->frame=proc->frame_rx;
+ }
+ if (ulsch_harq->round == 0) {
+ if (stats) {
+ stats->current_Qm = Q_m;
+ stats->current_RI = 1;
+ stats->total_bytes_tx += ulsch_harq->TBS;
+ stats->current_TBS = ulsch_harq->TBS;
+ stats->current_G = ulsch_harq->G;
+ }
+ }
+
+
//if (ulsch_harq->round == 0) { // delete for RB shortage pattern
// This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24;
@@ -1086,3 +1115,44 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
ret = ulsch_decoding_data_all(eNB,proc, UE_id,harq_pid,llr8_flag);
return(ret);
}
+
+#define STATSTRLEN 16384
+void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
+
+ char output[16384];
+ int stroff=0;
+ for (int i=0;iulsch_stats[i].rnti>0 && eNB->ulsch_stats[i].round_trials[0]>100) {
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",
+ eNB->ulsch_stats[i].rnti, aa,eNB->ulsch_stats[i].ulsch_power[aa],aa,eNB->ulsch_stats[i].ulsch_noise_power[aa]);
+ AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n");
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n",
+ eNB->ulsch_stats[i].rnti,
+ eNB->ulsch_stats[i].round_trials[0],
+ (double)eNB->ulsch_stats[i].round_trials[1]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[1],
+ (double)eNB->ulsch_stats[i].round_trials[2]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[2],
+ (double)eNB->ulsch_stats[i].round_trials[3]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[3]);
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset %d, total_bytes RX/SCHED %d/%d\n",
+ eNB->ulsch_stats[i].rnti,
+ eNB->ulsch_stats[i].current_Qm,
+ eNB->ulsch_stats[i].current_G,
+ eNB->ulsch_stats[i].current_TBS,
+ (double)eNB->ulsch_stats[i].current_G/eNB->ulsch_stats[i].current_TBS,
+ eNB->ulsch_stats[i].current_RI,
+ eNB->ulsch_stats[i].timing_offset,
+ eNB->ulsch_stats[i].total_bytes_rx,
+ eNB->ulsch_stats[i].total_bytes_tx);
+ }
+ fprintf(fd,"%s",output);
+}
+
+void clear_ulsch_stats(PHY_VARS_eNB *eNB) {
+
+ for (int i=0;iulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
+}
+
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index eeab616097..3529df8e44 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -31,12 +31,12 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
+//#include "PHY/phy_extern.h"
#include "transport_eNB.h"
#include "PHY/sse_intrin.h"
#include "transport_common_proto.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
-#include "PHY/MODULATION/modulation_eNB.h"
+//#include "PHY/MODULATION/modulation_eNB.h"
#include "T.h"
@@ -45,8 +45,11 @@
//extern int **ulchmag_eren;
//eren
-static short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
-static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
+static const short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
+static const short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
+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};
+
void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) {
#if defined(__x86_64__) || defined(__i386__)
@@ -511,7 +514,6 @@ void ulsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
for (i=0; i<(nb_rb*3); i++) {
#if defined(__x86_64__) || defined(__i386__)
mmtmpU0 = _mm_abs_epi16(rxF[i]);
- // print_shorts("tmp0",&tmp0);
mmtmpU0 = _mm_subs_epi16(ch_mag[i],mmtmpU0);
(*llrp128)[0] = _mm_unpacklo_epi32(rxF[i],mmtmpU0);
(*llrp128)[1] = _mm_unpackhi_epi32(rxF[i],mmtmpU0);
@@ -627,11 +629,15 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t symbol,
uint16_t nb_rb) {
#if defined(__x86_64__) || defined(__i386__)
- __m128i *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b;
- __m128i *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b;
+ __m128i *rxdataF_comp128_0=NULL,*ul_ch_mag128_0=NULL,*ul_ch_mag128_0b=NULL;
+ __m128i *rxdataF_comp128_1=NULL,*ul_ch_mag128_1=NULL,*ul_ch_mag128_1b=NULL;
+ __m128i *rxdataF_comp128_2=NULL,*ul_ch_mag128_2=NULL,*ul_ch_mag128_2b=NULL;
+ __m128i *rxdataF_comp128_3=NULL,*ul_ch_mag128_3=NULL,*ul_ch_mag128_3b=NULL;
#elif defined(__arm__)
int16x8_t *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b;
int16x8_t *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b;
+ int16x8_t *rxdataF_comp128_2,*ul_ch_mag128_2,*ul_ch_mag128_2b;
+ int16x8_t *rxdataF_comp128_3,*ul_ch_mag128_3,*ul_ch_mag128_3b;
#endif
int32_t i;
@@ -643,15 +649,39 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_mag128_1 = (__m128i *)&ul_ch_mag[1][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_0b = (__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_1b = (__m128i *)&ul_ch_magb[1][symbol*frame_parms->N_RB_DL*12];
-
- // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
- for (i=0; inb_antennas_rx>2) {
+ rxdataF_comp128_2 = (__m128i *)&rxdataF_comp[2][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_2 = (__m128i *)&ul_ch_mag[2][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_2b = (__m128i *)&ul_ch_magb[2][symbol*frame_parms->N_RB_DL*12];
+ }
+ if (frame_parms->nb_antennas_rx>3) {
+ rxdataF_comp128_3 = (__m128i *)&rxdataF_comp[3][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_3 = (__m128i *)&ul_ch_mag[3][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_3b = (__m128i *)&ul_ch_magb[3][symbol*frame_parms->N_RB_DL*12];
}
+ // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
+ if (frame_parms->nb_antennas_rx==2)
+ for (i=0; inb_antennas_rx==3)
+ for (i=0; inb_antennas_rx==4)
+ for (i=0; iN_RB_DL*12];
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
@@ -795,7 +825,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU0 = _mm_srai_epi32(mmtmpU0,output_shift);
mmtmpU1 = _mm_packs_epi32(mmtmpU0,mmtmpU0);
ul_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpU1,mmtmpU1);
- LOG_D(PHY,"comp: symbol %d rb %d => %d,%d,%d (output_shift %d)\n",symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift);
+ //LOG_I(PHY,"comp: ant %d symbol %d rb %d => %d,%d,%d (output_shift %d)\n",aarx,symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift);
#elif defined(__arm__)
mmtmpU0 = vmull_s16(ul_ch128[0], ul_ch128[0]);
mmtmpU0 = vqshlq_s32(vqaddq_s32(mmtmpU0,vrev64q_s32(mmtmpU0)),-output_shift128);
@@ -834,6 +864,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
// print_ints("c1",&mmtmpU3);
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
/*
+ LOG_I(PHY,"Antenna %d:",aarx);
print_shorts("rx:",&rxdataF128[0]);
print_shorts("ch:",&ul_ch128[0]);
print_shorts("pack:",&rxdataF_comp128[0]);
@@ -851,9 +882,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
rxdataF_comp128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
- // print_shorts("rx:",rxdataF128[1]);
- // print_shorts("ch:",ul_ch128[1]);
- // print_shorts("pack:",rxdataF_comp128[1]);
+ /*
+ LOG_I(PHY,"Antenna %d:",aarx);
+ print_shorts("rx:",&rxdataF128[1]);
+ print_shorts("ch:",&ul_ch128[1]);
+ print_shorts("pack:",&rxdataF_comp128[1]);
+ */
// multiply by conjugated channel
mmtmpU0 = _mm_madd_epi16(ul_ch128[2],rxdataF128[2]);
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
@@ -867,9 +901,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
rxdataF_comp128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
- // print_shorts("rx:",rxdataF128[2]);
- // print_shorts("ch:",ul_ch128[2]);
- // print_shorts("pack:",rxdataF_comp128[2]);
+ /*
+ LOG_I(PHY,"Antenna %d:",aarx);
+ print_shorts("rx:",&rxdataF128[2]);
+ print_shorts("ch:",&ul_ch128[2]);
+ print_shorts("pack:",&rxdataF_comp128[2]);
+ */
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i *)&jitter[0]));
rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i *)&jitter[0]));
@@ -1078,6 +1115,15 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
for (i=0; inb_antennas_rx; i++) {
+ pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i],
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor;
+ LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid,
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i]));
+ pusch_vars->ulsch_noise_power[i]=0;
+ for (int rb=0;rbharq_processes[harq_pid]->nb_rb;rb++)
+ pusch_vars->ulsch_noise_power[i]+=eNB->measurements.n0_subband_power[i][rb]/ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;
+ LOG_D(PHY,"noise power[%d] %d\n",i,dB_fixed_x10(pusch_vars->ulsch_noise_power[i]));
+/* Check this modification w.r.t to new PUSCH modifications
//symbol 3
int symbol_offset = frame_parms->N_RB_UL*12*(3 - frame_parms->Ncp);
pusch_vars->ulsch_interference_power[i] = interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12);
@@ -1100,7 +1146,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i]));
-
+ */
}
ulsch_channel_level(pusch_vars->drs_ch_estimates,
@@ -1113,8 +1159,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++)
avgs = cmax(avgs,avgU[aarx]);
- // log2_maxh = 4+(log2_approx(avgs)/2);
- log2_maxh = (log2_approx(avgs)/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+4;
+ log2_maxh = 4+(log2_approx(avgs)/2);
LOG_D(PHY,"[ULSCH] log2_maxh = %d (%d,%d)\n",log2_maxh,avgU[0],avgs);
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
@@ -1221,67 +1266,56 @@ void dump_ulsch(PHY_VARS_eNB *eNB,int frame,int subframe,uint8_t UE_id,int round
uint8_t harq_pid;
char fname[100],vname[100];
harq_pid = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
- LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, TBS %d, Qm %d, N_symb %d\n",
+ LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, first_rb %d, TBS %d, Qm %d, N_symb %d\n",
subframe,harq_pid,round,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
+ eNB->ulsch[UE_id]->harq_processes[harq_pid]->first_rb,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS,eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
+ LOG_UI(PHY,"ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[aa]),aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_noise_power[aa]));
sprintf(fname,"/tmp/ulsch_r%d_d",round);
sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
LOG_UM(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
if (eNB->common_vars.rxdata) {
- sprintf(fname,"/tmp/rxsig0_r%d.m",round);
- sprintf(vname,"rxs0_r%d",round);
- LOG_UM(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsig%d_r%d.m",aarx,round);
+ sprintf(vname,"rxs%d_r%d",aarx,round);
+ LOG_UM(fname,vname, &eNB->common_vars.rxdata[aarx][0],eNB->frame_parms.samples_per_tti*10,1,1);
- if (eNB->frame_parms.nb_antennas_rx>1)
- if (eNB->common_vars.rxdata) {
- sprintf(fname,"/tmp/rxsig1_r%d.m",round);
- sprintf(vname,"rxs1_r%d",round);
- LOG_UM(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
- }
+ }
}
-
- sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
- sprintf(vname,"rxsF0_r%d",round);
- LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
-
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
- sprintf(vname,"rxsF1_r%d",round);
- LOG_UM(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+ if (eNB->common_vars.rxdataF) {
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsigF%d_r%d.m",aarx,round);
+ sprintf(vname,"rxsF%d_r%d",aarx,round);
+ LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[aarx][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+ }
}
-
- sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
- sprintf(vname,"rxsF0_ext_r%d",round);
- LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
-
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
- sprintf(vname,"rxsF1_ext_r%d",round);
- LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ if (eNB->pusch_vars[UE_id]->rxdataF_ext) {
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsigF%d_ext_r%d.m",aarx,round);
+ sprintf(vname,"rxsF%d_ext_r%d",aarx,round);
+ LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ }
}
-
/*
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->frame_parms.nb_antennas_rx>1)
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
*/
- sprintf(fname,"/tmp/drs_est0_r%d.m",round);
- sprintf(vname,"drsest0_r%d",round);
- LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/drs_est%d_r%d.m",aarx,round);
+ sprintf(vname,"drsest%d_r%d",aarx,round);
+ LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[aarx],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/drs_est1_r%d.m",round);
- sprintf(vname,"drsest1_r%d",round);
- LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ sprintf(fname,"/tmp/ulsch%d_rxF_comp0_r%d.m",aarx,round);
+ sprintf(vname,"ulsch_rxF%d_comp0_r%d",aarx,round);
+ LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
}
- sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
- sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
- LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
// LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
sprintf(vname,"ulsch_llr_r%d",round);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
index 7442a0ae7e..39900113b7 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
@@ -78,7 +78,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
switch (N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling =4;
break;
case 25:
@@ -276,7 +276,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
switch (frame_parms->N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling =4;
break;
case 25:
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
index ab7c2b9091..929f63e9fc 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
@@ -41,6 +41,7 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "../LTE_TRANSPORT/prach_extern.h"
+#include "common/utils/lte/prach_utils.h"
//#define PRACH_DEBUG 1
@@ -115,7 +116,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
NCS = NCS_restricted[Ncs_config];
}
- n_ra_prb = get_prach_prb_offset(&(ue->frame_parms),
+ n_ra_prb = get_prach_prb_offset(ue->frame_parms.frame_type,
+ ue->frame_parms.tdd_config,
+ ue->frame_parms.N_RB_UL,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex, Nf);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
index 3299401443..7ab795cae9 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
@@ -1740,10 +1740,5 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue);
*/
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf);
-
/**@}*/
#endif
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
index 4c433a5683..6b84a5f969 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
@@ -36,9 +36,11 @@
#include "../LTE_TRANSPORT/mdci.h"
#include "../LTE_TRANSPORT/uci_common.h"
#include "../LTE_TRANSPORT/transport_common.h"
+/*
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
+*/
#include "../LTE_TRANSPORT/transport_common.h"
diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c
index 4405c46abf..d592aa466e 100644
--- a/openair1/PHY/MODULATION/beamforming.c
+++ b/openair1/PHY/MODULATION/beamforming.c
@@ -44,7 +44,6 @@
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c
index 746f8dbc0e..ccb7ee5f3e 100644
--- a/openair1/PHY/MODULATION/slot_fep_ul.c
+++ b/openair1/PHY/MODULATION/slot_fep_ul.c
@@ -20,8 +20,8 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
-#include "modulation_eNB.h"
+//#include "PHY/phy_extern.h"
+//#include "modulation_eNB.h"
//#define DEBUG_FEP
diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz.c b/openair1/PHY/MODULATION/ul_7_5_kHz.c
index a5b428a813..384b9d621c 100644
--- a/openair1/PHY/MODULATION/ul_7_5_kHz.c
+++ b/openair1/PHY/MODULATION/ul_7_5_kHz.c
@@ -20,7 +20,6 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include
#include "PHY/sse_intrin.h"
#include "modulation_extern.h"
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
index 6b86e8805e..b54b968e2d 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c
@@ -239,7 +239,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu[i].RNTI,gNB,SEARCH_EXIST_OR_FREE);
- if( (dlsch_id<0) || (dlsch_id>=NUMBER_OF_NR_DLSCH_MAX) ){
+ if( (dlsch_id<0) || (dlsch_id>=gNB->number_of_nr_dlsch_max) ){
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu[i].RNTI,dlsch_id);
return;
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
index 96c4957bed..b1dbc7c7d9 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
@@ -132,7 +132,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
time_stats_t *dlsch_interleaving_stats=&gNB->dlsch_interleaving_stats;
time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats;
- for (int dlsch_id=0;dlsch_idnumber_of_nr_dlsch_max;dlsch_id++) {
dlsch = gNB->dlsch[dlsch_id][0];
if (dlsch->slot_tx[slot] == 0) continue;
@@ -159,7 +159,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers;
uint8_t Qm = rel15->qamModOrder[0];
uint32_t encoded_length = nb_re*Qm;
- int16_t mod_dmrs[14][n_dmrs<<1] __attribute__ ((aligned(16)));
+ int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16)));
/* PTRS */
uint16_t beta_ptrs = 1;
@@ -264,24 +264,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
printf("\n");
}
#endif
-
- /// DMRS QPSK modulation
- // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
- for (int l=rel15->StartSymbolIndex; lStartSymbolIndex+rel15->NrOfSymbols; l++) {
- if (rel15->dlDmrsSymbPos & (1 << l)) {
- nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
-
-#ifdef DEBUG_DLSCH
- printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs, dmrs_Type);
- for (int i=0; i>4; i++) {
- for (int j=0; j<8; j++) {
- printf("%d %d\t", mod_dmrs[l][((i<<3)+j)<<1], mod_dmrs[l][(((i<<3)+j)<<1)+1]);
- }
- printf("\n");
- }
-#endif
- }
- }
/// Resource mapping
@@ -349,6 +331,21 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
}
}
+ /// DMRS QPSK modulation
+ if (rel15->dlDmrsSymbPos & (1 << l)) {
+ nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
+
+#ifdef DEBUG_DLSCH
+ printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs, dmrs_Type);
+ for (int i=0; i>4; i++) {
+ for (int j=0; j<8; j++) {
+ printf("%d %d\t", mod_dmrs[((i<<3)+j)<<1], mod_dmrs[(((i<<3)+j)<<1)+1]);
+ }
+ printf("\n");
+ }
+#endif
+ }
+
/* calculate if current symbol is PTRS symbols */
ptrs_idx = 0;
@@ -379,8 +376,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
/* Map DMRS Symbol */
if ( ( dmrs_symbol_map & (1 << l) ) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) {
- txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15;
- txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
+ txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15;
+ txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_DLSCH_MAPPING
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
@@ -543,6 +540,6 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) {
void clear_pdsch_stats(PHY_VARS_gNB *gNB) {
- for (int i=0;inumber_of_nr_dlsch_max;i++)
memset((void*)&gNB->dlsch_stats[i],0,sizeof(gNB->dlsch_stats[i]));
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
index 05d6c4c112..543002827d 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
@@ -260,7 +260,7 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
int16_t first_free_index=-1;
AssertFatal(gNB!=NULL,"gNB is null\n");
- for (i=0; inumber_of_nr_dlsch_max; i++) {
AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i);
AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
@@ -286,7 +286,7 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15;
int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST);
- AssertFatal( (dlsch_id>=0) && (dlsch_id=0) && (dlsch_idnumber_of_nr_dlsch_max),
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
index 5e6011c437..994ff18bc8 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
@@ -133,15 +133,13 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
@param ue Pointer to PHY variables
@param UE_id id of current UE
@param frame Frame number
- @param nr_tti_rx TTI number
- @param symbol Symbol on which to act (within-in nr_TTI_rx)
+ @param slot Slot number
@param harq_pid HARQ process ID
*/
int nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t UE_id,
uint32_t frame,
- uint8_t nr_tti_rx,
- unsigned char symbol,
+ uint8_t slot,
unsigned char harq_pid);
/** \brief This function performs RB extraction (signal and channel estimates) (currently signal only until channel estimation and compensation are implemented)
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
index 17e8fbfe5f..53ff90404b 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
@@ -41,7 +41,7 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
int16_t first_free_index=-1;
AssertFatal(gNB!=NULL,"gNB is null\n");
- for (i=0; inumber_of_nr_ulsch_max; i++) {
AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i);
AssertFatal(gNB->ulsch[i][0]!=NULL,"gNB->ulsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i][0]->harq_mask,gNB->ulsch[i][0]->rnti,first_free_index);
@@ -62,7 +62,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
int ulsch_id = find_nr_ulsch(ulsch_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE);
- AssertFatal( (ulsch_id>=0) && (ulsch_id=0) && (ulsch_idnumber_of_nr_ulsch_max),
"illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id);
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id][0];
@@ -143,11 +143,11 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
char output[16384];
int stroff=0;
- for (int i=0;inumber_of_nr_ulsch_max;i++) {
if (gNB->ulsch_stats[i].rnti>0) {
- for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
- if (aa==0) stroff+=sprintf(output+stroff,"ULSCH RNTI %4x: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n",
- gNB->ulsch_stats[i].rnti,
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
+ if (aa==0) stroff+=sprintf(output+stroff,"ULSCH RNTI %4x: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n",
+ gNB->ulsch_stats[i].rnti,
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
else stroff+=sprintf(output+stroff," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
@@ -170,21 +170,21 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
gNB->ulsch_stats[i].current_RI,
gNB->ulsch_stats[i].total_bytes_rx,
gNB->ulsch_stats[i].total_bytes_tx);
- }
+ }
}
fprintf(fd,"%s",output);
}
void clear_pusch_stats(PHY_VARS_gNB *gNB) {
- for (int i=0;inumber_of_nr_ulsch_max;i++)
memset((void*)&gNB->ulsch_stats[i],0,sizeof(gNB->ulsch_stats[i]));
}
NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch) {
NR_gNB_SCH_STATS_t *stats=NULL;
int first_free=-1;
- for (int i=0;inumber_of_nr_ulsch_max;i++) {
if (gNB->ulsch_stats[i].rnti == 0 && first_free == -1) {
first_free = i;
stats=&gNB->ulsch_stats[i];
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
index 1c13f5a20b..c7cc301341 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
@@ -12,6 +12,8 @@
//#define DEBUG_RB_EXT
//#define DEBUG_CH_MAG
+#define INVALID_VALUE 255
+
void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
{
@@ -1157,12 +1159,11 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
int nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t ulsch_id,
uint32_t frame,
- uint8_t nr_tti_rx,
- unsigned char symbol,
+ uint8_t slot,
unsigned char harq_pid)
{
- uint8_t aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
+ uint8_t aarx, aatx;
uint32_t nb_re_pusch, bwp_start_subcarrier;
int avgs;
int avg[4];
@@ -1170,54 +1171,33 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu;
- dmrs_symbol_flag = 0;
-
- if(symbol == rel15_ul->start_symbol_index){
- gNB->pusch_vars[ulsch_id]->dmrs_symbol = 0;
- gNB->pusch_vars[ulsch_id]->cl_done = 0;
- }
-
+ gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE;
+ gNB->pusch_vars[ulsch_id]->cl_done = 0;
bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
-
- dmrs_symbol_flag = ((rel15_ul->ul_dmrs_symb_pos)>>symbol)&0x01;
-
- LOG_D(PHY,"symbol %d bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n",symbol,bwp_start_subcarrier,rel15_ul->rb_start,frame_parms->first_carrier_offset);
+ LOG_D(PHY,"bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset);
LOG_D(PHY,"ul_dmrs_symb_pos %x\n",rel15_ul->ul_dmrs_symb_pos);
- if (dmrs_symbol_flag == 1){
- if (((rel15_ul->ul_dmrs_symb_pos)>>((symbol+1)%frame_parms->symbols_per_slot))&0x01)
- AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
-
- if (rel15_ul->dmrs_config_type == 0) {
- // if no data in dmrs cdm group is 1 only even REs have no data
- // if no data in dmrs cdm group is 2 both odd and even REs have no data
- nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6));
- }
- else {
- nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4));
- }
- LOG_D(PHY,"dmrs_symbol: nb_re_pusch %d\n",nb_re_pusch);
- gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
-
- } else {
- nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
- }
-
//----------------------------------------------------------
//--------------------- Channel estimation ---------------------
//----------------------------------------------------------
start_meas(&gNB->ulsch_channel_estimation_stats);
- if (dmrs_symbol_flag == 1) {
- nr_pusch_channel_estimation(gNB,
- nr_tti_rx,
- 0, // p
- symbol,
- ulsch_id,
- bwp_start_subcarrier,
- rel15_ul);
+ for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) {
+ uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
+ LOG_D(PHY,"symbol %d, dmrs_symbol_flag :%d\n", symbol, dmrs_symbol_flag);
+ if (dmrs_symbol_flag == 1) {
+ if (gNB->pusch_vars[ulsch_id]->dmrs_symbol == INVALID_VALUE)
+ gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
- nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol);
+ nr_pusch_channel_estimation(gNB,
+ slot,
+ 0, // p
+ symbol,
+ ulsch_id,
+ bwp_start_subcarrier,
+ rel15_ul);
+
+ nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
if (symbol == rel15_ul->start_symbol_index) {
@@ -1233,147 +1213,157 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
}
}
stop_meas(&gNB->ulsch_channel_estimation_stats);
- //----------------------------------------------------------
- //--------------------- RBs extraction ---------------------
- //----------------------------------------------------------
- gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] = nb_re_pusch;
+#ifdef __AVX2__
+ int off = ((rel15_ul->rb_size&1) == 1)? 4:0;
+#else
+ int off = 0;
+#endif
+ uint32_t rxdataF_ext_offset = 0;
- if (nb_re_pusch > 0) {
+ for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) {
+ uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
+ if (dmrs_symbol_flag == 1) {
+ if ((rel15_ul->ul_dmrs_symb_pos >> ((symbol + 1) % frame_parms->symbols_per_slot)) & 0x01)
+ AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
- start_meas(&gNB->ulsch_rbs_extraction_stats);
- nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
- gNB->pusch_vars[ulsch_id],
- symbol,
- dmrs_symbol_flag,
- rel15_ul,
- frame_parms);
- stop_meas(&gNB->ulsch_rbs_extraction_stats);
+ gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
- //----------------------------------------------------------
- //--------------------- Channel Scaling --------------------
- //----------------------------------------------------------
-
- nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
- frame_parms,
- gNB->ulsch[ulsch_id],
- symbol,
- dmrs_symbol_flag,
- rel15_ul->rb_size,
- rel15_ul->dmrs_config_type);
-
-
- if (gNB->pusch_vars[ulsch_id]->cl_done==0) {
-
- nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
- frame_parms,
- avg,
- symbol,
- nb_re_pusch,
- rel15_ul->rb_size);
-
- avgs = 0;
-
- for (aatx=0;aatxnb_antennas_rx;aarx++)
- avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
-
- gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+3;
- gNB->pusch_vars[ulsch_id]->cl_done = 1;
+ if (rel15_ul->dmrs_config_type == 0) {
+ // if no data in dmrs cdm group is 1 only even REs have no data
+ // if no data in dmrs cdm group is 2 both odd and even REs have no data
+ nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6));
+ }
+ else {
+ nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4));
+ }
+ } else {
+ nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
}
- //----------------------------------------------------------
- //--------------------- Channel Compensation ---------------
- //----------------------------------------------------------
+ gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] = nb_re_pusch;
+ LOG_D(PHY,"symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, gNB->pusch_vars[ulsch_id]->dmrs_symbol);
- start_meas(&gNB->ulsch_channel_compensation_stats);
- nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext,
- gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
- gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
- gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
- gNB->pusch_vars[ulsch_id]->rxdataF_comp,
- (nb_antennas_ue_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL,
- frame_parms,
+ //----------------------------------------------------------
+ //--------------------- RBs extraction ---------------------
+ //----------------------------------------------------------
+ if (nb_re_pusch > 0) {
+
+ start_meas(&gNB->ulsch_rbs_extraction_stats);
+ nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
+ gNB->pusch_vars[ulsch_id],
symbol,
dmrs_symbol_flag,
- rel15_ul->qam_mod_order,
- rel15_ul->rb_size,
- gNB->pusch_vars[ulsch_id]->log2_maxh);
- stop_meas(&gNB->ulsch_channel_compensation_stats);
+ rel15_ul,
+ frame_parms);
+ stop_meas(&gNB->ulsch_rbs_extraction_stats);
- start_meas(&gNB->ulsch_mrc_stats);
- nr_ulsch_detection_mrc(frame_parms,
- gNB->pusch_vars[ulsch_id]->rxdataF_comp,
- gNB->pusch_vars[ulsch_id]->ul_ch_mag,
- gNB->pusch_vars[ulsch_id]->ul_ch_magb,
- symbol,
- rel15_ul->rb_size);
- stop_meas(&gNB->ulsch_mrc_stats);
+ //----------------------------------------------------------
+ //--------------------- Channel Scaling --------------------
+ //----------------------------------------------------------
+ nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
+ frame_parms,
+ gNB->ulsch[ulsch_id],
+ symbol,
+ dmrs_symbol_flag,
+ rel15_ul->rb_size,
+ rel15_ul->dmrs_config_type);
+ if (gNB->pusch_vars[ulsch_id]->cl_done==0) {
+ nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
+ frame_parms,
+ avg,
+ symbol,
+ nb_re_pusch,
+ rel15_ul->rb_size);
+
+ avgs = 0;
+
+ for (aatx=0;aatxnb_antennas_rx;aarx++)
+ avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
+
+ gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+3;
+ gNB->pusch_vars[ulsch_id]->cl_done = 1;
+ }
+
+ //----------------------------------------------------------
+ //--------------------- Channel Compensation ---------------
+ //----------------------------------------------------------
+ start_meas(&gNB->ulsch_channel_compensation_stats);
+ nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext,
+ gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
+ gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
+ gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
+ gNB->pusch_vars[ulsch_id]->rxdataF_comp,
+ (nb_antennas_ue_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL,
+ frame_parms,
+ symbol,
+ dmrs_symbol_flag,
+ rel15_ul->qam_mod_order,
+ rel15_ul->rb_size,
+ gNB->pusch_vars[ulsch_id]->log2_maxh);
+ stop_meas(&gNB->ulsch_channel_compensation_stats);
+
+ start_meas(&gNB->ulsch_mrc_stats);
+ nr_ulsch_detection_mrc(frame_parms,
+ gNB->pusch_vars[ulsch_id]->rxdataF_comp,
+ gNB->pusch_vars[ulsch_id]->ul_ch_mag,
+ gNB->pusch_vars[ulsch_id]->ul_ch_magb,
+ symbol,
+ rel15_ul->rb_size);
+ stop_meas(&gNB->ulsch_mrc_stats);
+
+ if (rel15_ul->transform_precoding == transform_precoder_enabled) {
- if (rel15_ul->transform_precoding == transform_precoder_enabled) {
-
#ifdef __AVX2__
// For odd number of resource blocks need byte alignment to multiple of 8
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
#else
int nb_re_pusch2 = nb_re_pusch;
- #endif
-
- // perform IDFT operation on the compensated rxdata if transform precoding is enabled
- nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch);
- LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch);
- }
+ #endif
+ // perform IDFT operation on the compensated rxdata if transform precoding is enabled
+ nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch);
+ LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch);
+ }
- //----------------------------------------------------------
- //--------------------- PTRS Processing --------------------
- //----------------------------------------------------------
+ //----------------------------------------------------------
+ //--------------------- PTRS Processing --------------------
+ //----------------------------------------------------------
+ /* In case PTRS is enabled then LLR will be calculated after PTRS symbols are processed *
+ * otherwise LLR are calculated for each symbol based upon DMRS channel estimates only. */
+ if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
+ start_meas(&gNB->ulsch_ptrs_processing_stats);
+ nr_pusch_ptrs_processing(gNB,
+ frame_parms,
+ rel15_ul,
+ ulsch_id,
+ slot,
+ symbol,
+ nb_re_pusch);
+ stop_meas(&gNB->ulsch_ptrs_processing_stats);
- /* In case PTRS is enabled then LLR will be calculated after PTRS symbols are processed *
- * otherwise LLR are calculated for each symbol based upon DMRS channel estimates only. */
- if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)
- {
- start_meas(&gNB->ulsch_ptrs_processing_stats);
- nr_pusch_ptrs_processing(gNB,
- frame_parms,
- rel15_ul,
- ulsch_id,
- nr_tti_rx,
- symbol,
- nb_re_pusch);
- stop_meas(&gNB->ulsch_ptrs_processing_stats);
+ /* Subtract total PTRS RE's in the symbol from PUSCH RE's */
+ gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot;
+ }
- /* Subtract total PTRS RE's in the symbol from PUSCH RE's */
- gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot;
- }
- }
-
- /*---------------------------------------------------------------------------------------------------- */
- /*-------------------- LLRs computation -------------------------------------------------------------*/
- /*-----------------------------------------------------------------------------------------------------*/
- if(symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols -1)) {
-
-#ifdef __AVX2__
- int off = ((rel15_ul->rb_size&1) == 1)? 4:0;
-#else
- int off = 0;
-#endif
- uint32_t rxdataF_ext_offset = 0;
- for(uint8_t i =rel15_ul->start_symbol_index; i< (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols);i++) {
+ /*---------------------------------------------------------------------------------------------------- */
+ /*-------------------- LLRs computation -------------------------------------------------------------*/
+ /*-----------------------------------------------------------------------------------------------------*/
start_meas(&gNB->ulsch_llr_stats);
- nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][i * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)],
- gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
- gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
- &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order],
- rel15_ul->rb_size,
- gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i],
- i,
- rel15_ul->qam_mod_order);
+ nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)],
+ gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
+ gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
+ &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order],
+ rel15_ul->rb_size,
+ gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol],
+ symbol,
+ rel15_ul->qam_mod_order);
stop_meas(&gNB->ulsch_llr_stats);
- rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i];
- }// symbol loop
- }// last symbol check
-
- return (0);
+ rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol];
+ }
+ } // symbol loop
+
+ return 0;
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
index aa32ecc8c9..f3cca9e33d 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
@@ -38,10 +38,10 @@
//#include "PHY/defs_nr_UE.h"
#include "../NR_TRANSPORT/nr_transport_common_proto.h"
-#ifndef STANDALONE_COMPILE
+/*#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
-
+*/
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c
index 6e85bca384..83207426fd 100644
--- a/openair1/PHY/TOOLS/oai_dfts.c
+++ b/openair1/PHY/TOOLS/oai_dfts.c
@@ -32,17 +32,17 @@
#define M_PI 3.14159265358979323846
#endif
#define OAIDFTS_MAIN
-#ifndef MR_MAIN
-#include "PHY/defs_common.h"
-#include "PHY/impl_defs_top.h"
-#else
+//#ifndef MR_MAIN
+//#include "PHY/defs_common.h"
+//#include "PHY/impl_defs_top.h"
+//#else
#include "time_meas.h"
#include "LOG/log.h"
#define debug_msg
#define ONE_OVER_SQRT2_Q15 23170
-int oai_exit=0;
-#endif
+//int oai_exit=0;
+//#endif
#define ONE_OVER_SQRT3_Q15 18919
@@ -50,6 +50,8 @@ int oai_exit=0;
#include "assertions.h"
+#include "tools_defs.h"
+
#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
#define print_shorts256(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7],(x)[8],(x)[9],(x)[10],(x)[11],(x)[12],(x)[13],(x)[14],(x)[15])
diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h
index 86c94421f2..66cb51adc6 100644
--- a/openair1/PHY/defs_RU.h
+++ b/openair1/PHY/defs_RU.h
@@ -436,6 +436,14 @@ typedef enum {
typedef struct RU_t_s {
/// index of this ru
uint32_t idx;
+ /// pointer to first RU
+ struct RU_t_s *ru0;
+ /// pointer to ru_mask
+ uint64_t *ru_mask;
+ /// pointer to ru_mutex
+ pthread_mutex_t *ru_mutex;
+ /// pointer to ru_cond
+ pthread_cond_t *ru_cond;
/// Pointer to configuration file
char *rf_config_file;
/// southbound interface
@@ -446,6 +454,12 @@ typedef struct RU_t_s {
node_function_t function;
/// Ethernet parameters for fronthaul interface
eth_params_t eth_params;
+ /// flag to indicate RF emulation mode
+ int emulate_rf;
+ /// numerology index
+ int numerology;
+ /// flag to indicate basicsim operation
+ int basicsim;
/// flag to indicate the RU is in sync with a master reference
int in_synch;
/// timing offset
diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h
index 70ca77fcc6..a371b2334b 100644
--- a/openair1/PHY/defs_common.h
+++ b/openair1/PHY/defs_common.h
@@ -945,6 +945,23 @@ extern int sync_var;
#define DECODE_NUM_FPTR 13
+// Mask for identifying subframe for MBMS
+#define MBSFN_TDD_SF3 0x80// for TDD
+#define MBSFN_TDD_SF4 0x40
+#define MBSFN_TDD_SF7 0x20
+#define MBSFN_TDD_SF8 0x10
+#define MBSFN_TDD_SF9 0x08
+
+
+
+#define MBSFN_FDD_SF1 0x80// for FDD
+#define MBSFN_FDD_SF2 0x40
+#define MBSFN_FDD_SF3 0x20
+#define MBSFN_FDD_SF6 0x10
+#define MBSFN_FDD_SF7 0x08
+#define MBSFN_FDD_SF8 0x04
+
+
typedef uint8_t(decoder_if_t)(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h
index 0f1bf75114..030d50bc04 100644
--- a/openair1/PHY/defs_eNB.h
+++ b/openair1/PHY/defs_eNB.h
@@ -164,10 +164,10 @@ typedef struct {
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb;
- /// measured RX power based on DRS
- int ulsch_power[2];
- /// measured Interference power based on DRS
- int ulsch_interference_power[2];
+ /// measured RX power based on DMRS
+ int ulsch_power[4];
+ /// measured RX power of noise
+ int ulsch_noise_power[4];
/// \brief llr values.
/// - first index: ? [0..1179743] (hard coded)
int16_t *llr;
@@ -217,6 +217,58 @@ typedef struct {
int ret;
} td_params;
+/// Context data structure for RX/TX portion of subframe processing
+typedef struct {
+ /// Component Carrier index
+ uint8_t CC_id;
+ /// timestamp transmitted to HW
+ openair0_timestamp timestamp_tx;
+ openair0_timestamp timestamp_rx;
+ /// subframe to act upon for transmission
+ int subframe_tx;
+ /// subframe to act upon for reception
+ int subframe_rx;
+ /// frame to act upon for transmission
+ int frame_tx;
+ /// frame to act upon for reception
+ int frame_rx;
+ int frame_prach;
+ int subframe_prach;
+ int frame_prach_br;
+ int subframe_prach_br;
+ /// \brief Instance count for RXn-TXnp4 processing thread.
+ /// \internal This variable is protected by \ref mutex_rxtx.
+ int instance_cnt;
+ /// pthread structure for RXn-TXnp4 processing thread
+ pthread_t pthread;
+ /// pthread attributes for RXn-TXnp4 processing thread
+ pthread_attr_t attr;
+ /// condition variable for tx processing thread
+ pthread_cond_t cond;
+ /// mutex for RXn-TXnp4 processing thread
+ pthread_mutex_t mutex;
+ /// scheduling parameters for RXn-TXnp4 thread
+ struct sched_param sched_param_rxtx;
+
+ /// \internal This variable is protected by \ref mutex_RUs.
+ int instance_cnt_RUs;
+ /// condition variable for tx processing thread
+ pthread_cond_t cond_RUs;
+ /// mutex for RXn-TXnp4 processing thread
+ pthread_mutex_t mutex_RUs;
+ tpool_t *threadPool;
+ int nbEncode;
+ int nbDecode;
+ notifiedFIFO_t *respEncode;
+ notifiedFIFO_t *respDecode;
+ pthread_mutex_t mutex_emulateRF;
+ int instance_cnt_emulateRF;
+ pthread_t pthread_emulateRF;
+ pthread_attr_t attr_emulateRF;
+ pthread_cond_t cond_emulateRF;
+ int first_rx;
+} L1_rxtx_proc_t;
+
typedef struct {
struct PHY_VARS_eNB_s *eNB;
LTE_eNB_DLSCH_t *dlsch;
@@ -362,8 +414,11 @@ typedef struct L1_proc_t_s {
L1_rxtx_proc_t L1_proc,L1_proc_tx;
/// stats thread pthread descriptor
pthread_t process_stats_thread;
+ /// L1 stats pthread descriptor
+ pthread_t L1_stats_thread;
/// for waking up tx procedure
RU_proc_t *ru_proc;
+ struct PHY_VARS_eNB_s *eNB;
} L1_proc_t;
@@ -395,36 +450,73 @@ typedef struct {
short n0_subband_power_avg_dB;
// eNB measurements (per user)
//! estimated received spatial signal power (linear)
- unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
+ unsigned int rx_spatial_power[NUMBER_OF_SRS_MAX][2][2];
//! estimated received spatial signal power (dB)
- unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
+ unsigned short rx_spatial_power_dB[NUMBER_OF_SRS_MAX][2][2];
//! estimated rssi (dBm)
- short rx_rssi_dBm[NUMBER_OF_UE_MAX];
+ short rx_rssi_dBm[NUMBER_OF_SRS_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
- int rx_correlation[NUMBER_OF_UE_MAX][2];
+ int rx_correlation[NUMBER_OF_SRS_MAX][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
- int rx_correlation_dB[NUMBER_OF_UE_MAX][2];
+ int rx_correlation_dB[NUMBER_OF_SRS_MAX][2];
/// Wideband CQI (= SINR)
- int wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
+ int wideband_cqi[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI in dB (= SINR dB)
- int wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
+ int wideband_cqi_dB[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI (sum of all RX antennas, in dB)
- char wideband_cqi_tot[NUMBER_OF_UE_MAX];
+ char wideband_cqi_tot[NUMBER_OF_SRS_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
- int subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
+ int subband_cqi[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_UE_MAX][100];
/// Subband CQI in dB and RB (= SINR dB)
- int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
+ int subband_cqi_dB[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB
- int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
+ int subband_cqi_tot_dB[NUMBER_OF_SRS_MAX][100];
/// PRACH background noise level
int prach_I0;
/// PUCCH background noise level
int n0_pucch_dB;
} PHY_MEASUREMENTS_eNB;
+typedef struct {
+ uint16_t rnti;
+ int frame;
+ int round_trials[8];
+ int total_bytes_tx;
+ int total_bytes_rx;
+ int current_G;
+ int current_TBS;
+ int current_Qm;
+ int current_mcs;
+ int current_RI;
+ int timing_offset;
+ int ulsch_power[4];
+ int ulsch_noise_power[4];
+} eNB_SCH_STATS_t;
+
+typedef struct {
+ uint16_t rnti;
+ int frame;
+ int pucch1_trials;
+ int pucch1_thres;
+ int current_pucch1_stat_pos;
+ int current_pucch1_stat_neg;
+ int pucch1_positive_SR;
+ int pucch1_low_stat[4];
+ int pucch1_high_stat[4];
+ int pucch1_phase;
+ int pucch1a_trials;
+ int current_pucch1a_stat_re;
+ int current_pucch1a_stat_im;
+ int pucch1ab_DTX;
+ int pucch1b_trials;
+ int current_pucch1b_stat_re;
+ int current_pucch1b_stat_im;
+ int pucch3_trials;
+ int current_pucch3_stat;
+} eNB_UCI_STATS_t;
/// Top-level PHY Data Structure for eNB
typedef struct PHY_VARS_eNB_s {
@@ -472,13 +564,13 @@ typedef struct PHY_VARS_eNB_s {
LTE_eNB_MPDCCH mpdcch_vars[2];
LTE_eNB_PRACH prach_vars_br;
LTE_eNB_COMMON common_vars;
- LTE_eNB_UCI uci_vars[NUMBER_OF_UCI_VARS_MAX];
- LTE_eNB_SRS srs_vars[NUMBER_OF_UE_MAX];
+ LTE_eNB_UCI uci_vars[NUMBER_OF_UCI_MAX];
+ LTE_eNB_SRS srs_vars[NUMBER_OF_SRS_MAX];
LTE_eNB_PBCH pbch;
- LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX];
+ LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_ULSCH_MAX];
LTE_eNB_PRACH prach_vars;
- LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
- LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
+ LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_DLSCH_MAX][2]; // Num active DLSCH contexts times two spatial streams
+ LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_ULSCH_MAX]; // Num active ULSCH contexts
LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
LTE_eNB_DLSCH_t *dlsch_MCH;
LTE_eNB_DLSCH_t *dlsch_PCH;
@@ -489,7 +581,7 @@ typedef struct PHY_VARS_eNB_s {
uint32_t lte_gold_table[20][2][14];
/// UE-specific reference symbols (p=5), TM 7
- uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][38];
+ uint32_t lte_gold_uespec_port5_table[NUMBER_OF_DLSCH_MAX][20][38];
/// UE-specific reference symbols (p=7...14), TM 8/9/10
uint32_t lte_gold_uespec_table[2][20][2][21];
@@ -521,6 +613,9 @@ typedef struct PHY_VARS_eNB_s {
uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
char eNB_generate_rar;
+ /// indicator that eNB signal generation uses DTX (i.e. signal is cleared in each subframe
+ int use_DTX;
+ int32_t **subframe_mask;
/// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_UE_MAX];
@@ -592,7 +687,12 @@ typedef struct PHY_VARS_eNB_s {
/// Information regarding TM5
MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX];
-
+ /// statistics for DLSCH measurement collection
+ eNB_SCH_STATS_t dlsch_stats[NUMBER_OF_SCH_STATS_MAX];
+ /// statistics for ULSCH measurement collection
+ eNB_SCH_STATS_t ulsch_stats[NUMBER_OF_SCH_STATS_MAX];
+ /// statis for UCI (PUCCH) measurement collection
+ eNB_UCI_STATS_t uci_stats[NUMBER_OF_SCH_STATS_MAX];
/// target_ue_dl_mcs : only for debug purposes
uint32_t target_ue_dl_mcs;
/// target_ue_ul_mcs : only for debug purposes
diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h
index 129f7a9a71..364e3a118a 100644
--- a/openair1/PHY/defs_gNB.h
+++ b/openair1/PHY/defs_gNB.h
@@ -751,7 +751,6 @@ typedef struct PHY_VARS_gNB_s {
// nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu;
// nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu;
-
uint16_t num_pdsch_rnti[80];
NR_gNB_SSB_t ssb[64];
NR_gNB_PBCH pbch;
@@ -886,6 +885,8 @@ typedef struct PHY_VARS_gNB_s {
tpool_t *threadPool;
int nbDecode;
uint8_t pusch_proc_threads;
+ int number_of_nr_dlsch_max;
+ int number_of_nr_ulsch_max;
void * scopeData;
} PHY_VARS_gNB;
diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h
index fad578c8b0..a74c3675a4 100644
--- a/openair1/PHY/impl_defs_nr.h
+++ b/openair1/PHY/impl_defs_nr.h
@@ -36,7 +36,6 @@
#include
#include "types.h"
-#include "NR_PDSCH-TimeDomainResourceAllocation.h"
#ifdef DEFINE_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H
#define EXTERN
@@ -395,6 +394,13 @@ typedef struct{
typedef struct{
// to be defined FIXME!!!
}zp_CSI_RS_Resource_t;
+
+typedef struct{
+ int k0;
+ int mappingType;
+ int startSymbolAndLength;
+
+}PDSCH_TimeDomainResourceAllocation_t;
typedef struct {
/*
* resourceAllocation
@@ -447,7 +453,8 @@ typedef struct {
*/
maxNrofCodeWordsScheduledByDCI_t maxNrofCodeWordsScheduledByDCI;
- NR_PDSCH_TimeDomainResourceAllocation_t *pdsch_TimeDomainResourceAllocation[MAX_NR_OF_DL_ALLOCATIONS];
+
+ PDSCH_TimeDomainResourceAllocation_t *pdsch_TimeDomainResourceAllocation[MAX_NR_OF_DL_ALLOCATIONS];
} PDSCH_Config_t;
diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h
index 4ba5e328e3..d5fea5aec6 100644
--- a/openair1/PHY/phy_extern.h
+++ b/openair1/PHY/phy_extern.h
@@ -23,7 +23,6 @@
#define __PHY_EXTERN_H__
#include "PHY/defs_common.h"
-#include "common/ran_context.h"
extern char* namepointer_chMag ;
extern char* namepointer_log2;
@@ -33,14 +32,13 @@ 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_extern.h"
-//#include "SIMULATION/ETH_TRANSPORT/extern.h"
+#include "PHY/defs_RU.h"
extern unsigned int DAQ_MBOX;
extern int number_of_cards;
extern const short conjugate[8],conjugate2[8];
-extern RAN_CONTEXT_t RC;
extern short primary_synch0[144];
extern short primary_synch1[144];
diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h
index fdaf6eaa89..9f227806fd 100644
--- a/openair1/PHY/phy_extern_ue.h
+++ b/openair1/PHY/phy_extern_ue.h
@@ -23,7 +23,6 @@
#define __PHY_EXTERN_UE__H__
#include "PHY/defs_UE.h"
-#include "common/ran_context.h"
extern char* namepointer_chMag ;
extern char* namepointer_log2;
diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h
index dadb1649ec..9edb7031b9 100644
--- a/openair1/PHY/phy_vars.h
+++ b/openair1/PHY/phy_vars.h
@@ -25,7 +25,6 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
-#include "common/ran_context.h"
char* namepointer_chMag ;
char fmageren_name2[512];
@@ -38,9 +37,10 @@ char* namepointer_log2;
#include "PHY/LTE_TRANSPORT/transport_vars.h"
#include "PHY/MODULATION/modulation_vars.h"
+#include "nfapi/oai_integration/vendor_ext.h"
+
PHY_VARS_UE ***PHY_vars_UE_g;
-RAN_CONTEXT_t RC;
UL_RCC_IND_t UL_RCC_INFO;
unsigned short rev[2048],rev_times4[8192],rev_half[1024];
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index 3f342802b4..ecfec02193 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -32,11 +32,15 @@
#include "PHY/defs_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
+#include "PHY/LTE_TRANSPORT/transport_extern.h"
#include "SCHED/sched_eNB.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "nfapi_pnf_interface.h"
#include "fapi_l1.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req);
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req);
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
@@ -209,13 +213,13 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
- if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) {
+ if( (UE_id<0) || (UE_id>=NUMBER_OF_DLSCH_MAX) ) {
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
return;
}
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
- //AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
+ //AssertFatal(UE_id= %d(NUMBER_OF_DLSCHMAX)\n",UE_id,NUMBER_OF_DLSCH_MAX);
dlsch0 = eNB->dlsch[UE_id][0];
dlsch1 = eNB->dlsch[UE_id][1];
@@ -291,7 +295,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
if ((rel13->pdsch_payload_type <2) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR/SI-BR
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
- AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
+ AssertFatal(UE_id= %d(NUMBER_OF_DLSCH_MAX)\n",UE_id,NUMBER_OF_DLSCH_MAX);
dlsch0 = eNB->dlsch[UE_id][0];
dlsch0->harq_mask = 1;
dlsch0_harq = dlsch0->harq_processes[0];
@@ -366,7 +370,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
} else {
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
- AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
+ AssertFatal(UE_id= %d(NUMBER_OF_DLSCH_MAX)\n",UE_id,NUMBER_OF_DLSCH_MAX);
dlsch0 = eNB->dlsch[UE_id][0];
dlsch1 = eNB->dlsch[UE_id][1];
dlsch0->sib1_br_flag=0;
@@ -596,7 +600,7 @@ void handle_uci_sr_pdu(PHY_VARS_eNB *eNB,
uci->frame = frame;
uci->subframe = subframe;
uci->rnti = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti;
- uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
+ uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
uci->type = SR;
uci->pucch_fmt = pucch_format1;
uci->num_antenna_ports = 1;
@@ -622,7 +626,7 @@ void handle_uci_sr_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_
uci->frame = frame;
uci->subframe = subframe;
uci->rnti = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti;
- uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
+ uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
uci->type = HARQ_SR;
uci->num_antenna_ports = 1;
uci->num_pucch_resources = 1;
@@ -660,7 +664,7 @@ void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_p
if (NFAPI_MODE==NFAPI_MODE_VNF) return;
- for (i=0; isoundingrs_ul_config_dedicated[i].active==1) continue;
eNB->soundingrs_ul_config_dedicated[i].active = 1;
@@ -676,7 +680,7 @@ void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_p
break;
}
- AssertFatal(imodule_id;
@@ -780,7 +785,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
- int i;
+
eNB->pdcch_vars[subframe&1].num_pdcch_symbols = number_pdcch_ofdm_symbols;
eNB->pdcch_vars[subframe&1].num_dci = 0;
eNB->phich_vars[subframe&1].num_hi = 0;
@@ -811,8 +816,8 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
// clear DCI allocation maps for new subframe
if (NFAPI_MODE!=NFAPI_MODE_VNF)
- for (i=0; iulsch[i]) {
+ for (int i=0; iulsch[i]!=NULL) {
ulsch_harq = eNB->ulsch[i]->harq_processes[harq_pid];
ulsch_harq->dci_alloc=0;
ulsch_harq->rar_alloc=0;
@@ -820,7 +825,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
}
}
- for (i=0; idl_config_request_body.dl_config_pdu_list[i];
//LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_config_pdu->pdu_type);
@@ -969,7 +974,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
}
if (NFAPI_MODE!=NFAPI_MODE_VNF)
- for (i=0; ihi_dci0_request_body.hi_dci0_pdu_list[i];
LOG_D(PHY,"NFAPI: hi_dci0_pdu %d : type %d\n",i,hi_dci0_req_pdu->pdu_type);
@@ -993,7 +998,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
if (number_ul_pdu>0) {
uint8_t ulsch_pdu_num = 0;
- for (i=0; iul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) ||
@@ -1020,7 +1025,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
}
}
} else {
- for (i=0; iul_config_request_body.ul_config_pdu_list[i];
LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type);
AssertFatal(ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h
index 6b9121e17f..b8f0ae1dd8 100644
--- a/openair1/SCHED/fapi_l1.h
+++ b/openair1/SCHED/fapi_l1.h
@@ -31,8 +31,6 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/defs_gNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_common.h"
@@ -82,4 +80,4 @@ void handle_uci_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu
void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_pdu,uint16_t frame,uint8_t subframe);
-void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc);
+void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc);
diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 0b592b9c55..7033c52701 100644
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -1085,73 +1085,3 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri
}
}
-
-// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id,
-int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs)
-{
-
- /// The payload + CRC size in bits, "B"
- uint32_t B;
- /// Number of code segments
- uint32_t C;
- /// Number of "small" code segments
- uint32_t Cminus;
- /// Number of "large" code segments
- uint32_t Cplus;
- /// Number of bits in "small" code segments (<6144)
- uint32_t Kminus;
- /// Number of bits in "large" code segments (<6144)
- uint32_t Kplus;
- /// Total number of bits across all segments
- uint32_t sumKr;
- /// Number of "Filler" bits
- uint32_t F;
- // num resource elements
- uint32_t num_re=0.0;
- // num symbols
- uint32_t num_symb=0.0;
- /// effective spectral efficiency of the PUSCH
- uint32_t MPR_x100=0;
- /// beta_offset
- uint16_t beta_offset_pusch_x8=8;
- /// delta mcs
- float delta_mcs=0.0;
- /// bandwidth factor
- float bw_factor=0.0;
-
- B= tbs+24;
- lte_segmentation(NULL,
- NULL,
- B,
- &C,
- &Cplus,
- &Cminus,
- &Kplus,
- &Kminus,
- &F);
-
-
- sumKr = Cminus*Kminus + Cplus*Kplus;
- num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
- num_re = num_symb * nb_rb * 12;
-
- if (num_re == 0)
- return(0);
-
- MPR_x100 = 100*sumKr/num_re;
-
- if (control_only == 1 )
- beta_offset_pusch_x8=8; // fixme
-
- //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
-
- // if deltamcs_enabledm
- delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch_x8)>>3))/100.0);
- bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0);
-#ifdef DEBUG_SEGMENTATION
- printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
- (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
-#endif
- return (int16_t)ceil(delta_mcs + bw_factor);
-
-}
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index d894061acd..f40f760f45 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -52,21 +52,25 @@
#define MBMS_NFAPI_SCHEDULER
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
-int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) {
+nfapi_ue_release_request_body_t release_rntis;
+
+int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t ULSCH_id,uint8_t harq_pid, uint8_t bw_factor) {
uint32_t Nre,sumKr,MPR_x100,Kr,r;
uint16_t beta_offset_pusch;
- DevAssert( UE_id < NUMBER_OF_UE_MAX+1 );
+ DevAssert( ULSCH_id < NUMBER_OF_ULSCH_MAX+1 );
DevAssert( harq_pid < 8 );
- Nre = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_initial *
- eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12;
+ Nre = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Nsymb_initial *
+ eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->nb_rb*12;
sumKr = 0;
- for (r=0; rulsch[UE_id]->harq_processes[harq_pid]->C; r++) {
- if (rulsch[UE_id]->harq_processes[harq_pid]->Cminus)
- Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kminus;
+ for (r=0; rulsch[ULSCH_id]->harq_processes[harq_pid]->C; r++) {
+ if (rulsch[ULSCH_id]->harq_processes[harq_pid]->Cminus)
+ Kr = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Kminus;
else
- Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus;
+ Kr = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Kplus;
sumKr += Kr;
}
@@ -79,14 +83,14 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t
// FK 20140908 sumKr is only set after the ulsch_encoding
beta_offset_pusch = 8;
//(eNB->ulsch[UE_id]->harq_processes[harq_pid]->control_only == 1) ? eNB->ulsch[UE_id]->beta_offset_cqi_times8:8;
- DevAssert( UE_id < NUMBER_OF_UE_MAX );
+ DevAssert( ULSCH_id < NUMBER_OF_ULSCH_MAX );
//#warning "This condition happens sometimes. Need more investigation" // navid
//DevAssert( MPR_x100/6 < 100 );
if (1==1) { //eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) {
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
if (bw_factor == 1) {
- uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;
+ uint8_t nb_rb = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->nb_rb;
return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1];
} else
return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3));
@@ -97,21 +101,21 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) {
- int8_t UE_id;
+ int8_t ULSCH_id;
if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) {
LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id);
return -1;
}
- UE_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST);
+ ULSCH_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST);
- if (UE_id == -1) {
+ if (ULSCH_id == -1) {
// not found
return 0;
}
- return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], UE_id, harq_pid, 0 );
+ return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], ULSCH_id, harq_pid, 0 );
}
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
@@ -499,9 +503,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int do_meas) {
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
- uint32_t i,aa;
uint8_t harq_pid;
- int16_t UE_id=0;
uint8_t num_pdcch_symbols=0;
uint8_t num_dci=0;
uint8_t num_mdci = 0;
@@ -516,12 +518,15 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),1);
if (do_meas==1) start_meas(&eNB->phy_proc_tx);
-
if (do_meas==1) start_meas(&eNB->dlsch_common_and_dci);
// clear the transmit data array for the current subframe
- for (aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) {
- memset (&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)], 0, fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t));
+ for (int aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) {
+ if (eNB->use_DTX==0)
+ memcpy(&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)],
+ &eNB->subframe_mask[aa][subframe*fp->ofdm_symbol_size*fp->symbols_per_tti],
+ fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t));
+ else memset(&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)], 0, fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t));
}
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
@@ -556,7 +561,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
ul_frame = pdcch_alloc2ul_frame (fp, frame, subframe);
// clear previous allocation information for all UEs
- for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+ for (volatile int i = 0; i < NUMBER_OF_DLSCH_MAX; i++) {
if (eNB->dlsch[i][0])
eNB->dlsch[i][0]->subframe_tx[subframe] = 0;
}
@@ -565,7 +570,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
//if ((ul_subframe < 10)&&
// (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here
if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here
- for (i=0; iulsch[i] && eNB->ulsch[i]->ue_type >0) harq_pid = 0;
else
@@ -651,9 +656,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
// Now scan UE specific DLSCH
LTE_eNB_DLSCH_t *dlsch0,*dlsch1;
- for (UE_id=0; UE_iddlsch[(uint8_t)UE_id][0];
- dlsch1 = eNB->dlsch[(uint8_t)UE_id][1];
+ for (int DLSCH_id=0; DLSCH_iddlsch[(uint8_t)DLSCH_id][0];
+ dlsch1 = eNB->dlsch[(uint8_t)DLSCH_id][1];
if ((dlsch0)&&(dlsch0->rnti>0)&&
#ifdef PHY_TX_THREAD
@@ -663,12 +668,13 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
#endif
) {
// get harq_pid
- harq_pid = dlsch0->harq_ids[frame%2][subframe];
+ harq_pid = dlsch0->harq_ids[frame%2][subframe];
//AssertFatal(harq_pid>=0,"harq_pid is negative\n");
if((harq_pid < 0) || (harq_pid >= dlsch0->Mdlharq)) {
+
if (dlsch0->ue_type==0)
- LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 UE_id:%d frame:%d subframe:%d rnti:%x [ %1d.%1d.%1d.%1d.%1d.%1d.%1d.%1d\n", harq_pid,UE_id,frame,subframe,dlsch0->rnti,
+ LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 DLSCH_id:%d frame:%d subframe:%d rnti:%x [ %1d.%1d.%1d.%1d.%1d.%1d.%1d.%1d\n", harq_pid,DLSCH_id,frame,subframe,dlsch0->rnti,
dlsch0->harq_ids[frame%2][0],
dlsch0->harq_ids[frame%2][1],
dlsch0->harq_ids[frame%2][2],
@@ -682,7 +688,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
proc,
harq_pid,
dlsch0,
- &eNB->UE_stats[(uint32_t)UE_id])) {
+ &eNB->UE_stats[(uint32_t)DLSCH_id])) {
// if we generate dlsch, we must generate pdsch
pdsch_procedures(eNB,
proc,
@@ -717,6 +723,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (do_meas==1) stop_meas(&eNB->phy_proc_tx);
}
+/* This has to be updated with FAPI structures*/
void srs_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
@@ -728,7 +735,7 @@ void srs_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
// Do SRS processing
// check if there is SRS and we have to use shortened format
// TODO: check for exceptions in transmission of SRS together with ACK/NACK
- for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+ for (i = 0; i < NUMBER_OF_SRS_MAX; i++) {
if (eNB->soundingrs_ul_config_dedicated[i].active == 1) {
if (lte_srs_channel_estimation (fp, &eNB->common_vars, &eNB->srs_vars[i], &eNB->soundingrs_ul_config_dedicated[i], subframe, 0 /*eNB_id */ )) {
LOG_E (PHY, "problem processing SRS\n");
@@ -793,7 +800,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
calc_pucch_1x_interference(eNB, frame, subframe, 0);
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) {
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
uci = &(eNB->uci_vars[i]);
if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) {
@@ -850,7 +857,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
int pucch1_thres = (uci->ue_type == 0) ? eNB->pucch1_DTX_threshold : eNB->pucch1_DTX_threshold_emtc[0];
metric_SR = rx_pucch(eNB,
uci->pucch_fmt,
- uci->ue_id,
+ i,//uci->ue_id,
uci->n_pucch_1_0_sr[0],
0, // n2_pucch
uci->srs_active, // shortened format
@@ -1275,7 +1282,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PHY_PROC
LOG_D (PHY, "[eNB %d][PDSCH %x] Frame %d subframe %d ACK/NAK metric 0 %d, metric 1 %d, (%d,%d)\n", eNB->Mod_id,
- eNB->dlsch[UE_id][0]->rnti, frame, subframe, metric0, metric1, pucch_b0b1[0], pucch_b0b1[1]);
+ eNB->dlsch[DLSCH_id][0]->rnti, frame, subframe, metric0, metric1, pucch_b0b1[0], pucch_b0b1[1]);
#endif
}
@@ -1298,7 +1305,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
}
}
} // end if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) {
- } // end loop for (int i = 0; i < NUMBER_OF_UE_MAX; i++) {
+ } // end loop for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
}
void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
@@ -1325,7 +1332,7 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
int nb=abortTpool(proc->threadPool, req->key);
nb+=abortNotifiedFIFO(proc->respDecode, req->key);
proc->nbDecode-=nb;
- LOG_I(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
+ LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
ulsch_harq->processedSegments, nb, rdata->nbSegments);
ulsch_harq->processedSegments=rdata->nbSegments;
@@ -1381,6 +1388,15 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
fill_rx_indication(eNB,i,rdata->frame,rdata->subframe); // indicate SDU to MAC
ulsch_harq->status = SCH_IDLE;
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
+ for (int j=0;julsch_stats[j].rnti == ulsch->rnti) {
+ eNB->ulsch_stats[j].total_bytes_rx+=ulsch_harq->TBS;
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++) {
+ eNB->ulsch_stats[j].ulsch_power[aa] = dB_fixed_x10(eNB->pusch_vars[rdata->UEid]->ulsch_power[aa]);
+ eNB->ulsch_stats[j].ulsch_noise_power[aa] = dB_fixed_x10(eNB->pusch_vars[rdata->UEid]->ulsch_noise_power[aa]);
+ }
+ break;
+ }
T (T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(rdata->frame), T_INT(rdata->subframe), T_INT(ulsch->rnti),
T_INT(rdata->harq_pid));
} // ulsch not in error
@@ -1401,8 +1417,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
const int frame = proc->frame_rx;
uint32_t harq_pid0 = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
- for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+ for (i = 0; i < NUMBER_OF_ULSCH_MAX; i++) {
ulsch = eNB->ulsch[i];
+ if (!ulsch) continue;
if (ulsch->ue_type > 0) harq_pid = 0;
else harq_pid=harq_pid0;
@@ -1411,10 +1428,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n",
i, harq_pid, frame,subframe,i,ulsch->rnti,
- ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
+ ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
- if ((ulsch) &&
- (ulsch->rnti>0) &&
+ if ((ulsch->rnti>0) &&
(ulsch_harq->status == ACTIVE) &&
((ulsch_harq->frame == frame) || (ulsch_harq->repetition_number >1) ) &&
((ulsch_harq->subframe == subframe) || (ulsch_harq->repetition_number >1) ) &&
@@ -1459,6 +1475,17 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb>20 ? 1 : 0);
stop_meas(&eNB->ulsch_decoding_stats);
+/*
+ int ulsch_id=-1;
+ for (ulsch_id=0;ulsch_idrnti == eNB->ulsch_stats[ulsch_id].rnti) break;
+ AssertFatal(ulsch_id>=0,"no ulsch_id found\n");
+
+ if (eNB->ulsch_stats[ulsch_id].round_trials[0]>100) {
+ dump_ulsch(eNB,frame,subframe,i,ulsch_harq->round);
+ AssertFatal(1==0,"exiting\n");
+ }
+*/
}
else if ((ulsch) &&
(ulsch->rnti>0) &&
@@ -1472,7 +1499,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
ulsch->harq_mask &= ~(1 << harq_pid);
LOG_W (PHY, "Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)\n", ulsch->rnti, harq_pid, ulsch->harq_mask);
}
- } // for (i=0; inbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool);
@@ -1537,7 +1564,7 @@ void kill_te_thread(PHY_VARS_eNB *eNB) {
}
void fill_rx_indication(PHY_VARS_eNB *eNB,
- int UE_id,
+ int ULSCH_id,
int frame,
int subframe) {
nfapi_rx_indication_pdu_t *pdu;
@@ -1545,7 +1572,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
int sync_pos;
uint32_t harq_pid;
- if (eNB->ulsch[UE_id]->ue_type > 0) harq_pid = 0;
+ if (eNB->ulsch[ULSCH_id]->ue_type > 0) harq_pid = 0;
else {
harq_pid = subframe2harq_pid (&eNB->frame_parms,
frame, subframe);
@@ -1555,19 +1582,22 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe;
eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
pdu = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
- // pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
+ // pdu->rx_ue_information.handle = eNB->ulsch[ULSCH_id]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
- pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti;
+ pdu->rx_ue_information.rnti = eNB->ulsch[ULSCH_id]->rnti;
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
- pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
+ pdu->rx_indication_rel8.length = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->TBS>>3;
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
- pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes;
+ pdu->data = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->decodedBytes;
// estimate timing advance for MAC
- sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[UE_id]->drs_ch_estimates_time);
- timing_advance_update = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check
+ sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[ULSCH_id]->drs_ch_estimates_time);
+ timing_advance_update = sync_pos;
- // if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
- // if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
+ for (int i=0;iulsch_stats[i].rnti == eNB->ulsch[ULSCH_id]->rnti)
+ eNB->ulsch_stats[i].timing_offset = sync_pos;
+ // if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);}
+ // if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);}
switch (eNB->frame_parms.N_RB_DL) {
case 6: /* nothing to do */
break;
@@ -1607,7 +1637,13 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
// estimate UL_CQI for MAC
- int SNRtimes10 = dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[0] + ((eNB->frame_parms.nb_antennas_rx>1) ?eNB->pusch_vars[UE_id]->ulsch_power[1] : 0 ) ) - dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]+((eNB->frame_parms.nb_antennas_rx>1) ?eNB->pusch_vars[UE_id]->ulsch_interference_power[1] : 0 ) );
+ int total_power=0, avg_noise_power=0;
+ for (int i=0;iframe_parms.nb_antennas_rx;i++) {
+ total_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]);
+ avg_noise_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i])/eNB->frame_parms.nb_antennas_rx;
+ }
+ int SNRtimes10 = dB_fixed_x10(total_power) -
+ dB_fixed_x10(avg_noise_power);
if (SNRtimes10 < -640)
pdu->rx_indication_rel8.ul_cqi = 0;
@@ -1616,9 +1652,11 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
else
pdu->rx_indication_rel8.ul_cqi = (640 + SNRtimes10) / 5;
- LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d), timing_advance %d (update %d)\n",
- harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,eNB->measurements.n0_subband_power_avg_dB,pdu->rx_indication_rel8.timing_advance,
- timing_advance_update);
+ LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d,%d), timing_advance %d (update %d,sync_pos %d)\n",
+ harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,dB_fixed_x10(total_power),dB_fixed_x10(avg_noise_power),pdu->rx_indication_rel8.timing_advance,timing_advance_update,sync_pos);
+ for (int i=0;iframe_parms.nb_antennas_rx;i++)
+ LOG_D(PHY,"antenna %d: ulsch_power %d, noise_power %d\n",i,dB_fixed_x10(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]),dB_fixed_x10(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i]));
+
eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe;
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
@@ -1629,7 +1667,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
* Release the harq process if its round is >= 'after_rounds'
*/
static void do_release_harq(PHY_VARS_eNB *eNB,
- int UE_id,
+ int DLSCH_id,
int tb,
uint16_t frame,
uint8_t subframe,
@@ -1644,10 +1682,10 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
int harq_pid;
int subframe_tx;
int frame_tx;
- AssertFatal(UE_id != -1, "No existing dlsch context\n");
- AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
- dlsch0 = eNB->dlsch[UE_id][0];
- dlsch1 = eNB->dlsch[UE_id][1];
+ AssertFatal(DLSCH_id != -1, "No existing dlsch context\n");
+ AssertFatal(DLSCH_id < NUMBER_OF_DLSCH_MAX, "Returned DLSCH_id %d >= %d (NUMBER_OF_DLSCH_MAX)\n", DLSCH_id, NUMBER_OF_DLSCH_MAX);
+ dlsch0 = eNB->dlsch[DLSCH_id][0];
+ dlsch1 = eNB->dlsch[DLSCH_id][1];
if (eNB->frame_parms.frame_type == FDD) {
subframe_tx = (subframe + 6) % 10;
@@ -1746,13 +1784,13 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
} // end if TDD
}
-static void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack) {
+static void release_harq(PHY_VARS_eNB *eNB,int DLSCH_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack) {
/*
* Maximum number of DL transmissions = 4.
* TODO: get the value from configuration.
* If is_ack is true then we release immediately. The value -1 can be used for that.
*/
- do_release_harq(eNB, UE_id, tb, frame, subframe, mask, is_ack ? -1 : 4);
+ do_release_harq(eNB, DLSCH_id, tb, frame, subframe, mask, is_ack ? -1 : 4);
}
int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
@@ -1832,14 +1870,14 @@ void fill_ulsch_cqi_indication (PHY_VARS_eNB *eNB, uint16_t frame, uint8_t subfr
}
void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_harq, uint16_t rnti, int frame, int subframe, int bundling) {
- int UE_id = find_dlsch(rnti,eNB,SEARCH_EXIST);
+ int DLSCH_id = find_dlsch(rnti,eNB,SEARCH_EXIST);
- if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) {
- LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rnti,UE_id);
+ if( (DLSCH_id<0) || (DLSCH_id>=NUMBER_OF_DLSCH_MAX) ) {
+ LOG_E(PHY,"illegal DLSCH_id found!!! rnti %04x DLSCH_id %d\n",rnti,DLSCH_id);
return;
}
- //AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
+ //AssertFatal(DLSCH_id>=0,"DLSCH_id doesn't exist\n");
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_harq_indication_pdu_t *pdu = &eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs];
int M;
@@ -1861,7 +1899,7 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har
AssertFatal (ulsch_harq->o_ACK[i] == 0 || ulsch_harq->o_ACK[i] == 1, "harq_ack[%d] is %d, should be 1,2 or 4\n", i, ulsch_harq->o_ACK[i]);
pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 2 - ulsch_harq->o_ACK[i];
// release DLSCH if needed
- release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
+ release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
}
} else { // TDD
M = ul_ACK_subframe2_M (&eNB->frame_parms, subframe);
@@ -1877,14 +1915,14 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har
* We have to release the proper HARQ in case of ACK or NACK if max retransmission reached.
* Basically, call release_harq with 1 as last argument when ACK and 0 when NACK.
*/
- release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
+ release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
- if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
- else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
+ if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
+ else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1);
else if (M>1 && ulsch_harq->o_ACK[i] == 1) {
// spatial bundling
- release_harq(eNB,UE_id,0,frame,subframe,1<o_ACK[i] == 1);
- release_harq(eNB,UE_id,1,frame,subframe,1<o_ACK[i] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,1<o_ACK[i] == 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,1<o_ACK[i] == 1);
}
}
}
@@ -1900,10 +1938,10 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
return;
}
- int UE_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST);
+ int DLSCH_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST);
- //AssertFatal(UE_id>=0,"UE_id doesn't exist rnti:%x\n", uci->rnti);
- if (UE_id < 0) {
+ //AssertFatal(DLSCH_id>=0,"DLSCH_id doesn't exist rnti:%x\n", uci->rnti);
+ if (DLSCH_id < 0) {
LOG_E(PHY,"SFN/SF:%04d%d Unable to find rnti:%x do not send HARQ\n", frame, subframe, uci->rnti);
return;
}
@@ -1943,7 +1981,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]);
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0];
// release DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
} else if (uci->pucch_fmt == pucch_format1b) {
pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
pdu->harq_indication_fdd_rel13.mode = 0;
@@ -1953,8 +1991,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0];
pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1];
// release DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
} else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt);
} else { // TDD
AssertFatal (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode);
@@ -1972,7 +2010,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
// release all bundled DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
} else if (uci->pucch_fmt == pucch_format1b) {
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2;
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]);
@@ -1981,8 +2019,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1];
// release all DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
}
break;
@@ -1996,7 +2034,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
// release all DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
} else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) {
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2;
@@ -2005,8 +2043,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1];
// release all DLSCH if needed
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1);
} else { // num_pucch_resources (M) > 1
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.number_of_ack_nack = uci->num_pucch_resources;
@@ -2018,8 +2056,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
if (uci->num_pucch_resources == 4) pdu->harq_indication_tdd_rel13.harq_data[3].multiplex.value_0 = harq_ack[3];
// spatial-bundling in this case so release both HARQ if necessary
- release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
- release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */);
}
break;
@@ -2043,8 +2081,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 ||
tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1);
} else {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
}
@@ -2055,8 +2093,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 ||
tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1);
} else {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
}
@@ -2067,8 +2105,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 ||
tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
- release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1);
- release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1);
+ release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1);
} else {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
}
@@ -2085,7 +2123,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
-void fill_crc_indication (PHY_VARS_eNB *eNB, int UE_id, int frame, int subframe, uint8_t crc_flag) {
+void fill_crc_indication (PHY_VARS_eNB *eNB, int ULSCH_id, int frame, int subframe, uint8_t crc_flag) {
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
eNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
@@ -2094,7 +2132,7 @@ void fill_crc_indication (PHY_VARS_eNB *eNB, int UE_id, int frame, int subframe,
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
- pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti;
+ pdu->rx_ue_information.rnti = eNB->ulsch[ULSCH_id]->rnti;
pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
pdu->crc_indication_rel8.crc_flag = crc_flag;
eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
@@ -2133,20 +2171,24 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
}
lte_eNB_I0_measurements (eNB, subframe, 0, eNB->first_run_I0_measurements);
- int min_I0=1000,max_I0=0;
- int amin=0,amax=0;
- if ((frame==0) && (subframe==3)) {
- for (int i=0; iframe_parms.N_RB_UL; i++) {
- if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
- if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;}
-
- if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
- }
-
- LOG_I (PHY, "max_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
+ // clear unused statistics after 2 seconds
+ for (int i=0;iulsch_stats[i].frame <= frame) {
+ if ((eNB->ulsch_stats[i].frame + 200) < frame) memset(&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
+ }
+ else {
+ if (eNB->ulsch_stats[i].frame + 200 < (frame+1024)) memset(&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
+ }
+ if (eNB->uci_stats[i].frame <= frame) {
+ if ((eNB->uci_stats[i].frame + 200) < frame) memset(&eNB->uci_stats[i],0,sizeof(eNB->uci_stats[i]));
+ }
+ else {
+ if (eNB->uci_stats[i].frame + 200 < (frame+1024)) memset(&eNB->uci_stats[i],0,sizeof(eNB->uci_stats[i]));
+ }
}
+
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
}
@@ -2163,13 +2205,7 @@ void release_rnti_of_phy(module_id_t mod_id) {
eNB_PHY = RC.eNB[mod_id][CC_id];
rnti = release_rntis.ue_release_request_TLVs_list[i].rnti;
- for (j=0; julsch[j];
-
- if((ulsch != NULL) && (ulsch->rnti == rnti)) {
- LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
- clean_eNb_ulsch(ulsch);
- }
+ for (j=0; jdlsch[j][0];
@@ -2179,14 +2215,18 @@ void release_rnti_of_phy(module_id_t mod_id) {
}
}
- ulsch = eNB_PHY->ulsch[j];
+ for (j=0;julsch[j];
- if((ulsch != NULL) && (ulsch->rnti == rnti)) {
- LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
- clean_eNb_ulsch(ulsch);
+ if((ulsch != NULL) && (ulsch->rnti == rnti)) {
+ LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
+ clean_eNb_ulsch(ulsch);
+ for (j=0;julsch_stats[j].rnti == rnti) {eNB_PHY->ulsch_stats[j].rnti=0; break;}
+ }
}
- for(j=0; juci_vars[j].rnti == rnti) {
LOG_I(PHY, "clean eNb uci_vars[%d] UE %x \n",j, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c
index b99bb2ee7d..4d0fe428e8 100644
--- a/openair1/SCHED/prach_procedures.c
+++ b/openair1/SCHED/prach_procedures.c
@@ -31,8 +31,6 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
-#include "SCHED/sched_eNB.h"
#include "nfapi_interface.h"
#include "fapi_l1.h"
#include "nfapi_pnf.h"
@@ -46,7 +44,6 @@
#include
-#include "intertask_interface.h"
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
@@ -188,7 +185,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
else {
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((avg_preamble_energy[0]*124)>>10);
- if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
+ if (frame==0) LOG_D(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
}
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index 70399f0a23..15eba7b5bc 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -54,7 +54,6 @@
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "SCHED/sched_eNB.h"
#include "PHY/MODULATION/modulation_eNB.h"
#include "PHY/LTE_TRANSPORT/if4_tools.h"
@@ -140,27 +139,26 @@ void feptx0(RU_t *ru,
int num_symb = 7;
if (subframe_select(fp,subframe) == SF_S)
- num_symb = fp->dl_symbols_in_S_subframe+1;
+ num_symb = fp->dl_symbols_in_S_subframe+1;
- if (ru->generate_dmrs_sync == 1 && slot == 0 && subframe == 1 && aa==0) {
+ if (ru->generate_dmrs_sync == 1 && slot == 2 && aa==0) {
//int32_t dmrs[ru->frame_parms.ofdm_symbol_size*14] __attribute__((aligned(32)));
//int32_t *dmrsp[2] ={dmrs,NULL}; //{&dmrs[(3-ru->frame_parms.Ncp)*ru->frame_parms.ofdm_symbol_size],NULL};
-
- generate_drs_pusch((PHY_VARS_UE *)NULL,
- (UE_rxtx_proc_t*)NULL,
- fp,
- ru->common.txdataF_BF,
- 0,
- AMP,
- 0,
- 0,
- fp->N_RB_DL,
- aa);
+ generate_drs_pusch((PHY_VARS_UE *)NULL,
+ (UE_rxtx_proc_t*)NULL,
+ fp,
+ ru->common.txdataF_BF,
+ 0,
+ AMP,
+ 0,
+ 0,
+ fp->N_RB_DL,
+ aa);
}
- normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF],
- (int*)&ru->common.txdata[aa][slot_offset],
- num_symb,
- fp);
+ normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF],
+ (int*)&ru->common.txdata[aa][slot_offset],
+ num_symb,
+ fp);
}
}
@@ -474,15 +472,16 @@ void feptx_prec(RU_t *ru,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+ru->idx , 1);
for (aa=0;aanb_tx;aa++) {
- memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
- for (int p=0;pdo_precoding == 0) {
- if (p==0)
- memcpy((void*)ru->common.txdataF_BF[aa],
- (void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
- sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
- } else {
- if (pnb_antenna_ports_eNB) {
+ if (ru->do_precoding == 0) {
+ memcpy((void*)ru->common.txdataF_BF[aa],
+ (void*)&eNB->common_vars.txdataF[aa%fp->nb_antenna_ports_eNB][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
+ sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
+
+ }
+ else {
+ memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti);
+ for (int p=0;pnb_antenna_ports_eNB) {
// For the moment this does nothing different than below, except ignore antenna ports 5,7,8.
for (l=0;lnum_pdcch_symbols;l++)
beam_precoding(eNB->common_vars.txdataF,
@@ -494,10 +493,10 @@ void feptx_prec(RU_t *ru,
aa,
p,
eNB->Mod_id);
- } //if (pnb_antenna_ports_eNB)
+ } //if (pnb_antenna_ports_eNB)
// PDSCH region
- if (pnb_antenna_ports_eNB || p==5 || p==7 || p==8) {
+ if (pnb_antenna_ports_eNB || p==5 || p==7 || p==8) {
for (l=pdcch_vars->num_pdcch_symbols;lsymbols_per_tti;l++) {
beam_precoding(eNB->common_vars.txdataF,
ru->common.txdataF_BF,
@@ -510,8 +509,8 @@ void feptx_prec(RU_t *ru,
eNB->Mod_id);
} // for (l=pdcch_vars ....)
} // if (pnb_antenna_ports_eNB) ...
- } // ru->do_precoding!=0
- } // for (p=0...)
+ } // for (p=0...)
+ } // if do_precoding
} // for (aa=0 ...)
if(ru->idx<2)
@@ -658,7 +657,7 @@ void ru_fep_full_2thread(RU_t *ru,
struct timespec wait;
- if ((fp->frame_type == TDD) && (subframe_select(fp,subframe) != SF_UL)) return;
+ if ((fp->frame_type == TDD) && (subframe_select(fp,subframe) == SF_DL)) return;
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
@@ -705,7 +704,7 @@ void ru_fep_full_2thread(RU_t *ru,
if (proc->tti_rx/*proc->subframe_rx*/==1 && ru->is_slave==1/* && ru->state == RU_CHECK_SYNC*/)
{
- //LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx);
+ LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx);
ulsch_extract_rbs_single(ru->common.rxdataF,
calibration->rxdataF_ext,
0,
@@ -731,9 +730,10 @@ void ru_fep_full_2thread(RU_t *ru,
check_sync_pos = lte_est_timing_advance_pusch(ru->frame_parms, ru->calibration.drs_ch_estimates_time);
if (ru->state == RU_CHECK_SYNC) {
if ((check_sync_pos >= 0 && check_sync_pos<8) || (check_sync_pos < 0 && check_sync_pos>-8)) {
- LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check);
+// LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check);
ru->wait_check++;
}
+ LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check);
if (ru->wait_check==20) {
ru->state = RU_RUN;
@@ -743,10 +743,11 @@ void ru_fep_full_2thread(RU_t *ru,
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len
LOG_I(PHY,"Sending RRU_sync_ok to RAU\n");
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU %d\n",ru->idx);
+/*
//LOG_I(PHY,"~~~~~~~~~ RU_RUN\n");
- /*LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
+ LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][36*fp->N_RB_DL], 12*(fp->N_RB_DL),1,1);
- LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1);
+ //LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);*/
}
diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h
index f3e43d516e..c9fc338686 100644
--- a/openair1/SCHED/sched_common.h
+++ b/openair1/SCHED/sched_common.h
@@ -311,7 +311,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id);
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index);
-void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc);
+void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc);
LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h
index f04bec2e5c..de987b0ac7 100644
--- a/openair1/SCHED/sched_eNB.h
+++ b/openair1/SCHED/sched_eNB.h
@@ -193,7 +193,7 @@ int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
-void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc);
+void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc);
LTE_eNB_UE_stats *get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c
index 88f3dca070..012e088dff 100644
--- a/openair1/SCHED_NR/fapi_nr_l1.c
+++ b/openair1/SCHED_NR/fapi_nr_l1.c
@@ -168,7 +168,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
int pdcch_received=0;
gNB->num_pdsch_rnti[slot]=0;
- for (int i=0; inumber_of_nr_dlsch_max; i++) {
gNB->dlsch[i][0]->rnti=0;
gNB->dlsch[i][0]->harq_mask=0;
}
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index 1b2baf03f5..c8042ecec3 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -31,15 +31,12 @@
*/
#include "PHY/defs_gNB.h"
-#include "PHY/phy_extern.h"
#include "sched_nr.h"
#include "PHY/MODULATION/modulation_common.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "PHY/LTE_TRANSPORT/if5_tools.h"
-#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
-#include "LAYER2/MAC/mac.h"
#include "common/utils/LOG/log.h"
#include "common/utils/system.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 2c820e30cc..6993532928 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -381,9 +381,9 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
- // estimate UL_CQI for MAC
+ // estimate UL_CQI for MAC
- int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) -
+ int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) -
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot);
LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0);
@@ -462,7 +462,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
}
}
}
- for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
int harq_pid;
NR_UL_gNB_HARQ_t *ulsch_harq;
@@ -611,7 +611,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
}
}
- for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
int harq_pid;
NR_UL_gNB_HARQ_t *ulsch_harq;
@@ -674,7 +674,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]/=num_dmrs;
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
}
- if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
+ if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 8955454282..adfda7a0c8 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -60,7 +60,7 @@
#include "dummy_functions.c"
#include "executables/thread-common.h"
#include "executables/split_headers.h"
-
+#include "common/ran_context.h"
void feptx_ofdm(RU_t *ru, int frame, int subframe);
void feptx_prec(RU_t *ru, int frame, int subframe);
@@ -85,6 +85,7 @@ double DS_TDL = .03;
static int cmpdouble(const void *p1, const void *p2) {
return *(double *)p1 > *(double *)p2;
}
+RAN_CONTEXT_t RC;
int emulate_rf = 0;
int split73=0;
@@ -936,9 +937,10 @@ int main(int argc, char **argv) {
NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL);
} else {
- if (rballocset==0) NB_RB = 8;
+ if (rballocset==0) NB_RB = 2+TPC;
else NB_RB = DLSCH_RB_ALLOC;
+ printf("Common PDSCH: NB_RB = %d\n",NB_RB);
AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB);
}
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index c6049bc31d..0d39e6e533 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -55,6 +55,8 @@
#include "executables/thread-common.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "executables/split_headers.h"
+#include "common/ran_context.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
double cpuf;
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
@@ -87,7 +89,7 @@ static int cmpdouble(const void *p1, const void *p2) {
return *(double *)p1 > *(double *)p2;
}
-
+RAN_CONTEXT_t RC;
int split73=0;
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
AssertFatal(false, "Must not be called in this context\n");
@@ -345,7 +347,6 @@ int main(int argc, char **argv) {
int UE_id = 0;
static int nb_rb=25,first_rb=0,mcs=0,round=0;
//unsigned char l;
- static int awgn_flag = 0 ;
SCM_t channel_model=Rice1;
unsigned char *input_buffer=0,harq_pid;
unsigned short input_buffer_length;
@@ -407,7 +408,7 @@ int main(int argc, char **argv) {
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n");
logInit();
- set_glog(OAILOG_WARNING);
+ set_glog(OAILOG_INFO);
T_stdout = 1;
// enable these lines if you need debug info
// however itti will catch all signals, so ctrl-c won't work anymore
@@ -1089,14 +1090,12 @@ int main(int argc, char **argv) {
}
}
- if (awgn_flag == 0) {
- if (UE2eNB->max_Doppler == 0) {
- multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
- eNB->frame_parms.samples_per_tti,hold_channel,0);
- } else {
- multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
- 2*eNB->frame_parms.samples_per_tti,hold_channel);
- }
+ if (UE2eNB->max_Doppler == 0) {
+ multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
+ eNB->frame_parms.samples_per_tti,hold_channel,0);
+ } else {
+ multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
+ 2*eNB->frame_parms.samples_per_tti,hold_channel);
}
if(abstx) {
@@ -1139,6 +1138,15 @@ int main(int argc, char **argv) {
sqrt(sigma2/2)*gaussdouble(0.0,1.0));
}
}
+ if (n_frames==1)
+ for (i=0; iframe_parms.samples_per_tti; i++) {
+ for (aa=0; aaframe_parms.nb_antennas_rx; aa++) {
+ ((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i] =
+ (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
+ ((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i+1] =
+ (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
+ }
+ }
if (n_frames<=10) {
printf("rx_level Null symbol %f\n",10*log10((double)signal_energy((int *)
@@ -1164,9 +1172,10 @@ int main(int argc, char **argv) {
start_meas(&eNB->phy_proc_rx);
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full;
ru->feprx(ru,subframe);
+ if (n_frames==1) lte_eNB_I0_measurements(eNB,(subframe+1)%10,0,1);
+
phy_procedures_eNB_uespec_RX(eNB,proc_rxtx);
stop_meas(&eNB->phy_proc_rx);
-
if (cqi_flag > 0) {
cqi_error = 0;
@@ -1206,6 +1215,9 @@ int main(int argc, char **argv) {
eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL);
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
+ dump_I0_stats(stdout,eNB);
+ dump_ulsch_stats(stdout,eNB,0);
+
exit(-1);
}
@@ -1266,14 +1278,16 @@ int main(int argc, char **argv) {
if (t_rx > 2000 )
n_rx_dropped++;
- appendVarArray(table_tx, &t_tx);
- appendVarArray(table_tx_ifft, &t_tx_ifft);
- appendVarArray(table_tx_mod, &t_tx_mod );
- appendVarArray(table_tx_enc, &t_tx_enc );
- appendVarArray(table_rx, &t_rx );
- appendVarArray(table_rx_fft, &t_rx_fft );
- appendVarArray(table_rx_demod, &t_rx_demod );
- appendVarArray(table_rx_dec, &t_rx_dec );
+ if (trials < 1000) {
+ appendVarArray(table_tx, &t_tx);
+ appendVarArray(table_tx_ifft, &t_tx_ifft);
+ appendVarArray(table_tx_mod, &t_tx_mod );
+ appendVarArray(table_tx_enc, &t_tx_enc );
+ appendVarArray(table_rx, &t_rx );
+ appendVarArray(table_rx_fft, &t_rx_fft );
+ appendVarArray(table_rx_demod, &t_rx_demod );
+ appendVarArray(table_rx_dec, &t_rx_dec );
+ }
} //trials
// sort table
@@ -1292,6 +1306,7 @@ int main(int argc, char **argv) {
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
}
+ dump_ulsch_stats(stdout,eNB,0);
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %u dB, delta_IF %d [ (%d,%d) dB / (%u,%u) dB ]**************************\n",
nb_rb,mcs,SNR,SNR2,
tx_lev_dB,
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index 12b0b1d1f0..633a214699 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -357,7 +357,7 @@ int main(int argc, char **argv)
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
crcTableInit();
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions);
- phy_init_nr_gNB(gNB, 0, 0);
+ phy_init_nr_gNB(gNB, 0, 1); //lowmem
//init_eNB_afterRU();
frame_length_complex_samples = frame_parms->samples_per_subframe;
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index c924e28dc8..54c3a68631 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -69,6 +69,8 @@
#include
#include
+#include
+
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
rlc_info_t Rlc_info_um,Rlc_info_am_config;
@@ -773,7 +775,7 @@ int main(int argc, char **argv)
// reset preprocessor to the one of DLSIM after it has been set during
// rrc_mac_config_req_gNB
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
- phy_init_nr_gNB(gNB,0,0);
+ phy_init_nr_gNB(gNB,0,1);
N_RB_DL = gNB->frame_parms.N_RB_DL;
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
UE_info->num_UEs=1;
@@ -1416,15 +1418,62 @@ void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dm
}
else if (dmrs_arg[0] == 1) {
mapping_type = typeB;
+ } else {
+ AssertFatal(1==0,"Incorrect Mappingtype, valid options 0-typeA, 1-typeB\n");
}
- /* Additional DMRS positions 0 ,1 and 2 */
- if(dmrs_arg[1] >= 0 && dmrs_arg[1] <3 ) {
+
+ /* Additional DMRS positions 0 ,1 ,2 and 3 */
+ if(dmrs_arg[1] >= 0 && dmrs_arg[1] <4 ) {
add_pos = dmrs_arg[1];
+ } else {
+ AssertFatal(1==0,"Incorrect Additional Position, valid options 0-pos1, 1-pos1, 2-pos2, 3-pos3\n");
}
if(scg != NULL) {
NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0];
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = add_pos;
+
+ AssertFatal((bwp->bwp_Dedicated->pdsch_Config != NULL && bwp->bwp_Dedicated->pdsch_Config->choice.setup != NULL), "Base RRC reconfig structures are not allocated.\n");
+
+ if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA == NULL) {
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL;
+ printf("DLSIM: Allocated Mapping TypeA in RRC reconfig message\n");
+ } else if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB == NULL) {
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->maxLength=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID0=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID1=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->phaseTrackingRS=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_AdditionalPosition = NULL;
+ printf("DLSIM: Allocated Mapping TypeB in RRC reconfig message\n");
+ }
+
+ struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeA = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA;
+ struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeB = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB;
+
+
+ NR_DMRS_DownlinkConfig_t *dmrs_config = (mapping_type == typeA) ? dmrs_MappingtypeA->choice.setup : dmrs_MappingtypeB->choice.setup;
+
+ if (add_pos != 2) { // pos0,pos1,pos3
+ if (dmrs_config->dmrs_AdditionalPosition == NULL) {
+ dmrs_config->dmrs_AdditionalPosition = calloc(1,sizeof(*dmrs_MappingtypeA->choice.setup->dmrs_AdditionalPosition));
+ }
+ *dmrs_config->dmrs_AdditionalPosition = add_pos;
+ } else { // if NULL, Value pos2
+ free(dmrs_config->dmrs_AdditionalPosition);
+ dmrs_config->dmrs_AdditionalPosition = NULL;
+ }
+
for (int i=0;ibwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType = mapping_type;
}
diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
index 32b6b10412..24ed8a930c 100644
--- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
+++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
@@ -1,3 +1,5 @@
+#include "nfapi/oai_integration/vendor_ext.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); }
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index c24a841c4b..548b76db69 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -47,7 +47,7 @@
#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
//#define DEBUG_NR_PBCHSIM
PHY_VARS_gNB *gNB;
@@ -415,7 +415,7 @@ int main(int argc, char **argv)
frame_parms->ssb_type = nr_ssb_type_C;
nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
- phy_init_nr_gNB(gNB,0,0);
+ phy_init_nr_gNB(gNB,0,1);
nr_set_ssb_first_subcarrier(&gNB->gNB_config,frame_parms);
uint8_t n_hf = 0;
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index 6ca7a9dde0..7fcbf8256b 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -48,10 +48,10 @@
#include "OCG_vars.h"
#include
#include
+#include
#include
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
-
#define NR_PRACH_DEBUG 1
#define PRACH_WRITE_OUTPUT_DEBUG 1
@@ -541,7 +541,8 @@ int main(int argc, char **argv){
ru->if_south = LOCAL_RF;
ru->nb_tx = n_tx;
ru->nb_rx = n_rx;
-
+ ru->num_gNB = 1;
+ ru->gNB_list[0] = gNB;
gNB->gNB_config.carrier_config.num_tx_ant.value = 1;
gNB->gNB_config.carrier_config.num_rx_ant.value = 1;
if (mu==1)
@@ -642,7 +643,7 @@ int main(int argc, char **argv){
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
RC.nb_nr_L1_inst=1;
- phy_init_nr_gNB(gNB,0,0);
+ phy_init_nr_gNB(gNB,0,1); //lowmem
nr_phy_init_RU(ru);
gNB->common_vars.rxdata = ru->common.rxdata;
set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4);
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 749703d230..9c5fa5b8c9 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -46,6 +46,7 @@
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
+
PHY_VARS_gNB *gNB;
PHY_VARS_NR_UE *UE;
RAN_CONTEXT_t RC;
diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c
index f84e553683..c889e6dcb9 100644
--- a/openair1/SIMULATION/NR_PHY/ulschsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulschsim.c
@@ -394,7 +394,7 @@ int main(int argc, char **argv)
nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions);
- phy_init_nr_gNB(gNB, 0, 0);
+ phy_init_nr_gNB(gNB, 0, 1); //lowmem
//configure UE
UE = malloc(sizeof(PHY_VARS_NR_UE));
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index a99a47dc54..a7fab7c945 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -63,8 +63,8 @@
#include
#include
+#include
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
-
//#define DEBUG_ULSIM
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
@@ -240,6 +240,7 @@ double s_re1[122880],s_im1[122880],r_re1[122880],r_im1[122880];
double r_re2[122880],r_im2[122880];
double r_re3[122880],r_im3[122880];
+
int main(int argc, char **argv)
{
char c;
@@ -706,7 +707,7 @@ int main(int argc, char **argv)
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL);
// UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
- phy_init_nr_gNB(gNB,0,0);
+ phy_init_nr_gNB(gNB,0,1);
N_RB_DL = gNB->frame_parms.N_RB_DL;
@@ -831,7 +832,7 @@ int main(int argc, char **argv)
}
uint8_t length_dmrs = pusch_len1;
- uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs);
+ uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs, start_symbol, NR_MIB__dmrs_TypeA_Position_pos2);
uint16_t number_dmrs_symbols = get_dmrs_symbols_in_slot(l_prime_mask, nb_symb_sch);
uint8_t nb_re_dmrs = (dmrs_config_type == pusch_dmrs_type1) ? 6 : 4;
@@ -1017,7 +1018,7 @@ int main(int argc, char **argv)
pusch_pdu->transform_precoding = transform_precoding;
pusch_pdu->data_scrambling_id = *scc->physCellId;
pusch_pdu->nrOfLayers = 1;
- pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol;
+ pusch_pdu->ul_dmrs_symb_pos = l_prime_mask;
pusch_pdu->dmrs_config_type = dmrs_config_type;
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
pusch_pdu->scid = 0;
@@ -1080,7 +1081,7 @@ int main(int argc, char **argv)
ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb;
ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch;
ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol;
- ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol;
+ ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask;
ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs;
ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c
index 683526a8f0..3608eb7da2 100644
--- a/openair1/SIMULATION/TOOLS/multipath_channel.c
+++ b/openair1/SIMULATION/TOOLS/multipath_channel.c
@@ -39,13 +39,13 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
//#define CHANNEL_SSE
#ifdef CHANNEL_SSE
void multipath_channel(channel_desc_t *desc,
- double tx_sig_re[2][30720*2],
- double tx_sig_im[2][30720*2],
- double rx_sig_re[2][30720*2],
- double rx_sig_im[2][30720*2],
+ double tx_sig_re[NB_ANTENNAS_TX][30720*2],
+ double tx_sig_im[NB_ANTENANS_TX][30720*2],
+ double rx_sig_re[NB_ANTENNAS_RX][30720*2],
+ double rx_sig_im[NB_ANTENNAS_RX][30720*2],
uint32_t length,
uint8_t keep_channel,
- int log_channel)
+ int log_channel)
{
int i,ii,j,l;
@@ -146,13 +146,13 @@ void multipath_channel(channel_desc_t *desc,
#else
void multipath_channel(channel_desc_t *desc,
- double *tx_sig_re[2],
- double *tx_sig_im[2],
- double *rx_sig_re[2],
- double *rx_sig_im[2],
+ double *tx_sig_re[NB_ANTENNAS_TX],
+ double *tx_sig_im[NB_ANTENNAS_TX],
+ double *rx_sig_re[NB_ANTENNAS_RX],
+ double *rx_sig_im[NB_ANTENNAS_RX],
uint32_t length,
uint8_t keep_channel,
- int log_channel)
+ int log_channel)
{
int i,ii,j,l;
@@ -198,21 +198,22 @@ void multipath_channel(channel_desc_t *desc,
rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
- if (i==0 && log_channel == 1) {
- printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
- desc->ch[ii+(j*desc->nb_rx)][l].x,
- desc->ch[ii+(j*desc->nb_rx)][l].y);
- }
+
+ if (i==0 && log_channel == 1) {
+ printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
+ desc->ch[ii+(j*desc->nb_rx)][l].x,
+ desc->ch[ii+(j*desc->nb_rx)][l].y);
+ }
} //l
} // j
rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
-
- /* if ((ii==0)&&((i%32)==0)) {
- printf("%p %p %f,%f => %e,%e\n",rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
- }*/
-
+#ifdef DEBUG_CHANNEL
+ if ((i%32)==0) {
+ printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
+ }
+#endif
//rx_sig_re[ii][i] = sqrt(.5)*(tx_sig_re[0][i] + tx_sig_re[1][i]);
//rx_sig_im[ii][i] = sqrt(.5)*(tx_sig_im[0][i] + tx_sig_im[1][i]);
diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index 4e26d9a954..d2339954bd 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -2034,7 +2034,6 @@ static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt)
prnt("ERROR: %s, unknown channel parameter\n",param);
return CMDSTATUS_FOUND;
}
-
display_channelmodel(defined_channels[cd_id],debug,prnt);
free(param);
free(value);
diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h
index 7696f9202f..78e260b73f 100644
--- a/openair1/SIMULATION/TOOLS/sim.h
+++ b/openair1/SIMULATION/TOOLS/sim.h
@@ -339,10 +339,10 @@ void set_channeldesc_name(channel_desc_t *cdesc,char *modelname);
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
/**\fn void multipath_channel(channel_desc_t *desc,
- double tx_sig_re[2],
- double tx_sig_im[2],
- double rx_sig_re[2],
- double rx_sig_im[2],
+ double tx_sig_re[NB_ANTENNAS_TX],
+ double tx_sig_im[NB_ANTENANS_TX],
+ double rx_sig_re[NB_ANTENNAS_RX],
+ double rx_sig_im[NB_ANTENNAS_RX],
uint32_t length,
uint8_t keep_channel,
int log_channel)
@@ -359,10 +359,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
*/
void multipath_channel(channel_desc_t *desc,
- double *tx_sig_re[2],
- double *tx_sig_im[2],
- double *rx_sig_re[2],
- double *rx_sig_im[2],
+ double *tx_sig_re[NB_ANTENNAS_TX],
+ double *tx_sig_im[NB_ANTENNAS_TX],
+ double *rx_sig_re[NB_ANTENNAS_RX],
+ double *rx_sig_im[NB_ANTENNAS_RX],
uint32_t length,
uint8_t keep_channel,
int log_channel);
@@ -510,7 +510,6 @@ double N_RB2channel_bandwidth(uint16_t N_RB);
void InitSinLUT( void );
void phase_noise(double ts, int16_t * InRe, int16_t * InIm);
-#include "targets/RT/USER/rfsim.h"
void do_DL_sig(sim_t *sim,
uint16_t subframe,
diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h
index be6927ec37..1a48a9bb97 100644
--- a/openair2/COMMON/platform_constants.h
+++ b/openair2/COMMON/platform_constants.h
@@ -28,12 +28,19 @@
***************************************************************************/
-#include "LTE_asn_constant.h"
-#include "NR_asn_constant.h"
#ifndef __PLATFORM_CONSTANTS_H__
# define __PLATFORM_CONSTANTS_H__
+#ifndef NO_RRC
+#include "LTE_asn_constant.h"
+#include "NR_asn_constant.h"
+#else
+#define LTE_maxDRB 14
+#define LTE_maxDRB_NB_r13 5
+#define NR_MAXDRB 14
+#endif
+
#ifdef JUMBO_FRAME
#define NL_MAX_PAYLOAD 18000 /* this should cover the max mtu size*/
#else
@@ -87,14 +94,7 @@
#define MAX_gNB 2
#endif
-#define NUMBER_OF_NR_DLSCH_MAX 2//16
-#define NUMBER_OF_NR_ULSCH_MAX 2//16
-#define NUMBER_OF_NR_SCH_STATS_MAX 16
#define NUMBER_OF_NR_UCI_STATS_MAX 16
-#define NUMBER_OF_NR_PUCCH_MAX 16
-#define NUMBER_OF_NR_SR_MAX 16
-#define NUMBER_OF_NR_PDCCH_MAX 16
-
#define MAX_MANAGED_ENB_PER_MOBILE 2
#define MAX_MANAGED_GNB_PER_MOBILE 2
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
index 7ca466e8ff..51e495b027 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
@@ -42,6 +42,9 @@
#include
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
/*Array containing the Agent-MAC interfaces*/
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
index 42246c3ebf..e05fa98854 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
@@ -33,6 +33,9 @@
#include "flexran_agent_mac_internal.h"
#include "flexran_agent_mac_slice_verification.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
extern SLIST_HEAD(flexran_so_handle,
flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB];
diff --git a/openair2/ENB_APP/MACRLC_paramdef.h b/openair2/ENB_APP/MACRLC_paramdef.h
index fcee6142f0..11cbe445b8 100644
--- a/openair2/ENB_APP/MACRLC_paramdef.h
+++ b/openair2/ENB_APP/MACRLC_paramdef.h
@@ -56,10 +56,14 @@
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
#define CONFIG_STRING_MACRLC_SCHED_MODE "scheduler_mode"
-#define CONFIG_MACRLC_PUSCH10xSNR "puSch10xSnr"
-#define CONFIG_MACRLC_PUCCH10xSNR "puCch10xSnr"
+#define CONFIG_STRING_MACRLC_PUSCH10xSNR "puSch10xSnr"
+#define CONFIG_STRING_MACRLC_PUCCH10xSNR "puCch10xSnr"
#define CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO "default_sched_dl_algo"
-
+#define CONFIG_STRING_MACRLC_UE_MULTIPLE_MAX "ue_multiple_max"
+#define CONFIG_STRING_MACRLC_USE_MCS_OFFSET "use_mcs_offset"
+#define CONFIG_STRING_MACRLC_BLER_TARGET_LOWER "bler_target_lower"
+#define CONFIG_STRING_MACRLC_BLER_TARGET_UPPER "bler_target_upper"
+#define CONFIG_STRING_MACRLC_MAX_UL_RB_INDEX "max_ul_rb_index"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* MacRLC configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
@@ -83,10 +87,15 @@
{CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_SCHED_MODE, NULL, 0, strptr:NULL, defstrval:"default", TYPE_STRING, 0}, \
-{CONFIG_MACRLC_PUSCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
-{CONFIG_MACRLC_PUCCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
-{CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO, NULL, 0, strptr:NULL, defstrval:"round_robin_dl", TYPE_STRING, 0}, \
-}
+{CONFIG_STRING_MACRLC_PUSCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
+{CONFIG_STRING_MACRLC_PUCCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \
+{CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO, NULL, 0, strptr:NULL, defstrval:"round_robin_dl", TYPE_STRING, 0}, \
+{CONFIG_STRING_MACRLC_UE_MULTIPLE_MAX, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \
+{CONFIG_STRING_MACRLC_USE_MCS_OFFSET, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
+{CONFIG_STRING_MACRLC_BLER_TARGET_LOWER, NULL, 0, dblptr:NULL, defdblval:.5, TYPE_DOUBLE, 0}, \
+{CONFIG_STRING_MACRLC_BLER_TARGET_UPPER, NULL, 0, dblptr:NULL, defdblval:2, TYPE_DOUBLE, 0}, \
+{CONFIG_STRING_MACRLC_MAX_UL_RB_INDEX, NULL, 0, iptr:NULL, defintval:22, TYPE_INT, 0}}
+
#define MACRLC_CC_IDX 0
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
#define MACRLC_LOCAL_N_IF_NAME_IDX 2
@@ -108,6 +117,11 @@
#define MACRLC_PUSCH10xSNR_IDX 18
#define MACRLC_PUCCH10xSNR_IDX 19
#define MACRLC_DEFAULT_SCHED_DL_ALGO_IDX 20
+#define MACRLC_UE_MULTIPLE_MAX_IDX 21
+#define MACRLC_USE_MCS_OFFSET_IDX 22
+#define MACRLC_BLER_TARGET_LOWER_IDX 23
+#define MACRLC_BLER_TARGET_UPPER_IDX 24
+#define MACRLC_MAX_UL_RB_INDEX_IDX 25
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
#endif
diff --git a/openair2/ENB_APP/NB_IoT_interface.c b/openair2/ENB_APP/NB_IoT_interface.c
index 7355233d71..8fc6de78af 100644
--- a/openair2/ENB_APP/NB_IoT_interface.c
+++ b/openair2/ENB_APP/NB_IoT_interface.c
@@ -35,6 +35,9 @@
#define NBIOT_INTERFACE_SOURCE
#include "NB_IoT_interface.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
diff --git a/openair2/ENB_APP/NB_IoT_interface.h b/openair2/ENB_APP/NB_IoT_interface.h
index b3454b077b..c13f6dd1cb 100644
--- a/openair2/ENB_APP/NB_IoT_interface.h
+++ b/openair2/ENB_APP/NB_IoT_interface.h
@@ -31,6 +31,7 @@
#define NBIOT_MODULENAME "NB_IoT"
+#include "common/ran_context.h"
typedef void(*RCConfig_NbIoT_f_t)(RAN_CONTEXT_t *RC);
#define NBIOT_RCCONFIG_FNAME "RCConfig_NbIoT"
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 5080157c3f..9f134f826e 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -244,6 +244,8 @@ void *eNB_app_task(void *args_p) {
}
+ LOG_I(ENB_APP,"TASK_ENB_APP is ready\n");
+
do {
// Wait for a message
itti_receive_msg (TASK_ENB_APP, &msg_p);
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index ee7b26ff1a..9b4f3c7261 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -64,6 +64,8 @@ extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t
extern char *parallel_config;
extern char *worker_config;
+RAN_CONTEXT_t RC;
+
void RCconfig_flexran() {
/* get number of eNBs */
paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
@@ -218,13 +220,26 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) {
for (j = 0; j < RC.nb_macrlc_inst; j++) {
RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr);
RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr);
+ RC.mac[j]->ue_multiple_max = *(MacRLC_ParamList.paramarray[j][MACRLC_UE_MULTIPLE_MAX_IDX ].iptr);
+ RC.mac[j]->use_mcs_offset = *(MacRLC_ParamList.paramarray[j][MACRLC_USE_MCS_OFFSET_IDX ].iptr);
+ RC.mac[j]->bler_lower = *(MacRLC_ParamList.paramarray[j][MACRLC_BLER_TARGET_LOWER_IDX ].dblptr);
+ RC.mac[j]->bler_upper = *(MacRLC_ParamList.paramarray[j][MACRLC_BLER_TARGET_UPPER_IDX ].dblptr);
+ RC.mac[j]->max_ul_rb_index = *(MacRLC_ParamList.paramarray[j][MACRLC_MAX_UL_RB_INDEX_IDX ].iptr);
RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
-
+ LOG_I(ENB_APP,"MAC instance %d parameters : pusch_snr %lf, pucch_snr %lf, ue_multiple_max %d, use_mcs_offset %d, bler_lower %lf, bler_upper %lf,max_ul_rb_index %d\n",
+ j,
+ RC.mac[j]->puSch10xSnr/10.0,
+ RC.mac[j]->puCch10xSnr/10.0,
+ RC.mac[j]->ue_multiple_max,
+ RC.mac[j]->use_mcs_offset,
+ RC.mac[j]->bler_lower,
+ RC.mac[j]->bler_upper,
+ RC.mac[j]->max_ul_rb_index);
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
// check number of instances is same as RRC/PDCP
- printf("Configuring local RRC for MACRLC\n");
+ LOG_I(ENB_APP,"Configuring local RRC for MACRLC\n");
} else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
- printf("Configuring F1 interfaces for MACRLC\n");
+ LOG_I(ENB_APP,"Configuring F1 interfaces for MACRLC\n");
RC.mac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
RC.mac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
RC.mac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
@@ -1993,7 +2008,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) {
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth;
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1;
F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator;
- F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0;
+ F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.sul_active = 0;
} else {
LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k);
F1AP_SETUP_REQ (msg_p).fdd_flag = 1;
@@ -2779,12 +2794,13 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
"value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n",
X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS);
X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 = 0;
-
+ LOG_I(X2AP,"X2ParamList.numelt %d\n",X2ParamList.numelt);
for (l = 0; l < X2ParamList.numelt; l++) {
X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 += 1;
strcpy(X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv4_address,*(X2ParamList.paramarray[l][ENB_X2_IPV4_ADDRESS_IDX].strptr));
strcpy(X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv6_address,*(X2ParamList.paramarray[l][ENB_X2_IPV6_ADDRESS_IDX].strptr));
+ LOG_I(X2AP,"registering with ip : %s\n",*(X2ParamList.paramarray[l][ENB_X2_IPV4_ADDRESS_IDX].strptr));
if (strcmp(*(X2ParamList.paramarray[l][ENB_X2_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv4 = 1;
X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv6 = 0;
@@ -2964,7 +2980,7 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont
eNB_RRC_INST *rrc = RC.rrc[inst];
rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0];
LTE_BCCH_DL_SCH_Message_t *bcch_message ;
- AssertFatal(si_ind==0,"Can only handle a single SI block for now\n");
+ AssertFatal(si_ind==2,"Can only handle a single SI block for now\n");
LOG_I(ENB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n",inst,si_ind,si_container,si_container_length);
// point to first SI block
bcch_message = &carrier->systemInformation;
@@ -3151,15 +3167,19 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) {
(check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 &&
resp->cells_to_activate[j].nrpci == carrier->physCellId)) {
// copy system information and decode it
- for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) {
+ for (si_ind=2; si_indcells_to_activate[j].num_SI; si_ind++) {
//printf("SI %d size %d: ", si_ind, resp->SI_container_length[j][si_ind]);
//for (int n=0;nSI_container_length[j][si_ind];n++)
// printf("%02x ",resp->SI_container[j][si_ind][n]);
//printf("\n");
- extract_and_decode_SI(i,
- si_ind,
- resp->cells_to_activate[j].SI_container[si_ind],
- resp->cells_to_activate[j].SI_container_length[si_ind]);
+ if (si_ind==6) si_ind=9;
+ if (resp->cells_to_activate[j].SI_container[si_ind] != NULL) {
+ extract_and_decode_SI(i,
+ si_ind,
+ resp->cells_to_activate[j].SI_container[si_ind],
+ resp->cells_to_activate[j].SI_container_length[si_ind]);
+ }
+
}
// perform MAC/L1 common configuration
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index 4bc4f5bf22..b95bf90f70 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -100,7 +100,6 @@ typedef struct ru_config_s {
uint8_t if_compress;
} ru_config_t;
-extern void RCconfig_RU(void);
extern void RCconfig_flexran(void);
extern void RCconfig_L1(void);
extern void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]);
diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c
index 33182f3593..af7ff6ff6f 100644
--- a/openair2/ENB_APP/flexran_agent.c
+++ b/openair2/ENB_APP/flexran_agent.c
@@ -33,6 +33,9 @@
#include
#include
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
int agent_task_created = 0;
/*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c
index 1af59eab87..55a1c61b25 100644
--- a/openair2/ENB_APP/flexran_agent_common.c
+++ b/openair2/ENB_APP/flexran_agent_common.c
@@ -53,6 +53,9 @@
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rrc_eNB_UE_context.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
/*
* message primitives
*/
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c
index ff21971810..070ce1be03 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.c
+++ b/openair2/ENB_APP/flexran_agent_ran_api.c
@@ -32,6 +32,9 @@
#include "s1ap_eNB_management_procedures.h"
#include "openair2/LAYER2/MAC/slicing/slicing.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
static inline int phy_is_present(mid_t mod_id, uint8_t cc_id) {
return RC.eNB && RC.eNB[mod_id] && RC.eNB[mod_id][cc_id];
}
diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c
index 6ab6932f88..4104fce837 100644
--- a/openair2/F1AP/f1ap_cu_interface_management.c
+++ b/openair2/F1AP/f1ap_cu_interface_management.c
@@ -142,8 +142,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* tac */
if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) {
OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]);
- LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n",
- i, F1AP_SETUP_REQ(message_p).tac[i]);
+ LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]);
}
/* - nRCGI */
TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i],
@@ -322,22 +321,22 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List;
-
-
+
+
for (i=0;
iid = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
-
+
/* 3.1 cells to be Activated list item */
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
-
+
/* - nRCGI */
F1AP_NRCGI_t nRCGI;
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
@@ -345,14 +344,14 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
&nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity);
cells_to_be_activated_list_item.nRCGI = nRCGI;
-
+
/* optional */
/* - nRPCI */
if (1) {
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
*cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007
}
-
+
/* optional */
/* - gNB-CU System Information */
if (1) {
@@ -559,44 +558,44 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
-
+
// mandatory
- // c2. Cells_to_be_Activated_List
+ // c2. Cells_to_be_Activated_List
if (f1ap_gnb_cu_configuration_update->num_cells_to_activate > 0) {
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List;
-
+
for (i=0; inum_cells_to_activate; i++) {
-
+
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t));
cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject;
cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
-
+
// 2.1 cells to be Activated list item
F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t));
-
- // - nRCGI
+
+ // - nRCGI
F1AP_NRCGI_t nRCGI;
memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t));
- MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
- f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
+ MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc,
+ f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc,
f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length,
&nRCGI.pLMN_Identity);
- NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid,
+ NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid,
&nRCGI.nRCellIdentity);
cells_to_be_activated_list_item.nRCGI = nRCGI;
-
+
// optional
// -nRPCI
cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t));
*cells_to_be_activated_list_item.nRPCI = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007
-
- // optional
+
+ // optional
// 3.1.2 gNB-CUSystem Information
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs;
cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t));
@@ -610,7 +609,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
//for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++)
// printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]);
//printf("\n");
-
+
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
for (int sIBtype=2;sIBtype<21;sIBtype++) {
if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
@@ -619,39 +618,39 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
memset((void*)sib_item,0,sizeof(*sib_item));
sib_item->sIBtype = sIBtype;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
- (const char*)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype],
+ (const char*)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype],
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
-
+
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item);
}
}
cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation;
-
-
+
+
F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t;
memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t));
-
+
ASN_SEQUENCE_ADD(&p_154P112_t.list,
cells_to_be_activated_list_itemExtIEs);
cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t;
-
+
free(gNB_CUSystemInformation);
gNB_CUSystemInformation = NULL;
- }
+ }
// ADD
cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
cells_to_be_activated_list_item_ies);
- }
+ }
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
-
+
}
-
+
/*
- // c3. Cells_to_be_Deactivated_List
+ // c3. Cells_to_be_Deactivated_List
//
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List;
@@ -668,7 +667,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject;
cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item;
- // 3.1 cells to be Deactivated list item
+ // 3.1 cells to be Deactivated list item
F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item;
memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t));
@@ -690,7 +689,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
/*
// c4. GNB_CU_TNL_Association_To_Add_List
-
+
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List;
ie->criticality = F1AP_Criticality_reject;
@@ -706,7 +705,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject;
gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item;
- // 4.1 GNB_CU_TNL_Association_To_Add_Item
+ // 4.1 GNB_CU_TNL_Association_To_Add_Item
F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item;
memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t));
@@ -728,7 +727,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
-
+
gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item;
ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list,
gnb_cu_tnl_association_to_add_item_ies);
@@ -737,8 +736,8 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
*/
- /*
-
+ /*
+
// c5. GNB_CU_TNL_Association_To_Remove_List
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List;
@@ -759,7 +758,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t));
- // 4.1.1 tNLAssociationTransportLayerAddress
+ // 4.1.1 tNLAssociationTransportLayerAddress
F1AP_CP_TransportLayerAddress_t transportLayerAddress;
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
@@ -781,7 +780,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
*/
- /*
+ /*
//c6. GNB_CU_TNL_Association_To_Update_List
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List;
@@ -797,7 +796,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject;
gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item;
- // 4.1 GNB_CU_TNL_Association_To_Update_Item
+ // 4.1 GNB_CU_TNL_Association_To_Update_Item
F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item;
memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t));
@@ -816,7 +815,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
- // 4.1.2 tNLAssociationUsage
+ // 4.1.2 tNLAssociationUsage
if (1) {
gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t));
*gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue;
@@ -830,7 +829,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
*/
- /*
+ /*
// c7. Cells_to_be_Barred_List
ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List;
@@ -850,7 +849,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item;
memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t));
- // - nRCGI
+ // - nRCGI
F1AP_NRCGI_t nRCGI;
memset(&nRCGI,0,sizeof(F1AP_NRCGI_t));
MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length,
diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
index 0255da0f29..1b1e8b1299 100644
--- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
+++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
@@ -155,7 +155,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
// first get RRC instance (note, no the ITTI instance)
gNB_RRC_INST *rrc = RC.nrrrc[i];
if (rrc->nr_cellid == nr_cellid) {
- rrc_inst = i;
+ rrc_inst = i;
break;
}
}
@@ -164,7 +164,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
// first get RRC instance (note, no the ITTI instance)
eNB_RRC_INST *rrc = RC.rrc[i];
if (rrc->nr_cellid == nr_cellid) {
- rrc_inst = i;
+ rrc_inst = i;
break;
}
}
@@ -180,20 +180,20 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
- NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
+ NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
- NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
+ NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
- NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
+ NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
} else {
- RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
+ RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
- RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
+ RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
- RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
+ RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
}
@@ -211,7 +211,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
{
LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n");
- F1AP_F1AP_PDU_t pdu;
+ F1AP_F1AP_PDU_t pdu;
F1AP_DLRRCMessageTransfer_t *out;
F1AP_DLRRCMessageTransferIEs_t *ie;
@@ -300,25 +300,23 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* optional */
/* c7. RAT_FrequencyPriorityInformation */
/* TODO */
- if (0) {
- int endc=1;
- ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
- ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation;
- ie->criticality = F1AP_Criticality_reject;
- ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation;
- if (endc==1) {
- ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC;
- ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L;
- }
- else {
- ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN;
- ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L;
- }
- //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority;
- //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L;
- ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+ int endc=1;
+ ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
+ ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation;
+ ie->criticality = F1AP_Criticality_reject;
+ ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation;
+ if (endc==1) {
+ ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC;
+ ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L;
}
-
+ else {
+ ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN;
+ ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L;
+ }
+ //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority;
+ //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L;
+ ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
+
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER \n");
diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c
index 2f30a9d817..4c8eef8a05 100644
--- a/openair2/F1AP/f1ap_cu_ue_context_management.c
+++ b/openair2/F1AP/f1ap_cu_ue_context_management.c
@@ -440,6 +440,7 @@ if (0) {
DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L;
DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L;
+
/* OPTIONAL */
/* delayCritical */
if (0) {
@@ -475,7 +476,7 @@ if (0) {
/* OPTIONAL */
/* gBR_QoS_Flow_Information */
if (0) {
- DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t));
+ DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t));
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L);
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L);
asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L);
@@ -484,14 +485,14 @@ if (0) {
/* OPTIONAL */
/* maxPacketLossRateDownlink */
if (0) {
- DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
+ DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
*DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L;
}
/* OPTIONAL */
/* maxPacketLossRateUplink */
if (0) {
- DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
+ DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t));
*DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L;
}
@@ -500,7 +501,7 @@ if (0) {
/* OPTIONAL */
/* reflective_QoS_Attribute */
if (0) {
- DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long));
+ DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long));
*DRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L;
}
@@ -728,7 +729,7 @@ if (0) {
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation;
- int endc = 1; // RK: Get this from somewhere ...
+ int endc = 1; // RK: Get this from somewhere ...
if (endc) {
ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC;
ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L;
diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c
index e2e09c15c2..e75580cece 100644
--- a/openair2/F1AP/f1ap_du_interface_management.c
+++ b/openair2/F1AP/f1ap_du_interface_management.c
@@ -240,7 +240,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* FDD.1.3 freqBandListNr */
int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands;
- LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands);
+ LOG_I(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands);
int fdd_ul_j;
for (fdd_ul_j=0;
fdd_ul_jnr_mode_info[i].fdd.dl_num_frequency_bands;
- LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands);
+ LOG_I(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands);
int fdd_dl_j;
for (fdd_dl_j=0;
fdd_dl_jnr_mode_info[i].tdd.num_frequency_bands;
- LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands);
+ LOG_I(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands);
+ AssertFatal(tdd_num_available_freq_Bands > 0, "should have at least one TDD band available\n");
int j;
for (j=0;
jnRCGI.nRCellIdentity.buf[2],
cell->nRCGI.nRCellIdentity.buf[3],
cell->nRCGI.nRCellIdentity.buf[4]);
+
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid);
- F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
- if (ext==NULL) continue;
+ F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
+
+ if (ext==NULL) continue;
for (int cnt=0;cntlist.count;cnt++) {
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt];
@@ -582,10 +585,9 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
} // switch ie
} // for IE
AssertFatal(TransactionId!=-1,"TransactionId was not sent\n");
- LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate);
+ AssertFatal(num_cells_to_activate>0,"No cells activated\n");
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate;
- // tmp
- // F1AP_SETUP_RESP (msg_p).num_SI[0] = 1;
+
for (int i=0;i 0, "System Information %d is missing",i);
@@ -605,7 +607,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
} else {
LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n",
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
- itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
+ itti_send_msg_to_task(TASK_ENB_APP, instance, msg_p);
}
return 0;
@@ -1138,7 +1140,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance,
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
if (ext==NULL) continue;
-
+
for (int cnt=0;cntlist.count;cnt++) {
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt];
switch (cells_to_be_activated_list_itemExtIEs->id) {
@@ -1244,7 +1246,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed == 0,
"%d TNLAssociations failed\n",
GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed);
-
+
AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs == 0,
"%d DedicatedSIDeliveryNeededUEs\n",
GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs);
diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c
index 8594345cc9..934e8d4210 100644
--- a/openair2/F1AP/f1ap_du_task.c
+++ b/openair2/F1AP/f1ap_du_task.c
@@ -86,9 +86,9 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
DevAssert(sctp_new_association_resp != NULL);
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
- LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n",
+ LOG_E(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
sctp_new_association_resp->sctp_state,
- instance,
+ (int)instance,
sctp_new_association_resp->ulp_cnx_id);
//f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c
index 1dbfd707c0..7bafa9e266 100644
--- a/openair2/F1AP/f1ap_encoder.c
+++ b/openair2/F1AP/f1ap_encoder.c
@@ -84,12 +84,8 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length)
LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n");
}
- encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer);
-
- if (encoded < 0) {
- LOG_E(F1AP, "Failed to encode F1AP message\n");
- return -1;
- }
+ AssertFatal((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer))>0,
+ "Failed to encode F1AP message\n");
*length = encoded;
diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c
index a589797f9b..7ec5d6844d 100644
--- a/openair2/GNB_APP/gnb_config.c
+++ b/openair2/GNB_APP/gnb_config.c
@@ -35,6 +35,7 @@
#include "assertions.h"
#include "gnb_config.h"
#include "gnb_paramdef.h"
+#include "enb_paramdef.h"
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
#include "intertask_interface.h"
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index ccbff6a5eb..4e063d2207 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -595,6 +595,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
CC_id = UE_PCCID(module_idP, UE_id);
UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
+/* to be merged with MAC_stats.log generation. probably redundant
if (((frameP & 127) == 0) && (subframeP == 0)) {
double total_bler;
if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) {
@@ -632,7 +633,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
UE_scheduling_control->aperiodic_ri_received[CC_id]
);
}
-
+*/
RC.eNB[module_idP][CC_id]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = -63;
if (UE_id == UE_info->list.head) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 3dea211dbc..8a400af1f3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -476,8 +476,8 @@ void generate_Msg2(module_id_t module_idP,
first_rb = 0;
vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1;
- vrb_map[first_rb + 2] = 1;
- vrb_map[first_rb + 3] = 1;
+ //vrb_map[first_rb + 2] = 1;
+ //vrb_map[first_rb + 3] = 1;
memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
@@ -488,12 +488,12 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // RA-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 0; // no TPC
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1;
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = 0;
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = 1;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
- dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
+ dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 2);
// This checks if the above DCI allocation is feasible in current subframe
if (!CCE_allocation_infeasible(module_idP, CC_idP, 0, subframeP,
@@ -512,7 +512,7 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->RA_rnti;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 2);
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
@@ -901,7 +901,7 @@ generate_Msg4(module_id_t module_idP,
} // rach_resource_type > 0
else {
// This is normal LTE case
- LOG_I(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
+ LOG_D(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
// Get RRCConnectionSetup for Piggyback
@@ -918,7 +918,7 @@ generate_Msg4(module_id_t module_idP,
module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);
// AssertFatal(rrc_sdu_length > 0,
// "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length);
- LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
+ LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP, ra->rnti);
/// Choose first 4 RBs for Msg4, should really check that these are free!
first_rb = 0;
@@ -1086,7 +1086,7 @@ generate_Msg4(module_id_t module_idP,
}
} // CCE Allocation feasible
} else {
- LOG_I(MAC,
+ LOG_D(MAC,
"eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Delaying Msg4 for RRC Piggyback (RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP, ra->rnti);
ra->Msg4_subframe ++;
@@ -1289,8 +1289,8 @@ initiate_ra_proc(module_id_t module_idP,
}
LOG_D(MAC,
- "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n",
- module_idP, CC_id, frameP, subframeP, preamble_index);
+ "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d, timing offset %d\n",
+ module_idP, CC_id, frameP, subframeP, preamble_index, timing_offset);
LOG_D(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d PRACH resource type %d\n",
module_idP, CC_id, frameP, subframeP, rach_resource_type);
@@ -1332,6 +1332,9 @@ initiate_ra_proc(module_id_t module_idP,
abort();
case 1 :
+ case 3 :
+ case 4 :
+ case 5 :
offset = 6;
break;
}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index b516b04e03..596d978a98 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -651,7 +651,7 @@ schedule_ue_spec(module_id_t module_idP,
eNB_UE_stats->rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
eNB_UE_stats->harq_pid = harq_pid;
eNB_UE_stats->harq_round = round_DL;
-
+ eNB_UE_stats->dlsch_rounds[round_DL&7]++;
if (eNB_UE_stats->rrc_status < RRC_RECONFIGURED) {
ue_sched_ctrl->uplane_inactivity_timer = 0;
}
@@ -792,7 +792,6 @@ schedule_ue_spec(module_id_t module_idP,
// No TX request for retransmission (check if null request for FAPI)
}
- //eNB_UE_stats->dlsch_trials[round]++;
eNB_UE_stats->num_retransmission += 1;
eNB_UE_stats->rbs_used_retx = nb_rb;
eNB_UE_stats->total_rbs_used_retx += nb_rb;
@@ -1065,20 +1064,23 @@ schedule_ue_spec(module_id_t module_idP,
ue_template->pucch_tpc_tx_frame = frameP;
ue_template->pucch_tpc_tx_subframe = subframeP;
- if (snr > target_snr + 4) {
+ if (snr > target_snr + PUCCH_PCHYST) {
tpc = 0; //-1
- } else if (snr < target_snr - 4) {
+ ue_sched_ctrl->pucch_tpc_accumulated[CC_id]--;
+ } else if (snr < target_snr - PUCCH_PCHYST) {
tpc = 2; //+1
+ ue_sched_ctrl->pucch_tpc_accumulated[CC_id]--;
} else {
tpc = 1; //0
}
- LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d (normal case)\n",
+ LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d (accumulated %d), snr/target snr %d/%d (normal case)\n",
module_idP,
frameP,
subframeP,
harq_pid,
tpc,
+ ue_sched_ctrl->pucch_tpc_accumulated[CC_id],
snr,
target_snr);
} // Po_PUCCH has been updated
@@ -1700,9 +1702,9 @@ schedule_ue_spec_br(module_id_t module_idP,
UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP;
UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP;
- if (snr > target_snr + 4) {
+ if (snr > target_snr + PUCCH_PCHYST) {
tpc = 0; //-1
- } else if (snr < target_snr - 4) {
+ } else if (snr < target_snr - PUCCH_PCHYST) {
tpc = 2; //+1
} else {
tpc = 1; //0
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index 23137b7887..e9f0b807c4 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -47,7 +47,7 @@
#include "OCG_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rlc.h"
-
+#include "common/utils/lte/prach_utils.h"
#include "T.h"
@@ -195,7 +195,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
// Initialization
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- dlsch_ue_max_num[CC_id] = (uint16_t)RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max;
+ dlsch_ue_max_num[CC_id] = eNB->ue_multiple_max;
// save origin DL PDU number
DL_req = &eNB->DL_req[CC_id].dl_config_request_body;
saved_dlsch_dci[CC_id] = DL_req->number_pdu;
@@ -1044,48 +1044,6 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
}
}
-#ifdef TM5
-
- // This has to be revisited!!!!
- for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- i1 = 0;
- i2 = 0;
- i3 = 0;
-
- for (j = 0; j < N_RBG[CC_id]; j++) {
- if (MIMO_mode_indicator[CC_id][j] == 2) {
- i1 = i1 + 1;
- } else if (MIMO_mode_indicator[CC_id][j] == 1) {
- i2 = i2 + 1;
- } else if (MIMO_mode_indicator[CC_id][j] == 0) {
- i3 = i3 + 1;
- }
- }
-
- if ((i1 < N_RBG[CC_id]) && (i2 > 0) && (i3 == 0)) {
- PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions =
- PHY_vars_eNB_g[Mod_id][CC_id]->
- check_for_SUMIMO_transmissions + 1;
- }
-
- if (i3 == N_RBG[CC_id] && i1 == 0 && i2 == 0) {
- PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions =
- PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions +
- 1;
- }
-
- if((i1 < N_RBG[CC_id]) && (i3 > 0)) {
- PHY_vars_eNB_g[Mod_id][CC_id]->
- check_for_MUMIMO_transmissions + 1;
- }
-
- PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions =
- PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions +
- 1;
- }
-
-#endif
-
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) {
if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2) {
@@ -1154,7 +1112,6 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
// int continue_flag = 0;
int32_t snr, target_snr;
int32_t tpc = 1;
- static int32_t tpc_accumulated = 0;
UE_sched_ctrl_t *ue_sched_ctl;
int mcs;
int i;
@@ -1540,7 +1497,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
subframeP,
S_DL_SCHEDULED,
rnti);
- //eNB_UE_stats->dlsch_trials[round]++;
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[round]++;
UE_info->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1;
UE_info->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb;
UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb;
@@ -1982,6 +1939,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
// store stats
eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[0]++;
UE_info->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
@@ -2015,19 +1973,19 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP;
UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP;
- if (snr > target_snr + 4) {
+ if (snr > target_snr + PUCCH_PCHYST) {
tpc = 0; //-1
- tpc_accumulated--;
- } else if (snr < target_snr - 4) {
+ ue_sched_ctl->pucch_tpc_accumulated[CC_id]--;
+ } else if (snr < target_snr - PUCCH_PCHYST) {
tpc = 2; //+1
- tpc_accumulated++;
+ ue_sched_ctl->pucch_tpc_accumulated[CC_id]++;
} else {
tpc = 1; //0
}
LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,frameP, subframeP,harq_pid,tpc,
- tpc_accumulated,snr,target_snr);
+ ue_sched_ctl->pucch_tpc_accumulated[CC_id],snr,target_snr);
} // Po_PUCCH has been updated
else {
tpc = 1; //0
@@ -2245,7 +2203,6 @@ void ulsch_scheduler_pre_ue_select_fairRR(
uint8_t first_ue_id[MAX_NUM_CCs][20];
uint8_t ul_inactivity_num[MAX_NUM_CCs];
uint8_t ul_inactivity_id[MAX_NUM_CCs][20]={{0}};
- // LTE_DL_FRAME_PARMS *frame_parms;
uint8_t ulsch_ue_max_num[MAX_NUM_CCs];
uint16_t saved_ulsch_dci[MAX_NUM_CCs];
rnti_t rnti;
@@ -2263,7 +2220,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
//save ulsch dci number
saved_ulsch_dci[CC_id] = eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci;
// maximum multiplicity number
- ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max;
+ ulsch_ue_max_num[CC_id] =eNB->ue_multiple_max;
cc_id_flag[CC_id] = 0;
ue_first_num[CC_id] = 0;
ul_inactivity_num[CC_id] = 0;
@@ -2290,6 +2247,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
// UL DCI
HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body;
+
if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) {
cc_id_flag[CC_id] = 1;
HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id];
@@ -2322,6 +2280,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
//round
round = UE_info->UE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid];
+
if ( round > 0 ) {
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
format_flag = 2;
@@ -2352,6 +2311,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0;
}
+
if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) {
if ( bytes_to_schedule > 0 ) {
first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id;
@@ -2369,9 +2329,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
UE_sched_ctl = &UE_info->UE_sched_ctrl[UE_id];
rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
-
- if ( ((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) ||
- ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) ||
+ if ( ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) ||
((UE_sched_ctl->cqi_req_timer>64)&&((rrc_status >= RRC_CONNECTED))) ) {
first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id;
first_ue_total[CC_id] [ue_first_num[CC_id]] = 0;
@@ -2482,6 +2440,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
}
rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
+
if ( (bytes_to_schedule > 0) || (UE_info->UE_template[CC_id][UE_id].ul_SR > 0) ||
((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) ||
((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) ||
@@ -2595,7 +2554,6 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
eNB_MAC_INST *eNB = RC.mac[module_idP];
UE_info_t *UE_info= &eNB->UE_info;
UE_TEMPLATE *UE_template = NULL;
- LTE_DL_FRAME_PARMS *frame_parms = NULL;
uint8_t ue_num_temp;
uint8_t total_rbs=0;
uint8_t average_rbs;
@@ -2617,18 +2575,17 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
// MCS and RB assgin
for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) {
cc = &RC.mac[module_idP]->common_channels[CC_id];
- frame_parms = &(RC.eNB[module_idP][CC_id]->frame_parms);
-
+ int N_RB_UL = to_prb(cc->ul_Bandwidth);
if (cc->tdd_Config) { //TDD
- if (frame_parms->N_RB_UL == 25) {
+ if (N_RB_UL == 25) {
num_pucch_rb = 1;
- } else if (frame_parms->N_RB_UL == 50) {
+ } else if (N_RB_UL == 50) {
num_pucch_rb = 2;
} else {
num_pucch_rb = 3;
}
} else {//FDD
- if (frame_parms->N_RB_UL == 25) {
+ if (N_RB_UL == 25) {
num_pucch_rb = 1;
} else {
num_pucch_rb = 2;
@@ -2653,13 +2610,13 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
continue;
}
- if (first_rb[CC_id] >= frame_parms->N_RB_UL-num_pucch_rb ) {
+ if (first_rb[CC_id] >= N_RB_UL-num_pucch_rb ) {
LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id);
break;
}
- total_rbs = frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id];
+ total_rbs = N_RB_UL-num_pucch_rb-first_rb[CC_id];
average_rbs = (int)round((double)total_rbs/(double)ue_num_temp);
if ( average_rbs < 3 ) {
@@ -2727,19 +2684,20 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id];
UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id];
- if(bler < 0.5) {
- if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] !=0) {
- UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]--;
+ if (eNB->use_mcs_offset == 1) {
+ if(bler < eNB->bler_lower) {
+ if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] !=0) {
+ UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]--;
+ }
}
- }
- if(bler >= 2) {
- UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]++;
- if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] >= 20) {
- UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]=20;
+ if(bler >= eNB->bler_upper) {
+ UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]++;
+ if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] >= 20) {
+ UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]=20;
+ }
}
}
}
-
snr = UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[CC_id];
mcs = 20 - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id];
@@ -2758,15 +2716,20 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) {
rb_table_index = 2;
tbs = get_TBS_UL(mcs,rb_table[rb_table_index]);
- tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100);
+ tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0);
- while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id])) &&
- ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) {
- rb_table_index++;
+ while ( (((UE_template->phr_info - tx_power) < 0 ) || (tbs > bytes_to_schedule)) && (mcs > 3) ) {
+ mcs--;
tbs = get_TBS_UL(mcs,rb_table[rb_table_index]);
- tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100);
+ tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0);
}
+ while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(N_RB_UL-num_pucch_rb-first_rb[CC_id])) &&
+ ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < eNB->max_ul_rb_index )) {
+ rb_table_index++;
+ tbs = get_TBS_UL(mcs,rb_table[rb_table_index]);
+ tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0);
+ }
if ( rb_table[rb_table_index]<3 ) {
rb_table_index=2;
}
@@ -2807,11 +2770,12 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
} else {
// assigne RBS( 3 RBs)
+/*
first_rb[CC_id] = first_rb[CC_id] + 3;
UE_info->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul = 3;
UE_info->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 2;
- UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
- }
+ UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10;
+*/ }
}
} else if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE ) {
// assigne RBS( 3 RBs)
@@ -2913,12 +2877,10 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs];
memset(ulsch_ue_select, 0, sizeof(ulsch_ue_select));
- LTE_DL_FRAME_PARMS *frame_parms ;
for (CC_id=0; CC_idcommon_channels[CC_id];
- frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms;
-
+ int N_RB_UL=to_prb(cc->ul_Bandwidth);
// output of scheduling, the UE numbers in RBs, where it is in the code???
// check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3
// Msg3 is using 1 PRB so we need to increase first_rb accordingly
@@ -2928,13 +2890,13 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3;
if (cc->tdd_Config == NULL) {
- if(frame_parms->N_RB_UL == 25) {
+ if(N_RB_UL == 25) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1;
} else {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2;
}
} else {
- switch(frame_parms->N_RB_UL) {
+ switch(N_RB_UL) {
case 25:
default:
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1;
@@ -2958,14 +2920,18 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
}
//PRACH
- if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) {
+ if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0,
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
+ sched_frame,sched_subframe)==1) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH;
- ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset(
- frame_parms,
- frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
- frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
- 0,//tdd_mapindex
- frameP); //Nf --> shouldn't it be sched_frame ???
+ ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb =
+ get_prach_prb_offset(cc->tdd_Config!=NULL ? 1 : 0,
+ cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,
+ to_prb(cc->ul_Bandwidth),
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset,
+ 0,
+ sched_frame);
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++;
@@ -2993,7 +2959,6 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
uint32_t cqi_req,cshift,ndi,tpc;
int32_t snr;
int32_t target_snr=0;
- static int32_t tpc_accumulated=0;
int CC_id,ulsch_ue_num;
int N_RB_UL;
eNB_MAC_INST *eNB = RC.mac[module_idP];
@@ -3012,7 +2977,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
nfapi_ul_config_request_body_t *ul_req_tmp;
nfapi_ul_config_ulsch_harq_information *ulsch_harq_information;
- LOG_D(MAC,"entering ulsch preprocesor\n");
+ LOG_D(MAC,"entering ulsch preprocesor for %d.%d\n",sched_frame,sched_subframeP);
ulsch_scheduler_pre_processor_fairRR(module_idP,
frameP,
subframeP,
@@ -3185,12 +3150,12 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_template->pusch_tpc_tx_frame=frameP;
UE_template->pusch_tpc_tx_subframe=subframeP;
- if (snr > target_snr + 4) {
+ if (snr > target_snr + PUSCH_PCHYST) {
tpc = 0; //-1
- tpc_accumulated--;
- } else if (snr < target_snr - 4) {
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id]--;
+ } else if (snr < target_snr - PUSCH_PCHYST) {
tpc = 2; //+1
- tpc_accumulated++;
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id]++;
} else {
tpc = 1; //0
}
@@ -3201,7 +3166,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
if (tpc!=1) {
LOG_D(MAC,"[eNB %d] ULSCH schedulerRR: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,frameP,subframeP,harq_pid,tpc,
- tpc_accumulated,snr,target_snr);
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id],snr,target_snr);
}
// new transmission
@@ -3214,6 +3179,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_sched_ctrl->cqi_req_timer);
ndi = 1-UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid]=ndi;
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0]++;
UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul;
@@ -3402,6 +3368,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
T_INT(round));
UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
+
uint8_t mcs_rv = 0;
if(rvidx_tab[round&3]==1) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 47c27798bf..c83cc1d9d3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -57,7 +57,7 @@
#include "flexran_agent_mac.h"
#include
#include
-
+#include "common/utils/lte/prach_utils.h"
#include "T.h"
@@ -144,16 +144,18 @@ rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1) {
UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id];
UE_template_ptr = &UE_info->UE_template[CC_idP][UE_id];
- LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
+ LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH (%s) sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d, timing_advance %d\n",
enb_mod_idP,
harq_pid,
CC_idP,
frameP,
subframeP,
+ sduP==NULL ? "in error" : "OK",
UE_scheduling_control->round_UL[CC_idP][harq_pid],
current_rnti,
UE_id,
- ul_cqi);
+ ul_cqi,
+ timing_advance);
AssertFatal(UE_scheduling_control->round_UL[CC_idP][harq_pid] < 8, "round >= 8\n");
if (sduP != NULL) {
@@ -219,7 +221,7 @@ rx_sdu(const module_id_t enb_mod_idP,
if (UE_scheduling_control->round_UL[CC_idP][harq_pid] == 3) {
UE_scheduling_control->ul_scheduled &= (~(1 << harq_pid));
UE_scheduling_control->round_UL[CC_idP][harq_pid] = 0;
-
+ UE_info->eNB_UE_stats[CC_idP][UE_id].ulsch_errors++;
if (UE_scheduling_control->ul_consecutive_errors++ == 10) {
UE_scheduling_control->ul_failure_timer = 1;
}
@@ -236,6 +238,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
} else {
UE_scheduling_control->round_UL[CC_idP][harq_pid]++;
+ UE_info->eNB_UE_stats[CC_idP][UE_id].ulsch_rounds[UE_scheduling_control->round_UL[CC_idP][harq_pid]]++;
}
/* CDRX UL HARQ timers */
@@ -287,14 +290,17 @@ rx_sdu(const module_id_t enb_mod_idP,
AssertFatal(mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx > 1,
"maxHARQ %d should be greater than 1\n",
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
- LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",
+ LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu (%s) round %d from PHY (rnti %x, RA_id %d) ul_cqi %d, timing advance %d\n",
enb_mod_idP,
harq_pid,
CC_idP,
+ sduP!=NULL ? "OK" : "in error",
ra->msg3_round,
current_rnti,
RA_id,
- ul_cqi);
+ ul_cqi,
+ timing_advance);
+
first_rb = ra->msg3_first_rb;
if (sduP == NULL) { // we've got an error on Msg3
@@ -403,7 +409,8 @@ rx_sdu(const module_id_t enb_mod_idP,
switch (rx_ces[i]) { // implement and process PHR + CRNTI + BSR
case POWER_HEADROOM:
if (UE_id != -1) {
- UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + (int8_t)(hundred_times_log10_NPRB[UE_template_ptr->nb_rb_ul[harq_pid] - 1] / 100);
+ /*UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + (int8_t)(hundred_times_log10_NPRB[UE_template_ptr->nb_rb_ul[harq_pid] - 1] / 100);i*/
+ UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + estimate_ue_tx_power(0,sdu_lenP*8,UE_template_ptr->nb_rb_ul[harq_pid],0,mac->common_channels[CC_idP].Ncp,0);
if (UE_template_ptr->phr_info > 40) {
UE_template_ptr->phr_info = 40;
@@ -424,7 +431,7 @@ rx_sdu(const module_id_t enb_mod_idP,
case CRNTI:
old_rnti = (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1];
old_UE_id = find_UE_id(enb_mod_idP, old_rnti);
- LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
+ LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
enb_mod_idP,
frameP,
subframeP,
@@ -438,7 +445,7 @@ rx_sdu(const module_id_t enb_mod_idP,
/* Receiving CRNTI means that the current rnti has to go away */
if (old_UE_id != -1) {
if (mac_eNB_get_rrc_status(enb_mod_idP,old_rnti) == RRC_HO_EXECUTION) {
- LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Handover case\n",
+ LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Handover case\n",
enb_mod_idP,
frameP,
subframeP,
@@ -1293,16 +1300,19 @@ schedule_ulsch(module_id_t module_idP,
/* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) {
- LTE_DL_FRAME_PARMS *frame_parms = &RC.eNB[module_idP][CC_id]->frame_parms;
- if (is_prach_subframe(frame_parms, sched_frame, sched_subframe)) {
- int start_rb = get_prach_prb_offset(
- frame_parms,
- frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
- frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
- 0, // tdd_mapindex
- sched_frame); // Nf
+
+ if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0,
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
+ sched_frame, sched_subframe)) {
+ int start_rb = get_prach_prb_offset(cc->tdd_Config!=NULL ? 1 : 0,
+ cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,
+ to_prb(cc->ul_Bandwidth),
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
+ cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset,
+ 0, // tdd_mapindex
+ sched_frame); // Nf
for (int i = 0; i < 6; i++)
- cc[CC_id].vrb_map_UL[start_rb + i] = 1;
+ cc->vrb_map_UL[start_rb + i] = 1;
}
/* HACK: let's remove the PUCCH from available RBs
@@ -1314,24 +1324,24 @@ schedule_ulsch(module_id_t module_idP,
*/
switch (to_prb(cc[CC_id].ul_Bandwidth)) {
case 25:
- cc[CC_id].vrb_map_UL[0] = 1;
- cc[CC_id].vrb_map_UL[24] = 1;
+ cc->vrb_map_UL[0] = 1;
+ cc->vrb_map_UL[24] = 1;
break;
case 50:
- cc[CC_id].vrb_map_UL[0] = 1;
- cc[CC_id].vrb_map_UL[1] = 1;
- cc[CC_id].vrb_map_UL[48] = 1;
- cc[CC_id].vrb_map_UL[49] = 1;
+ cc->vrb_map_UL[0] = 1;
+ cc->vrb_map_UL[1] = 1;
+ cc->vrb_map_UL[48] = 1;
+ cc->vrb_map_UL[49] = 1;
break;
case 100:
- cc[CC_id].vrb_map_UL[0] = 1;
- cc[CC_id].vrb_map_UL[1] = 1;
- cc[CC_id].vrb_map_UL[2] = 1;
- cc[CC_id].vrb_map_UL[97] = 1;
- cc[CC_id].vrb_map_UL[98] = 1;
- cc[CC_id].vrb_map_UL[99] = 1;
+ cc->vrb_map_UL[0] = 1;
+ cc->vrb_map_UL[1] = 1;
+ cc->vrb_map_UL[2] = 1;
+ cc->vrb_map_UL[97] = 1;
+ cc->vrb_map_UL[98] = 1;
+ cc->vrb_map_UL[99] = 1;
break;
default:
@@ -1349,6 +1359,8 @@ schedule_ulsch(module_id_t module_idP,
/*
* Schedule the DCI0 for ULSCH
*/
+
+
void
schedule_ulsch_rnti(module_id_t module_idP,
int CC_id,
@@ -1356,7 +1368,6 @@ schedule_ulsch_rnti(module_id_t module_idP,
sub_frame_t subframeP,
unsigned char sched_subframeP) {
/* TODO: does this need to be static? */
- static int32_t tpc_accumulated = 0;
/* values from 0 to 7 can be used for mapping the cyclic shift
* (36.211 , Table 5.5.2.1.1-1) */
const uint32_t cshift = 0;
@@ -1481,8 +1492,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
/* Power control */
/*
* Compute the expected ULSCH RX snr (for the stats)
- * This is the normalized RX snr and this should be constant (regardless
- * of mcs) Is not in dBm, unit from nfapi, converting to dBm
+ *
*/
const int32_t snr = UE_sched_ctrl_ptr->pusch_snr[CC_id];
const int32_t target_snr = mac->puSch10xSnr / 10;
@@ -1501,12 +1511,12 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_template_ptr->pusch_tpc_tx_frame = frameP;
UE_template_ptr->pusch_tpc_tx_subframe = subframeP;
- if (snr > target_snr + 4) {
+ if (snr > target_snr + PUSCH_PCHYST) {
tpc = 0; // -1
- tpc_accumulated--;
- } else if (snr < target_snr - 4) {
+ UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id]--;
+ } else if (snr < target_snr - PUSCH_PCHYST) {
tpc = 2; // +1
- tpc_accumulated++;
+ UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id]++;
}
}
if (tpc != 1) {
@@ -1518,7 +1528,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
subframeP,
harq_pid,
tpc,
- tpc_accumulated,
+ UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id],
snr,
target_snr);
}
@@ -1572,6 +1582,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
const uint8_t ndi = 1 - UE_template_ptr->oldNDI_UL[harq_pid]; // NDI: new data indicator
const uint8_t mcs = UE_template_ptr->pre_assigned_mcs_ul;
UE_template_ptr->oldNDI_UL[harq_pid] = ndi;
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0]++;
UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr;
UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr;
UE_template_ptr->mcs_UL[harq_pid] = mcs;
@@ -1593,8 +1604,6 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = mcs;
- while (rb_table[rb_table_index] > 45 && rb_table_index > 0)
- rb_table_index--;
UE_template_ptr->TBS_UL[harq_pid] = get_TBS_UL(mcs, rb_table[rb_table_index]);
UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index];
@@ -2080,10 +2089,10 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
if (snr > target_snr + 4) {
tpc = 0; //-1
- UE_sched_ctrl->tpc_accumulated[CC_id]--;
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id]--;
} else if (snr < target_snr - 4) {
tpc = 2; //+1
- UE_sched_ctrl->tpc_accumulated[CC_id]++;
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id]++;
} else {
tpc = 1; //0
}
@@ -2098,7 +2107,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
subframeP,
harq_pid,
tpc,
- UE_sched_ctrl->tpc_accumulated[CC_id],
+ UE_sched_ctrl->pusch_tpc_accumulated[CC_id],
snr,
target_snr);
}
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index ae8522bc83..062f613526 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -83,7 +83,7 @@
#define MAX_MAC_INST 16
#define BCCH_PAYLOAD_SIZE_MAX 128
-#define CCCH_PAYLOAD_SIZE_MAX 128
+#define CCCH_PAYLOAD_SIZE_MAX 512
#define PCCH_PAYLOAD_SIZE_MAX 128
#define RAR_PAYLOAD_SIZE_MAX 128
@@ -143,7 +143,10 @@
#define MAX_SUPPORTED_BW 4
/*!\brief CQI values range from 1 to 15 (4 bits) */
#define CQI_VALUE_RANGE 16
-
+/*!\brief Hysteresis of PUSCH power control loop */
+#define PUSCH_PCHYST 1
+/*!\brief Hysteresis of PUCCH power control loop */
+#define PUCCH_PCHYST 1
/*!\brief value for indicating BSR Timer is not running */
#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
@@ -615,6 +618,8 @@ typedef struct {
// here for RX
//
+
+ uint32_t ulsch_rounds[4];
uint32_t ulsch_bitrate;
//
uint32_t ulsch_bytes_rx;
@@ -684,6 +689,17 @@ typedef struct {
// Length of SDU Got from LC DL
uint32_t sdu_length_tx[NB_RB_MAX];
+ int lc_bytes_tx[64];
+ int dlsch_rounds[8];
+ int dlsch_errors;
+ int dlsch_total_bytes;
+
+ int lc_bytes_rx[64];
+ int ulsch_rounds[8];
+ int ulsch_errors;
+ int ulsch_total_bytes_scheduled;
+ int ulsch_total_bytes_rx;
+
/// overall
//
@@ -776,7 +792,6 @@ typedef struct {
uint32_t num_mac_sdu_rx;
// Length of SDU Got from LC UL - Size array can be refined
uint32_t sdu_length_rx[NB_RB_MAX];
-
} eNB_UE_STATS;
/*! \brief eNB template for UE context information */
@@ -982,7 +997,8 @@ typedef struct {
uint16_t feedback_cnt[NFAPI_CC_MAX];
uint16_t timing_advance;
uint16_t timing_advance_r9;
- uint8_t tpc_accumulated[NFAPI_CC_MAX];
+ int8_t pusch_tpc_accumulated[NFAPI_CC_MAX];
+ int8_t pucch_tpc_accumulated[NFAPI_CC_MAX];
uint8_t periodic_wideband_cqi[NFAPI_CC_MAX];
uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX];
uint8_t periodic_wideband_pmi[NFAPI_CC_MAX];
@@ -1342,6 +1358,7 @@ typedef struct {
uint8_t FeMBMS_flag;
} COMMON_channels_t;
/*! \brief top level eNB MAC structure */
+
typedef struct eNB_MAC_INST_s {
/// Ethernet parameters for northbound midhaul interface
eth_params_t eth_params_n;
@@ -1435,6 +1452,17 @@ typedef struct eNB_MAC_INST_s {
int32_t puSch10xSnr;
int32_t puCch10xSnr;
+
+ int max_ul_rb_index;
+
+ int ue_multiple_max;
+
+ int use_mcs_offset;
+
+ double bler_lower;
+
+ double bler_upper;
+ pthread_t mac_stats_thread;
} eNB_MAC_INST;
/*
diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h
index cda64ec0e9..cbca693b2a 100644
--- a/openair2/LAYER2/MAC/mac_extern.h
+++ b/openair2/LAYER2/MAC/mac_extern.h
@@ -78,5 +78,8 @@ extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern mac_rlc_am_muilist_t rlc_am_mui;
extern SCHEDULER_MODES global_scheduler_mode;
+
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
extern rb_id_t mbms_rab_id;
#endif //DEF_H
diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c
index 59554425cc..a4e924c68b 100644
--- a/openair2/LAYER2/MAC/main.c
+++ b/openair2/LAYER2/MAC/main.c
@@ -40,8 +40,84 @@
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "common/ran_context.h"
#include "intertask_interface.h"
+#include
extern RAN_CONTEXT_t RC;
+extern int oai_exit;
+
+void *mac_stats_thread(void *param) {
+ eNB_MAC_INST *mac = (eNB_MAC_INST *)param;
+ FILE *fd;
+ UE_info_t *UE_info = &(mac->UE_info);
+
+ while (!oai_exit) {
+ sleep(1);
+ fd=fopen("MAC_stats.log","w+");
+ AssertFatal(fd!=NULL,"Cannot open MAC_stats.log\n");
+
+ for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
+ if (UE_info->active[UE_id]) {
+ int rnti = UE_RNTI(mac->Mod_id, UE_id);
+ int CC_id = UE_PCCID(mac->Mod_id, UE_id);
+ UE_sched_ctrl_t *UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
+
+ double total_bler;
+ if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) {
+ total_bler = 0;
+ }
+ else {
+ total_bler = (double)UE_scheduling_control->pusch_rx_error_num[CC_id] / (double)(UE_scheduling_control->pusch_rx_error_num[CC_id] + UE_scheduling_control->pusch_rx_num[CC_id]) * 100;
+ }
+ fprintf(fd,"MAC UE rnti %x : %s, PHR %d DLCQI %d PUSCH %d PUCCH %d RLC disc %d UL-stat rcv %lu err %lu bler %lf (%lf/%lf) total_bler %lf mcsoff %d pre_allocated nb_rb %d, mcs %d, bsr %u sched %u tbs %lu cnt %u , DL-stat tbs %lu cnt %u rb %u buf %u 1st %u ret %u ri %d\n",
+ rnti,
+ UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync",
+ UE_info->UE_template[CC_id][UE_id].phr_info,
+ UE_scheduling_control->dl_cqi[CC_id],
+ UE_scheduling_control->pusch_snr/*_avg*/[CC_id],
+ UE_scheduling_control->pucch1_snr[CC_id],
+ UE_scheduling_control->rlc_out_of_resources_cnt,
+ UE_scheduling_control->pusch_rx_num[CC_id],
+ UE_scheduling_control->pusch_rx_error_num[CC_id],
+ UE_scheduling_control->pusch_bler[CC_id],
+ mac->bler_lower,mac->bler_upper,total_bler,
+ UE_scheduling_control->mcs_offset[CC_id],
+ UE_info->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul,
+ UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul,
+ UE_info->UE_template[CC_id][UE_id].estimated_ul_buffer,
+ UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes,
+ UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes_rx,
+ UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus_rx,
+ UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes,
+ UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus,
+ UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used,
+#if defined(PRE_SCD_THREAD)
+ UE_info->UE_template[CC_id][UE_id].dl_buffer_total,
+#else
+ 0,
+#endif
+ UE_scheduling_control->first_cnt[CC_id],
+ UE_scheduling_control->ret_cnt[CC_id],
+ UE_scheduling_control->aperiodic_ri_received[CC_id]
+ );
+ fprintf(fd," ULSCH rounds %d/%d/%d/%d, DLSCH rounds %d/%d/%d/%d, ULSCH errors %d, DLSCH errors %d\n",
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0],
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[1],
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[2],
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[3],
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[0],
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[1],
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[2],
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[3],
+ UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_errors,
+ UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_errors);
+
+
+ }
+ }
+ fclose(fd);
+ }
+ return(NULL);
+}
void init_UE_info(UE_info_t *UE_info)
{
@@ -128,6 +204,9 @@ void mac_top_init_eNB(void)
pdcp_layer_init();
rrc_init_global_param();
+
+ for (i=0;imac_stats_thread,NULL,mac_stats_thread,(void*)mac[i]);
+
}
void mac_init_cell_params(int Mod_idP, int CC_idP)
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index bf8202f622..bb892c7efe 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -730,13 +730,13 @@ void calculate_max_mcs_min_rb(module_id_t mod_id,
int tbs = get_TBS_UL(*mcs, rb_table[*rb_index]);
// fixme: set use_srs flag
- *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
+ *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
/* find maximum MCS */
while ((phr - *tx_power < 0 || tbs > bytes) && *mcs > 3) {
(*mcs)--;
tbs = get_TBS_UL(*mcs, rb_table[*rb_index]);
- *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
+ *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
}
/* find minimum necessary RBs */
@@ -746,7 +746,7 @@ void calculate_max_mcs_min_rb(module_id_t mod_id,
&& phr - *tx_power > 0) {
(*rb_index)++;
tbs = get_TBS_UL(*mcs, rb_table[*rb_index]);
- *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
+ *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0);
}
/* Decrease if we went to far in last iteration */
@@ -801,7 +801,7 @@ int rr_ul_run(module_id_t Mod_id,
AssertFatal(num_contig_rb <= 2, "cannot handle more than two contiguous RB regions\n");
UE_info_t *UE_info = &RC.mac[Mod_id]->UE_info;
const int max_rb = num_contig_rb > 1 ? MAX(rbs[0].length, rbs[1].length) : rbs[0].length;
-
+ eNB_MAC_INST *mac = RC.mac[Mod_id];
/* for every UE: check whether we have to handle a retransmission (and
* allocate, if so). If not, compute how much RBs this UE would need */
int rb_idx_required[MAX_MOBILES_PER_ENB];
@@ -809,7 +809,7 @@ int rr_ul_run(module_id_t Mod_id,
int num_ue_req = 0;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
UE_TEMPLATE *UE_template = &UE_info->UE_template[CC_id][UE_id];
- uint8_t harq_pid = subframe2harqpid(&RC.mac[Mod_id]->common_channels[CC_id],
+ uint8_t harq_pid = subframe2harqpid(&mac->common_channels[CC_id],
sched_frame, sched_subframe);
if (UE_info->UE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid] > 0) {
/* this UE has a retransmission, allocate it right away */
@@ -845,11 +845,11 @@ int rr_ul_run(module_id_t Mod_id,
}
} else {
LOG_W(MAC,
- "cannot allocate UL retransmission for UE %d (nb_rb %d)\n",
- UE_id,
- nb_rb);
+ "%d.%d cannot allocate UL retransmission for UE %d (nb_rb %d, rbs0.length %d, rbs1.length %d,rbs0.start %d,rbs1.start %d)\n",
+ sched_frame,sched_subframe,UE_id,
+ nb_rb, rbs[0].length,rbs[1].length,rbs[0].start,rbs[1].start);
UE_template->pre_dci_ul_pdu_idx = -1; // do not need CCE
- RC.mac[Mod_id]->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body.number_of_dci--;
+ mac->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body.number_of_dci--;
continue;
}
LOG_D(MAC, "%4d.%d UE %d retx %d RBs at start %d\n",
@@ -895,10 +895,9 @@ int rr_ul_run(module_id_t Mod_id,
&tx_power);
UE_template->pre_assigned_mcs_ul = mcs;
- /* rb_idx_given >= 22: apparently the PHY cannot support more than 48
- * RBs in the uplink. Hence, we limit every UE to 48 RBs, which is at
- * index 22 */
- rb_idx_required[UE_id] = min(22, rb_table_index);
+ /* rb_idx_given >= MAX index: limit RBs to value in configuration file
+ * RBs in the uplink. */
+ rb_idx_required[UE_id] = min(mac->max_ul_rb_index, rb_table_index);
//UE_template->pre_allocated_nb_rb_ul = rb_table[rb_table_index];
/* only print log when PHR changed */
static int phr = 0;
diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c
index 23ac209389..d48952318a 100644
--- a/openair2/LAYER2/MAC/rar_tools.c
+++ b/openair2/LAYER2/MAC/rar_tools.c
@@ -67,8 +67,10 @@ fill_rar(const module_id_t module_idP,
rar[5] = (uint8_t) (ra->rnti & 0xff);
//ra->timing_offset = 0;
ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
- rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
- rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
+ //rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
+ //rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
+ rar[0] = (uint8_t) (ra->timing_offset >> (4)); // 7 MSBs of timing advance + divide by 4
+ rar[1] = (uint8_t) (ra->timing_offset << (4)) & 0xf0; // 4 LSBs of timing advance + divide by 4
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if(N_RB_UL == 25) {
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
index 4a288ee12f..6bb7970be6 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
@@ -54,7 +54,7 @@
// Definitions for MAC control and data
#define NR_BCCH_DL_SCH 3 // SI
#define NR_BCCH_BCH 5 // MIB
-#define CCCH_PAYLOAD_SIZE_MAX 128
+#define CCCH_PAYLOAD_SIZE_MAX 512
#define RAR_PAYLOAD_SIZE_MAX 128
#define MAX_BWP_SIZE 275
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
index 5be080d30c..a5a9aac7ec 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
@@ -1729,6 +1729,47 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
}
}
+// TS 38.211 Table 7.4.1.1.2-3: PDSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled.
+// The first 4 colomns are PDSCH mapping type A and the last 4 colomns are PDSCH mapping type B.
+// When l' = l0, it is represented by 1
+// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10.
+
+int32_t table_7_4_1_1_2_3_pdsch_dmrs_positions_l [13][8] = { // Duration in symbols
+{-1, -1, -1, -1, 1, 1, 1, 1}, //2 // (DMRS l' position)
+{0, 0, 0, 0, 1, 1, 1, 1}, //3 // (DMRS l' position)
+{0, 0, 0, 0, 1, 1, 1, 1}, //4 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //5 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //6 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //7 // (DMRS l' position)
+{0, 128, 128, 128, 1, 65, 73, 73}, //8 // (DMRS l' position)
+{0, 128, 128, 128, 1, 129, 145, 145}, //9 // (DMRS l' position)
+{0, 512, 576, 576, 1, 129, 145, 145}, //10 // (DMRS l' position)
+{0, 512, 576, 576, 1, 257, 273, 585}, //11 // (DMRS l' position)
+{0, 512, 576, 2336, 1, 513, 545, 585}, //12 // (DMRS l' position)
+{0, 2048, 2176, 2336, 1, 513, 545, 585}, //13 // (DMRS l' position)
+{0, 2048, 2176, 2336, -1, -1, -1, -1}, //14 // (DMRS l' position)
+};
+
+
+// TS 38.211 Table 7.4.1.1.2-4: PDSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled.
+// The first 4 colomns are PDSCH mapping type A and the last 4 colomns are PDSCH mapping type B.
+// When l' = l0, it is represented by 1
+
+int32_t table_7_4_1_1_2_4_pdsch_dmrs_positions_l [12][8] = { // Duration in symbols
+{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position)
+{0, 0, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //5 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //6 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //7 // (DMRS l' position)
+{0, 0, -1, -1, 3, 99, -1, -1}, //8 // (DMRS l' position)
+{0, 0, -1, -1, 3, 99, -1, -1}, //9 // (DMRS l' position)
+{0, 768, -1, -1, 3, 387, -1, -1}, //10 // (DMRS l' position)
+{0, 768, -1, -1, 3, 387, -1, -1}, //11 // (DMRS l' position)
+{0, 768, -1, -1, 3, 771, -1, -1}, //12 // (DMRS l' position)
+{0, 3072, -1, -1, 3, 771, -1, -1}, //13 // (DMRS l' position)
+{0, 3072, -1, -1, -1, -1, -1, -1}, //14 // (DMRS l' position)
+};
+
// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled.
// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B.
// When l' = l0, it is represented by 1
@@ -1736,17 +1777,17 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols
{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position)
-{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position)
-{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position)
-{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position)
-{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position)
-{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position)
-{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position)
-{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position)
-{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position)
-{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position)
-{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position)
-{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position)
+{0, 0, 0, 0, 1, 1, 1, 1}, //4 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //5 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //6 // (DMRS l' position)
+{0, 0, 0, 0, 1, 17, 17, 17}, //7 // (DMRS l' position)
+{0, 128, 128, 128, 1, 65, 73, 73}, //8 // (DMRS l' position)
+{0, 128, 128, 128, 1, 65, 73, 73}, //9 // (DMRS l' position)
+{0, 512, 576, 576, 1, 257, 273, 585}, //10 // (DMRS l' position)
+{0, 512, 576, 576, 1, 257, 273, 585}, //11 // (DMRS l' position)
+{0, 512, 576, 2336, 1, 1025, 1057, 585}, //12 // (DMRS l' position)
+{0, 2048, 2176, 2336, 1, 1025, 1057, 585}, //13 // (DMRS l' position)
+{0, 2048, 2176, 2336, 1, 1025, 1057, 585}, //14 // (DMRS l' position)
};
@@ -1756,17 +1797,17 @@ int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = {
int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols
{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position)
-{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position)
-{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position)
-{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position)
-{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position)
-{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position)
-{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position)
-{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position)
-{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position)
-{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position)
-{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position)
-{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position)
+{0, 0, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //5 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //6 // (DMRS l' position)
+{0, 0, -1, -1, 3, 3, -1, -1}, //7 // (DMRS l' position)
+{0, 0, -1, -1, 3, 99, -1, -1}, //8 // (DMRS l' position)
+{0, 0, -1, -1, 3, 99, -1, -1}, //9 // (DMRS l' position)
+{0, 768, -1, -1, 3, 387, -1, -1}, //10 // (DMRS l' position)
+{0, 768, -1, -1, 3, 387, -1, -1}, //11 // (DMRS l' position)
+{0, 768, -1, -1, 3, 1539, -1, -1}, //12 // (DMRS l' position)
+{0, 3072, -1, -1, 3, 1539, -1, -1}, //13 // (DMRS l' position)
+{0, 3072, -1, -1, 3, 1539, -1, -1}, //14 // (DMRS l' position)
};
// Returns the corresponding row index of the NR table
@@ -2312,8 +2353,8 @@ int get_num_dmrs(uint16_t dmrs_mask ) {
return(num_dmrs);
}
/* returns the total DMRS symbols in a slot*/
-uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol){
- return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols,startSymbol));
+uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype){
+ return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols, startSymbol, mappingtype));
}
// Table 5.1.2.2.1-1 38.214
@@ -2377,29 +2418,46 @@ uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) {
}
-int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) {
+int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbol, uint8_t dmrs_typeA_position) {
uint8_t row, colomn;
int32_t l_prime;
+ LOG_D(MAC, "PUSCH: NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", duration_in_symbols, start_symbol, mapping_type, dmrs_typeA_position);
+
+ // Section 6.4.1.1.3 in Spec 38.211
+ // For PDSCH Mapping TypeA, ld is duration between first OFDM of the slot and last OFDM symbol of the scheduled PUSCH resources
+ // For TypeB, ld is the duration of the scheduled PUSCH resources
+ uint8_t ld = (mapping_type == typeA) ? (duration_in_symbols + start_symbol) : duration_in_symbols;
+ uint8_t l0 = (dmrs_typeA_position == NR_MIB__dmrs_TypeA_Position_pos2) ? 2 : 3 ;
+
colomn = additional_pos;
if (mapping_type == typeB)
colomn += 4;
- if (duration_in_symbols < 4)
+ if (ld < 4)
row = 0;
else
- row = duration_in_symbols - 3;
+ row = ld - 3;
- if (pusch_maxLength == pusch_len1)
+ if (pusch_maxLength == pusch_len1) {
l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn];
- else
+ l0 = 1 << l0;
+ }
+ else {
l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn];
+ l0 = 1<0,"invalid l_prime < 0\n");
+ LOG_D(MAC, "PUSCH - l0:%d, ld:%d,row:%d, column:%d, addpos:%d, maxlen:%d\n", l0, ld, row, colomn, additional_pos, pusch_maxLength);
+ AssertFatal(l_prime>=0,"invalid l_prime < 0\n");
+
+ l_prime = (mapping_type == typeA) ? (l_prime | l0) : (l_prime << start_symbol);
+ LOG_D(MAC, " PUSCH DMRS MASK in HEX:%x\n", l_prime);
return l_prime;
+
}
/*******************************************************************
@@ -2952,92 +3010,90 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl
else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
}
-int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol) {
+int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI) {
+
+ int l0;int dmrs_AdditionalPosition = 0;int maxLength = 0;
+ NR_DMRS_DownlinkConfig_t *dmrs_config = NULL;
+
+ LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype_fromDCI, dmrs_TypeA_Position);
- int l0;
- int ld = NrOfSymbols+startSymbol;
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
- if (pdsch_Config == NULL) { // Initial BWP
- if (ld <= 7) return(1<dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
+ dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
+ } else if (mappingtype_fromDCI == typeB) {
+ if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
+ dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
+ } else {
+ AssertFatal(1==0,"Incorrect Mappingtype\n");
+ }
+
+ AssertFatal(dmrs_config != NULL," DMRS configs not present in PDSCH DMRS Downlink config\n");
+
+ // default values of maxlength = len2, additionalposition is pos2
+ if (dmrs_config->maxLength != NULL) maxLength = 2;
+ if (dmrs_config->dmrs_AdditionalPosition != NULL) dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition;
+ }
+
+ uint8_t ld, row, column;
+ int32_t l_prime = -1;
+
+ // columns 0-3 for TypeA, 4-7 for TypeB
+ column = (mappingtype_fromDCI == typeA) ? dmrs_AdditionalPosition : (dmrs_AdditionalPosition + 4);
+
+ // Section 7.4.1.1.2 in Spec 38.211
+ // For PDSCH Mapping TypeA, ld is duration between first OFDM of the slot and last OFDM symbol of the scheduled PDSCH resources
+ // For TypeB, ld is the duration of the scheduled PDSCH resources
+ ld = (mappingtype_fromDCI == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols;
+
+ // Section 7.4.1.1.2 in Spec 38.211
+ //For PDSCH Mapping typeB, if PDSCH duration ld <=4, only single symbol DMRS is supported
+ if (mappingtype_fromDCI == typeB && ld <= 4)
+ maxLength = 1;
+
+ AssertFatal(ld > 2 && ld < 15,"Illegal NrOfSymbols according to Table 5.1.2.1-1 Spec 38.214 %d\n",ld);
+ AssertFatal((NrOfSymbols + startSymbol) < 15,"Illegal S+L according to Table 5.1.2.1-1 Spec 38.214 S:%d L:%d\n",startSymbol, NrOfSymbols);
+
+ if (mappingtype_fromDCI == typeA) {
+
+ // Section 7.4.1.1.2 in Spec 38.211
+ AssertFatal((l0 == 2) || (l0 == 3 && dmrs_AdditionalPosition != 3),"Wrong config, If dmrs_TypeA_Position POS3, ADD POS cannot be POS3 \n");
+
+ // Table 5.1.2.1-1 in Spec 38.214
+ AssertFatal(startSymbol <= l0, "Wrong config, Start symbol %d cannot be later than dmrs_TypeA_Position %d \n", startSymbol, l0);
+
+ // Section 7.4.1.1.2 in Spec 38.211
+ AssertFatal(l0 == 2 || (l0 == 3 && (ld != 3 || ld != 4)), "ld 3 or 4 symbols only possible with dmrs_TypeA_Position POS2 \n");
+
+ }
+
+ if (maxLength == 1) {
+ row = ld - 2;
+ l_prime = table_7_4_1_1_2_3_pdsch_dmrs_positions_l[row][column];
+ l0 = 1 << l0;
}
else {
- if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
- pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
- // Relative to start of slot
- NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
- AssertFatal(ld>1 && ld < 15,"Illegal l_d %d\n",ld);
- int pos2=0;
- if (dmrs_config->maxLength == NULL) {
- // this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS
- if (dmrs_config->dmrs_AdditionalPosition == NULL) pos2=1;
- else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition == NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0 )
- return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
- return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
- return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
- return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
- return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
- return(1<3,"Illegal l_d %d for len2 DMRS\n",ld);
- if (ld < 10) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_DownlinkForPDSCH_MappingTypeB &&
- pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
- // Relative to start of PDSCH resource
- AssertFatal(1==0,"TypeB DMRS not supported yet\n");
- }
+ row = (ld < 4) ? 0 : (ld - 3);
+ l_prime = table_7_4_1_1_2_4_pdsch_dmrs_positions_l[row][column];
+ l0 = 1<=0,"ERROR in configuration.Check Time Domain allocation of this Grant. l_prime < 1. row:%d, column:%d\n", row, column);
+
+ l_prime = (mappingtype_fromDCI == typeA) ? (l_prime | l0) : (l_prime << startSymbol);
+ LOG_D(MAC, " PDSCH DMRS MASK in HEX:%x\n", l_prime);
+
+ return l_prime;
}
uint8_t get_pusch_mcs_table(long *mcs_Table,
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
index 7f6a722925..a6adb47c0a 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
@@ -47,7 +47,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
-int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol);
+int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI);
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
@@ -121,7 +121,7 @@ uint16_t get_NCS(uint8_t index, uint16_t format, uint8_t restricted_set_config);
int get_num_dmrs(uint16_t dmrs_mask );
uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position);
-int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength);
+int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbolt, uint8_t dmrs_typeA_position);
uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table);
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
@@ -153,7 +153,7 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config,
uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower,
uint8_t NrOfSymbols);
-uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol);
+uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype);
/* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16
@param *pusch_config, pointer to pusch config
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
index df5bb70c06..7c54c85632 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
@@ -48,6 +48,8 @@
#include "NR_MAC_COMMON/nr_mac.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h"
+#include
+
void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
// Random Access procedure initialization as per 5.1.1 and initialization of variables specific
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index af2a80b968..255e399d1c 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -668,11 +668,21 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
+
+ NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
+ if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
+ pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
+ else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
+ pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
+
+ int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
+
/* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
mac->mib->dmrs_TypeA_Position,
dlsch_config_pdu_1_0->number_symbols,
- dlsch_config_pdu_1_0->start_symbol);
+ dlsch_config_pdu_1_0->start_symbol,
+ mappingtype);
dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[0] != NULL) ? (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0;
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
if (dlsch_config_pdu_1_0->number_symbols == 2)
@@ -833,10 +843,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
- // FIXME: fix number of additional dmrs
- if(pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition == NULL)
- pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition=calloc(1,sizeof(*pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
-
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_1 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
dlsch_config_pdu_1_1->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
@@ -857,11 +863,21 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
+
+ NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
+ if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
+ pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
+ else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
+ pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
+
+ int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
+
/* dmrs symbol positions*/
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
mac->scc->dmrs_TypeA_Position,
dlsch_config_pdu_1_1->number_symbols,
- dlsch_config_pdu_1_1->start_symbol);
+ dlsch_config_pdu_1_1->start_symbol,
+ mappingtype);
dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
/* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
index 5f5689fc9b..87cc5fae38 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
@@ -51,6 +51,8 @@
#include "asn1_conversions.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
+#include
+
static prach_association_pattern_t prach_assoc_pattern;
static ssb_list_info_t ssb_list;
@@ -502,7 +504,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
int NrOfSymbols;
uint8_t nb_dmrs_re_per_rb;
- uint16_t l_prime_mask = 1;
+ uint16_t l_prime_mask = 0;
uint16_t number_dmrs_symbols = 0;
int N_PRB_oh = 0;
@@ -517,22 +519,26 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP;
else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP;
+ pusch_dmrs_AdditionalPosition_t add_pos = pusch_dmrs_pos2;
+ pusch_maxLength_t dmrslength = pusch_len1;
+
if (rar_grant) {
// Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
NR_BWP_UplinkDedicated_t *ibwp;
- int scs,abwp_start,abwp_size,startSymbolAndLength;
+ int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype;
NR_PUSCH_Config_t *pusch_Config=NULL;
if (mac->cg && ubwp &&
- mac->cg->spCellConfig &&
- mac->cg->spCellConfig->spCellConfigDedicated &&
- mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
- mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP
- ) {
+ mac->cg->spCellConfig &&
+ mac->cg->spCellConfig->spCellConfigDedicated &&
+ mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
+ mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) {
+
ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
pusch_Config = ibwp->pusch_Config->choice.setup;
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
+ mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
// active BWP start
abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
@@ -541,6 +547,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
}
else {
startSymbolAndLength = initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
+ mappingtype = initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType;
// active BWP start
abwp_start = NRRIV2PRBOFFSET(initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
@@ -578,6 +585,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->start_symbol_index = StartSymbolIndex;
pusch_config_pdu->nr_of_symbols = NrOfSymbols;
+ l_prime_mask = get_l_prime(NrOfSymbols, mappingtype, add_pos, dmrslength, StartSymbolIndex, mac->scc->dmrs_TypeA_Position);
+ LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , DMRS_MASK:%x\n", pusch_config_pdu->start_symbol_index, pusch_config_pdu->nr_of_symbols, mappingtype, l_prime_mask);
+
#ifdef DEBUG_MSG3
LOG_D(NR_MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size);
#endif
@@ -668,18 +678,26 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
}
+ NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
+ if (pusch_Config->pusch_TimeDomainAllocationList) {
+ pusch_TimeDomainAllocationList = pusch_Config->pusch_TimeDomainAllocationList->choice.setup;
+ }
+ else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
+ pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
+ }
+
+ int mappingtype = pusch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
+
+ NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL;
+ NR_DMRS_ulconfig = (mappingtype == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA)
+ ? pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup : pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup;
+
/* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/
if (pusch_config_pdu->transform_precoding == transform_precoder_enabled) {
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
- NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL;
- if(pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL)
- NR_DMRS_ulconfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup;
- else
- NR_DMRS_ulconfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup;
-
uint32_t n_RS_Id = 0;
if (NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
n_RS_Id = *NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity;
@@ -748,9 +766,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->absolute_delta_PUSCH = 4;
}
+ if (NR_DMRS_ulconfig != NULL) {
+ add_pos = (NR_DMRS_ulconfig->dmrs_AdditionalPosition == NULL) ? 2 : *NR_DMRS_ulconfig->dmrs_AdditionalPosition;
+ dmrslength = NR_DMRS_ulconfig->maxLength == NULL ? pusch_len1 : pusch_len2;
+ }
+
/* DMRS */
- l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB,
- (*dci_format == NR_UL_DCI_FORMAT_0_1) ? pusch_dmrs_pos0 : pusch_dmrs_pos2, pusch_len1);
+ l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, mappingtype, add_pos, dmrslength, pusch_config_pdu->start_symbol_index, scc->dmrs_TypeA_Position);
if ((mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_disabled))
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_enabled))
@@ -758,11 +780,11 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
// Num PRB Overhead from PUSCH-ServingCellConfig
if (mac->cg &&
- mac->cg->spCellConfig &&
- mac->cg->spCellConfig->spCellConfigDedicated &&
- mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
- mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig &&
- mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead)
+ mac->cg->spCellConfig &&
+ mac->cg->spCellConfig->spCellConfigDedicated &&
+ mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
+ mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig &&
+ mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead)
N_PRB_oh = *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
else N_PRB_oh = 0;
@@ -799,7 +821,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->nr_of_symbols,
rnti_types[rnti_type]);
- pusch_config_pdu->ul_dmrs_symb_pos = l_prime_mask << pusch_config_pdu->start_symbol_index;;
+ pusch_config_pdu->ul_dmrs_symb_pos = l_prime_mask;
pusch_config_pdu->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
pusch_config_pdu->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index 28b7bce006..8080ca28ab 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -41,6 +41,7 @@
#include "UTIL/OPT/opt.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
+#include
extern RAN_CONTEXT_t RC;
extern const uint8_t nr_slots_per_frame[5];
extern uint16_t sl_ahead;
@@ -832,6 +833,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
int start_symbol_index,nr_of_symbols;
SLIV2SL(startSymbolAndLength, &start_symbol_index, &nr_of_symbols);
+ int mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType;
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
pusch_pdu->rnti = ra->rnti;
@@ -854,7 +856,10 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
pusch_pdu->transform_precoding = 0;
pusch_pdu->data_scrambling_id = *scc->physCellId;
pusch_pdu->nrOfLayers = 1;
- pusch_pdu->ul_dmrs_symb_pos = 1<ul_dmrs_symb_pos = get_l_prime(nr_of_symbols,mappingtype,pusch_dmrs_pos2,pusch_len1,start_symbol_index, scc->dmrs_TypeA_Position);
+ LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , ul_dmrs_symb_pos:%x\n", start_symbol_index, nr_of_symbols, mappingtype, pusch_pdu->ul_dmrs_symb_pos);
+
pusch_pdu->dmrs_config_type = 0;
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id.
pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0.
@@ -972,6 +977,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
LOG_D(MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",startSymbolIndex,nrOfSymbols);
+ int mappingtype = ra->CellGroup->spCellConfig->spCellConfigDedicated->
+ downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
+ pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
+
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
const int bwpid = bwp ? bwp->bwp_Id : 0;
@@ -1056,7 +1065,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL,
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
nrOfSymbols,
- startSymbolIndex);
+ startSymbolIndex,
+ mappingtype);
int x_Overhead = 0;
uint8_t tb_scaling = 0;
@@ -1243,10 +1253,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n");
+ int mappingtype = ra->CellGroup->spCellConfig->spCellConfigDedicated->
+ downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->
+ pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
+
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL,
scc->dmrs_TypeA_Position,
nrOfSymbols,
- startSymbolIndex);
+ startSymbolIndex,
+ mappingtype);
uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
index bfa46d5368..8b12742fcc 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
@@ -356,6 +356,7 @@ void schedule_control_sib1(module_id_t module_id,
int startSymbolIndex = 0;
int nrOfSymbols = 0;
+
if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) {
startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][1];
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2];
@@ -364,6 +365,9 @@ void schedule_control_sib1(module_id_t module_id,
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2];
}
+ // TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
+ int mappingtype = (startSymbolIndex <= 3)? typeA: typeB;
+
if (nrOfSymbols == 2) {
gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 1;
} else {
@@ -372,7 +376,7 @@ void schedule_control_sib1(module_id_t module_id,
// Calculate number of PRB_DMRS
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6;
- uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex);
+ uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype);
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos);
@@ -394,6 +398,7 @@ void schedule_control_sib1(module_id_t module_id,
LOG_D(MAC,"TBS = %i\n", TBS);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
+ LOG_D(MAC,"mappingtype = %d\n", mappingtype);
// Mark the corresponding RBs as used
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) {
@@ -406,7 +411,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
uint32_t TBS,
int StartSymbolIndex,
- int NrOfSymbols) {
+ int NrOfSymbols,
+ uint16_t dlDmrsSymbPos) {
gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP];
NR_COMMON_channels_t *cc = gNB_mac->common_channels;
@@ -477,9 +483,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx;
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
-
- pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols, pdsch_pdu_rel15->StartSymbolIndex);
-
+ pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos;
LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos);
/* Fill PDCCH DL DCI PDU */
@@ -604,9 +608,12 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2];
}
+ // TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
+ int mappingtype = (startSymbolIndex <= 3) ? typeA : typeB;
+
// Calculate number of PRB_DMRS
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6;
- uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex);
+ uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype);
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
@@ -614,7 +621,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3;
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
- nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols);
+ nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols, dlDmrsSymbPos);
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
index 7f2111aefb..147b20804f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
@@ -146,15 +146,18 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
int startSymbolAndLength=0;
int StartSymbolIndex=-1,NrOfSymbols=14;
int StartSymbolIndex_tmp,NrOfSymbols_tmp;
+ int mappingtype_tmp, mappingtype;
for (int i=0;
idownlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;
i++) {
startSymbolAndLength = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength,&StartSymbolIndex_tmp,&NrOfSymbols_tmp);
+ mappingtype_tmp = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
if (NrOfSymbols_tmp < NrOfSymbols) {
NrOfSymbols = NrOfSymbols_tmp;
StartSymbolIndex = StartSymbolIndex_tmp;
+ mappingtype = mappingtype_tmp;
// k0 = *scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
// time_domain_assignment = i;
}
@@ -165,7 +168,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL,
scc->dmrs_TypeA_Position,
NrOfSymbols,
- StartSymbolIndex);
+ StartSymbolIndex,
+ mappingtype);
/*
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 2e7f6f2bc9..a3a55a4171 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -278,6 +278,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
+ const int mapping_type = tdaList->list.array[tda]->mappingType;
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols);
@@ -300,7 +301,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
// if no data in dmrs cdm group is 1 only even REs have no data
// if no data in dmrs cdm group is 2 both odd and even REs have no data
ps->N_PRB_DMRS = num_dmrs_cdm_grps_no_data * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
- ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwp ? bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex);
+ ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwp ? bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type);
ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos);
}
@@ -364,11 +365,12 @@ void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc,
: *ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)):2;
const pusch_maxLength_t pusch_maxLength =
ps->NR_DMRS_UplinkConfig ? (ps->NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2) : 1;
- const uint16_t l_prime_mask = get_l_prime(ps->nrOfSymbols,
+ ps->ul_dmrs_symb_pos = get_l_prime(ps->nrOfSymbols,
ps->mapping_type,
additional_pos,
- pusch_maxLength);
- ps->ul_dmrs_symb_pos = l_prime_mask << ps->startSymbolIndex;
+ pusch_maxLength,
+ ps->startSymbolIndex,
+ scc->dmrs_TypeA_Position);
uint8_t num_dmrs_symb = 0;
for(int i = ps->startSymbolIndex; i < ps->startSymbolIndex + ps->nrOfSymbols; i++)
num_dmrs_symb += (ps->ul_dmrs_symb_pos >> i) & 1;
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index e516217ff1..51d3cfc8f3 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -57,7 +57,7 @@
#include "openair2/RRC/NAS/nas_config.h"
#include "intertask_interface.h"
#include "openair3/S1AP/s1ap_eNB.h"
-
+#include
# include "gtpv1u_eNB_task.h"
# include "gtpv1u.h"
@@ -136,6 +136,43 @@ notifiedFIFO_t pdcp_sdu_list;
pdcp_enb_t pdcp_enb[MAX_NUM_CCs];
+extern volatile int oai_exit;
+
+pthread_t pdcp_stats_thread_desc;
+
+void *pdcp_stats_thread(void *param) {
+
+ FILE *fd;
+ int old_byte_cnt[MAX_MOBILES_PER_ENB][NB_RB_MAX],old_byte_cnt_rx[MAX_MOBILES_PER_ENB][NB_RB_MAX];
+ for (int i=0;i0) {
+ fprintf(fd,"PDCP: CRNTI %x, DRB %d: tx_bytes %d, DL Throughput %e\n",
+ pdcp_enb[0].rnti[UE_id],drb_id,
+ Pdcp_stats_tx_bytes[0][UE_id][drb_id],
+ (double)((Pdcp_stats_tx_bytes[0][UE_id][drb_id]-old_byte_cnt[UE_id][drb_id])<<3));
+ fprintf(fd," rx_bytes %d, UL Throughput %e\n",
+ Pdcp_stats_rx_bytes[0][UE_id][drb_id],
+ (double)((Pdcp_stats_rx_bytes[0][UE_id][drb_id]-old_byte_cnt_rx[UE_id][drb_id])<<3));
+ old_byte_cnt[UE_id][drb_id]=Pdcp_stats_tx_bytes[0][UE_id][drb_id];
+ old_byte_cnt_rx[UE_id][drb_id]=Pdcp_stats_rx_bytes[0][UE_id][drb_id];
+ }
+ }
+ fclose(fd);
+ }
+ return(NULL);
+}
+
uint64_t get_pdcp_optmask(void) {
return pdcp_params.optmask;
}
@@ -516,7 +553,7 @@ boolean_t pdcp_data_req(
break;
}
- //LOG_I(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, rb_idP+rb_offset, current_sn);
+ LOG_D(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, (int)(rb_idP+rb_offset), current_sn);
Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_tx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
@@ -2345,6 +2382,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
}
+ pthread_create(&pdcp_stats_thread_desc,NULL,pdcp_stats_thread,NULL);
+
return pdcp_params.optmask ;
}
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
index 36500c3d16..1709c387cf 100644
--- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
@@ -508,6 +508,13 @@ error:
return -1;
}
+boolean_t pdcp_data_ind(
+ const protocol_ctxt_t *const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_id,
+ const sdu_size_t sdu_buffer_size,
+ mem_block_t *const sdu_buffer);
int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
boolean_t result = 0;
diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index 38a742bf74..ed3c9a5b7d 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -19,6 +19,8 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint16_t sf_ahead;
extern UL_RCC_IND_t UL_RCC_INFO;
+extern RAN_CONTEXT_t RC;
+
uint16_t frame_cnt=0;
void handle_rach(UL_IND_t *UL_info) {
int i;
@@ -685,7 +687,7 @@ static void dump_dl(Sched_Rsp_t *d) {
/* debug utility functions end */
/****************************************************************************/
-void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) {
+void UL_indication(UL_IND_t *UL_info, void *proc) {
AssertFatal(UL_info!=NULL,"UL_INFO is null\n");
#ifdef DUMP_FAPI
dump_ul(UL_info);
diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h
index 1470cbc006..096979c4fd 100644
--- a/openair2/PHY_INTERFACE/IF_Module.h
+++ b/openair2/PHY_INTERFACE/IF_Module.h
@@ -37,7 +37,6 @@
#include
//#include "openair1/PHY/LTE_TRANSPORT/transport_eNB.h"
#include "nfapi_interface.h"
-#include "platform_constants.h"
#include "platform_types.h"
#include
@@ -135,64 +134,13 @@ typedef struct {
uint8_t Mod_id;
int CC_id;
nfapi_config_request_t *cfg;
-}PHY_Config_t;
+} PHY_Config_t;
#include
-/// Context data structure for RX/TX portion of subframe processing
-typedef struct {
- /// Component Carrier index
- uint8_t CC_id;
- /// timestamp transmitted to HW
- openair0_timestamp timestamp_tx;
- openair0_timestamp timestamp_rx;
- /// subframe to act upon for transmission
- int subframe_tx;
- /// subframe to act upon for reception
- int subframe_rx;
- /// frame to act upon for transmission
- int frame_tx;
- /// frame to act upon for reception
- int frame_rx;
- int frame_prach;
- int subframe_prach;
- int frame_prach_br;
- int subframe_prach_br;
- /// \brief Instance count for RXn-TXnp4 processing thread.
- /// \internal This variable is protected by \ref mutex_rxtx.
- int instance_cnt;
- /// pthread structure for RXn-TXnp4 processing thread
- pthread_t pthread;
- /// pthread attributes for RXn-TXnp4 processing thread
- pthread_attr_t attr;
- /// condition variable for tx processing thread
- pthread_cond_t cond;
- /// mutex for RXn-TXnp4 processing thread
- pthread_mutex_t mutex;
- /// scheduling parameters for RXn-TXnp4 thread
- struct sched_param sched_param_rxtx;
-
- /// \internal This variable is protected by \ref mutex_RUs.
- int instance_cnt_RUs;
- /// condition variable for tx processing thread
- pthread_cond_t cond_RUs;
- /// mutex for RXn-TXnp4 processing thread
- pthread_mutex_t mutex_RUs;
- tpool_t *threadPool;
- int nbEncode;
- int nbDecode;
- notifiedFIFO_t *respEncode;
- notifiedFIFO_t *respDecode;
- pthread_mutex_t mutex_emulateRF;
- int instance_cnt_emulateRF;
- pthread_t pthread_emulateRF;
- pthread_attr_t attr_emulateRF;
- pthread_cond_t cond_emulateRF;
- int first_rx;
-} L1_rxtx_proc_t;
typedef struct IF_Module_s{
//define the function pointer
- void (*UL_indication)(UL_IND_t *UL_INFO, L1_rxtx_proc_t *proc);
- void (*schedule_response)(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc);
+ void (*UL_indication)(UL_IND_t *UL_INFO, void *proc);
+ void (*schedule_response)(Sched_Rsp_t *Sched_INFO, void *proc);
void (*PHY_config_req)(PHY_Config_t* config_INFO);
void (*PHY_config_update_sib2_req)(PHY_Config_t* config_INFO);
@@ -209,7 +157,7 @@ void IF_Module_kill(int Mod_id);
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
-void UL_indication(UL_IND_t *UL_INFO, L1_rxtx_proc_t *proc);
+void UL_indication(UL_IND_t *UL_INFO, void *proc);
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void Schedule_Response(Sched_Rsp_t *Sched_INFO);
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index 61bce26b2c..ce26aeef87 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -2728,7 +2728,7 @@ do_RRCConnectionSetup(
// assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax,
//SchedulingRequestConfig__setup__dsr_TransMax_n4);
// assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
- physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4;
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n64;
rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id;
rrcConnectionSetup->criticalExtensions.present = LTE_RRCConnectionSetup__criticalExtensions_PR_c1;
rrcConnectionSetup->criticalExtensions.choice.c1.present = LTE_RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ;
@@ -3220,56 +3220,58 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0;
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
&rat);
-
- /* request NR configuration */
LTE_UECapabilityEnquiry_r8_IEs_t *r8 = &dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8;
LTE_UECapabilityEnquiry_v8a0_IEs_t r8_a0;
LTE_UECapabilityEnquiry_v1180_IEs_t r11_80;
LTE_UECapabilityEnquiry_v1310_IEs_t r13_10;
LTE_UECapabilityEnquiry_v1430_IEs_t r14_30;
LTE_UECapabilityEnquiry_v1510_IEs_t r15_10;
-
- memset(&r8_a0, 0, sizeof(r8_a0));
- memset(&r11_80, 0, sizeof(r11_80));
- memset(&r13_10, 0, sizeof(r13_10));
- memset(&r14_30, 0, sizeof(r14_30));
- memset(&r15_10, 0, sizeof(r15_10));
-
- r8->nonCriticalExtension = &r8_a0;
- r8_a0.nonCriticalExtension = &r11_80;
- r11_80.nonCriticalExtension = &r13_10;
- r13_10.nonCriticalExtension = &r14_30;
- r14_30.nonCriticalExtension = &r15_10;
-
- /* TODO: no hardcoded values here */
-
- nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
-
- nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
- nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA;
- nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t));
- nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band;
- ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
-
- nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
- nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR;
- nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t));
- if(nr_band > 0)
- nsa_band->choice.bandInformationNR->bandNR = nr_band;
- else
- nsa_band->choice.bandInformationNR->bandNR = 78;
- ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
-
OCTET_STRING_t req_freq;
- //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 }; // bands 7 & nr78
- unsigned char req_freq_buf[1024];
- enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList,
- NULL,
- (void *)nsa_band_list,
- req_freq_buf,
- 1024);
- xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list);
+ if (nr_band>0) {
+
+ /* request NR configuration */
+
+ memset(&r8_a0, 0, sizeof(r8_a0));
+ memset(&r11_80, 0, sizeof(r11_80));
+ memset(&r13_10, 0, sizeof(r13_10));
+ memset(&r14_30, 0, sizeof(r14_30));
+ memset(&r15_10, 0, sizeof(r15_10));
+
+ r8->nonCriticalExtension = &r8_a0;
+ r8_a0.nonCriticalExtension = &r11_80;
+ r11_80.nonCriticalExtension = &r13_10;
+ r13_10.nonCriticalExtension = &r14_30;
+ r14_30.nonCriticalExtension = &r15_10;
+
+ /* TODO: no hardcoded values here */
+
+ nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
+
+ nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
+ nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA;
+ nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t));
+ nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band;
+ ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
+
+ nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
+ nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR;
+ nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t));
+ //if(nr_band > 0)
+ nsa_band->choice.bandInformationNR->bandNR = nr_band;
+ //else
+ // nsa_band->choice.bandInformationNR->bandNR = 78;
+ ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
+
+ //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 }; // bands 7 & nr78
+ unsigned char req_freq_buf[1024];
+ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList,
+ NULL,
+ (void *)nsa_band_list,
+ req_freq_buf,
+ 1024);
+
+ xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list);
@@ -3280,14 +3282,16 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
//0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a
// };
- req_freq.buf = req_freq_buf;
- req_freq.size = (enc_rval.encoded+7)/8;
+ req_freq.buf = req_freq_buf;
+ req_freq.size = (enc_rval.encoded+7)/8;
// req_freq.size = 21;
- r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
- if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg);
+ r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
+ // Add request for eutra-nr
}
+// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+ xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg);
+// }
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message,
NULL,
diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h
index 2a34971c23..3907d2321d 100644
--- a/openair2/RRC/LTE/defs_NB_IoT.h
+++ b/openair2/RRC/LTE/defs_NB_IoT.h
@@ -211,13 +211,13 @@ typedef struct RB_INFO_TABLE_ENTRY_NB_IoT_s {
RB_INFO_NB_IoT Rb_info;
uint8_t Active;
uint32_t Next_check_frame;
- uint8_t Status;
+ uint8_t status;
} RB_INFO_TABLE_ENTRY_NB_IoT;
typedef struct SRB_INFO_TABLE_ENTRY_NB_IoT_s {
SRB_INFO_NB_IoT Srb_info;
uint8_t Active;
- uint8_t Status;
+ uint8_t status;
uint32_t Next_check_frame;
} SRB_INFO_TABLE_ENTRY_NB_IoT;
@@ -269,7 +269,7 @@ typedef struct eNB_RRC_UE_NB_IoT_s {
e_LTE_CipheringAlgorithm_r12 ciphering_algorithm; //Specs. TS 36.331 V14.1.0 pag 432 Change position of chipering enumerative w.r.t previous version
e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
- uint8_t Status;
+ uint8_t status;
rnti_t rnti;
uint64_t random_ue_identity;
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index 881e5b8ad1..2e91e55589 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -1056,7 +1056,7 @@ void release_UE_in_freeList(module_id_t mod_id) {
if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
// clean UCI entries for rnti
- for (i=0; iuci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
@@ -1090,7 +1090,7 @@ void release_UE_in_freeList(module_id_t mod_id) {
clean_eNb_ulsch(ulsch);
}
- for (i=0; iuci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
@@ -3442,6 +3442,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
if (ue_context_pP->ue_context.does_nr) {
+ LOG_I(RRC,"Configuring measurement for NR cell\n");
ReportConfig_NR->reportConfigId = 7;
ReportConfig_NR->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigInterRAT;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.present = LTE_ReportConfigInterRAT__triggerType_PR_event;
@@ -4568,7 +4569,6 @@ rrc_eNB_process_MeasurementReport(
case 7:
LOG_D(RRC, "NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
- printf("NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
break;
default:
@@ -4593,6 +4593,9 @@ rrc_eNB_process_MeasurementReport(
ue_context_pP->ue_context.gnb_x2_assoc_id = -1; // set when receiving X2AP_ENDC_SGNB_ADDITION_REQ_ACK
if(is_en_dc_supported(ue_context_pP->ue_context.UE_Capability)) {
+
+ AssertFatal(measResults2->measResultNeighCells!=NULL,"no measResultNeighCells, shouldn't happen!\n");
+ AssertFatal(measResults2->measResultNeighCells->present==LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15,"field is not LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15");
/** to add gNB as Secondary node CG-ConfigInfo to be added as per 36.423 r15 **/
if(encode_CG_ConfigInfo(enc_buf,sizeof(enc_buf),ue_context_pP,&enc_size) == RRC_OK)
LOG_I(RRC,"CG-ConfigInfo encoded successfully\n");
@@ -4611,6 +4614,7 @@ rrc_eNB_process_MeasurementReport(
X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size;
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId
+ //= measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15;
= measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId;
//For the moment we have a single E-RAB which will be the one to be added to the gNB
@@ -4633,6 +4637,32 @@ rrc_eNB_process_MeasurementReport(
return;
}
}
+
+ if (!ue_context_pP->ue_context.measResults->measResultNeighCells) {
+ ue_context_pP->ue_context.measResults->measResultNeighCells = calloc(1,sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells));
+ ue_context_pP->ue_context.measResults->measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15;
+ ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array));
+ ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0] = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]));
+ ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.count = 1;
+ }
+ struct LTE_MeasResultCellNR_r15 *ueCtxtMeasResultCellNR_r15 = ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0];
+ const struct LTE_MeasResultCellNR_r15 *measNeighCellNR0 = measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0];
+ ueCtxtMeasResultCellNR_r15->pci_r15 = measNeighCellNR0->pci_r15;
+ if (!ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15)
+ ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15));
+ if (!ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15)
+ ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15));
+ *ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = *measNeighCellNR0->measResultCell_r15.rsrpResult_r15;
+ *ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = *measNeighCellNR0->measResultCell_r15.rsrqResult_r15;
+ if (measNeighCellNR0->measResultRS_IndexList_r15) {
+ if (!ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15) {
+ ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15 = calloc(1,sizeof(*ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15));
+ ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array = calloc(1, sizeof(ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array));
+ ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array[0] = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array));
+ ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.count = 1;
+ }
+ ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15 = measNeighCellNR0->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15;
+ }
}
if (measResults2->measResultNeighCells == NULL)
@@ -5710,7 +5740,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
//SchedulingRequestConfig__setup__dsr_TransMax_n4);
// assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax =
- LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4;
+ LTE_SchedulingRequestConfig__setup__dsr_TransMax_n64;
LOG_D(RRC,
"handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id);
@@ -7581,7 +7611,205 @@ rrc_eNB_decode_ccch(
return rval;
}
+#define NCE nonCriticalExtension
+
+static void
+get_ue_Category(
+ LTE_UE_EUTRA_Capability_t *c,
+ long *catDL,
+ long *catUL
+)
+{
+ if (c != NULL) { // v8.6
+ *catDL=c->ue_Category; *catUL=c->ue_Category;
+ struct LTE_UE_EUTRA_Capability_v920_IEs *c92=c->NCE;
+ if (c92 != NULL) { // v9.2
+ struct LTE_UE_EUTRA_Capability_v940_IEs *c94=c92->NCE;
+ if (c94 != NULL) { // v9.4
+ struct LTE_UE_EUTRA_Capability_v1020_IEs *c102=c94->NCE;
+ if (c102 != NULL) { // v10.2
+ if (c102->ue_Category_v1020) {*catDL=*c102->ue_Category_v1020;*catUL=*c102->ue_Category_v1020;}
+ struct LTE_UE_EUTRA_Capability_v1060_IEs *c106=c102->NCE;
+ if (c106 != NULL) { // v10.6
+ struct LTE_UE_EUTRA_Capability_v1090_IEs *c109=c106->NCE;
+ if (c109 != NULL) { // v10.9
+ struct LTE_UE_EUTRA_Capability_v1130_IEs *c113=c109->NCE;
+ if (c113 != NULL) { // v11.3
+ struct LTE_UE_EUTRA_Capability_v1170_IEs *c117=c113->NCE;
+ if (c117 != NULL) { // v11.7
+ if (c117->ue_Category_v1170) {*catDL=*c117->ue_Category_v1170;
+ struct LTE_UE_EUTRA_Capability_v1180_IEs *c118=c117->NCE;
+ if (c118 != NULL) { // v11.8
+ struct LTE_UE_EUTRA_Capability_v11a0_IEs *c11a=c118->NCE;
+ if (c11a != NULL) { // v11.a
+ if (c11a->ue_Category_v11a0) {*catDL=*c11a->ue_Category_v11a0;*catUL=*c11a->ue_Category_v11a0;}
+ struct LTE_UE_EUTRA_Capability_v1250_IEs *c125=c11a->NCE;
+ if (c125 != NULL) { // v12.5
+ if (c125->ue_CategoryDL_r12) *catDL=*c125->ue_CategoryDL_r12;
+ if (c125->ue_CategoryUL_r12) *catUL=*c125->ue_CategoryUL_r12;
+ struct LTE_UE_EUTRA_Capability_v1260_IEs *c126=c125->NCE;
+ if (c126 != NULL) { // v12.6
+ if (c126->ue_CategoryDL_v1260) *catDL=*c126->ue_CategoryDL_v1260;
+ struct LTE_UE_EUTRA_Capability_v1270_IEs *c127=c126->NCE;
+ if (c127 != NULL) { // v12.7
+ struct LTE_UE_EUTRA_Capability_v1280_IEs *c128=c127->NCE;
+ if (c128 != NULL) { // v12.8
+ struct LTE_UE_EUTRA_Capability_v1310_IEs *c131=c128->NCE;
+ if (c131 != NULL) { // v13.1
+ if (c131->ue_CategoryDL_v1310 && *c131->ue_CategoryDL_v1310 == 0) *catDL=17;
+ if (c131->ue_CategoryDL_v1310 && *c131->ue_CategoryDL_v1310 == 1) *catDL=-1;
+ if (c131->ue_CategoryUL_v1310 && *c131->ue_CategoryUL_v1310 == 0) *catUL=14;
+ if (c131->ue_CategoryUL_v1310 && *c131->ue_CategoryUL_v1310 == 1) *catUL=-1;
+ struct LTE_UE_EUTRA_Capability_v1320_IEs *c132=c131->NCE;
+ if (c132 != NULL) { //v13.2
+ struct LTE_UE_EUTRA_Capability_v1330_IEs *c133=c132->NCE;
+ if (c133 != NULL) { // v13.3
+ if (c133->ue_CategoryDL_v1330) *catDL=*c133->ue_CategoryDL_v1330;
+ struct LTE_UE_EUTRA_Capability_v1340_IEs *c134=c133->NCE;
+ if (c134 != NULL) { // v13.4
+ if (c134->ue_CategoryUL_v1340) *catUL=*c134->ue_CategoryUL_v1340;
+ struct LTE_UE_EUTRA_Capability_v1350_IEs *c135=c134->NCE;
+ if (c135 != NULL) { // v13.5
+ if (c135->ue_CategoryDL_v1350) *catDL=99; // Cat 1Bis
+ if (c135->ue_CategoryUL_v1350) *catUL=99; // Cat 1Bis
+ struct LTE_UE_EUTRA_Capability_v1360_IEs *c136=c135->NCE;
+ if (c136 != NULL) { // v13.6
+ struct LTE_UE_EUTRA_Capability_v1430_IEs *c143=c136->NCE;
+ if (c143 != NULL) { // v14.3
+ if (c143->ue_CategoryDL_v1430 && *c143->ue_CategoryDL_v1430 == LTE_UE_EUTRA_Capability_v1430_IEs__ue_CategoryDL_v1430_m2) *catDL=-2;
+ if (c143->ue_CategoryUL_v1430 && *c143->ue_CategoryUL_v1430 == LTE_UE_EUTRA_Capability_v1430_IEs__ue_CategoryDL_v1430_m2) *catUL=-2;
+ if (c143->ue_CategoryUL_v1430) *catUL=16+*c143->ue_CategoryUL_v1430;
+ if (c143->ue_CategoryUL_v1430b)*catUL=21;
+ struct LTE_UE_EUTRA_Capability_v1440_IEs *c144=c143->NCE;
+ if (c144 != NULL) { // v14.4
+ struct LTE_UE_EUTRA_Capability_v1450_IEs *c145=c144->NCE;
+ if (c145 != NULL) { // v14.5
+ if (c145->ue_CategoryDL_v1450) *catDL=*c145->ue_CategoryDL_v1450;
+ struct LTE_UE_EUTRA_Capability_v1460_IEs *c146=c145->NCE;
+ if (c146 != NULL) { // v14.6
+ if (c146->ue_CategoryDL_v1460) *catDL=*c146->ue_CategoryDL_v1460;
+ struct LTE_UE_EUTRA_Capability_v1510_IEs *c151=c146->NCE;
+ if (c151 != NULL) { // v15.1
+ struct LTE_UE_EUTRA_Capability_v1520_IEs *c152=c151->NCE;
+ if (c152 != NULL) { // v15.20
+ struct LTE_UE_EUTRA_Capability_v1530_IEs *c153=c152->NCE;
+ if (c153 != NULL) { // v15.30
+ if (c153->ue_CategoryDL_v1530) *catDL=*c153->ue_CategoryDL_v1530;
+ if (c153->ue_CategoryUL_v1530) *catUL=*c153->ue_CategoryUL_v1530;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+static int
+is_ul_64QAM_supported(
+ LTE_UE_EUTRA_Capability_t *c
+)
//-----------------------------------------------------------------------------
+{
+ return c != NULL // R8
+ && c->NCE != NULL // R92
+ && c->NCE->NCE != NULL // R94
+ && c->NCE->NCE->NCE != NULL // R102
+ && c->NCE->NCE->NCE->NCE != NULL // R106
+ && c->NCE->NCE->NCE->NCE->NCE != NULL // R109
+ && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->ul_64QAM_r12 != NULL
+ && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->ul_64QAM_r12==LTE_SupportedBandEUTRA_v1250__ul_64QAM_r12_supported;
+}
+
+static int
+is_dl_256QAM_supported(
+ LTE_UE_EUTRA_Capability_t *c
+)
+//-----------------------------------------------------------------------------
+{
+ return c != NULL // R8
+ && c->NCE != NULL // R92
+ && c->NCE->NCE != NULL // R94
+ && c->NCE->NCE->NCE != NULL // R102
+ && c->NCE->NCE->NCE->NCE != NULL // R106
+ && c->NCE->NCE->NCE->NCE->NCE != NULL // R109
+ && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->dl_256QAM_r12 != NULL
+ && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->dl_256QAM_r12==LTE_SupportedBandEUTRA_v1250__dl_256QAM_r12_supported;
+
+}
+static int
+is_ul_256QAM_supported(
+ LTE_UE_EUTRA_Capability_t *c
+)
+//-----------------------------------------------------------------------------
+{
+ return c != NULL // R8
+ && c->NCE != NULL // R92
+ && c->NCE->NCE != NULL // R94
+ && c->NCE->NCE->NCE != NULL // R102
+ && c->NCE->NCE->NCE->NCE != NULL // R106
+ && c->NCE->NCE->NCE->NCE->NCE != NULL // R109
+ && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //135
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430 != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array != NULL
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14!=NULL
+ && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14==LTE_BandParameters_v1430__ul_256QAM_r14_supported;
+}
+
static int
is_en_dc_supported(
LTE_UE_EUTRA_Capability_t *c
@@ -7591,32 +7819,31 @@ is_en_dc_supported(
/* to be refined - check that the bands supported by the UE include
* the band of the gNB
*/
-#define NCE nonCriticalExtension
- return c != NULL
- && c->NCE != NULL
- && c->NCE->NCE != NULL
- && c->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
- && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
+ return c != NULL // R8
+ && c->NCE != NULL // R92
+ && c->NCE->NCE != NULL // R94
+ && c->NCE->NCE->NCE != NULL // R102
+ && c->NCE->NCE->NCE->NCE != NULL // R106
+ && c->NCE->NCE->NCE->NCE->NCE != NULL // R109
+ && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //135
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //144
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //145
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //146
+ && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //151
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL
&& *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 ==
@@ -7624,6 +7851,45 @@ is_en_dc_supported(
#undef NCE
}
+int to_nr_rsrpq(long rsrpq_result,int nr_band) {
+
+ switch(nr_band) {
+ case 1: // A
+ case 70:
+ case 74:
+ case 34:
+ case 38:
+ case 39:
+ case 40:
+ case 50:
+ case 51:
+ return((rsrpq_result*10)-1180);
+ case 66: // B
+ return((rsrpq_result*10)-1175);
+ case 77: // C
+ case 78:
+ case 79:
+ return((rsrpq_result*10)-1170);
+ case 28: // D
+ return((rsrpq_result*10)-1165);
+ case 2:
+ case 5:
+ case 7:
+ case 41: // E
+ return((rsrpq_result*10)-1160);
+ case 3: // G
+ case 8:
+ case 12:
+ case 20:
+ case 71:
+ return((rsrpq_result*10)-1150);
+ case 25: // H
+ return((rsrpq_result*10)-1145);
+ default:
+ AssertFatal(1==0,"Illegal NR band %d\n",nr_band);
+ }
+}
+
//-----------------------------------------------------------------------------
int
rrc_eNB_decode_dcch(
@@ -8193,7 +8459,7 @@ rrc_eNB_decode_dcch(
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
ue_context_p->ue_context.UE_Capability_nr = 0;
}
-
+ LOG_I(RRC,"Received NR_UE_Capabilities\n");
dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_NR_Capability,
(void **)&ue_context_p->ue_context.UE_Capability_nr,
@@ -8218,6 +8484,8 @@ rrc_eNB_decode_dcch(
if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type ==
LTE_RAT_Type_eutra_nr) {
+ LOG_I(RRC,"Received UE_Capabilities_MRDC\n");
+
if(ue_context_p->ue_context.UE_Capability_MRDC) {
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
ue_context_p->ue_context.UE_Capability_MRDC = 0;
@@ -8574,7 +8842,6 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i];
int num_SI= 0;
-
if (rrc->carrier[0].SIB23) {
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container[num_SI] = rrc->carrier[0].SIB23;
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container_length[num_SI] = rrc->carrier[0].sizeof_SIB23;
@@ -8780,10 +9047,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
struct rrc_eNB_ue_context_s *ue_to_be_removed[NUMBER_OF_UE_MAX];
int removed_ue_count = 0;
int cur_ue;
-#ifdef LOCALIZATION
- double estimated_distance = 0;
- protocol_ctxt_t ctxt;
-#endif
MessageDef *msg;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX, VCD_FUNCTION_IN);
@@ -8795,22 +9058,53 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
}
// check for UL failure or for UE to be released
+ FILE *fd=NULL;
+ if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0)
+ fd=fopen("RRC_stats.log","w+");
+
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
ctxt_pP->rnti = ue_context_p->ue_id_rnti;
- if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe == 0)) {
- if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
- LOG_I(RRC, "UE rnti %x: S-TMSI %x failure timer %d/8\n",
- ue_context_p->ue_context.rnti,
- ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
- ue_context_p->ue_context.ul_failure_timer);
- } else {
- LOG_I(RRC, "UE rnti %x failure timer %d/8\n",
- ue_context_p->ue_context.rnti,
- ue_context_p->ue_context.ul_failure_timer);
+ if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0) {
+ if (fd) {
+ if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+ fprintf(fd,"RRC UE rnti %x: S-TMSI %x failure timer %d/8\n",
+ ue_context_p->ue_context.rnti,
+ ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+ ue_context_p->ue_context.ul_failure_timer);
+ } else {
+ fprintf(fd,"RRC UE rnti %x failure timer %d/8\n",
+ ue_context_p->ue_context.rnti,
+ ue_context_p->ue_context.ul_failure_timer);
+ }
+
+ if (ue_context_p->ue_context.UE_Capability) {
+ long catDL,catUL;
+ get_ue_Category(ue_context_p->ue_context.UE_Capability,&catDL,&catUL);
+ fprintf(fd,"RRC UE cap: CatDL %ld, CatUL %ld, 64QAM UL %s, 256 QAM DL %s, 256 QAM UL %s, ENDC %s,\n",
+ catDL,catUL,
+ is_ul_64QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no",
+ is_dl_256QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no",
+ is_ul_256QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no",
+ is_en_dc_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no");
+ }
+ if (ue_context_p->ue_context.measResults) {
+ fprintf(fd, "RRC PCell RSRP %ld, RSRQ %ld\n", ue_context_p->ue_context.measResults->measResultPCell.rsrpResult-140,
+ ue_context_p->ue_context.measResults->measResultPCell.rsrqResult/2 - 20);
+ if (ue_context_p->ue_context.measResults->measResultNeighCells &&
+ ue_context_p->ue_context.measResults->measResultNeighCells->present == LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15) {
+
+ fprintf(fd,"NR_pci %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15);
+ if(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15)
+ fprintf(fd,"NR_rsrp %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0);
+ if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15)
+ fprintf(fd,"NR_rsrq %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0);
+ if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15)
+ fprintf(fd,"NR_ssb_index %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15);
+ }
+ }
}
}
-
if (ue_context_p->ue_context.ul_failure_timer > 0) {
ue_context_p->ue_context.ul_failure_timer++;
@@ -9002,31 +9296,9 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
}
}
-#ifdef RRC_LOCALIZATION
- /* for the localization, only primary CC_id might be relevant*/
- gettimeofday(&ts, NULL);
- current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
- ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
- RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
- ctxt = *ctxt_pP;
- ctxt.rnti = ue_context_p->ue_context.rnti;
- estimated_distance = rrc_get_estimated_ue_distance(&ctxt, CC_id, RC.rrc[ctxt_pP->module_id]->loc_type);
+ if (fd!=NULL) fclose(fd);
+
- if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
- estimated_distance != -1) {
- LOG_D(LOCALIZE, "RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
- ctxt.rnti,
- ctxt_pP->module_id,
- current_timestamp_ms,
- ctxt_pP->frame,
- estimated_distance);
- LOG_D(LOCALIZE, "RRC status %d\n",
- ue_context_p->ue_context.Status);
- push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, estimated_distance);
- RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
- } // end if
- } // end RB_FOREACH
-#endif
(void)ts; /* remove gcc warning "unused variable" */
(void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
(void)current_timestamp_ms; /* remove gcc warning "unused variable" */
diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h
index 1483693ac6..480f0414d5 100644
--- a/openair2/RRC/NR/nr_rrc_defs.h
+++ b/openair2/RRC/NR/nr_rrc_defs.h
@@ -239,13 +239,13 @@ typedef struct RB_INFO_TABLE_ENTRY_NR_s {
NR_RB_INFO Rb_info;
uint8_t Active;
uint32_t Next_check_frame;
- uint8_t Status;
+ uint8_t status;
} NR_RB_INFO_TABLE_ENTRY;
typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
NR_SRB_INFO Srb_info;
uint8_t Active;
- uint8_t Status;
+ uint8_t status;
uint32_t Next_check_frame;
} NR_SRB_INFO_TABLE_ENTRY;
@@ -317,7 +317,7 @@ typedef struct gNB_RRC_UE_s {
NR_CipheringAlgorithm_t ciphering_algorithm;
e_NR_IntegrityProtAlgorithm integrity_algorithm;
- uint8_t Status;
+ uint8_t status;
rnti_t rnti;
uint64_t random_ue_identity;
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index 2571ad8e55..9ae3724dec 100755
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -437,7 +437,7 @@ rrc_gNB_generate_RRCSetup(
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
-
+
break;
case ngran_gNB_DU:
@@ -497,7 +497,7 @@ rrc_gNB_generate_RRCSetup(
ue_context_pP->ue_context.masterCellGroup
);
nr_rrc_rlc_config_asn1_req(ctxt_pP,
- ue_context_pP->ue_context.SRB_configList,
+ ue_context_pP->ue_context.SRB_configList,
NULL,
NULL,
NULL,
@@ -564,7 +564,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
ue_context_pP->ue_context.rnti,
(NR_CellGroupConfig_t *)NULL
);
-
+
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
@@ -687,7 +687,7 @@ rrc_gNB_process_RRCSetupComplete(
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1;
- ue_context_pP->ue_context.Status = NR_RRC_CONNECTED;
+ ue_context_pP->ue_context.status = NR_RRC_CONNECTED;
if (AMF_MODE_ENABLED) {
rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete);
@@ -879,14 +879,14 @@ rrc_gNB_generate_defaultRRCReconfiguration(
// rrc_rlc_config_asn1_req
}
break;
-
+
default :
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type);
}
}
//-----------------------------------------------------------------------------
-void
+void
rrc_gNB_generate_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP
@@ -899,7 +899,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
NR_DRB_ToAddModList_t **DRB_configList = NULL;
NR_DRB_ToAddModList_t **DRB_configList2 = NULL;
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
- NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
+ NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList = NULL;
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
@@ -1051,7 +1051,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup);
size = do_RRCReconfiguration(ctxt_pP, buffer,
xid,
- *SRB_configList2,
+ *SRB_configList2,
*DRB_configList,
NULL,
NULL,
@@ -1262,7 +1262,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
#ifndef ITTI_SIM
LOG_I(NR_RRC,"Configuring PDCP DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
-
+
nr_rrc_pdcp_config_asn1_req(ctxt_pP,
SRB_configList, // NULL,
DRB_configList,
@@ -1495,7 +1495,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
uint8_t next_xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
int ret = 0;
- ue_context_pP->ue_context.Status = NR_RRC_CONNECTED;
+ ue_context_pP->ue_context.status = NR_RRC_CONNECTED;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED
ue_context_pP->ue_context.reestablishment_xid = next_xid;
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
@@ -1990,7 +1990,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
}
#endif
//c-plane not end
- if((ue_context_p->ue_context.Status != NR_RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == NR_ReestablishmentCause_spare1)) {
+ if((ue_context_p->ue_context.status != NR_RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == NR_ReestablishmentCause_spare1)) {
LOG_E(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" NR_RRCReestablishmentRequest (UE %x c-plane is not end), RRC establishment failed \n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti);
@@ -2002,9 +2002,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
LOG_E(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRRCReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status NR_RRC_RECONFIGURED\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
- ue_context_p->ue_context.Status
+ ue_context_p->ue_context.status
);
- ue_context_p->ue_context.Status = NR_RRC_RECONFIGURED;
+ ue_context_p->ue_context.status = NR_RRC_RECONFIGURED;
protocol_ctxt_t ctxt_old_p;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p,
ctxt_pP->instance,
@@ -2707,13 +2707,13 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
if (msg_p2 == NULL) {
msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
}
-
+
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
}
- F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
+ F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0];
@@ -2731,7 +2731,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
cu_cell_ind++;
found_cell=1;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind;
- // send
+ // send
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n",
diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c
index 222f6a2375..fb1533c518 100644
--- a/openair2/RRC/NR/rrc_gNB_NGAP.c
+++ b/openair2/RRC/NR/rrc_gNB_NGAP.c
@@ -579,7 +579,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
}
// in case, send the S1SP initial context response if it is not sent with the attach complete message
- if (ue_context_p->ue_context.Status == NR_RRC_RECONFIGURED) {
+ if (ue_context_p->ue_context.status == NR_RRC_RECONFIGURED) {
LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
}
diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c
index 5e38e5c577..eefe5f2cce 100644
--- a/openair2/RRC/NR_UE/rrc_UE.c
+++ b/openair2/RRC/NR_UE/rrc_UE.c
@@ -553,7 +553,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
uint8_t *const bufferP,
const uint8_t buffer_len ){
NR_BCCH_BCH_Message_t *bcch_message = NULL;
-
+
if (NR_UE_rrc_inst[module_id].mib != NULL)
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
@@ -564,7 +564,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
(void **)&bcch_message,
(const void *)bufferP,
buffer_len );
-
+
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
LOG_I(NR_RRC,"NR_BCCH_BCH decode error\n");
// free the memory
@@ -578,10 +578,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
//memcpy( (void *)mib,
// (void *)&bcch_message->message.choice.mib,
// sizeof(NR_MIB_t) );
-
+
nr_rrc_mac_config_req_ue( 0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
}
-
+
return 0;
}
@@ -1289,7 +1289,7 @@ nr_rrc_ue_process_masterCellGroup(
} else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config)
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig;
- else
+ else
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig;
}
LOG_I(RRC,"Sending CellGroupConfig to MAC\n");
@@ -1474,7 +1474,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
MessageDef *msg_p;
asn_dec_rval_t dec_rval = uper_decode( NULL,
- &asn_DEF_NR_DL_DCCH_Message,
+ &asn_DEF_NR_DL_DCCH_Message,
(void**)&nr_dl_dcch_msg,
(uint8_t *)bufferP,
buffer_len, 0, 0);
@@ -1489,7 +1489,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
}
if(nr_dl_dcch_msg != NULL){
- switch(nr_dl_dcch_msg->message.present){
+ switch(nr_dl_dcch_msg->message.present){
case NR_DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1->present){
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
@@ -1794,41 +1794,41 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
}
}
- //-----------------------------------------------------------------------------
- int32_t
- nr_rrc_ue_establish_srb1(
- module_id_t ue_mod_idP,
- frame_t frameP,
- uint8_t gNB_index,
- NR_SRB_ToAddMod_t *SRB_config
- )
- //-----------------------------------------------------------------------------
- {
- // add descriptor from RRC PDU
- NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1;
- NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
- NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1;
- LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index);
- return(0);
- }
+//-----------------------------------------------------------------------------
+int32_t
+nr_rrc_ue_establish_srb1(
+ module_id_t ue_mod_idP,
+ frame_t frameP,
+ uint8_t gNB_index,
+ NR_SRB_ToAddMod_t *SRB_config
+)
+//-----------------------------------------------------------------------------
+{
+ // add descriptor from RRC PDU
+ NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1;
+ NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG
+ NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1;
+ LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index);
+ return(0);
+}
- //-----------------------------------------------------------------------------
- int32_t
- nr_rrc_ue_establish_srb2(
- module_id_t ue_mod_idP,
- frame_t frameP,
- uint8_t gNB_index,
- NR_SRB_ToAddMod_t *SRB_config
- )
- //-----------------------------------------------------------------------------
- {
- // add descriptor from RRC PDU
- NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1;
- NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
- NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2;
- LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index);
- return(0);
- }
+//-----------------------------------------------------------------------------
+int32_t
+nr_rrc_ue_establish_srb2(
+ module_id_t ue_mod_idP,
+ frame_t frameP,
+ uint8_t gNB_index,
+ NR_SRB_ToAddMod_t *SRB_config
+)
+//-----------------------------------------------------------------------------
+{
+ // add descriptor from RRC PDU
+ NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1;
+ NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG
+ NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2;
+ LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index);
+ return(0);
+}
//-----------------------------------------------------------------------------
int32_t
@@ -2065,7 +2065,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
if (SRB_id == 1) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index],
- radioBearerConfig->srb_ToAddModList->list.array[cnt],
+ radioBearerConfig->srb_ToAddModList->list.array[cnt],
sizeof(NR_SRB_ToAddMod_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
diff --git a/openair2/UTIL/OTG/otg_defs.h b/openair2/UTIL/OTG/otg_defs.h
index 6c9944014f..af0260587f 100644
--- a/openair2/UTIL/OTG/otg_defs.h
+++ b/openair2/UTIL/OTG/otg_defs.h
@@ -34,13 +34,8 @@
# define __OTG_DEFS_H__
/* \brief To define the NUMBER_OF_eNB_MAX and MAX_MOBILES_PER_ENB */
-#if STANDALONE==1
- #include "openairinterface5g_limits.h"
-#else
- // impl_defs_top.h includes openairinterface5g_limits.h
- #include "PHY/impl_defs_top.h"
-#endif
-
+#include "openairinterface5g_limits.h"
+#include
#include "otg_config.h"
/**
diff --git a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
index c173d3b729..4bed349327 100644
--- a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
+++ b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
@@ -26,7 +26,7 @@
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
-#include "PagingIdentity.h"
+#include "NasPagingIdentity.h"
#include "Cli.h"
#include "SsCode.h"
#include "LcsIndicator.h"
diff --git a/openair3/NAS/COMMON/IES/NasPagingIdentity.h b/openair3/NAS/COMMON/IES/NasPagingIdentity.h
new file mode 100644
index 0000000000..3e03128006
--- /dev/null
+++ b/openair3/NAS/COMMON/IES/NasPagingIdentity.h
@@ -0,0 +1,43 @@
+/*
+ * 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
+#include
+#include
+
+#include "OctetString.h"
+
+#ifndef NASPAGING_IDENTITY_H_
+#define NASPAGING_IDENTITY_H_
+
+#define PAGING_IDENTITY_MINIMUM_LENGTH 2
+#define PAGING_IDENTITY_MAXIMUM_LENGTH 2
+
+typedef uint8_t PagingIdentity;
+
+int encode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len);
+
+void dump_paging_identity_xml(PagingIdentity *pagingidentity, uint8_t iei);
+
+int decode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len);
+
+#endif /* PAGING IDENTITY_H_ */
+
diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c
index 3a69d4c991..2758d01de3 100644
--- a/targets/ARCH/COMMON/common_lib.c
+++ b/targets/ARCH/COMMON/common_lib.c
@@ -40,7 +40,8 @@
#include "assertions.h"
#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h"
-#include "targets/RT/USER/lte-softmodem.h"
+//#include "targets/RT/USER/lte-softmodem.h"
+#include "executables/softmodem-common.h"
char *get_devname(int devtype) {
char *devnames[MAX_RF_DEV_TYPE]=DEVTYPE_NAMES;
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
index 2dfb4a7bf1..ee0dce48f0 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
@@ -45,7 +45,6 @@
#include "common_lib.h"
#include "ethernet_lib.h"
-#include "common/ran_context.h"
//#define DEBUG 1
@@ -414,7 +413,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
#endif
#elif defined(__arm__) || defined(__aarch64__)
- int nsamps2 = (payload_size>>4)+1
+ int nsamps2 = (payload_size>>4)+1;
int16x8_t temp_rx[nsamps2];
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
#else
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index 771ce37104..fd4a830a02 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -464,6 +464,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI
write_package[end].buff[i] = buff[i];
write_thread->count_write++;
write_thread->end = (write_thread->end + 1)% MAX_WRITE_THREAD_PACKAGE;
+ LOG_D(HW,"Signaling TX TS %llu\n",(unsigned long long)timestamp);
pthread_cond_signal(&write_thread->cond_write);
pthread_mutex_unlock(&write_thread->mutex_write);
return 0;
@@ -624,24 +625,48 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
- __m256i buff_tmp[2][nsamps2];
+ __m256i buff_tmp[4][nsamps2];
#else
nsamps2 = (nsamps+3)>>2;
- __m128i buff_tmp[2][nsamps2];
+ __m128i buff_tmp[4][nsamps2];
#endif
#elif defined(__arm__)
nsamps2 = (nsamps+3)>>2;
- int16x8_t buff_tmp[2][nsamps2];
+ int16x8_t buff_tmp[4][nsamps2];
#endif
- if (cc>1) {
+ int rxshift;
+ switch (device->type) {
+ case USRP_B200_DEV:
+ rxshift=4;
+ break;
+ case USRP_X300_DEV:
+ case USRP_N300_DEV:
+ rxshift=2;
+ break;
+ default:
+ AssertFatal(1==0,"Shouldn't be here\n");
+ }
+ if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector buff_ptrs;
- for (int i=0; irx_stream->recv(buff_ptrs, nsamps, s->rx_md);
- } else {
+ while (samples_received != nsamps) {
+ for (int i=0; irx_stream->recv(buff_ptrs,nsamps-samples_received, s->rx_md);
+
+
+ if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
+ break;
+
+ if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) {
+ printf("sleep...\n"); //usleep(100);
+ }
+ }
+ if (samples_received == nsamps) s->wait_for_first_pps=0;
+ } else {
// receive a single channel (e.g. from connector RF A)
samples_received=0;
@@ -667,17 +692,17 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
// FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if ((((uintptr_t) buff[i])&0x1F)==0) {
- ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
+ ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],rxshift);
} else {
- ((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j],4);
- ((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j+1],4);
+ ((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j],rxshift);
+ ((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j+1],rxshift);
}
#else
- ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
+ ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],rxshift);
#endif
#elif defined(__arm__)
- ((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
+ ((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],rxshift);
#endif
}
}
@@ -1288,10 +1313,12 @@ extern "C" {
LOG_I(HW,"rx_max_num_samps %zu\n",
s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps());
-
- for (int i = 0; irx_stream = s->usrp->get_rx_stream(stream_args_rx);
uhd::stream_args_t stream_args_tx("sc16", "sc16");
diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c
index f80f77f39c..3bd4285cff 100644
--- a/targets/ARCH/rfsimulator/simulator.c
+++ b/targets/ARCH/rfsimulator/simulator.c
@@ -61,10 +61,7 @@
#define MAX_SIMULATION_CONNECTED_NODES 5
#define GENERATE_CHANNEL 10 //each frame in DL
-// Fixme: datamodel, external variables in .h files, ...
-#include
-extern RAN_CONTEXT_t RC;
//
#define RFSIMU_SECTION "rfsimulator"
diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h
index ad98a6091b..de1502112b 100644
--- a/targets/COMMON/openairinterface5g_limits.h
+++ b/targets/COMMON/openairinterface5g_limits.h
@@ -6,23 +6,39 @@
# define NUMBER_OF_gNB_MAX 1
# define NUMBER_OF_RU_MAX 2
# define NUMBER_OF_NR_RU_MAX 2
+# define NUMBER_OF_UCI_MAX 16
+# define NUMBER_OF_ULSCH_MAX 8
+# define NUMBER_OF_DLSCH_MAX 8
+# define NUMBER_OF_SRS_MAX 16
+# define NUMBER_OF_NR_ULSCH_MAX 8
+# define NUMBER_OF_NR_DLSCH_MAX 8
+# define NUMBER_OF_NR_UCI_MAX 16
+# define nUMBER_OF_NR_SRS_MAX 16
+# define NUMBER_OF_SCH_STATS_MAX 16
+
+# define NUMBER_OF_NR_SCH_STATS_MAX 16
+
+# define NUMBER_OF_NR_PUCCH_MAX 16
+# define NUMBER_OF_NR_SR_MAX 16
+# define NUMBER_OF_NR_PDCCH_MAX 16
+
+#define MAX_MANAGED_ENB_PER_MOBILE 2
+#define MAX_MANAGED_GNB_PER_MOBILE 2
+
# ifndef PHYSIM
# ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 4
# define NUMBER_OF_NR_UE_MAX 4
-# define NUMBER_OF_UCI_VARS_MAX 14
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# define NUMBER_OF_CONNECTED_gNB_MAX 1
# else
# define NUMBER_OF_UE_MAX 256
-# define NUMBER_OF_UCI_VARS_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# define NUMBER_OF_CONNECTED_gNB_MAX 1
# endif
# else
# define NUMBER_OF_UE_MAX 4
# define NUMBER_OF_NR_UE_MAX 4
-# define NUMBER_OF_UCI_VARS_MAX 56
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# define NUMBER_OF_CONNECTED_gNB_MAX 1
# endif
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
index e7824186bb..29e226d293 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
@@ -33,7 +33,7 @@ gNBs =
# downlinkConfigCommon
#frequencyInfoDL
- # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
+ # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP), points to Subcarrier 0 of RB#10 of SSB block
absoluteFrequencySSB = 641032;
dl_frequencyBand = 78;
# this is 3600 MHz
@@ -46,13 +46,13 @@ gNBs =
dl_carrierBandwidth = 106;
#initialDownlinkBWP
#genericParameters
- # this is RBstart=41,L=24 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 6368;
+ # this is RBstart=33 (Start RB of SSB block),L=24 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 6358; #6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
- initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPcontrolResourceSetZero = 0; #12;
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
@@ -76,7 +76,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 6368;
+ initialULBWPlocationAndBandwidth = 6358;#6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
index 62c73523d6..791b50748f 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
@@ -33,7 +33,7 @@ gNBs =
# downlinkConfigCommon
#frequencyInfoDL
- # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
+ # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP). points to Subcarrier 0 of RB#10 of SSB block
absoluteFrequencySSB = 641032;
dl_frequencyBand = 78;
# this is 3600 MHz
@@ -46,13 +46,13 @@ gNBs =
dl_carrierBandwidth = 106;
#initialDownlinkBWP
#genericParameters
- # this is RBstart=0,L=50 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 6368;
+ # this is RBstart=33 (Start RB of SSB block),L=24 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 6358; #6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
- initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPcontrolResourceSetZero = 0;
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
@@ -77,7 +77,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 6368;
+ initialULBWPlocationAndBandwidth = 6358; #6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf
index 57be93b34b..9f3292c8a1 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf
@@ -33,7 +33,7 @@ gNBs =
# downlinkConfigCommon
#frequencyInfoDL
- # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
+ # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP). Points to Subcarrier 0 of RB#10 of SSB block
absoluteFrequencySSB = 642016;#642364;
dl_frequencyBand = 78;
# this is 3600 MHz
@@ -46,13 +46,13 @@ gNBs =
dl_carrierBandwidth = 217;
#initialDownlinkBWP
#genericParameters
- # this is RBstart=84,L=50 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 13559;
+ # this is RBstart=74 (Start RB of SSB block),L=50 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
- initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPcontrolResourceSetZero = 0;
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
@@ -76,7 +76,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 13559;
+ initialULBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -233,6 +233,7 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
}
);
@@ -275,7 +276,7 @@ log_config :
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
- phy_log_level ="debug";
+ phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf
index 536d1a9959..99ae7d21e3 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf
@@ -46,13 +46,13 @@ gNBs =
dl_carrierBandwidth = 217;
#initialDownlinkBWP
#genericParameters
- # this is RBstart=84,L=50 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 13559;
+ # this is RBstart=74,L=50 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
- initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPcontrolResourceSetZero = 0;
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
@@ -76,7 +76,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 13559;
+ initialULBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -217,6 +217,7 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
}
);
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf
index b785888658..d3e1310845 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf
@@ -46,13 +46,13 @@ gNBs =
dl_carrierBandwidth = 273;
#initialDownlinkBWP
#genericParameters
- # this is RBstart=84,L=50 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 13559;
+ # this is RBstart=74,L=50 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
- initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPcontrolResourceSetZero = 0;
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
@@ -76,7 +76,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 13559;
+ initialULBWPlocationAndBandwidth = 13549;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -217,6 +217,7 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
}
);
diff --git a/targets/RT/USER/eNB_usrp.gtkw b/targets/RT/USER/eNB_usrp.gtkw
index 074e3b1324..8f3aeaac62 100644
--- a/targets/RT/USER/eNB_usrp.gtkw
+++ b/targets/RT/USER/eNB_usrp.gtkw
@@ -1,13 +1,13 @@
[*]
[*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
-[*] Sun May 19 21:39:57 2019
+[*] Tue Jan 26 21:45:57 2021
[*]
-[dumpfile] "/tmp/openair_dump_eNB.vcd"
-[dumpfile_mtime] "Sun May 19 21:30:25 2019"
-[dumpfile_size] 11590554
-[savefile] "/home/sphex/raymond/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
-[timestart] 7629910000
-[size] 1840 795
+[dumpfile] "/home/eurecom/raymond/gtkw/openair_dump_eNB.vcd"
+[dumpfile_mtime] "Tue Jan 26 21:26:33 2021"
+[dumpfile_size] 180869253
+[savefile] "/home/eurecom/raymond/openairinterface5g_2/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
+[timestart] 11468800000
+[size] 1693 785
[pos] -1 -1
*-21.832302 7639830000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 386
@@ -16,17 +16,22 @@
[sst_vpaned_height] 303
@28
functions.trx_read
+@29
+functions.trx_write_thread
+@28
functions.trx_write
@24
variables.trx_ts[63:0]
variables.trx_tst[63:0]
+variables.trx_write_flags[63:0]
@28
functions.eNB_thread_rxtx0
+@420
+variables.l1_proc_tx_ic[63:0]
+variables.l1_proc_ic[63:0]
@24
variables.frame_number_RX0_RU[63:0]
-@25
variables.tti_number_RX0_RU[63:0]
-@24
variables.frame_number_TX0_RU[63:0]
variables.tti_number_TX0_RU[63:0]
@28
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index 5316705809..31c142c8da 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -70,6 +70,7 @@
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "PHY/LTE_TRANSPORT/if5_tools.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/phy_extern.h"
@@ -96,6 +97,9 @@
#include "T.h"
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
//#define DEBUG_THREADS 1
//#define USRP_DEBUG 1
@@ -261,7 +265,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id;
- eNB->if_inst->UL_indication(&eNB->UL_INFO, proc);
+ eNB->if_inst->UL_indication(&eNB->UL_INFO, (void*)proc);
AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret);
/* this conflict resolution may be totally wrong, to be tested */
/* CONFLICT RESOLUTION: BEGIN */
@@ -323,7 +327,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
static void *L1_thread_tx(void *param) {
L1_proc_t *eNB_proc = (L1_proc_t *)param;
L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx;
- PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
+ PHY_VARS_eNB *eNB = eNB_proc->eNB;
char thread_name[100];
sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1);
thread_top_init(thread_name,1,470000,500000,500000);
@@ -331,6 +335,7 @@ static void *L1_thread_tx(void *param) {
//wait_sync("tx_thread");
+ proc->respEncode = eNB->proc.L1_proc.respEncode;
while (!oai_exit) {
LOG_D(PHY,"Waiting for TX (IC %d)\n",proc->instance_cnt);
@@ -351,21 +356,19 @@ static void *L1_thread_tx(void *param) {
LOG_D(PHY,"L1 TX processing %d.%d\n",proc->frame_tx,proc->subframe_tx);
phy_procedures_eNB_TX(eNB, proc, 1);
AssertFatal((ret= pthread_mutex_lock( &proc->mutex ))==0,"error locking L1_proc_tx mutex, return %d\n",ret);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,proc->instance_cnt);
int subframe_tx = proc->subframe_tx;
int frame_tx = proc->frame_tx;
uint64_t timestamp_tx = proc->timestamp_tx;
proc->instance_cnt = -1;
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,proc->instance_cnt);
LOG_D(PHY,"L1 TX signaling done for %d.%d\n",proc->frame_tx,proc->subframe_tx);
// the thread can now be woken up
LOG_D(PHY,"L1_thread_tx: signaling completion in %d.%d\n",proc->frame_tx,proc->subframe_tx);
- if (pthread_cond_signal(&proc->cond) != 0) {
- LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
- exit_fun( "ERROR pthread_cond_signal" );
- }
-
+ AssertFatal((ret=pthread_cond_signal(&proc->cond))== 0, "ERROR pthread_cond_signal for eNB TXnp4 thread ret %d\n",ret);
AssertFatal((ret= pthread_mutex_unlock( &proc->mutex ))==0,"error unlocking L1_proc_tx mutex, return %d\n",ret);
+
+
wakeup_txfh(eNB,proc,frame_tx,subframe_tx,timestamp_tx);
}
@@ -391,6 +394,8 @@ static void *L1_thread( void *param ) {
}
PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
+
+
char thread_name[100];
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
@@ -402,7 +407,7 @@ static void *L1_thread( void *param ) {
LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid));
while (!oai_exit) {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0, 0 );
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
LOG_D(PHY,"L1RX waiting for RU RX\n");
@@ -410,7 +415,7 @@ static void *L1_thread( void *param ) {
LOG_D(PHY,"L1RX starting in %d.%d\n",proc->frame_rx,proc->subframe_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu());
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0, 1 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx);
@@ -424,6 +429,8 @@ static void *L1_thread( void *param ) {
LOG_D(PHY,"L1 RX %d.%d done\n",proc->frame_rx,proc->subframe_rx);
+ if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break;
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_IC, proc->instance_cnt);
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB,proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx,proc->timestamp_tx);
else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) {
@@ -432,9 +439,7 @@ static void *L1_thread( void *param ) {
}
}
- if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break;
} // while !oai_exit
-
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n");
eNB_thread_rxtx_status = 0;
@@ -530,6 +535,7 @@ int wakeup_txfh(PHY_VARS_eNB *eNB,
AssertFatal(pthread_cond_signal(&ru_proc->cond_eNBs) == 0,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
AssertFatal((ret=pthread_mutex_unlock(&ru_proc->mutex_eNBs))==0,"mutex_unlock returned %d\n",ret);
+
}
return(0);
@@ -542,19 +548,19 @@ int wakeup_tx(PHY_VARS_eNB *eNB,
int frame_tx,
int subframe_tx,
uint64_t timestamp_tx) {
- L1_rxtx_proc_t *L1_proc = &eNB->proc.L1_proc;
L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx;
int ret;
LOG_D(PHY,"ENTERED wakeup_tx (IC %d)\n",L1_proc_tx->instance_cnt);
+ // check if subframe is a has TX else return
+ if (subframe_select(&eNB->frame_parms,subframe_tx) == SF_UL) return 0;
AssertFatal((ret = pthread_mutex_lock(&L1_proc_tx->mutex))==0,"mutex_lock returns %d\n",ret);
- LOG_D(PHY,"L1 RX %d.%d Waiting to wake up L1 TX %d.%d (IC L1TX %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->frame_tx,L1_proc->subframe_tx,L1_proc_tx->instance_cnt);
+ LOG_D(PHY,"L1 RX %d.%d Waiting to wake up L1 TX %d.%d (IC L1TX %d)\n",frame_rx,subframe_rx,frame_tx,subframe_tx,L1_proc_tx->instance_cnt);
while(L1_proc_tx->instance_cnt == 0) {
pthread_cond_wait(&L1_proc_tx->cond,&L1_proc_tx->mutex);
}
LOG_D(PHY,"L1 RX Got signal that TX %d.%d is done\n",L1_proc_tx->frame_tx,L1_proc_tx->subframe_tx);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,L1_proc_tx->instance_cnt);
L1_proc_tx->instance_cnt = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,L1_proc_tx->instance_cnt);
L1_proc_tx->subframe_rx = subframe_rx;
@@ -563,9 +569,11 @@ int wakeup_tx(PHY_VARS_eNB *eNB,
L1_proc_tx->frame_tx = frame_tx;
L1_proc_tx->timestamp_tx = timestamp_tx;
// the thread can now be woken up
- LOG_D(PHY,"L1 RX Waking up L1 TX %d.%d\n",L1_proc->frame_tx,L1_proc->subframe_tx);
+ LOG_D(PHY,"L1 RX Waking up L1 TX %d.%d\n",frame_tx,subframe_tx);
+
AssertFatal(pthread_cond_signal(&L1_proc_tx->cond) == 0, "ERROR pthread_cond_signal for eNB L1 thread tx\n");
AssertFatal((ret=pthread_mutex_unlock(&L1_proc_tx->mutex))==0,"mutex_unlock returns %d\n",ret);
+
return(0);
}
@@ -585,10 +593,16 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,
if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe
AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret);
LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx);
+/* AssertFatal(1==0,"L1_thread isn't ready in %d.%d (L1RX %d.%d), aborting RX, exiting\n",
+ ru_proc->frame_rx,ru_proc->tti_rx,L1_proc->frame_rx,L1_proc->subframe_rx);
+*/
return(0);
+
}
++L1_proc->instance_cnt;
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_IC, L1_proc->instance_cnt);
+
// We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
// transmitted timestamp of the next TX slot (first).
@@ -606,14 +620,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->subframe_tx);
- // the thread can now be woken up
- if (pthread_cond_signal(&L1_proc->cond) != 0) {
- LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
- exit_fun( "ERROR pthread_cond_signal" );
- return(-1);
- }
+ // the thread can now be woken up
+ AssertFatal((ret=pthread_cond_signal(&L1_proc->cond))== 0, "ERROR pthread_cond_signal for eNB RXn-TXnp4 thread, ret %d\n",ret);
AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret);
+
+
return(0);
}
@@ -837,6 +849,21 @@ static void *process_stats_thread(void *param) {
return(NULL);
}
+void *L1_stats_thread(void *param) {
+ PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param;
+ wait_sync("L1_stats_thread");
+ FILE *fd;
+ while (!oai_exit) {
+ sleep(1);
+ fd=fopen("L1_stats.log","w");
+ AssertFatal(fd!=NULL,"Cannot open L1_stats.log\n");
+ dump_I0_stats(fd,eNB);
+ dump_ulsch_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
+ dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
+ fclose(fd);
+ }
+ return(NULL);
+}
void init_eNB_proc(int inst) {
/*int i=0;*/
@@ -858,6 +885,7 @@ void init_eNB_proc(int inst) {
L1_proc_tx->instance_cnt = -1;
L1_proc->instance_cnt_RUs = 0;
L1_proc_tx->instance_cnt_RUs = 0;
+ proc->eNB = eNB;
proc->instance_cnt_prach = -1;
proc->instance_cnt_asynch_rxtx = -1;
proc->instance_cnt_synch = -1;
@@ -930,6 +958,7 @@ void init_eNB_proc(int inst) {
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
+ pthread_create(&proc->L1_stats_thread,NULL,L1_stats_thread,(void*)eNB);
}
//for multiple CCs: setup master and slaves
@@ -1060,60 +1089,47 @@ void print_opp_meas(void) {
void free_transport(PHY_VARS_eNB *eNB) {
- for (int i=0; idlsch[i][j]);
-
- LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
- free_eNB_ulsch(eNB->ulsch[1+i]);
}
-
- free_eNB_ulsch(eNB->ulsch[0]);
+ for (int i=0;iulsch[i]);
+ }
}
void init_transport(PHY_VARS_eNB *eNB) {
- int i;
- int j;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
LOG_I(PHY, "Initialise transport\n");
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
- for (i=0; idlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp);
-
+ LOG_I(PHY,"eNB->dlsch[%d][%d] %p\n",i,j,eNB->dlsch[i][j]);
if (!eNB->dlsch[i][j]) {
- LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
+ LOG_E(PHY,"Can't get eNB dlsch structures for DLSCH %d \n", i);
exit(-1);
} else {
eNB->dlsch[i][j]->rnti=0;
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
}
}
+ }
+ for (int i=0;iulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
+ LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,NUMBER_OF_ULSCH_MAX);
+ eNB->ulsch[i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
- if (!eNB->ulsch[1+i]) {
+ if (!eNB->ulsch[i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
-
- // this is the transmission mode for the signalling channels
- // this will be overwritten with the real transmission mode by the RRC once the UE is connected
- eNB->transmission_mode[i] = fp->nb_antenna_ports_eNB==1 ? 1 : 2;
- }
-
- // ULSCH for RA
- eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, fp->N_RB_UL, 0);
-
- if (!eNB->ulsch[0]) {
- LOG_E(PHY,"Can't get eNB ulsch structures\n");
- exit(-1);
}
eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
@@ -1126,7 +1142,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
eNB->rx_total_gain_dB=130;
- for(i=0; imu_mimo_mode[i].dl_pow_off = 2;
eNB->check_for_total_transmissions = 0;
@@ -1134,11 +1150,13 @@ void init_transport(PHY_VARS_eNB *eNB) {
eNB->FULL_MUMIMO_transmissions = 0;
eNB->check_for_SUMIMO_transmissions = 0;
fp->pucch_config_common.deltaPUCCH_Shift = 1;
+ if (eNB->use_DTX == 0) fill_subframe_mask(eNB);
+
}
void init_eNB_afterRU(void) {
- int inst,CC_id,ru_id,i,aa;
+ int inst,CC_id,i;
PHY_VARS_eNB *eNB;
LOG_I(PHY,"%s() RC.nb_inst:%d\n", __FUNCTION__, RC.nb_inst);
@@ -1148,13 +1166,14 @@ void init_eNB_afterRU(void) {
for (CC_id=0; CC_idnum_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id);
-
+ // map antennas and PRACH signals to eNB RX
LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id);
eNB->frame_parms.nb_antennas_rx = 0;
+ LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU);
+ if (NFAPI_MODE==NFAPI_MODE_PNF) AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id);
+ for (int ru_id=0; ru_idnum_RU; ru_id++)
+ eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx;
+ phy_init_lte_eNB(eNB,0,0);
LOG_I(PHY,"Overwriting eNB->prach_vars.rxsigF[0]:%p\n", eNB->prach_vars.rxsigF[0]);
eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *));
@@ -1163,10 +1182,8 @@ void init_eNB_afterRU(void) {
eNB->prach_vars_br.rxsigF[ce_level] = (int16_t **)malloc16(64*sizeof(int16_t *));
}
- LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU);
- for (ru_id=0,aa=0; ru_idnum_RU; ru_id++) {
- eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx;
+ for (int ru_id=0,aa=0; ru_idnum_RU; ru_id++) {
AssertFatal(eNB->RU_list[ru_id]->common.rxdataF!=NULL,
"RU %d : common.rxdataF is NULL\n",
@@ -1214,7 +1231,7 @@ void init_eNB_afterRU(void) {
init_eNB_proc(inst);
}
- for (ru_id=0; ru_idwakeup_rxtx = wakeup_rxtx;
RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB;
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 4682c5989e..86d3a88781 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -51,7 +51,6 @@
#include "assertions.h"
#include "msc.h"
#include "PHY/defs_common.h"
-#include "PHY/phy_extern.h"
#include "PHY/types.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
@@ -59,23 +58,11 @@
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "PHY/LTE_TRANSPORT/if5_tools.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
-#include "PHY_INTERFACE/phy_interface.h"
-#include "LAYER2/MAC/mac.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "LAYER2/MAC/mac_proto.h"
-#include "RRC/LTE/rrc_extern.h"
-#include "SCHED/sched_eNB.h"
-#include "UTIL/OPT/opt.h"
-#include "UTIL/OTG/otg_tx.h"
-#include "UTIL/OTG/otg_externs.h"
-#include "UTIL/MATH/oml.h"
+#include "SCHED/sched_common.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
-#include "nfapi/oai_integration/vendor_ext.h"
-#include "enb_config.h"
#include "targets/ARCH/COMMON/common_lib.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
-#include "targets/RT/USER/lte-softmodem.h"
//#include "PHY/TOOLS/time_meas.h"
/* these variables have to be defined before including ENB_APP/enb_paramdef.h */
@@ -86,29 +73,25 @@ static int DEFBFW[] = {0x00007fff};
#include "ENB_APP/enb_paramdef.h"
#include "common/config/config_userapi.h"
-#ifndef OPENAIR2
- #include "UTIL/OTG/otg_extern.h"
-#endif
-
-#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "T.h"
-#include "pdcp.h"
+#include "executables/softmodem-common.h"
#define MBMS_EXPERIMENTAL
extern volatile int oai_exit;
-extern int emulate_rf;
-extern int numerology;
extern clock_source_t clock_source;
#include "executables/thread-common.h"
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
extern void phy_init_RU(RU_t *);
-void stop_RU(int nb_ru);
+void prach_procedures(PHY_VARS_eNB *eNB,int br_flag);
+
+void stop_RU(RU_t **rup,int nb_ru);
+
void do_ru_synch(RU_t *ru);
void configure_ru(int idx,
@@ -124,13 +107,24 @@ 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 uint16_t sf_ahead;
+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"
+#include "openair2/LAYER2/MAC/mac_extern.h"
extern uint8_t dlsch_ue_select_tbl_in_use;
void init_ru_vnf(void);
+ extern RAN_CONTEXT_t RC;
#endif
+RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond);
/*************************************************************/
/* Functions to attach and configure RRU */
@@ -141,7 +135,7 @@ extern uint16_t sf_ahead;
// southbound IF5 fronthaul for 16-bit OAI format
static inline void fh_if5_south_out(RU_t *ru,int frame, int subframe, uint64_t timestamp) {
- if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
+ if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
ru->south_out_cnt++;
@@ -149,14 +143,12 @@ static inline void fh_if5_south_out(RU_t *ru,int frame, int subframe, uint64_t t
}
-
-
// southbound IF4p5 fronthaul
static inline void fh_if4p5_south_out(RU_t *ru,
int frame,
int subframe,
uint64_t timestamp) {
- if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
+ if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
LOG_D(PHY,"ENTERED fh_if4p5_south_out Sending IF4p5 for frame %d subframe %d ru %d\n",ru->proc.frame_tx,ru->proc.tti_tx,ru->idx);
@@ -166,7 +158,7 @@ static inline void fh_if4p5_south_out(RU_t *ru,
LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt);
}
- /*if (ru == RC.ru[0] || ru == RC.ru[1]) {
+ /*if (ru->idx == 0 || ru->idx == ru) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU+ru->idx, ru->proc.frame_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU+ru->idx, ru->proc.subframe_tx );
}*/
@@ -227,31 +219,30 @@ void fh_if4p5_south_in(RU_t *ru,
symbol_mask_full = (1<symbols_per_tti)-1;
LOG_D(PHY,"fh_if4p5_south_in: RU %d, frame %d, subframe %d, ru %d, mask %x\n",ru->idx,*frame,*subframe,ru->idx,proc->symbol_mask[*subframe]);
- AssertFatal(proc->symbol_mask[*subframe]==0 || proc->symbol_mask[*subframe]==symbol_mask_full,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]);
+ //AssertFatal(proc->symbol_mask[*subframe]==0 || proc->symbol_mask[*subframe]>=symbol_mask_full,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]); // >= because PULTICK for S-subframe could have been received during normal subframe
- if (proc->symbol_mask[*subframe]==0) { // this is normal case, if not true then we received a PULTICK before the previous subframe was finished
+ if (proc->symbol_mask[*subframe]idx,*frame,*subframe,f,sf);
+ LOG_D(PHY,"fh_if4p5_south_in (%s/%d): RU %d, frame %d, subframe %d, f %d, sf %d, symbol %d\n",packet_type == IF4p5_PULFFT ? "PULFFT" : "PULTICK",packet_type,ru->idx,*frame,*subframe,f,sf,symbol_number);
if (oai_exit == 1 || ru->cmd== STOP_RU) break;
if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<symbol_mask[sf] = symbol_mask_full;
+ proc->symbol_mask[sf] = 0xffff;
pultick_received++;
-
/*
if ((proc->first_rx==0) && (f!=*frame)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received frame %d != expected %d (RU %d) \n",f,*frame, ru->idx);
else if ((proc->first_rx==0) && (sf!=*subframe)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received subframe %d != expected %d (first_rx %d)\n",sf,*subframe,proc->first_rx);
else break; */
- if (f==*frame || sf==*subframe) break;
+ //if (f==*frame || sf==*subframe) break;
} else if (packet_type == IF4p5_PRACH) {
// nothing in RU for RAU
}
- LOG_D(PHY,"rx_fh_if4p5 for RU %d: subframe %d, sf %d, symbol mask %x\n",ru->idx,*subframe,sf,proc->symbol_mask[sf]);
- } while(proc->symbol_mask[sf] != symbol_mask_full);
+ LOG_D(PHY,"rx_fh_if4p5 for RU %d: subframe %d, sf %d, symbol %d, symbol mask %x\n",ru->idx,*subframe,sf,symbol_number,proc->symbol_mask[sf]);
+ } while(proc->symbol_mask[*subframe] < symbol_mask_full);
} else {
f = *frame;
sf = *subframe;
@@ -263,7 +254,7 @@ void fh_if4p5_south_in(RU_t *ru,
proc->timestamp_rx = ((proc->frame_rx * 10) + proc->tti_rx ) * fp->samples_per_tti ;
// proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
- if (get_nprocs()<=4) {
+ if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) {
proc->tti_tx = (sf+sf_ahead)%10;
proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f;
}
@@ -291,7 +282,7 @@ void fh_if4p5_south_in(RU_t *ru,
*subframe = proc->tti_rx;
}
- /*if (ru == RC.ru[0] || ru == RC.ru[1]) {
+ /*if (ru->idx == 0 || ru->idx == 1) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU+ru->idx, f );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU+ru->idx, sf );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, f );
@@ -399,7 +390,7 @@ void fh_if4p5_north_in(RU_t *ru,
ru->north_in_cnt++;
// dump VCD output for first RU in list
- if (ru == RC.ru[0]) {
+ if (ru->idx == 0) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, *frame );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, *subframe );
}
@@ -491,7 +482,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,
LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,tti_tx);
// dump VCD output for first RU in list
- if (ru == RC.ru[0]) {
+ if (ru->idx == 0) {
/*VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx );*/
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, frame_tx);
@@ -557,8 +548,8 @@ volatile late_control_e late_control=STATE_BURST_NORMAL;
static void *emulatedRF_thread(void *param) {
RU_proc_t *proc = (RU_proc_t *) param;
int microsec = 500; // length of time to sleep, in miliseconds
+ int numerology = 0 ;
struct timespec req = {0};
- int numerology = get_softmodem_params()->numerology;
req.tv_sec = 0;
req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2;
cpu_set_t cpuset;
@@ -609,7 +600,7 @@ void rx_rf(RU_t *ru,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
old_ts = proc->timestamp_rx;
- if(get_softmodem_params()->emulate_rf) {
+ if(ru->emulate_rf) {
wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
rxs = fp->samples_per_tti;
@@ -662,7 +653,7 @@ void rx_rf(RU_t *ru,
proc->tti_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
// synchronize first reception to frame 0 subframe 0
- if (ru->fh_north_asynch_in == NULL) {
+ if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD && ru->fh_north_asynch_in == NULL) {
#ifdef PHY_TX_THREAD
proc->timestamp_phy_tx = proc->timestamp_rx+((sf_ahead-1)*fp->samples_per_tti);
proc->subframe_phy_tx = (proc->tti_rx+(sf_ahead-1))%10;
@@ -690,16 +681,12 @@ void rx_rf(RU_t *ru,
proc->frame_rx,
proc->tti_rx);
- // dump VCD output for first RU in list
- if (ru == RC.ru[0]) {
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, proc->frame_rx );
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX0_RU, proc->tti_rx );
+ }
- if (ru->fh_north_asynch_in == NULL) {
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx );
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx );
- }
- }
+ // dump VCD output for first RU in list
+ if (ru->idx == 0) {
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, proc->frame_rx );
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX0_RU, proc->tti_rx );
}
if (proc->first_rx == 0) {
@@ -790,6 +777,7 @@ void tx_rf(RU_t *ru,
/* add fail safe for late command */
if(late_control!=STATE_BURST_NORMAL) { //stop burst
+ LOG_E(PHY,"%d.%d late_control : %d\n",frame,subframe,late_control);
switch (late_control) {
case STATE_BURST_TERMINATE:
flags=10; // end of burst and no time spec
@@ -818,12 +806,13 @@ void tx_rf(RU_t *ru,
break;
}
}
-
- /* add fail safe for late command end */
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, subframe);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS,flags);
+
+ /* add fail safe for late command end */
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
@@ -841,7 +830,7 @@ void tx_rf(RU_t *ru,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
// AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
- if( (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ) { /* add fail safe for late command */
+ if( usrp_tx_thread == 0 && (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ) { /* add fail safe for late command */
late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control);
}
@@ -954,7 +943,7 @@ void *ru_thread_prach( void *param ) {
thread_top_init("ru_thread_prach",1,500000,1000000,20000000);
//wait_sync("ru_thread_prach");
- while (RC.ru_mask>0 && ru->function!=eNodeB_3GPP) {
+ while (*ru->ru_mask>0 && ru->function!=eNodeB_3GPP) {
usleep(1e6);
LOG_D(PHY,"%s() RACH waiting for RU to be configured\n", __FUNCTION__);
}
@@ -1167,7 +1156,7 @@ void wakeup_L1s(RU_t *ru) {
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) {
//AssertFatal((proc->RU_mask&(1<Mod_id,ru->proc.frame_rx,ru->proc.tti_rx,ru->idx,eNB->num_RU,proc->RU_mask);
proc->RU_mask[ru->proc.tti_rx] |= (1<RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0) ) {
+ } else if (eNB->RU_list[i]->state == RU_SYNC ||(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] /*&& ru->is_slave==0*/) ) {
proc->RU_mask[ru->proc.tti_rx] |= (1<numerology;
if(fp->N_RB_DL == 100) {
- if(numerology == 0) {
+ if(ru->numerology == 0) {
if (fp->threequarter_fs) {
cfg->sample_rate=23.04e6;
cfg->samples_per_frame = 230400;
@@ -1319,12 +1308,12 @@ void fill_rf_config(RU_t *ru,
cfg->tx_bw = 10e6;
cfg->rx_bw = 10e6;
}
- } else if(numerology == 1) {
+ } else if(ru->numerology == 1) {
cfg->sample_rate=61.44e6;
cfg->samples_per_frame = 307200;
cfg->tx_bw = 20e6;
cfg->rx_bw = 20e6;
- } else if(numerology == 2) {
+ } else if(ru->numerology == 2) {
cfg->sample_rate=122.88e6;
cfg->samples_per_frame = 307200;
cfg->tx_bw = 40e6;
@@ -1523,36 +1512,43 @@ static void *ru_thread_tx( void *param ) {
LOG_D(PHY,"ru_thread_tx (ru %d): Waiting for TX processing\n",ru->idx);
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
- LOG_D(PHY,"ru_thread_tx: TX in %d.%d\n",ru->proc.frame_tx,ru->proc.tti_tx);
+ ret = pthread_mutex_lock(&proc->mutex_eNBs);
+ AssertFatal(ret == 0,"mutex_lock return %d\n",ret);
+ int frame_tx=proc->frame_tx;
+ int tti_tx =proc->tti_tx;
+ uint64_t timestamp_tx = proc->timestamp_tx;
+ ret = pthread_mutex_unlock(&proc->mutex_eNBs);
+ AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
+
if (oai_exit) break;
// do TX front-end processing if needed (precoding and/or IDFTs)
- if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx);
+ if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx);
// do OFDM if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx);
+ if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx);
- if(!(get_softmodem_params()->emulate_rf)) { //if(!emulate_rf){
+ if(!(ru->emulate_rf)) { //if(!emulate_rf){
// do outgoing fronthaul (south) if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx);
+ if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,tti_tx,timestamp_tx);
if (ru->fh_north_out) ru->fh_north_out(ru);
} else {
for (int i=0; inb_tx; i++) {
- if(proc->frame_tx == 2) {
- sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,proc->frame_tx,proc->tti_tx);
+ if(frame_tx == 2) {
+ sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,frame_tx,tti_tx);
LOG_M(filename,"txdataF_frame",ru->common.txdataF_BF[i],fp->symbols_per_tti*fp->ofdm_symbol_size, 1, 1);
}
- if(proc->frame_tx == 2 && proc->tti_tx==0) {
- sprintf(filename,"txdata%d_frame%d.m",i,proc->frame_tx);
+ if(frame_tx == 2 && tti_tx==0) {
+ sprintf(filename,"txdata%d_frame%d.m",i,frame_tx);
LOG_M(filename,"txdata_frame",ru->common.txdata[i],fp->samples_per_tti*10, 1, 1);
}
}
}
- LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", proc->frame_tx, proc->tti_tx);
+ LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", frame_tx, tti_tx);
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
for(int i = 0; inum_eNB; i++) {
@@ -1568,7 +1564,7 @@ static void *ru_thread_tx( void *param ) {
eNB->Mod_id,eNB_proc->frame_rx,eNB_proc->subframe_rx,ru->idx,eNB->num_RU,eNB_proc->RU_mask_tx);
eNB_proc->RU_mask_tx |= (1<RU_list[j]->state==RU_SYNC ||*/ (eNB->RU_list[j]->is_slave==1 && eNB->RU_list[j]->wait_cnt>0 && ru!=eNB->RU_list[j] && ru->is_slave==0)) {
+ } else if (eNB->RU_list[j]->state==RU_SYNC ||(eNB->RU_list[j]->is_slave==1 && eNB->RU_list[j]->wait_cnt>0 && ru!=eNB->RU_list[j])) {
eNB_proc->RU_mask_tx |= (1<mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
AssertFatal((ret=pthread_mutex_lock( &L1_proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret);
L1_proc->instance_cnt_RUs = 0;
- LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", proc->frame_tx, proc->tti_tx);
+ LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", frame_tx, tti_tx);
// the thread can now be woken up
LOG_D(PHY,"ru_thread_tx: clearing mask and Waking up L1 thread\n");
@@ -1637,10 +1633,10 @@ static void *ru_thread( void *param ) {
}
LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
- AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret);
- RC.ru_mask &= ~(1<idx);
- pthread_cond_signal(&RC.ru_cond);
- AssertFatal((ret=pthread_mutex_unlock(&RC.ru_mutex))==0,"mutex_unlock returns %d\n",ret);
+ AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret);
+ *ru->ru_mask &= ~(1<idx);
+ pthread_cond_signal(ru->ru_cond);
+ AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret);
ru->state = RU_RUN;
} else if (ru->has_ctrl_prt == 0) {
// There is no control port: start everything here
@@ -1660,10 +1656,10 @@ static void *ru_thread( void *param ) {
exit(-1);
}
- AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret);
- RC.ru_mask &= ~(1<