Commit f26373c5 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge remote-tracking branch 'origin/develop-nr_cppcheck' into integration_develop-nr_2019w42

Conflicts:
	executables/nr-gnb.c
	openair1/PHY/NR_REFSIG/nr_dmrs_rx.c
	openair1/SIMULATION/NR_PHY/ulsim.c
parents da13ff9c 08eda57a
......@@ -57,6 +57,9 @@ pipeline {
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
def allParametersPresent = true
if (env.TESTPLATFORM_OWNER) {
echo "Platform is ${env.TESTPLATFORM_OWNER}"
}
if (params.RedHatRemoteServer == null) {
allParametersPresent = false
......
......@@ -44,7 +44,7 @@ function build_on_vm {
STATUS=1
return
fi
if [ ! -f /etc/apt/apt.conf.d/01proxy ]
if [[ ! -f /etc/apt/apt.conf.d/01proxy ]] && [[ "$OPTIONAL_APTCACHER" != "true" ]]
then
echo "Missing /etc/apt/apt.conf.d/01proxy file!"
echo "Is apt-cacher installed and configured?"
......@@ -96,12 +96,12 @@ function build_on_vm {
else
scp -o StrictHostKeyChecking=no $JENKINS_WKSP/localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu
fi
scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu
[ -f /etc/apt/apt.conf.d/01proxy ] && scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu
echo "############################################################"
echo "Running install and build script on VM ($VM_NAME)"
echo "############################################################"
echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
echo "[ -f 01proxy ] && sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS
echo "git config --global https.postBuffer 123289600" >> $VM_CMDS
if [[ "$VM_NAME" == *"-cppcheck"* ]]
......
......@@ -233,6 +233,7 @@ eNBs =
#pdsch_maxNumRepetitionCEmodeB_r13 = "r384"; # NULL - 2
pusch_maxNumRepetitionCEmodeA_r13 = "r8"; #0
pusch_repetitionLevelCEmodeA_r13 = "l1";
#pusch_maxNumRepetitionCEmodeB_r13 = "r768"; #4 #NULL
#pusch_HoppingOffset_v1310 = 5; #NULL
......
......@@ -542,8 +542,37 @@ class SSHConnection():
self.command('git config user.email "jenkins@openairinterface.org"', '\$', 5)
self.command('git config user.name "OAI Jenkins"', '\$', 5)
if self.clean_repository:
pass
self.command('ls *.txt', '\$', 5)
result = re.search('LAST_BUILD_INFO', str(self.ssh.before))
if result is not None:
mismatch = False
self.command('grep SRC_COMMIT LAST_BUILD_INFO.txt', '\$', 2)
result = re.search(self.ranCommitID, str(self.ssh.before))
if result is None:
mismatch = True
self.command('grep MERGED_W_TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2)
if (self.ranAllowMerge):
result = re.search('YES', str(self.ssh.before))
if result is None:
mismatch = True
self.command('grep TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2)
if self.ranTargetBranch == '':
result = re.search('develop', str(self.ssh.before))
else:
result = re.search(self.ranTargetBranch, str(self.ssh.before))
if result is None:
mismatch = True
else:
result = re.search('NO', str(self.ssh.before))
if result is None:
mismatch = True
if not mismatch:
self.close()
self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK)
return
self.command('echo ' + self.UEPassword + ' | sudo -S git clean -x -d -ff', '\$', 30)
# if the commit ID is provided use it to point to it
if self.ranCommitID != '':
self.command('git checkout -f ' + self.ranCommitID, '\$', 5)
......@@ -571,12 +600,23 @@ class SSHConnection():
self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
self.command('mv compile_oai_ue.log ' + 'build_log_' + self.testCase_id, '\$', 5)
self.close()
if buildStatus:
logging.info('\u001B[1m Building OAI ' + ue_prefix + 'UE Pass\u001B[0m')
# Generating a BUILD INFO file
self.command('echo "SRC_BRANCH: ' + self.ranBranch + '" > ../LAST_BUILD_INFO.txt', '\$', 2)
self.command('echo "SRC_COMMIT: ' + self.ranCommitID + '" >> ../LAST_BUILD_INFO.txt', '\$', 2)
if (self.ranAllowMerge):
self.command('echo "MERGED_W_TGT_BRANCH: YES" >> ../LAST_BUILD_INFO.txt', '\$', 2)
if self.ranTargetBranch == '':
self.command('echo "TGT_BRANCH: develop" >> ../LAST_BUILD_INFO.txt', '\$', 2)
else:
self.command('echo "TGT_BRANCH: ' + self.ranTargetBranch + '" >> ../LAST_BUILD_INFO.txt', '\$', 2)
else:
self.command('echo "MERGED_W_TGT_BRANCH: NO" >> ../LAST_BUILD_INFO.txt', '\$', 2)
self.close()
self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE')
else:
logging.error('\u001B[1m Building OAI ' + ue_prefix + 'UE Failed\u001B[0m')
self.close()
logging.error('\u001B[1m Building OAI UE Failed\u001B[0m')
self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'KO', ALL_PROCESSES_OK, 'OAI UE')
self.CreateHtmlTabFooter(False)
sys.exit(1)
......@@ -1138,7 +1178,7 @@ class SSHConnection():
html_queue = SimpleQueue()
self.checkDevTTYisUnlocked()
if attach_status:
html_cell = '<pre style="background-color:white">CAT-M module\nAttachment Completed in ' + str(attach_cnt+4) + ' seconds'
html_cell = '<pre style="background-color:white">CAT-M module Attachment Completed in ' + str(attach_cnt+4) + ' seconds'
if (nRSRQ is not None) and (nRSRP is not None):
html_cell += '\n RSRQ = ' + str(-20+(nRSRQ/2)) + ' dB'
html_cell += '\n RSRP = ' + str(-140+nRSRP) + ' dBm</pre>'
......@@ -1147,9 +1187,11 @@ class SSHConnection():
html_queue.put(html_cell)
self.CreateHtmlTestRowQueue('N/A', 'OK', 1, html_queue)
else:
html_cell = '<pre style="background-color:white">CAT-M module\nAttachment Failed</pre>'
logging.error('\u001B[1m CAT-M module Attachment Failed\u001B[0m')
html_cell = '<pre style="background-color:white">CAT-M module Attachment Failed</pre>'
html_queue.put(html_cell)
self.CreateHtmlTestRowQueue('N/A', 'KO', 1, html_queue)
self.AutoTerminateUEandeNB()
def PingCatM(self):
if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '':
......@@ -1160,7 +1202,7 @@ class SSHConnection():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.prematureExit = True
self.AutoTerminateUEandeNB()
return
try:
statusQueue = SimpleQueue()
......@@ -1179,6 +1221,8 @@ class SSHConnection():
if result is not None:
moduleIPAddr = result.group('ipaddr')
else:
self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB()
return
ping_time = re.findall("-c (\d+)",str(self.ping_args))
device_id = 'catm'
......@@ -2409,15 +2453,16 @@ class SSHConnection():
os.kill(os.getppid(),signal.SIGUSR1)
def IperfNoS1(self):
if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
Usage()
sys.exit('Insufficient Parameter')
check_eNB = True
check_OAI_UE = True
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
self.AutoTerminateUEandeNB()
if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
Usage()
sys.exit('Insufficient Parameter')
return
server_on_enb = re.search('-R', str(self.iperf_args))
if server_on_enb is not None:
iServerIPAddr = self.eNBIPAddress
......@@ -3447,6 +3492,11 @@ class SSHConnection():
self.ShowTestID()
self.eNB_instance = '0'
self.TerminateeNB()
if self.flexranCtrlInstalled and self.flexranCtrlStarted:
self.testCase_id = 'AUTO-KILL-flexran-ctl'
self.desc = 'Automatic Termination of FlexRan CTL'
self.ShowTestID()
self.TerminateFlexranCtrl()
self.prematureExit = True
def IdleSleep(self):
......@@ -4564,7 +4614,11 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
while cnt < SSH.repeatCounts[0] and SSH.prematureExit:
SSH.prematureExit = False
for test_case_id in todo_tests:
if SSH.prematureExit:
break
for test in all_tests:
if SSH.prematureExit:
break
id = test.get('id')
if test_case_id != id:
continue
......@@ -4645,10 +4699,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
SSH.Perform_X2_Handover()
else:
sys.exit('Invalid action')
if SSH.prematureExit:
break
if SSH.prematureExit:
break
cnt += 1
if cnt == SSH.repeatCounts[0] and SSH.prematureExit:
logging.debug('Testsuite failed ' + str(cnt) + ' time(s)')
......
......@@ -140,10 +140,25 @@ function command_options_usage {
echo ""
}
# function to set specific behavior depending on the TESTPLATFORM_OWNER variable
# which may be set by a jenkins server for exemple
function platform_set {
if [ "$TESTPLATFORM_OWNER" != "" ]
then
echo "Running on $TESTPLATFORM_OWNER platform"
if [ -x "/usr/local/bin/oai_${TESTPLATFORM_OWNER}_setenv.sh" ]
then
. /usr/local/bin/oai_${TESTPLATFORM_OWNER}_setenv.sh
fi
fi
}
function setvar_usage {
declare -A HELP_VAR
HELP_VAR["VM_OSREL"]="OS release to use in virtual machines"
HELP_VAR["RUN_EXPERIMENTAL"]="Enforce execution of variants with EXPERIMENTAL variable set to \"true\""
HELP_VAR["OPTIONAL_APTCACHER"]="build and Run tests will fail if apt-cacher not installed and this variable not set to \"true\""
HELP_VAR["TESTPLATFORM_OWNER"]="Allow pipeline customization via execution of an externel scripts residing on the jenkins server"
echo "--setvar_<varname> <value> where varname is one of:"
for i in ${AUTHORIZED_VAR[@]}; do printf "%20s : %s\n" "$i" "${HELP_VAR[$i]}" ;done
}
......@@ -177,7 +192,7 @@ function variant__v4__cppcheck {
VM_MEMORY=4096
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -I openair3/NAS/COMMON/UTIL -j4"
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -I openair3/NAS/COMMON/UTIL -j4"
}
function variant__v5__gnb_usrp {
......@@ -328,6 +343,7 @@ function check_setvar {
exit 1
}
platform_set
MY_DIR=$(dirname $(readlink -f $0))
. $MY_DIR/createVM.sh
. $MY_DIR/buildOnVM.sh
......@@ -337,6 +353,7 @@ MY_DIR=$(dirname $(readlink -f $0))
. $MY_DIR/reportBuildLocally.sh
. $MY_DIR/reportTestLocally.sh
if [ $# -lt 1 ]
then
echo "Syntax Error: too few arguments"
......@@ -454,7 +471,7 @@ RUN_OPTIONS="none"
# list of variables that can be set via the --setvar option
AUTHORIZED_VAR=("VM_OSREL RUN_EXPERIMENTAL")
AUTHORIZED_VAR=("VM_OSREL RUN_EXPERIMENTAL OPTIONAL_APTCACHER TESTPLATFORM_OWNER")
#variables to set which OS VM should use
......
......@@ -476,7 +476,7 @@ function install_epc_on_vm {
local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME`
echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR"
scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
[ -f /etc/apt/apt.conf.d/01proxy ] && scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
# ltebox specific actions (install and start)
LTE_BOX_TO_INSTALL=1
......@@ -500,7 +500,7 @@ function install_epc_on_vm {
echo "############################################################"
echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)"
echo "############################################################"
echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
echo "sudo [ -f 01proxy ] && cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS
echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS
echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
......
......@@ -25,10 +25,23 @@
<htmlTabName>EPC-Start</htmlTabName>
<htmlTabIcon>log-in</htmlTabIcon>
<TestCaseRequestedList>
010101 090101
050101 060101 070101
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="010101">
<class>Build_eNB</class>
<desc>Build eNB (USRP)</desc>
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
</testCase>
<testCase id="090101">
<class>Build_OAI_UE</class>
<desc>Build OAI UE</desc>
<Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args>
</testCase>
<testCase id="050101">
<class>Initialize_HSS</class>
<desc>Initialize HSS</desc>
......
......@@ -24,7 +24,7 @@
<htmlTabRef>test-05-tm1-nos1-tunnel</htmlTabRef>
<htmlTabName>Test-05MHz-TM1-noS1-tunnel</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>2</repeatCount>
<repeatCount>4</repeatCount>
<TestCaseRequestedList>
030201 090109
030101 000001 090101 000002 040501 040502 000001 040601 040602 040641 040642 000001 090109 030201
......
......@@ -25,10 +25,16 @@
<htmlTabName>EPC-Closure</htmlTabName>
<htmlTabIcon>log-out</htmlTabIcon>
<TestCaseRequestedList>
040202
050201 060201 070201
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="040202">
<class>Terminate_CatM_module</class>
<desc>Terminate CAT-M Module</desc>
</testCase>
<testCase id="050201">
<class>Terminate_HSS</class>
<desc>Terminate HSS</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList>
030201 030202
050202
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -43,4 +44,9 @@
<eNB_serverId>1</eNB_serverId>
</testCase>
<testCase id="050202">
<class>Terminate_FlexranCtrl</class>
<desc>Stopping Flexran Controller</desc>
</testCase>
</testCaseList>
......@@ -2028,7 +2028,7 @@ add_library(LFDS7
# Simulation library
##########################
add_library(SIMU
set (SIMUSRC
${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
......@@ -2039,9 +2039,13 @@ ${OPENAIR1_DIR}/SIMULATION/TOOLS/channel_sim.c
${OPENAIR1_DIR}/SIMULATION/RF/rf.c
${OPENAIR1_DIR}/SIMULATION/RF/dac.c
${OPENAIR1_DIR}/SIMULATION/RF/adc.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/targets/ARCH/rfsimulator/apply_channelmod.c
#${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
)
# Simulation library
##########################
add_library( SIMU SHARED ${SIMUSRC} )
add_library(SIMU_ETH
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2347,7 +2351,6 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
......@@ -2571,69 +2574,108 @@ target_link_libraries (dlsim_tm4
add_executable(polartest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c
${OPENAIR_DIR}/common/utils/backtrace.c)
target_link_libraries(polartest SIMU PHY PHY_NR PHY_COMMON m ${ATLAS_LIBRARIES})
${OPENAIR_DIR}/common/utils/system.c
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(polartest
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE CONFIG_LIB -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
)
add_executable(smallblocktest
add_executable(smallblocktest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/smallblocktest.c
${OPENAIR_DIR}/common/utils/backtrace.c)
target_link_libraries(smallblocktest SIMU PHY PHY_NR PHY_COMMON m ${ATLAS_LIBRARIES})
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(smallblocktest
-Wl,--start-group UTIL SIMU PHY_NR CONFIG_LIB -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
)
add_executable(ldpctest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
${OPENAIR_DIR}/common/utils/backtrace.c)
target_link_libraries(ldpctest SIMU PHY PHY_NR m ${ATLAS_LIBRARIES})
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(ldpctest
-Wl,--start-group UTIL SIMU PHY_NR CONFIG_LIB -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
)
add_executable(nr_dlschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_dlschsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
add_executable(nr_pbchsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_pbchsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
#PUCCH ---> Prashanth
add_executable(nr_pucchsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_pucchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_pucchsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
#PUCCH ---> Prashanth
add_executable(nr_dlsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_ulschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_ulschsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
add_executable(nr_ulsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${UTIL_SRC}
${T_SOURCE})
target_link_libraries(nr_ulsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
......
......@@ -149,7 +149,7 @@ Options
--build-eclipse
Build eclipse project files. Paths are auto corrected by fixprj.sh
--build-lib <libraries>
Build optional shared library, <libraries> can be one or several of $OPTIONAL_LIBRARIES
Build optional shared library, <libraries> can be one or several of $OPTIONAL_LIBRARIES or \"all\"
--usrp-recplay
Build for I/Q record-playback modes
-h | --help
......@@ -346,16 +346,21 @@ function main() {
shift 1;;
--build-lib)
BUILD_OPTLIB=""
for alib in $2 ; do
if [ "$2" == "all" ] ; then
BUILD_OPTLIB="$OPTIONAL_LIBRARIES"
echo_info "Enabling build of all optional shared libraries ($OPTIONAL_LIBRARIES)"
else
for alib in $2 ; do
for oklib in $OPTIONAL_LIBRARIES ; do
if [ "$alib" = "$oklib" ] ; then
BUILD_OPTLIB="$BUILD_OPTLIB $alib"
echo_info "Enabling build of lib${alib}.so"
fi
if [ "$alib" = "$oklib" ] ; then
BUILD_OPTLIB="$BUILD_OPTLIB $alib"
echo_info "Enabling build of lib${alib}.so"
fi
done
done
done
if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES"
if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES"
fi
fi
shift 2;;
--usrp-recplay)
......@@ -580,7 +585,8 @@ function main() {
nr-uesoftmodem $dbin/nr-uesoftmodem.$REL
fi
# mandatory shared lib
# mandatory shared libraries common to UE and (e/g)NB
compilations \
$build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
......@@ -864,7 +870,6 @@ function main() {
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
echo_info "liboai_transpro.so is linked to ETHERNET transport"
fi
###################
# Doxygen Support #
......
## config module management
```c
configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags)
```
......@@ -14,23 +16,17 @@ void End_configmodule(void)
* Free memory which has been allocated by the configuration module since its initialization.
* Possibly calls the `config_<config source>_end` function
## Retrieving parameter's values
```c
int config_get(paramdef_t *params,int numparams, char *prefix)
```
* Reads as many parameters as described in params, they must all be in the same configuration file section
* Calls the `config_<config source>_get` function
* Calls the `config_process_cmdline` function
* `params` points to an array of `paramdef_t` structures which describes the parameters to be read, possibly including a pointer to a checking function. The following bits can possibly be set in the `paramflags` mask before calling
- `PARAMFLAG_MANDATORY`: -1 is returned if the parameter is not explicitly defined in the config source.
- `PARAMFLAG_DISABLECMDLINE`: parameter cannot be modified via the command line
- `PARAMFLAG_DONOTREAD`: ignore the parameter, can be used at run-time, to alter a pre-defined `paramdef_t` array which is used in several `config_get` or/and `config_getlist` calls.
- `PARAMFLAG_NOFREE`: do not free the memory possibly allocated by the config module to store the value of the parameter. Default behavior is for the config module to free the memory it has allocated when the `config_end` function is called.
- `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
* `params` is also used as an output parameter, `< XXX >ptr >` field is used by the config module to store the value it has read. The following bits can possibly be set in the `paramflags` mask after the call:
- `PARAMFLAG_MALLOCINCONFIG`: memory has been allocated for the ` < XXX >ptr > ` field
- `PARAMFLAG_PARAMSET`: parameter has been found in the config source, it is not set to default value.
- `PARAMFLAG_PARAMSET`: parameter has been set to its default value
* `params` points to an array of `paramdef_t` structures which describes the parameters to be read, possibly including a pointer to a checking function.The `paramflags` bit mask can be used to modify how a specific parameter is processed and the same mask is also used by the configuration module to return information about how the parameter has been processed. Bits definitions are described in the [`paramdef_t` structure description](./struct.md)
* `numparams` is the number of entries in the params array
* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured
......@@ -44,6 +40,9 @@ int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int
* `ParamList` points to a structure, where `paramarray` field points to an array of `paramdef_t` structure, allocated by the function. It is used to return the values of the parameters.
* The returned value is the number of occurrences in the list or -1 in case of severe error
## utility functions and macros
The configuration module also defines APIs to access the `paramdef_t` and `configmodule_interface_t` fields. They are listed in the configuration module [include file `common/config/config_userapi.h`](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_userapi.h)
[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
......@@ -5,6 +5,7 @@ It is defined in include file [ common/config/config_paramdesc.h ](https://gitla
|:-----------|:------------------------------------------------------------------|----:|
| `optname` | parameter name, as used when looking for it in the config source, 63 bytes max (64 with trailing \0) | I |
| `helstr` | pointer to a C string printed when using --help on the command line | I |
| `paramflags` | bit mask, used to modify how the parameter is processed, or to return to the API caller how the parameter has been set, see list in the next table | IO |
| `strptr` `strlistptr` `u8ptr` `i8ptr` `u16ptr` `i16ptr` `uptr` `iptr` `u64ptr` `i64ptr` `dblptr` `voidptr` | a pointer to a variable where the parameter value(s) will be returned. This field is an anonymous union, the supported pointer types have been built to avoid type mismatch warnings at compile time. | O |
| `defstrval` `defstrlistval` `defuintval` `defintval` `defint64val` `defintarrayval` `defdblval` | this field is an anonymous union, it can be used to define the default value for the parameter. It is ignored if `PARAMFLAG_MANDATORY` is set in the `paramflags` field.| I |
| `type` | Supported parameter types are defined as integer macros. Supported simple types are `TYPE_STRING`, parameter value is returned in `strptr` field, `TYPE_INT8` `TYPE_UINT8` `TYPE_INT16` `TYPE_UINT16` `TYPE_INT32` `TYPE_UINT32` `TYPE_INT64` `TYPE_UINT64`, parameter value is returned in the corresponding uXptr or iXptr, `TYPE_MASK`, value is returned in `u32ptr`, `TYPE_DOUBLE` value is returned in `dblptr`, `TYPE_IPV4ADDR` value is returned in binary, network bytes order in `u32ptr` field. `TYPE_STRINGLIST`, `TYPE_INTARRAY` and `TYPE_UINTARRAY` are multiple values types. Multiple values are returned in respectively, `strlistptr`, `iptr` and `uptr` fields which then point to arrays. The `numelt` field gives the number of item in the array. | I |
......@@ -12,6 +13,22 @@ It is defined in include file [ common/config/config_paramdesc.h ](https://gitla
| `chkPptr` | possible pointer to the structure containing the info used to check parameter values | I |
| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
## `paramflags` bits definition
| C macro bit definition | usage | I/O |
|:-------------------------------------|:---------------------------------------------------------------------------------------------------------------------|----:|
| `PARAMFLAG_MANDATORY` | parameter is mandatory, comfiguration module will stop the process if it is not specified. Default value is ignored | I |
| `PARAMFLAG_DISABLECMDLINE` | parameter cannot be specified on the command line | I |
| `PARAMFLAG_DONOTREAD` | ignore the parameter, usefull when a parameter group is used in different context | I |
| `PARAMFLAG_NOFREE` | The end_configmodule API won't free the memory which has been possibly allocated to store the value of the parameter.| I |
| `PARAMFLAG_BOOL` | Parameter is a boolean, it can be specified without a value to set it to true | I |
| `PARAMFLAG_CMDLINE_NOPREFIXENABLED` | parameter can be specified without the prefix on the command line. Must be used with care, carefuly checking unicity, especially for short parameter names | I |
| `PARAMFLAG_MALLOCINCONFIG` | Memory for the parameter value has been allocated by the configuration module |O |
| `PARAMFLAG_PARAMSET` | Parameter value has been explicitely set, as the parameter was specified either on the command line or the config source | O |
| `PARAMFLAG_PARAMSETDEF` | Parameter value has been set to it's default | O |
# `paramlist_def_t`structure
It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
......
......@@ -167,8 +167,8 @@ int config_check_unknown_cmdlineopt(char *prefix) {
char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0;
memset(testprefix,0,sizeof(testprefix));
memset(testprefix,0,sizeof(testprefix));
if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1;
......@@ -253,7 +253,9 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
}
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */
((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
char *valptr=NULL;
int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
......
......@@ -45,7 +45,7 @@
#define PARAMFLAG_DONOTREAD (1 << 2) // parameter must be ignored in get function
#define PARAMFLAG_NOFREE (1 << 3) // don't free parameter in end function
#define PARAMFLAG_BOOL (1 << 4) // integer param can be 0 or 1
#define PARAMFLAG_CMDLINE_NOPREFIXENABLED (1 << 5) // on the command line, allow a parameter to be specified without the prefix
/* Flags used by config modules to return info to calling modules and/or to for internal usage*/
#define PARAMFLAG_MALLOCINCONFIG (1 << 15) // parameter allocated in config module
......
......@@ -172,7 +172,7 @@ int config_get_processedint(paramdef_t *cfgoption) {
return ret;
}
void config_printhelp(paramdef_t *params,int numparams, char *prefix) {
printf("\n-----Help for section %-26s: %03i entries------\n",(prefix==NULL)?"(root section)":prefix ,numparams);
printf("\n-----Help for section %-26s: %03i entries------\n",(prefix==NULL)?"(root section)":prefix,numparams);
for (int i=0 ; i<numparams ; i++) {
printf(" %s%s: %s",
......@@ -204,6 +204,16 @@ int config_execcheck(paramdef_t *params, int numparams, char *prefix) {
return st;
}
int config_paramidx_fromname(paramdef_t *params, int numparams, char *name) {
for (int i=0; i<numparams ; i++) {
if (strcmp(name,params[i].optname) == 0)
return i;
}
fprintf(stderr,"[CONFIG]config_paramidx_fromname , %s is not a valid parameter name\n",name);
return -1;
}
int config_get(paramdef_t *params, int numparams, char *prefix) {
int ret= -1;
......@@ -438,7 +448,7 @@ int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
status=1;
for (int j=0; j<cfgoptions->numelt ; j++) {
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname,j,(int)cfgoptions->iptr[j]);
}
}
......@@ -452,7 +462,7 @@ int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->dblptr)=cfgoptions->defdblval;
status=1;
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname, *(cfgoptions->dblptr));
}
return status;
......@@ -460,7 +470,7 @@ int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
if (rst == 1 && *(cfgoptions->uptr) > 0) {
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
......
......@@ -39,6 +39,7 @@ extern "C"
{
#endif
/* utility functions to ease usage of config module structures */
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
......@@ -46,6 +47,8 @@ extern "C"
#define CONFIG_SETRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags |= P; }
#define CONFIG_CLEARRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags &= (~P); }
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
extern int config_paramidx_fromname(paramdef_t *params,int numparams, char *name);
/* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void);
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
......
......@@ -232,7 +232,7 @@ int write_file_matlab(const char *fname,
void log_getconfig(log_t *g_log)
{
char *gloglevel = NULL;
int consolelog ;
int consolelog = 0;
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
......
......@@ -25,7 +25,6 @@
* \date 2009 - 2014
* \version 0.5
* @ingroup util
*/
#ifndef __LOG_H__
......@@ -297,7 +296,7 @@ extern "C" {
# include "log_if.h"
/*----------------------------------------------------------------------------*/
int logInit (void);
int isLogInitDone (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
......@@ -363,14 +362,14 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG globalconfiguration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG globalconfiguration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST, 0} \
}
#define LOG_OPTIONS_IDX 2
......
......@@ -634,7 +634,7 @@ void *vcd_dumper_thread_rt(void *args)
uint32_t data_ready_wait;
# if defined(ENABLE_ITTI)
signal_mask();
return 0; //signal_mask(); //function defined at common/utils/ocp_itti/intertask_interface.cpp
# endif
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
......
......@@ -11,11 +11,11 @@
#include <common/utils/system.h>
typedef struct timer_elm_s {
timer_type_t type; ///< Timer type
long instance;
timer_type_t type; ///< Timer type
long instance;
long duration;
uint64_t timeout;
void *timer_arg; ///< Optional argument that will be passed when timer expires
void *timer_arg; ///< Optional argument that will be passed when timer expires
} timer_elm_t ;
typedef struct task_list_s {
......
......@@ -25,7 +25,7 @@ typedef struct {
typedef struct {
uint32_t interval_sec;
uint32_t interval_us;
long task_id;
long task_id;
int32_t instance;
timer_type_t type;
void *timer_arg;
......@@ -33,7 +33,7 @@ typedef struct {
} timer_create_t;
typedef struct {
long task_id;
long task_id;
long timer_id;
} timer_delete_t;
......@@ -536,6 +536,7 @@ int timer_setup(
int timer_remove(long timer_id);
#define timer_stop timer_remove
int signal_handle(int *end);
int signal_mask(void);
#ifdef __cplusplus
}
......
......@@ -123,7 +123,7 @@ void client_printf(const char *message, ...) {
if (telnetparams.new_socket > 0) {
vsnprintf(telnetparams.msgbuff,sizeof(telnetparams.msgbuff)-1,message, va_args);
send(telnetparams.new_socket,telnetparams.msgbuff , strlen(telnetparams.msgbuff), MSG_NOSIGNAL);
send(telnetparams.new_socket,telnetparams.msgbuff, strlen(telnetparams.msgbuff), MSG_NOSIGNAL);
} else {
vprintf(message, va_args);
}
......@@ -475,7 +475,7 @@ int process_command(char *buf) {
memset(cmdb,0,sizeof(cmdb));
bufbck=strdup(buf);
rt=CMDSTATUS_NOTFOUND;
j = sscanf(buf,"%9s %9s %9[^\t\n]",modulename,cmd,cmdb);
j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb);
if (telnetparams.telnetdbg > 0)
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
......@@ -543,7 +543,7 @@ void run_telnetsrv(void) {
char buf[TELNET_MAX_MSGLENGTH];
struct sockaddr cli_addr;
unsigned int cli_len = sizeof(cli_addr);
int readc , filled;
int readc, filled;
int status;
int optval = 1;
pthread_setname_np(pthread_self(), "telnet");
......@@ -604,7 +604,7 @@ void run_telnetsrv(void) {
}
if (telnetparams.telnetdbg > 0)
printf("[TELNETSRV] Command received: readc %i filled %i \"%s\"\n", readc, filled ,buf);
printf("[TELNETSRV] Command received: readc %i filled %i \"%s\"\n", readc, filled,buf);
if (buf[0] == '!') {
if (buf[1] == '!') {
......
......@@ -54,7 +54,7 @@ cd cmake_targets/
```
- The `-I` option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed.
- The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process.
- The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process. The RF simulator[RF simulator](../targets/ARCH/rfsimulator/README.md) is implemented as a specific device replacing RF hardware, it can be build using `-w SIMU` option.
- `--eNB` is to build the `lte-softmodem` executable and all required shared libraries
- `--UE` is to build the `lte-uesoftmodem` executable and all required shared libraries
......
......@@ -99,10 +99,10 @@
#if defined(ENABLE_ITTI)
extern volatile int start_gNB;
extern volatile int start_UE;
extern volatile int start_gNB;
extern volatile int start_UE;
#endif
extern volatile int oai_exit;
extern volatile int oai_exit;
extern openair0_config_t openair0_cfg[MAX_CARDS];
......@@ -133,13 +133,14 @@ extern double cpuf;
void init_gNB(int,int);
void stop_gNB(int nb_inst);
int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot_tx,uint64_t timestamp_tx);
int wakeup_tx(PHY_VARS_gNB *gNB,int frame_rx,int slot_rx,int frame_tx,int slot_tx,uint64_t timestamp_tx);
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void);
int wakeup_txfh(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int frame_tx, int slot_tx, uint64_t timestamp_tx);
int wakeup_tx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, uint64_t timestamp_tx);
#include "executables/thread-common.h"
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
void wakeup_prach_gNB(PHY_VARS_gNB *gNB,RU_t *ru,int frame,int subframe);
void wakeup_prach_gNB(PHY_VARS_gNB *gNB, RU_t *ru, int frame, int subframe);
extern uint8_t nfapi_mode;
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
......@@ -149,7 +150,7 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
#define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
static inline int rxtx(PHY_VARS_gNB *gNB,int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) {
static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) {
start_meas(&softmodem_stats_rxtx_sf);
// *******************************************************************
......
......@@ -114,27 +114,22 @@ static int DEFENBS[] = {0};
#include "T.h"
#include "nfapi_interface.h"
extern volatile int oai_exit;
extern volatile int oai_exit;
extern void nr_phy_free_RU(RU_t *);
extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void);
#include "executables/thread-common.h"
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
void init_NR_RU(char *);
void stop_RU(int nb_ru);
void do_ru_sync(RU_t *ru);
void configure_ru(int idx,
void *arg);
void configure_rru(int idx,
void *arg);
void configure_ru(int idx, void *arg);
void configure_rru(int idx, void *arg);
int attach_rru(RU_t *ru);
int connect_rau(RU_t *ru);
extern uint16_t sl_ahead;
......@@ -781,7 +776,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx,
(long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot);
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);
AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen);
}
}
......@@ -1229,12 +1224,12 @@ static void *ru_stats_thread(void *param) {
}
static void *ru_thread_tx( void *param ) {
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
PHY_VARS_gNB *gNB;
gNB_L1_proc_t *gNB_proc;
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
PHY_VARS_gNB *gNB;
gNB_L1_proc_t *gNB_proc;
gNB_L1_rxtx_proc_t *L1_proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
char filename[40];
int print_frame = 8;
int i = 0;
......@@ -1258,12 +1253,14 @@ static void *ru_thread_tx( void *param ) {
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_gNBs,&proc->cond_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx");
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_gNBs))==0,"mutex_lock return %d\n",ret);
ret = pthread_mutex_lock(&proc->mutex_gNBs);
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;
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_gNBs))==0,"mutex_lock returns %d\n",ret);
ret = pthread_mutex_unlock(&proc->mutex_gNBs);
AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
if (oai_exit) break;
......@@ -1314,7 +1311,8 @@ static void *ru_thread_tx( void *param ) {
gNB = ru->gNB_list[i];
gNB_proc = &gNB->proc;
L1_proc = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? &gNB_proc->L1_proc_tx : &gNB_proc->L1_proc;
AssertFatal((ret=pthread_mutex_lock(&gNB_proc->mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
ret = pthread_mutex_lock(&gNB_proc->mutex_RU_tx);
AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
for (int j=0; j<gNB->num_RU; j++) {
if (ru == gNB->RU_list[j]) {
......@@ -1327,12 +1325,15 @@ static void *ru_thread_tx( void *param ) {
}
if (gNB_proc->RU_mask_tx != (1<<gNB->num_RU)-1) { // not all RUs have provided their information so return
AssertFatal((ret=pthread_mutex_unlock(&gNB_proc->mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx);
AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
} else { // all RUs TX are finished so send the ready signal to gNB processing
gNB_proc->RU_mask_tx = 0;
AssertFatal((ret=pthread_mutex_unlock(&gNB_proc->mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx);
AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
AssertFatal((ret=pthread_mutex_lock(&L1_proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret);
ret = pthread_mutex_lock(&L1_proc->mutex_RUs_tx);
AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
// the thread can now be woken up
if (L1_proc->instance_cnt_RUs==-1) {
AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0,
......@@ -1340,8 +1341,8 @@ static void *ru_thread_tx( void *param ) {
} //else AssertFatal(1==0,"gNB TX thread is not ready\n");
L1_proc->instance_cnt_RUs = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs);
AssertFatal((ret=pthread_mutex_unlock(&L1_proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret);
ret = pthread_mutex_unlock(&L1_proc->mutex_RUs_tx);
AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
}
}
}
......@@ -1354,11 +1355,11 @@ static void *ru_thread( void *param ) {
static int ru_thread_status;
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
int ret;
int slot = fp->slots_per_frame-1;
int frame =1023;
char filename[40],threadname[40];
int slot = fp->slots_per_frame-1;
int frame = 1023;
char filename[40], threadname[40];
int print_frame = 8;
int i = 0;
int aa;
......@@ -1653,7 +1654,7 @@ void init_RU_proc(RU_t *ru) {
memset((void *)proc,0,sizeof(RU_proc_t));
proc->ru = ru;
proc->instance_cnt_prach = -1;
proc->instance_cnt_synch = -1; ;
proc->instance_cnt_synch = -1;
proc->instance_cnt_FH = -1;
proc->instance_cnt_FH1 = -1;
proc->instance_cnt_gNBs = -1;
......@@ -1866,8 +1867,8 @@ void configure_ru(int idx,
if (capabilities->FH_fmt < MAX_FH_FMTs) LOG_I(PHY, "RU FH options %s\n",rru_format_options[capabilities->FH_fmt]);
AssertFatal((ret=check_capabilities(ru,capabilities)) == 0,
"Cannot configure RRU %d, check_capabilities returned %d\n", idx,ret);
ret = check_capabilities(ru,capabilities);
AssertFatal(ret == 0, "Cannot configure RRU %d, check_capabilities returned %d\n", idx, ret);
// take antenna capabilities of RRU
ru->nb_tx = capabilities->nb_tx[0];
ru->nb_rx = capabilities->nb_rx[0];
......
#ifndef NR_SOFTMODEM_COMMON_H
#define NR_SOFTMODEM_COMMON_H
#ifndef _GNU_SOURCE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
......
......@@ -83,6 +83,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "PHY/TOOLS/nr_phy_scope.h"
#include "stats.h"
#include "nr-softmodem.h"
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
#include "NB_IoT_interface.h"
short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655};
......@@ -167,7 +169,7 @@ int rx_input_level_dBm;
uint32_t do_forms=0;
int otg_enabled;
//int number_of_cards = 1;
//int number_of_cards = 1;
//static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
......@@ -188,46 +190,10 @@ int transmission_mode=1;
int emulate_rf = 0;
int numerology = 0;
typedef struct {
uint64_t optmask;
THREAD_STRUCT thread_struct;
char rf_config_file[1024];
int phy_test;
uint8_t usim_test;
int emulate_rf;
int wait_for_sync; //eNodeB only
int single_thread_flag; //eNodeB only
int chain_offset;
int numerology;
unsigned int start_msc;
uint32_t clock_source;
int hw_timing_advance;
} softmodem_params_t;
static softmodem_params_t softmodem_params;
static char *parallel_config = NULL;
static char *worker_config = NULL;
static THREAD_STRUCT thread_struct;
void set_parallel_conf(char *parallel_conf) {
if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
}
void set_worker_conf(char *worker_conf) {
if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
}
PARALLEL_CONF_t get_thread_parallel_conf(void) {
return thread_struct.parallel_conf;
}
WORKER_CONF_t get_thread_worker_conf(void) {
return thread_struct.worker_conf;
}
/* struct for ethernet specific parameters given in eNB conf file */
eth_params_t *eth_params;
......@@ -507,7 +473,7 @@ static void get_options(void) {
int tddflag, nonbiotflag;
uint32_t online_log_messages;
uint32_t glog_level, glog_verbosity;
uint32_t start_telnetsrv;
uint32_t start_telnetsrv = 0;
paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
paramdef_t cmdline_logparams[] = CMDLINE_LOGPARAMS_DESC_NR ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
......
......@@ -8,42 +8,41 @@
#define DEFAULT_DLF 2680000000
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
when calling config_get or config_getlist functions */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters common to eNodeB and UE */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters common to eNodeB and UE */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_GNB { \
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)},\
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \
}
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)},\
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \
}
......
......@@ -103,9 +103,11 @@ FD_phy_scope_nrue *form_nrue[NUMBER_OF_UE_MAX];
//FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
//FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
char title[255];
static pthread_t forms_thread; //xforms
static pthread_t forms_thread; //xforms
#include <executables/nr-uesoftmodem.h>
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
RAN_CONTEXT_t RC;
volatile int start_eNB = 0;
......@@ -148,7 +150,7 @@ double bw = 10.0e6;
static int tx_max_power[MAX_NUM_CCs] = {0};
char rf_config_file[1024];
char rf_config_file[1024];
int chain_offset=0;
int phy_test = 0;
......@@ -163,53 +165,18 @@ uint8_t nb_antenna_rx = 1;
char ref[128] = "internal";
char channels[128] = "0";
typedef struct {
uint64_t optmask;
THREAD_STRUCT thread_struct;
char rf_config_file[1024];
int phy_test;
uint8_t usim_test;
int emulate_rf;
int wait_for_sync; //eNodeB only
int single_thread_flag; //eNodeB only
int chain_offset;
int numerology;
unsigned int start_msc;
uint32_t clock_source;
int hw_timing_advance;
} softmodem_params_t;
static softmodem_params_t softmodem_params;
static char *parallel_config = NULL;
static char *worker_config = NULL;
static THREAD_STRUCT thread_struct;
void set_parallel_conf(char *parallel_conf) {
if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
}
void set_worker_conf(char *worker_conf) {
if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
}
PARALLEL_CONF_t get_thread_parallel_conf(void) {
return thread_struct.parallel_conf;
}
WORKER_CONF_t get_thread_worker_conf(void) {
return thread_struct.worker_conf;
}
int rx_input_level_dBm;
//static int online_log_messages=0;
uint32_t do_forms=0;
int otg_enabled;
//int number_of_cards = 1;
//int number_of_cards = 1;
static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
int16_t node_synch_ref[MAX_NUM_CCs];
......
This diff is collapsed.
#ifndef SOFTMODEM_COMMON_H
#define SOFTMODEM_COMMON_H
typedef struct {
uint64_t optmask;
THREAD_STRUCT thread_struct;
char rf_config_file[1024];
int phy_test;
uint8_t usim_test;
int emulate_rf;
int wait_for_sync; //eNodeB only
int single_thread_flag; //eNodeB only
int chain_offset;
int numerology;
unsigned int start_msc;
uint32_t clock_source;
uint32_t timing_source;
int hw_timing_advance;
uint32_t send_dmrs_sync;
} softmodem_params_t;
#endif
#ifndef THREAD_COMMON_H
#define THREAD_COMMON_H
#include "PHY/defs_common.h"
THREAD_STRUCT thread_struct;
static inline void set_parallel_conf(char *parallel_conf) {
mapping config[]= {
FOREACH_PARALLEL(GENERATE_ENUMTXT)
{NULL,-1}
};
thread_struct.parallel_conf = (PARALLEL_CONF_t)map_str_to_int(config, parallel_conf);
if (thread_struct.parallel_conf == -1 ) {
LOG_E(ENB_APP,"Impossible value: %s\n", parallel_conf);
thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
}
printf("[CONFIG] parallel_conf is set to %d\n", thread_struct.parallel_conf);
}
static inline void set_worker_conf(char *worker_conf) {
mapping config[]={
FOREACH_WORKER(GENERATE_ENUMTXT)
{NULL, -1}
};
thread_struct.worker_conf = (WORKER_CONF_t)map_str_to_int(config, worker_conf);
if (thread_struct.worker_conf == -1 ) {
LOG_E(ENB_APP,"Impossible value: %s\n", worker_conf);
thread_struct.worker_conf = WORKER_DISABLE ;
}
printf("[CONFIG] worker_conf is set to %d\n", thread_struct.worker_conf);
}
static inline PARALLEL_CONF_t get_thread_parallel_conf(void) {
return thread_struct.parallel_conf;
}
static inline WORKER_CONF_t get_thread_worker_conf(void) {
return thread_struct.worker_conf;
}
#endif
......@@ -23,13 +23,14 @@
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrLDPC_encoder/defs.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#define MAX_NUM_DLSCH_SEGMENTS 16
#define MAX_BLOCK_LENGTH 8448
#ifndef malloc16
# ifdef __AVX2__
......@@ -42,7 +43,6 @@
#define NR_LDPC_PROFILER_DETAIL
#define NR_LDPC_ENABLE_PARITY_CHECK
// 4-bit quantizer
char quantize4bit(double D,double x)
{
......@@ -76,31 +76,15 @@ char quantize8bit(double D,double x)
return((char)qxd);
}
char quantize(double D,double x,unsigned char B)
{
double qxd;
short maxlev;
qxd = floor(x/D);
maxlev = 1<<(B-1);//(char)(pow(2,B-1));
//printf("x=%f,qxd=%f,maxlev=%d\n",x,qxd, maxlev);
if (qxd <= -maxlev)
qxd = -maxlev;
else if (qxd >= maxlev)
qxd = maxlev-1;
return((char)qxd);
}
typedef struct {
double n_iter_mean;
double n_iter_std;
int n_iter_max;
double n_iter_mean;
double n_iter_std;
int n_iter_max;
} n_iter_stats_t;
#define MAX_BLOCK_LENGTH 8448
RAN_CONTEXT_t RC;
PHY_VARS_UE ***PHY_vars_UE_g;
uint16_t NB_UE_INST = 1;
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};
......@@ -118,7 +102,7 @@ int test_ldpc(short No_iteration,
unsigned int *crc_misses,
time_stats_t *time_optim,
time_stats_t *time_decoder,
n_iter_stats_t * dec_iter)
n_iter_stats_t *dec_iter)
{
//clock initiate
//time_stats_t time,time_optim,tinput,tprep,tparity,toutput, time_decoder;
......@@ -146,12 +130,12 @@ int test_ldpc(short No_iteration,
double *modulated_input[MAX_NUM_DLSCH_SEGMENTS];
char *channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS];
unsigned int i,j,trial=0;
short BG,Zc,Kb,nrows;//,ncols;
short BG=0,Zc,Kb=0,nrows=0;//,ncols;
int no_punctured_columns,removed_bit;
int i1;
int R_ind = 0;
//Table of possible lifting sizes
//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};
//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};
//int n_segments=1;
int code_rate_vec[8] = {15, 13, 25, 12, 23, 34, 56, 89};
//double code_rate_actual_vec[8] = {0.2, 0.33333, 0.4, 0.5, 0.66667, 0.73333, 0.81481, 0.88};
......@@ -227,15 +211,15 @@ int test_ldpc(short No_iteration,
//determine number of bits in codeword
if (block_length>3840)
{
BG=1;
BG = 1;
Kb = 22;
nrows=46; //parity check bits
nrows = 46; //parity check bits
//ncols=22; //info bits
}
else if (block_length<=3840)
{
BG=2;
nrows=42; //parity check bits
BG = 2;
nrows = 42; //parity check bits
//ncols=10; // info bits
if (block_length>640)
......@@ -246,7 +230,7 @@ int test_ldpc(short No_iteration,
Kb = 8;
else
Kb = 6;
}
}
if (nom_rate == 1)
if (denom_rate == 5)
......@@ -298,7 +282,7 @@ int test_ldpc(short No_iteration,
}
}
printf("ldpc_test: codeword_length %d, n_segments %d, block_length %d, BG %d, Zc %d, Kb %d\n",n_segments *block_length, n_segments, block_length,BG, Zc, Kb);
printf("ldpc_test: codeword_length %d, n_segments %d, block_length %d, BG %d, Zc %d, Kb %d\n",n_segments *block_length, n_segments, block_length, BG, Zc, Kb);
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*(1/((float)nom_rate/(float)denom_rate)))/Zc;
// printf("puncture:%d\n",no_punctured_columns);
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
......@@ -330,11 +314,11 @@ int test_ldpc(short No_iteration,
if (ntrials==1)
for (j=0;j<n_segments;j++)
for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++)
if (channel_input[j][i]!=channel_input_optim[j][i]) {
printf("differ in seg %d pos %d (%d,%d)\n",j,i,channel_input[j][i],channel_input_optim[j][i]);
return (-1);
}
for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++)
if (channel_input[j][i]!=channel_input_optim[j][i]) {
printf("differ in seg %u pos %u (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]);
return (-1);
}
//else{
// printf("NOT differ in seg %d pos %d (%d,%d)\n",j,i,channel_input[j][i],channel_input_optim[j][i]);
// }
......@@ -344,7 +328,6 @@ int test_ldpc(short No_iteration,
printf("removed_bit: %d\n", removed_bit);
printf("To: %d\n", (Kb+nrows-no_punctured_columns) * Zc-removed_bit);
printf("number of undecoded bits: %d\n", (Kb+nrows-no_punctured_columns-2) * Zc-removed_bit);
}
//print_meas_now(&time, "", stdout);
......@@ -359,7 +342,7 @@ int test_ldpc(short No_iteration,
for (i = 2*Zc; i < (Kb+nrows-no_punctured_columns) * Zc-removed_bit; i++) {
#ifdef DEBUG_CODER
if ((i&0xf)==0)
printf("\ne %d..%d: ",i,i+15);
printf("\ne %u..%u: ",i,i+15);
#endif
if (channel_input[j][i-2*Zc]==0)
......@@ -369,7 +352,7 @@ int test_ldpc(short No_iteration,
///channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
//channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//channel_output_fixed[i] = (char)quantize(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
channel_output_fixed[j][i] = (char)quantize(sigma/4.0/4.0,modulated_input[j][i] + sigma*gaussdouble(0.0,1.0),qbits);
......@@ -383,11 +366,11 @@ int test_ldpc(short No_iteration,
//Uncoded BER
if (channel_output_fixed[j][i]<0)
channel_output_uncoded[j][i]=1; //QPSK demod
else
else
channel_output_uncoded[j][i]=0;
if (channel_output_uncoded[j][i] != channel_input[j][i-2*Zc])
*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
}
} // End segments
......@@ -541,7 +524,7 @@ int main(int argc, char *argv[])
time_stats_t time_optim[10], time_decoder[10];
n_iter_stats_t dec_iter[3];
short BG,Zc,Kb;
short BG=0,Zc,Kb;
while ((c = getopt (argc, argv, "q:r:s:S:l:n:d:i:t:u:h")) != -1)
switch (c)
......@@ -571,8 +554,8 @@ int main(int argc, char *argv[])
break;
case 'S':
n_segments = atof(optarg);
break;
n_segments = atof(optarg);
break;
case 't':
SNR_step = atof(optarg);
......@@ -583,8 +566,8 @@ int main(int argc, char *argv[])
break;
case 'u':
test_uncoded = atoi(optarg);
break;
test_uncoded = atoi(optarg);
break;
case 'h':
default:
......@@ -622,14 +605,14 @@ int main(int argc, char *argv[])
//determine number of bits in codeword
if (block_length>3840)
{
BG=1;
BG = 1;
Kb = 22;
//nrows=46; //parity check bits
//ncols=22; //info bits
}
else if (block_length<=3840)
{
BG=2;
BG = 2;
//nrows=42; //parity check bits
//ncols=10; // info bits
......@@ -663,8 +646,7 @@ int main(int argc, char *argv[])
fprintf(fd,"SNR BLER BER UNCODED_BER ENCODER_MEAN ENCODER_STD ENCODER_MAX DECODER_TIME_MEAN DECODER_TIME_STD DECODER_TIME_MAX DECODER_ITER_MEAN DECODER_ITER_STD DECODER_ITER_MAX\n");
for (SNR=SNR0;SNR<SNR0+20.0;SNR+=SNR_step)
{
for (SNR=SNR0;SNR<SNR0+20.0;SNR+=SNR_step) {
//reset_meas(&time_optim);
//reset_meas(&time_decoder);
//n_iter_stats_t dec_iter = {0, 0, 0};
......@@ -689,9 +671,9 @@ int main(int argc, char *argv[])
time_decoder,
dec_iter);
printf("SNR %f, BLER %f (%d/%d)\n",SNR,(float)decoded_errors[i]/(float)n_trials,decoded_errors[i],n_trials);
printf("SNR %f, BER %f (%d/%d)\n",SNR,(float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments ,decoded_errors[i],n_trials);
printf("SNR %f, Uncoded BER %f (%d/%d)\n",SNR,errors_bit_uncoded/(float)n_trials/(double)n_segments ,decoded_errors[i],n_trials);
printf("SNR %f, BLER %f (%u/%d)\n", SNR, (float)decoded_errors[i]/(float)n_trials, decoded_errors[i], n_trials);
printf("SNR %f, BER %f (%u/%d)\n", SNR, (float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments, decoded_errors[i], n_trials);
printf("SNR %f, Uncoded BER %f (%u/%d)\n",SNR, errors_bit_uncoded/(float)n_trials/(double)n_segments, decoded_errors[i], n_trials);
printf("SNR %f, Mean iterations: %f\n",SNR, dec_iter->n_iter_mean);
printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std);
printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max);
......@@ -720,23 +702,11 @@ int main(int argc, char *argv[])
dec_iter->n_iter_max
);
if (decoded_errors[i] == 0)
break;
i=i+1;
if (decoded_errors[i] == 0) break;
i=i+1;
}
fclose(fd);
return(0);
}
......@@ -11,6 +11,7 @@
#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 "PHY/NR_TRANSPORT/nr_transport.h"
//#include "common/utils/LOG/log.h"
......@@ -18,7 +19,12 @@
//#define DEBUG_POLAR_TIMING
//#define DEBUG_POLARTEST
int main(int argc, char *argv[]) {
RAN_CONTEXT_t RC;
PHY_VARS_UE ***PHY_vars_UE_g;
uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
//Default simulation values (Aim for iterations = 1000000.)
int decoder_int16=0;
int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI
......
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
#include "SIMULATION/TOOLS/sim.h"
#include <getopt.h>
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
//#define DEBUG_SMALLBLOCKTEST
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);
}
int main(int argc, char *argv[]) {
RAN_CONTEXT_t RC;
PHY_VARS_UE ***PHY_vars_UE_g;
uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
time_stats_t timeEncoder,timeDecoder;
opp_enabled=1;
cpu_freq_GHz = get_cpu_freq_GHz();
......
......@@ -445,7 +445,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
pointer_shift_values=(short *) pointer_shift_values_BG2;
}
else {
AssertFatal(0,"BG %d is not supported yet\n",BG);
AssertFatal(0,"BG %d is not supported yet\n",BG);
}
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
......
......@@ -601,7 +601,8 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out,
const t_nrPolar_params *polarParams) {
const t_nrPolar_params *polarParams)
{
int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
......@@ -645,8 +646,8 @@ uint32_t polar_decoder_int16(int16_t *input,
//int len_mod64=len&63;
int crclen = polarParams->crcParityBits;
uint64_t rxcrc=B[0]&((1<<crclen)-1);
uint32_t crc;
uint64_t Ar;
uint32_t crc = 0;
uint64_t Ar = 0;
AssertFatal(len<65,"A must be less than 65 bits\n");
if (len<=32) {
......
......@@ -268,7 +268,7 @@ static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,vo
#endif
for (int i=0; i<polarParams->encoderLength; i++) {
#ifdef DEBUG_POLAR_ENCODER
printf("%u<-%u : %llx.%llx =>",i,polarParams->rate_matching_pattern[i],((uint64_t *)out)[1],((uint64_t *)out)[0]);
printf("%d<-%u : %llx.%llx =>",i,polarParams->rate_matching_pattern[i],((uint64_t *)out)[1],((uint64_t *)out)[0]);
#endif
tmp0 = (*in128&(((uint128_t)1)<<polarParams->rate_matching_pattern[i]));
if (tmp0!=0) {
......
......@@ -30,12 +30,12 @@
//#define DEBUG_SEGMENTATION
int32_t nr_segmentation(unsigned char *input_buffer,
unsigned char **output_buffers,
unsigned int B,
unsigned int *C,
unsigned int *K,
unsigned int *Zout, // [hna] Zout is Zc
unsigned int *F)
unsigned char **output_buffers,
unsigned int B,
unsigned int *C,
unsigned int *K,
unsigned int *Zout, // [hna] Zout is Zc
unsigned int *F)
{
unsigned int L,Bprime,Bprime_by_C,Z,r,Kb,k,s,crc,Kprime;
......@@ -53,12 +53,12 @@ int32_t nr_segmentation(unsigned char *input_buffer,
Bprime = B+((*C)*L);
#ifdef DEBUG_SEGMENTATION
printf("Bprime %d\n",Bprime);
printf("Bprime %u\n",Bprime);
#endif
}
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) {
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
return(-1);
}
......@@ -83,7 +83,7 @@ else
Z = (Bprime_by_C/Kb);
#ifdef DEBUG_SEGMENTATION
printf("nr segmetation B %d Bprime %d Bprime_by_C %d z %d \n", B, Bprime, Bprime_by_C, Z);
printf("nr segmetation B %u Bprime %u Bprime_by_C %u z %u \n", B, Bprime, Bprime_by_C, Z);
#endif
if (Z <= 2) {
......@@ -110,7 +110,7 @@ else
*K = *K + 8;
#ifdef DEBUG_SEGMENTATION
printf("Z_by_C %d , K2 %d\n",Z,*K);
printf("Z_by_C %u , K2 %u\n",Z,*K);
#endif
} else if (Z <= 256) { // increase by 4 bytes til here
*K = (Z>>4)<<4;
......@@ -134,8 +134,8 @@ else
*F = ((*K) - Bprime_by_C);
#ifdef DEBUG_SEGMENTATION
printf("final nr seg output Z %d K %d F %d \n", *Zout, *K, *F);
printf("C %d, K %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*K,Bprime>>3,Bprime,*F);
printf("final nr seg output Z %u K %u F %u \n", *Zout, *K, *F);
printf("C %u, K %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*K,Bprime>>3,Bprime,*F);
#endif
if ((input_buffer) && (output_buffers)) {
......
......@@ -788,8 +788,9 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
int16_t Ravg[2];
Ravg[0]=0;
Ravg[1]=0;
int16_t iv, rv, phase_idx;
__m128i avg128U1, avg128U2, R[3], mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
int16_t iv, rv, phase_idx = 0;
__m128i avg128U1, avg128U2, R[3], mmtmpD0, mmtmpD1, mmtmpD2, mmtmpD3;
// round(tan((pi/4)*[1:1:N]/N)*pow2(15))
int16_t alpha[128] = {201, 402, 603, 804, 1006, 1207, 1408, 1610, 1811, 2013, 2215, 2417, 2619, 2822, 3024, 3227, 3431, 3634, 3838, 4042, 4246, 4450, 4655, 4861, 5066, 5272, 5479, 5686, 5893, 6101, 6309, 6518, 6727, 6937, 7147, 7358, 7570, 7782, 7995, 8208, 8422, 8637, 8852, 9068, 9285, 9503, 9721, 9940, 10160, 10381, 10603, 10825, 11049, 11273, 11498, 11725, 11952, 12180, 12410, 12640, 12872, 13104, 13338, 13573, 13809, 14046, 14285, 14525, 14766, 15009, 15253, 15498, 15745, 15993, 16243, 16494, 16747, 17001, 17257, 17515, 17774, 18035, 18298, 18563, 18829, 19098, 19368, 19640, 19915, 20191, 20470, 20750, 21033, 21318, 21605, 21895, 22187, 22481, 22778, 23078, 23380, 23685, 23992, 24302, 24615, 24931, 25250, 25572, 25897, 26226, 26557, 26892, 27230, 27572, 27917, 28266, 28618, 28975, 29335, 29699, 30067, 30440, 30817, 31198, 31583, 31973, 32368, 32767};
// compute log2_maxh (output_shift)
......
......@@ -2001,6 +2001,11 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
ulsch->ue_type = ulsch_pdu->ulsch_pdu_rel13.ue_type;
AssertFatal(harq_pid ==0 || ulsch->ue_type == NOCE, "Harq PID is not zero for BL/CE UE\n");
if(ulsch_pdu->ulsch_pdu_rel13.repetition_number >1) // Fill the Harq process parameters in the first Rep only
{
return;
}
//AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
if(ulsch->harq_processes[harq_pid]->nb_rb == 0) {
LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id);
......@@ -2009,6 +2014,10 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
ulsch->harq_processes[harq_pid]->frame = frame;
ulsch->harq_processes[harq_pid]->subframe = subframe;
ulsch->harq_processes[harq_pid]->handled = 0;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
ulsch->harq_processes[harq_pid]->repetition_number = ulsch_pdu->ulsch_pdu_rel13.repetition_number ;
ulsch->harq_processes[harq_pid]->total_number_of_repetitions = ulsch_pdu->ulsch_pdu_rel13.total_number_of_repetitions ;
#endif
ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start;
ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
ulsch->harq_processes[harq_pid]->dci_alloc = 1;
......
......@@ -42,6 +42,7 @@
#include "common/utils/LOG/log.h"
#include "targets/RT/USER/lte-softmodem.h"
#include <syscall.h>
#include "executables/thread-common.h"
//#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1
......@@ -57,9 +58,8 @@
uint64_t runtime,
uint64_t deadline,
uint64_t period);*/
extern WORKER_CONF_t get_thread_worker_conf(void);
extern volatile int oai_exit;
extern volatile int oai_exit;
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
int i, r, aa, layer;
......@@ -99,7 +99,14 @@ 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,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS *frame_parms) {
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
unsigned char Mdlharq,
uint32_t Nsoft,
unsigned char N_RB_DL,
uint8_t abstraction_flag,
LTE_DL_FRAME_PARMS *frame_parms)
{
LTE_eNB_DLSCH_t *dlsch;
unsigned char exit_flag = 0,i,j,r,aa,layer;
int re;
......@@ -221,6 +228,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
return(NULL);
}
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
unsigned char Mdlharq;
unsigned char i,j,r;
......@@ -257,8 +265,6 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
}
int dlsch_encoding_2threads0(te_params *tep) {
LTE_eNB_DLSCH_t *dlsch = tep->dlsch;
unsigned int G = tep->G;
......@@ -358,7 +364,6 @@ void *te_thread(void *param) {
}
int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,
......@@ -548,6 +553,8 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,
......@@ -812,10 +819,3 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
......@@ -118,8 +118,7 @@ uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb) {
}
}
int adjust_G2(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe,uint8_t symbol) {
int adjust_G2(LTE_DL_FRAME_PARMS *frame_parms, uint32_t *rb_alloc, uint8_t mod_order, uint8_t subframe, uint8_t symbol) {
int rb,re_pbch_sss=0;
int rb_alloc_ind,nsymb;
nsymb = (frame_parms->Ncp==NORMAL) ? 14 : 12;
......@@ -205,7 +204,7 @@ int adjust_G2(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_ord
return(re_pbch_sss);
}
int adjust_G(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe) {
int adjust_G(LTE_DL_FRAME_PARMS *frame_parms, uint32_t *rb_alloc, uint8_t mod_order, uint8_t subframe) {
int rb,re_pbch_sss=0;
uint8_t rb_alloc_ind;
......@@ -286,7 +285,16 @@ int adjust_G(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_orde
return(0);
}
int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe,uint8_t beamforming_mode) {
int get_G(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint32_t *rb_alloc,
uint8_t mod_order,
uint8_t Nl,
uint8_t num_pdcch_symbols,
int frame,
uint8_t subframe,
uint8_t beamforming_mode)
{
int G_adj;
if (is_pmch_subframe(frame,subframe,frame_parms) == 0) {
......@@ -319,8 +327,16 @@ int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint
}
}
int get_G_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe,uint8_t beamforming_mode) {
int get_G_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint32_t *rb_alloc,
uint8_t mod_order,
uint8_t Nl,
uint8_t num_pdcch_symbols,
int frame,
uint8_t subframe,
uint8_t beamforming_mode)
{
//int G_adj;
/*if (is_pmch_subframe(frame,subframe,frame_parms) == 0) {
G_adj= adjust_G(frame_parms,rb_alloc,mod_order,subframe);
......@@ -353,13 +369,10 @@ int get_G_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb
return((int)frame_parms->N_RB_DL * mod_order * 120);
}
// following function requires dlsch_tbs_full.h
#include "PHY/LTE_TRANSPORT/dlsch_tbs_full.h"
unsigned char SE2I_TBS(float SE,
unsigned char N_PRB,
unsigned char symbPerRB) {
unsigned char SE2I_TBS(float SE, unsigned char N_PRB, unsigned char symbPerRB) {
unsigned char I_TBS= -1;
int throughPutGoal = 0;
short diffOld = TBStable[0][N_PRB-1] - throughPutGoal; // always positive because of unsigned arithmetic
......@@ -393,7 +406,6 @@ unsigned char SE2I_TBS(float SE,
}
//added for ALU icic purpose
uint8_t Get_SB_size(uint8_t n_rb_dl) {
if(n_rb_dl<27)
return 4;
......@@ -402,6 +414,4 @@ uint8_t Get_SB_size(uint8_t n_rb_dl) {
else
return 8;
}
//end ALU's algo
......@@ -314,6 +314,12 @@ typedef struct {
// int calibration_flag;
/// delta_TF for power control
int32_t delta_TF;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
// PUSCH Repetition Number for the current SF
uint32_t repetition_number ;
// PUSCH Total number of repetitions
uint32_t total_number_of_repetitions;
#endif
} LTE_UL_eNB_HARQ_t;
typedef struct {
......
......@@ -553,12 +553,18 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
int G = ulsch_harq->G;
unsigned int E;
decoder_if_t *tc;
static int32_t pusch_rep_buffer[3*(6144+64)];
int max_Ncb;
if (llr8_flag == 0)
tc = *decoder16;
else
tc = *decoder8;
if(ulsch_harq->repetition_number == 1){
memset(pusch_rep_buffer,0,(sizeof(int32_t)*3*(6144+64))) ; // reset the buffer every new repetitions
}
for (r=0; r<ulsch_harq->C; r++) {
// printf("before subblock deinterleaving c[%d] = %p\n",r,ulsch_harq->c[r]);
// Get Turbo interleaver parameters
......@@ -592,7 +598,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
0, //Uplink
1,
ulsch_harq->rvidx,
(ulsch_harq->round==0)?1:0, // clear
(ulsch_harq->rvidx==0)?1:0, // clear
ulsch_harq->Qm,
1,
r,
......@@ -602,6 +608,27 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
}
stop_meas(&eNB->ulsch_rate_unmatching_stats);
max_Ncb = 3*ulsch_harq->RTC[r]*32 ;
if(ulsch_harq->total_number_of_repetitions > 1)
{
if (ulsch_harq->rvidx==1)
{ // Store the result of HARQ combining in the last emtc repetitions of sequence 0,2,3,1
for (int nn=0;nn<max_Ncb;nn++)
{
pusch_rep_buffer[nn] += ulsch_harq->w[r][nn] ;
}
}
if (ulsch_harq->repetition_number == ulsch_harq->total_number_of_repetitions)
{
for (int nn=0;nn<max_Ncb;nn++)
{
ulsch_harq->w[r][nn] = pusch_rep_buffer[nn] ;
}
}
}
r_offset += E;
start_meas(&eNB->ulsch_deinterleaving_stats);
sub_block_deinterleaving_turbo(4+Kr,
......
......@@ -36,10 +36,10 @@
#endif*/
int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
{
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_COMMON *common_vars = &ue->common_vars;
......@@ -131,8 +131,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#ifdef DEBUG_FEP
// if (ue->frame <100)
/*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,sample_offset,rx_offset,frame_length_samples);
/*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n",
ue->proc.proc_rxtx[(Ns)&1].frame_rx, Ns, symbol, nb_prefix_samples, nb_prefix_samples0, slot_offset, sample_offset, rx_offset, frame_length_samples);
#endif
if (symbol==0) {
......@@ -192,7 +192,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns)&1].frame_rx, symbol,rx_offset);
printf("slot_fep: frame %d: symbol %d rx_offset %u\n", ue->proc.proc_rxtx[(Ns)&1].frame_rx, symbol, rx_offset);
#endif
}
......
......@@ -105,12 +105,12 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
unsigned int Ns,
unsigned int *nr_gold_pdsch,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pdsch_rb)
unsigned int Ns,
unsigned int *nr_gold_pdsch,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pdsch_rb)
{
int8_t w,config_type;
short *mod_table;
......@@ -156,15 +156,15 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
return(0);
}
int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned int Ns,
unsigned int *nr_gold_pdcch,
int32_t *output,
unsigned short p,
unsigned short nb_rb_coreset)
uint8_t eNB_offset,
unsigned int Ns,
unsigned int *nr_gold_pdcch,
int32_t *output,
unsigned short p,
unsigned short nb_rb_coreset)
{
uint8_t idx=0;
//uint8_t pdcch_rb_offset =0;
//nr_gold_pdcch += ((int)floor(ue->frame_parms.ssb_start_subcarrier/12)+pdcch_rb_offset)*3/32;
......@@ -176,8 +176,8 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
((int16_t*)output)[(i<<1)+1] = nr_rx_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
#ifdef DEBUG_PDCCH
if (i<8)
printf("i %d idx %d pdcch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdcch[(i<<1)>>5], (((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1),
(((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1],&output[0]);
printf("i %d idx %d pdcch gold %u b0-b1 %d-%d mod_dmrs %d %d addr %p\n", i, idx, nr_gold_pdcch[(i<<1)>>5], (((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1),
(((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1],&output[0]);
#endif
}
}
......@@ -185,7 +185,10 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
return(0);
}
int nr_pbch_dmrs_rx(int symbol,unsigned int *nr_gold_pbch,int32_t *output )
int nr_pbch_dmrs_rx(int symbol,
unsigned int *nr_gold_pbch,
int32_t *output)
{
int m,m0,m1;
uint8_t idx=0;
......@@ -219,6 +222,3 @@ int nr_pbch_dmrs_rx(int symbol,unsigned int *nr_gold_pbch,int32_t *output )
return(0);
}
......@@ -54,7 +54,9 @@
*
*********************************************************************/
int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling)
int16_t *base_sequence_less_than_36(unsigned int M_ZC,
unsigned int u,
unsigned int scaling)
{
char *phi_table;
int16_t *rv_overbar;
......@@ -77,7 +79,7 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned
case 30:
break;
default:
printf("function base_sequence_less_than 36_: unsupported base sequence size : %d \n", M_ZC);
printf("function base_sequence_less_than 36_: unsupported base sequence size : %u \n", M_ZC);
assert(0);
break;
}
......@@ -121,7 +123,10 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned
*
*********************************************************************/
int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, unsigned int u, unsigned int v, unsigned int scaling)
int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
unsigned int u,
unsigned int v,
unsigned int scaling)
{
int16_t *rv_overbar;
unsigned int N_ZC;
......
......@@ -95,7 +95,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
dlsch->harq_processes[i]->d[r] = NULL;
}
}
}
free16(dlsch->harq_processes[i],sizeof(NR_DL_gNB_HARQ_t));
dlsch->harq_processes[i] = NULL;
}
......@@ -103,7 +103,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
free16(dlsch,sizeof(NR_gNB_DLSCH_t));
dlsch = NULL;
}
}
}
......@@ -269,10 +269,11 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
}
}
int nr_dlsch_encoding(unsigned char *a,int frame,
uint8_t slot,
NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms)
int nr_dlsch_encoding(unsigned char *a,
int frame,
uint8_t slot,
NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms)
{
unsigned int G;
......@@ -416,7 +417,7 @@ int nr_dlsch_encoding(unsigned char *a,int frame,
}
}
#ifdef DEBUG_DLSCH_CODING
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
printf("Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d)...\n",
r,
G,
Kr*3,
......
......@@ -31,11 +31,11 @@
int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
int dmrss,
NR_UE_SSB *current_ssb)
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
int dmrss,
NR_UE_SSB *current_ssb)
{
int pilot[200] __attribute__((aligned(16)));
unsigned char aarx;
......@@ -149,7 +149,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb->c_im +=ch[1];
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
pil+=2;
......@@ -165,7 +165,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb->c_im +=ch[1];
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
pil+=2;
//re_offset = (re_offset+4)&(ue->frame_parms.ofdm_symbol_size-1);
......@@ -180,7 +180,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb->c_im +=ch[1];
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
pil+=2;
......@@ -199,12 +199,12 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
int dmrss,
uint8_t ssb_index,
uint8_t n_hf)
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
int dmrss,
uint8_t ssb_index,
uint8_t n_hf)
{
int pilot[200] __attribute__((aligned(16)));
unsigned char aarx;
......@@ -367,7 +367,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl,
ch,
......@@ -387,7 +387,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
......@@ -403,7 +403,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fr,
......@@ -426,11 +426,11 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
}
int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
unsigned short coreset_start_subcarrier,
unsigned short nb_rb_coreset)
uint8_t eNB_offset,
unsigned char Ns,
unsigned char symbol,
unsigned short coreset_start_subcarrier,
unsigned short nb_rb_coreset)
{
int pilot[200] __attribute__((aligned(16)));
unsigned char aarx,p;
......@@ -550,7 +550,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDCCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl,
ch,
......@@ -566,7 +566,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDCCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
......@@ -656,14 +656,13 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
}
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned char Ns,
unsigned short p,
unsigned char symbol,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch)
uint8_t eNB_offset,
unsigned char Ns,
unsigned short p,
unsigned char symbol,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch)
{
int pilot[1320] __attribute__((aligned(16)));
unsigned char aarx;
unsigned short k;
......@@ -804,7 +803,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
......@@ -819,7 +818,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fmm,
ch,
......@@ -837,7 +836,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
......@@ -856,7 +855,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot %d: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fmr,
ch,
......@@ -872,7 +871,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fr,
ch,
......
......@@ -1175,7 +1175,7 @@ void nr_dci_decoding_procedure0(int s,
} else {
nb_candidates = (L2 == 4) ? 4 : ((L2 == 8)? 2 : 1); // according to Table 10.1-1 (38.213 section 10.1)
#ifdef NR_PDCCH_DCI_DEBUG
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> we are in common searchSpace and nb_candidates=%d for L2=%d\n",nb_candidates,L2);
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> we are in common searchSpace and nb_candidates=%u for L2=%d\n", nb_candidates, L2);
#endif
}
} else {
......@@ -1214,7 +1214,7 @@ void nr_dci_decoding_procedure0(int s,
}
#ifdef NR_PDCCH_DCI_DEBUG
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> L2(%d) | nCCE[%d](%d) | Yk(%d) | nb_candidates(%d)\n",L2,p,nCCE[p],Yk,nb_candidates);
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> L2(%d) | nCCE[%d](%d) | Yk(%u) | nb_candidates(%u)\n", L2, p, nCCE[p], Yk, nb_candidates);
#endif
/* for (CCEind=0;
CCEind<nCCE2;
......@@ -1227,7 +1227,7 @@ void nr_dci_decoding_procedure0(int s,
if (L==4) m_p_s_L_max=1; // Table 10.1-2 is not defined for L=4
#ifdef NR_PDCCH_DCI_DEBUG
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> m_max_slot_pdcch_Table10_1_2(%d)=%d\n",L,m_max_slot_pdcch_Table10_1_2[L]);
if(0 <= L && L < 4) printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> m_max_slot_pdcch_Table10_1_2(%d)=%d\n",L,m_max_slot_pdcch_Table10_1_2[L]);
#endif
for (m = 0; m < nb_candidates; m++) {
......@@ -1236,16 +1236,16 @@ void nr_dci_decoding_procedure0(int s,
if (nCCE[p] < L2) return;
#ifdef NR_PDCCH_DCI_DEBUG
int debug1 = nCCE[p] / L2;
int debug2 = L2*m_p_s_L_max;
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",debug1,p,nCCE[p],L2);
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",debug2,L2,m_p_s_L_max);
int debug1 = nCCE[p] / L2;
int debug2 = L2*m_p_s_L_max;
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",debug1,p,nCCE[p],L2);
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",debug2,L2,m_p_s_L_max);
#endif
CCEind = (((Yk + (uint16_t)(floor((m*nCCE[p])/(L2*m_p_s_L_max))) + n_ci) % (uint16_t)(floor(nCCE[p] / L2))) * L2);
CCEind = (((Yk + (uint16_t)(floor((m*nCCE[p])/(L2*m_p_s_L_max))) + n_ci) % (uint16_t)(floor(nCCE[p] / L2))) * L2);
#ifdef NR_PDCCH_DCI_DEBUG
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEind(%d) = (((Yk(%d) + ((m(%d)*nCCE[p](%d))/(L2(%d)*m_p_s_L_max(%d)))) % (nCCE[p] / L2)) * L2)\n",
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEind(%d) = (((Yk(%u) + ((m(%u)*nCCE[p](%d))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n",
CCEind,Yk,m,nCCE[p],L2,m_p_s_L_max);
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> n_candidate(m)=%d | CCEind=%d |",m,CCEind);
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> n_candidate(m)=%u | CCEind=%d |",m,CCEind);
#endif
if (CCEind < 32)
......@@ -1254,7 +1254,7 @@ void nr_dci_decoding_procedure0(int s,
CCEmap = CCEmap1;
else if (CCEind < 96)
CCEmap = CCEmap2;
else AssertFatal(1==0,"Illegal CCEind %d (Yk %d, m %d, nCCE %d, L2 %d\n",CCEind, Yk, m, nCCE[p], L2);
else AssertFatal(1==0,"Illegal CCEind %d (Yk %u, m %u, nCCE %d, L2 %d\n", CCEind, Yk, m, nCCE[p], L2);
switch (L2) {
case 1:
......@@ -1286,7 +1286,7 @@ void nr_dci_decoding_procedure0(int s,
CCEmap_cand = (*CCEmap) & CCEmap_mask;
// CCE is not allocated yet
#ifdef NR_PDCCH_DCI_DEBUG
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEmap_cand=%d \n",CCEmap_cand);
printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEmap_cand=%u \n",CCEmap_cand);
#endif
if (CCEmap_cand == 0) {
......
......@@ -379,11 +379,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,nr_tti_rx,slot,
symbol,ue->high_speed_flag,type,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
printf("[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",
frame,nr_tti_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
#else
LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,nr_tti_rx,slot,symbol,
ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",
frame,nr_tti_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
#endif
#endif
......
......@@ -93,7 +93,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
(i!=(nushiftmod4+8))) {
rxF_ext[j]=rxF[rx_offset];
#ifdef DEBUG_PBCH
printf("rxF ext[%d] = (%d,%d) rxF [%d]= (%d,%d)\n",(9*rb) + j,
printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(9*rb) + j,
((int16_t *)&rxF_ext[j])[0],
((int16_t *)&rxF_ext[j])[1],
rx_offset,
......@@ -116,7 +116,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
(i!=(nushiftmod4+8))) {
rxF_ext[j]=rxF[rx_offset];
#ifdef DEBUG_PBCH
printf("rxF ext[%d] = (%d,%d) rxF [%d]= (%d,%d)\n",(rb<4) ? (9*rb) + j : (9*(rb-12))+j,
printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(rb<4) ? (9*rb) + j : (9*(rb-12))+j,
((int16_t *)&rxF_ext[j])[0],
((int16_t *)&rxF_ext[j])[1],
rx_offset,
......
......@@ -44,8 +44,7 @@
void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
{
int i;
int r;
int i, r;
if (ulsch) {
#ifdef DEBUG_ULSCH_FREE
......@@ -87,10 +86,10 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
}
NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag)
NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL,
int number_of_harq_pids,
uint8_t abstraction_flag)
{
NR_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,r;
unsigned char bw_scaling =1;
......@@ -187,12 +186,10 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
}
int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid)
NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid)
{
/////////////////////////parameters and variables declaration/////////////////////////
///////////
......@@ -377,7 +374,7 @@ opp_enabled=0;
}
#ifdef DEBUG_DLSCH_CODING
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
printf("Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d)...\n",
r,
G,
Kr*3,
......
......@@ -234,8 +234,8 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
if (N_ID_2 == 0) {
char output_file[255];
char sequence_name[255];
sprintf(output_file, "pss_seq_%d_%d.m", N_ID_2, length);
sprintf(sequence_name, "pss_seq_%d_%d", N_ID_2, length);
sprintf(output_file, "pss_seq_%d_%u.m", N_ID_2, length);
sprintf(sequence_name, "pss_seq_%d_%u", N_ID_2, length);
printf("file %s sequence %s\n", output_file, sequence_name);
LOG_M(output_file, sequence_name, primary_synchro, LENGTH_PSS_NR, 1, 1);
......@@ -298,14 +298,14 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
if (N_ID_2 == 0) {
char output_file[255];
char sequence_name[255];
sprintf(output_file, "%s%d_%d%s","pss_seq_t_", N_ID_2, length, ".m");
sprintf(sequence_name, "%s%d_%d","pss_seq_t_", N_ID_2, length);
sprintf(output_file, "%s%d_%u%s","pss_seq_t_", N_ID_2, length, ".m");
sprintf(sequence_name, "%s%d_%u","pss_seq_t_", N_ID_2, length);
printf("file %s sequence %s\n", output_file, sequence_name);
LOG_M(output_file, sequence_name, primary_synchro_time, length, 1, 1);
sprintf(output_file, "%s%d_%d%s","pss_seq_f_", N_ID_2, length, ".m");
sprintf(sequence_name, "%s%d_%d","pss_seq_f_", N_ID_2, length);
sprintf(output_file, "%s%d_%u%s","pss_seq_f_", N_ID_2, length, ".m");
sprintf(sequence_name, "%s%d_%u","pss_seq_f_", N_ID_2, length);
LOG_M(output_file, sequence_name, synchroF_tmp, length, 1, 1);
}
......@@ -900,7 +900,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
pss_source = pss_index;
#ifdef DEBUG_PSS_NR
printf("pss_index %d: n %6d peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]);
printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]);
#endif
}
}
......
......@@ -559,7 +559,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
}
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
//llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error.
llr = (float*) malloc(coded_bits_per_codeword*sizeof(float));
memset((void *)llr, 0,coded_bits_per_codeword*sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword*sizeof(float));
llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero
bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
......@@ -572,7 +575,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
pdcch_llr = (int8_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr;
pdcch_comp = (int16_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0];
pdsch_llr = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0
// pdsch_llr = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0]; // stream 0
//pdsch_llr = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0]; // stream 0
pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0];
pdsch_mag = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0];
......
......@@ -31,6 +31,7 @@ float tput_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
float tput_ue_max[NUMBER_OF_UE_MAX] = {0};
static void ia_receiver_on_off( FL_OBJECT *button, long arg)
{
if (fl_get_button(button)) {
......@@ -43,6 +44,7 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg)
fl_set_object_color(button, FL_RED, FL_RED);
}
}
static void dl_traffic_on_off( FL_OBJECT *button, long arg)
{
if (fl_get_button(button)) {
......@@ -140,6 +142,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fdui->lte_phy_scope_enb->fdui = fdui;
return fdui;
}
void phy_scope_eNB(FD_lte_phy_scope_enb *form,
PHY_VARS_eNB *phy_vars_enb,
int UE_id)
......@@ -325,7 +328,9 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
free(bit);
free(chest_f_abs);
}
FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) {
FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
{
FL_OBJECT *obj;
FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui );
// Define form
......@@ -429,11 +434,13 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) {
fdui->lte_phy_scope_ue->fdui = fdui;
return fdui;
}
void phy_scope_UE(FD_lte_phy_scope_ue *form,
PHY_VARS_UE *phy_vars_ue,
int eNB_id,
int UE_id,
uint8_t subframe){
uint8_t subframe)
{
int i,arx,atx,ind,k;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti;
......@@ -492,14 +499,14 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) {
mod0 = get_Qm(mcs0);
coded_bits_per_codeword0 = get_G(frame_parms,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even,
get_Qm(mcs0),
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl,
num_pdcch_symbols,
frame,
subframe,
beamforming_mode);
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even,
get_Qm(mcs0),
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl,
num_pdcch_symbols,
frame,
subframe,
beamforming_mode);
} else {
coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti);
mod0=0;
......@@ -507,14 +514,14 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) {
mod1 = get_Qm(mcs1);
coded_bits_per_codeword1 = get_G(frame_parms,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even,
get_Qm(mcs1),
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl,
num_pdcch_symbols,
frame,
subframe,
beamforming_mode);
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb,
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even,
get_Qm(mcs1),
phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl,
num_pdcch_symbols,
frame,
subframe,
beamforming_mode);
} else {
coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti);
mod1=0;
......@@ -526,9 +533,14 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
chest_t_abs[arx] = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float));
}
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // init to zero
//llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error.
llr0 = (float*) malloc(coded_bits_per_codeword0*sizeof(float));
memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero
bit0 = malloc(coded_bits_per_codeword0*sizeof(float));
llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // init to zero
//llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error.
llr1 = (float*) malloc(coded_bits_per_codeword1*sizeof(float));
memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero
bit1 = malloc(coded_bits_per_codeword1*sizeof(float));
llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero
bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
......@@ -822,6 +834,4 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
for (int m=0; m<coded_bits_per_codeword1; ++m)
phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0;
}*/
}
}
......@@ -898,39 +898,6 @@ typedef struct THREAD_STRUCT_s {
PARALLEL_CONF_t parallel_conf;
WORKER_CONF_t worker_conf;
} THREAD_STRUCT;
/*extern THREAD_STRUCT thread_struct;
static inline void set_parallel_conf(char *parallel_conf) {
mapping config[]= {
FOREACH_PARALLEL(GENERATE_ENUMTXT)
{NULL,-1}
};
thread_struct.parallel_conf = (PARALLEL_CONF_t)map_str_to_int(config, parallel_conf);
if (thread_struct.parallel_conf == -1 ) {
LOG_E(ENB_APP,"Impossible value: %s\n", parallel_conf);
thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
}
}
static inline void set_worker_conf(char *worker_conf) {
mapping config[]={
FOREACH_WORKER(GENERATE_ENUMTXT)
{NULL, -1}
};
thread_struct.worker_conf = (WORKER_CONF_t)map_str_to_int(config, worker_conf);
if (thread_struct.worker_conf == -1 ) {
LOG_E(ENB_APP,"Impossible value: %s\n", worker_conf);
thread_struct.worker_conf = WORKER_DISABLE ;
}
}
static inline PARALLEL_CONF_t get_thread_parallel_conf(void) {
return thread_struct.parallel_conf;
}
static inline WORKER_CONF_t get_thread_worker_conf(void) {
return thread_struct.worker_conf;
}*/
typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;
......
......@@ -1134,6 +1134,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx;
uint32_t harq_pid0 = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
int rvidx_tab[4] = {0,2,3,1};
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
ulsch = eNB->ulsch[i];
......@@ -1150,8 +1151,8 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
if ((ulsch) &&
(ulsch->rnti>0) &&
(ulsch_harq->status == ACTIVE) &&
(ulsch_harq->frame == frame) &&
(ulsch_harq->subframe == subframe) &&
((ulsch_harq->frame == frame) || (ulsch_harq->repetition_number >1) ) &&
((ulsch_harq->subframe == subframe) || (ulsch_harq->repetition_number >1) ) &&
(ulsch_harq->handled == 0)) {
// UE has ULSCH scheduling
for (int rb=0;
......@@ -1208,6 +1209,10 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
ulsch_harq->cqi_crc_status,
ulsch_harq->O_ACK,
eNB->ulsch_decoding_stats.p_time, eNB->ulsch_decoding_stats.max);
if (ulsch_harq->repetition_number < ulsch_harq->total_number_of_repetitions){
ulsch_harq->rvidx = rvidx_tab[(ulsch_harq->repetition_number%4)] ; // Set the correct rvidx for the next emtc repetitions
ulsch_harq->repetition_number +=1 ; // Increment repetition_number for the next ULSCH allocation
}
//compute the expected ULSCH RX power (for the stats)
ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
......@@ -1263,7 +1268,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
*/
ulsch_harq->handled = 1;
} // ulsch in error
else {
else if(ulsch_harq->repetition_number == ulsch_harq->total_number_of_repetitions){
fill_crc_indication(eNB,i,frame,subframe,0); // indicate ACK to MAC
fill_rx_indication(eNB,i,frame,subframe); // indicate SDU to MAC
ulsch_harq->status = SCH_IDLE;
......
......@@ -3022,7 +3022,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
&format_found,
crc_scrambled_values);
#ifdef NR_PDCCH_SCHED_DEBUG
printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%d\n",dci_cnt);
printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT);
......
......@@ -922,7 +922,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
/* a valid resource has already be found outside this function */
resource_set_found = TRUE;
ready_pucch_resource_id = TRUE;
pucch_resource_indicator = pucch_resource_indicator;
//pucch_resource_indicator = pucch_resource_indicator;
}
if (resource_set_found == TRUE) {
......
......@@ -35,38 +35,30 @@
#include <unistd.h>
#include <execinfo.h>
#include <signal.h>
#include "SIMULATION/TOOLS/sim.h"
#include "common/config/config_load_configmodule.h"
#include "common/utils/LOG/log.h"
#include "LAYER2/MAC/mac_vars.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_vars.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_common_vars.h"
#include "LAYER2/MAC/mac_vars.h"
#include "OCG_vars.h"
#include "common/utils/LOG/log.h"
#include "UTIL/LISTS/list.h"
#include "unitary_defs.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#include "dummy_functions.c"
#include "PHY/INIT/phy_init.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
#include "PHY/MODULATION/modulation_common.h"
#include "PHY/MODULATION/modulation_eNB.h"
#include "PHY/MODULATION/modulation_UE.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_common_vars.h"
#include "SCHED_UE/sched_UE.h"
#include "common/config/config_load_configmodule.h"
#include "PHY/INIT/phy_init.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "SIMULATION/TOOLS/sim.h"
#include "UTIL/LISTS/list.h"
#include "OCG_vars.h"
#include "unitary_defs.h"
#include "dummy_functions.c"
#include "executables/thread-common.h"
void feptx_ofdm(RU_t *ru, int frame, int subframe);
void feptx_prec(RU_t *ru, int frame, int subframe);
......@@ -85,30 +77,6 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
//THREAD_STRUCT thread_struct;
static THREAD_STRUCT thread_struct;
void set_parallel_conf(char *parallel_conf) {
if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
}
void set_worker_conf(char *worker_conf) {
if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
}
PARALLEL_CONF_t get_thread_parallel_conf(void) {
return thread_struct.parallel_conf;
}
WORKER_CONF_t get_thread_worker_conf(void) {
return thread_struct.worker_conf;
}
int emulate_rf = 0;
void handler(int sig) {
......@@ -122,8 +90,6 @@ void handler(int sig) {
exit(1);
}
//DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_2A[2];
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_1E[2];
......
......@@ -58,7 +58,7 @@
#define BW 5.0
PHY_VARS_eNB *PHY_vars_eNB,*PHY_vars_eNB1,*PHY_vars_eNB2;
PHY_VARS_eNB *PHY_vars_eNB, *PHY_vars_eNB1, *PHY_vars_eNB2;
PHY_VARS_UE *PHY_vars_UE[2];
#define DLSCH_RB_ALLOC 0x1fff // igore DC component,RB13
......@@ -699,7 +699,7 @@ int main(int argc, char **argv) {
bzero(txdataF2[0],FRAME_LENGTH_BYTES_NO_PREFIX);
bzero(txdataF2[1],FRAME_LENGTH_BYTES_NO_PREFIX);
#else
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[eNb_id];
txdata = PHY_vars_eNB->common_vars.txdataF[eNb_id];
txdata1 = PHY_vars_eNB1->lte_eNB_common_vars.txdata[eNb_id];
txdata2 = PHY_vars_eNB2->lte_eNB_common_vars.txdata[eNb_id];
#endif
......
......@@ -33,30 +33,28 @@
#include <string.h>
#include <math.h>
#include <unistd.h>
#include "SIMULATION/TOOLS/sim.h"
#include "LAYER2/MAC/mac_vars.h"
#include "PHY/types.h"
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_vars.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#include "SCHED/sched_common_vars.h"
#include "SCHED/sched_eNB.h"
#include "SCHED_UE/sched_UE.h"
#include "LAYER2/MAC/mac_vars.h"
#include "SIMULATION/TOOLS/sim.h"
#include "OCG_vars.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
#include "PHY/INIT/phy_init.h"
#include "unitary_defs.h"
#include "PHY/TOOLS/lte_phy_scope.h"
#include "dummy_functions.c"
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/config/config_load_configmodule.h"
#include "executables/thread-common.h"
#include "targets/RT/USER/lte-softmodem.h"
double cpuf;
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
//#define MCS_COUNT 23//added for PHY abstraction
......@@ -96,7 +94,6 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
nfapi_tx_request_t TX_req;
Sched_Rsp_t sched_resp;
THREAD_STRUCT thread_struct;
void
fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
......
......@@ -57,6 +57,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode = 0;
uint16_t NB_UE_INST = 1;
// needed for some functions
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
......@@ -439,7 +440,7 @@ int main(int argc, char **argv)
mod_order = nr_get_Qm(Imcs, 1);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
printf("available bits %d TBS %d mod_order %d\n", available_bits, TBS, mod_order);
printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
//dlsch->harq_ids[subframe]= 0;
rel15->n_prb = nb_rb;
rel15->nb_symbols = nb_symb_sch;
......@@ -475,7 +476,7 @@ int main(int argc, char **argv)
//estimated_output = harq_process->b;
#ifdef DEBUG_NR_DLSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]);
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif
/*for (int i=0; i<TBS/8; i++)
......@@ -565,7 +566,7 @@ int main(int argc, char **argv)
if (errors_bit > 0) {
n_false_positive++;
if (n_trials == 1)
printf("errors_bit %d (trial %d)\n", errors_bit, trial);
printf("errors_bit %u (trial %d)\n", errors_bit, trial);
}
}
......
......@@ -64,6 +64,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode=0;
uint16_t NB_UE_INST = 1;
//Dummy Functions
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms, unsigned char subframe) {return(SF_DL);}
......@@ -81,7 +82,7 @@ int main(int argc, char **argv)
{
char c;
int i,aa;//,l;
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
uint8_t snr1set=0;
int **txdata;
double **s_re,**s_im,**r_re,**r_im;
......@@ -736,7 +737,7 @@ int main(int argc, char **argv)
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15.nb_layers);
printf("\n");
printf("available_bits = %d\n",available_bits);
printf("available_bits = %u\n", available_bits);
for (i = 0; i < available_bits; i++) {
......@@ -775,7 +776,7 @@ int main(int argc, char **argv)
if (errors_bit > 0) {
n_false_positive++;
if (n_trials == 1)
printf("errors_bit = %d (trial %d)\n", errors_bit, trial);
printf("errors_bit = %u (trial %d)\n", errors_bit, trial);
}
printf("\n");
......
......@@ -41,7 +41,7 @@ void exit_function(const char* file, const char* function, const int line, const
exit(-1);
}
char quantize(double D, double x, unsigned char B) {
signed char quantize(double D, double x, unsigned char B) {
double qxd;
short maxlev;
qxd = floor(x / D);
......
......@@ -56,6 +56,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode=0;
uint16_t NB_UE_INST = 1;
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
......
......@@ -54,6 +54,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode=0;
uint16_t NB_UE_INST = 1;
// needed for some functions
PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
......
......@@ -56,6 +56,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode = 0;
uint16_t NB_UE_INST = 1;
// needed for some functions
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
......@@ -388,8 +389,8 @@ int main(int argc, char **argv)
mod_order = nr_get_Qm(Imcs, 1);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
printf("\n");
printf("available bits %d TBS %d mod_order %d\n", available_bits, TBS, mod_order);
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
/////////// setting rel15_ul parameters ///////////
rel15_ul->number_rbs = nb_rb;
......@@ -451,7 +452,7 @@ int main(int argc, char **argv)
////////////////////////////////////////////////////////////////////////////////////////////
#ifdef DEBUG_NR_ULSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]);
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif
/////////////////////////ULSCH coding/////////////////////////
......@@ -542,7 +543,7 @@ int main(int argc, char **argv)
if (errors_bit > 0) {
n_false_positive++;
if (n_trials == 1)
printf("errors_bit %d (trial %d)\n", errors_bit, trial);
printf("errors_bit %u (trial %d)\n", errors_bit, trial);
}
printf("\n");
}
......
......@@ -64,6 +64,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
int nfapi_mode = 0;
uint16_t NB_UE_INST = 1;
// dummy functions
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
......
This diff is collapsed.
......@@ -147,7 +147,7 @@ typedef struct {
/// Rice factor???
/// Walls (penetration loss)
/// Nodes in the scenario
node_desc_t* nodes;
node_desc_t *nodes;
} scenario_desc_t;
typedef enum {
......@@ -180,29 +180,66 @@ typedef enum {
EPA_medium,
EPA_high,
} SCM_t;
#define CHANNELMOD_MAP_INIT \
{"custom",custom},\
{"SCM_A",SCM_A},\
{"SCM_B",SCM_B},\
{"SCM_C",SCM_C},\
{"SCM_D",SCM_D},\
{"EPA",EPA},\
{"EVA",EVA},\
{"ETU",ETU},\
{"MBSFN",MBSFN},\
{"Rayleigh8",Rayleigh8},\
{"Rayleigh1",Rayleigh1},\
{"Rayleigh1_800",Rayleigh1_800},\
{"Rayleigh1_corr",Rayleigh1_corr},\
{"Rayleigh1_anticorr",Rayleigh1_anticorr},\
{"Rice8",Rice8},\
{"Rice1",Rice1},\
{"Rice1_corr",Rice1_corr},\
{"Rice1_anticorr",Rice1_anticorr},\
{"AWGN",AWGN},\
{"Rayleigh1_orthogonal",Rayleigh1_orthogonal},\
{"Rayleigh1_orth_eff_ch_TM4_prec_real",Rayleigh1_orth_eff_ch_TM4_prec_real},\
{"Rayleigh1_orth_eff_ch_TM4_prec_imag",Rayleigh1_orth_eff_ch_TM4_prec_imag},\
{"Rayleigh8_orth_eff_ch_TM4_prec_real",Rayleigh8_orth_eff_ch_TM4_prec_real},\
{"Rayleigh8_orth_eff_ch_TM4_prec_imag",Rayleigh8_orth_eff_ch_TM4_prec_imag},\
{"TS_SHIFT",TS_SHIFT},\
{"EPA_low",EPA_low},\
{"EPA_medium",EPA_medium},\
{"EPA_high",EPA_high},\
{NULL, -1}
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CHANNELMOD_SECTION "channelmod"
#define CHANNELMOD_PARAMS_DESC { \
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB , defdblval:25, TYPE_DOUBLE, 0},\
{"sinr_dB", NULL , 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
}
#include "platform_constants.h"
typedef struct {
channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
double r_re_DL[NUMBER_OF_UE_MAX][2][30720];
double r_im_DL[NUMBER_OF_UE_MAX][2][30720];
double r_re_UL[NUMBER_OF_eNB_MAX][2][30720];
double r_im_UL[NUMBER_OF_eNB_MAX][2][30720];
int RU_output_mask[NUMBER_OF_UE_MAX];
int UE_output_mask[NUMBER_OF_RU_MAX];
pthread_mutex_t RU_output_mutex[NUMBER_OF_UE_MAX];
pthread_mutex_t UE_output_mutex[NUMBER_OF_RU_MAX];
pthread_mutex_t subframe_mutex;
int subframe_ru_mask;
int subframe_UE_mask;
openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp last_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
double ru_amp[NUMBER_OF_RU_MAX];
pthread_t rfsim_thread;
channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
double r_re_DL[NUMBER_OF_UE_MAX][2][30720];
double r_im_DL[NUMBER_OF_UE_MAX][2][30720];
double r_re_UL[NUMBER_OF_eNB_MAX][2][30720];
double r_im_UL[NUMBER_OF_eNB_MAX][2][30720];
int RU_output_mask[NUMBER_OF_UE_MAX];
int UE_output_mask[NUMBER_OF_RU_MAX];
pthread_mutex_t RU_output_mutex[NUMBER_OF_UE_MAX];
pthread_mutex_t UE_output_mutex[NUMBER_OF_RU_MAX];
pthread_mutex_t subframe_mutex;
int subframe_ru_mask;
int subframe_UE_mask;
openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp last_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
double ru_amp[NUMBER_OF_RU_MAX];
pthread_t rfsim_thread;
} sim_t;
......@@ -395,23 +432,40 @@ void multipath_tv_channel(channel_desc_t *desc,
/**@} */
/**@} */
void rxAddInput( struct complex16 *input_sig,
struct complex16 *after_channel_sig,
int rxAnt,
channel_desc_t *channelDesc,
int nbSamples,
uint64_t TS,
uint32_t CirSize
);
int modelid_fromname(char *modelname);
double channelmod_get_snr_dB(void);
double channelmod_get_sinr_dB(void);
void init_channelmod(void) ;
double N_RB2sampling_rate(uint16_t N_RB);
double N_RB2channel_bandwidth(uint16_t N_RB);
//#include "targets/RT/USER/rfsim.h"
#include "targets/RT/USER/rfsim.h"
void do_DL_sig(sim_t *sim,
uint16_t subframe,
uint32_t offset,
uint32_t length,
uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *ue_frame_parms,
uint8_t abstraction_flag,
LTE_DL_FRAME_PARMS *ue_frame_parms,
uint8_t UE_id,
int CC_id);
void do_UL_sig(sim_t *sim,
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int ru_id,uint8_t CC_id);
uint16_t subframe,
uint8_t abstraction_flag,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
int ru_id,
uint8_t CC_id);
#endif
......@@ -274,6 +274,7 @@ typedef struct RrcConfigurationReq_s {
long *pdsch_maxNumRepetitionCEmodeB_r13 [MAX_NUM_CCs];
long *pusch_maxNumRepetitionCEmodeA_r13 [MAX_NUM_CCs];
long *pusch_maxNumRepetitionCEmodeB_r13 [MAX_NUM_CCs];
long *pusch_repetitionLevelCEmodeA_r13 [MAX_NUM_CCs];
long *pusch_HoppingOffset_v1310 [MAX_NUM_CCs];
//SIB18
......
......@@ -55,11 +55,8 @@
#include "RRC_config_tools.h"
#include "enb_paramdef.h"
#include "proto_agent.h"
#include "executables/thread-common.h"
extern void set_parallel_conf(char *parallel_conf);
extern void set_worker_conf(char *worker_conf);
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw);
extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw);
extern char *parallel_config;
......
......@@ -859,6 +859,21 @@ void fill_eMTC_configuration(MessageDef *msg_p, ccparams_eMTC_t *eMTCconfig, in
config_fname);
}
RRC_CONFIGURATION_REQ(msg_p).pusch_repetitionLevelCEmodeA_r13[cc_idx] = CALLOC(1, sizeof(long));
if (!strcmp(eMTCconfig->pusch_repetitionLevelCEmodeA_r13, "l1")) {
*RRC_CONFIGURATION_REQ(msg_p).pusch_repetitionLevelCEmodeA_r13[cc_idx] = 0;
} else if (!strcmp(eMTCconfig->pusch_repetitionLevelCEmodeA_r13, "l2")) {
*RRC_CONFIGURATION_REQ(msg_p).pusch_repetitionLevelCEmodeA_r13[cc_idx] = 1;
} else if (!strcmp(eMTCconfig->pusch_repetitionLevelCEmodeA_r13, "l3")) {
*RRC_CONFIGURATION_REQ(msg_p).pusch_repetitionLevelCEmodeA_r13[cc_idx] = 2;
} else if (!strcmp(eMTCconfig->pusch_repetitionLevelCEmodeA_r13, "l4")) {
*RRC_CONFIGURATION_REQ(msg_p).pusch_repetitionLevelCEmodeA_r13[cc_idx] = 3;
} else {
AssertFatal (0,
"Failed to parse eNB configuration file %s, pusch_repetitionLevelCEmodeA_r13 unknown value!\n",
config_fname);
}
char rachCELevelInfoListPath[MAX_OPTNAME_SIZE * 2];
config_getlist(&rachcelevellist, NULL, 0, brparamspath);
RRC_CONFIGURATION_REQ (msg_p).rach_CE_LevelInfoList_r13_size[cc_idx] = rachcelevellist.numelt;
......
This diff is collapsed.
......@@ -64,6 +64,7 @@
#define ENB_CONFIG_STRING_PDSCH_MAX_NUM_REPETITION_CE_MODE_B_R13 "pdsch_maxNumRepetitionCEmodeB_r13"
#define ENB_CONFIG_STRING_PUSCH_MAX_NUM_REPETITION_CE_MODE_A_R13 "pusch_maxNumRepetitionCEmodeA_r13"
#define ENB_CONFIG_STRING_PUSCH_MAX_NUM_REPETITION_CE_MODE_B_R13 "pusch_maxNumRepetitionCEmodeB_r13"
#define ENB_CONFIG_STRING_PUSCH_REPETITION_LEVEL_CE_MODE_A_R13 "pusch_repetitionLevelCEmodeA_r13"
#define ENB_CONFIG_STRING_PUSCH_HOPPING_OFFSET_V1310 "pusch_HoppingOffset_v1310"
#define ENB_CONFIG_STRING_SYSTEM_INFO_VALUE_TAG_LIST "system_info_value_tag_SI"
#define ENB_CONFIG_STRING_FIRST_PREAMBLE_R13 "firstPreamble_r13"
......@@ -161,6 +162,7 @@ typedef struct ccparams_eMTC_s {
char *pdsch_maxNumRepetitionCEmodeB_r13;
char *pusch_maxNumRepetitionCEmodeA_r13;
char *pusch_maxNumRepetitionCEmodeB_r13;
char *pusch_repetitionLevelCEmodeA_r13;
} ccparams_eMTC_t;
......@@ -230,6 +232,7 @@ typedef struct ccparams_eMTC_s {
{ENB_CONFIG_STRING_PRACH_HOPPING_OFFSET_R13, NULL, 0, iptr:&eMTCconfig->prach_HoppingOffset_r13, defintval:0, TYPE_INT, 0}, \
{ENB_CONFIG_STRING_PDSCH_MAX_NUM_REPETITION_CE_MODE_A_R13, NULL, 0, strptr:&eMTCconfig->pdsch_maxNumRepetitionCEmodeA_r13, defstrval:"r16", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_PUSCH_MAX_NUM_REPETITION_CE_MODE_A_R13, NULL, 0, strptr:&eMTCconfig->pusch_maxNumRepetitionCEmodeA_r13, defstrval:"r8", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_PUSCH_REPETITION_LEVEL_CE_MODE_A_R13, NULL, 0, strptr:&eMTCconfig->pusch_repetitionLevelCEmodeA_r13, defstrval:"l1", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_CELL_SELECTION_INFO_CE_R13, NULL, 0, strptr:&eMTCconfig->cellSelectionInfoCE_r13, defstrval:"ENABLE", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_Q_RX_LEV_MIN_CE_R13, NULL, 0, iptr:&eMTCconfig->q_RxLevMinCE_r13, defintval:-70, TYPE_INT, 0}, \
{ENB_CONFIG_STRING_BANDWIDTH_REDUCED_ACCESS_RELATED_INFO_R13, NULL, 0, strptr:&eMTCconfig->bandwidthReducedAccessRelatedInfo_r13, defstrval:"ENABLE", TYPE_STRING, 0}, \
......
......@@ -59,7 +59,7 @@
//#include "RRC_config_tools.h"
#include "gnb_paramdef.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "executables/thread-common.h"
#include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h"
#include "NR_FrequencyInfoUL.h"
......@@ -77,10 +77,7 @@
#include "NR_EUTRA-MBSFN-SubframeConfig.h"
extern uint16_t sf_ahead;
extern void set_parallel_conf(char *parallel_conf);
extern void set_worker_conf(char *worker_conf);
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void);
extern int config_check_band_frequencies(int ind, int16_t band, uint32_t downlink_frequency,
int32_t uplink_frequency_offset, uint32_t frame_type);
......
......@@ -68,6 +68,7 @@
extern RAN_CONTEXT_t RC;
extern const uint8_t pusch_repetition_Table8_2_36213[3][4];
extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
......@@ -98,6 +99,7 @@ void
add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
sub_frame_t subframeP) {
eNB_MAC_INST *mac = RC.mac[module_idP];
eNB_RRC_INST *rrc = RC.rrc[module_idP];
COMMON_channels_t *cc = &mac->common_channels[CC_id];
uint8_t j;
nfapi_ul_config_request_t *ul_req;
......@@ -108,6 +110,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
uint8_t sf_ahead_dl;
uint8_t rvseq[4] = {0, 2, 3, 1};
uint8_t pusch_maxNumRepetitionCEmodeA_r13;
ul_req = &mac->UL_req_tmp[CC_id][ra->Msg3_subframe];
ul_req_body = &ul_req->ul_config_request_body;
AssertFatal(ra->state != IDLE, "RA is not active for RA %X\n",
......@@ -139,7 +142,13 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL (ra->msg3_mcs, ra->msg3_nb_rb);
// Re13 fields
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ra->rach_resource_type > 2 ? 2 : 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = 1;
if (ra->rach_resource_type > 0) {
pusch_maxNumRepetitionCEmodeA_r13= *(rrc->configuration.pusch_maxNumRepetitionCEmodeA_r13[CC_id]);
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions= pusch_repetition_Table8_2_36213[pusch_maxNumRepetitionCEmodeA_r13][ra->pusch_repetition_levels];
}
else{
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions=1;
}
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
ul_req_body->number_of_pdus++;
......@@ -235,6 +244,7 @@ void generate_Msg2(module_id_t module_idP,
//------------------------------------------------------------------------------
{
eNB_MAC_INST *mac = RC.mac[module_idP];
eNB_RRC_INST *rrc = RC.rrc[module_idP];
COMMON_channels_t *cc = mac->common_channels;
uint8_t *vrb_map = NULL;
int first_rb = 0;
......@@ -246,6 +256,7 @@ void generate_Msg2(module_id_t module_idP,
dl_req_body = &mac->DL_req[CC_idP].dl_config_request_body;
dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
uint8_t PUSCH_Rep_Level;
int rmax = 0;
int rep = 0;
int reps = 0;
......@@ -257,6 +268,13 @@ void generate_Msg2(module_id_t module_idP,
uint16_t absSF = (10 * frameP) + subframeP;
uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
if (ra->rach_resource_type > 0) {
PUSCH_Rep_Level= *(rrc->configuration.pusch_repetitionLevelCEmodeA_r13[CC_idP]);
}
else {
PUSCH_Rep_Level= 0;
}
if (absSF > absSF_Msg2) {
return; // we're not ready yet
}
......@@ -396,6 +414,8 @@ void generate_Msg2(module_id_t module_idP,
ra->msg2_mpdcch_repetition_cnt++;
}
ra->pusch_repetition_levels = PUSCH_Rep_Level;
if((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
/* Program PDSCH */
LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n",
......@@ -1218,6 +1238,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
UE_id = find_UE_id(module_idP, ra->rnti);
DevAssert(UE_id != -1);
mac->UE_list.UE_template[UE_PCCID(module_idP, UE_id)][UE_id].configured = TRUE;
mac->UE_list.UE_template[UE_PCCID(module_idP, UE_id)][UE_id].pusch_repetition_levels=ra->pusch_repetition_levels;
cancel_ra_proc(module_idP, CC_idP, frameP, ra->rnti);
}
}
......
......@@ -84,6 +84,14 @@ uint8_t rb_table[34] = {
81, 90, 96, 100 // 30-33
};
// This table hold the possible number of MTC repetition for CE ModeA
const uint8_t pusch_repetition_Table8_2_36213[3][4]=
{
{1 , 2 , 4 , 8 },
{1 , 4 , 8 , 16},
{1 , 4 , 16, 32}
};
extern mui_t rrc_eNB_mui;
//-----------------------------------------------------------------------------
......@@ -293,16 +301,22 @@ rx_sdu(const module_id_t enb_mod_idP,
if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
} else {
// first_rb = UE_template_ptr->first_rb_ul[harq_pid]; // UE_id = -1 !!!!
ra->msg3_round++;
/* Prepare handling of retransmission */
get_Msg3allocret(&mac->common_channels[CC_idP],
ra->Msg3_subframe,
ra->Msg3_frame,
&ra->Msg3_frame,
&ra->Msg3_subframe);
// prepare handling of retransmission
add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP);
if (ra->rach_resource_type > 0) {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // TODO: Currently we don't support retransmission of Msg3 ( If in error Cancel RA procedure and reattach)
}
else
{
// first_rb = UE_template_ptr->first_rb_ul[harq_pid]; // UE_id = -1 !!!!
ra->msg3_round++;
/* Prepare handling of retransmission */
get_Msg3allocret(&mac->common_channels[CC_idP],
ra->Msg3_subframe,
ra->Msg3_frame,
&ra->Msg3_frame,
&ra->Msg3_subframe);
// prepare handling of retransmission
add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP);
}
}
/* TODO: program NACK for PHICH? */
......@@ -1925,10 +1939,13 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
int tpc = 0;
int cqi_req = 0;
eNB_MAC_INST *eNB = RC.mac[module_idP];
eNB_RRC_INST *rrc = RC.rrc[module_idP];
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list = &(eNB->UE_list);
UE_TEMPLATE *UE_template = NULL;
UE_sched_ctrl_t *UE_sched_ctrl = NULL;
uint8_t Total_Num_Rep_ULSCH,pusch_maxNumRepetitionCEmodeA_r13;
uint8_t UL_Scheduling_DCI_SF,UL_Scheduling_DCI_Frame_Even_Odd_Flag; //TODO: To be removed after scheduler relaxation Task
if (sched_subframeP < subframeP) {
sched_frame++;
......@@ -1937,11 +1954,9 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
nfapi_hi_dci0_request_body_t *hi_dci0_req = &(eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body);
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = NULL;
nfapi_ul_config_request_body_t *ul_req_tmp = &(eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body);
/* If frameP odd don't schedule */
if ((frameP & 1) == 1) {
return;
}
nfapi_ul_config_request_body_t *ul_req_body_Rep;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
nfapi_ul_config_request_pdu_t *ul_config_pdu_Rep;
/* Loop over all active UEs */
for (UE_id = UE_list->head_ul; UE_id >= 0; UE_id = UE_list->next_ul[UE_id]) {
......@@ -1999,8 +2014,18 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->estimated_ul_buffer;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO, UE_template->estimated_ul_buffer);
pusch_maxNumRepetitionCEmodeA_r13= *(rrc->configuration.pusch_maxNumRepetitionCEmodeA_r13[CC_id]);
Total_Num_Rep_ULSCH = pusch_repetition_Table8_2_36213[pusch_maxNumRepetitionCEmodeA_r13][UE_template->pusch_repetition_levels];
UL_Scheduling_DCI_SF = (40-4 - Total_Num_Rep_ULSCH)%10; //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task
UL_Scheduling_DCI_Frame_Even_Odd_Flag= ! (((40-4 - Total_Num_Rep_ULSCH)/10 )%2); //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task
/* If frameP odd don't schedule */
if ((frameP&1) == UL_Scheduling_DCI_Frame_Even_Odd_Flag) //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task
{
//if ((UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0) && (subframeP == 5)) {
if ((UE_template->ul_SR > 0 || round_UL > 0 || status < RRC_CONNECTED) && (subframeP == 5)) {
if ((UE_template->ul_SR > 0 || round_UL > 0 || status < RRC_CONNECTED) && (subframeP == UL_Scheduling_DCI_SF)) {
/*
* if there is information on bsr of DCCH, DTCH,
* or if there is UL_SR,
......@@ -2151,7 +2176,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB = 3
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = UE_template->pusch_repetition_levels;
AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off,
"epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13;
......@@ -2201,7 +2226,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
);
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
UE_template->rach_resource_type > 2 ? 2 : 1,
1, // total_number_of_repetitions
Total_Num_Rep_ULSCH, // total_number_of_repetitions
1, // repetition_number
(frameP * 10) + subframeP);
ul_req_tmp->number_of_pdus++;
......@@ -2330,5 +2355,24 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP,
}
} // UE_is_to_be_scheduled
} // ULCCs
} // loop over UE_id
} // loop over UE_id
} // Schedule new ULSCH
// This section is to repeat ULSCH PDU for a number of MTC repetitions
for(int i=0;i<ul_req_tmp->number_of_pdus;i++)
{
ul_config_pdu = &ul_req_tmp->ul_config_pdu_list[i];
if (ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) // Repeat ULSCH PDUs only
continue ;
if(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number < ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions)
{
ul_req_body_Rep = &eNB->UL_req_tmp[CC_id][(sched_subframeP+1)%10].ul_config_request_body;
ul_config_pdu_Rep = &ul_req_body_Rep->ul_config_pdu_list[ul_req_body_Rep->number_of_pdus];
memcpy ((void *) ul_config_pdu_Rep, ul_config_pdu, sizeof (nfapi_ul_config_request_pdu_t));
ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel8.handle = eNB->ul_handle++;
ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel13.repetition_number = ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number +1;
ul_req_body_Rep->number_of_pdus++;
} //repetition_number < total_number_of_repetitions
} // For loop on PDUs
}
......@@ -904,9 +904,11 @@ typedef struct {
uint16_t mpdcch_repetition_cnt;
frame_t Msg2_frame;
sub_frame_t Msg2_subframe;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// Repetition column in pusch_repetition Table 8.2.b in TS36.213
uint8_t pusch_repetition_levels;
#endif
LTE_PhysicalConfigDedicated_t *physicalConfigDedicated;
} UE_TEMPLATE;
/*! \brief scheduling control information set through an API (not used)*/
......@@ -1113,7 +1115,10 @@ typedef struct {
uint8_t msg2_narrowband;
uint8_t msg34_narrowband;
int msg4_rrc_sdu_length;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// Repetition column in pusch_repetition Table 8.2.b in TS36.213
uint8_t pusch_repetition_levels;
#endif
int32_t crnti_rrc_mui;
int8_t crnti_harq_pid;
} RA_t;
......
......@@ -26,7 +26,6 @@
* \version 1.0
* \email navid.nikaein@eurecom.fr
* @ingroup _mac
*/
......@@ -102,7 +101,6 @@ MAC_RLC_XFACE *Mac_rlc_xface;
int pCC_id[NUMBER_OF_eNB_MAX];
eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
......@@ -126,7 +124,6 @@ DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
DCI1C_5MHz_t MCCH_alloc_pdu;
DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
......
......@@ -125,7 +125,6 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
COMMON_channels_t *cc = &eNB->common_channels[CC_id];
uint8_t *rar = (uint8_t *)(dlsch_buffer + 1);
uint32_t rballoc = 0;
uint32_t reps = 0;
uint32_t ULdelay = 0;
uint32_t cqireq = 0;
uint32_t mpdcch_nb_index = 0;
......@@ -151,7 +150,6 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
input_buffer_length = 6;
N_NB_index = get_numnarrowbandbits(cc->mib->message.dl_Bandwidth);
/* UL Grant */
reps = 0;
ra->msg3_mcs = 7;
TPC = 3; // no power increase
ULdelay = 0;
......@@ -161,7 +159,7 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
uint32_t buffer = 0;
buffer |= ra->msg34_narrowband << (16 + (4 - N_NB_index));
buffer |= ((rballoc & 0x0F) << (12 + (4 - N_NB_index)));
buffer |= ((reps & 0x03) << (10 + (4 - N_NB_index)));
buffer |= ((ra->pusch_repetition_levels & 0x03) << (10 + (4 - N_NB_index)));
buffer |= ((ra->msg3_mcs & 0x07) << (7 + (4 - N_NB_index)));
buffer |= ((TPC & 0x07) << (4 + (4 - N_NB_index)));
buffer |= ((cqireq & 0x01) << (3 + (4 - N_NB_index)));
......
......@@ -110,13 +110,12 @@ void nas_COMMON_receive(uint16_t dlen,
#ifdef NAS_ADDRESS_FIX
// Make the third byte of both the source and destination equal to the fourth of the destination
unsigned char * ifaddr, *saddr, daddr;
uint32_t odaddr = 0, osaddr;
daddr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
odaddr = ((struct iphdr *)skb->data)->daddr;
// sn = addr[3];
//sn = addr[3];
saddr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
uint32_t odaddr,osaddr;
osaddr = ((struct iphdr *)skb->data)->saddr;
if (daddr[0] == saddr[0]) {// same network
......
......@@ -117,7 +117,7 @@ void fn_rrc (void) {
case RRCI_CX_ESTABLISH_RESP: {
rrci_cx_establish_resp_t *p = (rrci_cx_establish_resp_t *) Data;
unsigned char CH_index,i;
unsigned char i, CH_index = 0;
msg( "[RRCI]>[RRC][Inst %d]:RRCI_CX_ESTABLISH_RESP\n",Header->inst);
for(i=0; i<NB_SIG_CNX_UE; i++)
......@@ -185,6 +185,3 @@ void fn_rrc (void) {
}
}
}
......@@ -74,8 +74,8 @@ typedef guint8 gboolean;
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
#define OPT_PARAMS_DESC { \
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
}
#define OPTTYPE_IDX 0
......
......@@ -224,9 +224,9 @@ int size_dist(
return size_data;
}
int adjust_size(int size)
{
if (size<PAYLOAD_MIN) {
LOG_W(OTG,"Packet Size=%d out of range, size=%d \n", size, PAYLOAD_MIN);
size=PAYLOAD_MIN;
......@@ -239,9 +239,6 @@ int adjust_size(int size)
}
unsigned char *packet_gen(
const int src_instance,
const int dst_instance,
......@@ -391,22 +388,20 @@ unsigned char *packet_gen(
}
unsigned char *packet_gen_multicast(
const int src_instance,
const int dst_instance,
const int ctime,
unsigned int * const pkt_size)
{
*pkt_size =0;
unsigned int size=0;
unsigned int buffer_size =0;
*pkt_size = 0;
unsigned int size = 0;
unsigned int buffer_size = 0;
char *payload=NULL;
char *header=NULL;
unsigned int flag;
int app,seq_num=0;
int otg_hdr_size= sizeof(otg_hdr_info_t) + sizeof(otg_hdr_t);
unsigned int flag = 0;
int app, seq_num = 0;
int otg_hdr_size = sizeof(otg_hdr_info_t) + sizeof(otg_hdr_t);
set_ctime(ctime); // fixme: this should be done separetly from packet_gen and packet_gen_multicast
......@@ -488,7 +483,9 @@ unsigned char *packet_gen_multicast(
payload,
buffer_size,
0/*g_otg_multicast->application_type[src_instance][dst][app]*/,
flag, 0, ctime,
flag,
0,
ctime,
seq_num,
0,
HDR_IP_v4_MIN+HDR_UDP,
......
......@@ -37,8 +37,8 @@
#if defined(ENB_MODE)
# include "common/utils/LOG/log.h"
# define SCTP_ERROR(x, args...) LOG_E(SCTP, x, ##args)
# define SCTP_WARN(x, args...) LOG_W(SCTP, x, ##args)
# define SCTP_DEBUG(x, args...) LOG_I(SCTP, x, ##args)
# define SCTP_WARN(x, args...) LOG_W(SCTP, x, ##args)
#else
# define SCTP_ERROR(x, args...) do { fprintf(stderr, "[SCTP][E]"x, ##args); } while(0)
# define SCTP_DEBUG(x, args...) do { fprintf(stdout, "[SCTP][D]"x, ##args); } while(0)
......
......@@ -717,8 +717,7 @@ static int sctp_create_new_listener(
SCTP_DEBUG("ipv4 addresses:\n");
for (i = 0; i < init_p->nb_ipv4_addr; i++) {
SCTP_DEBUG("\t- "IPV4_ADDR"\n",
IPV4_ADDR_FORMAT(init_p->ipv4_address[i]));
SCTP_DEBUG("\t- "IPV4_ADDR"\n", IPV4_ADDR_FORMAT(init_p->ipv4_address[i]));
ip4_addr = (struct sockaddr_in *)&addr[i];
ip4_addr->sin_family = AF_INET;
ip4_addr->sin_port = htons(init_p->port);
......
......@@ -41,9 +41,9 @@
/* name of shared library implementing the transport */
#define OAI_TP_LIBNAME "oai_transpro"
/* name of shared library implementing the basic/rf simulator */
#define OAI_RFSIM_LIBNAME "rfsimulator"
#define OAI_RFSIM_LIBNAME "rfsimulator"
/* name of shared library implementing the basic/rf simulator */
#define OAI_BASICSIM_LIBNAME "tcp_bridge_oai"
#define OAI_BASICSIM_LIBNAME "tcp_bridge_oai"
/* flags for BBU to determine whether the attached radio head is local or remote */
#define RAU_LOCAL_RADIO_HEAD 0
#define RAU_REMOTE_RADIO_HEAD 1
......@@ -420,7 +420,6 @@ typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_
#define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size)
#define sample_t struct complex16 // 2*16 bits complex number
typedef struct {
uint64_t magic; // Magic value (see defines above)
......@@ -446,8 +445,6 @@ typedef struct {
#define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size)
#define sample_t struct complex16 // 2*16 bits complex number
#ifdef __cplusplus
extern "C"
{
......
......@@ -42,11 +42,11 @@
#include <net/if.h>
#include <netinet/ether.h>
#define MAX_INST 4
#define DEFAULT_IF "lo"
#define MAX_INST 4
#define DEFAULT_IF "lo"
#define TX_FLAG 1
#define RX_FLAG 0
#define TX_FLAG 1
#define RX_FLAG 0
#include "if_defs.h"
#define APP_HEADER_SIZE_BYTES (sizeof(int32_t) + sizeof(openair0_timestamp))
......
#General
This is an RF simulator that allows to test OAI without an RF board.
# General
This is an RF simulator that allows to test OAI without an RF board. It replaces an actual RF board driver.
It replaces an actual RF board driver.
As much as possible, it works like an RF board, but not in real-time: It can run faster than real-time if there is enough CPU, or slower (it is CPU-bound instead of real-time RF sampling-bound).
As much as possible, it works like an RF board, but not in realtime: It can run faster than realtime if there is enough CPU or slower (it is CPU bound instead of real time RF sampling bound)
# build
#build
## From [build_oai](../../../doc/BUILD.md) script
The RF simulator is implemented as an OAI device and always built when you build the OAI eNB or the OAI UE.
## From build_oai
You can build it the same way, and together with actual RF driver
Using the `-w SIMU` option it is possible to just re-build the RF simulator device.
Example:
```bash
./build_oai --ue-nas-use-tun --UE --eNB -w SIMU
./build_oai --UE --eNB
Will compile UE
Will compile eNB
CMAKE_CMD=cmake ..
No local radio head and no transport protocol selected
No radio head has been selected (HW set to None)
No transport protocol has been selected (TP set to None)
RF HW set to None
Flags for Deadline scheduler: False
......................
......................
Compiling rfsimulator
Log file for compilation has been written to: /usr/local/oai/rfsimu_config/openairinterface5g/cmake_targets/log/rfsimulator.Rel15.txt
rfsimulator compiled
......................
......................
```
It is also possible to build actual RF and use choose on each run:
```bash
./build_oai --ue-nas-use-tun --UE --eNB -w USRP --rfsimulator
```
Will build both the eNB (lte-softmodem) and the UE (lte-uesoftmodem)
We recommend using the option --ue-nas-use-tun that is much simpler to use than the OAI kernel driver.
## Add the rfsimulator after initial build
After any regular build, you can compile the driver
After any regular build you can compile the device from the build directory:
```bash
cd <the_compilation_dir_from_build_oai_script>/build
cd <path to oai sources>/openairinterface5g/cmake_targets/ran_build/build
make rfsimulator
```
Then, you can use it freely
This is equivalent to using `-w SIMU` when running the `build_oai` script.
# Usage
Setting the env variable RFSIMULATOR enables the RF board simulator. It should be set to "server" in the eNB or gNB.
To use the RF simulator add the `--rfsim` option to the command line. By default the RF simulator device will try to connect to host 127.0.0.1, port 4043, which is usually the behavior for the UE.
The RF simulator is using the configuration module, and its parameters are defined in a specific section called "rfsimulator".
| parameter | usage | default |
|:---------------------|:------------------------------------------------------------------------------------------------------------------|----:|
| serveraddr | ip address to connect to, or "enb" to behave as a tcp server | 127.0.0.1 |
| serverport | port number to connect to or to listen on (eNB, which behaves as a tcp server) | 4043 |
| options | list of comma separated run-time options, two are supported: `chanmod` to enable channel modeling and `saviq` to write transmitted iqs to a file | all options disabled |
| modelname | Name of the channel model to apply on received iqs when the `chanmod` option is enabled | AWGN |
| IQfile | Path to the file to be used to store iqs, when the `saviq` option is enabled | /tmp/rfsimulator.iqs |
Setting the env variable RFSIMULATOR can be used instead of using the serveraddr parameter; it is to preserve compatibility with previous version.
## 4G case
For the UE, it should be set to the IP address of the eNB
example:
For the UE, it should be set to the IP address of the eNB. For example:
```bash
sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50
```
For the eNodeB, use a valid configuration file setup for USRP board tests and start the softmodem as usual, **but** adding the `--rfsim` option.
For the eNB, use a valid configuration file setup for the USRP board tests and start the softmodem as usual, **but**, adding the `--rfsim` option.
```bash
sudo RFSIMULATOR=enb ./lte-softmodem -O <config file> --rfsim
```
Except this, the UE and the eNB can be used as if the RF is real
If you reach 'RA not active' on UE, be careful to generate a valid SIM
Except this, the UE and the eNB can be used as if the RF is real. noS1 mode can also be used with the RF simulator.
If you reach 'RA not active' on UE, be careful to generate a valid SIM.
```bash
$OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .
```
## 5G case
After regular build, add the simulation driver
(don't use ./build_oai -w SIMU until we merge 4G and 5G branches)
The 5G RF simulator will be aligned with the 4G as the efforts for merging the 5G specific branches into the develop make progresses.
After regular build, add the simulation driver (do not use ./build_oai -w SIMU until 4G and 5G branches are merged).
```bash
cd ran_build/build
make rfsimulator
......@@ -77,46 +95,40 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C 3510000000
Of course, set the gNB machine IP address if the UE and the gNB are not on the same machine.
In UE, you can add "-d" to get the softscope
In the UE, you can add `-d` option to get the softscope.
### Store and replay
You can store emitted I/Q samples:
If you set the environment variable: saveIQfile to a file name
The simulator will write all IQ samples into this file
You can store emitted I/Q samples. If you set the option `saviq`, the simulator will write all the I/Q samples into this file. Then, you can replay with the executable `replay_node`.
Then, you can replay with the executable "replay_node"
First compile it, as the other binaries
```
First compile it like other binaries:
```bash
make replay_node
```
You can use this binary as I/Q data source to feed whatever UE or NB with recorded I/Q samples.
You can use this binary as I/Q data source to feed whatever UE or gNB with recorded I/Q samples.
The file format is successive blocks of a header followed by the I/Q array.
If you have existing stored I/Q, you can adpat the tool "replay_node" to convert your format to the rfsimulator format.
The file format is successive blocks of a header followed by the I/Q array. If you have existing stored I/Q, you can adapt the tool `replay_node` to convert your format to the rfsimulator format.
The format intend to be compatible with the OAI store/replay feature on USRP
The format intends to be compatible with the OAI store/replay feature on USRP.
### Channel simulation
The RF channel simulator is called.
In current version all channel paramters are hard coded in the call to:
When the `chanmod` option is enabled, the RF channel simulator is called.
In the current version all channel parameters are set depending on the model name via a call to:
```bash
new_channel_desc_scm(bridge->tx_num_channels,
bridge->rx_num_channels,
AWGN,
<model name>,
bridge->sample_rate,
bridge->tx_bw,
0.0, // forgetting_factor
0, // maybe used for TA
0); // path_loss in dB
0, // maybe used for TA
0); // path_loss in dB
```
Only the input noise can be changed on command line with the `-s` parameter.
Only the input noise can be changed on command line with -s parameter.
With path loss = 0 set "-s 5" to see a little noise.
With path loss = 0 set `-s 5` to see a little noise. `-s` is a shortcut to `channelmod.s`. It is expected to enhance the channel modelization flexibility by the addition of more parameters in the channelmod section.
## Caveats
Still issues in power control: txgain, rxgain are not used
# Caveats
Still issues in power control: txgain, rxgain are not used.
/*
Author: Laurent THOMAS, Open Cells for Nokia
copyleft: OpenAirInterface Software Alliance and it's licence
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <errno.h>
#include <common/utils/assertions.h>
#include <common/utils/LOG/log.h>
#include <common/config/config_userapi.h>
#include <openair1/SIMULATION/TOOLS/sim.h>
/*
Legacy study:
The parameters are:
gain&loss (decay, signal power, ...)
either a fixed gain in dB, a target power in dBm or ACG (automatic control gain) to a target average
=> don't redo the AGC, as it was used in UE case, that must have a AGC inside the UE
will be better to handle the "set_gain()" called by UE to apply it's gain (enable test of UE power loop)
lin_amp = pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas);
a lot of operations in legacy, grouped in one simulation signal decay: txgain*decay*rxgain
multi_path (auto convolution, ISI, ...)
either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes
legacy: we regenerate each sub frame in UL, and each frame only in DL
*/
void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_sig,
int rxAnt,
channel_desc_t *channelDesc,
int nbSamples,
uint64_t TS,
uint32_t CirSize
) {
// channelDesc->path_loss_dB should contain the total path gain
// so, in actual RF: tx gain + path loss + rx gain (+antenna gain, ...)
// UE and NB gain control to be added
// Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...)
const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0);
// Energy in one sample to calibrate input noise
//Fixme: modified the N0W computation, not understand the origin value
const double KT=1.38e-23*290; //Boltzman*temperature
// sampling rate is linked to acquisition band (the input pass band filter)
const double noise_figure_watt = KT*channelDesc->sampling_rate;
// Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ?
// the parameter "-s" is declared as SNR, but the input power is not well defined
// −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise)
const double rxGain= 132.24 - channelmod_get_snr_dB();
// sqrt(4*noise_figure_watt) is the thermal noise factor (volts)
// fixme: the last constant is pure trial results to make decent noise
const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10;
// Fixme: we don't fill the offset length samples at begining ?
// anyway, in today code, channel_offset=0
const int dd = abs(channelDesc->channel_offset);
const int nbTx=channelDesc->nb_tx;
for (int i=0; i<((int)nbSamples-dd); i++) {
struct complex16 *out_ptr=after_channel_sig+dd+i;
struct complex rx_tmp= {0};
for (int txAnt=0; txAnt < nbTx; txAnt++) {
const struct complex *channelModel= channelDesc->ch[rxAnt+(txAnt*channelDesc->nb_rx)];
//const struct complex *channelModelEnd=channelModel+channelDesc->channel_length;
for (int l = 0; l<(int)channelDesc->channel_length; l++) {
// let's assume TS+i >= l
// fixme: the rfsimulator current structure is interleaved antennas
// this has been designed to not have to wait a full block transmission
// but it is not very usefull
// it would be better to split out each antenna in a separate flow
// that will allow to mix ru antennas freely
struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize];
rx_tmp.x += tx16.r * channelModel[l].x - tx16.i * channelModel[l].y;
rx_tmp.y += tx16.i * channelModel[l].x + tx16.r * channelModel[l].y;
} //l
}
out_ptr->r += round(rx_tmp.x*pathLossLinear + noise_per_sample*gaussdouble(0.0,1.0));
out_ptr->i += round(rx_tmp.y*pathLossLinear + noise_per_sample*gaussdouble(0.0,1.0));
out_ptr++;
}
if ( (TS*nbTx)%CirSize+nbSamples <= CirSize )
// Cast to a wrong type for compatibility !
LOG_D(HW,"Input power %f, output power: %f, channel path loss %f, noise coeff: %f \n",
10*log10((double)signal_energy((int32_t *)&input_sig[(TS*nbTx)%CirSize], nbSamples)),
10*log10((double)signal_energy((int32_t *)after_channel_sig, nbSamples)),
channelDesc->path_loss_dB,
10*log10(noise_per_sample));
}
This diff is collapsed.
......@@ -5,6 +5,7 @@
#include <common/utils/simple_executable.h>
volatile int oai_exit = 0;
void fullwrite(int fd, void *_buf, int count) {
char *buf = _buf;
......@@ -123,7 +124,7 @@ int main(int argc, char *argv[]) {
setblocking(serviceSock, blocking);
AssertFatal(read(fd,&header,sizeof(header)), "");
fullwrite(serviceSock, &header, sizeof(header));
int dataSize=sizeof(sample_t)*header.size*header.nbAnt;
int dataSize=sizeof(int32_t)*header.size*header.nbAnt;
if (dataSize>bufSize) {
void * new_buff = realloc(buff, dataSize);
......
......@@ -230,6 +230,7 @@ eNBs =
pdsch_maxNumRepetitionCEmodeA_r13 = "r16"; #0
pusch_repetitionLevelCEmodeA_r13 = "l1"; #0
#pdsch_maxNumRepetitionCEmodeB_r13 = "r384"; # NULL - 2
pusch_maxNumRepetitionCEmodeA_r13 = "r8"; #0
......
......@@ -275,12 +275,24 @@ NETWORK_CONTROLLER :
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
/*
#example config for rfsimulator
rfsimulator :
{
serveraddr = "enb";
serverport = "4043";
options = ("saviq");
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
*/
log_config :
{
global_log_level ="info";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment