Merge remote-tracking branch 'develop'
This commit is contained in:
@@ -266,6 +266,42 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('Log Collection') {
|
stage('Log Collection') {
|
||||||
parallel {
|
parallel {
|
||||||
|
stage('Log Collection (eNB - Build)') {
|
||||||
|
steps {
|
||||||
|
withCredentials([
|
||||||
|
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
|
||||||
|
]) {
|
||||||
|
echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m'
|
||||||
|
sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}"
|
||||||
|
|
||||||
|
echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m'
|
||||||
|
sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
if(fileExists("build.log.${env.BUILD_ID}.zip")) {
|
||||||
|
archiveArtifacts "build.log.${env.BUILD_ID}.zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Log Collection (OAI UE - Build)') {
|
||||||
|
steps {
|
||||||
|
echo '\u2705 \u001B[32mLog Collection (OAI UE - Build)\u001B[0m'
|
||||||
|
withCredentials([
|
||||||
|
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
|
||||||
|
]) {
|
||||||
|
sh "python3 ci-scripts/main.py --mode=LogCollectBuild --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}"
|
||||||
|
|
||||||
|
echo '\u2705 \u001B[32mLog Transfer (UE - Build)\u001B[0m'
|
||||||
|
sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
if(fileExists("build.log.${env.BUILD_ID}.zip")) {
|
||||||
|
archiveArtifacts "build.log.${env.BUILD_ID}.zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Log Collection (eNB - Run)') {
|
stage('Log Collection (eNB - Run)') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ if [ $# -eq 0 ]
|
|||||||
then
|
then
|
||||||
echo " ---- Checking the whole repository ----"
|
echo " ---- Checking the whole repository ----"
|
||||||
echo ""
|
echo ""
|
||||||
NB_FILES_TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt --recursive *.c *.h | grep -c Formatted `
|
NB_FILES_TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt --recursive *.c *.h | grep -c Formatted || true`
|
||||||
echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT"
|
echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT"
|
||||||
echo $NB_FILES_TO_FORMAT > ./oai_rules_result.txt
|
echo $NB_FILES_TO_FORMAT > ./oai_rules_result.txt
|
||||||
|
|
||||||
@@ -67,17 +67,17 @@ then
|
|||||||
awk '/#[ \t]*ifndef/ { gsub("^.*ifndef *",""); if (names[$1]!="") print "files with same {define ", FILENAME, names[$1]; names[$1]=FILENAME } /#[ \t]*define/ { gsub("^.*define *",""); if(names[$1]!=FILENAME) print "error in declaration", FILENAME, $1, names[$1]; nextfile }' `find openair* common targets executables -name *.h |grep -v LFDS` > header-files-w-incorrect-define.txt
|
awk '/#[ \t]*ifndef/ { gsub("^.*ifndef *",""); if (names[$1]!="") print "files with same {define ", FILENAME, names[$1]; names[$1]=FILENAME } /#[ \t]*define/ { gsub("^.*define *",""); if(names[$1]!=FILENAME) print "error in declaration", FILENAME, $1, names[$1]; nextfile }' `find openair* common targets executables -name *.h |grep -v LFDS` > header-files-w-incorrect-define.txt
|
||||||
|
|
||||||
# Testing if explicit GNU GPL license banner
|
# Testing if explicit GNU GPL license banner
|
||||||
egrep -irl --exclude-dir=.git --include=*.cpp --include=*.c --include=*.h "General Public License" . > files-w-gnu-gpl-license-banner.txt
|
egrep -irl --exclude-dir=.git --include=*.cpp --include=*.c --include=*.h "General Public License" . | egrep -v "openair3/NAS/COMMON/milenage.h" > files-w-gnu-gpl-license-banner.txt
|
||||||
|
|
||||||
# Looking at exotic/suspect banner
|
# Looking at exotic/suspect banner
|
||||||
LIST_OF_FILES_W_BANNER=`egrep -irl --exclude-dir=.git --include=*.cpp --include=*.c --include=*.h "Copyright|copyleft" .`
|
LIST_OF_FILES_W_BANNER=`egrep -irl --exclude-dir=.git --include=*.cpp --include=*.c --include=*.h "Copyright|copyleft" .`
|
||||||
if [ -f ./files-w-suspect-banner.txt ]; then rm -f ./files-w-suspect-banner.txt; fi
|
if [ -f ./files-w-suspect-banner.txt ]; then rm -f ./files-w-suspect-banner.txt; fi
|
||||||
for FILE in $LIST_OF_FILES_W_BANNER
|
for FILE in $LIST_OF_FILES_W_BANNER
|
||||||
do
|
do
|
||||||
IS_NFAPI=`echo $FILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext"`
|
IS_NFAPI=`echo $FILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true`
|
||||||
IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FILE`
|
IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FILE || true`
|
||||||
IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FILE`
|
IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FILE || true`
|
||||||
IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_"`
|
IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair3/NAS/COMMON/milenage.h" || true`
|
||||||
if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ]
|
if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ]
|
||||||
then
|
then
|
||||||
if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ]
|
if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ]
|
||||||
@@ -178,7 +178,7 @@ do
|
|||||||
EXT="${filename##*.}"
|
EXT="${filename##*.}"
|
||||||
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
|
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
|
||||||
then
|
then
|
||||||
TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted `
|
TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted || true`
|
||||||
NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT))
|
NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT))
|
||||||
if [ $TO_FORMAT -ne 0 ]
|
if [ $TO_FORMAT -ne 0 ]
|
||||||
then
|
then
|
||||||
@@ -186,15 +186,19 @@ do
|
|||||||
echo $FULLFILE >> ./oai_rules_result_list.txt
|
echo $FULLFILE >> ./oai_rules_result_list.txt
|
||||||
fi
|
fi
|
||||||
# Testing if explicit GNU GPL license banner
|
# Testing if explicit GNU GPL license banner
|
||||||
egrep -i "General Public License" $FULLFILE >> files-w-gnu-gpl-license-banner.txt
|
GNU_EXCEPTION=`echo $FULLFILE | egrep -c "openair3/NAS/COMMON/milenage.h" || true`
|
||||||
|
if [ $GNU_EXCEPTION -eq 0 ]
|
||||||
|
then
|
||||||
|
egrep -il "General Public License" $FULLFILE >> files-w-gnu-gpl-license-banner.txt
|
||||||
|
fi
|
||||||
# Looking at exotic/suspect banner
|
# Looking at exotic/suspect banner
|
||||||
IS_BANNER=`egrep -i -c "Copyright|copyleft" $FULLFILE`
|
IS_BANNER=`egrep -i -c "Copyright|copyleft" $FULLFILE || true`
|
||||||
if [ $IS_BANNER -ne 0 ]
|
if [ $IS_BANNER -ne 0 ]
|
||||||
then
|
then
|
||||||
IS_NFAPI=`echo $FULLFILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext"`
|
IS_NFAPI=`echo $FULLFILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true`
|
||||||
IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FULLFILE`
|
IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FULLFILE || true`
|
||||||
IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FULLFILE`
|
IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FULLFILE || true`
|
||||||
IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_"`
|
IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair3/NAS/COMMON/milenage.h" || true`
|
||||||
if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ]
|
if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ]
|
||||||
then
|
then
|
||||||
if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ]
|
if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ]
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ gNBs =
|
|||||||
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
|
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
|
||||||
#
|
#
|
||||||
msg1_SubcarrierSpacing = 1,
|
msg1_SubcarrierSpacing = 1,
|
||||||
|
|
||||||
# restrictedSetConfig
|
# restrictedSetConfig
|
||||||
# 0=unrestricted, 1=restricted type A, 2=restricted type B
|
# 0=unrestricted, 1=restricted type A, 2=restricted type B
|
||||||
restrictedSetConfig = 0,
|
restrictedSetConfig = 0,
|
||||||
|
|
||||||
# pusch-ConfigCommon (up to 16 elements)
|
# pusch-ConfigCommon (up to 16 elements)
|
||||||
initialULBWPk2_0 = 6;
|
initialULBWPk2_0 = 6;
|
||||||
initialULBWPmappingType_0 = 1
|
initialULBWPmappingType_0 = 1
|
||||||
|
|||||||
@@ -291,3 +291,6 @@ THREAD_STRUCT = (
|
|||||||
rrc_log_verbosity ="medium";
|
rrc_log_verbosity ="medium";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uicc: {
|
||||||
|
opc = "testopc";
|
||||||
|
};
|
||||||
|
|||||||
+18
-12
@@ -1220,6 +1220,8 @@ function start_rf_sim_gnb {
|
|||||||
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
|
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
|
||||||
echo "echo \"source oaienv\"" >> $1
|
echo "echo \"source oaienv\"" >> $1
|
||||||
echo "source oaienv" >> $1
|
echo "source oaienv" >> $1
|
||||||
|
echo "echo \"export RFSIMULATOR=server\"" >> $1
|
||||||
|
echo "export RFSIMULATOR=server" >> $1
|
||||||
echo "cd ci-scripts/conf_files/" >> $1
|
echo "cd ci-scripts/conf_files/" >> $1
|
||||||
echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
|
echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
|
||||||
#echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
|
#echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
|
||||||
@@ -1233,9 +1235,9 @@ function start_rf_sim_gnb {
|
|||||||
then
|
then
|
||||||
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
||||||
then
|
then
|
||||||
echo "echo \"RFSIMULATOR=server ./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1
|
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1
|
||||||
else #RA test => use --do-ra option
|
else #RA test => use --do-ra option
|
||||||
echo "echo \"RFSIMULATOR=server ./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1
|
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
|
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
|
||||||
@@ -1320,30 +1322,25 @@ function start_rf_sim_nr_ue {
|
|||||||
local LOC_RA_TEST=$8
|
local LOC_RA_TEST=$8
|
||||||
|
|
||||||
# Copy the RAW files from the gNB run
|
# Copy the RAW files from the gNB run
|
||||||
# In RA test mode, they were not copied from gNB VM
|
|
||||||
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
|
||||||
then
|
|
||||||
scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
|
scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
|
||||||
scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
|
scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
|
||||||
fi
|
|
||||||
|
|
||||||
echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
|
echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
|
||||||
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
|
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
|
||||||
|
echo "echo \"export RFSIMULATOR=${LOC_GNB_VM_IP_ADDR}\"" >> $1
|
||||||
|
echo "export RFSIMULATOR=${LOC_GNB_VM_IP_ADDR}" >> $1
|
||||||
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1
|
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1
|
||||||
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
||||||
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
|
||||||
then
|
|
||||||
echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
||||||
echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1
|
echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1
|
||||||
fi
|
|
||||||
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
||||||
if [ $LOC_S1_CONFIGURATION -eq 0 ]
|
if [ $LOC_S1_CONFIGURATION -eq 0 ]
|
||||||
then
|
then
|
||||||
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
|
||||||
then
|
then
|
||||||
echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
|
echo "echo \"./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
|
||||||
else #RA test => use --do-ra option
|
else #RA test => use --do-ra option
|
||||||
echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor\" > ./my-nr-softmodem-run.sh " >> $1
|
echo "echo \"./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/\" > ./my-nr-softmodem-run.sh " >> $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
|
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
|
||||||
@@ -2198,15 +2195,21 @@ function run_test_on_vm {
|
|||||||
PRB=106
|
PRB=106
|
||||||
FREQUENCY=3510
|
FREQUENCY=3510
|
||||||
|
|
||||||
|
if [ ! -d $ARCHIVES_LOC ]
|
||||||
|
then
|
||||||
|
mkdir --parents $ARCHIVES_LOC
|
||||||
|
fi
|
||||||
|
|
||||||
local try_cnt="0"
|
local try_cnt="0"
|
||||||
NR_STATUS=0
|
NR_STATUS=0
|
||||||
|
|
||||||
######### start of RA TEST loop
|
######### start of RA TEST loop
|
||||||
while [ $try_cnt -lt 10 ] #10 because it hardly succeed within CI
|
while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
|
||||||
do
|
do
|
||||||
|
|
||||||
SYNC_STATUS=0
|
SYNC_STATUS=0
|
||||||
RA_STATUS=0
|
RA_STATUS=0
|
||||||
|
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_test.log
|
||||||
|
|
||||||
echo "############################################################"
|
echo "############################################################"
|
||||||
echo "${CN_CONFIG} : Starting the gNB"
|
echo "${CN_CONFIG} : Starting the gNB"
|
||||||
@@ -2271,6 +2274,9 @@ function run_test_on_vm {
|
|||||||
SYNC_STATUS=0
|
SYNC_STATUS=0
|
||||||
PING_STATUS=0
|
PING_STATUS=0
|
||||||
IPERF_STATUS=0
|
IPERF_STATUS=0
|
||||||
|
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ue.log
|
||||||
|
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
|
||||||
|
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_ul*txt
|
||||||
|
|
||||||
echo "############################################################"
|
echo "############################################################"
|
||||||
echo "${CN_CONFIG} : Starting the gNB"
|
echo "${CN_CONFIG} : Starting the gNB"
|
||||||
|
|||||||
+194
-129
@@ -23,6 +23,114 @@
|
|||||||
|
|
||||||
cmake_minimum_required (VERSION 3.0)
|
cmake_minimum_required (VERSION 3.0)
|
||||||
|
|
||||||
|
|
||||||
|
# System packages that are required
|
||||||
|
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
|
||||||
|
# or cmake provide a generic interface to pkg-config that widely used
|
||||||
|
###################################
|
||||||
|
include(FindPkgConfig)
|
||||||
|
|
||||||
|
pkg_search_module(LIBXML2 libxml-2.0 REQUIRED)
|
||||||
|
include_directories(${LIBXML2_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
pkg_search_module(LIBXSLT libxslt REQUIRED)
|
||||||
|
include_directories(${LIBXSLT_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
pkg_search_module(OPENSSL openssl REQUIRED)
|
||||||
|
include_directories(${OPENSSL_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
pkg_search_module(CONFIG libconfig REQUIRED)
|
||||||
|
include_directories(${CONFIG_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
pkg_search_module(CRYPTO libcrypto REQUIRED)
|
||||||
|
include_directories(${CRYPTO_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
#use native cmake method as this package is not in pkg-config
|
||||||
|
if (${RF_BOARD} STREQUAL "OAI_USRP")
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
include_directories(${LIBBOOST_INCLUDE_DIR})
|
||||||
|
|
||||||
|
elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
|
||||||
|
include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
|
||||||
|
include_directories("/usr/local/include/")
|
||||||
|
set(HW_SOURCE ${HW_SOURCE}
|
||||||
|
${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp)
|
||||||
|
LINK_DIRECTORIES("/usr/local/lib")
|
||||||
|
set(option_HW_lib "-lSoapySDR -rdynamic -ldl")
|
||||||
|
|
||||||
|
endif (${RF_BOARD} STREQUAL "OAI_USRP")
|
||||||
|
|
||||||
|
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
|
||||||
|
if(NOT ${OPENPGM_FOUND})
|
||||||
|
message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
|
||||||
|
else()
|
||||||
|
include_directories(${OPENPGM_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
pkg_search_module(NETTLE nettle)
|
||||||
|
if(NOT ${NETTLE_FOUND})
|
||||||
|
message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!")
|
||||||
|
else()
|
||||||
|
include_directories(${NETTLE_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION})
|
||||||
|
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION})
|
||||||
|
message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}")
|
||||||
|
message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}")
|
||||||
|
|
||||||
|
if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "")
|
||||||
|
message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
|
||||||
|
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
|
||||||
|
|
||||||
|
pkg_search_module(XPM xpm)
|
||||||
|
if(NOT ${XPM_FOUND})
|
||||||
|
message("PACKAGE xpm not found: some targets will fail")
|
||||||
|
else()
|
||||||
|
include_directories(${XPM_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Atlas is required by some packages, but not found in pkg-config
|
||||||
|
# So, here are some hacks here. Hope this gets fixed in future!
|
||||||
|
if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
|
||||||
|
include_directories("/usr/include/atlas")
|
||||||
|
LINK_DIRECTORIES("/usr/lib/lapack")
|
||||||
|
LINK_DIRECTORIES("/usr/lib64")
|
||||||
|
LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here!
|
||||||
|
|
||||||
|
if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7
|
||||||
|
list(APPEND ATLAS_LIBRARIES blas)
|
||||||
|
|
||||||
|
else() # Case for Ubuntu
|
||||||
|
list(APPEND ATLAS_LIBRARIES cblas)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7
|
||||||
|
list(APPEND ATLAS_LIBRARIES tatlas)
|
||||||
|
else()
|
||||||
|
list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND ATLAS_LIBRARIES lapack)
|
||||||
|
|
||||||
|
# for ubuntu 17.10, directories are different
|
||||||
|
elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h")
|
||||||
|
|
||||||
|
include_directories("/usr/include/x86_64-linux-gnu")
|
||||||
|
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
|
||||||
|
list(APPEND ATLAS_LIBRARIES cblas)
|
||||||
|
list(APPEND ATLAS_LIBRARIES atlas)
|
||||||
|
list(APPEND ATLAS_LIBRARIES lapack)
|
||||||
|
|
||||||
|
else()
|
||||||
|
message("No Blas/Atlas libs found, some targets will fail")
|
||||||
|
endif()
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Base directories, compatible with legacy OAI building #
|
# Base directories, compatible with legacy OAI building #
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -232,8 +340,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
|
|||||||
#########################
|
#########################
|
||||||
# set a flag for changes in the source code
|
# set a flag for changes in the source code
|
||||||
# these changes are related to hardcoded path to include .h files
|
# these changes are related to hardcoded path to include .h files
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
|
||||||
|
|
||||||
set(GIT_BRANCH "UNKNOWN")
|
set(GIT_BRANCH "UNKNOWN")
|
||||||
@@ -302,7 +410,6 @@ set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
|
|||||||
add_library(ITTI
|
add_library(ITTI
|
||||||
${OCP_ITTI}/intertask_interface.cpp
|
${OCP_ITTI}/intertask_interface.cpp
|
||||||
${OPENAIR_DIR}/common/utils/backtrace.c
|
${OPENAIR_DIR}/common/utils/backtrace.c
|
||||||
${OPENAIR_DIR}/common/utils/memory_pools.c
|
|
||||||
)
|
)
|
||||||
add_dependencies(ITTI rrc_flag)
|
add_dependencies(ITTI rrc_flag)
|
||||||
set(ITTI_LIB ITTI)
|
set(ITTI_LIB ITTI)
|
||||||
@@ -378,6 +485,7 @@ add_custom_target (
|
|||||||
|
|
||||||
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
|
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
|
||||||
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
|
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
|
||||||
|
${OPENAIR2_DIR}/RRC/NR/nr_ngap_gNB.c
|
||||||
)
|
)
|
||||||
add_dependencies(NR_RRC_LIB nr_rrc_flag)
|
add_dependencies(NR_RRC_LIB nr_rrc_flag)
|
||||||
include_directories ("${NR_RRC_FULL_DIR}")
|
include_directories ("${NR_RRC_FULL_DIR}")
|
||||||
@@ -622,7 +730,7 @@ add_library(X2AP_ENB
|
|||||||
${X2AP_DIR}/x2ap_ids.c
|
${X2AP_DIR}/x2ap_ids.c
|
||||||
${X2AP_DIR}/x2ap_timers.c
|
${X2AP_DIR}/x2ap_timers.c
|
||||||
)
|
)
|
||||||
add_dependencies(X2AP_ENB rrc_flag x2_flag)
|
add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag)
|
||||||
|
|
||||||
|
|
||||||
# F1AP
|
# F1AP
|
||||||
@@ -813,7 +921,7 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}")
|
|||||||
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
|
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
|
||||||
|
|
||||||
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
|
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
|
||||||
add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
|
add_boolean_option(DEADLINE_SCHEDULER False "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
|
||||||
add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
|
add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
|
||||||
add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????")
|
add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????")
|
||||||
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
|
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
|
||||||
@@ -834,9 +942,9 @@ add_boolean_option(ENB_MODE True "Swap the include directories between openair2
|
|||||||
##########################
|
##########################
|
||||||
# SCHEDULING/REAL-TIME/PERF options
|
# SCHEDULING/REAL-TIME/PERF options
|
||||||
##########################
|
##########################
|
||||||
add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues")
|
add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME False "Add data in vcd traces: disable it if perf issues")
|
||||||
add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays")
|
add_boolean_option(ENABLE_VCD False "always true now, time measurements of proc calls and var displays")
|
||||||
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
|
add_boolean_option(ENABLE_VCD_FIFO False "time measurements of proc calls and var displays sent to FIFO (one more thread)")
|
||||||
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
|
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
|
||||||
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
|
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
|
||||||
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
|
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
|
||||||
@@ -1250,6 +1358,7 @@ set(SECU_OSA_SRC
|
|||||||
${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eia.c
|
${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eia.c
|
||||||
)
|
)
|
||||||
add_library(SECU_OSA ${SECU_OSA_SRC})
|
add_library(SECU_OSA ${SECU_OSA_SRC})
|
||||||
|
target_link_libraries(SECU_OSA ${NETTLE_LIBRARIES})
|
||||||
|
|
||||||
set(SECU_CN_SRC
|
set(SECU_CN_SRC
|
||||||
${OPENAIR3_DIR}/SECU/kdf.c
|
${OPENAIR3_DIR}/SECU/kdf.c
|
||||||
@@ -1263,6 +1372,8 @@ set(SECU_CN_SRC
|
|||||||
)
|
)
|
||||||
add_library(SECU_CN ${SECU_CN_SRC})
|
add_library(SECU_CN ${SECU_CN_SRC})
|
||||||
|
|
||||||
|
target_link_libraries(SECU_CN ${NETTLE_LIBRARIES})
|
||||||
|
|
||||||
# Physical Channel Procedures Scheduling
|
# Physical Channel Procedures Scheduling
|
||||||
################################"
|
################################"
|
||||||
set(SCHED_SRC
|
set(SCHED_SRC
|
||||||
@@ -1628,6 +1739,7 @@ set(PHY_SRC_UE
|
|||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/cic_filter_nr.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/cic_filter_nr.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
|
||||||
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
|
||||||
@@ -2047,6 +2159,11 @@ set (GTPV1U_SRC
|
|||||||
add_library(GTPV1U ${GTPV1U_SRC})
|
add_library(GTPV1U ${GTPV1U_SRC})
|
||||||
add_dependencies(GTPV1U rrc_flag)
|
add_dependencies(GTPV1U rrc_flag)
|
||||||
|
|
||||||
|
#add_library (GTPV1U_OCP
|
||||||
|
#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp
|
||||||
|
#)
|
||||||
|
#include_directories(${OPENAIR3_DIR}/ocp-gtp)
|
||||||
|
|
||||||
#NR case
|
#NR case
|
||||||
set (NR_GTPV1U_SRC
|
set (NR_GTPV1U_SRC
|
||||||
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
|
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
|
||||||
@@ -2350,6 +2467,14 @@ set (SHLIB_LOADER_SOURCES
|
|||||||
${OPENAIR_DIR}/common/utils/load_module_shlib.c
|
${OPENAIR_DIR}/common/utils/load_module_shlib.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_library(LIB_5GNAS_GNB
|
||||||
|
${NAS_SRC}/COMMON/nr_common.c
|
||||||
|
${NAS_SRC}/gNB/network_process_nas.c
|
||||||
|
${NAS_SRC}/NR_UE/ue_process_nas.c
|
||||||
|
${OPENAIR3_DIR}//UICC/usim_interface.c
|
||||||
|
)
|
||||||
|
target_link_libraries(LIB_5GNAS_GNB SECU_CN ${CRYPTO_LIBRARIES})
|
||||||
|
|
||||||
# Make lfds as a own source code (even if it is a outside library)
|
# Make lfds as a own source code (even if it is a outside library)
|
||||||
# For better intergration with compilation flags & structure of cmake
|
# For better intergration with compilation flags & structure of cmake
|
||||||
###################################################################
|
###################################################################
|
||||||
@@ -2426,114 +2551,6 @@ include_directories("${NFAPI_DIR}/nfapi/inc")
|
|||||||
include_directories("${NFAPI_DIR}/sim_common/inc")
|
include_directories("${NFAPI_DIR}/sim_common/inc")
|
||||||
include_directories("${NFAPI_DIR}/pnf_sim/inc")
|
include_directories("${NFAPI_DIR}/pnf_sim/inc")
|
||||||
|
|
||||||
|
|
||||||
# System packages that are required
|
|
||||||
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
|
|
||||||
# or cmake provide a generic interface to pkg-config that widely used
|
|
||||||
###################################
|
|
||||||
include(FindPkgConfig)
|
|
||||||
|
|
||||||
pkg_search_module(LIBXML2 libxml-2.0 REQUIRED)
|
|
||||||
include_directories(${LIBXML2_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
pkg_search_module(LIBXSLT libxslt REQUIRED)
|
|
||||||
include_directories(${LIBXSLT_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
pkg_search_module(OPENSSL openssl REQUIRED)
|
|
||||||
include_directories(${OPENSSL_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
pkg_search_module(CONFIG libconfig REQUIRED)
|
|
||||||
include_directories(${CONFIG_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
pkg_search_module(CRYPTO libcrypto REQUIRED)
|
|
||||||
include_directories(${CRYPTO_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
#use native cmake method as this package is not in pkg-config
|
|
||||||
if (${RF_BOARD} STREQUAL "OAI_USRP")
|
|
||||||
find_package(Boost REQUIRED)
|
|
||||||
include_directories(${LIBBOOST_INCLUDE_DIR})
|
|
||||||
|
|
||||||
elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
|
|
||||||
include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
|
|
||||||
include_directories("/usr/local/include/")
|
|
||||||
set(HW_SOURCE ${HW_SOURCE}
|
|
||||||
${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp)
|
|
||||||
LINK_DIRECTORIES("/usr/local/lib")
|
|
||||||
set(option_HW_lib "-lSoapySDR -rdynamic -ldl")
|
|
||||||
|
|
||||||
endif (${RF_BOARD} STREQUAL "OAI_USRP")
|
|
||||||
|
|
||||||
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
|
|
||||||
if(NOT ${OPENPGM_FOUND})
|
|
||||||
message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
|
|
||||||
else()
|
|
||||||
include_directories(${OPENPGM_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
pkg_search_module(NETTLE nettle)
|
|
||||||
if(NOT ${NETTLE_FOUND})
|
|
||||||
message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!")
|
|
||||||
else()
|
|
||||||
include_directories(${NETTLE_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}")
|
|
||||||
|
|
||||||
string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION})
|
|
||||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION})
|
|
||||||
message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}")
|
|
||||||
message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}")
|
|
||||||
|
|
||||||
if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "")
|
|
||||||
message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
|
|
||||||
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
|
|
||||||
|
|
||||||
pkg_search_module(XPM xpm)
|
|
||||||
if(NOT ${XPM_FOUND})
|
|
||||||
message("PACKAGE xpm not found: some targets will fail")
|
|
||||||
else()
|
|
||||||
include_directories(${XPM_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Atlas is required by some packages, but not found in pkg-config
|
|
||||||
# So, here are some hacks here. Hope this gets fixed in future!
|
|
||||||
if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
|
|
||||||
include_directories("/usr/include/atlas")
|
|
||||||
LINK_DIRECTORIES("/usr/lib/lapack")
|
|
||||||
LINK_DIRECTORIES("/usr/lib64")
|
|
||||||
LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here!
|
|
||||||
|
|
||||||
if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7
|
|
||||||
list(APPEND ATLAS_LIBRARIES blas)
|
|
||||||
|
|
||||||
else() # Case for Ubuntu
|
|
||||||
list(APPEND ATLAS_LIBRARIES cblas)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7
|
|
||||||
list(APPEND ATLAS_LIBRARIES tatlas)
|
|
||||||
else()
|
|
||||||
list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND ATLAS_LIBRARIES lapack)
|
|
||||||
|
|
||||||
# for ubuntu 17.10, directories are different
|
|
||||||
elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h")
|
|
||||||
|
|
||||||
include_directories("/usr/include/x86_64-linux-gnu")
|
|
||||||
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
|
|
||||||
list(APPEND ATLAS_LIBRARIES cblas)
|
|
||||||
list(APPEND ATLAS_LIBRARIES atlas)
|
|
||||||
list(APPEND ATLAS_LIBRARIES lapack)
|
|
||||||
|
|
||||||
else()
|
|
||||||
message("No Blas/Atlas libs found, some targets will fail")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND ATLAS_LIBRARIES lapack lapacke)
|
list(APPEND ATLAS_LIBRARIES lapack lapacke)
|
||||||
|
|
||||||
include_directories ("/usr/include/X11")
|
include_directories ("/usr/include/X11")
|
||||||
@@ -2640,6 +2657,12 @@ add_executable(measurement_display
|
|||||||
${OPENAIR_DIR}/common/utils/threadPool/measurement_display.c)
|
${OPENAIR_DIR}/common/utils/threadPool/measurement_display.c)
|
||||||
target_link_libraries (measurement_display minimal_lib)
|
target_link_libraries (measurement_display minimal_lib)
|
||||||
|
|
||||||
|
add_executable(test5Gnas
|
||||||
|
${OPENAIR_DIR}/openair3/TEST/test5Gnas.c
|
||||||
|
)
|
||||||
|
target_link_libraries (test5Gnas LIB_5GNAS_GNB CONFIG_LIB minimal_lib )
|
||||||
|
|
||||||
|
|
||||||
# lte-softmodem is both eNB and UE implementation
|
# lte-softmodem is both eNB and UE implementation
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
@@ -2681,7 +2704,7 @@ target_link_libraries (lte-softmodem
|
|||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
||||||
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (lte-softmodem ${T_LIB})
|
target_link_libraries (lte-softmodem ${T_LIB})
|
||||||
|
|
||||||
@@ -2720,7 +2743,7 @@ target_link_libraries (ocp-enb
|
|||||||
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
|
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
|
||||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
||||||
|
|
||||||
add_executable(cu_test
|
add_executable(cu_test
|
||||||
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
|
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
|
||||||
@@ -2792,7 +2815,7 @@ target_link_libraries (lte-uesoftmodem
|
|||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (lte-uesoftmodem ${T_LIB})
|
target_link_libraries (lte-uesoftmodem ${T_LIB})
|
||||||
|
|
||||||
@@ -2835,11 +2858,52 @@ target_link_libraries (nr-softmodem
|
|||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem ${T_LIB})
|
target_link_libraries (nr-softmodem ${T_LIB})
|
||||||
|
|
||||||
add_dependencies( nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
|
add_dependencies( nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
|
||||||
|
|
||||||
|
add_executable(ocp-gnb
|
||||||
|
${rrc_h}
|
||||||
|
${nr_rrc_h}
|
||||||
|
${s1ap_h}
|
||||||
|
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||||
|
${OPENAIR_DIR}/executables/ocp-gnb.c
|
||||||
|
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
|
||||||
|
${OPENAIR_DIR}/executables/softmodem-common.c
|
||||||
|
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||||
|
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||||
|
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
|
||||||
|
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||||
|
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
|
||||||
|
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||||
|
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||||
|
${OPENAIR_DIR}/common/utils/utils.c
|
||||||
|
${OPENAIR_DIR}/common/utils/system.c
|
||||||
|
${GTPU_need_ITTI}
|
||||||
|
${XFORMS_SOURCE_NR}
|
||||||
|
${T_SOURCE}
|
||||||
|
${CONFIG_SOURCES}
|
||||||
|
${SHLIB_LOADER_SOURCES}
|
||||||
|
${XFORMSINTERFACE_SOURCE}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries (ocp-gnb
|
||||||
|
-Wl,--start-group
|
||||||
|
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
|
||||||
|
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
|
||||||
|
S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||||
|
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
|
||||||
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
|
target_link_libraries (ocp-gnb ${LIBXML2_LIBRARIES} )
|
||||||
|
target_link_libraries (ocp-gnb pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
|
target_link_libraries (ocp-gnb ${LIB_LMS_LIBRARIES})
|
||||||
|
target_link_libraries (ocp-gnb ${T_LIB})
|
||||||
|
add_dependencies(ocp-gnb ldpc_orig ldpc_optim ldpc_optim8seg ldpc params_libconfig rfsimulator oai_usrpdevif rfsimulator nrscope)
|
||||||
|
|
||||||
|
|
||||||
# nr-uesoftmodem is UE implementation
|
# nr-uesoftmodem is UE implementation
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
@@ -2874,11 +2938,11 @@ target_link_libraries (nr-uesoftmodem
|
|||||||
RRC_LIB NR_RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
|
RRC_LIB NR_RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
|
||||||
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
|
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
|
||||||
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
|
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
|
||||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
||||||
|
|
||||||
@@ -3045,7 +3109,7 @@ add_executable(nr_dlsim
|
|||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
)
|
)
|
||||||
target_link_libraries(nr_dlsim
|
target_link_libraries(nr_dlsim
|
||||||
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR HASHTABLE -Wl,--end-group
|
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN -Wl,--end-group
|
||||||
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
|
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
|
||||||
)
|
)
|
||||||
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
|
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
|
||||||
@@ -3063,7 +3127,8 @@ add_executable(nr_prachsim
|
|||||||
${T_SOURCE}
|
${T_SOURCE}
|
||||||
${SHLIB_LOADER_SOURCES})
|
${SHLIB_LOADER_SOURCES})
|
||||||
target_link_libraries(nr_prachsim
|
target_link_libraries(nr_prachsim
|
||||||
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB MAC_UE_NR SCHED_NR_UE_LIB RRC_LIB NR_RRC_LIB L2_NR CONFIG_LIB HASHTABLE -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
|
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN -Wl,--end-group
|
||||||
|
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
|
||||||
|
|
||||||
add_executable(nr_ulschsim
|
add_executable(nr_ulschsim
|
||||||
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
|
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
|
||||||
@@ -3095,7 +3160,7 @@ add_executable(nr_ulsim
|
|||||||
${SHLIB_LOADER_SOURCES}
|
${SHLIB_LOADER_SOURCES}
|
||||||
)
|
)
|
||||||
target_link_libraries(nr_ulsim
|
target_link_libraries(nr_ulsim
|
||||||
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR PHY_NR_COMMON 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 HASHTABLE -Wl,--end-group
|
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN -Wl,--end-group
|
||||||
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
|
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
|
||||||
)
|
)
|
||||||
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
|
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
|
||||||
@@ -3130,7 +3195,7 @@ add_executable(test_epc_generate_scenario
|
|||||||
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
|
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
|
||||||
)
|
)
|
||||||
target_link_libraries (test_epc_generate_scenario
|
target_link_libraries (test_epc_generate_scenario
|
||||||
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB}
|
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(test_epc_play_scenario
|
add_executable(test_epc_play_scenario
|
||||||
@@ -3149,7 +3214,7 @@ add_executable(test_epc_play_scenario
|
|||||||
)
|
)
|
||||||
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
|
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
|
||||||
target_link_libraries (test_epc_play_scenario
|
target_link_libraries (test_epc_play_scenario
|
||||||
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB}
|
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -3169,7 +3234,7 @@ foreach(myExe s1ap
|
|||||||
${OPENAIR3_DIR}/TEST/test_${myExe}.c
|
${OPENAIR3_DIR}/TEST/test_${myExe}.c
|
||||||
)
|
)
|
||||||
target_link_libraries (test_${myExe}
|
target_link_libraries (test_${myExe}
|
||||||
-Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB}
|
-Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
|
||||||
)
|
)
|
||||||
endforeach(myExe)
|
endforeach(myExe)
|
||||||
|
|
||||||
@@ -3194,7 +3259,7 @@ if (${T_TRACER})
|
|||||||
SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
|
SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
|
||||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
|
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
|
||||||
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
||||||
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR
|
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR
|
||||||
CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
|
CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
|
||||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
|
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
|
||||||
if (TARGET ${i})
|
if (TARGET ${i})
|
||||||
|
|||||||
@@ -483,11 +483,6 @@ function main() {
|
|||||||
echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
|
echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
|
||||||
echo_info "Flags for CPU Affinity: $CPU_AFFINITY_FLAG_USER"
|
echo_info "Flags for CPU Affinity: $CPU_AFFINITY_FLAG_USER"
|
||||||
|
|
||||||
if [ -n "$UHD_IMAGES_DIR" ] && [ -z "$INSTALL_EXTERNAL" ]; then
|
|
||||||
echo_error "UHD images download settings will not be applied without -I present"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
# Setting and printing OAI envs, we should check here #
|
# Setting and printing OAI envs, we should check here #
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|||||||
+505
@@ -0,0 +1,505 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#/*
|
||||||
|
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
|
# * contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# * this work for additional information regarding copyright ownership.
|
||||||
|
# * The OpenAirInterface Software Alliance licenses this file to You under
|
||||||
|
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||||
|
# * except in compliance with the License.
|
||||||
|
# * You may obtain a copy of the License at
|
||||||
|
# *
|
||||||
|
# * http://www.openairinterface.org/?page_id=698
|
||||||
|
# *
|
||||||
|
# * Unless required by applicable law or agreed to in writing, software
|
||||||
|
# * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# * See the License for the specific language governing permissions and
|
||||||
|
# * limitations under the License.
|
||||||
|
# *-------------------------------------------------------------------------------
|
||||||
|
# * For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
|
# * contact@openairinterface.org
|
||||||
|
# */
|
||||||
|
|
||||||
|
# brief
|
||||||
|
# authors Laurent Thomas
|
||||||
|
#
|
||||||
|
#######################################
|
||||||
|
if [ ! -f /etc/os-release ]; then
|
||||||
|
echo "No /etc/os-release file found. You're likely on an unsupported distro."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
|
||||||
|
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
|
||||||
|
case "$OS_DISTRO" in
|
||||||
|
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt"; CMAKE="cmake" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
SUDO='sudo -E'
|
||||||
|
|
||||||
|
###############################
|
||||||
|
## echo and family
|
||||||
|
###############################
|
||||||
|
black='\E[30m'
|
||||||
|
red='\E[31m'
|
||||||
|
green='\E[32m'
|
||||||
|
yellow='\E[33m'
|
||||||
|
blue='\E[1;34m'
|
||||||
|
magenta='\E[35m'
|
||||||
|
cyan='\E[36m'
|
||||||
|
white='\E[37m'
|
||||||
|
reset_color='\E[00m'
|
||||||
|
COLORIZE=1
|
||||||
|
|
||||||
|
cecho() {
|
||||||
|
# Color-echo
|
||||||
|
# arg1 = message
|
||||||
|
# arg2 = color
|
||||||
|
local default_msg="No Message."
|
||||||
|
message=${1:-$default_msg}
|
||||||
|
color=${2:-$green}
|
||||||
|
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
|
||||||
|
echo -e "$message"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_error() { cecho "$* $red" ;}
|
||||||
|
echo_fatal() { cecho "$* $red"; exit 1 ;}
|
||||||
|
echo_warning() { cecho "$* $yellow" ;}
|
||||||
|
echo_success() { cecho "$* $green" ;}
|
||||||
|
echo_info() { cecho "$* $blue" ;}
|
||||||
|
|
||||||
|
########################
|
||||||
|
# distribution helpers #
|
||||||
|
########################
|
||||||
|
|
||||||
|
# This function return a string to identify the distribution we are running
|
||||||
|
# Examples:
|
||||||
|
# ubuntu16.04
|
||||||
|
# debian8.5
|
||||||
|
get_distribution_release() {
|
||||||
|
echo "$OS_DISTRO$OS_RELEASE"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_supported_distribution() {
|
||||||
|
case $(get_distribution_release) in
|
||||||
|
"ubuntu20.04") return 0 ;;
|
||||||
|
esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
##################
|
||||||
|
# Error handlers #
|
||||||
|
##################
|
||||||
|
|
||||||
|
handler_EXIT() {
|
||||||
|
local exit_code=$?
|
||||||
|
[ "$exit_code" -eq 0 ] || echo_error "build have failed"
|
||||||
|
exit $exit_code
|
||||||
|
}
|
||||||
|
|
||||||
|
trap handler_EXIT EXIT
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Cleaners
|
||||||
|
###########################
|
||||||
|
|
||||||
|
clean_kernel() {
|
||||||
|
$SUDO modprobe ip_tables
|
||||||
|
$SUDO modprobe x_tables
|
||||||
|
$SUDO iptables -P INPUT ACCEPT
|
||||||
|
$SUDO iptables -F INPUT
|
||||||
|
$SUDO iptables -P OUTPUT ACCEPT
|
||||||
|
$SUDO iptables -F OUTPUT
|
||||||
|
$SUDO iptables -P FORWARD ACCEPT
|
||||||
|
$SUDO iptables -F FORWARD
|
||||||
|
$SUDO iptables -t nat -F
|
||||||
|
$SUDO iptables -t mangle -F
|
||||||
|
$SUDO iptables -t filter -F
|
||||||
|
$SUDO iptables -t raw -F
|
||||||
|
echo_info "Flushed iptables"
|
||||||
|
$SUDO rmmod nasmesh > /dev/null 2>&1
|
||||||
|
$SUDO rmmod oai_nw_drv > /dev/null 2>&1
|
||||||
|
$SUDO rmmod openair_rf > /dev/null 2>&1
|
||||||
|
$SUDO rmmod ue_ip > /dev/null 2>&1
|
||||||
|
echo_info "removed drivers from kernel"
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_all_files() {
|
||||||
|
set_openair_env
|
||||||
|
rm -rf "$OPENAIR_DIR"/targets/bin/*
|
||||||
|
dir="$OPENAIR_DIR/cmake_targets"
|
||||||
|
rm -rf "$dir"/log/*
|
||||||
|
rm -rf "$dir"/ran_build/build
|
||||||
|
rm -rf "$dir"/ran_build_noLOG/build
|
||||||
|
rm -rf "$dir"/lte-simulators/build
|
||||||
|
rm -rf "$dir"/phy_simulators/build
|
||||||
|
rm -rf "$dir"/nas_sim_tools/build
|
||||||
|
rm -rf "$dir"/oaisim_build_oai/build
|
||||||
|
rm -rf "$dir"/oaisim_build_oai/CMakeLists.txt
|
||||||
|
rm -rf "$dir"/autotests/bin
|
||||||
|
rm -rf "$dir"/autotests/log
|
||||||
|
rm -rf "$dir"/autotests/*/build
|
||||||
|
}
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# External packages installers
|
||||||
|
############################################
|
||||||
|
|
||||||
|
install_protobuf_from_source(){
|
||||||
|
protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt
|
||||||
|
echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log "
|
||||||
|
(
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading protobuf"
|
||||||
|
#rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1
|
||||||
|
#wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
|
||||||
|
#tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner
|
||||||
|
#cd protobuf-2.6.1/
|
||||||
|
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
|
||||||
|
wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
|
||||||
|
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner
|
||||||
|
cd protobuf-3.3.0/ || exit
|
||||||
|
./configure
|
||||||
|
echo "Compiling protobuf"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
) >& "$protobuf_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_protobuf_c_from_source(){
|
||||||
|
protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt
|
||||||
|
echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log "
|
||||||
|
(
|
||||||
|
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||||
|
fi
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading protobuf-c"
|
||||||
|
rm -rf /tmp/protobuf-c
|
||||||
|
git clone https://github.com/protobuf-c/protobuf-c.git
|
||||||
|
cd protobuf-c || exit
|
||||||
|
git checkout 2a46af42784abf86804d536f6e0122d47cfeea45
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
echo "Compiling protobuf-c"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
) >& "$protobuf_c_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_usrp_uhd_driver_from_source(){
|
||||||
|
uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt
|
||||||
|
echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log "
|
||||||
|
(
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading UHD driver"
|
||||||
|
rm -rf /tmp/uhd
|
||||||
|
git clone https://github.com/EttusResearch/uhd.git
|
||||||
|
cd uhd || exit
|
||||||
|
git checkout tags/v3.13.0.2
|
||||||
|
mkdir -p host/build
|
||||||
|
cd host/build || exit
|
||||||
|
$CMAKE ../
|
||||||
|
echo "Compiling UHD"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
make test
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
) >& "$uhd_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_bladerf_driver_from_source(){
|
||||||
|
bladerf_install_log=$OPENAIR_DIR/cmake_targets/log/bladerf_install_log.txt
|
||||||
|
echo_info "\nInstalling BladeRF driver from sources. The log file for BladeRF driver installation is here: $bladerf_install_log "
|
||||||
|
(
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading BladeRF driver"
|
||||||
|
rm -rf /tmp/bladeRF
|
||||||
|
git clone https://github.com/Nuand/bladeRF.git
|
||||||
|
cd bladeRF || exit
|
||||||
|
git checkout tags/2016.06
|
||||||
|
mkdir -p build
|
||||||
|
cd build || exit
|
||||||
|
$CMAKE ../
|
||||||
|
echo "Compiling BladeRF driver"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
echo "Downloading FPGA and firmware images"
|
||||||
|
cd /tmp/bladeRF || exit
|
||||||
|
wget --tries=3 --retry-connrefused https://www.nuand.com/fx3/bladeRF_fw_latest.img
|
||||||
|
wget --tries=3 --retry-connrefused https://www.nuand.com/fpga/hostedx40-latest.rbf
|
||||||
|
sudo mkdir -p /usr/share/Nuand/bladeRF
|
||||||
|
sudo mv bladeRF_fw_latest.img /usr/share/Nuand/bladeRF/bladeRF_fw.img
|
||||||
|
sudo mv hostedx40-latest.rbf /usr/share/Nuand/bladeRF/hostedx40.rbf
|
||||||
|
) >& "$bladerf_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_install_bladerf_driver(){
|
||||||
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
||||||
|
$SUDO apt-get install -y bladerf libbladerf-dev
|
||||||
|
$SUDO apt-get install -y bladerf-firmware-fx3
|
||||||
|
$SUDO apt-get install -y bladerf-fpga-hostedx40
|
||||||
|
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
|
||||||
|
install_bladerf_driver_from_source
|
||||||
|
else
|
||||||
|
echo_error "BladeRF Installer for OAI does not support automatic build. Install BladeRF compiling sources manually from BladeRF website"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
flash_firmware_bladerf() {
|
||||||
|
$SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
|
||||||
|
}
|
||||||
|
|
||||||
|
install_soapy_from_source(){
|
||||||
|
soapy_install_log=$OPENAIR_DIR/cmake_targets/log/soapy_install_log.txt
|
||||||
|
echo_info "\nInstalling Soapy EcoSystem from source. The log file for Soapy installation is here: $soapy_install_log "
|
||||||
|
(
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading SoapySDR"
|
||||||
|
rm -rf /tmp/soapysdr
|
||||||
|
git clone -b soapy-sdr-0.7.0 --single-branch https://github.com/pothosware/SoapySDR.git
|
||||||
|
cd SoapySDR || exit
|
||||||
|
#git checkout tags/release_003_010_001_001
|
||||||
|
mkdir -p build
|
||||||
|
cd build || exit
|
||||||
|
$CMAKE ../
|
||||||
|
echo "Compiling SoapySDR"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading SoapyRemote"
|
||||||
|
rm -rf /tmp/soapyremote
|
||||||
|
git clone -b soapy-remote-0.5.0 --single-branch https://github.com/pothosware/SoapyRemote.git
|
||||||
|
cd SoapyRemote || exit
|
||||||
|
#git checkout tags/release_003_010_001_001
|
||||||
|
mkdir -p build
|
||||||
|
cd build || exit
|
||||||
|
cmake ../
|
||||||
|
echo "Compiling SoapyRemote"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
) >& "$soapy_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_soapy_iris_from_source(){
|
||||||
|
iris_install_log=$OPENAIR_DIR/cmake_targets/log/iris_install_log.txt
|
||||||
|
echo_info "\nInstalling Iris driver from source. The log file for Iris driver installation is here: $iris_install_log "
|
||||||
|
(
|
||||||
|
cd /tmp || exit
|
||||||
|
echo "Downloading SoapyIris"
|
||||||
|
rm -rf /tmp/sklk-soapyiris
|
||||||
|
git clone -b soapy-iris-2018.08.0.1 --single-branch https://github.com/skylarkwireless/sklk-soapyiris.git
|
||||||
|
cd sklk-soapyiris || exit
|
||||||
|
mkdir -p build
|
||||||
|
cd build ||exit
|
||||||
|
cmake ../
|
||||||
|
echo "Compiling SoapyIris"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
) >& "$iris_install_log"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_install_soapy () {
|
||||||
|
#if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
||||||
|
#first we remove old installation
|
||||||
|
$SUDO apt-get remove -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote || true
|
||||||
|
#$SUDO add-apt-repository -y ppa:myriadrf/drivers
|
||||||
|
#$SUDO apt-get update
|
||||||
|
#$SUDO apt-get install -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote
|
||||||
|
|
||||||
|
#elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
|
||||||
|
# $SUDO $INSTALLER -y install software-properties-common python3-software-properties python-software-properties subversion git python3 python-numpy python3-numpy cmake swig python-dev
|
||||||
|
install_soapy_from_source
|
||||||
|
#fi
|
||||||
|
install_soapy_iris_from_source
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
check_install_ubuntu_packages() {
|
||||||
|
$SUDO $INSTALLER update -y
|
||||||
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
||||||
|
local LAPACK_LIBNAME="liblapack.so"
|
||||||
|
local LAPACK_TARGET="/usr/lib/atlas-base/atlas/liblapack.so"
|
||||||
|
$SUDO apt install -y software-properties-common
|
||||||
|
case "$(get_distribution_release)" in
|
||||||
|
"ubuntu20.04")
|
||||||
|
specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
|
||||||
|
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
|
||||||
|
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$SUDO $INSTALLER install -y \
|
||||||
|
$specific_packages \
|
||||||
|
check \
|
||||||
|
dialog \
|
||||||
|
dkms \
|
||||||
|
gawk \
|
||||||
|
libboost-all-dev \
|
||||||
|
libpthread-stubs0-dev \
|
||||||
|
openvpn \
|
||||||
|
pkg-config \
|
||||||
|
python3-dev \
|
||||||
|
python-pexpect \
|
||||||
|
sshfs \
|
||||||
|
swig \
|
||||||
|
tshark \
|
||||||
|
uml-utilities \
|
||||||
|
unzip \
|
||||||
|
valgrind \
|
||||||
|
vlan \
|
||||||
|
exuberant-ctags \
|
||||||
|
ntpdate \
|
||||||
|
iperf3 \
|
||||||
|
android-tools-adb \
|
||||||
|
wvdial \
|
||||||
|
python-numpy \
|
||||||
|
sshpass \
|
||||||
|
nscd \
|
||||||
|
bc \
|
||||||
|
ntp \
|
||||||
|
python3-scipy \
|
||||||
|
python3-matplotlib \
|
||||||
|
bison \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
cmake-curses-gui \
|
||||||
|
ninja-build \
|
||||||
|
doxygen \
|
||||||
|
doxygen-gui \
|
||||||
|
texlive-latex-base \
|
||||||
|
ethtool \
|
||||||
|
flex \
|
||||||
|
gdb \
|
||||||
|
git \
|
||||||
|
graphviz \
|
||||||
|
gtkwave \
|
||||||
|
guile-2.0-dev \
|
||||||
|
iperf \
|
||||||
|
iptables \
|
||||||
|
libxtables-dev \
|
||||||
|
libatlas-base-dev \
|
||||||
|
libblas-dev \
|
||||||
|
liblapack-dev\
|
||||||
|
liblapacke-dev\
|
||||||
|
libffi-dev \
|
||||||
|
libforms-bin \
|
||||||
|
libforms-dev \
|
||||||
|
libgcrypt20-dev \
|
||||||
|
libgmp-dev \
|
||||||
|
libgtk-3-dev \
|
||||||
|
libidn2-0-dev \
|
||||||
|
libidn11-dev \
|
||||||
|
libmysqlclient-dev \
|
||||||
|
libpython2.7-dev \
|
||||||
|
libsctp1 \
|
||||||
|
libsctp-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libtool \
|
||||||
|
libusb-1.0-0-dev \
|
||||||
|
libxml2 \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt1-dev \
|
||||||
|
mscgen \
|
||||||
|
octave-signal \
|
||||||
|
openssh-client \
|
||||||
|
openssh-server \
|
||||||
|
openssl \
|
||||||
|
python3 \
|
||||||
|
subversion \
|
||||||
|
xmlstarlet \
|
||||||
|
python3-pip \
|
||||||
|
libyaml-dev \
|
||||||
|
wget \
|
||||||
|
libxpm-dev \
|
||||||
|
libboost-all-dev \
|
||||||
|
nettle-dev \
|
||||||
|
nettle-bin
|
||||||
|
fi
|
||||||
|
|
||||||
|
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
install_asn1c_from_source(){
|
||||||
|
asn1_install_log=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt
|
||||||
|
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
|
||||||
|
(
|
||||||
|
$SUDO rm -rf /tmp/asn1c
|
||||||
|
# GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
|
||||||
|
git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
|
||||||
|
cd /tmp/asn1c || exit
|
||||||
|
# better to use a given commit than a branch in case the branch
|
||||||
|
# is updated and requires modifications in the source of OAI
|
||||||
|
#git checkout velichkov_s1ap_plus_option_group
|
||||||
|
git checkout f12568d617dbf48497588f8e227d70388fa217c9
|
||||||
|
autoreconf -iv
|
||||||
|
./configure
|
||||||
|
make -j"$(nproc)"
|
||||||
|
$SUDO make install
|
||||||
|
cd - || exit
|
||||||
|
$SUDO ldconfig
|
||||||
|
) > "$asn1_install_log" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# 2. compile
|
||||||
|
################################################
|
||||||
|
|
||||||
|
install_nas_tools() {
|
||||||
|
echo_success "generate .ue_emm.nvram .ue.nvram"
|
||||||
|
./nvram --gen -c "$1" -o "$2"
|
||||||
|
./usim --gen -c "$1" -o "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################
|
||||||
|
# set_openair_env
|
||||||
|
###############################
|
||||||
|
set_openair_env(){
|
||||||
|
fullpath=$(readlink -f "${BASH_SOURCE[0]}")
|
||||||
|
[ -f "/.$fullpath" ] || fullpath=$(readlink -f "$PWD/$fullpath")
|
||||||
|
openair_path=${fullpath%/cmake_targets/*}
|
||||||
|
openair_path=${openair_path%/targets/*}
|
||||||
|
openair_path=${openair_path%/openair[123]/*}
|
||||||
|
export OPENAIR_DIR=$openair_path
|
||||||
|
export OPENAIR1_DIR=$openair_path/openair1
|
||||||
|
export OPENAIR2_DIR=$openair_path/openair2
|
||||||
|
export OPENAIR3_DIR=$openair_path/openair3
|
||||||
|
export OPENAIR_TARGETS=$openair_path/targets
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! check_supported_distribution; then
|
||||||
|
echo_error "Your distribution $(get_distribution_release) is not supported by oai !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo_info "Installing packages"
|
||||||
|
check_install_ubuntu_packages
|
||||||
|
|
||||||
|
echo_info "installing ASN.1 compiler"
|
||||||
|
install_asn1c_from_source
|
||||||
|
|
||||||
|
echo_info "installing protobuf/protobuf-c for flexran agent support"
|
||||||
|
install_protobuf_from_source
|
||||||
|
install_protobuf_c_from_source
|
||||||
|
|
||||||
|
if [ "$1" == "USRP" ] ; then
|
||||||
|
echo_info "installing packages for USRP support"
|
||||||
|
install_usrp_uhd_driver
|
||||||
|
fi
|
||||||
|
if [ "$1" == "BLADERF" ] ; then
|
||||||
|
echo_info "installing packages for BLADERF support"
|
||||||
|
check_install_bladerf_driver
|
||||||
|
flash_firmware_bladerf
|
||||||
|
fi
|
||||||
|
if [ "$1" == "IRIS" ] ; then
|
||||||
|
echo_info "installing packages for IRIS support"
|
||||||
|
check_install_soapy
|
||||||
|
# flash_firmware_iris
|
||||||
|
fi
|
||||||
+12
-9
@@ -397,18 +397,21 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
|||||||
/* define variable only used in LOG macro's */
|
/* define variable only used in LOG macro's */
|
||||||
# define LOG_VAR(A,B) A B
|
# define LOG_VAR(A,B) A B
|
||||||
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||||
# define LOG_I(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)/* */
|
|
||||||
# define LOG_W(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ; } while(0)/* */
|
|
||||||
# define LOG_E(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ; } while(0)/* */
|
|
||||||
# define LOG_D(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ; } while(0)/* */
|
|
||||||
# define LOG_T(c, x...) /* */
|
|
||||||
|
|
||||||
# define LOG_DUMPMSG(c, b, s, x...) /* */
|
# define LOG_E(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} while (0)
|
||||||
|
# define LOG_W(c, x...) do { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} while (0)
|
||||||
|
# define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0)
|
||||||
|
# define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0)
|
||||||
|
# define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0)
|
||||||
|
# define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0)
|
||||||
|
|
||||||
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
||||||
# define LOG_DEBUGFLAG(D) ( 0 )
|
# define LOG_DEBUGFLAG(D) (g_log->dump_mask & D)
|
||||||
# define LOG_DUMPFLAG(D) ( 0 )
|
# define LOG_DUMPFLAG(D) (g_log->debug_mask & D)
|
||||||
|
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
|
||||||
|
|
||||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||||
# define LOG_VAR(A,B)
|
# define LOG_VAR(A,B) A B
|
||||||
# endif /* T_TRACER */
|
# endif /* T_TRACER */
|
||||||
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
||||||
#define GCC_NOTUSED __attribute__((unused))
|
#define GCC_NOTUSED __attribute__((unused))
|
||||||
|
|||||||
@@ -814,6 +814,7 @@ static inline unsigned long long int vcd_get_time(void)
|
|||||||
return (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec)) +
|
return (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec)) +
|
||||||
((long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec) * 1000000000UL;
|
((long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec) * 1000000000UL;
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vcd_signal_dumper_create_header(void)
|
void vcd_signal_dumper_create_header(void)
|
||||||
|
|||||||
@@ -601,11 +601,19 @@ extern int ouput_vcd;
|
|||||||
|
|
||||||
#else /* T_TRACER */
|
#else /* T_TRACER */
|
||||||
|
|
||||||
|
#if ENABLE_VCD
|
||||||
#define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT) vcd_signal_dumper_init(aRgUmEnT)
|
#define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT) vcd_signal_dumper_init(aRgUmEnT)
|
||||||
#define VCD_SIGNAL_DUMPER_CLOSE() vcd_signal_dumper_close()
|
#define VCD_SIGNAL_DUMPER_CLOSE() vcd_signal_dumper_close()
|
||||||
#define VCD_SIGNAL_DUMPER_CREATE_HEADER() vcd_signal_dumper_create_header()
|
#define VCD_SIGNAL_DUMPER_CREATE_HEADER() vcd_signal_dumper_create_header()
|
||||||
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_variable_by_name(vAr1,vAr2)
|
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_variable_by_name(vAr1,vAr2)
|
||||||
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_function_by_name(vAr1,vAr2)
|
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_function_by_name(vAr1,vAr2)
|
||||||
|
#else
|
||||||
|
#define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT)
|
||||||
|
#define VCD_SIGNAL_DUMPER_CLOSE()
|
||||||
|
#define VCD_SIGNAL_DUMPER_CREATE_HEADER()
|
||||||
|
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(vAr1,vAr2)
|
||||||
|
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* T_TRACER */
|
#endif /* T_TRACER */
|
||||||
|
|||||||
@@ -1,490 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
||||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.openairinterface.org/?page_id=698
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*-------------------------------------------------------------------------------
|
|
||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
||||||
* contact@openairinterface.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "assertions.h"
|
|
||||||
#include "memory_pools.h"
|
|
||||||
|
|
||||||
#if T_TRACER
|
|
||||||
#include <string.h>
|
|
||||||
#include "T.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
const static int mp_debug = 0;
|
|
||||||
|
|
||||||
# define MP_DEBUG(x, args...) do { if (mp_debug) fprintf(stdout, "[MP][D]"x, ##args); fflush (stdout); } \
|
|
||||||
while(0)
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
#ifndef CHARS_TO_UINT32
|
|
||||||
#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MEMORY_POOL_ITEM_INFO_NUMBER 2
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
typedef int32_t items_group_position_t;
|
|
||||||
typedef int32_t items_group_index_t;
|
|
||||||
|
|
||||||
typedef union items_group_positions_u {
|
|
||||||
uint64_t all;
|
|
||||||
struct {
|
|
||||||
items_group_position_t put;
|
|
||||||
items_group_position_t get;
|
|
||||||
} ind;
|
|
||||||
} items_group_positions_t;
|
|
||||||
|
|
||||||
typedef struct items_group_s {
|
|
||||||
items_group_position_t number_plus_one;
|
|
||||||
volatile uint32_t minimum;
|
|
||||||
volatile items_group_positions_t positions;
|
|
||||||
volatile items_group_index_t *indexes;
|
|
||||||
} items_group_t;
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
//static const items_group_position_t ITEMS_GROUP_POSITION_INVALID = -1;
|
|
||||||
static const items_group_index_t ITEMS_GROUP_INDEX_INVALID = -1;
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
typedef uint32_t pool_item_start_mark_t;
|
|
||||||
typedef uint32_t pool_item_end_mark_t;
|
|
||||||
|
|
||||||
typedef uint32_t memory_pool_data_t;
|
|
||||||
|
|
||||||
typedef uint32_t pool_start_mark_t;
|
|
||||||
|
|
||||||
typedef uint32_t pools_start_mark_t;
|
|
||||||
|
|
||||||
typedef uint8_t pool_id_t;
|
|
||||||
typedef uint8_t item_status_t;
|
|
||||||
|
|
||||||
typedef struct memory_pool_item_start_s {
|
|
||||||
pool_item_start_mark_t start_mark;
|
|
||||||
|
|
||||||
pool_id_t pool_id;
|
|
||||||
item_status_t item_status;
|
|
||||||
uint16_t info[MEMORY_POOL_ITEM_INFO_NUMBER];
|
|
||||||
} memory_pool_item_start_t;
|
|
||||||
|
|
||||||
typedef struct memory_pool_item_end_s {
|
|
||||||
pool_item_end_mark_t end_mark;
|
|
||||||
} memory_pool_item_end_t;
|
|
||||||
|
|
||||||
typedef struct memory_pool_item_s {
|
|
||||||
memory_pool_item_start_t start;
|
|
||||||
memory_pool_data_t data[0];
|
|
||||||
memory_pool_item_end_t end;
|
|
||||||
} memory_pool_item_t;
|
|
||||||
|
|
||||||
typedef struct memory_pool_s {
|
|
||||||
pool_start_mark_t start_mark;
|
|
||||||
|
|
||||||
pool_id_t pool_id;
|
|
||||||
uint32_t item_data_number;
|
|
||||||
uint32_t pool_item_size;
|
|
||||||
items_group_t items_group_free;
|
|
||||||
memory_pool_item_t *items;
|
|
||||||
} memory_pool_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct memory_pools_s {
|
|
||||||
pools_start_mark_t start_mark;
|
|
||||||
|
|
||||||
uint32_t pools_number;
|
|
||||||
uint32_t pools_defined;
|
|
||||||
memory_pool_t *pools;
|
|
||||||
} memory_pools_t;
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
static const uint32_t MAX_POOLS_NUMBER = 20;
|
|
||||||
static const uint32_t MAX_POOL_ITEMS_NUMBER = 200 * 1000;
|
|
||||||
static const uint32_t MAX_POOL_ITEM_SIZE = 100 * 1000;
|
|
||||||
|
|
||||||
static const pool_item_start_mark_t POOL_ITEM_START_MARK = CHARS_TO_UINT32 ('P', 'I', 's', 't');
|
|
||||||
static const pool_item_end_mark_t POOL_ITEM_END_MARK = CHARS_TO_UINT32 ('p', 'i', 'E', 'N');
|
|
||||||
|
|
||||||
static const item_status_t ITEM_STATUS_FREE = 'F';
|
|
||||||
static const item_status_t ITEM_STATUS_ALLOCATED = 'a';
|
|
||||||
|
|
||||||
static const pool_start_mark_t POOL_START_MARK = CHARS_TO_UINT32 ('P', '_', 's', 't');
|
|
||||||
|
|
||||||
static const pools_start_mark_t POOLS_START_MARK = CHARS_TO_UINT32 ('P', 'S', 's', 't');
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
static inline uint32_t items_group_number_items (items_group_t *items_group) {
|
|
||||||
return items_group->number_plus_one - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t items_group_free_items (items_group_t *items_group) {
|
|
||||||
items_group_positions_t positions;
|
|
||||||
uint32_t free_items;
|
|
||||||
positions.all = items_group->positions.all;
|
|
||||||
free_items = items_group->number_plus_one + positions.ind.put - positions.ind.get;
|
|
||||||
free_items %= items_group->number_plus_one;
|
|
||||||
return free_items;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline items_group_index_t items_group_get_free_item (items_group_t *items_group) {
|
|
||||||
items_group_position_t get_raw;
|
|
||||||
items_group_position_t put;
|
|
||||||
items_group_position_t get;
|
|
||||||
items_group_position_t free_items;
|
|
||||||
items_group_index_t index = ITEMS_GROUP_INDEX_INVALID;
|
|
||||||
/* Get current put position */
|
|
||||||
put = items_group->positions.ind.put % items_group->number_plus_one;
|
|
||||||
/* Get current get position and increase it */
|
|
||||||
get_raw = __sync_fetch_and_add (&items_group->positions.ind.get, 1);
|
|
||||||
get = get_raw % items_group->number_plus_one;
|
|
||||||
|
|
||||||
if(put == get) {
|
|
||||||
/* No more item free, restore previous position */
|
|
||||||
__sync_fetch_and_sub (&items_group->positions.ind.get, 1);
|
|
||||||
} else {
|
|
||||||
/* Get index at current get position */
|
|
||||||
index = items_group->indexes[get];
|
|
||||||
|
|
||||||
if (index <= ITEMS_GROUP_INDEX_INVALID) {
|
|
||||||
/* Index has not yet been completely freed, restore previous get position */
|
|
||||||
__sync_fetch_and_sub (&items_group->positions.ind.get, 1);
|
|
||||||
} else {
|
|
||||||
if (get_raw == items_group->number_plus_one) {
|
|
||||||
/* Wrap get position */
|
|
||||||
__sync_fetch_and_sub (&items_group->positions.ind.get, items_group->number_plus_one);
|
|
||||||
}
|
|
||||||
|
|
||||||
free_items = items_group_free_items(items_group);
|
|
||||||
|
|
||||||
/* Updates minimum free items if needed */
|
|
||||||
while (items_group->minimum > free_items) {
|
|
||||||
items_group->minimum = free_items;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear index at current get position to indicate that item is free */
|
|
||||||
items_group->indexes[get] = ITEMS_GROUP_INDEX_INVALID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int items_group_put_free_item (items_group_t *items_group, items_group_index_t index) {
|
|
||||||
items_group_position_t put_raw;
|
|
||||||
items_group_position_t put;
|
|
||||||
/* Get current put position and increase it */
|
|
||||||
put_raw = __sync_fetch_and_add (&items_group->positions.ind.put, 1);
|
|
||||||
put = put_raw % items_group->number_plus_one;
|
|
||||||
|
|
||||||
if (put_raw == items_group->number_plus_one) {
|
|
||||||
/* Wrap position */
|
|
||||||
__sync_fetch_and_sub (&items_group->positions.ind.put, items_group->number_plus_one);
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertError (items_group->indexes[put] <= ITEMS_GROUP_INDEX_INVALID, return (EXIT_FAILURE),
|
|
||||||
"Index at current put position (%d) is not marked as free (%d)!\n", put, items_group->number_plus_one);
|
|
||||||
/* Save freed item index at current put position */
|
|
||||||
items_group->indexes[put] = index;
|
|
||||||
return (EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
static inline memory_pools_t *memory_pools_from_handler (memory_pools_handle_t memory_pools_handle) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = (memory_pools_t *) memory_pools_handle;
|
|
||||||
/* Sanity check on passed handle */
|
|
||||||
AssertError (memory_pools->start_mark == POOLS_START_MARK, memory_pools = NULL,
|
|
||||||
"Handle %p is not a valid memory pools handle, start mark is missing!\n", memory_pools_handle);
|
|
||||||
return (memory_pools);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline memory_pool_item_t *memory_pool_item_from_handler (memory_pool_item_handle_t memory_pool_item_handle) {
|
|
||||||
void *address;
|
|
||||||
memory_pool_item_t *memory_pool_item;
|
|
||||||
/* Recover memory_pools */
|
|
||||||
address = memory_pool_item_handle - sizeof(memory_pool_item_start_t);
|
|
||||||
memory_pool_item = (memory_pool_item_t *) address;
|
|
||||||
/* Sanity check on passed handle */
|
|
||||||
AssertError (memory_pool_item->start.start_mark == POOL_ITEM_START_MARK, memory_pool_item = NULL,
|
|
||||||
"Handle %p is not a valid memory pool item handle, start mark is missing!\n", memory_pool_item);
|
|
||||||
return (memory_pool_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline memory_pool_item_t *memory_pool_item_from_index (memory_pool_t *memory_pool, items_group_index_t index) {
|
|
||||||
void *address;
|
|
||||||
address = (void *) memory_pool->items;
|
|
||||||
address += index * memory_pool->pool_item_size;
|
|
||||||
return (address);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
|
||||||
memory_pools_handle_t memory_pools_create (uint32_t pools_number) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
pool_id_t pool;
|
|
||||||
AssertFatal (pools_number <= MAX_POOLS_NUMBER, "Too many memory pools requested (%d/%d)!\n", pools_number, MAX_POOLS_NUMBER); /* Limit to a reasonable number of pools */
|
|
||||||
/* Allocate memory_pools */
|
|
||||||
memory_pools = malloc (sizeof(memory_pools_t));
|
|
||||||
AssertFatal (memory_pools != NULL, "Memory pools structure allocation failed!\n");
|
|
||||||
/* Initialize memory_pools */
|
|
||||||
{
|
|
||||||
memory_pools->start_mark = POOLS_START_MARK;
|
|
||||||
memory_pools->pools_number = pools_number;
|
|
||||||
memory_pools->pools_defined = 0;
|
|
||||||
/* Allocate pools */
|
|
||||||
memory_pools->pools = calloc (pools_number, sizeof(memory_pool_t));
|
|
||||||
AssertFatal (memory_pools->pools != NULL, "Memory pools allocation failed!\n");
|
|
||||||
|
|
||||||
/* Initialize pools */
|
|
||||||
for (pool = 0; pool < pools_number; pool++) {
|
|
||||||
memory_pools->pools[pool].start_mark = POOL_START_MARK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ((memory_pools_handle_t) memory_pools);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
pool_id_t pool;
|
|
||||||
char *statistics;
|
|
||||||
int printed_chars;
|
|
||||||
uint32_t allocated_pool_memory;
|
|
||||||
uint32_t allocated_pools_memory = 0;
|
|
||||||
items_group_t *items_group;
|
|
||||||
uint32_t pool_items_size;
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = memory_pools_from_handler (memory_pools_handle);
|
|
||||||
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
|
|
||||||
statistics = malloc(memory_pools->pools_defined * 200);
|
|
||||||
printed_chars = sprintf (&statistics[0], "Pool: size, number, minimum, free, address space and memory used in Kbytes\n");
|
|
||||||
|
|
||||||
for (pool = 0; pool < memory_pools->pools_defined; pool++) {
|
|
||||||
items_group = &memory_pools->pools[pool].items_group_free;
|
|
||||||
allocated_pool_memory = items_group_number_items (items_group) * memory_pools->pools[pool].pool_item_size;
|
|
||||||
allocated_pools_memory += allocated_pool_memory;
|
|
||||||
pool_items_size = memory_pools->pools[pool].item_data_number * sizeof(memory_pool_data_t);
|
|
||||||
printed_chars += sprintf (&statistics[printed_chars], " %2u: %6u, %6u, %6u, %6u, [%p-%p] %6u\n",
|
|
||||||
pool, pool_items_size,
|
|
||||||
items_group_number_items (items_group),
|
|
||||||
items_group->minimum,
|
|
||||||
items_group_free_items (items_group),
|
|
||||||
memory_pools->pools[pool].items,
|
|
||||||
((void *) memory_pools->pools[pool].items) + allocated_pool_memory,
|
|
||||||
allocated_pool_memory / (1024));
|
|
||||||
}
|
|
||||||
|
|
||||||
printed_chars = sprintf (&statistics[printed_chars], "Pools memory %u Kbytes\n", allocated_pools_memory / (1024));
|
|
||||||
return (statistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
memory_pool_t *memory_pool;
|
|
||||||
pool_id_t pool;
|
|
||||||
items_group_index_t item_index;
|
|
||||||
memory_pool_item_t *memory_pool_item;
|
|
||||||
AssertFatal (pool_items_number <= MAX_POOL_ITEMS_NUMBER, "Too many items for a memory pool (%u/%d)!\n", pool_items_number, MAX_POOL_ITEMS_NUMBER); /* Limit to a reasonable number of items */
|
|
||||||
AssertFatal (pool_item_size <= MAX_POOL_ITEM_SIZE, "Item size is too big for memory pool items (%u/%d)!\n", pool_item_size, MAX_POOL_ITEM_SIZE); /* Limit to a reasonable item size */
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = memory_pools_from_handler (memory_pools_handle);
|
|
||||||
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
|
|
||||||
/* Check number of already created pools */
|
|
||||||
AssertFatal (memory_pools->pools_defined < memory_pools->pools_number, "Can not allocate more memory pool (%d)!\n", memory_pools->pools_number);
|
|
||||||
/* Select pool */
|
|
||||||
pool = memory_pools->pools_defined;
|
|
||||||
memory_pool = &memory_pools->pools[pool];
|
|
||||||
/* Initialize pool */
|
|
||||||
{
|
|
||||||
memory_pool->pool_id = pool;
|
|
||||||
/* Item size in memory_pool_data_t items by excess */
|
|
||||||
memory_pool->item_data_number = (pool_item_size + sizeof(memory_pool_data_t) - 1) / sizeof(memory_pool_data_t);
|
|
||||||
memory_pool->pool_item_size = (memory_pool->item_data_number * sizeof(memory_pool_data_t)) + sizeof(memory_pool_item_t);
|
|
||||||
memory_pool->items_group_free.number_plus_one = pool_items_number + 1;
|
|
||||||
memory_pool->items_group_free.minimum = pool_items_number;
|
|
||||||
memory_pool->items_group_free.positions.ind.put = pool_items_number;
|
|
||||||
memory_pool->items_group_free.positions.ind.get = 0;
|
|
||||||
/* Allocate free indexes */
|
|
||||||
memory_pool->items_group_free.indexes = malloc(memory_pool->items_group_free.number_plus_one * sizeof(items_group_index_t));
|
|
||||||
AssertFatal (memory_pool->items_group_free.indexes != NULL, "Memory pool indexes allocation failed!\n");
|
|
||||||
|
|
||||||
/* Initialize free indexes */
|
|
||||||
for (item_index = 0; item_index < pool_items_number; item_index++) {
|
|
||||||
memory_pool->items_group_free.indexes[item_index] = item_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Last index is not allocated */
|
|
||||||
memory_pool->items_group_free.indexes[item_index] = ITEMS_GROUP_INDEX_INVALID;
|
|
||||||
/* Allocate items */
|
|
||||||
memory_pool->items = calloc (pool_items_number, memory_pool->pool_item_size);
|
|
||||||
AssertFatal (memory_pool->items != NULL, "Memory pool items allocation failed!\n");
|
|
||||||
|
|
||||||
/* Initialize items */
|
|
||||||
for (item_index = 0; item_index < pool_items_number; item_index++) {
|
|
||||||
memory_pool_item = memory_pool_item_from_index (memory_pool, item_index);
|
|
||||||
memory_pool_item->start.start_mark = POOL_ITEM_START_MARK;
|
|
||||||
memory_pool_item->start.pool_id = pool;
|
|
||||||
memory_pool_item->start.item_status = ITEM_STATUS_FREE;
|
|
||||||
memory_pool_item->data[memory_pool->item_data_number] = POOL_ITEM_END_MARK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
memory_pools->pools_defined ++;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
memory_pool_item_t *memory_pool_item;
|
|
||||||
memory_pool_item_handle_t memory_pool_item_handle = NULL;
|
|
||||||
pool_id_t pool;
|
|
||||||
items_group_index_t item_index = ITEMS_GROUP_INDEX_INVALID;
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = memory_pools_from_handler (memory_pools_handle);
|
|
||||||
AssertError (memory_pools != NULL, {}, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
|
|
||||||
|
|
||||||
for (pool = 0; pool < memory_pools->pools_defined; pool++) {
|
|
||||||
if ((memory_pools->pools[pool].item_data_number * sizeof(memory_pool_data_t)) < item_size) {
|
|
||||||
/* This memory pool has too small items, skip it */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
item_index = items_group_get_free_item(&memory_pools->pools[pool].items_group_free);
|
|
||||||
|
|
||||||
if (item_index <= ITEMS_GROUP_INDEX_INVALID) {
|
|
||||||
/* Allocation failed, skip this pool */
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
/* Allocation succeed, exit searching loop */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item_index > ITEMS_GROUP_INDEX_INVALID) {
|
|
||||||
/* Convert item index into memory_pool_item address */
|
|
||||||
memory_pool_item = memory_pool_item_from_index (&memory_pools->pools[pool], item_index);
|
|
||||||
/* Sanity check on item status, must be free */
|
|
||||||
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_FREE, "Item status is not set to free (%d) in pool %u, item %d!\n",
|
|
||||||
memory_pool_item->start.item_status, pool, item_index);
|
|
||||||
memory_pool_item->start.item_status = ITEM_STATUS_ALLOCATED;
|
|
||||||
memory_pool_item->start.info[0] = info_0;
|
|
||||||
memory_pool_item->start.info[1] = info_1;
|
|
||||||
memory_pool_item_handle = memory_pool_item->data;
|
|
||||||
MP_DEBUG(" Alloc [%2u][%6d]{%6d}, %3u %3u, %6u, %p, %p, %p\n",
|
|
||||||
pool, item_index,
|
|
||||||
items_group_free_items (&memory_pools->pools[pool].items_group_free),
|
|
||||||
info_0, info_1,
|
|
||||||
item_size,
|
|
||||||
memory_pools->pools[pool].items,
|
|
||||||
memory_pool_item,
|
|
||||||
memory_pool_item_handle);
|
|
||||||
} else {
|
|
||||||
MP_DEBUG(" Alloc [--][------]{------}, %3u %3u, %6u, failed!\n", info_0, info_1, item_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return memory_pool_item_handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
memory_pool_item_t *memory_pool_item;
|
|
||||||
pool_id_t pool;
|
|
||||||
items_group_index_t item_index;
|
|
||||||
uint32_t item_size;
|
|
||||||
uint32_t pool_item_size;
|
|
||||||
uint16_t info_1;
|
|
||||||
int result;
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = memory_pools_from_handler (memory_pools_handle);
|
|
||||||
AssertError (memory_pools != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pools for handle %p!\n", memory_pools_handle);
|
|
||||||
/* Recover memory pool item */
|
|
||||||
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
|
|
||||||
AssertError (memory_pool_item != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
|
|
||||||
info_1 = memory_pool_item->start.info[1];
|
|
||||||
/* Recover pool index */
|
|
||||||
pool = memory_pool_item->start.pool_id;
|
|
||||||
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
|
|
||||||
item_size = memory_pools->pools[pool].item_data_number;
|
|
||||||
pool_item_size = memory_pools->pools[pool].pool_item_size;
|
|
||||||
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
|
|
||||||
MP_DEBUG(" Free [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
|
|
||||||
pool, item_index,
|
|
||||||
items_group_free_items (&memory_pools->pools[pool].items_group_free),
|
|
||||||
memory_pool_item->start.info[0], info_1,
|
|
||||||
memory_pool_item_handle, memory_pool_item,
|
|
||||||
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
|
|
||||||
/* Sanity check on calculated item index */
|
|
||||||
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
|
|
||||||
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
|
|
||||||
memory_pool_item,(void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
|
|
||||||
/* Sanity check on end marker, must still be present (no write overflow) */
|
|
||||||
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
|
|
||||||
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
|
|
||||||
/* Sanity check on item status, must be allocated */
|
|
||||||
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_ALLOCATED,
|
|
||||||
"Trying to free a non allocated (%x) memory pool item (pool %u, item %d)!\n",
|
|
||||||
memory_pool_item->start.item_status, pool, item_index);
|
|
||||||
memory_pool_item->start.item_status = ITEM_STATUS_FREE;
|
|
||||||
result = items_group_put_free_item(&memory_pools->pools[pool].items_group_free, item_index);
|
|
||||||
AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory pool item (pool %u, item %d)!\n", pool, item_index);
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info) {
|
|
||||||
memory_pools_t *memory_pools;
|
|
||||||
memory_pool_item_t *memory_pool_item;
|
|
||||||
pool_id_t pool;
|
|
||||||
items_group_index_t item_index;
|
|
||||||
uint32_t item_size;
|
|
||||||
uint32_t pool_item_size;
|
|
||||||
AssertFatal (index < MEMORY_POOL_ITEM_INFO_NUMBER, "Incorrect info index (%d/%d)!\n", index, MEMORY_POOL_ITEM_INFO_NUMBER);
|
|
||||||
/* Recover memory pool item */
|
|
||||||
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
|
|
||||||
AssertFatal (memory_pool_item != NULL, "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
|
|
||||||
/* Set info[1] */
|
|
||||||
memory_pool_item->start.info[index] = info;
|
|
||||||
|
|
||||||
/* Check item validity and log (not mandatory) */
|
|
||||||
if (1) {
|
|
||||||
/* Recover memory_pools */
|
|
||||||
memory_pools = memory_pools_from_handler (memory_pools_handle);
|
|
||||||
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
|
|
||||||
/* Recover pool index */
|
|
||||||
pool = memory_pool_item->start.pool_id;
|
|
||||||
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
|
|
||||||
item_size = memory_pools->pools[pool].item_data_number;
|
|
||||||
pool_item_size = memory_pools->pools[pool].pool_item_size;
|
|
||||||
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
|
|
||||||
MP_DEBUG(" Info [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
|
|
||||||
pool, item_index,
|
|
||||||
items_group_free_items (&memory_pools->pools[pool].items_group_free),
|
|
||||||
memory_pool_item->start.info[0], memory_pool_item->start.info[1],
|
|
||||||
memory_pool_item_handle, memory_pool_item,
|
|
||||||
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
|
|
||||||
/* Sanity check on calculated item index */
|
|
||||||
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
|
|
||||||
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
|
|
||||||
memory_pool_item, (void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
|
|
||||||
/* Sanity check on end marker, must still be present (no write overflow) */
|
|
||||||
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
|
|
||||||
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
|
|
||||||
/* Sanity check on item status, must be allocated */
|
|
||||||
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_ALLOCATED,
|
|
||||||
"Trying to free a non allocated (%x) memory pool item (pool %u, item %d)\n",
|
|
||||||
memory_pool_item->start.item_status, pool, item_index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,8 +8,7 @@ When a job is done, the worker sends a return if a return is defined.
|
|||||||
|
|
||||||
A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, but from a response of one job, the other linked jobs becomes useless).
|
A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, but from a response of one job, the other linked jobs becomes useless).
|
||||||
|
|
||||||
All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client,
|
All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client, so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter.
|
||||||
so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter.
|
|
||||||
|
|
||||||
## license
|
## license
|
||||||
Author:
|
Author:
|
||||||
@@ -19,17 +18,18 @@ When a job is done, the worker sends a return if a return is defined.
|
|||||||
# jobs
|
# jobs
|
||||||
|
|
||||||
A job is a message (notifiedFIFO_elt_t):
|
A job is a message (notifiedFIFO_elt_t):
|
||||||
next:
|
|
||||||
|
* next:
|
||||||
internal FIFO chain, do not set it
|
internal FIFO chain, do not set it
|
||||||
key:
|
* key:
|
||||||
a long int that the client can use to identify a message or a group of messages
|
a long int that the client can use to identify a message or a group of messages
|
||||||
responseFifo:
|
* ResponseFifo:
|
||||||
if the client defines a response FIFO, the message will be posted back after processing
|
if the client defines a response FIFO, the message will be posted back after processing
|
||||||
processingFunc:
|
* processingFunc:
|
||||||
any funtion (type void processingFunc(void *)) that the worker will launch
|
any funtion (type void processingFunc(void *)) that the worker will launch
|
||||||
msgData:
|
* msgData:
|
||||||
the data passed to processingFunc. It can be added automatically, or you can set it to a buffer you are managing
|
the data passed to processingFunc. It can be added automatically, or you can set it to a buffer you are managing
|
||||||
malloced:
|
* malloced:
|
||||||
a boolean that enable internal free in these cases:
|
a boolean that enable internal free in these cases:
|
||||||
no return Fifo or Abort feature
|
no return Fifo or Abort feature
|
||||||
|
|
||||||
@@ -38,23 +38,85 @@ When a job is done, the worker sends a return if a return is defined.
|
|||||||
# Queues of jobs
|
# Queues of jobs
|
||||||
|
|
||||||
Queues are type of:
|
Queues are type of:
|
||||||
notifiedFIFO_t that must be initialized by init_notifiedFIFO()
|
|
||||||
No delete function is required, the creator has only to free the data of type notifiedFIFO_t
|
|
||||||
|
|
||||||
push_notifiedFIFO() add a job in the queue
|
* notifiedFIFO_t that must be initialized by init_notifiedFIFO()
|
||||||
pull_notifiedFIFO() is blocking, poll_notifiedFIFO() is non blocking
|
* No delete function is required, the creator has only to free the data of type notifiedFIFO_t
|
||||||
|
* push_notifiedFIFO() add a job in the queue
|
||||||
|
* pull_notifiedFIFO() is blocking, poll_notifiedFIFO() is non blocking
|
||||||
|
* abort_notifiedFIFO() allows the customer to delete all waiting jobs that match with the key (see key in jobs definition)
|
||||||
|
|
||||||
abort_notifiedFIFO() allows the customer to delete all waiting jobs that match with the key (see key in jobs definition)
|
These queues details hereafter
|
||||||
|
|
||||||
|
## Common
|
||||||
|
|
||||||
|
newNotifiedFIFO_elt()
|
||||||
|
|
||||||
|
creates a message, that will later be used in queues/FIFO
|
||||||
|
|
||||||
|
delNotifiedFIFO_elt()
|
||||||
|
|
||||||
|
deletes it
|
||||||
|
|
||||||
|
NotifiedFifoData()
|
||||||
|
|
||||||
|
gives a pointer to the beginning of free usage memory in a message (you can put any data there, up to 'size' parameter you passed to newNotifiedFIFO_elt()
|
||||||
|
|
||||||
|
These 3 calls are not mandatory, you can also use your own memory to save the malloc()/free() that are behind these calls
|
||||||
|
iFirst level: non thread safe FIFO (or queues)
|
||||||
|
|
||||||
|
# low level: fast and simple
|
||||||
|
|
||||||
|
initNotifiedFIFO_nothreadSafe()
|
||||||
|
|
||||||
|
to create a queue
|
||||||
|
|
||||||
|
pushNotifiedFIFO_nothreadSafe()
|
||||||
|
|
||||||
|
Add a element in a queue
|
||||||
|
|
||||||
|
pullNotifiedFIFO_nothreadSafe()
|
||||||
|
|
||||||
|
pull a element from a queue
|
||||||
|
|
||||||
|
As these queues are not thread safe, there is NO blocking mechanism, neither pull() versus poll() calls
|
||||||
|
|
||||||
|
There is no delete for a message queue: you only have to abandon the memory you allocated to call iinitNotifiedFIFO_nothreadSafe(notifiedFIFO_t *nf)
|
||||||
|
|
||||||
|
So if you malloced the memory under 'nf' parameter you have to free it, if it is automatic variable (local variable) or global variable, nothing is to be done.
|
||||||
|
|
||||||
|
|
||||||
|
## thread safe queues
|
||||||
|
|
||||||
|
These queues are built on not thread safe queues when we need thread to thread protection
|
||||||
|
|
||||||
|
initNotifiedFIFO()
|
||||||
|
|
||||||
|
to create a queue
|
||||||
|
|
||||||
|
pushNotifiedFIFO()
|
||||||
|
|
||||||
|
Add a element in a queue
|
||||||
|
|
||||||
|
pullNotifiedFIFO()
|
||||||
|
|
||||||
|
pull a element from a queue, this call is blocking until a message arrived
|
||||||
|
|
||||||
|
pollNotifiedFIFO()
|
||||||
|
|
||||||
|
pull a element from a queue, this call is not blocking, so it returns always very shortly
|
||||||
|
|
||||||
|
in 99.9% cases, pull() is better than poll()
|
||||||
|
|
||||||
|
No delete() call, same principle as not thread safe queues
|
||||||
|
|
||||||
# Thread pools
|
# Thread pools
|
||||||
|
|
||||||
## initialization
|
## initialization
|
||||||
The clients can create one or more thread pools with init_tpool()
|
The clients can create one or more thread pools with init_tpool()
|
||||||
the params string structure:
|
|
||||||
describes a list of cores, separated by "," that run a worker thread
|
|
||||||
|
|
||||||
If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and
|
the params string structure: describes a list of cores, separated by "," that run a worker thread
|
||||||
the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
|
|
||||||
|
If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
|
||||||
|
|
||||||
The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>"
|
The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>"
|
||||||
|
|
||||||
@@ -69,6 +131,66 @@ When a job is done, the worker sends a return if a return is defined.
|
|||||||
|
|
||||||
Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
|
Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
|
||||||
|
|
||||||
|
## API details
|
||||||
|
Each thread pool (there can be several in the same process) should be initialized
|
||||||
|
|
||||||
|
### initTpool(char *params,tpool_t *pool, bool performanceMeas) is to be called oncepool
|
||||||
|
|
||||||
|
the configuration parameter is a string, elements separated by ",":
|
||||||
|
|
||||||
|
* N: if a N is in the parameter list, no threads are created
|
||||||
|
The purpose is to keep the same API in any case
|
||||||
|
* a CPU with a little number of cores,
|
||||||
|
or in debugging sessions to simplify the human work
|
||||||
|
* a number that represent a valid CPU core on the target CPU
|
||||||
|
A thread is created and stick on the core (with set affinity)
|
||||||
|
* a number that is not a valid CPU core
|
||||||
|
a floating thread is created (Linux is responsible of the real time core allocation)
|
||||||
|
|
||||||
|
example: "-1,-1,-1"
|
||||||
|
as there is no core number -1, the thread pool is made of 3 floating threads
|
||||||
|
be careful with fix allocation: it is hard to be more clever than Linux kernel
|
||||||
|
|
||||||
|
pool is the memory you allocated before to store the thread pool internal state (same concept as above queues)
|
||||||
|
|
||||||
|
performanceMeas is a flag to enable measurements (well described in documentation)
|
||||||
|
|
||||||
|
### pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg)
|
||||||
|
|
||||||
|
adds a job to do in the thread pool
|
||||||
|
|
||||||
|
The msg data you can set are:
|
||||||
|
|
||||||
|
* key:
|
||||||
|
a value for you that you will find back in the response
|
||||||
|
it is also the key for abortTpool()
|
||||||
|
* reponseFifo
|
||||||
|
if you set it, the message will be sent back on this queue when the job is done
|
||||||
|
if you don't set it, no return is performed, the thread pool frees the message 'msg' when the job is done
|
||||||
|
* processingFunc
|
||||||
|
the function the job will run. the function prototype is void <func>(void *memory)
|
||||||
|
the data part (the pointer returned by NotifiedFifoData(msg)) is passed to the function
|
||||||
|
it is used to send data to the processing function and also to write back results
|
||||||
|
of course, writing back results will lead you to use also a return queue (the parameter reponseFifo)
|
||||||
|
|
||||||
|
### pullTpool() collects job result in a return queue
|
||||||
|
|
||||||
|
you collect results in one result queue: the message you gave to pushTpool(), nevertheless it has been updated by processingFunc()
|
||||||
|
|
||||||
|
An example of multiple return queues, in eNB: I created one single thread pool (because it depends mainly on CPU hardware), but i use two return queues: one for turbo encode, one for turbo decode.
|
||||||
|
|
||||||
|
### tryPullTpool()
|
||||||
|
|
||||||
|
is the same, but not blocking (pollTpool() would have been a better name)
|
||||||
|
|
||||||
|
### abortTpool()
|
||||||
|
|
||||||
|
Is a facility to cancel work you pushed to a thread pool
|
||||||
|
|
||||||
|
I used it once: when eNB performs turbo decode, I push all segments in the thread pool.
|
||||||
|
|
||||||
|
But when I get back the decoding results, if one segment can't be decoded, I don't need the results of the other segments of the same UE.
|
||||||
|
|
||||||
## Performance measurements
|
## Performance measurements
|
||||||
|
|
||||||
A performance measurement is integrated:
|
A performance measurement is integrated:
|
||||||
@@ -76,7 +198,6 @@ When a job is done, the worker sends a return if a return is defined.
|
|||||||
|
|
||||||
* creationTime:
|
* creationTime:
|
||||||
time the request is push to the pool;
|
time the request is push to the pool;
|
||||||
|
|
||||||
* startProcessingTime:
|
* startProcessingTime:
|
||||||
time a worker start to run on the job
|
time a worker start to run on the job
|
||||||
* endProcessingTime:
|
* endProcessingTime:
|
||||||
|
|||||||
+107
@@ -0,0 +1,107 @@
|
|||||||
|
<style type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #110F14;
|
||||||
|
}
|
||||||
|
h2 { margin-left: 20px; }
|
||||||
|
h3 { margin-left: 40px; }
|
||||||
|
h4 { margin-left: 60px; }
|
||||||
|
|
||||||
|
.func2 { margin-left: 20px; }
|
||||||
|
.func3 { margin-left: 40px; }
|
||||||
|
.func4 { margin-left: 60px; }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
This tuto for 5G gNB NAS design
|
||||||
|
{: .text-center}
|
||||||
|
|
||||||
|
# source files
|
||||||
|
|
||||||
|
executables/ocp-gnb.c: a main loop to create a debuggable gNB, see document SW_archi.md
|
||||||
|
openair2/RRC/NR/nr_ngap_gNB.c: skeleton for interface with NGAP
|
||||||
|
openair3/NAS/COMMON/milenage.h: a simple milenage implementation, depend only on crypto library
|
||||||
|
openair3/NAS/COMMON/NR_NAS_defs.h: messages defined for NAS implemented in C: C struct, C enums and automatic conversion to labels for debug messages
|
||||||
|
openair3/NAS/COMMON/nr_common.c: 5G NAS common code between gNB and UE
|
||||||
|
openair3/UICC/usim_interface.c: UICC simulation for USIM messages
|
||||||
|
|
||||||
|
openair3/NAS/NR_UE/ue_process_nas.c: NAS code for UE
|
||||||
|
|
||||||
|
openair3/NAS/gNB/network_process_nas.c: NAS code for gNB running without 5GC
|
||||||
|
|
||||||
|
openair3/TEST/test5Gnas.c: unitary testing of NAS messages: encodes+decode a standard network entry, mixing code from UE and 5GC (or gNB in noCore)
|
||||||
|
|
||||||
|
# USIM simulation
|
||||||
|
A new USIM simulation, that parameters are in regular OAI config files
|
||||||
|
|
||||||
|
## To open the USIM
|
||||||
|
init_uicc() takes a parameter: the name of the block in the config file
|
||||||
|
In case we run several UEs in one process, the variable section name allows to make several UEs configurations in one config file.
|
||||||
|
|
||||||
|
The NAS implementation uses this possibility.
|
||||||
|
|
||||||
|
# UE side
|
||||||
|
UEprocessNAS() is the entry for all messages.
|
||||||
|
It decodes the message type and call the specific function for each messgae
|
||||||
|
|
||||||
|
## Identityrequest + IdentityResponse
|
||||||
|
When the UE receives the request, it stores the 5GC request parameters in the UE context ( UE->uicc pointer)
|
||||||
|
It calls "scheduleNAS", that would trigger a answer (seeing general archtecture, it will probly be a itti message to future RRC or NGAP thread).
|
||||||
|
|
||||||
|
When the scheduler wants to encode the answer, it calls identityResponse()
|
||||||
|
The UE search for a section in the config file called "uicc"
|
||||||
|
it encodes the NAS answer with the IMSI, as a 4G compatible authentication.
|
||||||
|
A future release would encode 5G SUPI as native 5G UICC.
|
||||||
|
|
||||||
|
## Authenticationrequest + authenticationResponse
|
||||||
|
When the UE receives the request, it stores the 5GC request parameters in the UE context ( UE->uicc pointer)
|
||||||
|
It calls "scheduleNAS", that would trigger a answer (seeing general archtecture, it will probly be a itti message to future RRC or NGAP thread).
|
||||||
|
|
||||||
|
When the scheduler wants to encode the answer, it calls authenticationResponse()
|
||||||
|
The UE search for a section in the config file called "uicc"
|
||||||
|
It uses the Milenage parameters of this section to encode a milenage response
|
||||||
|
A future release would encode 5G new authentication cyphering functions.
|
||||||
|
|
||||||
|
## SecurityModeCommand + securityModeComplete
|
||||||
|
When the UE receives the request it will:
|
||||||
|
Selected NAS security algorithms: store it for future encoding
|
||||||
|
Replayed UE security capabilities: check if it is equal to UE capabilities it sent to the 5GC
|
||||||
|
IMEISV request: to implement
|
||||||
|
ngKSI: Key set Indicator, similator to 4G to select a ciphering keys set
|
||||||
|
|
||||||
|
When the scheduler wants to encode the answer, it calls registrationComplete()
|
||||||
|
|
||||||
|
## registrationComplete
|
||||||
|
To be defined in UE, this NAS message is done after RRC sequence completes
|
||||||
|
|
||||||
|
# gNB side
|
||||||
|
gNB NGAP thread receives the NAS message from PHY layers
|
||||||
|
In normal mode, it send it to the core network with no decoding.
|
||||||
|
|
||||||
|
Here after, the gNB mode "noCore" processing in gNB: NGAP calls the entry function: processNAS() instead of forwarding the packet to the 5GC
|
||||||
|
|
||||||
|
## RRCModeComplete + Identityrequest
|
||||||
|
When the gNB completes RRC attach, it sends a first message to NGAP thread.
|
||||||
|
Normal processing sends NGAP initial UE message, in noCore mode, it should call: identityRequest() that encode the NAS identity request inside the gNB.
|
||||||
|
The gNB NGAP thread then should call the piece of code that forward the message to the UE as when it receives a NAS message from 5GC.
|
||||||
|
|
||||||
|
## All NAS coming from UE
|
||||||
|
When NGAP thread receives a NAS message from lower layers, it encapsulates it to forward it to the 5GC. In "noCore" mode it calls processNAS().
|
||||||
|
|
||||||
|
This function stores in the gNB the NAS data, then it should encode the next message (identity, authentication, security mode) or do nothing (registration complete).
|
||||||
|
|
||||||
|
|
||||||
|
<div class="panel panel-info">
|
||||||
|
**Note**
|
||||||
|
{: .panel-heading}
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -254,9 +254,11 @@ The NAS layer is based on **3GPP 24.301** and implements the following functions
|
|||||||
The following features are valid for the gNB and the 5G-NR UE.
|
The following features are valid for the gNB and the 5G-NR UE.
|
||||||
|
|
||||||
* Static TDD,
|
* Static TDD,
|
||||||
|
* FDD
|
||||||
* Normal CP
|
* Normal CP
|
||||||
* 30 kHz subcarrier spacing
|
* 30 kHz subcarrier spacing
|
||||||
* Bandwidths up to 80MHz (217 Physical Resource Blocks)
|
* Bandwidths up to 80MHz (217 Physical Resource Blocks)
|
||||||
|
* Intermediate downlink and uplink frequencies to interface with IF equipment
|
||||||
* Single antenna port (single beam)
|
* Single antenna port (single beam)
|
||||||
* Slot format: 14 OFDM symbols in UL or DL
|
* Slot format: 14 OFDM symbols in UL or DL
|
||||||
* Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 supported)
|
* Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 supported)
|
||||||
|
|||||||
@@ -132,6 +132,42 @@ With the RF simulator (on the same machine):
|
|||||||
|
|
||||||
`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD`
|
`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD`
|
||||||
|
|
||||||
|
## IF setup with OAI
|
||||||
|
|
||||||
|
The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment.
|
||||||
|
|
||||||
|
In order to run this setup, the following flags are needed at the UE side:
|
||||||
|
|
||||||
|
`-C`
|
||||||
|
|
||||||
|
`--CO`
|
||||||
|
|
||||||
|
and the following parameters must be configured in the RUs section of the gNB configuration file:
|
||||||
|
|
||||||
|
`if_freq`
|
||||||
|
|
||||||
|
`if_offset`
|
||||||
|
|
||||||
|
### Run OAI with custom DL/UL intermediate frequencies
|
||||||
|
|
||||||
|
The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 at gNB side.
|
||||||
|
|
||||||
|
From the `cmake_targets/ran_build/build` folder:
|
||||||
|
|
||||||
|
gNB on machine 1:
|
||||||
|
|
||||||
|
`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf`
|
||||||
|
|
||||||
|
UE on machine 2:
|
||||||
|
|
||||||
|
`sudo ./nr-uesoftmodem -C 2169080000 --CO -400000000`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||||
|
|
||||||
|
|||||||
+212
@@ -0,0 +1,212 @@
|
|||||||
|
<style type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #110F14;
|
||||||
|
}
|
||||||
|
h2 { margin-left: 20px; }
|
||||||
|
h3 { margin-left: 40px; }
|
||||||
|
h4 { margin-left: 60px; }
|
||||||
|
|
||||||
|
.func2 { margin-left: 20px; }
|
||||||
|
.func3 { margin-left: 40px; }
|
||||||
|
.func4 { margin-left: 60px; }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
This tuto for 5G gNB design, with Open Cells main
|
||||||
|
{: .text-center}
|
||||||
|
|
||||||
|
# Top file: executables/ocp-gnb.c
|
||||||
|
|
||||||
|
the function main() initializes the data from configuration file
|
||||||
|
|
||||||
|
# The main thread is in ru_thread()
|
||||||
|
The infinite loop:
|
||||||
|
## rx_rf()
|
||||||
|
Collect radio signal samples from RF board
|
||||||
|
all SDR processing is triggered by I/Q sample reception and it's date (timestamp)
|
||||||
|
TX I/Q samples will have a date in the future, compared to RX timestamp
|
||||||
|
called for each 5G NR slot
|
||||||
|
it blocks until data is available
|
||||||
|
the internal time comes from the RF board sampling numbers
|
||||||
|
(each sample has a incremental number representing a very accurate timing)
|
||||||
|
raw incoming data is in buffer called "rxdata"
|
||||||
|
We derivate frame number, slot number, ... from the RX timestamp
|
||||||
|
{: .func2}
|
||||||
|
## nr_fep_full()
|
||||||
|
"front end processing" of uplink signal
|
||||||
|
performs DFT on the signal
|
||||||
|
same function (duplicates): phy_procedures_gNB_common_RX()
|
||||||
|
it computes the buffer rxdataF (for frequency) from rxdata (samples over time)
|
||||||
|
rxdataF is the rxdata in frequency domain, phase aligned
|
||||||
|
{: .func3}
|
||||||
|
## gNB_top()
|
||||||
|
only compute frame numbre, slot number, ...
|
||||||
|
{: .func3}
|
||||||
|
## ocp_rxtx()
|
||||||
|
main processing for both UL and DL
|
||||||
|
start by calling oai_subframe_ind() that trigger processing in pnf_p7_subframe_ind() purpose ???
|
||||||
|
all the context is in the passed structure UL_INFO
|
||||||
|
the context is not very clear: there is a mutex on it,
|
||||||
|
but not actual coherency (see below handle_nr_rach() assumes data is up-to-date)
|
||||||
|
The first part (in NR_UL_indication, uses the data computed by the lower part (phy_procedures_gNB_uespec_RX), but for the **previous** slot
|
||||||
|
Then, phy_procedures_gNB_uespec_RX will hereafter replace the data for the next run
|
||||||
|
This is very tricky and not thread safe at all.
|
||||||
|
{: .func3}
|
||||||
|
|
||||||
|
### NR_UL_indication()
|
||||||
|
This block processes data already decoded and stored in structures behind UL_INFO
|
||||||
|
{: .func4}
|
||||||
|
|
||||||
|
* handle_nr_rach()
|
||||||
|
process data from RACH primary detection
|
||||||
|
if the input is a UE RACH detection
|
||||||
|
{: .func4}
|
||||||
|
* nr_schedule_msg2()
|
||||||
|
{: .func4}
|
||||||
|
* handle_nr_uci()
|
||||||
|
????
|
||||||
|
{: .func4}
|
||||||
|
* handle_nr_ulsch()
|
||||||
|
handles ulsch data prepared by nr_fill_indication()
|
||||||
|
{: .func4}
|
||||||
|
* gNB_dlsch_ulsch_scheduler ()
|
||||||
|
the **scheduler** is called here, see dedicated chapter
|
||||||
|
{: .func4}
|
||||||
|
* NR_Schedule_response()
|
||||||
|
process as per the scheduler decided
|
||||||
|
{: .func4}
|
||||||
|
|
||||||
|
### L1_nr_prach_procedures()
|
||||||
|
????
|
||||||
|
{: .func4}
|
||||||
|
### phy_procedures_gNB_uespec_RX()
|
||||||
|
* nr_decode_pucch0()
|
||||||
|
actual CCH channel decoding form rxdataF (rx data in frequency domain)
|
||||||
|
populates UL_INFO.uci_ind, actual uci data is in gNB->pucch
|
||||||
|
{: .func4}
|
||||||
|
* nr_rx_pusch()
|
||||||
|
{: .func4}
|
||||||
|
* extracts data from rxdataF (frequency transformed received data)
|
||||||
|
{: .func4}
|
||||||
|
* nr_pusch_channel_estimation()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_extract_rbs_single()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_scale_channel()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_channel_level()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_channel_compensation()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_compute_llr()
|
||||||
|
this function creates the "likelyhood ratios"
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_procedures()
|
||||||
|
{: .func4}
|
||||||
|
* actual ULsch decoding
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_unscrambling()
|
||||||
|
{: .func4}
|
||||||
|
* nr_ulsch_decoding()
|
||||||
|
{: .func4}
|
||||||
|
* nr_fill_indication()
|
||||||
|
populate the data for the next call to "NR_UL_indication()"
|
||||||
|
it would be better to call **NR_UL_indication()** now instead of before (on previous slot)
|
||||||
|
{: .func4}
|
||||||
|
|
||||||
|
### phy_procedures_gNB_TX()
|
||||||
|
* nr_common_signal_procedures()
|
||||||
|
generate common signals
|
||||||
|
{: .func4}
|
||||||
|
* nr_generate_dci_top()
|
||||||
|
generate DCI: the scheduling informtion for each UE in both DL and UL
|
||||||
|
{: .func4}
|
||||||
|
* nr_generate_pdsch()
|
||||||
|
generate DL shared channel (user data)
|
||||||
|
{: .func4}
|
||||||
|
|
||||||
|
### nr_feptx_prec()
|
||||||
|
tx precoding
|
||||||
|
{: .func3}
|
||||||
|
### nr_feptx0
|
||||||
|
do the inverse DFT
|
||||||
|
{: .func3}
|
||||||
|
### tx_rf()
|
||||||
|
send radio signal samples to the RF board
|
||||||
|
the samples numbers are the future time for these samples emission on-air
|
||||||
|
{: .func3}
|
||||||
|
|
||||||
|
# Scheduler
|
||||||
|
The scheduler is called by the chain: nr_ul_indication()=>gNB_dlsch_ulsch_scheduler()
|
||||||
|
It calls sub functions to process each physical channel (rach, ...)
|
||||||
|
The scheduler uses and internal map of used RB: vrb_map and vrb_map_UL, so each specific channel scheduler can see the already filled RB in each subframe (the function gNB_dlsch_ulsch_scheduler() clears these two arrays when it starts)
|
||||||
|
|
||||||
|
The scheduler also calls "run_pdcp()", as this is not a autonomous thread, it needs to be called here to update traffic requests (DL) and to propagate waiting UL to upper layers
|
||||||
|
After calling run_pdcp, it updates "rlc" time data but it doesn't actually process rlc
|
||||||
|
it sends a iiti message to activate the thread for RRC, the answer will be asynchronous in ????
|
||||||
|
|
||||||
|
Calls schedule_nr_mib() that calls mac_rrc_nr_data_req() to fill MIB,
|
||||||
|
|
||||||
|
Calls each channel allocation: schedule SI, schedule_ul, schedule_dl, ...
|
||||||
|
this is a major entry for "phy-test" mode: in this mode, the allocation is fixed
|
||||||
|
all these channels goes to mac_rrc_nr_data_req() to get the data to transmit
|
||||||
|
|
||||||
|
nr_schedule_ue_spec() is called
|
||||||
|
* calls nr_simple_dlsch_preprocessor()=> mac_rlc_status_ind() mac_rlc_status_ind() locks and checks directly inside rlc data the quantity of waiting data. So, the scheduler can allocate RBs
|
||||||
|
* calls nr_update_pucch_scheduling()
|
||||||
|
* get_pdsch_to_harq_feedback() to schedule retransmission in DL
|
||||||
|
|
||||||
|
Calls nr_fill_nfapi_dl_pdu() to actually populate what should be done by the lower layers to make the Tx subframe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# RRC
|
||||||
|
RRC is a regular thread with itti loop on queue: TASK_RRC_GNB
|
||||||
|
it receives it's configuration in message NRRRC_CONFIGURATION_REQ, then real time mesages for all events: S1/NGAP events, X2AP messages and RRC_SUBFRAME_PROCESS
|
||||||
|
|
||||||
|
RRC_SUBFRAME_PROCESS message is send each subframe
|
||||||
|
|
||||||
|
how does it communicate to scheduler ?
|
||||||
|
|
||||||
|
|
||||||
|
# RLC
|
||||||
|
RLC code is new implementation, not using OAI mechanisms: it is implmented directly on pthreads, ignoring OAI common functions.
|
||||||
|
It runs a thread waiting incoming data, but it is mainly running inside calling thread.
|
||||||
|
It is a library, running in thread RRC (except on itti message: F1AP_UL_RRC_MESSAGE for F1).
|
||||||
|
|
||||||
|
# NGAP
|
||||||
|
NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)?
|
||||||
|
About all messages are exchanged with RRC thread
|
||||||
|
|
||||||
|
|
||||||
|
# GTP
|
||||||
|
Gtp + UDP are two twin threads performing the data plane interface to the core network
|
||||||
|
The design is hybrid: thread and inside other threads calls. It should at least be protected by a mutex.
|
||||||
|
## GTP thread
|
||||||
|
Gtp thread has a itti interface: queue TASK_GTPV1_U
|
||||||
|
The interface is about full definition: control messages (create/delet GTP tunnels) and data messages (user plane UL and DL).
|
||||||
|
PDCP layer push to the GTP queue (outside UDP thread that do almost nothing and work only with GTP thread) is to push a UL packet.
|
||||||
|
|
||||||
|
|
||||||
|
## GTP thread running code from other layers
|
||||||
|
gtp thread calls directly pdcp_data_req(), so it runs inside it's context internal pdcp structures updates
|
||||||
|
|
||||||
|
## inside other threads
|
||||||
|
gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex.
|
||||||
|
|
||||||
|
|
||||||
|
<div class="panel panel-info">
|
||||||
|
**Note**
|
||||||
|
{: .panel-heading}
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
+80
-122
@@ -78,9 +78,18 @@ int otg_enabled;
|
|||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
int split73;
|
int split73;
|
||||||
|
int usrp_tx_thread = 0;
|
||||||
char * split73_config;
|
char * split73_config;
|
||||||
int split73;
|
int split73;
|
||||||
int usrp_tx_thread = 0;
|
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
|
||||||
|
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0};
|
||||||
|
void flexran_agent_slice_update(mid_t module_idP) {
|
||||||
|
}
|
||||||
|
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void proto_agent_stop(mod_id_t mod_id){
|
||||||
|
}
|
||||||
|
|
||||||
static void *ru_thread( void *param );
|
static void *ru_thread( void *param );
|
||||||
void kill_RU_proc(RU_t *ru) {
|
void kill_RU_proc(RU_t *ru) {
|
||||||
@@ -101,21 +110,6 @@ void exit_function(const char *file, const char *function, const int line, const
|
|||||||
close_log_mem();
|
close_log_mem();
|
||||||
oai_exit = 1;
|
oai_exit = 1;
|
||||||
|
|
||||||
if (RC.ru == NULL)
|
|
||||||
exit(-1); // likely init not completed, prevent crash or hang, exit now...
|
|
||||||
|
|
||||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
|
||||||
if (RC.ru[ru_id] && RC.ru[ru_id]->rfdevice.trx_end_func) {
|
|
||||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
|
||||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func) {
|
|
||||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
|
||||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep(1); //allow lte-softmodem threads to exit first
|
sleep(1); //allow lte-softmodem threads to exit first
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -399,6 +393,7 @@ int setup_RU_buffers(RU_t *ru) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void init_precoding_weights(PHY_VARS_eNB *eNB) {
|
void init_precoding_weights(PHY_VARS_eNB *eNB) {
|
||||||
int layer,ru_id,aa,re,ue,tb;
|
int layer,ru_id,aa,re,ue,tb;
|
||||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||||
@@ -431,6 +426,7 @@ void init_precoding_weights(PHY_VARS_eNB *eNB) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void ocp_rx_prach(PHY_VARS_eNB *eNB,
|
void ocp_rx_prach(PHY_VARS_eNB *eNB,
|
||||||
L1_rxtx_proc_t *proc,
|
L1_rxtx_proc_t *proc,
|
||||||
@@ -804,8 +800,7 @@ int init_rf(RU_t *ru) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_RU(char *rf_config_file, int send_dmrssync) {
|
void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) {
|
||||||
RU_t *ru;
|
|
||||||
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
|
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
|
||||||
int i;
|
int i;
|
||||||
int CC_id;
|
int CC_id;
|
||||||
@@ -821,11 +816,8 @@ void init_RU(char *rf_config_file, int send_dmrssync) {
|
|||||||
|
|
||||||
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
|
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
|
||||||
|
|
||||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
|
||||||
LOG_D(PHY,"Process RC.ru[%d]\n",ru_id);
|
|
||||||
ru = RC.ru[ru_id];
|
|
||||||
ru->rf_config_file = rf_config_file;
|
ru->rf_config_file = rf_config_file;
|
||||||
ru->idx = ru_id;
|
ru->idx = 0;
|
||||||
ru->ts_offset = 0;
|
ru->ts_offset = 0;
|
||||||
|
|
||||||
if (ru->is_slave == 1) {
|
if (ru->is_slave == 1) {
|
||||||
@@ -849,8 +841,6 @@ void init_RU(char *rf_config_file, int send_dmrssync) {
|
|||||||
ru->wakeup_L1_sleep_cnt_max = 3;
|
ru->wakeup_L1_sleep_cnt_max = 3;
|
||||||
|
|
||||||
if (ru->num_eNB > 0) {
|
if (ru->num_eNB > 0) {
|
||||||
LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n",
|
|
||||||
__FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
|
|
||||||
AssertFatal(ru->eNB_list[0], "ru->eNB_list is not initialized\n");
|
AssertFatal(ru->eNB_list[0], "ru->eNB_list is not initialized\n");
|
||||||
} else {
|
} else {
|
||||||
LOG_E(PHY,"Wrong data model, assigning eNB 0, carrier 0 to RU 0\n");
|
LOG_E(PHY,"Wrong data model, assigning eNB 0, carrier 0 to RU 0\n");
|
||||||
@@ -867,20 +857,19 @@ void init_RU(char *rf_config_file, int send_dmrssync) {
|
|||||||
int ruIndex=eNB0->num_RU++;
|
int ruIndex=eNB0->num_RU++;
|
||||||
eNB0->RU_list[ruIndex] = ru;
|
eNB0->RU_list[ruIndex] = ru;
|
||||||
}
|
}
|
||||||
} // for ru_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop_RU(int nb_ru) {
|
void stop_RU(int nb_ru) {
|
||||||
for (int inst = 0; inst < nb_ru; inst++) {
|
for (int inst = 0; inst < nb_ru; inst++) {
|
||||||
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
|
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
|
||||||
kill_RU_proc(RC.ru[inst]);
|
//kill_RU_proc(RC.ru[inst]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------*/
|
/* --------------------------------------------------------*/
|
||||||
/* from here function to use configuration module */
|
/* from here function to use configuration module */
|
||||||
static int DEFBFW[] = {0x00007fff};
|
static int DEFBFW[] = {0x00007fff};
|
||||||
void RCconfig_RU(void) {
|
void ocpRCconfig_RU(RU_t* ru) {
|
||||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||||
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||||
@@ -891,31 +880,20 @@ void RCconfig_RU(void) {
|
|||||||
return;
|
return;
|
||||||
} // setting != NULL
|
} // setting != NULL
|
||||||
|
|
||||||
if ( RC.ru != NULL ) {
|
ru->idx = 0;
|
||||||
LOG_W(PHY, "Calling RCconfig_RU twice (nb ru=%d), ignoring the second call data structure is %p\n",
|
ru->if_timing = synch_to_ext_device;
|
||||||
RUParamList.numelt,RC.ru);
|
paramdef_t *vals=RUParamList.paramarray[0];
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *));
|
|
||||||
|
|
||||||
for (int j = 0; j < RC.nb_RU; j++) {
|
|
||||||
RC.ru[j] = (RU_t *)calloc(sizeof(RU_t), 1);
|
|
||||||
RC.ru[j]->idx = j;
|
|
||||||
LOG_I(PHY,"Creating RC.ru[%d]:%p\n", j, RC.ru[j]);
|
|
||||||
RC.ru[j]->if_timing = synch_to_ext_device;
|
|
||||||
paramdef_t *vals=RUParamList.paramarray[j];
|
|
||||||
|
|
||||||
if (RC.nb_L1_inst >0)
|
if (RC.nb_L1_inst >0)
|
||||||
RC.ru[j]->num_eNB = vals[RU_ENB_LIST_IDX].numelt;
|
ru->num_eNB = vals[RU_ENB_LIST_IDX].numelt;
|
||||||
else
|
else
|
||||||
RC.ru[j]->num_eNB = 0;
|
ru->num_eNB = 0;
|
||||||
|
|
||||||
for (int i=0; i<RC.ru[j]->num_eNB; i++)
|
for (int i=0; i<ru->num_eNB; i++)
|
||||||
RC.ru[j]->eNB_list[i] = RC.eNB[vals[RU_ENB_LIST_IDX].iptr[i]][0];
|
ru->eNB_list[i] = RC.eNB[vals[RU_ENB_LIST_IDX].iptr[i]][0];
|
||||||
|
|
||||||
if (config_isparamset(vals, RU_SDR_ADDRS)) {
|
if (config_isparamset(vals, RU_SDR_ADDRS)) {
|
||||||
RC.ru[j]->openair0_cfg.sdr_addrs = strdup(*(vals[RU_SDR_ADDRS].strptr));
|
ru->openair0_cfg.sdr_addrs = strdup(*(vals[RU_SDR_ADDRS].strptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_isparamset(vals, RU_SDR_CLK_SRC)) {
|
if (config_isparamset(vals, RU_SDR_CLK_SRC)) {
|
||||||
@@ -923,11 +901,11 @@ void RCconfig_RU(void) {
|
|||||||
LOG_D(PHY, "RU clock source set as %s\n", paramVal);
|
LOG_D(PHY, "RU clock source set as %s\n", paramVal);
|
||||||
|
|
||||||
if (strcmp(paramVal, "internal") == 0) {
|
if (strcmp(paramVal, "internal") == 0) {
|
||||||
RC.ru[j]->openair0_cfg.clock_source = internal;
|
ru->openair0_cfg.clock_source = internal;
|
||||||
} else if (strcmp(paramVal, "external") == 0) {
|
} else if (strcmp(paramVal, "external") == 0) {
|
||||||
RC.ru[j]->openair0_cfg.clock_source = external;
|
ru->openair0_cfg.clock_source = external;
|
||||||
} else if (strcmp(paramVal, "gpsdo") == 0) {
|
} else if (strcmp(paramVal, "gpsdo") == 0) {
|
||||||
RC.ru[j]->openair0_cfg.clock_source = gpsdo;
|
ru->openair0_cfg.clock_source = gpsdo;
|
||||||
} else {
|
} else {
|
||||||
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", paramVal);
|
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", paramVal);
|
||||||
}
|
}
|
||||||
@@ -935,43 +913,41 @@ void RCconfig_RU(void) {
|
|||||||
|
|
||||||
if (strcmp(*(vals[RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
if (strcmp(*(vals[RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
||||||
if ( !(config_isparamset(vals,RU_LOCAL_IF_NAME_IDX)) ) {
|
if ( !(config_isparamset(vals,RU_LOCAL_IF_NAME_IDX)) ) {
|
||||||
RC.ru[j]->if_south = LOCAL_RF;
|
ru->if_south = LOCAL_RF;
|
||||||
RC.ru[j]->function = eNodeB_3GPP;
|
ru->function = eNodeB_3GPP;
|
||||||
LOG_I(PHY, "Setting function for RU %d to eNodeB_3GPP\n",j);
|
|
||||||
} else {
|
} else {
|
||||||
RC.ru[j]->eth_params.local_if_name = strdup(*(vals[RU_LOCAL_IF_NAME_IDX].strptr));
|
ru->eth_params.local_if_name = strdup(*(vals[RU_LOCAL_IF_NAME_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.my_addr = strdup(*(vals[RU_LOCAL_ADDRESS_IDX].strptr));
|
ru->eth_params.my_addr = strdup(*(vals[RU_LOCAL_ADDRESS_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.remote_addr = strdup(*(vals[RU_REMOTE_ADDRESS_IDX].strptr));
|
ru->eth_params.remote_addr = strdup(*(vals[RU_REMOTE_ADDRESS_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.my_portc = *(vals[RU_LOCAL_PORTC_IDX].uptr);
|
ru->eth_params.my_portc = *(vals[RU_LOCAL_PORTC_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.remote_portc = *(vals[RU_REMOTE_PORTC_IDX].uptr);
|
ru->eth_params.remote_portc = *(vals[RU_REMOTE_PORTC_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.my_portd = *(vals[RU_LOCAL_PORTD_IDX].uptr);
|
ru->eth_params.my_portd = *(vals[RU_LOCAL_PORTD_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.remote_portd = *(vals[RU_REMOTE_PORTD_IDX].uptr);
|
ru->eth_params.remote_portd = *(vals[RU_REMOTE_PORTD_IDX].uptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
RC.ru[j]->max_pdschReferenceSignalPower = *(vals[RU_MAX_RS_EPRE_IDX].uptr);;
|
ru->max_pdschReferenceSignalPower = *(vals[RU_MAX_RS_EPRE_IDX].uptr);;
|
||||||
RC.ru[j]->max_rxgain = *(vals[RU_MAX_RXGAIN_IDX].uptr);
|
ru->max_rxgain = *(vals[RU_MAX_RXGAIN_IDX].uptr);
|
||||||
RC.ru[j]->num_bands = vals[RU_BAND_LIST_IDX].numelt;
|
ru->num_bands = vals[RU_BAND_LIST_IDX].numelt;
|
||||||
/* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
|
/* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
|
||||||
RC.ru[j]->sf_extension = *(vals[RU_SF_EXTENSION_IDX].uptr);
|
ru->sf_extension = *(vals[RU_SF_EXTENSION_IDX].uptr);
|
||||||
RC.ru[j]->end_of_burst_delay = *(vals[RU_END_OF_BURST_DELAY_IDX].uptr);
|
ru->end_of_burst_delay = *(vals[RU_END_OF_BURST_DELAY_IDX].uptr);
|
||||||
|
|
||||||
for (int i=0; i<RC.ru[j]->num_bands; i++) RC.ru[j]->band[i] = vals[RU_BAND_LIST_IDX].iptr[i];
|
for (int i=0; i<ru->num_bands; i++)
|
||||||
|
ru->band[i] = vals[RU_BAND_LIST_IDX].iptr[i];
|
||||||
} else {
|
} else {
|
||||||
LOG_I(PHY,"RU %d: Transport %s\n",j,*(vals[RU_TRANSPORT_PREFERENCE_IDX].strptr));
|
ru->eth_params.local_if_name = strdup(*(vals[RU_LOCAL_IF_NAME_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.local_if_name = strdup(*(vals[RU_LOCAL_IF_NAME_IDX].strptr));
|
ru->eth_params.my_addr = strdup(*(vals[RU_LOCAL_ADDRESS_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.my_addr = strdup(*(vals[RU_LOCAL_ADDRESS_IDX].strptr));
|
ru->eth_params.remote_addr = strdup(*(vals[RU_REMOTE_ADDRESS_IDX].strptr));
|
||||||
RC.ru[j]->eth_params.remote_addr = strdup(*(vals[RU_REMOTE_ADDRESS_IDX].strptr));
|
ru->eth_params.my_portc = *(vals[RU_LOCAL_PORTC_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.my_portc = *(vals[RU_LOCAL_PORTC_IDX].uptr);
|
ru->eth_params.remote_portc = *(vals[RU_REMOTE_PORTC_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.remote_portc = *(vals[RU_REMOTE_PORTC_IDX].uptr);
|
ru->eth_params.my_portd = *(vals[RU_LOCAL_PORTD_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.my_portd = *(vals[RU_LOCAL_PORTD_IDX].uptr);
|
ru->eth_params.remote_portd = *(vals[RU_REMOTE_PORTD_IDX].uptr);
|
||||||
RC.ru[j]->eth_params.remote_portd = *(vals[RU_REMOTE_PORTD_IDX].uptr);
|
|
||||||
} /* strcmp(local_rf, "yes") != 0 */
|
} /* strcmp(local_rf, "yes") != 0 */
|
||||||
|
|
||||||
RC.ru[j]->nb_tx = *(vals[RU_NB_TX_IDX].uptr);
|
ru->nb_tx = *(vals[RU_NB_TX_IDX].uptr);
|
||||||
RC.ru[j]->nb_rx = *(vals[RU_NB_RX_IDX].uptr);
|
ru->nb_rx = *(vals[RU_NB_RX_IDX].uptr);
|
||||||
RC.ru[j]->att_tx = *(vals[RU_ATT_TX_IDX].uptr);
|
ru->att_tx = *(vals[RU_ATT_TX_IDX].uptr);
|
||||||
RC.ru[j]->att_rx = *(vals[RU_ATT_RX_IDX].uptr);
|
ru->att_rx = *(vals[RU_ATT_RX_IDX].uptr);
|
||||||
}// j=0..num_rus
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1055,13 +1031,13 @@ void init_pdcp(void) {
|
|||||||
pdcp_module_init(pdcp_initmask);
|
pdcp_module_init(pdcp_initmask);
|
||||||
|
|
||||||
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
|
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
|
||||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
|
//pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
|
||||||
} else {
|
} else {
|
||||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
|
//pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1087,16 +1063,11 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) {
|
|||||||
int stop_L1L2(module_id_t enb_id) {
|
int stop_L1L2(module_id_t enb_id) {
|
||||||
LOG_W(ENB_APP, "stopping lte-softmodem\n");
|
LOG_W(ENB_APP, "stopping lte-softmodem\n");
|
||||||
|
|
||||||
if (!RC.ru) {
|
|
||||||
LOG_UI(ENB_APP, "no RU configured\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* these tasks need to pick up new configuration */
|
/* these tasks need to pick up new configuration */
|
||||||
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
|
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
|
||||||
oai_exit = 1;
|
oai_exit = 1;
|
||||||
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
|
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
|
||||||
kill_RU_proc(RC.ru[enb_id]);
|
//kill_RU_proc(RC.ru[enb_id]);
|
||||||
LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
|
LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
|
||||||
kill_eNB_proc(enb_id);
|
kill_eNB_proc(enb_id);
|
||||||
oai_exit = 0;
|
oai_exit = 0;
|
||||||
@@ -1106,7 +1077,7 @@ int stop_L1L2(module_id_t enb_id) {
|
|||||||
phy_free_lte_eNB(RC.eNB[enb_id][cc_id]);
|
phy_free_lte_eNB(RC.eNB[enb_id][cc_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
phy_free_RU(RC.ru[enb_id]);
|
//phy_free_RU(RC.ru[enb_id]);
|
||||||
free_lte_top();
|
free_lte_top();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1115,14 +1086,18 @@ int stop_L1L2(module_id_t enb_id) {
|
|||||||
* Restart the lte-softmodem after it has been soft-stopped with stop_L1L2()
|
* Restart the lte-softmodem after it has been soft-stopped with stop_L1L2()
|
||||||
*/
|
*/
|
||||||
int restart_L1L2(module_id_t enb_id) {
|
int restart_L1L2(module_id_t enb_id) {
|
||||||
RU_t *ru = RC.ru[enb_id];
|
RU_t *ru = NULL; //RC.ru[enb_id];
|
||||||
MessageDef *msg_p = NULL;
|
MessageDef *msg_p = NULL;
|
||||||
LOG_W(ENB_APP, "restarting lte-softmodem\n");
|
LOG_W(ENB_APP, "restarting lte-softmodem\n");
|
||||||
/* block threads */
|
/* block threads */
|
||||||
pthread_mutex_lock(&sync_mutex);
|
pthread_mutex_lock(&sync_mutex);
|
||||||
sync_var = -1;
|
sync_var = -1;
|
||||||
pthread_mutex_unlock(&sync_mutex);
|
pthread_mutex_unlock(&sync_mutex);
|
||||||
RC.ru_mask |= (1 << ru->idx);
|
|
||||||
|
/* copy the changed frame parameters to the RU */
|
||||||
|
/* TODO this should be done for all RUs associated to this eNB */
|
||||||
|
memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
|
||||||
|
|
||||||
/* reset the list of connected UEs in the MAC, since in this process with
|
/* reset the list of connected UEs in the MAC, since in this process with
|
||||||
* loose all UEs (have to reconnect) */
|
* loose all UEs (have to reconnect) */
|
||||||
init_UE_info(&RC.mac[enb_id]->UE_info);
|
init_UE_info(&RC.mac[enb_id]->UE_info);
|
||||||
@@ -1135,11 +1110,6 @@ int restart_L1L2(module_id_t enb_id) {
|
|||||||
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
|
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
|
||||||
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
|
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
|
||||||
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
||||||
/* TODO XForms might need to be restarted, but it is currently (09/02/18)
|
|
||||||
* broken, so we cannot test it */
|
|
||||||
init_RU_proc(ru);
|
|
||||||
ru->rf_map.card = 0;
|
|
||||||
ru->rf_map.chain = 0; /* CC_id + chain_offset;*/
|
|
||||||
init_eNB_afterRU();
|
init_eNB_afterRU();
|
||||||
printf("Sending sync to all threads\n");
|
printf("Sending sync to all threads\n");
|
||||||
pthread_mutex_lock(&sync_mutex);
|
pthread_mutex_lock(&sync_mutex);
|
||||||
@@ -1187,10 +1157,16 @@ int main ( int argc, char **argv ) {
|
|||||||
RCconfig_L1();
|
RCconfig_L1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
|
||||||
|
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
|
||||||
|
// some initialization is necessary and init_ru_vnf do this.
|
||||||
|
RU_t ru;
|
||||||
|
|
||||||
|
|
||||||
/* We need to read RU configuration before FlexRAN starts so it knows what
|
/* We need to read RU configuration before FlexRAN starts so it knows what
|
||||||
* splits to report. Actual RU start comes later. */
|
* splits to report. Actual RU start comes later. */
|
||||||
if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) {
|
if ( NFAPI_MODE != NFAPI_MODE_VNF) {
|
||||||
RCconfig_RU();
|
ocpRCconfig_RU(&ru);
|
||||||
LOG_I(PHY,
|
LOG_I(PHY,
|
||||||
"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",
|
"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",
|
||||||
RC.nb_L1_inst, RC.nb_RU, get_nprocs());
|
RC.nb_L1_inst, RC.nb_RU, get_nprocs());
|
||||||
@@ -1211,7 +1187,7 @@ int main ( int argc, char **argv ) {
|
|||||||
if (RC.nb_inst > 0) {
|
if (RC.nb_inst > 0) {
|
||||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||||
for (i = 0; i < RC.nb_inst; i++) {
|
for (i = 0; i < RC.nb_inst; i++) {
|
||||||
flexran_agent_start(i);
|
//flexran_agent_start(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks
|
/* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks
|
||||||
@@ -1292,20 +1268,16 @@ int main ( int argc, char **argv ) {
|
|||||||
|
|
||||||
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
|
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
|
||||||
|
|
||||||
// RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
|
|
||||||
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
|
|
||||||
// some initialization is necessary and init_ru_vnf do this.
|
|
||||||
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||||
printf("Initializing RU threads\n");
|
printf("Initializing RU threads\n");
|
||||||
init_RU(get_softmodem_params()->rf_config_file,
|
ocp_init_RU(&ru,
|
||||||
|
get_softmodem_params()->rf_config_file,
|
||||||
get_softmodem_params()->send_dmrs_sync);
|
get_softmodem_params()->send_dmrs_sync);
|
||||||
|
|
||||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
ru.rf_map.card=0;
|
||||||
RC.ru[ru_id]->rf_map.card=0;
|
ru.rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
||||||
RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
init_RU_proc(&ru);
|
||||||
LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
|
|
||||||
init_RU_proc(RC.ru[ru_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
config_sync_var=0;
|
config_sync_var=0;
|
||||||
|
|
||||||
@@ -1316,6 +1288,7 @@ int main ( int argc, char **argv ) {
|
|||||||
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
|
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
|
||||||
// once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
|
// once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
|
||||||
printf("ALL RUs ready - init eNBs\n");
|
printf("ALL RUs ready - init eNBs\n");
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
if (NFAPI_MODE!=NFAPI_MODE_PNF && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
if (NFAPI_MODE!=NFAPI_MODE_PNF && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||||
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
|
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||||
@@ -1369,10 +1342,6 @@ int main ( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int inst = 0; inst < RC.nb_RU; inst++) {
|
|
||||||
phy_free_RU(RC.ru[inst]);
|
|
||||||
}
|
|
||||||
|
|
||||||
free_lte_top();
|
free_lte_top();
|
||||||
end_configmodule();
|
end_configmodule();
|
||||||
pthread_cond_destroy(&sync_cond);
|
pthread_cond_destroy(&sync_cond);
|
||||||
@@ -1381,17 +1350,6 @@ int main ( int argc, char **argv ) {
|
|||||||
pthread_mutex_destroy(&nfapi_sync_mutex);
|
pthread_mutex_destroy(&nfapi_sync_mutex);
|
||||||
pthread_mutex_destroy(&ue_pf_po_mutex);
|
pthread_mutex_destroy(&ue_pf_po_mutex);
|
||||||
|
|
||||||
for(int ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
|
||||||
if (RC.ru[ru_id]->rfdevice.trx_end_func) {
|
|
||||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
|
||||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
|
|
||||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
|
||||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
terminate_opt();
|
terminate_opt();
|
||||||
|
|||||||
+20
-19
@@ -623,6 +623,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
|
|||||||
unsigned int rxs;
|
unsigned int rxs;
|
||||||
int i;
|
int i;
|
||||||
uint32_t samples_per_slot = fp->get_samples_per_slot(*slot,fp);
|
uint32_t samples_per_slot = fp->get_samples_per_slot(*slot,fp);
|
||||||
|
uint32_t samples_per_slot_prev ;
|
||||||
openair0_timestamp ts,old_ts;
|
openair0_timestamp ts,old_ts;
|
||||||
AssertFatal(*slot<fp->slots_per_frame && *slot>=0, "slot %d is illegal (%d)\n",*slot,fp->slots_per_frame);
|
AssertFatal(*slot<fp->slots_per_frame && *slot>=0, "slot %d is illegal (%d)\n",*slot,fp->slots_per_frame);
|
||||||
|
|
||||||
@@ -658,16 +659,16 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
|
|||||||
ru->ts_offset = proc->timestamp_rx;
|
ru->ts_offset = proc->timestamp_rx;
|
||||||
proc->timestamp_rx = 0;
|
proc->timestamp_rx = 0;
|
||||||
} else {
|
} else {
|
||||||
if (proc->timestamp_rx - old_ts != fp->get_samples_per_slot((*slot-1)%fp->slots_per_frame,fp)) {
|
samples_per_slot_prev = fp->get_samples_per_slot((*slot-1)%fp->slots_per_frame,fp);
|
||||||
LOG_D(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - samples_per_slot,ru->ts_offset);
|
if (proc->timestamp_rx - old_ts != samples_per_slot_prev) {
|
||||||
ru->ts_offset += (proc->timestamp_rx - old_ts - samples_per_slot);
|
LOG_D(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - samples_per_slot_prev,ru->ts_offset);
|
||||||
|
ru->ts_offset += (proc->timestamp_rx - old_ts - samples_per_slot_prev);
|
||||||
proc->timestamp_rx = ts-ru->ts_offset;
|
proc->timestamp_rx = ts-ru->ts_offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_subframe*10))&1023;
|
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_subframe*10))&1023;
|
||||||
uint32_t idx_sf = proc->timestamp_rx / fp->samples_per_subframe;
|
proc->tti_rx = fp->get_slot_from_timestamp(proc->timestamp_rx,fp);
|
||||||
proc->tti_rx = (idx_sf * fp->slots_per_subframe + (int)round((float)(proc->timestamp_rx % fp->samples_per_subframe) / fp->samples_per_slot0))%(fp->slots_per_frame);
|
|
||||||
// synchronize first reception to frame 0 subframe 0
|
// synchronize first reception to frame 0 subframe 0
|
||||||
LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, slot %d.%d / %d\n",
|
LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, slot %d.%d / %d\n",
|
||||||
ru->idx,
|
ru->idx,
|
||||||
@@ -688,7 +689,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (proc->frame_rx != *frame) {
|
if (proc->frame_rx != *frame) {
|
||||||
LOG_E(PHY,"Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->frame_rx %d frame %d)\n",(long long unsigned int)proc->timestamp_rx,proc->frame_rx,*frame);
|
LOG_E(PHY,"Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->frame_rx %d frame %d, proc->tti_rx %d, slot %d)\n",(long long unsigned int)proc->timestamp_rx,proc->frame_rx,*frame,proc->tti_rx,*slot);
|
||||||
exit_fun("Exiting");
|
exit_fun("Exiting");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -727,6 +728,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
|||||||
//nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame);
|
//nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame);
|
||||||
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT || IS_SOFTMODEM_RFSIM) {
|
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT || IS_SOFTMODEM_RFSIM) {
|
||||||
|
|
||||||
|
if (cfg->cell_config.frame_duplex_type.value == TDD){
|
||||||
if(slot_type == NR_MIXED_SLOT) {
|
if(slot_type == NR_MIXED_SLOT) {
|
||||||
txsymb = 0;
|
txsymb = 0;
|
||||||
for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
||||||
@@ -742,15 +744,10 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
|||||||
flags = 3; // end of burst
|
flags = 3; // end of burst
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg->cell_config.frame_duplex_type.value == TDD &&
|
if (slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT)
|
||||||
slot_type == NR_DOWNLINK_SLOT &&
|
|
||||||
prevslot_type == NR_UPLINK_SLOT) {
|
|
||||||
flags = 2; // start of burst
|
flags = 2; // start of burst
|
||||||
}
|
|
||||||
|
|
||||||
if (cfg->cell_config.frame_duplex_type.value == TDD &&
|
if (slot_type == NR_DOWNLINK_SLOT && nextslot_type == NR_UPLINK_SLOT)
|
||||||
slot_type == NR_DOWNLINK_SLOT &&
|
|
||||||
nextslot_type == NR_UPLINK_SLOT) {
|
|
||||||
flags = 3; // end of burst
|
flags = 3; // end of burst
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +755,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
|||||||
// the beam index is written in bits 8-10 of the flags
|
// the beam index is written in bits 8-10 of the flags
|
||||||
// bit 11 enables the gpio programming
|
// bit 11 enables the gpio programming
|
||||||
int beam=0;
|
int beam=0;
|
||||||
if (slot==0) beam = 11; //3 for boresight & 8 to enable
|
//if (slot==0) beam = 11; //3 for boresight & 8 to enable
|
||||||
/*
|
/*
|
||||||
if (slot==0 || slot==40) beam=0&8;
|
if (slot==0 || slot==40) beam=0&8;
|
||||||
if (slot==10 || slot==50) beam=1&8;
|
if (slot==10 || slot==50) beam=1&8;
|
||||||
@@ -1149,19 +1146,22 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
|
|||||||
if (ru->if_frequency == 0) {
|
if (ru->if_frequency == 0) {
|
||||||
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
|
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
|
||||||
cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
|
cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
|
||||||
}
|
} else if (ru->if_freq_offset){
|
||||||
else {
|
cfg->tx_freq[i] = (double)(ru->if_frequency);
|
||||||
|
cfg->rx_freq[i] = (double)(ru->if_frequency + ru->if_freq_offset);
|
||||||
|
LOG_I(PHY, "Setting IF TX frequency to %lu Hz with IF RX frequency offset %d Hz\n", ru->if_frequency, ru->if_freq_offset);
|
||||||
|
} else {
|
||||||
cfg->tx_freq[i] = (double)ru->if_frequency;
|
cfg->tx_freq[i] = (double)ru->if_frequency;
|
||||||
cfg->rx_freq[i] = (double)(ru->if_frequency+fp->ul_CarrierFreq-fp->dl_CarrierFreq);
|
cfg->rx_freq[i] = (double)(ru->if_frequency+fp->ul_CarrierFreq-fp->dl_CarrierFreq);
|
||||||
}
|
}
|
||||||
cfg->tx_gain[i] = ru->att_tx;
|
cfg->tx_gain[i] = ru->att_tx;
|
||||||
cfg->rx_gain[i] = ru->max_rxgain-ru->att_rx;
|
cfg->rx_gain[i] = ru->max_rxgain-ru->att_rx;
|
||||||
cfg->configFilename = rf_config_file;
|
cfg->configFilename = rf_config_file;
|
||||||
printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
|
LOG_I(PHY, "Channel %d: setting tx_gain offset %f, rx_gain offset %f, tx_freq %lu Hz, rx_freq %lu Hz\n",
|
||||||
i, cfg->tx_gain[i],
|
i, cfg->tx_gain[i],
|
||||||
cfg->rx_gain[i],
|
cfg->rx_gain[i],
|
||||||
cfg->tx_freq[i],
|
(unsigned long)cfg->tx_freq[i],
|
||||||
cfg->rx_freq[i]);
|
(unsigned long)cfg->rx_freq[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2494,6 +2494,7 @@ void RCconfig_RU(void)
|
|||||||
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
|
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
|
||||||
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
|
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
|
||||||
RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr);
|
RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr);
|
||||||
|
RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr);
|
||||||
|
|
||||||
if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) {
|
if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) {
|
||||||
RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt;
|
RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt;
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ if(!IS_SOFTMODEM_NOS1)
|
|||||||
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
|
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
|
||||||
printf("ALL RUs ready - init gNBs\n");
|
printf("ALL RUs ready - init gNBs\n");
|
||||||
if(IS_SOFTMODEM_DOFORMS) {
|
if(IS_SOFTMODEM_DOFORMS) {
|
||||||
|
sleep(1);
|
||||||
scopeParms_t p;
|
scopeParms_t p;
|
||||||
p.argc=&argc;
|
p.argc=&argc;
|
||||||
p.argv=argv;
|
p.argv=argv;
|
||||||
|
|||||||
+39
-49
@@ -135,17 +135,15 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||||
NR_DL_FRAME_PARMS *frame_parms,
|
|
||||||
uint8_t UE_id,
|
uint8_t UE_id,
|
||||||
uint8_t abstraction_flag)
|
uint8_t abstraction_flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nb_connected_gNB = 1, gNB_id;
|
int nb_connected_gNB = 1, gNB_id;
|
||||||
|
|
||||||
memcpy(&(ue->frame_parms), frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
|
||||||
|
|
||||||
ue->Mod_id = UE_id;
|
ue->Mod_id = UE_id;
|
||||||
ue->mac_enabled = 1;
|
ue->mac_enabled = 1;
|
||||||
|
ue->if_inst = nr_ue_if_module_init(0);
|
||||||
|
|
||||||
// Setting UE mode to NOT_SYNCHED by default
|
// Setting UE mode to NOT_SYNCHED by default
|
||||||
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
|
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
|
||||||
@@ -158,6 +156,9 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
// intialize transport
|
// intialize transport
|
||||||
init_nr_ue_transport(ue, abstraction_flag);
|
init_nr_ue_transport(ue, abstraction_flag);
|
||||||
|
|
||||||
|
// init N_TA offset
|
||||||
|
init_N_TA_offset(ue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -175,24 +176,30 @@ static void UE_synch(void *arg) {
|
|||||||
int i, hw_slot_offset;
|
int i, hw_slot_offset;
|
||||||
PHY_VARS_NR_UE *UE = syncD->UE;
|
PHY_VARS_NR_UE *UE = syncD->UE;
|
||||||
sync_mode_t sync_mode = pbch;
|
sync_mode_t sync_mode = pbch;
|
||||||
int CC_id = UE->CC_id;
|
//int CC_id = UE->CC_id;
|
||||||
int freq_offset=0;
|
static int freq_offset=0;
|
||||||
UE->is_synchronized = 0;
|
UE->is_synchronized = 0;
|
||||||
|
|
||||||
if (UE->UE_scan == 0) {
|
if (UE->UE_scan == 0) {
|
||||||
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu64", UL %"PRIu64" (oai_exit %d, rx_num_channels %d)\n",
|
|
||||||
UE->frame_parms.dl_CarrierFreq, UE->frame_parms.ul_CarrierFreq,
|
#ifdef FR2_TEST
|
||||||
oai_exit, openair0_cfg[0].rx_num_channels);
|
// Overwrite DL frequency (for FR2 testing)
|
||||||
|
if (downlink_frequency[0][0]!=0){
|
||||||
|
UE->frame_parms.dl_CarrierFreq = downlink_frequency[0][0];
|
||||||
|
UE->frame_parms.ul_CarrierFreq = downlink_frequency[0][0];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
||||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq;
|
|
||||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq;
|
|
||||||
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
|
|
||||||
|
|
||||||
if (UE->frame_parms.frame_type == FDD)
|
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %f, UL %f (RF card %d, oai_exit %d, channel %d, rx_num_channels %d)\n",
|
||||||
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_FDD;
|
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i],
|
||||||
else
|
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i],
|
||||||
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_TDD;
|
UE->rf_map.card,
|
||||||
|
oai_exit,
|
||||||
|
i,
|
||||||
|
openair0_cfg[0].rx_num_channels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_mode = pbch;
|
sync_mode = pbch;
|
||||||
@@ -247,31 +254,25 @@ static void UE_synch(void *arg) {
|
|||||||
case pbch:
|
case pbch:
|
||||||
LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||||
|
|
||||||
|
uint64_t dl_carrier, ul_carrier;
|
||||||
|
double rx_gain_off = 0;
|
||||||
|
nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier);
|
||||||
|
|
||||||
if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) {
|
if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) {
|
||||||
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
|
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
|
||||||
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
|
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
|
||||||
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
|
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
|
||||||
LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %lu, UL %lu), UE_scan_carrier %d\n",
|
|
||||||
hw_slot_offset,
|
|
||||||
freq_offset,
|
|
||||||
UE->rx_total_gain_dB,
|
|
||||||
UE->frame_parms.dl_CarrierFreq+freq_offset,
|
|
||||||
UE->frame_parms.ul_CarrierFreq+freq_offset,
|
|
||||||
UE->UE_scan_carrier );
|
|
||||||
|
|
||||||
// rerun with new cell parameters and frequency-offset
|
// rerun with new cell parameters and frequency-offset
|
||||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
// todo: the freq_offset computed on DL shall be scaled before being applied to UL
|
||||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
nr_rf_card_config(&openair0_cfg[UE->rf_map.card], rx_gain_off, ul_carrier, dl_carrier, freq_offset);
|
||||||
|
|
||||||
if (freq_offset >= 0)
|
LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %f (DL %f Hz, UL %f Hz)\n",
|
||||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] += abs(freq_offset);
|
hw_slot_offset,
|
||||||
else
|
freq_offset,
|
||||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(freq_offset);
|
openair0_cfg[UE->rf_map.card].rx_gain[0],
|
||||||
|
openair0_cfg[UE->rf_map.card].rx_freq[0],
|
||||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
|
openair0_cfg[UE->rf_map.card].tx_freq[0]);
|
||||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+(UE->frame_parms.ul_CarrierFreq-UE->frame_parms.dl_CarrierFreq);
|
|
||||||
UE->frame_parms.dl_CarrierFreq = openair0_cfg[CC_id].rx_freq[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// reconfigure for potentially different bandwidth
|
// reconfigure for potentially different bandwidth
|
||||||
switch(UE->frame_parms.N_RB_DL) {
|
switch(UE->frame_parms.N_RB_DL) {
|
||||||
@@ -315,7 +316,6 @@ static void UE_synch(void *arg) {
|
|||||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
//nr_init_frame_parms_ue(&UE->frame_parms);
|
|
||||||
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||||
LOG_E(HW,"Could not start the device\n");
|
LOG_E(HW,"Could not start the device\n");
|
||||||
oai_exit=1;
|
oai_exit=1;
|
||||||
@@ -328,31 +328,21 @@ static void UE_synch(void *arg) {
|
|||||||
UE->is_synchronized = 1;
|
UE->is_synchronized = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// initial sync failed
|
|
||||||
// calculate new offset and try again
|
|
||||||
if (UE->UE_scan_carrier == 1) {
|
if (UE->UE_scan_carrier == 1) {
|
||||||
|
|
||||||
if (freq_offset >= 0)
|
if (freq_offset >= 0)
|
||||||
freq_offset += 100;
|
freq_offset += 100;
|
||||||
|
|
||||||
freq_offset *= -1;
|
freq_offset *= -1;
|
||||||
LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %lu, UL %lu)\n",
|
|
||||||
freq_offset,
|
|
||||||
UE->rx_total_gain_dB,
|
|
||||||
UE->frame_parms.dl_CarrierFreq+freq_offset,
|
|
||||||
UE->frame_parms.ul_CarrierFreq+freq_offset );
|
|
||||||
|
|
||||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
nr_rf_card_config(&openair0_cfg[UE->rf_map.card], rx_gain_off, ul_carrier, dl_carrier, freq_offset);
|
||||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq+freq_offset;
|
|
||||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq+freq_offset;
|
|
||||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
|
||||||
|
|
||||||
if (UE->UE_scan_carrier==1)
|
LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset);
|
||||||
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UE->mode != loop_through_memory)
|
if (UE->mode != loop_through_memory)
|
||||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||||
}// initial_sync=0
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
+112
-303
@@ -40,7 +40,7 @@
|
|||||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||||
#include "openair1/PHY/MODULATION/nr_modulation.h"
|
#include "openair1/PHY/MODULATION/nr_modulation.h"
|
||||||
#include "PHY/phy_vars_nr_ue.h"
|
#include "PHY/phy_vars_nr_ue.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_vars.h"
|
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||||
#include "SCHED/sched_common_vars.h"
|
#include "SCHED/sched_common_vars.h"
|
||||||
#include "PHY/MODULATION/modulation_vars.h"
|
#include "PHY/MODULATION/modulation_vars.h"
|
||||||
//#include "../../SIMU/USER/init_lte.h"
|
//#include "../../SIMU/USER/init_lte.h"
|
||||||
@@ -85,7 +85,9 @@ unsigned short config_frames[4] = {2,9,11,13};
|
|||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "executables/thread-common.h"
|
#include "executables/thread-common.h"
|
||||||
|
|
||||||
// Raphael : missing
|
extern const char *duplex_mode[];
|
||||||
|
|
||||||
|
// Thread variables
|
||||||
pthread_cond_t nfapi_sync_cond;
|
pthread_cond_t nfapi_sync_cond;
|
||||||
pthread_mutex_t nfapi_sync_mutex;
|
pthread_mutex_t nfapi_sync_mutex;
|
||||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||||
@@ -94,30 +96,40 @@ pthread_cond_t sync_cond;
|
|||||||
pthread_mutex_t sync_mutex;
|
pthread_mutex_t sync_mutex;
|
||||||
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
||||||
int config_sync_var=-1;
|
int config_sync_var=-1;
|
||||||
|
tpool_t *Tpool;
|
||||||
|
#ifdef UE_DLSCH_PARALLELISATION
|
||||||
|
tpool_t *Tpool_dl;
|
||||||
|
#endif
|
||||||
|
|
||||||
RAN_CONTEXT_t RC;
|
RAN_CONTEXT_t RC;
|
||||||
volatile int start_eNB = 0;
|
volatile int start_eNB = 0;
|
||||||
volatile int start_UE = 0;
|
volatile int start_UE = 0;
|
||||||
volatile int oai_exit = 0;
|
volatile int oai_exit = 0;
|
||||||
|
|
||||||
int single_thread_flag=1;
|
// Command line options
|
||||||
static double snr_dB=20;
|
|
||||||
|
|
||||||
int threequarter_fs=0;
|
|
||||||
|
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
|
||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
|
||||||
//int32_t uplink_counter = 0;
|
|
||||||
|
|
||||||
|
|
||||||
extern int16_t nr_dlsch_demod_shift;
|
extern int16_t nr_dlsch_demod_shift;
|
||||||
|
static int tx_max_power[MAX_NUM_CCs] = {0};
|
||||||
|
|
||||||
int UE_scan = 0;
|
int single_thread_flag = 1;
|
||||||
|
int threequarter_fs = 0;
|
||||||
int UE_scan_carrier = 0;
|
int UE_scan_carrier = 0;
|
||||||
int UE_fo_compensation = 0;
|
int UE_fo_compensation = 0;
|
||||||
int UE_no_timing_correction = 0;
|
int UE_no_timing_correction = 0;
|
||||||
runmode_t mode = normal_txrx;
|
int N_RB_DL = 0;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
int tddflag = 0;
|
||||||
|
int vcdflag = 0;
|
||||||
|
uint8_t nb_antenna_tx = 1;
|
||||||
|
uint8_t nb_antenna_rx = 1;
|
||||||
|
double rx_gain_off = 0.0;
|
||||||
|
uint32_t timing_advance = 0;
|
||||||
|
char *usrp_args = NULL;
|
||||||
|
char *rrc_config_path = NULL;
|
||||||
|
int dumpframe = 0;
|
||||||
|
|
||||||
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
int rx_input_level_dBm;
|
||||||
|
|
||||||
#if MAX_NUM_CCs == 1
|
#if MAX_NUM_CCs == 1
|
||||||
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
|
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
|
||||||
@@ -129,73 +141,24 @@ double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
|
|||||||
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
|
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double rx_gain_off = 0.0;
|
// UE and OAI config variables
|
||||||
|
|
||||||
double sample_rate=30.72e6;
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
double bw = 10.0e6;
|
|
||||||
|
|
||||||
static int tx_max_power[MAX_NUM_CCs] = {0};
|
|
||||||
|
|
||||||
|
|
||||||
int chain_offset=0;
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t dci_Format = 0;
|
|
||||||
uint8_t agregation_Level =0xFF;
|
|
||||||
|
|
||||||
uint8_t nb_antenna_tx = 1;
|
|
||||||
uint8_t nb_antenna_rx = 1;
|
|
||||||
|
|
||||||
char ref[128] = "internal";
|
|
||||||
char channels[128] = "0";
|
|
||||||
|
|
||||||
|
|
||||||
int rx_input_level_dBm;
|
|
||||||
|
|
||||||
//static int online_log_messages=0;
|
|
||||||
|
|
||||||
|
|
||||||
int otg_enabled;
|
|
||||||
//int number_of_cards = 1;
|
|
||||||
|
|
||||||
static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
|
|
||||||
int16_t node_synch_ref[MAX_NUM_CCs];
|
int16_t node_synch_ref[MAX_NUM_CCs];
|
||||||
|
int otg_enabled;
|
||||||
|
double cpuf;
|
||||||
|
|
||||||
uint32_t target_dl_mcs = 28; //maximum allowed mcs
|
runmode_t mode = normal_txrx;
|
||||||
uint32_t target_ul_mcs = 20;
|
int UE_scan = 0;
|
||||||
uint32_t timing_advance = 0;
|
int chain_offset = 0;
|
||||||
uint64_t num_missed_slots = 0; // counter for the number of missed slots
|
uint64_t num_missed_slots = 0; // counter for the number of missed slots
|
||||||
|
|
||||||
|
|
||||||
int transmission_mode = 1;
|
int transmission_mode = 1;
|
||||||
int numerology = 0;
|
int numerology = 0;
|
||||||
int usrp_tx_thread = 0;
|
int usrp_tx_thread = 0;
|
||||||
|
|
||||||
/* flag set by eNB conf file to specify if the radio head is local or remote (default option is local) */
|
|
||||||
//uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD;
|
|
||||||
/* struct for ethernet specific parameters given in eNB conf file */
|
|
||||||
//eth_params_t *eth_params;
|
|
||||||
|
|
||||||
double cpuf;
|
|
||||||
|
|
||||||
char uecap_xer[1024],uecap_xer_in=0;
|
|
||||||
|
|
||||||
int oaisim_flag = 0;
|
int oaisim_flag = 0;
|
||||||
int emulate_rf = 0;
|
int emulate_rf = 0;
|
||||||
|
|
||||||
tpool_t *Tpool;
|
char uecap_xer[1024],uecap_xer_in=0;
|
||||||
#ifdef UE_DLSCH_PARALLELISATION
|
|
||||||
tpool_t *Tpool_dl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
char *usrp_args=NULL;
|
|
||||||
|
|
||||||
char *rrc_config_path=NULL;
|
|
||||||
|
|
||||||
/* forward declarations */
|
|
||||||
void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
|
||||||
|
|
||||||
|
|
||||||
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
||||||
* this is very hackish - find a proper solution
|
* this is very hackish - find a proper solution
|
||||||
@@ -245,37 +208,6 @@ void exit_function(const char *file, const char *function, const int line, const
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reset_stats(long arg) {
|
|
||||||
//int i,j,k;
|
|
||||||
/*PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[0][0];
|
|
||||||
|
|
||||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
|
||||||
for (k=0; k<8; k++) { //harq_processes
|
|
||||||
for (j=0; j<phy_vars_eNB->dlsch[i][0]->Mlimit; j++) {
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0;
|
|
||||||
|
|
||||||
for (j=0; j<phy_vars_eNB->ulsch[i]->Mlimit; j++) {
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_decoding_attempts[k][j]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_decoding_attempts_last[k][j]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_round_errors[k][j]=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].ulsch_round_fer[k][j]=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0;
|
|
||||||
phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void *l2l1_task(void *arg) {
|
void *l2l1_task(void *arg) {
|
||||||
MessageDef *message_p = NULL;
|
MessageDef *message_p = NULL;
|
||||||
int result;
|
int result;
|
||||||
@@ -316,21 +248,12 @@ void *l2l1_task(void *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int16_t dlsch_demod_shift;
|
|
||||||
|
|
||||||
static void get_options(void) {
|
static void get_options(void) {
|
||||||
int CC_id;
|
|
||||||
int tddflag=0, nonbiotflag, vcdflag=0;
|
|
||||||
char *loopfile=NULL;
|
char *loopfile=NULL;
|
||||||
int dumpframe=0;
|
|
||||||
//uint32_t noS1;
|
|
||||||
//uint32_t nokrnmod;
|
|
||||||
//uint32_t nokrnmod;
|
|
||||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ;
|
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ;
|
||||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||||
|
|
||||||
|
|
||||||
paramdef_t cmdline_uemodeparams[] = CMDLINE_UEMODEPARAMS_DESC;
|
paramdef_t cmdline_uemodeparams[] = CMDLINE_UEMODEPARAMS_DESC;
|
||||||
paramdef_t cmdline_ueparams[] = CMDLINE_NRUEPARAMS_DESC;
|
paramdef_t cmdline_ueparams[] = CMDLINE_NRUEPARAMS_DESC;
|
||||||
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
|
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
|
||||||
@@ -351,54 +274,12 @@ static void get_options(void) {
|
|||||||
if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr)
|
if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr)
|
||||||
if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx;
|
if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx;
|
||||||
|
|
||||||
if (dumpframe > 0) mode = rx_dump_frame;
|
if ((cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0)
|
||||||
|
mode = rx_dump_frame;
|
||||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
|
||||||
frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
UE_scan=0;
|
|
||||||
|
|
||||||
if (tddflag > 0) {
|
|
||||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
|
|
||||||
frame_parms[CC_id]->frame_type = TDD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vcdflag > 0)
|
if (vcdflag > 0)
|
||||||
ouput_vcd = 1;
|
ouput_vcd = 1;
|
||||||
|
|
||||||
/*if (frame_parms[0]->N_RB_DL !=0) {
|
|
||||||
if ( frame_parms[0]->N_RB_DL < 6 ) {
|
|
||||||
frame_parms[0]->N_RB_DL = 6;
|
|
||||||
printf ( "%i: Invalid number of resource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL);
|
|
||||||
}
|
|
||||||
if ( frame_parms[0]->N_RB_DL > 100 ) {
|
|
||||||
frame_parms[0]->N_RB_DL = 100;
|
|
||||||
printf ( "%i: Invalid number of resource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL);
|
|
||||||
}
|
|
||||||
if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) {
|
|
||||||
frame_parms[0]->N_RB_DL = 50;
|
|
||||||
printf ( "%i: Invalid number of resource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL);
|
|
||||||
}
|
|
||||||
if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) {
|
|
||||||
frame_parms[0]->N_RB_DL = 25;
|
|
||||||
printf ( "%i: Invalid number of resource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL);
|
|
||||||
}
|
|
||||||
UE_scan = 0;
|
|
||||||
frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL;
|
|
||||||
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
|
|
||||||
frame_parms[CC_id]->N_RB_DL=frame_parms[0]->N_RB_DL;
|
|
||||||
frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
|
|
||||||
tx_max_power[CC_id]=tx_max_power[0];
|
|
||||||
rx_gain[0][CC_id] = rx_gain[0][0];
|
|
||||||
tx_gain[0][CC_id] = tx_gain[0][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) {
|
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) {
|
||||||
// Here the configuration file is the XER encoded UE capabilities
|
// Here the configuration file is the XER encoded UE capabilities
|
||||||
// Read it in and store in asn1c data structures
|
// Read it in and store in asn1c data structures
|
||||||
@@ -408,44 +289,56 @@ static void get_options(void) {
|
|||||||
} /* UE with config file */
|
} /* UE with config file */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set PHY vars from command line
|
||||||
|
void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
||||||
|
|
||||||
void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
// Init power variables
|
||||||
int CC_id;
|
tx_max_power[CC_id] = tx_max_power[0];
|
||||||
|
rx_gain[0][CC_id] = rx_gain[0][0];
|
||||||
|
tx_gain[0][CC_id] = tx_gain[0][0];
|
||||||
|
|
||||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
// Set UE variables
|
||||||
/* Set some default values that may be overwritten while reading options */
|
UE->UE_scan = UE_scan;
|
||||||
frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) calloc(sizeof(NR_DL_FRAME_PARMS),1);
|
UE->UE_scan_carrier = UE_scan_carrier;
|
||||||
frame_parms[CC_id]->nr_band = 78;
|
UE->UE_fo_compensation = UE_fo_compensation;
|
||||||
frame_parms[CC_id]->frame_type = FDD;
|
UE->no_timing_correction = UE_no_timing_correction;
|
||||||
frame_parms[CC_id]->tdd_config = 3;
|
UE->mode = mode;
|
||||||
//frame_parms[CC_id]->tdd_config_S = 0;
|
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
||||||
frame_parms[CC_id]->N_RB_DL = 106;
|
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
||||||
frame_parms[CC_id]->N_RB_UL = 106;
|
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
||||||
frame_parms[CC_id]->Ncp = NORMAL;
|
|
||||||
//frame_parms[CC_id]->Ncp_UL = NORMAL;
|
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction);
|
||||||
frame_parms[CC_id]->Nid_cell = 0;
|
|
||||||
//frame_parms[CC_id]->num_MBSFN_config = 0;
|
// Set FP variables
|
||||||
frame_parms[CC_id]->nb_antenna_ports_gNB = 1;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
frame_parms[CC_id]->nb_antennas_tx = 1;
|
fp->nb_antennas_tx = nb_antenna_tx;
|
||||||
frame_parms[CC_id]->nb_antennas_rx = 1;
|
fp->nb_antennas_rx = nb_antenna_rx;
|
||||||
//frame_parms[CC_id]->nushift = 0;
|
fp->threequarter_fs = threequarter_fs;
|
||||||
// NR: Init to legacy LTE 20Mhz params
|
if (tddflag){
|
||||||
frame_parms[CC_id]->numerology_index = 0;
|
fp->frame_type = TDD;
|
||||||
frame_parms[CC_id]->ttis_per_subframe = 1;
|
LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type);
|
||||||
frame_parms[CC_id]->slots_per_tti = 2;
|
|
||||||
}
|
}
|
||||||
|
if (N_RB_DL){
|
||||||
|
fp->N_RB_DL = N_RB_DL;
|
||||||
|
LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", nb_antenna_rx, nb_antenna_tx, threequarter_fs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_openair0(void) {
|
void init_openair0(void) {
|
||||||
int card;
|
int card;
|
||||||
int i;
|
int freq_off = 0;
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms = &PHY_vars_UE_g[0][0]->frame_parms;
|
||||||
|
|
||||||
for (card=0; card<MAX_CARDS; card++) {
|
for (card=0; card<MAX_CARDS; card++) {
|
||||||
|
uint64_t dl_carrier, ul_carrier;
|
||||||
openair0_cfg[card].configFilename = NULL;
|
openair0_cfg[card].configFilename = NULL;
|
||||||
openair0_cfg[card].threequarter_fs = frame_parms[0]->threequarter_fs;
|
openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs;
|
||||||
numerology = frame_parms[0]->numerology_index;
|
numerology = frame_parms->numerology_index;
|
||||||
|
|
||||||
if(frame_parms[0]->N_RB_DL == 66) {
|
if(frame_parms->N_RB_DL == 66) {
|
||||||
if (numerology==3) {
|
if (numerology==3) {
|
||||||
openair0_cfg[card].sample_rate=122.88e6;
|
openair0_cfg[card].sample_rate=122.88e6;
|
||||||
openair0_cfg[card].samples_per_frame = 1228800;
|
openair0_cfg[card].samples_per_frame = 1228800;
|
||||||
@@ -453,7 +346,7 @@ void init_openair0(void) {
|
|||||||
LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
|
LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}else if(frame_parms[0]->N_RB_DL == 32) {
|
}else if(frame_parms->N_RB_DL == 32) {
|
||||||
if (numerology==3) {
|
if (numerology==3) {
|
||||||
openair0_cfg[card].sample_rate=61.44e6;
|
openair0_cfg[card].sample_rate=61.44e6;
|
||||||
openair0_cfg[card].samples_per_frame = 614400;
|
openair0_cfg[card].samples_per_frame = 614400;
|
||||||
@@ -461,9 +354,9 @@ void init_openair0(void) {
|
|||||||
LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
|
LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}else if(frame_parms[0]->N_RB_DL == 217) {
|
}else if(frame_parms->N_RB_DL == 217) {
|
||||||
if (numerology==1) {
|
if (numerology==1) {
|
||||||
if (frame_parms[0]->threequarter_fs) {
|
if (frame_parms->threequarter_fs) {
|
||||||
openair0_cfg[card].sample_rate=92.16e6;
|
openair0_cfg[card].sample_rate=92.16e6;
|
||||||
openair0_cfg[card].samples_per_frame = 921600;
|
openair0_cfg[card].samples_per_frame = 921600;
|
||||||
}
|
}
|
||||||
@@ -475,9 +368,9 @@ void init_openair0(void) {
|
|||||||
LOG_E(PHY,"Unsupported numerology!\n");
|
LOG_E(PHY,"Unsupported numerology!\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
} else if(frame_parms[0]->N_RB_DL == 273) {
|
} else if(frame_parms->N_RB_DL == 273) {
|
||||||
if (numerology==1) {
|
if (numerology==1) {
|
||||||
if (frame_parms[0]->threequarter_fs) {
|
if (frame_parms->threequarter_fs) {
|
||||||
AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
|
AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -488,9 +381,9 @@ void init_openair0(void) {
|
|||||||
LOG_E(PHY,"Unsupported numerology!\n");
|
LOG_E(PHY,"Unsupported numerology!\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
} else if(frame_parms[0]->N_RB_DL == 106) {
|
} else if(frame_parms->N_RB_DL == 106) {
|
||||||
if (numerology==0) {
|
if (numerology==0) {
|
||||||
if (frame_parms[0]->threequarter_fs) {
|
if (frame_parms->threequarter_fs) {
|
||||||
openair0_cfg[card].sample_rate=23.04e6;
|
openair0_cfg[card].sample_rate=23.04e6;
|
||||||
openair0_cfg[card].samples_per_frame = 230400;
|
openair0_cfg[card].samples_per_frame = 230400;
|
||||||
} else {
|
} else {
|
||||||
@@ -498,7 +391,7 @@ void init_openair0(void) {
|
|||||||
openair0_cfg[card].samples_per_frame = 307200;
|
openair0_cfg[card].samples_per_frame = 307200;
|
||||||
}
|
}
|
||||||
} else if (numerology==1) {
|
} else if (numerology==1) {
|
||||||
if (frame_parms[0]->threequarter_fs) {
|
if (frame_parms->threequarter_fs) {
|
||||||
openair0_cfg[card].sample_rate=46.08e6;
|
openair0_cfg[card].sample_rate=46.08e6;
|
||||||
openair0_cfg[card].samples_per_frame = 460800;
|
openair0_cfg[card].samples_per_frame = 460800;
|
||||||
}
|
}
|
||||||
@@ -513,57 +406,44 @@ void init_openair0(void) {
|
|||||||
LOG_E(PHY,"Unsupported numerology!\n");
|
LOG_E(PHY,"Unsupported numerology!\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
} else if(frame_parms[0]->N_RB_DL == 50) {
|
} else if(frame_parms->N_RB_DL == 50) {
|
||||||
openair0_cfg[card].sample_rate=15.36e6;
|
openair0_cfg[card].sample_rate=15.36e6;
|
||||||
openair0_cfg[card].samples_per_frame = 153600;
|
openair0_cfg[card].samples_per_frame = 153600;
|
||||||
} else if (frame_parms[0]->N_RB_DL == 25) {
|
} else if (frame_parms->N_RB_DL == 25) {
|
||||||
openair0_cfg[card].sample_rate=7.68e6;
|
openair0_cfg[card].sample_rate=7.68e6;
|
||||||
openair0_cfg[card].samples_per_frame = 76800;
|
openair0_cfg[card].samples_per_frame = 76800;
|
||||||
} else if (frame_parms[0]->N_RB_DL == 6) {
|
} else if (frame_parms->N_RB_DL == 6) {
|
||||||
openair0_cfg[card].sample_rate=1.92e6;
|
openair0_cfg[card].sample_rate=1.92e6;
|
||||||
openair0_cfg[card].samples_per_frame = 19200;
|
openair0_cfg[card].samples_per_frame = 19200;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms[0]->N_RB_DL);
|
LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms->N_RB_DL);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame_parms[0]->frame_type==TDD)
|
if (frame_parms->frame_type==TDD)
|
||||||
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
|
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
|
||||||
else //FDD
|
else
|
||||||
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
|
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
|
||||||
|
|
||||||
printf("HW: Configuring card %d, nb_antennas_tx/rx %hhu/%hhu\n",card,
|
|
||||||
PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx,
|
|
||||||
PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
|
|
||||||
openair0_cfg[card].Mod_id = 0;
|
openair0_cfg[card].Mod_id = 0;
|
||||||
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
|
openair0_cfg[card].num_rb_dl = frame_parms->N_RB_DL;
|
||||||
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
|
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
|
||||||
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
|
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
|
||||||
openair0_cfg[card].tx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx);
|
openair0_cfg[card].tx_num_channels = min(2, frame_parms->nb_antennas_tx);
|
||||||
openair0_cfg[card].rx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
|
openair0_cfg[card].rx_num_channels = min(2, frame_parms->nb_antennas_rx);
|
||||||
|
|
||||||
for (i=0; i<4; i++) {
|
LOG_I(PHY, "HW: Configuring card %d, tx/rx num_channels %d/%d, duplex_mode %s\n",
|
||||||
if (i<openair0_cfg[card].tx_num_channels)
|
card,
|
||||||
openair0_cfg[card].tx_freq[i] = frame_parms[0]->ul_CarrierFreq;
|
openair0_cfg[card].tx_num_channels,
|
||||||
else
|
openair0_cfg[card].rx_num_channels,
|
||||||
openair0_cfg[card].tx_freq[i]=0.0;
|
duplex_mode[openair0_cfg[card].duplex_mode]);
|
||||||
|
|
||||||
if (i<openair0_cfg[card].rx_num_channels)
|
nr_get_carrier_frequencies(frame_parms, &dl_carrier, &ul_carrier);
|
||||||
openair0_cfg[card].rx_freq[i] = frame_parms[0]->dl_CarrierFreq;
|
|
||||||
else
|
nr_rf_card_config(&openair0_cfg[card], rx_gain_off, ul_carrier, dl_carrier, freq_off);
|
||||||
openair0_cfg[card].rx_freq[i]=0.0;
|
|
||||||
|
|
||||||
openair0_cfg[card].autocal[i] = 1;
|
|
||||||
openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
|
|
||||||
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
|
|
||||||
openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file;
|
openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file;
|
||||||
printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
|
|
||||||
card,i, openair0_cfg[card].tx_gain[i],
|
|
||||||
openair0_cfg[card].rx_gain[i],
|
|
||||||
openair0_cfg[card].tx_freq[i],
|
|
||||||
openair0_cfg[card].rx_freq[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args;
|
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args;
|
||||||
|
|
||||||
@@ -607,14 +487,12 @@ int main( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
set_softmodem_sighandler();
|
set_softmodem_sighandler();
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||||
set_default_frame_parms(frame_parms);
|
|
||||||
mode = normal_txrx;
|
|
||||||
memset(openair0_cfg,0,sizeof(openair0_config_t)*MAX_CARDS);
|
memset(openair0_cfg,0,sizeof(openair0_config_t)*MAX_CARDS);
|
||||||
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
|
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
|
||||||
// initialize logging
|
// initialize logging
|
||||||
logInit();
|
logInit();
|
||||||
// get options and fill parameters from configuration file
|
// get options and fill parameters from configuration file
|
||||||
get_options (); //Command-line options, enb_properties
|
get_options(); //Command-line options
|
||||||
get_common_options(SOFTMODEM_5GUE_BIT );
|
get_common_options(SOFTMODEM_5GUE_BIT );
|
||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
T_Config_Init();
|
T_Config_Init();
|
||||||
@@ -649,14 +527,6 @@ int main( int argc, char **argv ) {
|
|||||||
init_NR_UE(1,rrc_config_path);
|
init_NR_UE(1,rrc_config_path);
|
||||||
if(IS_SOFTMODEM_NOS1)
|
if(IS_SOFTMODEM_NOS1)
|
||||||
init_pdcp();
|
init_pdcp();
|
||||||
/*
|
|
||||||
#ifdef PDCP_USE_NETLINK
|
|
||||||
netlink_init();
|
|
||||||
#if defined(PDCP_USE_NETLINK_QUEUES)
|
|
||||||
pdcp_netlink_init();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
NB_UE_INST=1;
|
NB_UE_INST=1;
|
||||||
NB_INST=1;
|
NB_INST=1;
|
||||||
@@ -667,93 +537,33 @@ int main( int argc, char **argv ) {
|
|||||||
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
|
||||||
|
|
||||||
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||||
printf("frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size);
|
|
||||||
frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
|
|
||||||
frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
|
|
||||||
frame_parms[CC_id]->nb_antenna_ports_gNB = 1; //initial value overwritten by initial sync later
|
|
||||||
frame_parms[CC_id]->threequarter_fs = threequarter_fs;
|
|
||||||
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
|
|
||||||
|
|
||||||
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
|
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
|
||||||
|
|
||||||
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
||||||
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
|
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
|
||||||
|
|
||||||
|
set_options(CC_id, UE[CC_id]);
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||||
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
|
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
|
||||||
mac->if_module->phy_config_request(&mac->phy_config);
|
mac->if_module->phy_config_request(&mac->phy_config);
|
||||||
|
|
||||||
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
||||||
nr_init_frame_parms_ue(frame_parms[CC_id],nrUE_config,NORMAL);
|
|
||||||
|
|
||||||
|
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||||
|
init_symbol_rotation(&UE[CC_id]->frame_parms, UE[CC_id]->frame_parms.dl_CarrierFreq);
|
||||||
|
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
|
||||||
|
|
||||||
|
#ifdef FR2_TEST
|
||||||
// Overwrite DL frequency (for FR2 testing)
|
// Overwrite DL frequency (for FR2 testing)
|
||||||
if (downlink_frequency[0][0]!=0){
|
if (downlink_frequency[0][0]!=0){
|
||||||
frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
|
frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
|
||||||
|
if (frame_parms[CC_id]->frame_type == TDD)
|
||||||
frame_parms[CC_id]->ul_CarrierFreq = downlink_frequency[0][0];
|
frame_parms[CC_id]->ul_CarrierFreq = downlink_frequency[0][0];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
init_symbol_rotation(frame_parms[CC_id],frame_parms[CC_id]->dl_CarrierFreq);
|
|
||||||
init_nr_ue_vars(UE[CC_id],frame_parms[CC_id],0,abstraction_flag);
|
|
||||||
|
|
||||||
UE[CC_id]->mac_enabled = 1;
|
|
||||||
UE[CC_id]->if_inst = nr_ue_if_module_init(0);
|
|
||||||
UE[CC_id]->UE_scan = UE_scan;
|
|
||||||
UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
|
|
||||||
UE[CC_id]->UE_fo_compensation = UE_fo_compensation;
|
|
||||||
UE[CC_id]->mode = mode;
|
|
||||||
UE[CC_id]->no_timing_correction = UE_no_timing_correction;
|
|
||||||
printf("UE[%d]->mode = %d\n",CC_id,mode);
|
|
||||||
|
|
||||||
UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
|
||||||
UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
|
|
||||||
|
|
||||||
if (UE[CC_id]->frame_parms.frame_type == FDD) {
|
|
||||||
UE[CC_id]->N_TA_offset = 0;
|
|
||||||
} else {
|
|
||||||
int N_RB = UE[CC_id]->frame_parms.N_RB_DL;
|
|
||||||
int N_TA_offset = UE[CC_id]->frame_parms.ul_CarrierFreq < 6e9 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2
|
|
||||||
double factor=1;
|
|
||||||
switch (UE[CC_id]->frame_parms.numerology_index) {
|
|
||||||
case 0: //15 kHz scs
|
|
||||||
AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n");
|
|
||||||
if (N_RB <= 25) factor = .25; // 7.68 Ms/s
|
|
||||||
else if (N_RB <=50) factor = .5; // 15.36 Ms/s
|
|
||||||
else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s
|
|
||||||
else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s
|
|
||||||
else AssertFatal(1==0,"Too many PRBS for mu=0\n");
|
|
||||||
break;
|
|
||||||
case 1: //30 kHz sc
|
|
||||||
AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n");
|
|
||||||
if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s
|
|
||||||
else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s
|
|
||||||
break;
|
|
||||||
case 2: //60 kHz scs
|
|
||||||
AssertFatal(1==0,"scs_common should not be 60 kHz\n");
|
|
||||||
break;
|
|
||||||
case 3: //120 kHz scs
|
|
||||||
AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n");
|
|
||||||
break;
|
|
||||||
case 4: //240 kHz scs
|
|
||||||
AssertFatal(1==0,"scs_common should not be 60 kHz\n");
|
|
||||||
if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s
|
|
||||||
else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s
|
|
||||||
else AssertFatal(1==0,"N_RB %d is too big for curretn FR2 implementation\n",N_RB);
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (N_RB == 100)
|
|
||||||
UE[CC_id]->N_TA_offset = 624;
|
|
||||||
else if (N_RB == 50)
|
|
||||||
UE[CC_id]->N_TA_offset = 624/2;
|
|
||||||
else if (N_RB == 25)
|
|
||||||
UE[CC_id]->N_TA_offset = 624/4;
|
|
||||||
}
|
|
||||||
if (UE[CC_id]->frame_parms.threequarter_fs == 1) factor = factor*.75;
|
|
||||||
UE[CC_id]->N_TA_offset = (int)(N_TA_offset * factor);
|
|
||||||
LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d)\n", UE[CC_id]->Mod_id, UE[CC_id]->N_TA_offset, factor, UE[CC_id]->frame_parms.ul_CarrierFreq, N_RB);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("tx_max_power = %d -> amp %d\n",tx_max_power[0],get_tx_amp(tx_max_poHwer,tx_max_power));
|
|
||||||
init_openair0();
|
init_openair0();
|
||||||
// init UE_PF_PO and mutex lock
|
// init UE_PF_PO and mutex lock
|
||||||
pthread_mutex_init(&ue_pf_po_mutex, NULL);
|
pthread_mutex_init(&ue_pf_po_mutex, NULL);
|
||||||
@@ -764,7 +574,6 @@ int main( int argc, char **argv ) {
|
|||||||
if(IS_SOFTMODEM_DOFORMS) {
|
if(IS_SOFTMODEM_DOFORMS) {
|
||||||
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
||||||
}
|
}
|
||||||
number_of_cards = 1;
|
|
||||||
|
|
||||||
for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||||
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
|
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
|
||||||
|
|||||||
@@ -48,13 +48,12 @@
|
|||||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
||||||
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&UE_fo_compensation, defintval:0, TYPE_INT, 0}, \
|
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&UE_fo_compensation, defintval:0, TYPE_INT, 0}, \
|
||||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
||||||
{"r" , CONFIG_HLP_PRB, 0, iptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
{"r" , CONFIG_HLP_PRB, 0, iptr:&(N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
||||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
|
||||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
|
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* command line parameters common to eNodeB and UE */
|
/* command line parameters common to gNB and UE */
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define CMDLINE_PARAMS_DESC_UE { \
|
#define CMDLINE_PARAMS_DESC_UE { \
|
||||||
@@ -62,22 +61,16 @@
|
|||||||
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||||
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
|
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0}, \
|
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 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}, \
|
|
||||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||||
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
|
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 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}, \
|
|
||||||
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \
|
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \
|
||||||
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
|
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern int T_port;
|
extern int T_port;
|
||||||
extern int T_nowait;
|
extern int T_nowait;
|
||||||
extern int T_dont_fork;
|
extern int T_dont_fork;
|
||||||
|
|
||||||
|
|
||||||
// In nr-ue.c
|
// In nr-ue.c
|
||||||
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||||
extern void fill_ue_band_info(void);
|
extern void fill_ue_band_info(void);
|
||||||
@@ -86,7 +79,7 @@ extern void init_NR_UE_threads(int);
|
|||||||
extern void reset_opp_meas(void);
|
extern void reset_opp_meas(void);
|
||||||
extern void print_opp_meas(void);
|
extern void print_opp_meas(void);
|
||||||
void *UE_thread(void *arg);
|
void *UE_thread(void *arg);
|
||||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
|
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag);
|
||||||
extern tpool_t *Tpool;
|
extern tpool_t *Tpool;
|
||||||
extern tpool_t *Tpool_dl;
|
extern tpool_t *Tpool_dl;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,7 @@ extern "C"
|
|||||||
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
||||||
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
||||||
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
||||||
|
#define CONFIG_HLP_ULF "Set the uplink frequency offset for all component carriers\n"
|
||||||
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
||||||
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
|
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
|
||||||
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
|
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
|
||||||
@@ -123,6 +124,7 @@ extern "C"
|
|||||||
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
||||||
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
||||||
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0, TYPE_UINT64, 0}, \
|
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0, TYPE_UINT64, 0}, \
|
||||||
|
{"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \
|
||||||
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 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}, \
|
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
|
||||||
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
||||||
@@ -230,6 +232,7 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
|
|||||||
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
|
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
|
||||||
extern void set_softmodem_sighandler(void);
|
extern void set_softmodem_sighandler(void);
|
||||||
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -720,9 +720,6 @@ int pnf_phy_hi_dci0_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pnf_phy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) {
|
int pnf_phy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) {
|
||||||
if (RC.ru == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RC.eNB == 0) {
|
if (RC.eNB == 0) {
|
||||||
return -2;
|
return -2;
|
||||||
@@ -847,9 +844,6 @@ int pnf_phy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, n
|
|||||||
req->ul_config_request_body.srs_present
|
req->ul_config_request_body.srs_present
|
||||||
);
|
);
|
||||||
|
|
||||||
if (RC.ru == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RC.eNB == 0) {
|
if (RC.eNB == 0) {
|
||||||
return -2;
|
return -2;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "PHY/impl_defs_nr.h"
|
#include "PHY/impl_defs_nr.h"
|
||||||
|
|
||||||
#define NFAPI_UE_MAX_NUM_CB 8
|
#define NFAPI_UE_MAX_NUM_CB 8
|
||||||
|
#define NFAPI_MAX_NUM_UL_PDU 8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
@@ -155,7 +156,7 @@ typedef struct {
|
|||||||
uint16_t slot;
|
uint16_t slot;
|
||||||
fapi_nr_tx_config_t tx_config;
|
fapi_nr_tx_config_t tx_config;
|
||||||
uint16_t number_of_pdus;
|
uint16_t number_of_pdus;
|
||||||
fapi_nr_tx_request_body_t *tx_request_body;
|
fapi_nr_tx_request_body_t tx_request_body[NFAPI_MAX_NUM_UL_PDU];
|
||||||
} fapi_nr_tx_request_t;
|
} fapi_nr_tx_request_t;
|
||||||
|
|
||||||
/// This struct replaces:
|
/// This struct replaces:
|
||||||
|
|||||||
@@ -45,8 +45,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn);
|
extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn);
|
||||||
|
|
||||||
extern int32_t get_nr_uldl_offset(int nr_bandP);
|
|
||||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -451,51 +449,25 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
|||||||
uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion;
|
uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion;
|
||||||
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
|
||||||
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
|
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
|
||||||
|
int32_t dlul_offset = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
gNB_config->cell_config.phy_cell_id.value = phy_config->cfg->cell_config.phy_cell_id.value;
|
|
||||||
gNB_config->carrier_config.dl_frequency.value = phy_config->cfg->carrier_config.dl_frequency.value;
|
|
||||||
gNB_config->carrier_config.uplink_frequency.value = phy_config->cfg->carrier_config.uplink_frequency.value;
|
|
||||||
gNB_config->ssb_config.scs_common.value = phy_config->cfg->ssb_config.scs_common.value;
|
|
||||||
gNB_config->carrier_config.dl_bandwidth.value = phy_config->cfg->carrier_config.dl_bandwidth.value;
|
|
||||||
gNB_config->carrier_config.uplink_bandwidth.value = phy_config->cfg->carrier_config.uplink_bandwidth.value;
|
|
||||||
gNB_config->ssb_table.ssb_subcarrier_offset.value = phy_config->cfg->ssb_table.ssb_subcarrier_offset.value;
|
|
||||||
gNB_config->ssb_table.ssb_offset_point_a.value = phy_config->cfg->ssb_table.ssb_offset_point_a.value;
|
|
||||||
gNB_config->ssb_table.ssb_mask_list[0].ssb_mask.value = phy_config->cfg->ssb_table.ssb_mask_list[0].ssb_mask.value;
|
|
||||||
gNB_config->ssb_table.ssb_mask_list[1].ssb_mask.value = phy_config->cfg->ssb_table.ssb_mask_list[1].ssb_mask.value;
|
|
||||||
gNB_config->ssb_table.ssb_period.value = phy_config->cfg->ssb_table.ssb_period.value;
|
|
||||||
for (int i=0; i<5; i++) {
|
|
||||||
gNB_config->carrier_config.dl_grid_size[i].value = phy_config->cfg->carrier_config.dl_grid_size[i].value;
|
|
||||||
gNB_config->carrier_config.ul_grid_size[i].value = phy_config->cfg->carrier_config.ul_grid_size[i].value;
|
|
||||||
gNB_config->carrier_config.dl_k0[i].value = phy_config->cfg->carrier_config.dl_k0[i].value;
|
|
||||||
gNB_config->carrier_config.ul_k0[i].value = phy_config->cfg->carrier_config.ul_k0[i].value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (phy_config->cfg->cell_config.frame_duplex_type.value == 0) {
|
|
||||||
gNB_config->cell_config.frame_duplex_type.value = FDD;
|
|
||||||
} else {
|
|
||||||
gNB_config->cell_config.frame_duplex_type.value = TDD;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config));
|
|
||||||
memcpy((void*)&gNB_config->tdd_table,(void*)&phy_config->cfg->tdd_table,sizeof(phy_config->cfg->tdd_table));
|
|
||||||
*/
|
|
||||||
memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg));
|
memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg));
|
||||||
RC.gNB[Mod_id]->mac_enabled = 1;
|
RC.gNB[Mod_id]->mac_enabled = 1;
|
||||||
|
|
||||||
uint64_t dl_bw_khz = (12*gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
uint64_t dl_bw_khz = (12*gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
||||||
fp->dl_CarrierFreq = ((dl_bw_khz>>1) + gNB_config->carrier_config.dl_frequency.value)*1000 ;
|
fp->dl_CarrierFreq = ((dl_bw_khz>>1) + gNB_config->carrier_config.dl_frequency.value)*1000 ;
|
||||||
|
|
||||||
int32_t dlul_offset = 0;
|
|
||||||
lte_frame_type_t frame_type = 0;
|
|
||||||
|
|
||||||
get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type);
|
|
||||||
|
|
||||||
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
|
||||||
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
|
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
|
||||||
|
|
||||||
AssertFatal(fp->ul_CarrierFreq==(fp->dl_CarrierFreq+dlul_offset), "Disagreement in uplink frequency for band %d\n", fp->nr_band);
|
fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||||
|
|
||||||
|
get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset);
|
||||||
|
dlul_offset *= 1000;
|
||||||
|
|
||||||
|
AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + dlul_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + dlul_offset);
|
||||||
|
|
||||||
|
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
|
||||||
|
|
||||||
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
|
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
|
||||||
LOG_I(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
|
LOG_I(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
|
||||||
|
|||||||
+56
-266
@@ -350,13 +350,6 @@ void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(Rel10) || defined(Rel14)
|
|
||||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
|
||||||
uint8_t eNB_index,
|
|
||||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
|
||||||
int CC_id) {
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void phy_config_harq_ue(module_id_t Mod_id,
|
void phy_config_harq_ue(module_id_t Mod_id,
|
||||||
@@ -374,210 +367,6 @@ void phy_config_harq_ue(module_id_t Mod_id,
|
|||||||
|
|
||||||
extern uint16_t beta_cqi[16];
|
extern uint16_t beta_cqi[16];
|
||||||
|
|
||||||
/*
|
|
||||||
void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
|
||||||
struct PhysicalConfigDedicated *physicalConfigDedicated )
|
|
||||||
{
|
|
||||||
|
|
||||||
static uint8_t first_dedicated_configuration = 0;
|
|
||||||
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
|
||||||
|
|
||||||
phy_vars_ue->total_TBS[eNB_id]=0;
|
|
||||||
phy_vars_ue->total_TBS_last[eNB_id]=0;
|
|
||||||
phy_vars_ue->bitrate[eNB_id]=0;
|
|
||||||
phy_vars_ue->total_received_bits[eNB_id]=0;
|
|
||||||
phy_vars_ue->dlsch_errors[eNB_id]=0;
|
|
||||||
phy_vars_ue->dlsch_errors_last[eNB_id]=0;
|
|
||||||
phy_vars_ue->dlsch_received[eNB_id]=0;
|
|
||||||
phy_vars_ue->dlsch_received_last[eNB_id]=0;
|
|
||||||
phy_vars_ue->dlsch_fer[eNB_id]=0;
|
|
||||||
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
|
|
||||||
|
|
||||||
if (physicalConfigDedicated) {
|
|
||||||
LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id);
|
|
||||||
LOG_D(PHY,"------------------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->pdsch_ConfigDedicated) {
|
|
||||||
phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a=physicalConfigDedicated->pdsch_ConfigDedicated->p_a;
|
|
||||||
LOG_D(PHY,"pdsch_config_dedicated.p_a %d\n",phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a);
|
|
||||||
LOG_D(PHY,"\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->pucch_ConfigDedicated) {
|
|
||||||
if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
|
|
||||||
phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=0;
|
|
||||||
else {
|
|
||||||
phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode)
|
|
||||||
phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = *physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode;
|
|
||||||
else
|
|
||||||
phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = bundling;
|
|
||||||
|
|
||||||
if ( phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode == multiplexing)
|
|
||||||
LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = multiplexing\n");
|
|
||||||
else
|
|
||||||
LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = bundling\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->pusch_ConfigDedicated) {
|
|
||||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
|
|
||||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
|
|
||||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
|
|
||||||
|
|
||||||
|
|
||||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index);
|
|
||||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index);
|
|
||||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d => %d)\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index,beta_cqi[phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index]);
|
|
||||||
LOG_D(PHY,"\n");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->uplinkPowerControlDedicated) {
|
|
||||||
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH = physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUSCH;
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled= physicalConfigDedicated->uplinkPowerControlDedicated->deltaMCS_Enabled;
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled= physicalConfigDedicated->uplinkPowerControlDedicated->accumulationEnabled;
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH= physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUCCH;
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset= physicalConfigDedicated->uplinkPowerControlDedicated->pSRS_Offset;
|
|
||||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient= *physicalConfigDedicated->uplinkPowerControlDedicated->filterCoefficient;
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUSCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH);
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.deltaMCS_Enabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled);
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.accumulationEnabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled);
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUCCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH);
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.pSRS_Offset %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset);
|
|
||||||
LOG_D(PHY,"ul_power_control_dedicated.filterCoefficient %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient);
|
|
||||||
LOG_D(PHY,"\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->antennaInfo) {
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
|
|
||||||
LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]);
|
|
||||||
switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm1:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 1;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm2:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 2;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm3:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 3;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm4:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 4;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm5:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 5;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm6:
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 6;
|
|
||||||
break;
|
|
||||||
case AntennaInfoDedicated__transmissionMode_tm7:
|
|
||||||
lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
|
|
||||||
phy_vars_ue->transmission_mode[eNB_id] = 7;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG_E(PHY,"Unknown transmission mode!\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->schedulingRequestConfig) {
|
|
||||||
if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) {
|
|
||||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
|
|
||||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
|
|
||||||
phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
|
|
||||||
|
|
||||||
LOG_D(PHY,"scheduling_request_config.sr_PUCCH_ResourceIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
|
|
||||||
LOG_D(PHY,"scheduling_request_config.sr_ConfigIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex);
|
|
||||||
LOG_D(PHY,"scheduling_request_config.dsr_TransMax %d\n",phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_D(PHY,"------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
|
|
||||||
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
|
|
||||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
|
|
||||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
|
|
||||||
|
|
||||||
|
|
||||||
LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_D(PHY,"------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (physicalConfigDedicated->cqi_ReportConfig) {
|
|
||||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) {
|
|
||||||
// configure PUSCH CQI reporting
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
|
|
||||||
if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) &&
|
|
||||||
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) &&
|
|
||||||
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31))
|
|
||||||
LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
|
|
||||||
}
|
|
||||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
|
|
||||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
|
|
||||||
// configure PUCCH CQI reporting
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
|
|
||||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
|
|
||||||
}
|
|
||||||
else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) {
|
|
||||||
// handle release
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
|
|
||||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"[PHY][UE %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id,eNB_id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fill cqi parameters for periodic CQI reporting
|
|
||||||
get_cqipmiri_params(phy_vars_ue,eNB_id);
|
|
||||||
|
|
||||||
// disable MIB SIB decoding once we are on connected mode
|
|
||||||
first_dedicated_configuration ++;
|
|
||||||
if(first_dedicated_configuration > 1)
|
|
||||||
{
|
|
||||||
LOG_I(PHY,"Disable SIB MIB decoding \n");
|
|
||||||
phy_vars_ue->decode_SIB = 0;
|
|
||||||
phy_vars_ue->decode_MIB = 0;
|
|
||||||
}
|
|
||||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
|
||||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
|
||||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
|
||||||
else
|
|
||||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
|
||||||
|
|
||||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
|
||||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*! \brief Helper function to allocate memory for DLSCH data structures.
|
/*! \brief Helper function to allocate memory for DLSCH data structures.
|
||||||
* \param[out] pdsch Pointer to the LTE_UE_PDSCH structure to initialize.
|
* \param[out] pdsch Pointer to the LTE_UE_PDSCH structure to initialize.
|
||||||
* \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
|
* \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
|
||||||
@@ -656,7 +445,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
|||||||
fp->nb_antennas_rx=1;
|
fp->nb_antennas_rx=1;
|
||||||
// dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig;
|
// dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig;
|
||||||
// ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
|
// ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
|
||||||
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
|
LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx);
|
||||||
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
||||||
phy_init_nr_top(ue);
|
phy_init_nr_top(ue);
|
||||||
// many memory allocation sizes are hard coded
|
// many memory allocation sizes are hard coded
|
||||||
@@ -971,6 +760,61 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
|
|||||||
ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
|
ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void init_N_TA_offset(PHY_VARS_NR_UE *ue){
|
||||||
|
|
||||||
|
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||||
|
|
||||||
|
if (fp->frame_type == FDD) {
|
||||||
|
ue->N_TA_offset = 0;
|
||||||
|
} else {
|
||||||
|
int N_RB = fp->N_RB_DL;
|
||||||
|
int N_TA_offset = fp->ul_CarrierFreq < 6e9 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2
|
||||||
|
double factor = 1;
|
||||||
|
switch (fp->numerology_index) {
|
||||||
|
case 0: //15 kHz scs
|
||||||
|
AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n");
|
||||||
|
if (N_RB <= 25) factor = .25; // 7.68 Ms/s
|
||||||
|
else if (N_RB <=50) factor = .5; // 15.36 Ms/s
|
||||||
|
else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s
|
||||||
|
else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s
|
||||||
|
else AssertFatal(1==0, "Too many PRBS for mu=0\n");
|
||||||
|
break;
|
||||||
|
case 1: //30 kHz sc
|
||||||
|
AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n");
|
||||||
|
if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s
|
||||||
|
else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s
|
||||||
|
break;
|
||||||
|
case 2: //60 kHz scs
|
||||||
|
AssertFatal(1==0, "scs_common should not be 60 kHz\n");
|
||||||
|
break;
|
||||||
|
case 3: //120 kHz scs
|
||||||
|
AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n");
|
||||||
|
break;
|
||||||
|
case 4: //240 kHz scs
|
||||||
|
AssertFatal(1==0, "scs_common should not be 60 kHz\n");
|
||||||
|
if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s
|
||||||
|
else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s
|
||||||
|
else AssertFatal(1==0, "N_RB %d is too big for curretn FR2 implementation\n", N_RB);
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (N_RB == 100)
|
||||||
|
ue->N_TA_offset = 624;
|
||||||
|
else if (N_RB == 50)
|
||||||
|
ue->N_TA_offset = 624/2;
|
||||||
|
else if (N_RB == 25)
|
||||||
|
ue->N_TA_offset = 624/4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fp->threequarter_fs == 1)
|
||||||
|
factor = factor*.75;
|
||||||
|
|
||||||
|
ue->N_TA_offset = (int)(N_TA_offset * factor);
|
||||||
|
|
||||||
|
LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, N_RB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void phy_init_nr_top(PHY_VARS_NR_UE *ue) {
|
void phy_init_nr_top(PHY_VARS_NR_UE *ue) {
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||||
crcTableInit();
|
crcTableInit();
|
||||||
@@ -988,57 +832,3 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) {
|
|||||||
//init_scrambling_lut();
|
//init_scrambling_lut();
|
||||||
//set_taus_seed(1328);
|
//set_taus_seed(1328);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_default_frame_parms_single(nfapi_nr_config_request_t *config,
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms) {
|
|
||||||
/* Set some default values that may be overwritten while reading options */
|
|
||||||
frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS));
|
|
||||||
config = (nfapi_nr_config_request_t*) malloc(sizeof(nfapi_nr_config_request_t));
|
|
||||||
config->subframe_config.numerology_index_mu.value =1;
|
|
||||||
config->subframe_config.duplex_mode.value = 1; //FDD
|
|
||||||
config->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
|
|
||||||
config->rf_config.dl_carrier_bandwidth.value = 100;
|
|
||||||
config->rf_config.ul_carrier_bandwidth.value = 100;
|
|
||||||
config->sch_config.physical_cell_id.value = 0;
|
|
||||||
|
|
||||||
frame_parms->frame_type = FDD;
|
|
||||||
//frame_parms[CC_id]->tdd_config_S = 0;
|
|
||||||
frame_parms->N_RB_DL = 106;
|
|
||||||
frame_parms->N_RB_UL = 106;
|
|
||||||
frame_parms->Ncp = NORMAL;
|
|
||||||
//frame_parms[CC_id]->Ncp_UL = NORMAL;
|
|
||||||
frame_parms->Nid_cell = 0;
|
|
||||||
//frame_parms[CC_id]->num_MBSFN_config = 0;
|
|
||||||
frame_parms->nb_antenna_ports_gNB = 1;
|
|
||||||
frame_parms->nb_antennas_tx = 1;
|
|
||||||
frame_parms->nb_antennas_rx = 1;
|
|
||||||
|
|
||||||
//frame_parms[CC_id]->nushift = 0;
|
|
||||||
|
|
||||||
///frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth;
|
|
||||||
//frame_parms[CC_id]->phich_config_common.phich_duration = normal;
|
|
||||||
|
|
||||||
// UL RS Config
|
|
||||||
/*frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 1;//n_DMRS1 set to 0
|
|
||||||
frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
|
|
||||||
frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
|
|
||||||
frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
|
|
||||||
|
|
||||||
frame_parms[CC_id]->pusch_config_common.n_SB = 1;
|
|
||||||
frame_parms[CC_id]->pusch_config_common.hoppingMode = 0;
|
|
||||||
frame_parms[CC_id]->pusch_config_common.pusch_HoppingOffset = 0;
|
|
||||||
frame_parms[CC_id]->pusch_config_common.enable64QAM = 0;
|
|
||||||
|
|
||||||
frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22;
|
|
||||||
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1;
|
|
||||||
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0;
|
|
||||||
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
|
|
||||||
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;*/
|
|
||||||
|
|
||||||
// NR: Init to legacy LTE 20Mhz params
|
|
||||||
frame_parms->numerology_index = 0;
|
|
||||||
frame_parms->ttis_per_subframe = 1;
|
|
||||||
frame_parms->slots_per_tti = 2;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -27,8 +27,6 @@
|
|||||||
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
|
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
|
||||||
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
|
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
|
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -85,6 +83,7 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
|
|||||||
|
|
||||||
void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw)
|
void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(mu) {
|
switch(mu) {
|
||||||
|
|
||||||
case NR_MU_0: //15kHz scs
|
case NR_MU_0: //15kHz scs
|
||||||
@@ -233,6 +232,20 @@ uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp)
|
|||||||
return samp_count;
|
return samp_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp)
|
||||||
|
{
|
||||||
|
uint32_t slot_idx = 0;
|
||||||
|
int samples_till_the_slot = 0;
|
||||||
|
timestamp_rx = timestamp_rx%fp->samples_per_frame;
|
||||||
|
|
||||||
|
while (timestamp_rx > samples_till_the_slot) {
|
||||||
|
samples_till_the_slot += fp->get_samples_per_slot(slot_idx,fp);
|
||||||
|
slot_idx++;
|
||||||
|
}
|
||||||
|
return slot_idx;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t get_samples_slot_timestamp(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead)
|
uint32_t get_samples_slot_timestamp(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead)
|
||||||
{
|
{
|
||||||
uint32_t samp_count = 0;
|
uint32_t samp_count = 0;
|
||||||
@@ -251,13 +264,15 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
|||||||
NR_DL_FRAME_PARMS *fp)
|
NR_DL_FRAME_PARMS *fp)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
AssertFatal (cfg != NULL, "%s %s:%i Null pointer to cfg %p!\n", __FUNCTION__, __FILE__, __LINE__, cfg);
|
||||||
|
|
||||||
fp->frame_type = cfg->cell_config.frame_duplex_type.value;
|
fp->frame_type = cfg->cell_config.frame_duplex_type.value;
|
||||||
fp->L_ssb = (((uint64_t) cfg->ssb_table.ssb_mask_list[0].ssb_mask.value)<<32) | cfg->ssb_table.ssb_mask_list[1].ssb_mask.value ;
|
fp->L_ssb = (((uint64_t) cfg->ssb_table.ssb_mask_list[0].ssb_mask.value)<<32) | cfg->ssb_table.ssb_mask_list[1].ssb_mask.value ;
|
||||||
fp->N_RB_DL = cfg->carrier_config.dl_grid_size[cfg->ssb_config.scs_common.value].value;
|
fp->N_RB_DL = cfg->carrier_config.dl_grid_size[cfg->ssb_config.scs_common.value].value;
|
||||||
fp->N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
|
fp->N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
|
||||||
|
|
||||||
int Ncp = NFAPI_CP_NORMAL;
|
int Ncp = NFAPI_CP_NORMAL;
|
||||||
int mu = cfg!= NULL ? cfg->ssb_config.scs_common.value : 0;
|
int mu = cfg->ssb_config.scs_common.value;
|
||||||
|
|
||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
|
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
|
||||||
@@ -289,6 +304,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
|||||||
(fp->nb_prefix_samples + fp->ofdm_symbol_size) * (fp->symbols_per_slot * fp->slots_per_subframe - 2);
|
(fp->nb_prefix_samples + fp->ofdm_symbol_size) * (fp->symbols_per_slot * fp->slots_per_subframe - 2);
|
||||||
fp->get_samples_per_slot = &get_samples_per_slot;
|
fp->get_samples_per_slot = &get_samples_per_slot;
|
||||||
fp->get_samples_slot_timestamp = &get_samples_slot_timestamp;
|
fp->get_samples_slot_timestamp = &get_samples_slot_timestamp;
|
||||||
|
fp->get_slot_from_timestamp = &get_slot_from_timestamp;
|
||||||
fp->samples_per_frame = 10 * fp->samples_per_subframe;
|
fp->samples_per_frame = 10 * fp->samples_per_subframe;
|
||||||
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
|
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
|
||||||
|
|
||||||
@@ -305,7 +321,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fp->N_ssb = 0;
|
fp->N_ssb = 0;
|
||||||
int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value;
|
int num_tx_ant = cfg->carrier_config.num_tx_ant.value;
|
||||||
|
|
||||||
for (int p=0; p<num_tx_ant; p++)
|
for (int p=0; p<num_tx_ant; p++)
|
||||||
fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
|
fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
|
||||||
@@ -316,9 +332,22 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
|||||||
|
|
||||||
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
|
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
|
||||||
fapi_nr_config_request_t* config,
|
fapi_nr_config_request_t* config,
|
||||||
int Ncp)
|
uint16_t nr_band)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
uint8_t nb_ant_ports_gNB = 1;
|
||||||
|
uint8_t tdd_cfg = 3;
|
||||||
|
uint8_t Nid_cell = 0;
|
||||||
|
int Ncp = NORMAL;
|
||||||
|
|
||||||
|
// default values until overwritten by RRCConnectionReconfiguration
|
||||||
|
fp->nb_antenna_ports_gNB = nb_ant_ports_gNB;
|
||||||
|
fp->tdd_config = tdd_cfg;
|
||||||
|
fp->Nid_cell = Nid_cell;
|
||||||
|
fp->nr_band = nr_band;
|
||||||
|
|
||||||
|
LOG_I(PHY, "Initializing frame parms: set nb_antenna_ports_gNB %d, tdd_config, %d, Nid_cell %d\n", fp->nb_antenna_ports_gNB, fp->tdd_config, fp->Nid_cell);
|
||||||
|
|
||||||
uint64_t dl_bw_khz = (12*config->carrier_config.dl_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common);
|
uint64_t dl_bw_khz = (12*config->carrier_config.dl_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common);
|
||||||
fp->dl_CarrierFreq = ((dl_bw_khz>>1) + config->carrier_config.dl_frequency)*1000 ;
|
fp->dl_CarrierFreq = ((dl_bw_khz>>1) + config->carrier_config.dl_frequency)*1000 ;
|
||||||
|
|
||||||
@@ -330,11 +359,15 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
|
|||||||
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
|
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
|
||||||
|
|
||||||
int32_t uplink_frequency_offset = 0;
|
int32_t uplink_frequency_offset = 0;
|
||||||
|
get_delta_duplex(fp->nr_band, fp->numerology_index, &uplink_frequency_offset);
|
||||||
|
get_frame_type(fp->nr_band, fp->numerology_index, &fp->frame_type);
|
||||||
|
uplink_frequency_offset *= 1000;
|
||||||
|
|
||||||
get_band(fp->dl_CarrierFreq, &fp->nr_band, &uplink_frequency_offset, &fp->frame_type);
|
LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset);
|
||||||
|
|
||||||
AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type in config request file for band %d\n", fp->nr_band);
|
AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type in config request file for band %d\n", fp->nr_band);
|
||||||
AssertFatal(fp->ul_CarrierFreq==(fp->dl_CarrierFreq+uplink_frequency_offset), "Disagreement in uplink frequency for band %d\n", fp->nr_band);
|
|
||||||
|
AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + uplink_frequency_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + uplink_frequency_offset);
|
||||||
|
|
||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("Initializing UE frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
|
printf("Initializing UE frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
|
||||||
@@ -350,11 +383,6 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
|
|||||||
set_scs_parameters(fp,fp->numerology_index,config->carrier_config.dl_bandwidth);
|
set_scs_parameters(fp,fp->numerology_index,config->carrier_config.dl_bandwidth);
|
||||||
|
|
||||||
fp->slots_per_frame = 10* fp->slots_per_subframe;
|
fp->slots_per_frame = 10* fp->slots_per_subframe;
|
||||||
|
|
||||||
fp->nb_antenna_ports_gNB = 1; // default value until overwritten by RRCConnectionReconfiguration
|
|
||||||
fp->nb_antennas_rx = 1; // default value until overwritten by RRCConnectionReconfiguration
|
|
||||||
fp->nb_antennas_tx = 1; // default value until overwritten by RRCConnectionReconfiguration
|
|
||||||
|
|
||||||
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
|
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
|
||||||
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
|
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
|
||||||
fp->samples_per_frame_wCP = 10 * fp->samples_per_subframe_wCP;
|
fp->samples_per_frame_wCP = 10 * fp->samples_per_subframe_wCP;
|
||||||
|
|||||||
@@ -394,9 +394,10 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
|
|||||||
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
|
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
|
||||||
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp);
|
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp);
|
||||||
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
|
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
|
||||||
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,fapi_nr_config_request_t *config,int Ncp);
|
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
|
||||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
|
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
|
||||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
|
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
|
||||||
|
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
|
||||||
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
|
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
|
||||||
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
|
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
|
||||||
void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
||||||
|
|||||||
@@ -2242,16 +2242,12 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
MIMO_mode_t mimo_mode = -1;
|
MIMO_mode_t mimo_mode = -1;
|
||||||
uint8_t mprime=0,Ns;
|
uint8_t mprime=0,Ns;
|
||||||
int8_t lprime=-1;
|
int8_t lprime=-1;
|
||||||
int aa=0;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_MODULATION
|
#ifdef DEBUG_DLSCH_MODULATION
|
||||||
uint8_t Nl0; //= dlsch0_harq->Nl;
|
uint8_t Nl0; //= dlsch0_harq->Nl;
|
||||||
uint8_t Nl1;
|
uint8_t Nl1;
|
||||||
#endif
|
#endif
|
||||||
int ru_id;
|
|
||||||
RU_t *ru;
|
|
||||||
int eNB_id;
|
|
||||||
|
|
||||||
|
|
||||||
if ((dlsch0 != NULL) && (dlsch1 != NULL)){
|
if ((dlsch0 != NULL) && (dlsch1 != NULL)){
|
||||||
@@ -2432,11 +2428,13 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mapping ue specific beamforming weights from UE specified DLSCH structure to RU beam weights for the eNB
|
// mapping ue specific beamforming weights from UE specified DLSCH structure to RU beam weights for the eNB
|
||||||
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
|
/*
|
||||||
|
for (int ru_id=0;ru_id<RC.nb_RU;ru_id++) {
|
||||||
|
RU_t *ru;
|
||||||
ru = RC.ru[ru_id];
|
ru = RC.ru[ru_id];
|
||||||
for (eNB_id=0;eNB_id<ru->num_eNB;eNB_id++){
|
for (int eNB_id=0;eNB_id<ru->num_eNB;eNB_id++){
|
||||||
if (phy_vars_eNB == ru->eNB_list[eNB_id]) {
|
if (phy_vars_eNB == ru->eNB_list[eNB_id]) {
|
||||||
for (aa=0;aa<ru->nb_tx;aa++){
|
for (int aa=0;aa<ru->nb_tx;aa++){
|
||||||
LOG_I(PHY,"ru_id:%d eNB_id:%d aa:%d memcpy(ru->beam_weights, dlsch0->ue_spec_bf_weights[ru_id][0],)\n", ru_id, eNB_id, aa);
|
LOG_I(PHY,"ru_id:%d eNB_id:%d aa:%d memcpy(ru->beam_weights, dlsch0->ue_spec_bf_weights[ru_id][0],)\n", ru_id, eNB_id, aa);
|
||||||
memcpy(ru->beam_weights[eNB_id][5][aa],
|
memcpy(ru->beam_weights[eNB_id][5][aa],
|
||||||
dlsch0->ue_spec_bf_weights[ru_id][0],
|
dlsch0->ue_spec_bf_weights[ru_id][0],
|
||||||
@@ -2445,6 +2443,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -506,10 +506,10 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq) {
|
|||||||
|
|
||||||
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
|
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
|
||||||
const double Tc=(1/480e3/4096);
|
const double Tc=(1/480e3/4096);
|
||||||
const double Nu=2048*64*.5;
|
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
|
||||||
const double f0= (double)CarrierFreq;
|
const double f0= (double)CarrierFreq;
|
||||||
const double Ncp0=16*64 + (144*64*.5);
|
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
|
||||||
const double Ncp1=(144*64*.5);
|
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
|
||||||
double tl=0,poff,exp_re,exp_im;
|
double tl=0,poff,exp_re,exp_im;
|
||||||
double Ncp,Ncpm1=Ncp0;
|
double Ncp,Ncpm1=Ncp0;
|
||||||
|
|
||||||
|
|||||||
@@ -483,13 +483,20 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
dft(dftsize,(int16_t *)&tmp_dft_in,
|
dft(dftsize,(int16_t *)&tmp_dft_in,
|
||||||
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
|
//dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
|
||||||
|
// (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||||
|
memcpy((void *)tmp_dft_in,
|
||||||
|
(void *) &rxdata[rxdata_offset-sample_offset],
|
||||||
|
(frame_parms->ofdm_symbol_size)*sizeof(int));
|
||||||
|
dft(dftsize,(int16_t *)&tmp_dft_in,
|
||||||
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||||
|
}
|
||||||
|
|
||||||
// clear DC carrier from OFDM symbols
|
// clear DC carrier from OFDM symbols
|
||||||
rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
|
rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
|
||||||
|
|
||||||
|
|
||||||
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||||
uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
|
uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
|
||||||
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
|
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
|
||||||
@@ -499,5 +506,6 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
(int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
(int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
||||||
frame_parms->ofdm_symbol_size,
|
frame_parms->ofdm_symbol_size,
|
||||||
15);
|
15);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( symbol == 3)
|
if( dmrss == 2) // update time statistics for last PBCH symbol
|
||||||
{
|
{
|
||||||
// do ifft of channel estimate
|
// do ifft of channel estimate
|
||||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
|
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t nr_tti_rx) {
|
uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t slot) {
|
||||||
/*
|
/*
|
||||||
#ifdef DEBUG_DCI
|
#ifdef DEBUG_DCI
|
||||||
if (frame_parms->frame_type == TDD)
|
if (frame_parms->frame_type == TDD)
|
||||||
@@ -69,11 +69,11 @@ uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
uint8_t ret = 255;
|
uint8_t ret = 255;
|
||||||
uint8_t subframe = nr_tti_rx>>((int)(log2 (frame_parms->ttis_per_subframe)));
|
uint8_t subframe = slot / frame_parms->slots_per_subframe;
|
||||||
|
|
||||||
AssertFatal(1==0,"Not ready for this ...\n");
|
AssertFatal(1==0,"Not ready for this ...\n");
|
||||||
if (frame_parms->frame_type == FDD) {
|
if (frame_parms->frame_type == FDD) {
|
||||||
ret = (((frame<<1)+nr_tti_rx)&7);
|
ret = (((frame<<1)+slot)&7);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
return(dlsch->max_ldpc_iterations + 1);
|
return(dlsch->max_ldpc_iterations + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (nr_tti_rx> (10*frame_parms->ttis_per_subframe-1)) {
|
/*if (nr_tti_rx> (frame_parms->slots_per_subframe-1)) {
|
||||||
printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx);
|
printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx);
|
||||||
return(dlsch->max_ldpc_iterations + 1);
|
return(dlsch->max_ldpc_iterations + 1);
|
||||||
}*/
|
}*/
|
||||||
@@ -649,14 +649,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t frame_rx_prev = frame;
|
|
||||||
int32_t tti_rx_prev = nr_tti_rx - 1;
|
|
||||||
if (tti_rx_prev < 0) {
|
|
||||||
frame_rx_prev--;
|
|
||||||
tti_rx_prev += 10*frame_parms->ttis_per_subframe;
|
|
||||||
}
|
|
||||||
frame_rx_prev = frame_rx_prev%1024;
|
|
||||||
|
|
||||||
if (err_flag == 1) {
|
if (err_flag == 1) {
|
||||||
//#if UE_DEBUG_TRACE
|
//#if UE_DEBUG_TRACE
|
||||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
||||||
@@ -843,7 +835,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
return(dlsch->max_ldpc_iterations);
|
return(dlsch->max_ldpc_iterations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (nr_tti_rx> (10*frame_parms->ttis_per_subframe-1)) {
|
/* if (nr_tti_rx> (frame_parms->slots_per_subframe-1)) {
|
||||||
printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx);
|
printf("dlsch_decoding.c: Illegal subframe index %d\n",nr_tti_rx);
|
||||||
return(dlsch->max_ldpc_iterations);
|
return(dlsch->max_ldpc_iterations);
|
||||||
}
|
}
|
||||||
@@ -1246,14 +1238,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
}
|
}
|
||||||
//} //loop r
|
//} //loop r
|
||||||
|
|
||||||
int32_t frame_rx_prev = frame;
|
|
||||||
int32_t tti_rx_prev = nr_tti_rx - 1;
|
|
||||||
if (tti_rx_prev < 0) {
|
|
||||||
frame_rx_prev--;
|
|
||||||
tti_rx_prev += 10*frame_parms->ttis_per_subframe;
|
|
||||||
}
|
|
||||||
frame_rx_prev = frame_rx_prev%1024;
|
|
||||||
|
|
||||||
if (err_flag == 1) {
|
if (err_flag == 1) {
|
||||||
#if UE_DEBUG_TRACE
|
#if UE_DEBUG_TRACE
|
||||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
dlsch0_harq->Qm = nr_get_Qm_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
|
dlsch0_harq->Qm = nr_get_Qm_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
|
||||||
dlsch0_harq->R = nr_get_code_rate_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
|
dlsch0_harq->R = nr_get_code_rate_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
|
||||||
|
if (dlsch0_harq->Qm == 0 || dlsch0_harq->R == 0) {
|
||||||
|
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_HARQ
|
#ifdef DEBUG_HARQ
|
||||||
printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode);
|
printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode);
|
||||||
@@ -687,13 +691,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
pdsch_vars[eNB_id]->llr_offset[symbol] = len*dlsch0_harq->Qm + llr_offset_symbol;
|
pdsch_vars[eNB_id]->llr_offset[symbol] = len*dlsch0_harq->Qm + llr_offset_symbol;
|
||||||
|
|
||||||
/*LOG_I(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n",
|
LOG_D(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d energy %d\n",
|
||||||
symbol,
|
symbol,
|
||||||
nb_rb,dlsch0_harq->Qm,
|
nb_rb,dlsch0_harq->Qm,
|
||||||
pdsch_vars[eNB_id]->llr_length[symbol],
|
pdsch_vars[eNB_id]->llr_length[symbol],
|
||||||
pdsch_vars[eNB_id]->llr_offset[symbol],
|
pdsch_vars[eNB_id]->llr_offset[symbol],
|
||||||
(int16_t*)pdsch_vars[eNB_id]->llr[0],
|
signal_energy(pdsch_vars[eNB_id]->rxdataF_comp0[0], 7*2*frame_parms->N_RB_DL*12));
|
||||||
pllr_symbol_cw0);*/
|
|
||||||
|
|
||||||
/*printf("compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n",
|
/*printf("compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n",
|
||||||
symbol,
|
symbol,
|
||||||
@@ -984,7 +988,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dlsch1_harq) {
|
if (dlsch1_harq) {
|
||||||
switch (nr_get_Qm_dl(dlsch1_harq->mcs,dlsch1_harq->mcs_table)) {
|
uint8_t Qm = nr_get_Qm_dl(dlsch1_harq->mcs,dlsch1_harq->mcs_table);
|
||||||
|
if (Qm == 0){
|
||||||
|
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
switch (Qm) {
|
||||||
case 2 :
|
case 2 :
|
||||||
if (rx_type==rx_standard) {
|
if (rx_type==rx_standard) {
|
||||||
nr_dlsch_qpsk_llr(frame_parms,
|
nr_dlsch_qpsk_llr(frame_parms,
|
||||||
|
|||||||
@@ -297,9 +297,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
|
|||||||
|
|
||||||
rx_sss_nr(ue,&metric_tdd_ncp,&phase_tdd_ncp);
|
rx_sss_nr(ue,&metric_tdd_ncp,&phase_tdd_ncp);
|
||||||
|
|
||||||
//FK: why do we need to do this again here?
|
|
||||||
//nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
|
|
||||||
|
|
||||||
nr_gold_pbch(ue);
|
nr_gold_pbch(ue);
|
||||||
ret = nr_pbch_detection(proc, ue,1,mode); // start pbch detection at first symbol after pss
|
ret = nr_pbch_detection(proc, ue,1,mode); // start pbch detection at first symbol after pss
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
#include "PHY/INIT/phy_init.h"
|
#include "PHY/INIT/phy_init.h"
|
||||||
|
|
||||||
//#define DEBUG_PBCH 1
|
//#define DEBUG_PBCH
|
||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
|
|
||||||
#ifdef OPENAIR2
|
#ifdef OPENAIR2
|
||||||
@@ -61,7 +61,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
|||||||
int nushiftmod4 = frame_parms->nushift;
|
int nushiftmod4 = frame_parms->nushift;
|
||||||
unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; //and
|
unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; //and
|
||||||
|
|
||||||
if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size;
|
// if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size;
|
||||||
|
rx_offset=(rx_offset)%(frame_parms->ofdm_symbol_size);
|
||||||
|
|
||||||
AssertFatal(symbol>=1 && symbol<5,
|
AssertFatal(symbol>=1 && symbol<5,
|
||||||
"symbol %d illegal for PBCH extraction\n",
|
"symbol %d illegal for PBCH extraction\n",
|
||||||
@@ -103,8 +104,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
|
rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size);
|
||||||
rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
//rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rxF_ext+=9;
|
rxF_ext+=9;
|
||||||
@@ -126,12 +127,14 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
|
rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size);
|
||||||
rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
//rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rxF_ext+=9;
|
rxF_ext+=9;
|
||||||
} else rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);//rx_offset = (rx_offset+12)&(frame_parms->ofdm_symbol_size-1);
|
} else{ //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);
|
||||||
|
rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1454,6 +1454,31 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
|||||||
runmode_t mode,
|
runmode_t mode,
|
||||||
int n_frames);
|
int n_frames);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter
|
||||||
|
@param fp Pointer to frame params
|
||||||
|
@param dl_Carrier Pointer to DL carrier to be set
|
||||||
|
@param ul_Carrier Pointer to UL carrier to be set
|
||||||
|
*/
|
||||||
|
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp,
|
||||||
|
uint64_t *dl_Carrier,
|
||||||
|
uint64_t *ul_Carrier);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief This function sets the OAI RF card rx/tx params
|
||||||
|
@param openair0_cfg Pointer OAI config for a specific card
|
||||||
|
@param tx_gain_off Tx gain offset
|
||||||
|
@param rx_gain_off Rx gain offset
|
||||||
|
@param ul_Carrier UL carrier to be set
|
||||||
|
@param dl_Carrier DL carrier to be set
|
||||||
|
@param freq_offset Freq offset to be set
|
||||||
|
*/
|
||||||
|
void nr_rf_card_config(openair0_config_t *openair0_cfg,
|
||||||
|
double rx_gain_off,
|
||||||
|
uint64_t ul_Carrier,
|
||||||
|
uint64_t dl_Carrier,
|
||||||
|
int freq_offset);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Encoding of PUSCH/ACK/RI/ACK from 36-212.
|
\brief Encoding of PUSCH/ACK/RI/ACK from 36-212.
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||||
|
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.openairinterface.org/?page_id=698
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*-------------------------------------------------------------------------------
|
||||||
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
|
* contact@openairinterface.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file PHY/NR_UE_TRANSPORT/nr_ue_rf_config.c
|
||||||
|
* \brief Functional helpers to configure the RF boards at UE side
|
||||||
|
* \author Guido Casati
|
||||||
|
* \date 2020
|
||||||
|
* \version 0.1
|
||||||
|
* \company Fraunhofer IIS
|
||||||
|
* \email: guido.casati@iis.fraunhofer.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PHY/defs_nr_UE.h"
|
||||||
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
|
#include "nr_transport_proto_ue.h"
|
||||||
|
|
||||||
|
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t *dl_carrier, uint64_t *ul_carrier){
|
||||||
|
|
||||||
|
if (downlink_frequency[0][0])
|
||||||
|
*dl_carrier = downlink_frequency[0][0];
|
||||||
|
else
|
||||||
|
*dl_carrier = fp->dl_CarrierFreq;
|
||||||
|
|
||||||
|
if (uplink_frequency_offset[0][0])
|
||||||
|
*ul_carrier = *dl_carrier + uplink_frequency_offset[0][0];
|
||||||
|
else
|
||||||
|
*ul_carrier = *dl_carrier + fp->ul_CarrierFreq - fp->dl_CarrierFreq;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void nr_rf_card_config(openair0_config_t *openair0_cfg,
|
||||||
|
double rx_gain_offset,
|
||||||
|
uint64_t ul_carrier,
|
||||||
|
uint64_t dl_carrier,
|
||||||
|
int freq_offset){
|
||||||
|
|
||||||
|
uint8_t mod_id = 0;
|
||||||
|
uint8_t cc_id = 0;
|
||||||
|
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id];
|
||||||
|
int rf_chain = ue->rf_map.chain;
|
||||||
|
double rx_gain = ue->rx_total_gain_dB;
|
||||||
|
double tx_gain = ue->tx_total_gain_dB;
|
||||||
|
|
||||||
|
for (int i = rf_chain; i < rf_chain + 4; i++) {
|
||||||
|
|
||||||
|
if (i < openair0_cfg->rx_num_channels)
|
||||||
|
openair0_cfg->rx_freq[i + rf_chain] = dl_carrier + freq_offset;
|
||||||
|
else
|
||||||
|
openair0_cfg->rx_freq[i] = 0.0;
|
||||||
|
|
||||||
|
if (i<openair0_cfg->tx_num_channels)
|
||||||
|
openair0_cfg->tx_freq[i] = ul_carrier + freq_offset;
|
||||||
|
else
|
||||||
|
openair0_cfg->tx_freq[i] = 0.0;
|
||||||
|
|
||||||
|
if (tx_gain)
|
||||||
|
openair0_cfg->tx_gain[i] = tx_gain;
|
||||||
|
if (rx_gain)
|
||||||
|
openair0_cfg->rx_gain[i] = rx_gain - rx_gain_offset;
|
||||||
|
|
||||||
|
openair0_cfg->autocal[i] = 1;
|
||||||
|
|
||||||
|
LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n",
|
||||||
|
i,
|
||||||
|
rf_chain,
|
||||||
|
openair0_cfg->tx_gain[i],
|
||||||
|
openair0_cfg->rx_gain[i],
|
||||||
|
openair0_cfg->tx_freq[i],
|
||||||
|
openair0_cfg->rx_freq[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -391,7 +391,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
|||||||
printf("\n");*/
|
printf("\n");*/
|
||||||
encoder_implemparams_t impp;
|
encoder_implemparams_t impp;
|
||||||
impp.n_segments = harq_process->C;
|
impp.n_segments = harq_process->C;
|
||||||
impp.macro_num=0;
|
|
||||||
impp.tinput = NULL;
|
impp.tinput = NULL;
|
||||||
impp.tprep = NULL;
|
impp.tprep = NULL;
|
||||||
impp.tparity = NULL;
|
impp.tparity = NULL;
|
||||||
@@ -399,7 +398,11 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
|||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
|
for(int j = 0; j < (harq_process->C/8 + 1); j++)
|
||||||
|
{
|
||||||
|
impp.macro_num = j;
|
||||||
nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,BG,&impp);
|
nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,BG,&impp);
|
||||||
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
|
|||||||
@@ -560,7 +560,6 @@ void set_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_change
|
|||||||
{
|
{
|
||||||
/* set new value according to rate_change */
|
/* set new value according to rate_change */
|
||||||
frame_parms_ue->ofdm_symbol_size = (frame_parms_ue->ofdm_symbol_size / rate_change);
|
frame_parms_ue->ofdm_symbol_size = (frame_parms_ue->ofdm_symbol_size / rate_change);
|
||||||
frame_parms_ue->samples_per_tti = (frame_parms_ue->samples_per_tti / rate_change);
|
|
||||||
frame_parms_ue->samples_per_subframe = (frame_parms_ue->samples_per_subframe / rate_change);
|
frame_parms_ue->samples_per_subframe = (frame_parms_ue->samples_per_subframe / rate_change);
|
||||||
|
|
||||||
free_context_pss_nr();
|
free_context_pss_nr();
|
||||||
@@ -588,7 +587,6 @@ void set_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_change
|
|||||||
void restore_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_change)
|
void restore_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_change)
|
||||||
{
|
{
|
||||||
frame_parms_ue->ofdm_symbol_size = frame_parms_ue->ofdm_symbol_size * rate_change;
|
frame_parms_ue->ofdm_symbol_size = frame_parms_ue->ofdm_symbol_size * rate_change;
|
||||||
frame_parms_ue->samples_per_tti = frame_parms_ue->samples_per_tti * rate_change;
|
|
||||||
frame_parms_ue->samples_per_subframe = frame_parms_ue->samples_per_subframe * rate_change;
|
frame_parms_ue->samples_per_subframe = frame_parms_ue->samples_per_subframe * rate_change;
|
||||||
|
|
||||||
free_context_pss_nr();
|
free_context_pss_nr();
|
||||||
@@ -620,8 +618,6 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r
|
|||||||
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
|
||||||
int samples_for_frame = 2*frame_parms->samples_per_frame;
|
int samples_for_frame = 2*frame_parms->samples_per_frame;
|
||||||
|
|
||||||
AssertFatal(frame_parms->samples_per_tti > 3839,"Illegal samples_per_tti %d\n",frame_parms->samples_per_tti);
|
|
||||||
|
|
||||||
#if TEST_SYNCHRO_TIMING_PSS
|
#if TEST_SYNCHRO_TIMING_PSS
|
||||||
|
|
||||||
opp_enabled = 1;
|
opp_enabled = 1;
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set,
|
|||||||
n_SRS = l/R;
|
n_SRS = l/R;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int8_t N_slot_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME * frame_parms->ttis_per_subframe;
|
int8_t N_slot_frame = frame_parms->slots_per_frame;
|
||||||
n_SRS = ((N_slot_frame*frame_number + slot_number - T_offset)/T_SRS)*(N_symb_SRS/R)+(l/R);
|
n_SRS = ((N_slot_frame*frame_number + slot_number - T_offset)/T_SRS)*(N_symb_SRS/R)+(l/R);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ int is_srs_period_nr(SRS_Resource_t *p_SRS_Resource, NR_DL_FRAME_PARMS *frame_pa
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t N_slot_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME * frame_parms->ttis_per_subframe;
|
int16_t N_slot_frame = frame_parms->slots_per_frame;
|
||||||
if ((N_slot_frame*frame_tx + slot_tx - T_offset)%T_SRS == 0) {
|
if ((N_slot_frame*frame_tx + slot_tx - T_offset)%T_SRS == 0) {
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ static void *scope_thread_eNB(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1);
|
usleep(100*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("%s",stats_buffer);
|
// printf("%s",stats_buffer);
|
||||||
|
|||||||
@@ -37,9 +37,12 @@ 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[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||||
float tput_ue_max[NUMBER_OF_UE_MAX] = {0};
|
float tput_ue_max[NUMBER_OF_UE_MAX] = {0};
|
||||||
|
|
||||||
static void ia_receiver_on_off( FL_OBJECT *button, long arg)
|
void drawsymbol(FL_OBJECT *obj, int id,
|
||||||
{
|
FL_POINT *p, int n, int w, int h) {
|
||||||
|
fl_points( p, n, FL_YELLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ia_receiver_on_off( FL_OBJECT *button, long arg) {
|
||||||
if (fl_get_button(button)) {
|
if (fl_get_button(button)) {
|
||||||
fl_set_object_label(button, "IA Receiver ON");
|
fl_set_object_label(button, "IA Receiver ON");
|
||||||
// PHY_vars_UE_g[0][0]->use_ia_receiver = 1;
|
// PHY_vars_UE_g[0][0]->use_ia_receiver = 1;
|
||||||
@@ -51,9 +54,7 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dl_traffic_on_off( FL_OBJECT *button, long arg)
|
static void dl_traffic_on_off( FL_OBJECT *button, long arg) {
|
||||||
{
|
|
||||||
|
|
||||||
if (fl_get_button(button)) {
|
if (fl_get_button(button)) {
|
||||||
fl_set_object_label(button, "DL Traffic ON");
|
fl_set_object_label(button, "DL Traffic ON");
|
||||||
otg_enabled = 1;
|
otg_enabled = 1;
|
||||||
@@ -65,46 +66,38 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
|
FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) {
|
||||||
{
|
|
||||||
|
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
FD_lte_phy_scope_enb *fdui = fl_malloc( sizeof *fdui );
|
FD_lte_phy_scope_enb *fdui = fl_malloc( sizeof *fdui );
|
||||||
|
|
||||||
// Define form
|
// Define form
|
||||||
fdui->lte_phy_scope_enb = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
fdui->lte_phy_scope_enb = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
||||||
|
|
||||||
// This the whole UI box
|
// This the whole UI box
|
||||||
obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" );
|
obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" );
|
||||||
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
||||||
|
|
||||||
// Received signal
|
// Received signal
|
||||||
fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" );
|
fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" );
|
||||||
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
|
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
|
||||||
|
|
||||||
// Time-domain channel response
|
// Time-domain channel response
|
||||||
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "SRS Frequency Response (samples, abs)" );
|
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "SRS Frequency Response (samples, abs)" );
|
||||||
fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color
|
||||||
|
|
||||||
// Frequency-domain channel response
|
// Frequency-domain channel response
|
||||||
fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" );
|
fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" );
|
||||||
fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_ybounds( fdui->chest_f,30,70);
|
fl_set_xyplot_ybounds( fdui->chest_f,30,70);
|
||||||
|
|
||||||
// LLR of PUSCH
|
// LLR of PUSCH
|
||||||
fdui->pusch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)" );
|
fdui->pusch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)" );
|
||||||
fl_set_object_boxtype( fdui->pusch_llr, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pusch_llr, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pusch_llr, FL_BLACK, FL_YELLOW );
|
fl_set_object_color( fdui->pusch_llr, FL_BLACK, FL_YELLOW );
|
||||||
fl_set_object_lcolor( fdui->pusch_llr, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pusch_llr, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pusch_llr,2);
|
fl_set_xyplot_symbolsize( fdui->pusch_llr,2);
|
||||||
|
fl_set_xyplot_symbol(fdui->pusch_llr, 0, drawsymbol);
|
||||||
// I/Q PUSCH comp
|
// I/Q PUSCH comp
|
||||||
fdui->pusch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 200, "PUSCH I/Q of MF Output" );
|
fdui->pusch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 200, "PUSCH I/Q of MF Output" );
|
||||||
fl_set_object_boxtype( fdui->pusch_comp, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pusch_comp, FL_EMBOSSED_BOX );
|
||||||
@@ -112,7 +105,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
|
|||||||
fl_set_object_lcolor( fdui->pusch_comp, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pusch_comp, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pusch_comp,2);
|
fl_set_xyplot_symbolsize( fdui->pusch_comp,2);
|
||||||
fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
||||||
|
fl_set_xyplot_symbol(fdui->pusch_comp, 0, drawsymbol);
|
||||||
// I/Q PUCCH comp (format 1)
|
// I/Q PUCCH comp (format 1)
|
||||||
fdui->pucch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 480, 240, 100, "PUCCH1 Energy (SR)" );
|
fdui->pucch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 480, 240, 100, "PUCCH1 Energy (SR)" );
|
||||||
fl_set_object_boxtype( fdui->pucch_comp1, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pucch_comp1, FL_EMBOSSED_BOX );
|
||||||
@@ -120,7 +113,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
|
|||||||
fl_set_object_lcolor( fdui->pucch_comp1, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pucch_comp1, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pucch_comp1,2);
|
fl_set_xyplot_symbolsize( fdui->pucch_comp1,2);
|
||||||
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
||||||
|
fl_set_xyplot_symbol(fdui->pucch_comp1, 0, drawsymbol);
|
||||||
// I/Q PUCCH comp (fromat 1a/b)
|
// I/Q PUCCH comp (fromat 1a/b)
|
||||||
fdui->pucch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 600, 240, 100, "PUCCH I/Q of MF Output" );
|
fdui->pucch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 600, 240, 100, "PUCCH I/Q of MF Output" );
|
||||||
fl_set_object_boxtype( fdui->pucch_comp, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pucch_comp, FL_EMBOSSED_BOX );
|
||||||
@@ -128,13 +121,12 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
|
|||||||
fl_set_object_lcolor( fdui->pucch_comp, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pucch_comp, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pucch_comp,2);
|
fl_set_xyplot_symbolsize( fdui->pucch_comp,2);
|
||||||
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
|
||||||
|
fl_set_xyplot_symbol(fdui->pucch_comp, 0, drawsymbol);
|
||||||
// Throughput on PUSCH
|
// Throughput on PUSCH
|
||||||
fdui->pusch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 480, 500, 100, "PUSCH Throughput [frame]/[kbit/s]" );
|
fdui->pusch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 480, 500, 100, "PUSCH Throughput [frame]/[kbit/s]" );
|
||||||
fl_set_object_boxtype( fdui->pusch_tput, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pusch_tput, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pusch_tput, FL_BLACK, FL_WHITE );
|
fl_set_object_color( fdui->pusch_tput, FL_BLACK, FL_WHITE );
|
||||||
fl_set_object_lcolor( fdui->pusch_tput, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pusch_tput, FL_WHITE ); // Label color
|
||||||
|
|
||||||
// Generic eNB Button
|
// Generic eNB Button
|
||||||
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" );
|
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" );
|
||||||
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
|
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
|
||||||
@@ -143,18 +135,15 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
|
|||||||
fl_set_object_label(fdui->button_0, "DL Traffic OFF");
|
fl_set_object_label(fdui->button_0, "DL Traffic OFF");
|
||||||
fl_set_object_color(fdui->button_0, FL_RED, FL_RED);
|
fl_set_object_color(fdui->button_0, FL_RED, FL_RED);
|
||||||
fl_set_object_callback(fdui->button_0, dl_traffic_on_off, 0 );
|
fl_set_object_callback(fdui->button_0, dl_traffic_on_off, 0 );
|
||||||
|
|
||||||
fl_end_form( );
|
fl_end_form( );
|
||||||
fdui->lte_phy_scope_enb->fdui = fdui;
|
fdui->lte_phy_scope_enb->fdui = fdui;
|
||||||
|
|
||||||
return fdui;
|
return fdui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
||||||
PHY_VARS_eNB *phy_vars_enb,
|
PHY_VARS_eNB *phy_vars_enb,
|
||||||
int UE_id)
|
int UE_id) {
|
||||||
{
|
LOG_D(HW,"scope for UE%d\n", UE_id);
|
||||||
|
|
||||||
int i,i2,arx,atx,ind,k;
|
int i,i2,arx,atx,ind,k;
|
||||||
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms;
|
||||||
int nsymb_ce = 12*frame_parms->N_RB_UL*frame_parms->symbols_per_tti;
|
int nsymb_ce = 12*frame_parms->N_RB_UL*frame_parms->symbols_per_tti;
|
||||||
@@ -192,13 +181,11 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
|||||||
}
|
}
|
||||||
|
|
||||||
coded_bits_per_codeword = frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti;
|
coded_bits_per_codeword = frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti;
|
||||||
|
|
||||||
chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
|
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)); // init to zero
|
||||||
bit = malloc(coded_bits_per_codeword*sizeof(float));
|
bit = malloc(coded_bits_per_codeword*sizeof(float));
|
||||||
|
|
||||||
rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata;
|
rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata;
|
||||||
//chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id];
|
|
||||||
chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates;
|
chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates;
|
||||||
chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates;
|
chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates;
|
||||||
pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr;
|
pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr;
|
||||||
@@ -278,7 +265,6 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
|||||||
freq[ind] = (float)ind;
|
freq[ind] = (float)ind;
|
||||||
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
|
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
|
||||||
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
|
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
|
||||||
|
|
||||||
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
|
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
|
||||||
ind++;
|
ind++;
|
||||||
}
|
}
|
||||||
@@ -346,75 +332,62 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
|||||||
// PUSCH I/Q of MF Output
|
// PUSCH I/Q of MF Output
|
||||||
if (pucch1ab_comp!=NULL) {
|
if (pucch1ab_comp!=NULL) {
|
||||||
for (ind=0; ind<10240; ind++) {
|
for (ind=0; ind<10240; ind++) {
|
||||||
|
|
||||||
I_pucch[ind] = (float)pucch1ab_comp[2*(ind)];
|
I_pucch[ind] = (float)pucch1ab_comp[2*(ind)];
|
||||||
Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1];
|
Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1];
|
||||||
A_pucch[ind] = 10*log10(pucch1_comp[ind]);
|
A_pucch[ind] = 10*log10(pucch1_comp[ind]);
|
||||||
B_pucch[ind] = ind;
|
B_pucch[ind] = ind;
|
||||||
C_pucch[ind] = (float)pucch1_thres[ind];
|
C_pucch[ind] = (float)pucch1_thres[ind];
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","","");
|
fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","","");
|
||||||
fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","","");
|
fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","","");
|
||||||
fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED);
|
fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED);
|
||||||
fl_set_xyplot_ybounds(form->pucch_comp,-5000,5000);
|
fl_set_xyplot_ybounds(form->pucch_comp,-5000,5000);
|
||||||
fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000);
|
fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000);
|
||||||
|
|
||||||
fl_set_xyplot_ybounds(form->pucch_comp1,0,80);
|
fl_set_xyplot_ybounds(form->pucch_comp1,0,80);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PUSCH Throughput
|
// PUSCH Throughput
|
||||||
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
|
|
||||||
tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
|
tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
|
||||||
tput_enb[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
|
tput_enb[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
|
||||||
|
|
||||||
fl_set_xyplot_data(form->pusch_tput,tput_time_enb[UE_id],tput_enb[UE_id],TPUT_WINDOW_LENGTH,"","","");
|
fl_set_xyplot_data(form->pusch_tput,tput_time_enb[UE_id],tput_enb[UE_id],TPUT_WINDOW_LENGTH,"","","");
|
||||||
|
|
||||||
// fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax);
|
// fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax);
|
||||||
// fl_set_xyplot_ybounds(form->pusch_tput,0,ymax);
|
// fl_set_xyplot_ybounds(form->pusch_tput,0,ymax);
|
||||||
|
|
||||||
fl_check_forms();
|
fl_check_forms();
|
||||||
|
|
||||||
free(llr);
|
free(llr);
|
||||||
free(bit);
|
free(bit);
|
||||||
free(chest_f_abs);
|
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;
|
FL_OBJECT *obj;
|
||||||
FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui );
|
FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui );
|
||||||
|
|
||||||
// Define form
|
// Define form
|
||||||
fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 900 );
|
fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 900 );
|
||||||
|
|
||||||
// This the whole UI box
|
// This the whole UI box
|
||||||
obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 900, "" );
|
obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 900, "" );
|
||||||
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
fl_set_object_color( obj, FL_BLACK, FL_BLACK );
|
||||||
|
|
||||||
// Received signal
|
// Received signal
|
||||||
fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" );
|
fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" );
|
||||||
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
|
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
|
||||||
|
fl_set_xyplot_symbol(fdui->rxsig_t, 0, drawsymbol);
|
||||||
// Time-domain channel response
|
// Time-domain channel response
|
||||||
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
|
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
|
||||||
fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color
|
||||||
|
fl_set_xyplot_symbol(fdui->chest_t, 0, drawsymbol);
|
||||||
// Frequency-domain channel response
|
// Frequency-domain channel response
|
||||||
fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" );
|
fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" );
|
||||||
fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED );
|
fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED );
|
||||||
fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_ybounds( fdui->chest_f,30,70);
|
fl_set_xyplot_ybounds( fdui->chest_f,30,70);
|
||||||
|
|
||||||
// LLR of PBCH
|
// LLR of PBCH
|
||||||
fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" );
|
fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" );
|
||||||
fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX );
|
||||||
@@ -423,23 +396,23 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
|
|||||||
fl_set_xyplot_symbolsize( fdui->pbch_llr,2);
|
fl_set_xyplot_symbolsize( fdui->pbch_llr,2);
|
||||||
fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR);
|
fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR);
|
||||||
fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920);
|
fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920);
|
||||||
|
fl_set_xyplot_symbol(fdui->pbch_llr, 0, drawsymbol);
|
||||||
// I/Q PBCH comp
|
// I/Q PBCH comp
|
||||||
fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" );
|
fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" );
|
||||||
fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN );
|
fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN );
|
||||||
fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pbch_comp,2);
|
fl_set_xyplot_symbolsize( fdui->pbch_comp,2);
|
||||||
|
fl_set_xyplot_symbol(fdui->pbch_comp, 0, drawsymbol);
|
||||||
// fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100);
|
// fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100);
|
||||||
// fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100);
|
// fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100);
|
||||||
|
|
||||||
// LLR of PDCCH
|
// LLR of PDCCH
|
||||||
fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" );
|
fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" );
|
||||||
fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN );
|
fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN );
|
||||||
fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pdcch_llr,2);
|
fl_set_xyplot_symbolsize( fdui->pdcch_llr,2);
|
||||||
|
fl_set_xyplot_symbol(fdui->pdcch_llr, 0, drawsymbol);
|
||||||
// I/Q PDCCH comp
|
// I/Q PDCCH comp
|
||||||
fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" );
|
fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" );
|
||||||
fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX );
|
||||||
@@ -447,7 +420,7 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
|
|||||||
fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pdcch_comp,2);
|
fl_set_xyplot_symbolsize( fdui->pdcch_comp,2);
|
||||||
fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR);
|
fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR);
|
||||||
|
fl_set_xyplot_symbol(fdui->pdcch_comp, 0, drawsymbol);
|
||||||
// LLR of PDSCH
|
// LLR of PDSCH
|
||||||
fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" );
|
fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" );
|
||||||
fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX );
|
||||||
@@ -455,20 +428,19 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
|
|||||||
fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pdsch_llr,2);
|
fl_set_xyplot_symbolsize( fdui->pdsch_llr,2);
|
||||||
fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR);
|
fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR);
|
||||||
|
fl_set_xyplot_symbol(fdui->pdsch_llr, 0, drawsymbol);
|
||||||
// I/Q PDSCH comp
|
// I/Q PDSCH comp
|
||||||
fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500, 240, 200, "PDSCH I/Q of MF Output" );
|
fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500, 240, 200, "PDSCH I/Q of MF Output" );
|
||||||
fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW );
|
fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW );
|
||||||
fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color
|
||||||
fl_set_xyplot_symbolsize( fdui->pdsch_comp,2);
|
fl_set_xyplot_symbolsize( fdui->pdsch_comp,2);
|
||||||
|
fl_set_xyplot_symbol(fdui->pdsch_comp, 0, drawsymbol);
|
||||||
// Throughput on PDSCH
|
// Throughput on PDSCH
|
||||||
fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" );
|
fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" );
|
||||||
fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX );
|
fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX );
|
||||||
fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE );
|
fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE );
|
||||||
fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color
|
fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color
|
||||||
|
|
||||||
// Generic UE Button
|
// Generic UE Button
|
||||||
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" );
|
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" );
|
||||||
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
|
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
|
||||||
@@ -478,10 +450,8 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
|
|||||||
fl_set_object_color(fdui->button_0, FL_RED, FL_RED);
|
fl_set_object_color(fdui->button_0, FL_RED, FL_RED);
|
||||||
fl_set_object_callback(fdui->button_0, ia_receiver_on_off, 0 );
|
fl_set_object_callback(fdui->button_0, ia_receiver_on_off, 0 );
|
||||||
fl_hide_object(fdui->button_0);
|
fl_hide_object(fdui->button_0);
|
||||||
|
|
||||||
fl_end_form( );
|
fl_end_form( );
|
||||||
fdui->lte_phy_scope_ue->fdui = fdui;
|
fdui->lte_phy_scope_ue->fdui = fdui;
|
||||||
|
|
||||||
return fdui;
|
return fdui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,8 +459,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
PHY_VARS_UE *phy_vars_ue,
|
PHY_VARS_UE *phy_vars_ue,
|
||||||
int eNB_id,
|
int eNB_id,
|
||||||
int UE_id,
|
int UE_id,
|
||||||
uint8_t subframe)
|
uint8_t subframe) {
|
||||||
{
|
|
||||||
int i,arx,atx,ind,k;
|
int i,arx,atx,ind,k;
|
||||||
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
|
||||||
int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti;
|
int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti;
|
||||||
@@ -521,7 +490,6 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
unsigned char harq_pid = 0;
|
unsigned char harq_pid = 0;
|
||||||
int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0;
|
int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0;
|
||||||
|
|
||||||
|
|
||||||
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) {
|
if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) {
|
||||||
harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid;
|
harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid;
|
||||||
|
|
||||||
@@ -568,11 +536,9 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
//llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error.
|
//llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error.
|
||||||
llr = (float *) malloc(coded_bits_per_codeword*sizeof(float));
|
llr = (float *) malloc(coded_bits_per_codeword*sizeof(float));
|
||||||
memset((void *)llr, 0,coded_bits_per_codeword*sizeof(float)); // init to zero
|
memset((void *)llr, 0,coded_bits_per_codeword*sizeof(float)); // init to zero
|
||||||
|
|
||||||
bit = malloc(coded_bits_per_codeword*sizeof(float));
|
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
|
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));
|
bit_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
|
||||||
|
|
||||||
rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata;
|
rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata;
|
||||||
chest_t = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id];
|
chest_t = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id];
|
||||||
chest_f = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id];
|
chest_f = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id];
|
||||||
@@ -652,7 +618,6 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
freq[ind] = (float)ind;
|
freq[ind] = (float)ind;
|
||||||
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
|
Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
|
||||||
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
|
Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
|
||||||
|
|
||||||
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
|
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
|
||||||
ind++;
|
ind++;
|
||||||
}
|
}
|
||||||
@@ -715,12 +680,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3);
|
fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3);
|
||||||
if (frame_parms->N_RB_DL != 100)
|
|
||||||
{
|
if (frame_parms->N_RB_DL != 100) {
|
||||||
fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","","");
|
fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","","");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_D(PHY,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
LOG_D(PHY,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -731,12 +694,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
I[i] = pdcch_comp[2*i];
|
I[i] = pdcch_comp[2*i];
|
||||||
Q[i] = pdcch_comp[2*i+1];
|
Q[i] = pdcch_comp[2*i+1];
|
||||||
}
|
}
|
||||||
if (frame_parms->N_RB_DL != 100)
|
|
||||||
{
|
if (frame_parms->N_RB_DL != 100) {
|
||||||
fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","","");
|
fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","","");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_D(PHY,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
LOG_D(PHY,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,12 +710,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
||||||
if (frame_parms->N_RB_DL != 100)
|
|
||||||
{
|
if (frame_parms->N_RB_DL != 100) {
|
||||||
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","","");
|
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","","");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_D(PHY,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
LOG_D(PHY,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -778,7 +737,6 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
// PDSCH Throughput
|
// PDSCH Throughput
|
||||||
memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
memmove( tput_ue[UE_id], &tput_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
memmove( tput_ue[UE_id], &tput_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
|
||||||
|
|
||||||
tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
|
tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame;
|
||||||
tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
|
tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0;
|
||||||
|
|
||||||
@@ -787,11 +745,8 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","","");
|
fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","","");
|
||||||
|
|
||||||
fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]);
|
fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]);
|
||||||
|
|
||||||
fl_check_forms();
|
fl_check_forms();
|
||||||
|
|
||||||
free(I);
|
free(I);
|
||||||
free(Q);
|
free(Q);
|
||||||
free(chest_f_abs);
|
free(chest_f_abs);
|
||||||
|
|||||||
@@ -32,7 +32,9 @@
|
|||||||
#ifndef __PHY_DEFS_NB_IOT__H__
|
#ifndef __PHY_DEFS_NB_IOT__H__
|
||||||
#define __PHY_DEFS_NB_IOT__H__
|
#define __PHY_DEFS_NB_IOT__H__
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|||||||
@@ -624,6 +624,8 @@ typedef struct RU_t_s {
|
|||||||
int wakeup_L1_sleep_cnt_max;
|
int wakeup_L1_sleep_cnt_max;
|
||||||
/// DL IF frequency in Hz
|
/// DL IF frequency in Hz
|
||||||
uint64_t if_frequency;
|
uint64_t if_frequency;
|
||||||
|
/// UL IF frequency offset to DL IF frequency in Hz
|
||||||
|
int if_freq_offset;
|
||||||
} RU_t;
|
} RU_t;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ typedef struct {
|
|||||||
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
|
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
|
||||||
|
|
||||||
typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp);
|
typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp);
|
||||||
|
typedef uint32_t (*get_slot_from_timestamp_t)(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp);
|
||||||
|
|
||||||
typedef uint32_t (*get_samples_slot_timestamp_t)(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead);
|
typedef uint32_t (*get_samples_slot_timestamp_t)(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead);
|
||||||
|
|
||||||
@@ -292,14 +293,14 @@ struct NR_DL_FRAME_PARMS {
|
|||||||
uint32_t samples_per_subframe;
|
uint32_t samples_per_subframe;
|
||||||
/// Number of samples in current slot
|
/// Number of samples in current slot
|
||||||
get_samples_per_slot_t get_samples_per_slot;
|
get_samples_per_slot_t get_samples_per_slot;
|
||||||
|
/// slot calculation from timestamp
|
||||||
|
get_slot_from_timestamp_t get_slot_from_timestamp;
|
||||||
/// Number of samples before slot
|
/// Number of samples before slot
|
||||||
get_samples_slot_timestamp_t get_samples_slot_timestamp;
|
get_samples_slot_timestamp_t get_samples_slot_timestamp;
|
||||||
/// Number of samples in 0th and center slot of a subframe
|
/// Number of samples in 0th and center slot of a subframe
|
||||||
uint32_t samples_per_slot0;
|
uint32_t samples_per_slot0;
|
||||||
/// Number of samples in other slots of the subframe
|
/// Number of samples in other slots of the subframe
|
||||||
uint32_t samples_per_slotN0;
|
uint32_t samples_per_slotN0;
|
||||||
/// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
|
|
||||||
uint16_t symbols_per_tti;
|
|
||||||
/// Number of samples in a radio frame
|
/// Number of samples in a radio frame
|
||||||
uint32_t samples_per_frame;
|
uint32_t samples_per_frame;
|
||||||
/// Number of samples in a subframe without CP
|
/// Number of samples in a subframe without CP
|
||||||
@@ -308,15 +309,8 @@ struct NR_DL_FRAME_PARMS {
|
|||||||
uint32_t samples_per_slot_wCP;
|
uint32_t samples_per_slot_wCP;
|
||||||
/// Number of samples in a radio frame without CP
|
/// Number of samples in a radio frame without CP
|
||||||
uint32_t samples_per_frame_wCP;
|
uint32_t samples_per_frame_wCP;
|
||||||
/// Number of samples in a tti (same as subrame in LTE, slot in NR)
|
|
||||||
uint32_t samples_per_tti;
|
|
||||||
/// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
|
/// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
|
||||||
uint8_t numerology_index;
|
uint8_t numerology_index;
|
||||||
/// NR number of ttis per subframe deduced from numerology (cf 38.211): 1, 2, 4, 8(not supported),16(not supported),32(not supported)
|
|
||||||
uint8_t ttis_per_subframe;
|
|
||||||
/// NR number of slots per tti . Assumption only 2 Slot per TTI is supported (Slot Config 1 in 38.211)
|
|
||||||
uint8_t slots_per_tti;
|
|
||||||
//#endif
|
|
||||||
/// Number of Physical transmit antennas in node
|
/// Number of Physical transmit antennas in node
|
||||||
uint8_t nb_antennas_tx;
|
uint8_t nb_antennas_tx;
|
||||||
/// Number of Receive antennas in node
|
/// Number of Receive antennas in node
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ extern char fmageren_name2[512];
|
|||||||
extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
|
extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
|
||||||
extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
|
extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
|
||||||
|
|
||||||
//#include "PHY/LTE_TRANSPORT/transport_extern.h"
|
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
extern const short conjugate[8],conjugate2[8];
|
extern const short conjugate[8],conjugate2[8];
|
||||||
extern int number_of_cards;
|
extern int number_of_cards;
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ typedef struct {
|
|||||||
/// timestamp transmitted to HW
|
/// timestamp transmitted to HW
|
||||||
openair0_timestamp timestamp_tx;
|
openair0_timestamp timestamp_tx;
|
||||||
//#ifdef UE_NR_PHY_DEMO
|
//#ifdef UE_NR_PHY_DEMO
|
||||||
/// NR TTI index within subframe_tx [0 .. ttis_per_subframe - 1] to act upon for transmission
|
/// NR TTI index within subframe_tx [0 .. slots_per_subframe - 1] to act upon for transmission
|
||||||
int nr_tti_tx;
|
int nr_tti_tx;
|
||||||
/// NR TTI index within subframe_rx [0 .. ttis_per_subframe - 1] to act upon for reception
|
/// NR TTI index within subframe_rx [0 .. slots_per_subframe - 1] to act upon for reception
|
||||||
int nr_tti_rx;
|
int nr_tti_rx;
|
||||||
/// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission
|
/// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission
|
||||||
int nr_slot_tx;
|
int nr_slot_tx;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
|
|||||||
while(p_current_TDD_UL_DL_SlotConfig != NULL) {
|
while(p_current_TDD_UL_DL_SlotConfig != NULL) {
|
||||||
int slot_index = p_current_TDD_UL_DL_SlotConfig->slotIndex;
|
int slot_index = p_current_TDD_UL_DL_SlotConfig->slotIndex;
|
||||||
|
|
||||||
if (slot_index < TDD_CONFIG_NB_FRAMES*(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)) {
|
if (slot_index < TDD_CONFIG_NB_FRAMES * frame_parms->slots_per_frame) {
|
||||||
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols != 0) {
|
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols != 0) {
|
||||||
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols == NR_TDD_SET_ALL_SYMBOLS) {
|
if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols == NR_TDD_SET_ALL_SYMBOLS) {
|
||||||
if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == 0) {
|
if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == 0) {
|
||||||
|
|||||||
@@ -380,7 +380,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
|||||||
case 245: timing_advance_update /= 32; break;
|
case 245: timing_advance_update /= 32; break;
|
||||||
case 273: timing_advance_update /= 32; break;
|
case 273: timing_advance_update /= 32; break;
|
||||||
case 66: timing_advance_update /= 12; break;
|
case 66: timing_advance_update /= 12; break;
|
||||||
default: abort();
|
case 32: timing_advance_update /= 12; break;
|
||||||
|
default: AssertFatal(0==1,"No case defined for PRB %d to calculate timing_advance_update\n",gNB->frame_parms.N_RB_DL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put timing advance command in 0..63 range
|
// put timing advance command in 0..63 range
|
||||||
@@ -531,7 +532,9 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
|
||||||
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
||||||
|
|
||||||
|
if (gNB->frame_parms.frame_type == TDD)
|
||||||
fill_ul_rb_mask(gNB, frame_rx, slot_rx);
|
fill_ul_rb_mask(gNB, frame_rx, slot_rx);
|
||||||
|
|
||||||
gNB_I0_measurements(gNB);
|
gNB_I0_measurements(gNB);
|
||||||
|
|
||||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
|
|||||||
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
||||||
|
|
||||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||||
|
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|||||||
@@ -154,8 +154,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
|
|
||||||
ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
|
ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
|
||||||
|
|
||||||
if (scheduled_response->tx_request){ // TBR todo here it should loop through the number of tx pdus
|
if (scheduled_response->tx_request){
|
||||||
fapi_nr_tx_request_body_t *tx_req_body = scheduled_response->tx_request->tx_request_body;
|
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[i];
|
||||||
|
|
||||||
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
|
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_info_extracted,
|
void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_info_extracted,
|
||||||
NR_UE_DLSCH_t **dlsch, NR_UE_ULSCH_t *ulsch, uint8_t nr_tti_rx, uint8_t tx_offset)
|
NR_UE_DLSCH_t **dlsch, NR_UE_ULSCH_t *ulsch, uint8_t slot, uint8_t tx_offset)
|
||||||
{
|
{
|
||||||
if (nr_dci_info_extracted->identifier_dci_formats == DL_DCI) {
|
if (nr_dci_info_extracted->identifier_dci_formats == DL_DCI) {
|
||||||
|
|
||||||
@@ -124,14 +124,14 @@ void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_i
|
|||||||
|
|
||||||
dl_harq->harq_ack.vDAI_DL = nr_dci_info_extracted->dai+1;
|
dl_harq->harq_ack.vDAI_DL = nr_dci_info_extracted->dai+1;
|
||||||
dl_harq->harq_ack.pucch_resource_indicator = nr_dci_info_extracted->pucch_resource_ind;
|
dl_harq->harq_ack.pucch_resource_indicator = nr_dci_info_extracted->pucch_resource_ind;
|
||||||
dl_harq->harq_ack.slot_for_feedback_ack = (nr_tti_rx + nr_dci_info_extracted->pdsch_to_harq_feedback_time_ind)%ue->frame_parms.ttis_per_subframe;
|
dl_harq->harq_ack.slot_for_feedback_ack = (slot + nr_dci_info_extracted->pdsch_to_harq_feedback_time_ind)%ue->frame_parms.slots_per_subframe;
|
||||||
dl_harq->harq_ack.harq_id = nr_dci_info_extracted->harq_process_number;
|
dl_harq->harq_ack.harq_id = nr_dci_info_extracted->harq_process_number;
|
||||||
dl_harq->harq_ack.rx_status = downlink_harq_process(dl_harq, dlsch[0]->current_harq_pid, nr_dci_info_extracted->ndi, dlsch[0]->rnti_type);
|
dl_harq->harq_ack.rx_status = downlink_harq_process(dl_harq, dlsch[0]->current_harq_pid, nr_dci_info_extracted->ndi, dlsch[0]->rnti_type);
|
||||||
}
|
}
|
||||||
else if (nr_dci_info_extracted->identifier_dci_formats == UL_DCI) {
|
else if (nr_dci_info_extracted->identifier_dci_formats == UL_DCI) {
|
||||||
|
|
||||||
/* store harq id for which pusch should be transmitted at rx_slot + tx_offset */
|
/* store harq id for which pusch should be transmitted at rx_slot + tx_offset */
|
||||||
set_tx_harq_id(ulsch, nr_dci_info_extracted->harq_process_number, (nr_tti_rx + tx_offset)%ue->frame_parms.ttis_per_subframe);
|
set_tx_harq_id(ulsch, nr_dci_info_extracted->harq_process_number, (slot + tx_offset)%ue->frame_parms.slots_per_subframe);
|
||||||
ulsch->harq_processes[nr_dci_info_extracted->harq_process_number]->tx_status = uplink_harq_process(ulsch, nr_dci_info_extracted->harq_process_number, nr_dci_info_extracted->ndi, ulsch->rnti_type);
|
ulsch->harq_processes[nr_dci_info_extracted->harq_process_number]->tx_status = uplink_harq_process(ulsch, nr_dci_info_extracted->harq_process_number, nr_dci_info_extracted->ndi, ulsch->rnti_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,6 +356,16 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
|||||||
} else {
|
} else {
|
||||||
LOG_E(PHY,"[UE %d] frame %d, nr_tti_rx %d, Error decoding PBCH!\n",
|
LOG_E(PHY,"[UE %d] frame %d, nr_tti_rx %d, Error decoding PBCH!\n",
|
||||||
ue->Mod_id,frame_rx, nr_tti_rx);
|
ue->Mod_id,frame_rx, nr_tti_rx);
|
||||||
|
/*FILE *fd;
|
||||||
|
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
|
||||||
|
fwrite((void *)&ue->common_vars.rxdata[0][0],
|
||||||
|
sizeof(int32_t),
|
||||||
|
ue->frame_parms.samples_per_frame,
|
||||||
|
fd);
|
||||||
|
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||||
|
fclose(fd);
|
||||||
|
exit(0);
|
||||||
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
write_output("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_subframe,1,1);
|
write_output("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_subframe,1,1);
|
||||||
@@ -1624,6 +1634,59 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp)
|
||||||
|
{
|
||||||
|
int mu = fp->numerology_index;
|
||||||
|
//uint8_t half_frame_index = fp->half_frame_bit;
|
||||||
|
//uint8_t i_ssb = fp->ssb_index;
|
||||||
|
uint8_t Lmax = fp->Lmax;
|
||||||
|
|
||||||
|
if (!(frame%(1<<(config->ssb_table.ssb_period-1)))){
|
||||||
|
|
||||||
|
if(Lmax <= 8) {
|
||||||
|
if(slot <=3 && (((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000))
|
||||||
|
return 1;
|
||||||
|
else return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(Lmax == 64) {
|
||||||
|
if (mu == NR_MU_3){
|
||||||
|
|
||||||
|
if (slot>=0 && slot <= 7){
|
||||||
|
if(((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000)
|
||||||
|
return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
else if (slot>=10 && slot <=17){
|
||||||
|
if(((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*(slot-2))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*(slot-2) +1))&0x80000000) == 0x80000000)
|
||||||
|
return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
else if (slot>=20 && slot <=27){
|
||||||
|
if(((config->ssb_table.ssb_mask_list[1].ssb_mask << 2*(slot-20))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[1].ssb_mask << (2*(slot-20) +1))&0x80000000) == 0x80000000)
|
||||||
|
return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
else if (slot>=30 && slot <=37){
|
||||||
|
if(((config->ssb_table.ssb_mask_list[1].ssb_mask << 2*(slot-22))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[1].ssb_mask << (2*(slot-22) +1))&0x80000000) == 0x80000000)
|
||||||
|
return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
else return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (mu == NR_MU_4) {
|
||||||
|
AssertFatal(0==1, "not implemented for mu = %d yet\n", mu);
|
||||||
|
}
|
||||||
|
else AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
|
||||||
|
}
|
||||||
|
else AssertFatal(0==1, "Invalid Lmax %u for the synchronization block\n", Lmax);
|
||||||
|
}
|
||||||
|
else return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp) {
|
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp) {
|
||||||
|
|
||||||
@@ -1654,6 +1717,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
int nr_tti_rx = proc->nr_tti_rx;
|
int nr_tti_rx = proc->nr_tti_rx;
|
||||||
int slot_pbch;
|
int slot_pbch;
|
||||||
|
//int slot_ssb;
|
||||||
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
|
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
|
||||||
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||||
|
|
||||||
@@ -1679,6 +1743,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb);
|
get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb);
|
||||||
|
|
||||||
slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_tti_rx, fp);
|
slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_tti_rx, fp);
|
||||||
|
//slot_ssb = is_ssb_in_slot(cfg, frame_rx, nr_tti_rx, fp);
|
||||||
|
|
||||||
// looking for pbch only in slot where it is supposed to be
|
// looking for pbch only in slot where it is supposed to be
|
||||||
if ((ue->decode_MIB == 1) && slot_pbch)
|
if ((ue->decode_MIB == 1) && slot_pbch)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue,
|
|||||||
//int K_PUCCH = 0;
|
//int K_PUCCH = 0;
|
||||||
if (O_ACK != 0) {
|
if (O_ACK != 0) {
|
||||||
/* it assumes that PDCCH is in the first symbol of receive slot FFS TDDO NR */
|
/* it assumes that PDCCH is in the first symbol of receive slot FFS TDDO NR */
|
||||||
//int slots_gap = (proc->nr_tti_tx > proc->nr_tti_rx ? (proc->nr_tti_tx - proc->nr_tti_rx - 1) : ((proc->nr_tti_tx + ue->frame_parms.ttis_per_subframe) - proc->nr_tti_rx - 1));
|
//int slots_gap = (proc->nr_tti_tx > proc->nr_tti_rx ? (proc->nr_tti_tx - proc->nr_tti_rx - 1) : ((proc->nr_tti_tx + ue->frame_parms.slots_per_subframe) - proc->nr_tti_rx - 1));
|
||||||
//K_PUCCH = (slots_gap * (ue->frame_parms.symbols_per_tti)) - 1;
|
//K_PUCCH = (slots_gap * (ue->frame_parms.symbols_per_tti)) - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
|
|
||||||
/* update current context */
|
/* update current context */
|
||||||
|
|
||||||
int subframe_number = (proc->nr_tti_rx)/(ue->frame_parms.slots_per_subframe);//ttis_per_subframe);
|
int subframe_number = proc->nr_slot_rx / ue->frame_parms.slots_per_subframe;
|
||||||
nb_pucch_format_4_in_subframes[subframe_number] = 0; /* reset pucch format 4 counter at current rx position */
|
nb_pucch_format_4_in_subframes[subframe_number] = 0; /* reset pucch format 4 counter at current rx position */
|
||||||
|
|
||||||
int dl_harq_pid = ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid;
|
int dl_harq_pid = ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid;
|
||||||
@@ -490,7 +490,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
|||||||
//}
|
//}
|
||||||
nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping];
|
nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping];
|
||||||
nb_of_prbs = 1;
|
nb_of_prbs = 1;
|
||||||
subframe_number = nr_tti_tx/(ue->frame_parms.slots_per_subframe);//ttis_per_subframe);
|
subframe_number = nr_tti_tx / ue->frame_parms.slots_per_subframe;
|
||||||
nb_pucch_format_4_in_subframes[subframe_number]++; /* increment number of transmit pucch 4 in current subframe */
|
nb_pucch_format_4_in_subframes[subframe_number]++; /* increment number of transmit pucch 4 in current subframe */
|
||||||
NR_TST_PHY_PRINTF("PUCCH Number of pucch format 4 in subframe %d is %d \n", subframe_number, nb_pucch_format_4_in_subframes[subframe_number]);
|
NR_TST_PHY_PRINTF("PUCCH Number of pucch format 4 in subframe %d is %d \n", subframe_number, nb_pucch_format_4_in_subframes[subframe_number]);
|
||||||
N_sc_ctrl_RB = N_SC_RB/(nb_pucch_format_4_in_subframes[subframe_number]);
|
N_sc_ctrl_RB = N_SC_RB/(nb_pucch_format_4_in_subframes[subframe_number]);
|
||||||
@@ -1277,7 +1277,7 @@ int trigger_periodic_scheduling_request(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_n
|
|||||||
return (1); /* period is slot */
|
return (1); /* period is slot */
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t N_slot_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME * ue->frame_parms.slots_per_subframe;//ttis_per_subframe;
|
int16_t N_slot_frame = ue->frame_parms.slots_per_frame;
|
||||||
if (((proc->frame_tx * N_slot_frame) + proc->nr_tti_tx - SR_offset)%SR_periodicity == 0) {
|
if (((proc->frame_tx * N_slot_frame) + proc->nr_tti_tx - SR_offset)%SR_periodicity == 0) {
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
|
|
||||||
static int cmpdouble(const void *p1, const void *p2) {
|
|
||||||
return *(double *)p1 > *(double *)p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
double median(varArray_t *input) {
|
double median(varArray_t *input) {
|
||||||
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
|
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
|||||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||||
|
|
||||||
double DS_TDL = .03;
|
double DS_TDL = .03;
|
||||||
|
static int cmpdouble(const void *p1, const void *p2) {
|
||||||
|
return *(double *)p1 > *(double *)p2;
|
||||||
|
}
|
||||||
|
|
||||||
int emulate_rf = 0;
|
int emulate_rf = 0;
|
||||||
int split73=0;
|
int split73=0;
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ double t_tx_min = 1000000000; /*!< \brief initial min process time for tx */
|
|||||||
double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
|
double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
|
||||||
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
||||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||||
|
static int cmpdouble(const void *p1, const void *p2) {
|
||||||
|
return *(double *)p1 > *(double *)p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int split73=0;
|
int split73=0;
|
||||||
@@ -345,7 +348,7 @@ int main(int argc, char **argv) {
|
|||||||
unsigned short input_buffer_length;
|
unsigned short input_buffer_length;
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
unsigned int coded_bits_per_codeword,nsymb;
|
unsigned int coded_bits_per_codeword,nsymb;
|
||||||
unsigned int tx_lev=0,tx_lev_dB,trials,errs[4]= {0,0,0,0},round_trials[4]= {0,0,0,0};
|
unsigned int tx_lev=0,tx_lev_dB,trials,errs[5]= {0,0,0,0,0},round_trials[4]= {0,0,0,0};
|
||||||
FILE *bler_fd=NULL;
|
FILE *bler_fd=NULL;
|
||||||
char bler_fname[512];
|
char bler_fname[512];
|
||||||
FILE *time_meas_fd=NULL;
|
FILE *time_meas_fd=NULL;
|
||||||
|
|||||||
@@ -66,8 +66,9 @@
|
|||||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||||
|
|
||||||
|
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||||
|
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||||
|
|
||||||
unsigned char NB_eNB_INST=0;
|
|
||||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||||
|
|
||||||
@@ -81,7 +82,6 @@ double cpuf;
|
|||||||
int sf_ahead=4 ;
|
int sf_ahead=4 ;
|
||||||
int sl_ahead=0;
|
int sl_ahead=0;
|
||||||
uint8_t nfapi_mode = 0;
|
uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
// dummy functions
|
// dummy functions
|
||||||
@@ -150,6 +150,42 @@ int is_x2ap_enabled(void)
|
|||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|
||||||
|
|
||||||
|
/* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs from command line of
|
||||||
|
dlsim, does not search for CCE/PUCCH occasion but simply sets to 0 */
|
||||||
|
int g_mcsIndex = -1, g_rbStart = -1, g_rbSize = -1;
|
||||||
|
void nr_dlsim_preprocessor(module_id_t module_id,
|
||||||
|
frame_t frame,
|
||||||
|
sub_frame_t slot,
|
||||||
|
int num_slots_per_tdd) {
|
||||||
|
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||||
|
AssertFatal(UE_info->num_UEs == 1, "can have only a single UE\n");
|
||||||
|
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[0];
|
||||||
|
|
||||||
|
/* manually set free CCE to 0 */
|
||||||
|
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||||
|
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss);
|
||||||
|
uint8_t nr_of_candidates;
|
||||||
|
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||||
|
&nr_of_candidates,
|
||||||
|
sched_ctrl->search_space);
|
||||||
|
sched_ctrl->coreset = get_coreset(
|
||||||
|
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||||
|
sched_ctrl->cce_index = 0;
|
||||||
|
|
||||||
|
/* set "any" value for PUCCH (simulator evaluates PDSCH only) */
|
||||||
|
sched_ctrl->pucch_sched_idx = 0;
|
||||||
|
sched_ctrl->pucch_occ_idx = 0;
|
||||||
|
|
||||||
|
sched_ctrl->rbStart = g_rbStart;
|
||||||
|
sched_ctrl->rbSize = g_rbSize;
|
||||||
|
sched_ctrl->mcs = g_mcsIndex;
|
||||||
|
sched_ctrl->time_domain_allocation = 2;
|
||||||
|
sched_ctrl->mcsTableIdx = 0;
|
||||||
|
AssertFatal(sched_ctrl->rbStart >= 0, "invalid rbStart %d\n", sched_ctrl->rbStart);
|
||||||
|
AssertFatal(sched_ctrl->rbSize > 0, "invalid rbSize %d\n", sched_ctrl->rbSize);
|
||||||
|
AssertFatal(sched_ctrl->mcs >= 0, "invalid sched_ctrl->mcs %d\n", sched_ctrl->mcs);
|
||||||
|
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@@ -194,11 +230,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||||
|
|
||||||
|
NB_UE_INST = 1;
|
||||||
//double pbch_sinr;
|
//double pbch_sinr;
|
||||||
//int pbch_tx_ant;
|
//int pbch_tx_ant;
|
||||||
int N_RB_DL=106,mu=1;
|
int N_RB_DL=106,mu=1;
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t dlsch_config;
|
|
||||||
NR_sched_pucch pucch_sched;
|
|
||||||
|
|
||||||
//unsigned char frame_type = 0;
|
//unsigned char frame_type = 0;
|
||||||
|
|
||||||
@@ -227,7 +262,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
randominit(0);
|
randominit(0);
|
||||||
|
|
||||||
int mcsIndex_set=0,rbStart_set=0,rbSize_set=0;
|
|
||||||
int print_perf = 0;
|
int print_perf = 0;
|
||||||
|
|
||||||
FILE *scg_fd=NULL;
|
FILE *scg_fd=NULL;
|
||||||
@@ -393,18 +427,15 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
dlsch_config.rbStart = atoi(optarg);
|
g_rbStart = atoi(optarg);
|
||||||
rbStart_set=1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
dlsch_config.rbSize = atoi(optarg);
|
g_rbSize = atoi(optarg);
|
||||||
rbSize_set=1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
dlsch_config.mcsIndex[0] = atoi(optarg);
|
g_mcsIndex = atoi(optarg);
|
||||||
mcsIndex_set=1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
@@ -483,6 +514,7 @@ int main(int argc, char **argv)
|
|||||||
RC.nb_nr_mac_CC[i] = 1;
|
RC.nb_nr_mac_CC[i] = 1;
|
||||||
mac_top_init_gNB();
|
mac_top_init_gNB();
|
||||||
gNB_mac = RC.nrmac[0];
|
gNB_mac = RC.nrmac[0];
|
||||||
|
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
|
||||||
gNB_RRC_INST rrc;
|
gNB_RRC_INST rrc;
|
||||||
memset((void*)&rrc,0,sizeof(rrc));
|
memset((void*)&rrc,0,sizeof(rrc));
|
||||||
|
|
||||||
@@ -560,6 +592,12 @@ int main(int argc, char **argv)
|
|||||||
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||||
// call MAC to configure common parameters
|
// call MAC to configure common parameters
|
||||||
|
|
||||||
|
/* rrc_mac_config_req_gNB() has created one user, so set the scheduling
|
||||||
|
* parameters from command line in global variables that will be picked up by
|
||||||
|
* scheduling preprocessor */
|
||||||
|
if (g_mcsIndex < 0) g_mcsIndex = 9;
|
||||||
|
if (g_rbStart < 0) g_rbStart=0;
|
||||||
|
if (g_rbSize < 0) g_rbSize = N_RB_DL - g_rbStart;
|
||||||
|
|
||||||
double fs,bw;
|
double fs,bw;
|
||||||
|
|
||||||
@@ -688,11 +726,6 @@ int main(int argc, char **argv)
|
|||||||
gNB->pbch_configured = 1;
|
gNB->pbch_configured = 1;
|
||||||
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
||||||
|
|
||||||
if (mcsIndex_set==0) dlsch_config.mcsIndex[0]=9;
|
|
||||||
|
|
||||||
if (rbStart_set==0) dlsch_config.rbStart=0;
|
|
||||||
if (rbSize_set==0) dlsch_config.rbSize=N_RB_DL-dlsch_config.rbStart;
|
|
||||||
|
|
||||||
//Configure UE
|
//Configure UE
|
||||||
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
||||||
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
|
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
|
||||||
@@ -788,8 +821,14 @@ int main(int argc, char **argv)
|
|||||||
for (int i=0; i<MAX_NUM_CORESET; i++)
|
for (int i=0; i<MAX_NUM_CORESET; i++)
|
||||||
gNB_mac->UE_info.num_pdcch_cand[0][i] = 0;
|
gNB_mac->UE_info.num_pdcch_cand[0][i] = 0;
|
||||||
|
|
||||||
if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config);
|
if (css_flag == 0) {
|
||||||
else nr_schedule_css_dlsch_phytest(0,frame,slot);
|
const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160};
|
||||||
|
const NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||||
|
const int num_slots_per_tdd = slots_per_frame[*scc->ssbSubcarrierSpacing] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
||||||
|
nr_schedule_ue_spec(0, frame, slot, num_slots_per_tdd);
|
||||||
|
} else {
|
||||||
|
nr_schedule_css_dlsch_phytest(0,frame,slot);
|
||||||
|
}
|
||||||
Sched_INFO.module_id = 0;
|
Sched_INFO.module_id = 0;
|
||||||
Sched_INFO.CC_id = 0;
|
Sched_INFO.CC_id = 0;
|
||||||
Sched_INFO.frame = frame;
|
Sched_INFO.frame = frame;
|
||||||
@@ -986,7 +1025,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (print_perf==1) {
|
if (print_perf==1) {
|
||||||
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
|
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
|
||||||
1000>>*scc->ssbSubcarrierSpacing,dlsch_config.rbSize,dlsch_config.mcsIndex[0],
|
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->K,
|
gNB->dlsch[0][0]->harq_processes[0]->K,
|
||||||
gNB->dlsch[0][0]->harq_processes[0]->K/((gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
gNB->dlsch[0][0]->harq_processes[0]->K/((gNB->dlsch[0][0]->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include "openair1/SIMULATION/RF/rf.h"
|
#include "openair1/SIMULATION/RF/rf.h"
|
||||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||||
|
#include "openair1/PHY/MODULATION/nr_modulation.h"
|
||||||
|
|
||||||
//#define DEBUG_NR_PBCHSIM
|
//#define DEBUG_NR_PBCHSIM
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,13 @@
|
|||||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||||
#include "nr_unitary_defs.h"
|
#include "nr_unitary_defs.h"
|
||||||
#include "OCG_vars.h"
|
#include "OCG_vars.h"
|
||||||
|
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||||
|
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||||
|
|
||||||
|
|
||||||
#define NR_PRACH_DEBUG 1
|
#define NR_PRACH_DEBUG 1
|
||||||
#define PRACH_WRITE_OUTPUT_DEBUG 1
|
#define PRACH_WRITE_OUTPUT_DEBUG 1
|
||||||
|
|
||||||
unsigned char NB_eNB_INST=0;
|
|
||||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||||
|
|
||||||
@@ -59,7 +61,6 @@ RAN_CONTEXT_t RC;
|
|||||||
RU_t *ru;
|
RU_t *ru;
|
||||||
double cpuf;
|
double cpuf;
|
||||||
extern uint16_t prach_root_sequence_map0_3[838];
|
extern uint16_t prach_root_sequence_map0_3[838];
|
||||||
uint16_t NB_UE_INST=1;
|
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
uint8_t nfapi_mode=0;
|
uint8_t nfapi_mode=0;
|
||||||
int sl_ahead = 0;
|
int sl_ahead = 0;
|
||||||
@@ -115,15 +116,16 @@ int main(int argc, char **argv){
|
|||||||
int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
||||||
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
||||||
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
||||||
uint8_t frame = 1, subframe = 9, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, num_root_sequences = 16, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
uint8_t frame = 1, subframe = 9, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
||||||
uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1;
|
uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1;
|
||||||
uint32_t tx_lev = 10000, prach_errors = 0, samp_count; //,tx_lev_dB;
|
uint32_t tx_lev = 10000, prach_errors = 0; //,tx_lev_dB;
|
||||||
uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000;
|
uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000;
|
||||||
uint16_t RA_sfn_index;
|
uint16_t RA_sfn_index;
|
||||||
uint8_t N_RA_slot;
|
uint8_t N_RA_slot;
|
||||||
uint8_t config_period;
|
uint8_t config_period;
|
||||||
int prachOccasion = 0;
|
int prachOccasion = 0;
|
||||||
double DS_TDL = .03;
|
double DS_TDL = .03;
|
||||||
|
NB_UE_INST=1;
|
||||||
|
|
||||||
// int8_t interf1=-19,interf2=-19;
|
// int8_t interf1=-19,interf2=-19;
|
||||||
// uint8_t abstraction_flag=0,calibration_flag=0;
|
// uint8_t abstraction_flag=0,calibration_flag=0;
|
||||||
@@ -703,7 +705,7 @@ int main(int argc, char **argv){
|
|||||||
// printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
|
// printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
|
||||||
|
|
||||||
if (awgn_flag == 0) {
|
if (awgn_flag == 0) {
|
||||||
multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, frame_parms->samples_per_tti<<1, 0);
|
multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, frame_parms->samples_per_frame, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_frames==1) {
|
if (n_frames==1) {
|
||||||
|
|||||||
@@ -60,9 +60,11 @@
|
|||||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||||
|
|
||||||
|
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||||
|
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||||
|
|
||||||
//#define DEBUG_ULSIM
|
//#define DEBUG_ULSIM
|
||||||
|
|
||||||
unsigned char NB_eNB_INST=0;
|
|
||||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||||
|
|
||||||
@@ -75,7 +77,6 @@ int sf_ahead=4 ;
|
|||||||
int sl_ahead=0;
|
int sl_ahead=0;
|
||||||
double cpuf;
|
double cpuf;
|
||||||
uint8_t nfapi_mode = 0;
|
uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ int main(int argc, char **argv)
|
|||||||
uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
|
uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
|
||||||
double tx_gain=1.0;
|
double tx_gain=1.0;
|
||||||
double N0=30;
|
double N0=30;
|
||||||
|
NB_UE_INST = 1;
|
||||||
|
|
||||||
//unsigned char frame_type = 0;
|
//unsigned char frame_type = 0;
|
||||||
NR_DL_FRAME_PARMS *frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms;
|
||||||
@@ -669,7 +671,6 @@ int main(int argc, char **argv)
|
|||||||
nr_scheduled_response_t scheduled_response;
|
nr_scheduled_response_t scheduled_response;
|
||||||
fapi_nr_ul_config_request_t ul_config;
|
fapi_nr_ul_config_request_t ul_config;
|
||||||
fapi_nr_tx_request_t tx_req;
|
fapi_nr_tx_request_t tx_req;
|
||||||
fapi_nr_tx_request_body_t tx_req_body;
|
|
||||||
|
|
||||||
uint8_t ptrs_mcs1 = 2;
|
uint8_t ptrs_mcs1 = 2;
|
||||||
uint8_t ptrs_mcs2 = 4;
|
uint8_t ptrs_mcs2 = 4;
|
||||||
@@ -906,16 +907,15 @@ int main(int argc, char **argv)
|
|||||||
scheduled_response.dl_config = NULL;
|
scheduled_response.dl_config = NULL;
|
||||||
scheduled_response.ul_config = &ul_config;
|
scheduled_response.ul_config = &ul_config;
|
||||||
scheduled_response.tx_request = &tx_req;
|
scheduled_response.tx_request = &tx_req;
|
||||||
scheduled_response.tx_request->tx_request_body = &tx_req_body;
|
|
||||||
|
|
||||||
// Config UL TX PDU
|
// Config UL TX PDU
|
||||||
tx_req.slot = slot;
|
tx_req.slot = slot;
|
||||||
tx_req.sfn = frame;
|
tx_req.sfn = frame;
|
||||||
// tx_req->tx_config // TbD
|
// tx_req->tx_config // TbD
|
||||||
tx_req.number_of_pdus = 1;
|
tx_req.number_of_pdus = 1;
|
||||||
tx_req_body.pdu_length = TBS/8;
|
tx_req.tx_request_body[0].pdu_length = TBS/8;
|
||||||
tx_req_body.pdu_index = 0;
|
tx_req.tx_request_body[0].pdu_index = 0;
|
||||||
tx_req_body.pdu = &ulsch_input_buffer[0];
|
tx_req.tx_request_body[0].pdu = &ulsch_input_buffer[0];
|
||||||
|
|
||||||
ul_config.slot = slot;
|
ul_config.slot = slot;
|
||||||
ul_config.number_pdus = 1;
|
ul_config.number_pdus = 1;
|
||||||
|
|||||||
@@ -51,16 +51,16 @@
|
|||||||
|
|
||||||
void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
|
void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
|
||||||
|
|
||||||
printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->ttis_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots,
|
printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->slots_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots,
|
||||||
frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity);
|
frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity);
|
||||||
|
|
||||||
int k = (TDD_CONFIG_NB_FRAMES * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) - 1; //19;
|
int k = (TDD_CONFIG_NB_FRAMES * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) - 1; //19;
|
||||||
int tti = 0;
|
int tti = 0;
|
||||||
for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; j++) {
|
for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->slots_per_frame; j++) {
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
if (j != 0) {
|
if (j != 0) {
|
||||||
frame = (frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/j;
|
frame = j / frame_parms->slots_per_frame;
|
||||||
tti = (j)%(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
tti = j % frame_parms->slots_per_frame;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frame = 0;
|
frame = 0;
|
||||||
@@ -99,9 +99,10 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
|
|||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int ttis_per_subframe)
|
void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int slots_per_subframe)
|
||||||
{
|
{
|
||||||
frame_parms->ttis_per_subframe = ttis_per_subframe;
|
frame_parms->slots_per_subframe = slots_per_subframe;
|
||||||
|
frame_parms->slots_per_frame = slots_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
|||||||
/* set a tx slot with no ack */
|
/* set a tx slot with no ack */
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
|
|
||||||
printf("\n => Test : Error due to acknownlegment not set \n");
|
printf("\n => Test : Error due to acknownlegment not set \n");
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ int test_pucch_common_config_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_
|
|||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = 2;
|
harq_status->vDAI_DL = 2;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
|
|
||||||
printf("\n => Test : PUCCH format from common config in dedicated mode: two positive downlink ACKnowledgments \n");
|
printf("\n => Test : PUCCH format from common config in dedicated mode: two positive downlink ACKnowledgments \n");
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
|||||||
|
|
||||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = 1;
|
harq_status->vDAI_DL = 1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -586,7 +586,7 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
|||||||
|
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = i+1;
|
harq_status->vDAI_DL = i+1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -620,7 +620,7 @@ int test_pucch_dedicated_single_transport_block(PHY_VARS_NR_UE *ue, int gNB_id,
|
|||||||
|
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = i+1;
|
harq_status->vDAI_DL = i+1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -684,7 +684,7 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
|||||||
|
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = i+1;
|
harq_status->vDAI_DL = i+1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -727,7 +727,7 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
|||||||
|
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = i+1;
|
harq_status->vDAI_DL = i+1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -761,7 +761,7 @@ int test_pucch_dedicated_two_transport_blocks(PHY_VARS_NR_UE *ue, int gNB_id, UE
|
|||||||
|
|
||||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid[i]].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = i+1;
|
harq_status->vDAI_DL = i+1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -980,7 +980,7 @@ int test_sr_ack_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pro
|
|||||||
|
|
||||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = 1;
|
harq_status->vDAI_DL = 1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -1019,7 +1019,7 @@ int test_sr_ack_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pro
|
|||||||
|
|
||||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_SECOND].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = 2;
|
harq_status->vDAI_DL = 2;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -1094,7 +1094,7 @@ int test_csi_dedicated(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *proc)
|
|||||||
|
|
||||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[TST_DL_HARQ_PID_FIRST].harq_ack;
|
||||||
|
|
||||||
harq_status->slot_for_feedback_ack = proc->nr_tti_tx;
|
harq_status->slot_for_feedback_ack = proc->nr_slot_tx;
|
||||||
harq_status->send_harq_status = 1;
|
harq_status->send_harq_status = 1;
|
||||||
harq_status->vDAI_DL = 1;
|
harq_status->vDAI_DL = 1;
|
||||||
harq_status->ack = DL_ACK;
|
harq_status->ack = DL_ACK;
|
||||||
@@ -1168,9 +1168,13 @@ int test_pucch(PHY_VARS_NR_UE *ue)
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc->frame_tx = 0;
|
proc->frame_rx = 0;
|
||||||
|
proc->nr_slot_rx = 0;
|
||||||
proc->nr_tti_rx = 0;
|
proc->nr_tti_rx = 0;
|
||||||
proc->nr_tti_tx = (proc->nr_tti_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX)%(ue->frame_parms.ttis_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
|
||||||
|
proc->frame_tx = proc->frame_rx + (proc->nr_slot_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX) / ue->frame_parms.slots_per_frame;
|
||||||
|
proc->nr_slot_tx = (proc->nr_slot_rx + NR_UE_CAPABILITY_SLOT_RX_TO_TX) % ue->frame_parms.slots_per_frame;
|
||||||
|
proc->nr_tti_tx = proc->nr_slot_tx % ue->frame_parms.slots_per_subframe;
|
||||||
|
|
||||||
init_pucch_power_configuration( ue, gNB_id);
|
init_pucch_power_configuration( ue, gNB_id);
|
||||||
|
|
||||||
|
|||||||
@@ -223,12 +223,13 @@ int test_srs_periodicity(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc)
|
|||||||
}
|
}
|
||||||
printf("srs period %d offset %d \n", srs_current_period, p_srs_resource->SRS_Offset);
|
printf("srs period %d offset %d \n", srs_current_period, p_srs_resource->SRS_Offset);
|
||||||
|
|
||||||
int duration = (10 * srs_current_period)/(NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe);
|
int duration = (10 * srs_current_period) / frame_parms->slots_per_frame;
|
||||||
|
|
||||||
for (int frame_tx = 0; frame_tx < duration; frame_tx++) {
|
for (int frame_tx = 0; frame_tx < duration; frame_tx++) {
|
||||||
for (int slot_tx = 0; slot_tx < (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe); slot_tx++) {
|
for (int slot_tx = 0; slot_tx < frame_parms->slots_per_frame; slot_tx++) {
|
||||||
proc->frame_tx = frame_tx;
|
proc->frame_tx = frame_tx;
|
||||||
proc->nr_tti_tx = slot_tx;
|
proc->nr_slot_tx = slot_tx;
|
||||||
|
proc->nr_tti_tx = slot_tx % frame_parms->slots_per_subframe;
|
||||||
if (ue_srs_procedure_nr( ue, proc, 0) == 0) {
|
if (ue_srs_procedure_nr( ue, proc, 0) == 0) {
|
||||||
printf("test_srs_periodicity srs at frame %d slot %d \n", frame_tx, slot_tx);
|
printf("test_srs_periodicity srs at frame %d slot %d \n", frame_tx, slot_tx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ typedef enum {
|
|||||||
#define CONFIG_STRING_RU_OTA_SYNC_ENABLE "ota_sync_enabled"
|
#define CONFIG_STRING_RU_OTA_SYNC_ENABLE "ota_sync_enabled"
|
||||||
#define CONFIG_STRING_RU_BF_WEIGHTS_LIST "bf_weights"
|
#define CONFIG_STRING_RU_BF_WEIGHTS_LIST "bf_weights"
|
||||||
#define CONFIG_STRING_RU_IF_FREQUENCY "if_freq"
|
#define CONFIG_STRING_RU_IF_FREQUENCY "if_freq"
|
||||||
|
#define CONFIG_STRING_RU_IF_FREQ_OFFSET "if_offset"
|
||||||
|
|
||||||
#define RU_LOCAL_IF_NAME_IDX 0
|
#define RU_LOCAL_IF_NAME_IDX 0
|
||||||
#define RU_LOCAL_ADDRESS_IDX 1
|
#define RU_LOCAL_ADDRESS_IDX 1
|
||||||
@@ -124,6 +125,7 @@ typedef enum {
|
|||||||
#define RU_OTA_SYNC_ENABLE_IDX 24
|
#define RU_OTA_SYNC_ENABLE_IDX 24
|
||||||
#define RU_BF_WEIGHTS_LIST_IDX 25
|
#define RU_BF_WEIGHTS_LIST_IDX 25
|
||||||
#define RU_IF_FREQUENCY 26
|
#define RU_IF_FREQUENCY 26
|
||||||
|
#define RU_IF_FREQ_OFFSET 27
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* RU configuration parameters */
|
/* RU configuration parameters */
|
||||||
@@ -157,6 +159,7 @@ typedef enum {
|
|||||||
{CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
|
{CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
|
||||||
{CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, iptr:NULL, defintarrayval:DEFBFW, TYPE_INTARRAY, 0}, \
|
{CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, iptr:NULL, defintarrayval:DEFBFW, TYPE_INTARRAY, 0}, \
|
||||||
{CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \
|
{CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \
|
||||||
|
{CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -56,6 +56,8 @@
|
|||||||
#include "flexran.pb-c.h"
|
#include "flexran.pb-c.h"
|
||||||
#include "flexran_agent_mac.h"
|
#include "flexran_agent_mac.h"
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <openair2/LAYER2/MAC/mac.h>
|
||||||
|
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8
|
|||||||
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
|
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
|
||||||
|
|
||||||
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
||||||
|
const char *duplex_mode[]={"FDD","TDD"};
|
||||||
|
|
||||||
uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) {
|
uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) {
|
||||||
|
|
||||||
@@ -1418,7 +1419,7 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
|
|||||||
else {
|
else {
|
||||||
r = L_ra/NCS;
|
r = L_ra/NCS;
|
||||||
found_sequences = (nb_preambles/r) + (nb_preambles%r!=0); //ceil(nb_preambles/r)
|
found_sequences = (nb_preambles/r) + (nb_preambles%r!=0); //ceil(nb_preambles/r)
|
||||||
printf(" found_sequences %u\n", found_sequences);
|
LOG_D(MAC, "Computing NR root sequences: found %u sequences\n", found_sequences);
|
||||||
return (found_sequences);
|
return (found_sequences);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1456,12 +1457,17 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
|
|||||||
AssertFatal(1==0,"Procedure to find nb of sequences for restricted type B not implemented yet");
|
AssertFatal(1==0,"Procedure to find nb of sequences for restricted type B not implemented yet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(" found_sequences %u\n", found_sequences);
|
LOG_D(MAC, "Computing NR root sequences: found %u sequences\n", found_sequences);
|
||||||
return found_sequences;
|
return found_sequences;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
|
||||||
|
// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
|
||||||
|
// Notes:
|
||||||
|
// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL
|
||||||
|
// - Frequencies are expressed in KHz
|
||||||
|
// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster
|
||||||
nr_bandentry_t nr_bandtable[] = {
|
nr_bandentry_t nr_bandtable[] = {
|
||||||
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
|
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
|
||||||
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
|
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
|
||||||
@@ -1470,17 +1476,27 @@ nr_bandentry_t nr_bandtable[] = {
|
|||||||
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
|
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
|
||||||
{8, 880000, 915000, 925000, 960000, 20, 185000, 100},
|
{8, 880000, 915000, 925000, 960000, 20, 185000, 100},
|
||||||
{12, 698000, 716000, 729000, 746000, 20, 145800, 100},
|
{12, 698000, 716000, 729000, 746000, 20, 145800, 100},
|
||||||
|
{14, 788000, 798000, 758000, 768000, 20, 151600, 100},
|
||||||
|
{18, 815000, 830000, 860000, 875000, 20, 172000, 100},
|
||||||
{20, 832000, 862000, 791000, 821000, 20, 158200, 100},
|
{20, 832000, 862000, 791000, 821000, 20, 158200, 100},
|
||||||
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
|
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
|
||||||
|
{26, 814000, 849000, 859000, 894000, 20, 171800, 100},
|
||||||
{28, 703000, 758000, 758000, 813000, 20, 151600, 100},
|
{28, 703000, 758000, 758000, 813000, 20, 151600, 100},
|
||||||
|
{29, 000, 000, 717000, 728000, 20, 143400, 100},
|
||||||
|
{30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100},
|
||||||
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
|
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
|
||||||
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
|
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
|
||||||
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
|
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
|
||||||
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
|
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
|
||||||
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
||||||
{41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
{41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
||||||
|
{47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15},
|
||||||
|
//{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15},
|
||||||
|
//{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30},
|
||||||
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
|
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
|
||||||
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
|
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
|
||||||
|
{53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100},
|
||||||
|
{65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100},
|
||||||
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
|
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
|
||||||
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
|
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
|
||||||
{71, 663000, 698000, 617000, 652000, 20, 123400, 100},
|
{71, 663000, 698000, 617000, 652000, 20, 123400, 100},
|
||||||
@@ -1499,6 +1515,15 @@ nr_bandentry_t nr_bandtable[] = {
|
|||||||
{83, 703000, 748000, 000, 000, 20, 140600, 100},
|
{83, 703000, 748000, 000, 000, 20, 140600, 100},
|
||||||
{84, 1920000, 1980000, 000, 000, 20, 384000, 100},
|
{84, 1920000, 1980000, 000, 000, 20, 384000, 100},
|
||||||
{86, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
{86, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
||||||
|
{89, 824000, 849000, 000, 000, 20, 342000, 100},
|
||||||
|
{90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
||||||
|
{90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
||||||
|
{90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100},
|
||||||
|
{91, 832000, 862000, 1427000, 1432000, 20, 285400, 100},
|
||||||
|
{92, 832000, 862000, 1432000, 1517000, 20, 286400, 100},
|
||||||
|
{93, 880000, 915000, 1427000, 1432000, 20, 285400, 100},
|
||||||
|
{94, 880000, 915000, 1432000, 1517000, 20, 286400, 100},
|
||||||
|
{95, 2010000, 2025000, 000, 000, 20, 402000, 100},
|
||||||
{257,26500020,29500000,26500020,29500000, 1,2054166, 60},
|
{257,26500020,29500000,26500020,29500000, 1,2054166, 60},
|
||||||
{257,26500080,29500000,26500080,29500000, 2,2054167, 120},
|
{257,26500080,29500000,26500080,29500000, 2,2054167, 120},
|
||||||
{258,24250080,27500000,24250080,27500000, 1,2016667, 60},
|
{258,24250080,27500000,24250080,27500000, 1,2016667, 60},
|
||||||
@@ -1552,46 +1577,58 @@ int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = {
|
|||||||
|
|
||||||
#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
|
#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
|
||||||
|
|
||||||
void get_band(uint64_t downlink_frequency,
|
// Returns the corresponding row index of the NR table
|
||||||
uint16_t *current_band,
|
int get_nr_table_idx(int nr_bandP, uint8_t scs_index){
|
||||||
int32_t *current_offset,
|
|
||||||
lte_frame_type_t *current_type)
|
|
||||||
{
|
|
||||||
int ind;
|
|
||||||
uint64_t center_frequency_khz;
|
|
||||||
uint64_t center_freq_diff_khz;
|
|
||||||
uint64_t dl_freq_khz = downlink_frequency/1000;
|
|
||||||
|
|
||||||
center_freq_diff_khz = 999999999999999999; // 2^64
|
int i, j;
|
||||||
*current_band = 0;
|
int scs_khz = 15 << scs_index;
|
||||||
|
int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95};
|
||||||
|
size_t s = sizeof(supplementary_bands)/sizeof(supplementary_bands[0]);
|
||||||
|
|
||||||
for ( ind=0;
|
for(j = 0; j < s; j++){
|
||||||
ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]);
|
if (nr_bandP == supplementary_bands[j])
|
||||||
ind++) {
|
AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
|
AssertFatal(nr_bandP <= nr_bandtable[NR_BANDTABLE_SIZE-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[NR_BANDTABLE_SIZE-1].band);
|
||||||
|
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
||||||
|
|
||||||
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) {
|
// selection of correct Deltaf raster according to SCS
|
||||||
|
if ((nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
||||||
|
i++;
|
||||||
|
|
||||||
center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min)/2;
|
LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min);
|
||||||
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
|
|
||||||
*current_band = nr_bandtable[ind].band;
|
|
||||||
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
|
|
||||||
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
|
|
||||||
|
|
||||||
if (*current_offset == 0)
|
return i;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Computes the duplex spacing (either positive or negative) in KHz
|
||||||
|
void get_delta_duplex(int nr_bandP, uint8_t scs_index, int32_t *delta_duplex){
|
||||||
|
|
||||||
|
int nr_table_idx = get_nr_table_idx(nr_bandP, scs_index);
|
||||||
|
|
||||||
|
*delta_duplex = (nr_bandtable[nr_table_idx].ul_min - nr_bandtable[nr_table_idx].dl_min);
|
||||||
|
|
||||||
|
LOG_D(PHY, "NR band duplex spacing is %d KHz (nr_bandtable[%d].band = %d)\n", *delta_duplex, nr_table_idx, nr_bandtable[nr_table_idx].band);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_frame_type(uint16_t current_band,
|
||||||
|
uint8_t scs_index,
|
||||||
|
lte_frame_type_t *current_type){
|
||||||
|
|
||||||
|
int32_t current_offset;
|
||||||
|
get_delta_duplex(current_band, scs_index, ¤t_offset);
|
||||||
|
|
||||||
|
current_offset *= 1000;
|
||||||
|
if (current_offset == 0)
|
||||||
*current_type = TDD;
|
*current_type = TDD;
|
||||||
else
|
else
|
||||||
*current_type = FDD;
|
*current_type = FDD;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_I( PHY, "DL frequency %"PRIu64": band %d, frame_type %d, UL frequency %"PRIu64"\n",
|
LOG_I(MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[*current_type], current_offset);
|
||||||
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
|
|
||||||
|
|
||||||
AssertFatal(*current_band != 0,
|
|
||||||
"Can't find EUTRA band for frequency %lu\n", downlink_frequency);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||||
@@ -1707,6 +1744,15 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs){
|
||||||
|
|
||||||
|
uint32_t delta_arfcn = nrarfcn - N_OFFs;
|
||||||
|
|
||||||
|
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
||||||
|
AssertFatal(1 == 0, "nrarfcn %u is not on the channel raster for step size %lu", nrarfcn, nr_bandtable[i].step_size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t to_nrarfcn(int nr_bandP,
|
uint32_t to_nrarfcn(int nr_bandP,
|
||||||
uint64_t dl_CarrierFreq,
|
uint64_t dl_CarrierFreq,
|
||||||
uint8_t scs_index,
|
uint8_t scs_index,
|
||||||
@@ -1714,17 +1760,10 @@ uint32_t to_nrarfcn(int nr_bandP,
|
|||||||
{
|
{
|
||||||
uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000;
|
uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000;
|
||||||
int bw_kHz = bw / 1000;
|
int bw_kHz = bw / 1000;
|
||||||
int scs_khz = 15<<scs_index;
|
uint32_t nrarfcn;
|
||||||
int i;
|
int i = get_nr_table_idx(nr_bandP, scs_index);
|
||||||
uint32_t nrarfcn, delta_arfcn;
|
|
||||||
|
|
||||||
LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
|
LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
|
||||||
AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
|
|
||||||
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
|
||||||
|
|
||||||
// selection of correct Deltaf raster according to SCS
|
|
||||||
if ( (nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
|
AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
|
||||||
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
||||||
@@ -1736,71 +1775,89 @@ uint32_t to_nrarfcn(int nr_bandP,
|
|||||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
|
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
|
||||||
|
|
||||||
int deltaFglobal = 60;
|
int deltaFglobal = 60;
|
||||||
|
uint32_t N_REF_Offs = 2016667;
|
||||||
|
uint64_t F_REF_Offs_khz = 24250080;
|
||||||
|
|
||||||
if (dl_CarrierFreq < 3e9) deltaFglobal = 15;
|
if (dl_CarrierFreq < 24.25e9) {
|
||||||
if (dl_CarrierFreq < 24.25e9) deltaFglobal = 5;
|
deltaFglobal = 15;
|
||||||
|
N_REF_Offs = 600000;
|
||||||
|
F_REF_Offs_khz = 3000000;
|
||||||
|
}
|
||||||
|
if (dl_CarrierFreq < 3e9) {
|
||||||
|
deltaFglobal = 5;
|
||||||
|
N_REF_Offs = 0;
|
||||||
|
F_REF_Offs_khz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
||||||
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
||||||
nrarfcn = (((dl_CarrierFreq_by_1k - nr_bandtable[i].dl_min)/deltaFglobal)+nr_bandtable[i].N_OFFs_DL);
|
nrarfcn = (((dl_CarrierFreq_by_1k - F_REF_Offs_khz)/deltaFglobal)+N_REF_Offs);
|
||||||
|
get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||||
delta_arfcn = nrarfcn - nr_bandtable[i].N_OFFs_DL;
|
|
||||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
|
||||||
AssertFatal(1==0,"dl_CarrierFreq %lu corresponds to %u which is not on the raster for step size %lu",
|
|
||||||
dl_CarrierFreq,nrarfcn,nr_bandtable[i].step_size);
|
|
||||||
|
|
||||||
return nrarfcn;
|
return nrarfcn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function computes the RF reference frequency from the NR-ARFCN according to 5.4.2.1 of 3GPP TS 38.104
|
||||||
|
// this function applies to both DL and UL
|
||||||
uint64_t from_nrarfcn(int nr_bandP,
|
uint64_t from_nrarfcn(int nr_bandP,
|
||||||
uint8_t scs_index,
|
uint8_t scs_index,
|
||||||
uint32_t dl_nrarfcn)
|
uint32_t nrarfcn)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int deltaFglobal = 5;
|
int deltaFglobal = 5;
|
||||||
int scs_khz = 15<<scs_index;
|
uint32_t N_REF_Offs = 0;
|
||||||
uint32_t delta_arfcn;
|
uint64_t F_REF_Offs_khz = 0;
|
||||||
|
int32_t delta_duplex;
|
||||||
|
uint64_t N_OFFs, frequency, freq_min;
|
||||||
|
int i = get_nr_table_idx(nr_bandP, scs_index);
|
||||||
|
|
||||||
if (dl_nrarfcn > 599999 && dl_nrarfcn < 2016667)
|
if (nrarfcn > 599999 && nrarfcn < 2016667) {
|
||||||
deltaFglobal = 15;
|
deltaFglobal = 15;
|
||||||
if (dl_nrarfcn > 2016666 && dl_nrarfcn < 3279166)
|
N_REF_Offs = 600000;
|
||||||
|
F_REF_Offs_khz = 3000000;
|
||||||
|
}
|
||||||
|
if (nrarfcn > 2016666 && nrarfcn < 3279166) {
|
||||||
deltaFglobal = 60;
|
deltaFglobal = 60;
|
||||||
|
N_REF_Offs = 2016667;
|
||||||
AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
|
F_REF_Offs_khz = 24250080;
|
||||||
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
|
||||||
AssertFatal(dl_nrarfcn>=nr_bandtable[i].N_OFFs_DL,"dl_nrarfcn %u < N_OFFs_DL[%d] %llu\n",dl_nrarfcn, nr_bandtable[i].band,(long long unsigned int)nr_bandtable[i].N_OFFs_DL);
|
|
||||||
|
|
||||||
// selection of correct Deltaf raster according to SCS
|
|
||||||
if ( (nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
delta_arfcn = dl_nrarfcn - nr_bandtable[i].N_OFFs_DL;
|
|
||||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
|
||||||
AssertFatal(1==0,"dl_nrarfcn %u is not on the raster for step size %lu",dl_nrarfcn,nr_bandtable[i].step_size);
|
|
||||||
|
|
||||||
LOG_I(PHY,"Computing dl_frequency (pointA %llu => %llu (dlmin %llu, nr_bandtable[%d].N_OFFs_DL %llu))\n",
|
|
||||||
(unsigned long long)dl_nrarfcn,
|
|
||||||
(unsigned long long)(1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal)),
|
|
||||||
(unsigned long long)nr_bandtable[i].dl_min,
|
|
||||||
i,
|
|
||||||
(unsigned long long)nr_bandtable[i].N_OFFs_DL);
|
|
||||||
|
|
||||||
return 1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_delta_duplex(nr_bandP, scs_index, &delta_duplex);
|
||||||
|
|
||||||
int32_t get_nr_uldl_offset(int nr_bandP)
|
if (delta_duplex <= 0){ // DL band >= UL band
|
||||||
{
|
if (nrarfcn >= nr_bandtable[i].N_OFFs_DL){ // is TDD of FDD DL
|
||||||
int i;
|
N_OFFs = nr_bandtable[i].N_OFFs_DL;
|
||||||
|
freq_min = nr_bandtable[i].dl_min;
|
||||||
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
} else {// is FDD UL
|
||||||
|
N_OFFs = nr_bandtable[i].N_OFFs_DL + delta_duplex/deltaFglobal;
|
||||||
AssertFatal(i < NR_BANDTABLE_SIZE, "i %d >= BANDTABLE_SIZE %ld\n", i, NR_BANDTABLE_SIZE);
|
freq_min = nr_bandtable[i].ul_min;
|
||||||
|
}
|
||||||
return (nr_bandtable[i].dl_min - nr_bandtable[i].ul_min);
|
} else { // UL band > DL band
|
||||||
|
if (nrarfcn >= nr_bandtable[i].N_OFFs_DL + delta_duplex/deltaFglobal){ // is FDD UL
|
||||||
|
N_OFFs = nr_bandtable[i].N_OFFs_DL + delta_duplex/deltaFglobal;
|
||||||
|
freq_min = nr_bandtable[i].ul_min;
|
||||||
|
} else { // is FDD DL
|
||||||
|
N_OFFs = nr_bandtable[i].N_OFFs_DL;
|
||||||
|
freq_min = nr_bandtable[i].dl_min;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_D(MAC, "Frequency from NR-ARFCN for N_OFFs %lu, duplex spacing %d KHz, deltaFglobal %d KHz\n", N_OFFs, delta_duplex, deltaFglobal);
|
||||||
|
|
||||||
|
AssertFatal(nrarfcn >= N_OFFs,"nrarfcn %u < N_OFFs[%d] %llu\n", nrarfcn, nr_bandtable[i].band, (long long unsigned int)N_OFFs);
|
||||||
|
get_delta_arfcn(i, nrarfcn, N_OFFs);
|
||||||
|
|
||||||
|
frequency = 1000*(F_REF_Offs_khz + (nrarfcn - N_REF_Offs) * deltaFglobal);
|
||||||
|
|
||||||
|
LOG_I(MAC, "Computing frequency (pointA %llu => %llu KHz (freq_min %llu KHz, NR band %d N_OFFs %llu))\n",
|
||||||
|
(unsigned long long)nrarfcn,
|
||||||
|
(unsigned long long)frequency/1000,
|
||||||
|
(unsigned long long)freq_min,
|
||||||
|
nr_bandP,
|
||||||
|
(unsigned long long)N_OFFs);
|
||||||
|
|
||||||
|
return frequency;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||||
int x_overhead,
|
int x_overhead,
|
||||||
@@ -1882,7 +1939,7 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 0:
|
case 0:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51311[Imcs][0]);
|
return (Table_51311[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1890,7 +1947,7 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51312[Imcs][0]);
|
return (Table_51312[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1898,13 +1955,14 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 2:
|
case 2:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51313[Imcs][0]);
|
return (Table_51313[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
|
LOG_E(MAC, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1913,7 +1971,7 @@ uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 0:
|
case 0:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51311[Imcs][1]);
|
return (Table_51311[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -1921,7 +1979,7 @@ uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51312[Imcs][1]);
|
return (Table_51312[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -1929,13 +1987,14 @@ uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 2:
|
case 2:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51313[Imcs][1]);
|
return (Table_51313[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
|
LOG_E(MAC, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1944,7 +2003,7 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 0:
|
case 0:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51311[Imcs][0]);
|
return (Table_51311[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1952,7 +2011,7 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51312[Imcs][0]);
|
return (Table_51312[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1960,7 +2019,7 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 2:
|
case 2:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51313[Imcs][0]);
|
return (Table_51313[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1968,7 +2027,7 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 3:
|
case 3:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_61411[Imcs][0]);
|
return (Table_61411[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
@@ -1976,13 +2035,14 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 4:
|
case 4:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_61412[Imcs][0]);
|
return (Table_61412[Imcs][0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
|
LOG_E(MAC, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1991,7 +2051,7 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 0:
|
case 0:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51311[Imcs][1]);
|
return (Table_51311[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -1999,7 +2059,7 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51312[Imcs][1]);
|
return (Table_51312[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -2007,7 +2067,7 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 2:
|
case 2:
|
||||||
if (Imcs > 28) {
|
if (Imcs > 28) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
|
||||||
Imcs = 28;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_51313[Imcs][1]);
|
return (Table_51313[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -2015,7 +2075,7 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 3:
|
case 3:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_61411[Imcs][1]);
|
return (Table_61411[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
@@ -2023,13 +2083,14 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
|||||||
case 4:
|
case 4:
|
||||||
if (Imcs > 27) {
|
if (Imcs > 27) {
|
||||||
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
|
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
|
||||||
Imcs = 27;
|
return 0;
|
||||||
}
|
}
|
||||||
return (Table_61412[Imcs][1]);
|
return (Table_61412[Imcs][1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
|
LOG_E(MAC, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,9 @@ typedef enum {
|
|||||||
|
|
||||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||||
|
|
||||||
void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
|
void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type);
|
||||||
|
|
||||||
|
void get_delta_duplex(int nr_bandP, uint8_t scs_index, int32_t *delta_duplex);
|
||||||
|
|
||||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||||
|
|
||||||
|
|||||||
@@ -147,13 +147,14 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|||||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
int i;
|
int i;
|
||||||
|
lte_frame_type_t frame_type;
|
||||||
|
|
||||||
mac->phy_config.Mod_id = module_id;
|
mac->phy_config.Mod_id = module_id;
|
||||||
mac->phy_config.CC_id = cc_idP;
|
mac->phy_config.CC_id = cc_idP;
|
||||||
|
|
||||||
// carrier config
|
// carrier config
|
||||||
|
|
||||||
LOG_I(MAC,"UE Config Common\n");
|
LOG_I(MAC, "Entering UE Config Common\n");
|
||||||
|
|
||||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||||
@@ -200,15 +201,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lte_frame_type_t frame_type;
|
get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type);
|
||||||
uint16_t band;
|
|
||||||
int32_t offset;
|
|
||||||
|
|
||||||
get_band((uint64_t)(cfg->carrier_config.dl_frequency)*1000,
|
|
||||||
&band,
|
|
||||||
&offset,
|
|
||||||
&frame_type);
|
|
||||||
|
|
||||||
|
|
||||||
// cell config
|
// cell config
|
||||||
|
|
||||||
@@ -259,8 +252,8 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|||||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||||
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||||
}
|
}
|
||||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period);
|
|
||||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||||
|
LOG_I(MAC,"Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period);
|
||||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ typedef struct {
|
|||||||
uint8_t generate_nr_prach;
|
uint8_t generate_nr_prach;
|
||||||
|
|
||||||
//// FAPI-like interface message
|
//// FAPI-like interface message
|
||||||
fapi_nr_ul_config_request_t ul_config_request;
|
fapi_nr_ul_config_request_t *ul_config_request;
|
||||||
fapi_nr_dl_config_request_t dl_config_request;
|
fapi_nr_dl_config_request_t dl_config_request;
|
||||||
|
|
||||||
/// Interface module instances
|
/// Interface module instances
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
|||||||
|
|
||||||
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||||
|
|
||||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index,fapi_nr_dci_indication_pdu_t *dci);
|
int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
|
||||||
|
|
||||||
uint32_t get_ssb_frame(uint32_t test);
|
uint32_t get_ssb_frame(uint32_t test);
|
||||||
uint32_t get_ssb_slot(uint32_t ssb_index);
|
uint32_t get_ssb_slot(uint32_t ssb_index);
|
||||||
|
|||||||
@@ -62,6 +62,17 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
|||||||
pdcp_layer_init();
|
pdcp_layer_init();
|
||||||
nr_DRB_preconfiguration();
|
nr_DRB_preconfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allocate memory for ul_config_request in the mac instance. This is now a pointer and will
|
||||||
|
// point to a list of structures (one for each UL slot) to store PUSCH scheduling parameters
|
||||||
|
// received from UL DCI.
|
||||||
|
if (nr_ue_mac_inst->scc) {
|
||||||
|
int num_slots_ul = nr_ue_mac_inst->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||||
|
if (nr_ue_mac_inst->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols>0)
|
||||||
|
num_slots_ul++;
|
||||||
|
LOG_D(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul);
|
||||||
|
nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else LOG_I(MAC,"Running without RRC instance\n");
|
else LOG_I(MAC,"Running without RRC instance\n");
|
||||||
|
|
||||||
|
|||||||
@@ -1346,6 +1346,61 @@ uint32_t get_ssb_frame(uint32_t test){
|
|||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function returns the slot offset K2 corresponding to a given time domain
|
||||||
|
* indication value from RRC configuration.
|
||||||
|
*/
|
||||||
|
long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||||
|
long k2 = -1;
|
||||||
|
// Get K2 from RRC configuration
|
||||||
|
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||||
|
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||||
|
if (pusch_config->pusch_TimeDomainAllocationList) {
|
||||||
|
pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup;
|
||||||
|
}
|
||||||
|
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||||
|
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||||
|
}
|
||||||
|
if (pusch_TimeDomainAllocationList) {
|
||||||
|
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
||||||
|
LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
||||||
|
time_domain_ind, pusch_TimeDomainAllocationList->list.count);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
k2 = *pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_D(MAC, "get_k2(): k2 is %ld\n", k2);
|
||||||
|
return k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function returns the UL config corresponding to a given UL slot
|
||||||
|
* from MAC instance .
|
||||||
|
*/
|
||||||
|
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) {
|
||||||
|
//Check if request to access ul_config is for a UL slot
|
||||||
|
if (is_nr_UL_slot(mac->scc, slot) == 0) {
|
||||||
|
LOG_W(MAC, "Slot %d is not a UL slot. get_ul_config_request() called for wrong slot!!!\n", slot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the index of the UL slot in mac->ul_config_request list. This is
|
||||||
|
// based on the TDD pattern (slot configuration period) and number of UL+mixed
|
||||||
|
// slots in the period. TS 38.213 Sec 11.1
|
||||||
|
int mu = mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||||
|
const int num_slots_per_tdd = nr_slots_per_frame[mu] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
||||||
|
const int num_slots_ul = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
||||||
|
int index = slot + num_slots_ul - num_slots_per_tdd;
|
||||||
|
LOG_D(MAC, "nr_ue_procedures: get_ul_config_request() slots per tdd %d, num_slots_ul %d, index %d\n",
|
||||||
|
num_slots_per_tdd,
|
||||||
|
num_slots_ul,
|
||||||
|
index);
|
||||||
|
|
||||||
|
return &mac->ul_config_request[index];
|
||||||
|
}
|
||||||
|
|
||||||
// Performs :
|
// Performs :
|
||||||
// 1. TODO: Call RRC for link status return to PHY
|
// 1. TODO: Call RRC for link status return to PHY
|
||||||
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
|
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
|
||||||
@@ -1451,7 +1506,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
}
|
}
|
||||||
} else if (ul_info) {
|
} else if (ul_info) {
|
||||||
|
|
||||||
if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB)
|
// ULSCH is handled only in phy-test mode (consistently with OAI gNB)
|
||||||
|
if (get_softmodem_params()->phy_test) {
|
||||||
|
|
||||||
uint8_t nb_dmrs_re_per_rb;
|
uint8_t nb_dmrs_re_per_rb;
|
||||||
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
||||||
@@ -1470,48 +1526,36 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||||
uint8_t access_mode = SCHEDULED_ACCESS;
|
uint8_t access_mode = SCHEDULED_ACCESS;
|
||||||
|
|
||||||
|
fapi_nr_ul_config_request_t *ul_config_req = get_ul_config_request(mac, slot_tx);
|
||||||
|
|
||||||
|
// Schedule ULSCH only if the current frame and slot match those in ul_config_req
|
||||||
|
// AND if a UL DCI has been received (as indicated by num_pdus).
|
||||||
|
if ((frame_tx == ul_config_req->sfn && slot_tx == ul_config_req->slot) &&
|
||||||
|
ul_config_req->number_pdus > 0) {
|
||||||
|
|
||||||
// program PUSCH with UL DCI parameters
|
// program PUSCH with UL DCI parameters
|
||||||
nr_dcireq_t dcireq;
|
|
||||||
nr_scheduled_response_t scheduled_response;
|
nr_scheduled_response_t scheduled_response;
|
||||||
fapi_nr_tx_request_t tx_req;
|
fapi_nr_tx_request_t tx_req;
|
||||||
fapi_nr_tx_request_body_t tx_req_body;
|
|
||||||
fapi_nr_ul_config_request_t *ul_config = &dcireq.ul_config_req;
|
|
||||||
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
|
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
|
||||||
|
|
||||||
fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = &mac->ul_config_request.ul_config_list[0];
|
for (int j = 0; j < ul_config_req->number_pdus; j++) {
|
||||||
|
fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = &ul_config_req->ul_config_list[j];
|
||||||
|
|
||||||
|
if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) {
|
||||||
|
|
||||||
uint16_t rnti = ulcfg_pdu->pusch_config_pdu.rnti;
|
|
||||||
uint32_t rb_size = ulcfg_pdu->pusch_config_pdu.rb_size;
|
|
||||||
uint32_t rb_start = ulcfg_pdu->pusch_config_pdu.rb_start;
|
|
||||||
uint8_t nr_of_symbols = ulcfg_pdu->pusch_config_pdu.nr_of_symbols;
|
|
||||||
uint8_t start_symbol_index = ulcfg_pdu->pusch_config_pdu.start_symbol_index;
|
|
||||||
uint8_t nrOfLayers = 1;
|
|
||||||
uint8_t mcs_index = ulcfg_pdu->pusch_config_pdu.mcs_index;
|
|
||||||
uint8_t mcs_table = ulcfg_pdu->pusch_config_pdu.mcs_table;
|
|
||||||
uint8_t harq_process_id = ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id;
|
|
||||||
uint8_t rv_index = ulcfg_pdu->pusch_config_pdu.pusch_data.rv_index;
|
|
||||||
uint16_t l_prime_mask = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1);
|
|
||||||
uint8_t dmrs_config_type = 0;
|
|
||||||
uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
|
||||||
// These should come from RRC config!!!
|
// These should come from RRC config!!!
|
||||||
uint8_t ptrs_mcs1 = 2;
|
uint8_t ptrs_mcs1 = 2;
|
||||||
uint8_t ptrs_mcs2 = 4;
|
uint8_t ptrs_mcs2 = 4;
|
||||||
uint8_t ptrs_mcs3 = 10;
|
uint8_t ptrs_mcs3 = 10;
|
||||||
uint16_t n_rb0 = 25;
|
uint16_t n_rb0 = 25;
|
||||||
uint16_t n_rb1 = 75;
|
uint16_t n_rb1 = 75;
|
||||||
uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table);
|
uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table);
|
||||||
uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, rb_size);
|
uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, ulcfg_pdu->pusch_config_pdu.rb_size);
|
||||||
uint16_t number_dmrs_symbols = 0;
|
uint16_t l_prime_mask = get_l_prime(ulcfg_pdu->pusch_config_pdu.nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1);
|
||||||
uint16_t ul_dmrs_symb_pos = l_prime_mask << start_symbol_index;
|
uint16_t ul_dmrs_symb_pos = l_prime_mask << ulcfg_pdu->pusch_config_pdu.start_symbol_index;
|
||||||
|
|
||||||
#ifdef DEBUG_DCI
|
uint8_t dmrs_config_type = 0;
|
||||||
LOG_I(MAC, " UL config params \n rnti: %x \n rb_size: %d \n",
|
uint16_t number_dmrs_symbols = 0;
|
||||||
rnti, rb_size);
|
|
||||||
LOG_I(MAC, "rb_start: %x \n nr_of_symbols: %d \n start_symbol_index: %d \n nrOfLayers: %d \n mcs_index: %d \n \
|
|
||||||
mcs_table: %d \n harq_process_id: %d \n ndi: %d \n num_cb: %d \n rv_index: %d \n",
|
|
||||||
rb_start, nr_of_symbols, start_symbol_index, nrOfLayers, mcs_index,
|
|
||||||
mcs_table, harq_process_id, ndi, num_cb, rv_index);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// PTRS ports configuration
|
// PTRS ports configuration
|
||||||
// TbD: ptrs_dmrs_port and ptrs_port_index are not initialised!
|
// TbD: ptrs_dmrs_port and ptrs_port_index are not initialised!
|
||||||
@@ -1523,48 +1567,36 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
else
|
else
|
||||||
N_PRB_oh = *mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
N_PRB_oh = *mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
||||||
|
|
||||||
ul_config->slot = ul_info->slot_tx;
|
ulcfg_pdu->pusch_config_pdu.ul_dmrs_symb_pos = ul_dmrs_symb_pos;
|
||||||
ul_config->number_pdus = 1;
|
ulcfg_pdu->pusch_config_pdu.dmrs_config_type = dmrs_config_type;
|
||||||
ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
ulcfg_pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.rnti = rnti;
|
ulcfg_pdu->pusch_config_pdu.nrOfLayers = 1;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.rb_size = rb_size;
|
ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator = 0;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start;
|
ulcfg_pdu->pusch_config_pdu.pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols;
|
ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index;
|
ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = ul_dmrs_symb_pos;
|
ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
|
//ulcfg_pdu->pusch_config_pdu.target_code_rate = nr_get_code_rate_ul(ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table);
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index;
|
//ulcfg_pdu->pusch_config_pdu.qam_mod_order = nr_get_Qm_ul(ulcfg_pdu->pusch_config_pdu.mcs_index, ulcfg_pdu->pusch_config_pdu.mcs_table);
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.target_code_rate = nr_get_code_rate_ul(mcs_index, mcs_table);
|
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.qam_mod_order = nr_get_Qm_ul(mcs_index, mcs_table);
|
|
||||||
|
|
||||||
if (1 << ptrs_time_density >= nr_of_symbols) {
|
if (1 << ulcfg_pdu->pusch_config_pdu.pusch_ptrs.ptrs_time_density >= ulcfg_pdu->pusch_config_pdu.nr_of_symbols) {
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
|
ulcfg_pdu->pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
|
||||||
}
|
}
|
||||||
|
|
||||||
get_num_re_dmrs(&ul_config->ul_config_list[0].pusch_config_pdu,
|
get_num_re_dmrs(&ulcfg_pdu->pusch_config_pdu,
|
||||||
&nb_dmrs_re_per_rb,
|
&nb_dmrs_re_per_rb,
|
||||||
&number_dmrs_symbols);
|
&number_dmrs_symbols);
|
||||||
|
|
||||||
TBS = nr_compute_tbs(ul_config->ul_config_list[0].pusch_config_pdu.qam_mod_order,
|
TBS = nr_compute_tbs(ulcfg_pdu->pusch_config_pdu.qam_mod_order,
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.target_code_rate,
|
ulcfg_pdu->pusch_config_pdu.target_code_rate,
|
||||||
rb_size,
|
ulcfg_pdu->pusch_config_pdu.rb_size,
|
||||||
nr_of_symbols,
|
ulcfg_pdu->pusch_config_pdu.nr_of_symbols,
|
||||||
nb_dmrs_re_per_rb*number_dmrs_symbols,
|
nb_dmrs_re_per_rb*number_dmrs_symbols,
|
||||||
N_PRB_oh,
|
N_PRB_oh,
|
||||||
0,
|
0,
|
||||||
nrOfLayers);
|
ulcfg_pdu->pusch_config_pdu.nrOfLayers);
|
||||||
TBS_bytes = TBS/8;
|
TBS_bytes = TBS/8;
|
||||||
ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS_bytes;
|
ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size = TBS_bytes;
|
||||||
|
|
||||||
if (IS_SOFTMODEM_NOS1){
|
if (IS_SOFTMODEM_NOS1){
|
||||||
// Getting IP traffic to be transmitted
|
// Getting IP traffic to be transmitted
|
||||||
@@ -1606,23 +1638,18 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dcireq.module_id = mod_id;
|
|
||||||
dcireq.gNB_index = gNB_index;
|
|
||||||
dcireq.cc_id = cc_id;
|
|
||||||
dcireq.frame = rx_frame;
|
|
||||||
dcireq.slot = rx_slot;
|
|
||||||
|
|
||||||
// Config UL TX PDU
|
// Config UL TX PDU
|
||||||
tx_req.slot = slot_tx;
|
tx_req.slot = slot_tx;
|
||||||
tx_req.sfn = frame_tx;
|
tx_req.sfn = frame_tx;
|
||||||
// tx_req->tx_config // TbD
|
// tx_req->tx_config // TbD
|
||||||
tx_req.number_of_pdus = 1;
|
tx_req.number_of_pdus++;
|
||||||
tx_req_body.pdu_length = TBS_bytes;
|
tx_req.tx_request_body[j].pdu_length = TBS_bytes;
|
||||||
tx_req_body.pdu_index = 0;
|
tx_req.tx_request_body[j].pdu_index = j;
|
||||||
tx_req_body.pdu = ulsch_input_buffer;
|
tx_req.tx_request_body[j].pdu = ulsch_input_buffer;
|
||||||
tx_req.tx_request_body = &tx_req_body;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, rx_frame, rx_slot);
|
fill_scheduled_response(&scheduled_response, NULL, ul_config_req, &tx_req, mod_id, cc_id, rx_frame, rx_slot);
|
||||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
||||||
mac->if_module->scheduled_response(&scheduled_response);
|
mac->if_module->scheduled_response(&scheduled_response);
|
||||||
}
|
}
|
||||||
@@ -1632,6 +1659,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
if (mac->RA_contention_resolution_timer_active == 1)
|
if (mac->RA_contention_resolution_timer_active == 1)
|
||||||
ue_contention_resolution(mod_id, gNB_index, cc_id, ul_info->frame_tx);
|
ue_contention_resolution(mod_id, gNB_index, cc_id, ul_info->frame_tx);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else if (get_softmodem_params()->do_ra){
|
} else if (get_softmodem_params()->do_ra){
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(ul_info->module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(ul_info->module_id);
|
||||||
@@ -1641,8 +1670,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
||||||
nr_scheduled_response_t scheduled_response;
|
nr_scheduled_response_t scheduled_response;
|
||||||
fapi_nr_tx_request_t tx_req;
|
fapi_nr_tx_request_t tx_req;
|
||||||
fapi_nr_tx_request_body_t tx_req_body;
|
//fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, ul_info->slot_tx);
|
||||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0];
|
||||||
fapi_nr_ul_config_request_pdu_t *ul_config_list = &ul_config->ul_config_list[ul_config->number_pdus];
|
fapi_nr_ul_config_request_pdu_t *ul_config_list = &ul_config->ul_config_list[ul_config->number_pdus];
|
||||||
uint16_t TBS_bytes = ul_config_list->pusch_config_pdu.pusch_data.tb_size;
|
uint16_t TBS_bytes = ul_config_list->pusch_config_pdu.pusch_data.tb_size;
|
||||||
|
|
||||||
@@ -1683,10 +1712,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
tx_req.slot = ul_info->slot_tx;
|
tx_req.slot = ul_info->slot_tx;
|
||||||
tx_req.sfn = ul_info->frame_tx;
|
tx_req.sfn = ul_info->frame_tx;
|
||||||
tx_req.number_of_pdus = 1;
|
tx_req.number_of_pdus = 1;
|
||||||
tx_req_body.pdu_length = TBS_bytes;
|
tx_req.tx_request_body[0].pdu_length = TBS_bytes;
|
||||||
tx_req_body.pdu_index = 0;
|
tx_req.tx_request_body[0].pdu_index = 0;
|
||||||
tx_req_body.pdu = ulsch_input_buffer;
|
tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
|
||||||
tx_req.tx_request_body = &tx_req_body;
|
|
||||||
ul_config_list->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
ul_config_list->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||||
ul_config->number_pdus++;
|
ul_config->number_pdus++;
|
||||||
// scheduled_response
|
// scheduled_response
|
||||||
@@ -1753,7 +1781,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
|||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||||
|
|
||||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
//fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
|
||||||
|
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0];
|
||||||
fapi_nr_ul_config_prach_pdu *prach_config_pdu;
|
fapi_nr_ul_config_prach_pdu *prach_config_pdu;
|
||||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||||
fapi_nr_prach_config_t *prach_config = &cfg->prach_config;
|
fapi_nr_prach_config_t *prach_config = &cfg->prach_config;
|
||||||
@@ -3087,7 +3116,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//////////////
|
//////////////
|
||||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index,fapi_nr_dci_indication_pdu_t *dci) {
|
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci) {
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
|
|
||||||
@@ -3095,16 +3124,19 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
|
|||||||
dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits);
|
dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits);
|
||||||
|
|
||||||
int dci_format = nr_extract_dci_info(mac,dci->dci_format,dci->payloadSize,dci->rnti,(uint64_t *)dci->payloadBits,def_dci_pdu_rel15);
|
int dci_format = nr_extract_dci_info(mac,dci->dci_format,dci->payloadSize,dci->rnti,(uint64_t *)dci->payloadBits,def_dci_pdu_rel15);
|
||||||
return (nr_ue_process_dci(module_id, cc_id, gNB_index, def_dci_pdu_rel15, dci->rnti, dci_format));
|
return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format){
|
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format){
|
||||||
|
|
||||||
int bwp_id = 1;
|
int bwp_id = 1;
|
||||||
|
int mu = 0;
|
||||||
|
long k2 = 0;
|
||||||
|
uint16_t frame_tx = 0, slot_tx = 0;
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
fapi_nr_ul_config_request_t *ul_config = NULL;
|
||||||
|
|
||||||
//const uint16_t n_RB_DLBWP = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP; //make sure this has been set
|
//const uint16_t n_RB_DLBWP = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP; //make sure this has been set
|
||||||
AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
||||||
@@ -3134,6 +3166,28 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
|
|||||||
* 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
|
* 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
|
||||||
* 50 SUL_IND_0_0:
|
* 50 SUL_IND_0_0:
|
||||||
*/
|
*/
|
||||||
|
// Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||||
|
// where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||||
|
// in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||||
|
|
||||||
|
// Get the numerology to calculate the Tx frame and slot
|
||||||
|
mu = mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
// Get slot offset K2 which will be used to calculate TX slot
|
||||||
|
k2 = get_k2(mac, dci->time_domain_assignment.val);
|
||||||
|
if (k2 < 0) // This can happen when a false DCI is received
|
||||||
|
return -1;
|
||||||
|
// Calculate TX slot and frame
|
||||||
|
slot_tx = (slot + k2) % nr_slots_per_frame[mu];
|
||||||
|
frame_tx = ((slot + k2) > nr_slots_per_frame[mu]) ? (frame + 1) % 1024 : frame;
|
||||||
|
|
||||||
|
// Get UL config request corresponding slot_tx
|
||||||
|
ul_config = get_ul_config_request(mac, slot_tx);
|
||||||
|
//AssertFatal(ul_config != NULL, "nr_ue_process_dci(): ul_config is NULL\n");
|
||||||
|
if (!ul_config) {
|
||||||
|
LOG_W(MAC, "nr_ue_process_dci(): ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n",frame,slot);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||||
ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti;
|
ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti;
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
||||||
@@ -3172,7 +3226,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
|
|||||||
}
|
}
|
||||||
/* SUL_IND_0_0 */ // To be implemented, FIXME!!!
|
/* SUL_IND_0_0 */ // To be implemented, FIXME!!!
|
||||||
|
|
||||||
|
ul_config->slot = slot_tx;
|
||||||
|
ul_config->sfn = frame_tx;
|
||||||
ul_config->number_pdus = ul_config->number_pdus + 1;
|
ul_config->number_pdus = ul_config->number_pdus + 1;
|
||||||
|
LOG_D(MAC, "nr_ue_process_dci(): Calculated frame and slot for pusch Tx: %d.%d, number of pdus %d\n", ul_config->sfn, ul_config->slot, ul_config->number_pdus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_UL_DCI_FORMAT_0_1:
|
case NR_UL_DCI_FORMAT_0_1:
|
||||||
@@ -3204,6 +3261,28 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
|
|||||||
* 48 UL_SCH_IND
|
* 48 UL_SCH_IND
|
||||||
* 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
|
* 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
|
||||||
*/
|
*/
|
||||||
|
// Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||||
|
// where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||||
|
// in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||||
|
|
||||||
|
// Get the numerology to calculate the Tx frame and slot
|
||||||
|
mu = mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
// Get slot offset K2 which will be used to calculate TX slot
|
||||||
|
k2 = get_k2(mac, dci->time_domain_assignment.val);
|
||||||
|
if (k2 < 0) // This can happen when a false DCI is received
|
||||||
|
return -1;
|
||||||
|
// Calculate TX slot and frame
|
||||||
|
slot_tx = (slot + k2) % nr_slots_per_frame[mu];
|
||||||
|
frame_tx = ((slot + k2) > nr_slots_per_frame[mu]) ? (frame + 1) % 1024 : frame;
|
||||||
|
|
||||||
|
// Get UL config request corresponding slot_tx
|
||||||
|
ul_config = get_ul_config_request(mac, slot_tx);
|
||||||
|
//AssertFatal(ul_config != NULL, "nr_ue_process_dci(): ul_config is NULL\n");
|
||||||
|
if (!ul_config) {
|
||||||
|
LOG_W(MAC, "nr_ue_process_dci(): ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n",frame,slot);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||||
ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti;
|
ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti;
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
||||||
@@ -3240,6 +3319,13 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
|
|||||||
pusch_config_pdu_0_1->mcs_table = get_pusch_mcs_table(pusch_config->mcs_TableTransformPrecoder, 1,
|
pusch_config_pdu_0_1->mcs_table = get_pusch_mcs_table(pusch_config->mcs_TableTransformPrecoder, 1,
|
||||||
dci_format, NR_RNTI_C, NR_SearchSpace__searchSpaceType_PR_ue_Specific, false);
|
dci_format, NR_RNTI_C, NR_SearchSpace__searchSpaceType_PR_ue_Specific, false);
|
||||||
|
|
||||||
|
pusch_config_pdu_0_1->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu_0_1->mcs_index, pusch_config_pdu_0_1->mcs_table);
|
||||||
|
pusch_config_pdu_0_1->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu_0_1->mcs_index, pusch_config_pdu_0_1->mcs_table);
|
||||||
|
if (pusch_config_pdu_0_1->target_code_rate == 0 || pusch_config_pdu_0_1->qam_mod_order == 0) {
|
||||||
|
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected UL DCI. Ignoring DCI! \n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* NDI */
|
/* NDI */
|
||||||
pusch_config_pdu_0_1->pusch_data.new_data_indicator = dci->ndi;
|
pusch_config_pdu_0_1->pusch_data.new_data_indicator = dci->ndi;
|
||||||
/* RV */
|
/* RV */
|
||||||
@@ -3498,7 +3584,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
|
|||||||
// A value of "1" indicates UL-SCH shall be transmitted on the PUSCH and
|
// A value of "1" indicates UL-SCH shall be transmitted on the PUSCH and
|
||||||
// a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH
|
// a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH
|
||||||
|
|
||||||
|
ul_config->slot = slot_tx;
|
||||||
|
ul_config->sfn = frame_tx;
|
||||||
ul_config->number_pdus = ul_config->number_pdus + 1;
|
ul_config->number_pdus = ul_config->number_pdus + 1;
|
||||||
|
LOG_D(MAC, "nr_ue_process_dci(): Calculated frame and slot for pusch Tx: %d.%d, number of pdus %d\n", ul_config->sfn, ul_config->slot, ul_config->number_pdus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_DL_DCI_FORMAT_1_0:
|
case NR_DL_DCI_FORMAT_1_0:
|
||||||
@@ -3900,7 +3989,6 @@ void nr_ue_send_sdu(module_id_t module_idP,
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
@@ -3908,7 +3996,6 @@ void nr_ue_send_sdu(module_id_t module_idP,
|
|||||||
}
|
}
|
||||||
LOG_T(MAC, "\n");
|
LOG_T(MAC, "\n");
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
// Processing MAC PDU
|
// Processing MAC PDU
|
||||||
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
|
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
|
||||||
@@ -4563,6 +4650,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
|
|||||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
|
||||||
switch(rx_lcid){
|
switch(rx_lcid){
|
||||||
// MAC CE
|
// MAC CE
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void nr_config_Msg3_pdu(NR_UE_MAC_INST_t *mac,
|
|||||||
uint8_t nb_dmrs_re_per_rb;
|
uint8_t nb_dmrs_re_per_rb;
|
||||||
uint16_t number_dmrs_symbols = 0;
|
uint16_t number_dmrs_symbols = 0;
|
||||||
int N_PRB_oh;
|
int N_PRB_oh;
|
||||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0];
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
||||||
|
|||||||
@@ -125,14 +125,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
|||||||
}
|
}
|
||||||
|
|
||||||
lte_frame_type_t frame_type;
|
lte_frame_type_t frame_type;
|
||||||
uint16_t band;
|
get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type);
|
||||||
int32_t offset;
|
|
||||||
|
|
||||||
get_band((uint64_t)(cfg->carrier_config.dl_frequency.value)*1000,
|
|
||||||
&band,
|
|
||||||
&offset,
|
|
||||||
&frame_type);
|
|
||||||
|
|
||||||
RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type;
|
RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type;
|
||||||
|
|
||||||
// Cell configuration
|
// Cell configuration
|
||||||
@@ -297,8 +290,8 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
|||||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||||
cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||||
}
|
}
|
||||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
|
||||||
if(cfg->cell_config.frame_duplex_type.value == TDD){
|
if(cfg->cell_config.frame_duplex_type.value == TDD){
|
||||||
|
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
||||||
int return_tdd = set_tdd_config_nr(cfg,
|
int return_tdd = set_tdd_config_nr(cfg,
|
||||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||||
@@ -306,10 +299,10 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
|||||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
|
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
|
||||||
|
|
||||||
if (return_tdd !=0){
|
if (return_tdd != 0)
|
||||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
LOG_E(MAC,"TDD configuration can not be done\n");
|
||||||
}
|
else
|
||||||
else LOG_I(PHY,"TDD has been properly configurated\n");
|
LOG_I(MAC,"TDD has been properly configurated\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -403,6 +403,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
|||||||
protocol_ctxt_t ctxt;
|
protocol_ctxt_t ctxt;
|
||||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
|
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
|
||||||
|
|
||||||
|
int nb_periods_per_frame;
|
||||||
|
|
||||||
const int UE_id = 0;
|
const int UE_id = 0;
|
||||||
const int bwp_id = 1;
|
const int bwp_id = 1;
|
||||||
|
|
||||||
@@ -411,9 +413,47 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
|||||||
NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_info->UE_sched_ctrl[UE_id];
|
NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||||
|
|
||||||
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||||
const int num_slots_per_tdd = slots_per_frame[*scc->ssbSubcarrierSpacing] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
|
||||||
|
switch(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) {
|
||||||
|
case 0:
|
||||||
|
nb_periods_per_frame = 20; // 10ms/0p5ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
nb_periods_per_frame = 16; // 10ms/0p625ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
nb_periods_per_frame = 10; // 10ms/1ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
nb_periods_per_frame = 8; // 10ms/1p25ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
nb_periods_per_frame = 5; // 10ms/2ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
nb_periods_per_frame = 4; // 10ms/2p5ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
nb_periods_per_frame = 2; // 10ms/5ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
nb_periods_per_frame = 1; // 10ms/10ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
AssertFatal(1==0,"Undefined tdd period %ld\n", scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
int num_slots_per_tdd = (slots_per_frame[*scc->ssbSubcarrierSpacing])/nb_periods_per_frame;
|
||||||
|
|
||||||
const int nr_ulmix_slots = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
const int nr_ulmix_slots = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
||||||
|
|
||||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||||
@@ -438,18 +478,18 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
|||||||
//mbsfn_status[CC_id] = 0;
|
//mbsfn_status[CC_id] = 0;
|
||||||
|
|
||||||
// clear vrb_maps
|
// clear vrb_maps
|
||||||
memset(cc[CC_id].vrb_map, 0, 275);
|
memset(cc[CC_id].vrb_map, 0, sizeof(uint16_t) * 275);
|
||||||
memset(cc[CC_id].vrb_map_UL, 0, 275);
|
memset(cc[CC_id].vrb_map_UL, 0, sizeof(uint16_t) * 275);
|
||||||
|
|
||||||
clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot);
|
clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
|
if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
|
||||||
|
|
||||||
|
|
||||||
// This schedules MIB
|
// This schedules MIB
|
||||||
if((slot == 0) && (frame & 7) == 0){
|
schedule_nr_mib(module_idP, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]);
|
||||||
schedule_nr_mib(module_idP, frame, slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This schedule PRACH if we are not in phy_test mode
|
// This schedule PRACH if we are not in phy_test mode
|
||||||
if (get_softmodem_params()->phy_test == 0)
|
if (get_softmodem_params()->phy_test == 0)
|
||||||
@@ -468,40 +508,30 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
|||||||
if (get_softmodem_params()->phy_test == 0) {
|
if (get_softmodem_params()->phy_test == 0) {
|
||||||
nr_schedule_RA(module_idP, frame, slot);
|
nr_schedule_RA(module_idP, frame, slot);
|
||||||
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
|
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
|
||||||
}
|
|
||||||
|
|
||||||
if (UE_info->active[UE_id]) {
|
|
||||||
// TbD once RACH is available, start ta_timer when UE is connected
|
|
||||||
if (ue_sched_ctl->ta_timer)
|
|
||||||
ue_sched_ctl->ta_timer--;
|
|
||||||
if (ue_sched_ctl->ta_timer == 0) {
|
|
||||||
ue_sched_ctl->ta_apply = true;
|
|
||||||
/* if time is up, then set the timer to not send it for 5 frames
|
|
||||||
// regardless of the TA value */
|
|
||||||
ue_sched_ctl->ta_timer = 100;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This schedules the DCI for Uplink and subsequently PUSCH
|
// This schedules the DCI for Uplink and subsequently PUSCH
|
||||||
|
|
||||||
// The decision about whether to schedule is done for each UE independently
|
// The decision about whether to schedule is done for each UE independently
|
||||||
// inside
|
// inside
|
||||||
if (UE_info->active[UE_id] && slot < 10) {
|
if (UE_info->active[UE_id] && slot < 10) {
|
||||||
|
|
||||||
int tda = 1; // time domain assignment hardcoded for now
|
int tda = 1; // time domain assignment hardcoded for now
|
||||||
schedule_fapi_ul_pdu(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, tda, ulsch_in_slot_bitmap);
|
schedule_fapi_ul_pdu(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, tda, ulsch_in_slot_bitmap);
|
||||||
nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot);
|
nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (UE_info->active[UE_id]
|
if (UE_info->active[UE_id]
|
||||||
&& (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd))
|
&& (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd))
|
||||||
&& slot < 10) {
|
&& slot < 10) {
|
||||||
|
|
||||||
ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd;
|
ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd;
|
||||||
//int pucch_sched;
|
|
||||||
//nr_update_pucch_scheduling(module_idP, UE_id, frame, slot, num_slots_per_tdd,&pucch_sched);
|
|
||||||
//nr_schedule_uss_dlsch_phytest(module_idP, frame, slot, &UE_info->UE_sched_ctrl[UE_id].sched_pucch[pucch_sched], NULL);
|
|
||||||
nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd);
|
nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd);
|
||||||
ue_sched_ctl->ta_apply = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (UE_info->active[UE_id])
|
if (UE_info->active[UE_id])
|
||||||
nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot);
|
nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot);
|
||||||
|
|
||||||
|
|||||||
@@ -438,9 +438,11 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pr_found) {
|
if (!pr_found) {
|
||||||
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
|
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
|
||||||
module_idP, preamble_index);
|
module_idP, preamble_index);
|
||||||
|
|
||||||
return; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
return; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
||||||
}
|
}
|
||||||
// This should be handled differently when we use the initialBWP for RA
|
// This should be handled differently when we use the initialBWP for RA
|
||||||
@@ -926,7 +928,7 @@ void nr_generate_Msg2(module_id_t module_idP,
|
|||||||
T_BUFFER(&cc[CC_id].RAR_pdu.payload[0], tx_req->TLVs[0].length));
|
T_BUFFER(&cc[CC_id].RAR_pdu.payload[0], tx_req->TLVs[0].length));
|
||||||
|
|
||||||
/* mark the corresponding RBs as used */
|
/* mark the corresponding RBs as used */
|
||||||
uint8_t *vrb_map = cc[CC_id].vrb_map;
|
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||||
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++)
|
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++)
|
||||||
vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1;
|
vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
extern uint8_t SSB_Table[38];
|
extern uint8_t SSB_Table[38];
|
||||||
|
|
||||||
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, uint8_t slots_per_frame){
|
||||||
|
|
||||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||||
NR_COMMON_channels_t *cc;
|
NR_COMMON_channels_t *cc;
|
||||||
@@ -67,32 +67,64 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
|||||||
|
|
||||||
int mib_sdu_length;
|
int mib_sdu_length;
|
||||||
int CC_id;
|
int CC_id;
|
||||||
AssertFatal(slotP == 0, "Subframe must be 0\n");
|
|
||||||
AssertFatal((frameP & 7) == 0, "Frame must be a multiple of 8\n");
|
|
||||||
|
|
||||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||||
|
cc = &gNB->common_channels[CC_id];
|
||||||
|
const long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||||
|
const uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||||
|
int ratio;
|
||||||
|
switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) {
|
||||||
|
case NR_SubcarrierSpacing_kHz15:
|
||||||
|
AssertFatal(band <= 79,
|
||||||
|
"Band %ld is not possible for SSB with 15 kHz SCS\n",
|
||||||
|
band);
|
||||||
|
if (band < 77) // below 3GHz
|
||||||
|
ratio = 3; // NRARFCN step is 5 kHz
|
||||||
|
else
|
||||||
|
ratio = 1; // NRARFCN step is 15 kHz
|
||||||
|
break;
|
||||||
|
case NR_SubcarrierSpacing_kHz30:
|
||||||
|
AssertFatal(band <= 79,
|
||||||
|
"Band %ld is not possible for SSB with 15 kHz SCS\n",
|
||||||
|
band);
|
||||||
|
if (band < 77) // below 3GHz
|
||||||
|
ratio = 6; // NRARFCN step is 5 kHz
|
||||||
|
else
|
||||||
|
ratio = 2; // NRARFCN step is 15 kHz
|
||||||
|
break;
|
||||||
|
case NR_SubcarrierSpacing_kHz120:
|
||||||
|
AssertFatal(band >= 257,
|
||||||
|
"Band %ld is not possible for SSB with 120 kHz SCS\n",
|
||||||
|
band);
|
||||||
|
ratio = 2; // NRARFCN step is 15 kHz
|
||||||
|
break;
|
||||||
|
case NR_SubcarrierSpacing_kHz240:
|
||||||
|
AssertFatal(band >= 257,
|
||||||
|
"Band %ld is not possible for SSB with 240 kHz SCS\n",
|
||||||
|
band);
|
||||||
|
ratio = 4; // NRARFCN step is 15 kHz
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",
|
||||||
|
*cc->ServingCellConfigCommon->ssbSubcarrierSpacing);
|
||||||
|
}
|
||||||
|
|
||||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0];
|
// scheduling MIB every 8 frames, PHY repeats it in between
|
||||||
|
if((slotP == 0) && (frameP & 7) == 0) {
|
||||||
dl_tti_request = &gNB->DL_req[CC_id];
|
dl_tti_request = &gNB->DL_req[CC_id];
|
||||||
dl_req = &dl_tti_request->dl_tti_request_body;
|
dl_req = &dl_tti_request->dl_tti_request_body;
|
||||||
cc = &gNB->common_channels[CC_id];
|
|
||||||
#if 0
|
|
||||||
//SSB is transmitted based on SSB periodicity
|
|
||||||
if((frameP % cfg->ssb_table.ssb_period.value) == 0) {
|
|
||||||
uint64_t L_ssb = (((uint64_t) cfg->ssb_table.ssb_mask_list[0].ssb_mask.value)<<32) | cfg->ssb_table.ssb_mask_list[1].ssb_mask.value ;
|
|
||||||
uint32_t ssb_index = -1;
|
|
||||||
for (int i=0; i<2; i++) { // max two SSB per slot
|
|
||||||
ssb_index = i + SSB_Table[slotP]; // computing the ssb_index
|
|
||||||
if ((ssb_index<64) && ((L_ssb >> (63-ssb_index)) & 0x01)) { // generating the ssb only if the bit of L_ssb at current ssb index is 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); // not used in this case
|
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]);
|
||||||
|
|
||||||
LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length);
|
LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length);
|
||||||
|
|
||||||
if (mib_sdu_length > 0) {
|
if (mib_sdu_length > 0) {
|
||||||
|
LOG_D(MAC,
|
||||||
LOG_D(MAC, "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", frameP, slotP, dl_req->nPDUs, mib_sdu_length);
|
"Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n",
|
||||||
|
frameP,
|
||||||
|
slotP,
|
||||||
|
dl_req->nPDUs,
|
||||||
|
mib_sdu_length);
|
||||||
|
|
||||||
if ((frameP & 1023) < 80){
|
if ((frameP & 1023) < 80){
|
||||||
LOG_I(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
|
LOG_I(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
|
||||||
@@ -106,54 +138,77 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
|||||||
AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n");
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId;
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId;
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0;
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0;
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;//ssb_index ;//SSB index for each SSB
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;
|
||||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n");
|
||||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n");
|
||||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n");
|
||||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n",cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count);
|
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n",cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count);
|
||||||
AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n");
|
||||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n");
|
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n");
|
||||||
long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
|
||||||
uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
const nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0];
|
||||||
int ratio;
|
|
||||||
switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) {
|
|
||||||
case NR_SubcarrierSpacing_kHz15:
|
|
||||||
AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band);
|
|
||||||
if (band<77) // below 3GHz
|
|
||||||
ratio=3; // NRARFCN step is 5 kHz
|
|
||||||
else
|
|
||||||
ratio=1; // NRARFCN step is 15 kHz
|
|
||||||
break;
|
|
||||||
case NR_SubcarrierSpacing_kHz30:
|
|
||||||
AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band);
|
|
||||||
if (band<77) // below 3GHz
|
|
||||||
ratio=6; // NRARFCN step is 5 kHz
|
|
||||||
else
|
|
||||||
ratio=2; // NRARFCN step is 15 kHz
|
|
||||||
break;
|
|
||||||
case NR_SubcarrierSpacing_kHz120:
|
|
||||||
AssertFatal(band >= 257, "Band %ld is not possible for SSB with 120 kHz SCS\n",band);
|
|
||||||
ratio=2; // NRARFCN step is 15 kHz
|
|
||||||
break;
|
|
||||||
case NR_SubcarrierSpacing_kHz240:
|
|
||||||
AssertFatal(band >= 257, "Band %ld is not possible for SSB with 240 kHz SCS\n",band);
|
|
||||||
ratio=4; // NRARFCN step is 15 kHz
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
AssertFatal(1==0,"SCS %ld not allowed for SSB \n", *cc->ServingCellConfigCommon->ssbSubcarrierSpacing);
|
|
||||||
}
|
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; //kSSB
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; //kSSB
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10;/*cfg->ssb_table.ssb_offset_point_a.value;*/ // absoluteFrequencySSB is the center of SSB
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1;
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1;
|
||||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1);
|
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1);
|
||||||
dl_req->nPDUs++;
|
dl_req->nPDUs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *vrb_map = cc[CC_id].vrb_map;
|
// checking if there is any SSB in slot
|
||||||
const int rbStart = dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA;
|
const int abs_slot = (slots_per_frame * frameP) + slotP;
|
||||||
|
const int slot_per_period = (slots_per_frame>>1)<<(*cc->ServingCellConfigCommon->ssb_periodicityServingCell);
|
||||||
|
int eff_120_slot;
|
||||||
|
const BIT_STRING_t *mediumBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap;
|
||||||
|
uint8_t buf = 0;
|
||||||
|
switch (cc->ServingCellConfigCommon->ssb_PositionsInBurst->present) {
|
||||||
|
case 1:
|
||||||
|
// presence of ssbs possible in the first 2 slots of ssb period
|
||||||
|
if ((abs_slot % slot_per_period) < 2 &&
|
||||||
|
(((mediumBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0)
|
||||||
|
fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// presence of ssbs possible in the first 4 slots of ssb period
|
||||||
|
if ((abs_slot % slot_per_period) < 4 &&
|
||||||
|
(((mediumBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0)
|
||||||
|
fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing ==
|
||||||
|
NR_SubcarrierSpacing_kHz120,
|
||||||
|
"240kHZ subcarrier spacing currently not supported for SSBs\n");
|
||||||
|
if ((abs_slot % slot_per_period) < 8) {
|
||||||
|
eff_120_slot = slotP;
|
||||||
|
buf = mediumBitmap->buf[0];
|
||||||
|
} else if ((abs_slot % slot_per_period) < 17) {
|
||||||
|
eff_120_slot = slotP - 9;
|
||||||
|
buf = mediumBitmap->buf[1];
|
||||||
|
} else if ((abs_slot % slot_per_period) < 26) {
|
||||||
|
eff_120_slot = slotP - 18;
|
||||||
|
buf = mediumBitmap->buf[2];
|
||||||
|
} else if ((abs_slot % slot_per_period) < 35) {
|
||||||
|
eff_120_slot = slotP - 27;
|
||||||
|
buf = mediumBitmap->buf[3];
|
||||||
|
}
|
||||||
|
if (((buf >> (6 - (eff_120_slot << 1))) & 3) != 0)
|
||||||
|
fill_ssb_vrb_map(cc, ssb_offset0 / (ratio * 12) - 10, CC_id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(0,
|
||||||
|
"SSB bitmap size value %d undefined (allowed values 1,2,3)\n",
|
||||||
|
cc->ServingCellConfigCommon->ssb_PositionsInBurst->present);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
|
||||||
|
//----------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) {
|
||||||
|
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||||
for (int rb = 0; rb < 20; rb++)
|
for (int rb = 0; rb < 20; rb++)
|
||||||
vrb_map[rbStart + rb] = 1;
|
vrb_map[rbStart + rb] = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -483,7 +483,6 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
|||||||
const int CC_id = 0;
|
const int CC_id = 0;
|
||||||
|
|
||||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
sched_ctrl->rbSize = 0;
|
|
||||||
|
|
||||||
/* Retrieve amount of data to send for this UE */
|
/* Retrieve amount of data to send for this UE */
|
||||||
sched_ctrl->num_total_bytes = 0;
|
sched_ctrl->num_total_bytes = 0;
|
||||||
@@ -500,7 +499,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
||||||
if (sched_ctrl->num_total_bytes == 0 && !get_softmodem_params()->phy_test)
|
if (sched_ctrl->num_total_bytes == 0
|
||||||
|
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
|
||||||
return;
|
return;
|
||||||
LOG_D(MAC,
|
LOG_D(MAC,
|
||||||
"%d.%d, DTCH%d->DLSCH, RLC status %d bytes\n",
|
"%d.%d, DTCH%d->DLSCH, RLC status %d bytes\n",
|
||||||
@@ -545,7 +545,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
|||||||
|
|
||||||
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
|
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
|
||||||
|
|
||||||
uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||||
const int current_harq_pid = sched_ctrl->current_harq_pid;
|
const int current_harq_pid = sched_ctrl->current_harq_pid;
|
||||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||||
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
|
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
|
||||||
@@ -625,18 +625,26 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
frame_t frame,
|
frame_t frame,
|
||||||
sub_frame_t slot,
|
sub_frame_t slot,
|
||||||
int num_slots_per_tdd) {
|
int num_slots_per_tdd) {
|
||||||
/* PREPROCESSOR */
|
|
||||||
nr_simple_dlsch_preprocessor(module_id, frame, slot, num_slots_per_tdd);
|
|
||||||
|
|
||||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
|
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
|
||||||
|
|
||||||
|
/* PREPROCESSOR */
|
||||||
|
gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd);
|
||||||
|
|
||||||
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
|
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
|
||||||
|
|
||||||
const int CC_id = 0;
|
const int CC_id = 0;
|
||||||
|
|
||||||
NR_UE_list_t *UE_list = &UE_info->list;
|
NR_UE_list_t *UE_list = &UE_info->list;
|
||||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
if (sched_ctrl->rbSize <= 0 && !get_softmodem_params()->phy_test)
|
|
||||||
|
/* update TA and set ta_apply every 10 frames.
|
||||||
|
* Possible improvement: take the periodicity from input file.
|
||||||
|
* If such UE is not scheduled now, it will be by the preprocessor later.
|
||||||
|
* If we add the CE, ta_apply will be reset */
|
||||||
|
if (frame >= (sched_ctrl->ta_frame + 10) % 1023)
|
||||||
|
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
|
||||||
|
|
||||||
|
if (sched_ctrl->rbSize <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const rnti_t rnti = UE_info->rnti[UE_id];
|
const rnti_t rnti = UE_info->rnti[UE_id];
|
||||||
@@ -677,27 +685,17 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
||||||
nr_fill_nfapi_dl_pdu(module_id,
|
nr_fill_nfapi_dl_pdu(module_id,
|
||||||
UE_id,
|
|
||||||
sched_ctrl->active_bwp->bwp_Id,
|
|
||||||
sched_ctrl->search_space,
|
|
||||||
sched_ctrl->coreset,
|
|
||||||
dl_req,
|
dl_req,
|
||||||
|
rnti,
|
||||||
|
UE_info->secondaryCellGroup[UE_id],
|
||||||
|
sched_ctrl,
|
||||||
pucch,
|
pucch,
|
||||||
1 /* nrOfLayers */,
|
|
||||||
sched_ctrl->mcs,
|
|
||||||
sched_ctrl->rbSize,
|
|
||||||
sched_ctrl->rbStart,
|
|
||||||
sched_ctrl->numDmrsCdmGrpsNoData,
|
|
||||||
getDmrsConfigType(sched_ctrl->active_bwp),
|
getDmrsConfigType(sched_ctrl->active_bwp),
|
||||||
sched_ctrl->mcsTableIdx,
|
|
||||||
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
TBS,
|
TBS,
|
||||||
sched_ctrl->time_domain_allocation,
|
|
||||||
startSymbolIndex,
|
startSymbolIndex,
|
||||||
nrOfSymbols,
|
nrOfSymbols,
|
||||||
sched_ctrl->aggregation_level,
|
|
||||||
sched_ctrl->cce_index,
|
|
||||||
current_harq_pid,
|
current_harq_pid,
|
||||||
harq->ndi,
|
harq->ndi,
|
||||||
harq->round);
|
harq->round);
|
||||||
@@ -734,7 +732,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
* nr_generate_dlsch_pdu() checks for ta_apply and add TA CE if necessary */
|
* nr_generate_dlsch_pdu() checks for ta_apply and add TA CE if necessary */
|
||||||
const int ta_len = (sched_ctrl->ta_apply) ? 2 : 0;
|
const int ta_len = (sched_ctrl->ta_apply) ? 2 : 0;
|
||||||
|
|
||||||
/* Get RLC data TODO: remove random data retrieval */
|
/* Get RLC data */
|
||||||
int header_length_total = 0;
|
int header_length_total = 0;
|
||||||
int header_length_last = 0;
|
int header_length_last = 0;
|
||||||
int sdu_length_total = 0;
|
int sdu_length_total = 0;
|
||||||
@@ -776,10 +774,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
sdu_length_total += sdu_lengths[num_sdus];
|
sdu_length_total += sdu_lengths[num_sdus];
|
||||||
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
|
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
|
||||||
header_length_total += header_length_last;
|
header_length_total += header_length_last;
|
||||||
|
|
||||||
num_sdus++;
|
num_sdus++;
|
||||||
|
|
||||||
//ue_sched_ctl->uplane_inactivity_timer = 0;
|
|
||||||
}
|
}
|
||||||
else if (get_softmodem_params()->phy_test) {
|
else if (get_softmodem_params()->phy_test) {
|
||||||
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
|
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
|
||||||
@@ -796,10 +791,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
|
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
|
||||||
UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += sdu_length_total;
|
UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += sdu_length_total;
|
||||||
|
|
||||||
// Check if there is data from RLC or CE
|
|
||||||
const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len;
|
const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len;
|
||||||
// padding param currently not in use
|
|
||||||
//padding = TBS - header_length_total - sdu_length_total - ta_len - 1;
|
|
||||||
|
|
||||||
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
|
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
|
||||||
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
|
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
|
||||||
@@ -840,6 +832,17 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
retInfo->mcs = sched_ctrl->mcs;
|
retInfo->mcs = sched_ctrl->mcs;
|
||||||
retInfo->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData;
|
retInfo->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData;
|
||||||
|
|
||||||
|
// ta command is sent, values are reset
|
||||||
|
if (sched_ctrl->ta_apply) {
|
||||||
|
sched_ctrl->ta_apply = false;
|
||||||
|
sched_ctrl->ta_frame = frame;
|
||||||
|
LOG_D(MAC,
|
||||||
|
"%d.%2d UE %d TA scheduled, resetting TA frame\n",
|
||||||
|
frame,
|
||||||
|
slot,
|
||||||
|
UE_id);
|
||||||
|
}
|
||||||
|
|
||||||
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
|
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
|
||||||
T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(buf, TBS));
|
T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(buf, TBS));
|
||||||
|
|
||||||
@@ -855,5 +858,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* mark UE as scheduled */
|
||||||
|
sched_ctrl->rbSize = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,239 +252,104 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int configure_fapi_dl_pdu_phytest(int Mod_idP,
|
/* schedules whole bandwidth for first user, all the time */
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
void nr_preprocessor_phytest(module_id_t module_id,
|
||||||
NR_sched_pucch *pucch_sched,
|
frame_t frame,
|
||||||
uint8_t *mcsIndex,
|
sub_frame_t slot,
|
||||||
uint16_t *rbSize,
|
int num_slots_per_tdd)
|
||||||
uint16_t *rbStart) {
|
{
|
||||||
gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP];
|
if (slot != 1)
|
||||||
NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
return; /* only schedule in slot 1 for now */
|
||||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||||
|
const int UE_id = 0;
|
||||||
|
const int CC_id = 0;
|
||||||
|
AssertFatal(UE_info->active[UE_id],
|
||||||
|
"%s(): expected UE %d to be active\n",
|
||||||
|
__func__,
|
||||||
|
UE_id);
|
||||||
|
|
||||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu;
|
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu;
|
/* find largest unallocated chunk */
|
||||||
|
const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||||
int TBS;
|
int rbStart = 0;
|
||||||
int bwp_id=1;
|
int tStart = 0;
|
||||||
int UE_id = 0;
|
int rbSize = 0;
|
||||||
|
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
/* find largest unallocated RB region */
|
||||||
|
do {
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
|
/* advance to first free RB */
|
||||||
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
while (tStart < bwpSize && vrb_map[tStart])
|
||||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
tStart++;
|
||||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
/* find maximum rbSize at current rbStart */
|
||||||
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
int tSize = 1;
|
||||||
|
while (tStart + tSize < bwpSize && !vrb_map[tStart + tSize])
|
||||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
tSize++;
|
||||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
if (tSize > rbSize) {
|
||||||
"searchPsacesToAddModList is empty\n");
|
rbStart = tStart;
|
||||||
|
rbSize = tSize;
|
||||||
dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
|
||||||
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
|
||||||
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
|
|
||||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
|
||||||
|
|
||||||
dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
|
|
||||||
memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
|
||||||
dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE;
|
|
||||||
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
|
||||||
|
|
||||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
|
||||||
|
|
||||||
|
|
||||||
pdsch_pdu_rel15->pduBitmap = 0;
|
|
||||||
pdsch_pdu_rel15->rnti = UE_info->rnti[UE_id];
|
|
||||||
pdsch_pdu_rel15->pduIndex = 0;
|
|
||||||
|
|
||||||
// BWP
|
|
||||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
|
||||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
|
||||||
pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
|
||||||
if (bwp->bwp_Common->genericParameters.cyclicPrefix) pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
|
||||||
else pdsch_pdu_rel15->CyclicPrefix=0;
|
|
||||||
|
|
||||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
|
||||||
int mcs = (mcsIndex!=NULL) ? *mcsIndex : 9;
|
|
||||||
int current_harq_pid = UE_info->UE_sched_ctrl[UE_id].current_harq_pid;
|
|
||||||
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcs,0);
|
|
||||||
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
|
||||||
pdsch_pdu_rel15->mcsIndex[0] = mcs;
|
|
||||||
pdsch_pdu_rel15->mcsTable[0] = 0;
|
|
||||||
pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round];
|
|
||||||
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
|
||||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
|
||||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
|
||||||
pdsch_pdu_rel15->refPoint = 0; // Point A
|
|
||||||
UE_info->mac_stats[UE_id].dlsch_rounds[UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round]++;
|
|
||||||
pdsch_pdu_rel15->dmrsConfigType = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
|
||||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
|
||||||
pdsch_pdu_rel15->SCID = 0;
|
|
||||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 1;
|
|
||||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
|
||||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
|
||||||
pdsch_pdu_rel15->rbStart = (rbStart!=NULL) ? *rbStart : 0;
|
|
||||||
pdsch_pdu_rel15->rbSize = (rbSize!=NULL) ? *rbSize : pdsch_pdu_rel15->BWPSize;
|
|
||||||
pdsch_pdu_rel15->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
|
|
||||||
|
|
||||||
int startSymbolAndLength=0;
|
|
||||||
int time_domain_assignment=2;
|
|
||||||
int StartSymbolIndex,NrOfSymbols;
|
|
||||||
|
|
||||||
AssertFatal(time_domain_assignment<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count,"time_domain_assignment %d>=%d\n",time_domain_assignment,bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count);
|
|
||||||
startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
|
||||||
SLIV2SL(startSymbolAndLength,&StartSymbolIndex,&NrOfSymbols);
|
|
||||||
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
|
||||||
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
|
||||||
|
|
||||||
// k0 = *bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
|
|
||||||
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
|
||||||
scc->dmrs_TypeA_Position,
|
|
||||||
pdsch_pdu_rel15->NrOfSymbols);
|
|
||||||
|
|
||||||
dci_pdu_rel15_t *dci_pdu_rel15 = calloc(MAX_DCI_CORESET,sizeof(dci_pdu_rel15_t));
|
|
||||||
|
|
||||||
// bwp indicator
|
|
||||||
int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
|
||||||
if (n_dl_bwp < 4)
|
|
||||||
dci_pdu_rel15[0].bwp_indicator.val = bwp_id;
|
|
||||||
else
|
|
||||||
dci_pdu_rel15[0].bwp_indicator.val = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212
|
|
||||||
// frequency domain assignment
|
|
||||||
if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation==NR_PDSCH_Config__resourceAllocation_resourceAllocationType1)
|
|
||||||
dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
|
||||||
pdsch_pdu_rel15->rbStart,
|
|
||||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275));
|
|
||||||
else
|
|
||||||
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
|
|
||||||
// time domain assignment
|
|
||||||
dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment; // row index used here instead of SLIV;
|
|
||||||
// mcs and rv
|
|
||||||
dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0];
|
|
||||||
dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0];
|
|
||||||
// harq pid and ndi
|
|
||||||
dci_pdu_rel15[0].harq_pid = current_harq_pid;
|
|
||||||
dci_pdu_rel15[0].ndi = UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].ndi;
|
|
||||||
// DAI
|
|
||||||
dci_pdu_rel15[0].dai[0].val = (pucch_sched->dai_c-1)&3;
|
|
||||||
// TPC for PUCCH
|
|
||||||
dci_pdu_rel15[0].tpc = UE_info->UE_sched_ctrl[UE_id].tpc1; // table 7.2.1-1 in 38.213
|
|
||||||
// PUCCH resource indicator
|
|
||||||
dci_pdu_rel15[0].pucch_resource_indicator = pucch_sched->resource_indicator;
|
|
||||||
// PDSCH to HARQ TI
|
|
||||||
dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = pucch_sched->timing_indicator;
|
|
||||||
UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].feedback_slot = pucch_sched->ul_slot;
|
|
||||||
UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].is_waiting = 1;
|
|
||||||
// antenna ports
|
|
||||||
dci_pdu_rel15[0].antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0
|
|
||||||
// dmrs sequence initialization
|
|
||||||
dci_pdu_rel15[0].dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID;
|
|
||||||
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
|
||||||
dci_pdu_rel15[0].frequency_domain_assignment.val,
|
|
||||||
pdsch_pdu_rel15->rbStart,
|
|
||||||
pdsch_pdu_rel15->rbSize,
|
|
||||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
|
||||||
dci_pdu_rel15[0].time_domain_assignment.val,
|
|
||||||
dci_pdu_rel15[0].vrb_to_prb_mapping.val,
|
|
||||||
dci_pdu_rel15[0].mcs,
|
|
||||||
dci_pdu_rel15[0].tb_scaling,
|
|
||||||
dci_pdu_rel15[0].ndi,
|
|
||||||
dci_pdu_rel15[0].rv);
|
|
||||||
|
|
||||||
NR_SearchSpace_t *ss;
|
|
||||||
int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
|
||||||
|
|
||||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
|
||||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
|
||||||
"searchPsacesToAddModList is empty\n");
|
|
||||||
|
|
||||||
int found=0;
|
|
||||||
|
|
||||||
for (int i=0;i<bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) {
|
|
||||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i];
|
|
||||||
AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n");
|
|
||||||
AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n");
|
|
||||||
if (ss->searchSpaceType->present == target_ss) {
|
|
||||||
found=1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
tStart += tSize;
|
||||||
AssertFatal(found==1,"Couldn't find an adequate searchspace\n");
|
} while (tStart < bwpSize);
|
||||||
|
|
||||||
uint8_t nr_of_candidates, aggregation_level;
|
sched_ctrl->num_total_bytes = 0;
|
||||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
|
const int lcid = DL_SCH_LCID_DTCH;
|
||||||
NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 1 /* dedicated */);
|
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||||
const int cid = coreset->controlResourceSetId;
|
/* update sched_ctrl->num_total_bytes so that postprocessor schedules data,
|
||||||
const uint16_t Y = UE_info->Y[UE_id][cid][nr_mac->current_slot];
|
* if available */
|
||||||
|
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
|
||||||
|
rnti,
|
||||||
|
module_id,
|
||||||
|
frame,
|
||||||
|
slot,
|
||||||
|
ENB_FLAG_YES,
|
||||||
|
MBMS_FLAG_NO,
|
||||||
|
lcid,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
||||||
|
|
||||||
|
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||||
|
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss);
|
||||||
|
uint8_t nr_of_candidates;
|
||||||
|
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||||
|
&nr_of_candidates,
|
||||||
|
sched_ctrl->search_space);
|
||||||
|
sched_ctrl->coreset = get_coreset(
|
||||||
|
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||||
|
const int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||||
|
const uint16_t Y = UE_info->Y[UE_id][cid][RC.nrmac[module_id]->current_slot];
|
||||||
const int m = UE_info->num_pdcch_cand[UE_id][cid];
|
const int m = UE_info->num_pdcch_cand[UE_id][cid];
|
||||||
int CCEIndex = allocate_nr_CCEs(nr_mac,
|
sched_ctrl->cce_index = allocate_nr_CCEs(RC.nrmac[module_id],
|
||||||
bwp,
|
sched_ctrl->active_bwp,
|
||||||
coreset,
|
sched_ctrl->coreset,
|
||||||
aggregation_level,
|
sched_ctrl->aggregation_level,
|
||||||
Y,
|
Y,
|
||||||
m,
|
m,
|
||||||
nr_of_candidates);
|
nr_of_candidates);
|
||||||
if (CCEIndex < 0) {
|
AssertFatal(sched_ctrl->cce_index >= 0,
|
||||||
LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PDSCH\n", __func__);
|
"%s(): could not find CCE for UE %d\n",
|
||||||
free(dci_pdu_rel15);
|
__func__,
|
||||||
return 0;
|
UE_id);
|
||||||
}
|
|
||||||
UE_info->num_pdcch_cand[UE_id][cid]++;
|
|
||||||
|
|
||||||
nr_configure_pdcch(nr_mac,
|
nr_acknack_scheduling(module_id,
|
||||||
pdcch_pdu_rel15,
|
UE_id,
|
||||||
UE_info->rnti[UE_id],
|
frame,
|
||||||
ss,
|
slot,
|
||||||
coreset,
|
num_slots_per_tdd,
|
||||||
scc,
|
&sched_ctrl->pucch_sched_idx,
|
||||||
bwp,
|
&sched_ctrl->pucch_occ_idx);
|
||||||
aggregation_level,
|
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
|
||||||
CCEIndex);
|
|
||||||
|
|
||||||
int dci_formats[2];
|
sched_ctrl->rbStart = rbStart;
|
||||||
int rnti_types[2];
|
sched_ctrl->rbSize = rbSize;
|
||||||
|
sched_ctrl->time_domain_allocation = 2;
|
||||||
|
sched_ctrl->mcsTableIdx = 0;
|
||||||
|
sched_ctrl->mcs = 9;
|
||||||
|
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||||
|
|
||||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats)
|
/* mark the corresponding RBs as used */
|
||||||
dci_formats[0] = NR_DL_DCI_FORMAT_1_1;
|
for (int rb = 0; rb < sched_ctrl->rbSize; rb++)
|
||||||
else
|
vrb_map[rb + sched_ctrl->rbStart] = 1;
|
||||||
dci_formats[0] = NR_DL_DCI_FORMAT_1_0;
|
|
||||||
|
|
||||||
rnti_types[0] = NR_RNTI_C;
|
|
||||||
|
|
||||||
fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,bwp_id);
|
|
||||||
|
|
||||||
LOG_D(MAC, "DCI params: rnti %x, rnti_type %d, dci_format %d\n \
|
|
||||||
coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
|
||||||
pdcch_pdu_rel15->dci_pdu.RNTI[0],
|
|
||||||
rnti_types[0],
|
|
||||||
dci_formats[0],
|
|
||||||
(unsigned long long)pdcch_pdu_rel15->FreqDomainResource,
|
|
||||||
pdcch_pdu_rel15->StartSymbolIndex,
|
|
||||||
pdcch_pdu_rel15->DurationSymbols);
|
|
||||||
|
|
||||||
int x_Overhead = 0; // should be 0 for initialBWP
|
|
||||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu,x_Overhead,pdsch_pdu_rel15->numDmrsCdmGrpsNoData,0);
|
|
||||||
|
|
||||||
// Hardcode it for now
|
|
||||||
TBS = dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15.TBSize[0];
|
|
||||||
if (UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round==0)
|
|
||||||
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
|
|
||||||
|
|
||||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d startSymbolAndLength %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
|
|
||||||
pdsch_pdu_rel15->rbStart,
|
|
||||||
pdsch_pdu_rel15->rbSize,
|
|
||||||
startSymbolAndLength,
|
|
||||||
pdsch_pdu_rel15->StartSymbolIndex,
|
|
||||||
pdsch_pdu_rel15->NrOfSymbols,
|
|
||||||
pdsch_pdu_rel15->nrOfLayers,
|
|
||||||
pdsch_pdu_rel15->NrOfCodewords,
|
|
||||||
pdsch_pdu_rel15->mcsIndex[0],
|
|
||||||
TBS);
|
|
||||||
|
|
||||||
free(dci_pdu_rel15);
|
|
||||||
return TBS; //Return TBS in bytes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_uldci(NR_BWP_Uplink_t *ubwp,
|
void config_uldci(NR_BWP_Uplink_t *ubwp,
|
||||||
@@ -563,231 +428,6 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void configure_fapi_dl_Tx(module_id_t Mod_idP,
|
|
||||||
frame_t frameP,
|
|
||||||
sub_frame_t slotP,
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
|
||||||
nfapi_nr_pdu_t *tx_req,
|
|
||||||
int tbs_bytes,
|
|
||||||
int16_t pdu_index){
|
|
||||||
|
|
||||||
int CC_id = 0;
|
|
||||||
|
|
||||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
|
||||||
gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP];
|
|
||||||
|
|
||||||
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS (bytes): %d\n",
|
|
||||||
pdsch_pdu_rel15->rbStart,
|
|
||||||
pdsch_pdu_rel15->rbSize,
|
|
||||||
pdsch_pdu_rel15->StartSymbolIndex,
|
|
||||||
pdsch_pdu_rel15->NrOfSymbols,
|
|
||||||
pdsch_pdu_rel15->nrOfLayers,
|
|
||||||
pdsch_pdu_rel15->NrOfCodewords,
|
|
||||||
pdsch_pdu_rel15->mcsIndex[0],
|
|
||||||
tbs_bytes);
|
|
||||||
|
|
||||||
dl_req->nPDUs+=2;
|
|
||||||
|
|
||||||
tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0];
|
|
||||||
tx_req->PDU_index = nr_mac->pdu_index[0]++;
|
|
||||||
tx_req->num_TLV = 1;
|
|
||||||
tx_req->TLVs[0].length = tbs_bytes +2;
|
|
||||||
|
|
||||||
memcpy((void*)&tx_req->TLVs[0].value.direct[0], (void*)&nr_mac->UE_info.DLSCH_pdu[0][0].payload[0], tbs_bytes);
|
|
||||||
|
|
||||||
nr_mac->TX_req[CC_id].Number_of_PDUs++;
|
|
||||||
nr_mac->TX_req[CC_id].SFN = frameP;
|
|
||||||
nr_mac->TX_req[CC_id].Slot = slotP;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
|
||||||
frame_t frameP,
|
|
||||||
sub_frame_t slotP,
|
|
||||||
NR_sched_pucch *pucch_sched,
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dlsch_config){
|
|
||||||
|
|
||||||
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest frame %d slot %d\n",frameP,slotP);
|
|
||||||
|
|
||||||
int post_padding = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0;
|
|
||||||
int lcid, offset, i, header_length_last, TBS_bytes = 0;
|
|
||||||
int UE_id = 0, CC_id = 0;
|
|
||||||
|
|
||||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
|
|
||||||
//NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
|
||||||
//NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon;
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
|
||||||
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[gNB_mac->TX_req[CC_id].Number_of_PDUs];
|
|
||||||
|
|
||||||
mac_rlc_status_resp_t rlc_status;
|
|
||||||
|
|
||||||
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
|
|
||||||
|
|
||||||
if (UE_info->num_UEs ==0) return;
|
|
||||||
|
|
||||||
unsigned char sdu_lcids[NB_RB_MAX] = {0};
|
|
||||||
uint16_t sdu_lengths[NB_RB_MAX] = {0};
|
|
||||||
uint16_t rnti = UE_info->rnti[UE_id];
|
|
||||||
NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_info->UE_sched_ctrl[UE_id];
|
|
||||||
|
|
||||||
uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
|
||||||
|
|
||||||
LOG_D(MAC, "Scheduling UE specific search space DCI type 1\n");
|
|
||||||
|
|
||||||
int ta_len = (ue_sched_ctl->ta_apply)?2:0;
|
|
||||||
|
|
||||||
TBS_bytes = configure_fapi_dl_pdu_phytest(
|
|
||||||
module_idP,
|
|
||||||
dl_req,
|
|
||||||
pucch_sched,
|
|
||||||
dlsch_config != NULL ? dlsch_config->mcsIndex : NULL,
|
|
||||||
dlsch_config != NULL ? &dlsch_config->rbSize : NULL,
|
|
||||||
dlsch_config != NULL ? &dlsch_config->rbStart : NULL);
|
|
||||||
|
|
||||||
if (TBS_bytes == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lcid = DL_SCH_LCID_DTCH;
|
|
||||||
|
|
||||||
//for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
|
|
||||||
|
|
||||||
// TODO: check if the lcid is active
|
|
||||||
|
|
||||||
LOG_D(MAC, "[gNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (TBS %d bytes, len %d)\n",
|
|
||||||
module_idP, frameP, lcid, TBS_bytes, TBS_bytes - ta_len - header_length_total - sdu_length_total - 3);
|
|
||||||
|
|
||||||
//if (TBS_bytes - ta_len - header_length_total - sdu_length_total - 3 > 0) {
|
|
||||||
rlc_status = mac_rlc_status_ind(module_idP,
|
|
||||||
rnti,
|
|
||||||
module_idP,
|
|
||||||
frameP,
|
|
||||||
slotP,
|
|
||||||
ENB_FLAG_YES,
|
|
||||||
MBMS_FLAG_NO,
|
|
||||||
lcid,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if (rlc_status.bytes_in_buffer > 0) {
|
|
||||||
|
|
||||||
LOG_I(MAC, "configure fapi due to data availability \n");
|
|
||||||
|
|
||||||
LOG_I(MAC, "[gNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d), TBS_bytes: %d \n \n",
|
|
||||||
module_idP, frameP, TBS_bytes - ta_len - header_length_total - sdu_length_total - 3,
|
|
||||||
lcid, header_length_total, TBS_bytes);
|
|
||||||
|
|
||||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
|
|
||||||
rnti,
|
|
||||||
module_idP,
|
|
||||||
frameP,
|
|
||||||
ENB_FLAG_YES,
|
|
||||||
MBMS_FLAG_NO,
|
|
||||||
lcid,
|
|
||||||
TBS_bytes - ta_len - header_length_total - sdu_length_total - 3,
|
|
||||||
(char *)&mac_sdus[sdu_length_total],
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
LOG_W(MAC, "[gNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", module_idP, sdu_lengths[num_sdus], lcid);
|
|
||||||
|
|
||||||
sdu_lcids[num_sdus] = lcid;
|
|
||||||
sdu_length_total += sdu_lengths[num_sdus];
|
|
||||||
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
|
|
||||||
header_length_total += header_length_last;
|
|
||||||
|
|
||||||
num_sdus++;
|
|
||||||
|
|
||||||
//ue_sched_ctl->uplane_inactivity_timer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
|
|
||||||
LOG_D(MAC,"Configuring DL_TX in %d.%d\n", frameP, slotP);
|
|
||||||
|
|
||||||
// fill dlsch_buffer with random data
|
|
||||||
for (i = 0; i < TBS_bytes; i++){
|
|
||||||
mac_sdus[i] = (unsigned char) (lrand48()&0xff);
|
|
||||||
//((uint8_t *)gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) (lrand48()&0xff);
|
|
||||||
}
|
|
||||||
//Sending SDUs with size 1
|
|
||||||
//Initialize elements of sdu_lcids and sdu_lengths
|
|
||||||
sdu_lcids[0] = 0x3f; // DRB
|
|
||||||
sdu_lengths[0] = TBS_bytes - ta_len - 3;
|
|
||||||
header_length_total += 2 + (sdu_lengths[0] >= 128);
|
|
||||||
sdu_length_total += sdu_lengths[0];
|
|
||||||
num_sdus +=1;
|
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
|
||||||
if (frameP%100 == 0){
|
|
||||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
|
|
||||||
for(int i = 0; i < 10; i++) {
|
|
||||||
LOG_I(MAC, "%x. ", ((uint8_t *)gNB_mac->UE_info.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += sdu_length_total;
|
|
||||||
|
|
||||||
// there is at least one SDU or TA command
|
|
||||||
// if (num_sdus > 0 ){
|
|
||||||
if (ta_len + sdu_length_total + header_length_total > 0) {
|
|
||||||
|
|
||||||
// Check if there is data from RLC or CE
|
|
||||||
if (TBS_bytes >= 2 + header_length_total + sdu_length_total + ta_len) {
|
|
||||||
// we have to consider padding
|
|
||||||
// padding param currently not in use
|
|
||||||
//padding = TBS_bytes - header_length_total - sdu_length_total - ta_len - 1;
|
|
||||||
post_padding = 1;
|
|
||||||
} else {
|
|
||||||
//padding = 0;
|
|
||||||
post_padding = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = nr_generate_dlsch_pdu(module_idP,
|
|
||||||
&UE_info->UE_sched_ctrl[UE_id],
|
|
||||||
(unsigned char *) mac_sdus,
|
|
||||||
(unsigned char *) gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0],
|
|
||||||
num_sdus, //num_sdus
|
|
||||||
sdu_lengths,
|
|
||||||
sdu_lcids,
|
|
||||||
255, // no drx
|
|
||||||
NULL, // contention res id
|
|
||||||
post_padding);
|
|
||||||
|
|
||||||
// Padding: fill remainder of DLSCH with 0
|
|
||||||
if (post_padding > 0){
|
|
||||||
for (int j = 0; j < (TBS_bytes - offset); j++)
|
|
||||||
gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0][offset + j] = 0; // mac_pdu[offset + j] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_fapi_dl_Tx(module_idP, frameP, slotP, dl_req, tx_req, TBS_bytes, gNB_mac->pdu_index[CC_id]);
|
|
||||||
|
|
||||||
if(IS_SOFTMODEM_NOS1){
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
|
||||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n \n", frameP, slotP, TBS_bytes);
|
|
||||||
for(int i = 0; i < 10; i++) { // TBS_bytes dlsch_pdu_rel15->transport_block_size/8 6784/8
|
|
||||||
LOG_I(MAC, "%x. ", mac_payload[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
|
||||||
if (frameP%100 == 0){
|
|
||||||
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
|
|
||||||
for(int i = 0; i < 10; i++) {
|
|
||||||
LOG_I(MAC, "byte %d : %x\n", i,((uint8_t *)gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0])[i]); //LOG_I(MAC, "%x. ", mac_payload[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // There is no data from RLC or MAC header, so don't schedule
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int8_t select_ul_harq_pid(NR_UE_sched_ctrl_t *sched_ctrl) {
|
int8_t select_ul_harq_pid(NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||||
|
|
||||||
uint8_t hrq_id;
|
uint8_t hrq_id;
|
||||||
@@ -979,7 +619,7 @@ void schedule_fapi_ul_pdu(int Mod_idP,
|
|||||||
pusch_pdu->resource_alloc = 1; //type 1
|
pusch_pdu->resource_alloc = 1; //type 1
|
||||||
pusch_pdu->rb_start = 0;
|
pusch_pdu->rb_start = 0;
|
||||||
if (get_softmodem_params()->phy_test==1)
|
if (get_softmodem_params()->phy_test==1)
|
||||||
pusch_pdu->rb_size = 50;
|
pusch_pdu->rb_size = min(pusch_pdu->bwp_size,50);
|
||||||
else
|
else
|
||||||
pusch_pdu->rb_size = pusch_pdu->bwp_size;
|
pusch_pdu->rb_size = pusch_pdu->bwp_size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,27 +432,17 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
||||||
int UE_id,
|
|
||||||
int bwp_id,
|
|
||||||
NR_SearchSpace_t *ss,
|
|
||||||
NR_ControlResourceSet_t *coreset,
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||||
|
rnti_t rnti,
|
||||||
|
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||||
|
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||||
NR_sched_pucch *pucch_sched,
|
NR_sched_pucch *pucch_sched,
|
||||||
int nrOfLayers,
|
|
||||||
uint8_t mcs,
|
|
||||||
uint16_t rbSize,
|
|
||||||
uint16_t rbStart,
|
|
||||||
uint8_t numDmrsCdmGrpsNoData,
|
|
||||||
nfapi_nr_dmrs_type_e dmrsConfigType,
|
nfapi_nr_dmrs_type_e dmrsConfigType,
|
||||||
uint8_t table_idx,
|
|
||||||
uint16_t R,
|
uint16_t R,
|
||||||
uint8_t Qm,
|
uint8_t Qm,
|
||||||
uint32_t TBS,
|
uint32_t TBS,
|
||||||
int time_domain_assignment,
|
|
||||||
int StartSymbolIndex,
|
int StartSymbolIndex,
|
||||||
int NrOfSymbols,
|
int NrOfSymbols,
|
||||||
uint8_t aggregation_level,
|
|
||||||
int CCEIndex,
|
|
||||||
int harq_pid,
|
int harq_pid,
|
||||||
int ndi,
|
int ndi,
|
||||||
int round) {
|
int round) {
|
||||||
@@ -460,9 +450,10 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||||
|
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
const int bwp_id = sched_ctrl->active_bwp->bwp_Id;
|
||||||
|
const int nrOfLayers = 1;
|
||||||
|
const int mcs = sched_ctrl->mcs;
|
||||||
|
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
|
|
||||||
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
|
||||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
|
||||||
@@ -487,7 +478,7 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
|
|
||||||
|
|
||||||
pdsch_pdu_rel15->pduBitmap = 0;
|
pdsch_pdu_rel15->pduBitmap = 0;
|
||||||
pdsch_pdu_rel15->rnti = UE_info->rnti[UE_id];
|
pdsch_pdu_rel15->rnti = rnti;
|
||||||
pdsch_pdu_rel15->pduIndex = nr_mac->pdu_index[0]++;
|
pdsch_pdu_rel15->pduIndex = nr_mac->pdu_index[0]++;
|
||||||
|
|
||||||
// BWP
|
// BWP
|
||||||
@@ -512,20 +503,19 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
||||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||||
pdsch_pdu_rel15->SCID = 0;
|
pdsch_pdu_rel15->SCID = 0;
|
||||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData;
|
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData;
|
||||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||||
pdsch_pdu_rel15->rbStart = rbStart;
|
pdsch_pdu_rel15->rbStart = sched_ctrl->rbStart;
|
||||||
pdsch_pdu_rel15->rbSize = rbSize;
|
pdsch_pdu_rel15->rbSize = sched_ctrl->rbSize;
|
||||||
pdsch_pdu_rel15->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
|
pdsch_pdu_rel15->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
|
||||||
pdsch_pdu_rel15->targetCodeRate[0] = R;
|
pdsch_pdu_rel15->targetCodeRate[0] = R;
|
||||||
pdsch_pdu_rel15->qamModOrder[0] = Qm;
|
pdsch_pdu_rel15->qamModOrder[0] = Qm;
|
||||||
pdsch_pdu_rel15->TBSize[0] = TBS;
|
pdsch_pdu_rel15->TBSize[0] = TBS;
|
||||||
pdsch_pdu_rel15->mcsTable[0] = table_idx;
|
pdsch_pdu_rel15->mcsTable[0] = sched_ctrl->mcsTableIdx;
|
||||||
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
||||||
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
||||||
|
|
||||||
// k0 = *bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
|
|
||||||
pdsch_pdu_rel15->dlDmrsSymbPos =
|
pdsch_pdu_rel15->dlDmrsSymbPos =
|
||||||
fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
scc->dmrs_TypeA_Position,
|
scc->dmrs_TypeA_Position,
|
||||||
@@ -550,8 +540,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
275));
|
275));
|
||||||
else
|
else
|
||||||
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
|
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
|
||||||
// time domain assignment
|
// time domain assignment: row index used instead of SLIV
|
||||||
dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment; // row index used here instead of SLIV;
|
dci_pdu_rel15[0].time_domain_assignment.val = sched_ctrl->time_domain_allocation;
|
||||||
// mcs and rv
|
// mcs and rv
|
||||||
dci_pdu_rel15[0].mcs = mcs;
|
dci_pdu_rel15[0].mcs = mcs;
|
||||||
dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0];
|
dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0];
|
||||||
@@ -562,7 +552,7 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
dci_pdu_rel15[0].dai[0].val = (pucch_sched->dai_c-1)&3;
|
dci_pdu_rel15[0].dai[0].val = (pucch_sched->dai_c-1)&3;
|
||||||
|
|
||||||
// TPC for PUCCH
|
// TPC for PUCCH
|
||||||
dci_pdu_rel15[0].tpc = UE_info->UE_sched_ctrl[UE_id].tpc1; // table 7.2.1-1 in 38.213
|
dci_pdu_rel15[0].tpc = sched_ctrl->tpc1; // table 7.2.1-1 in 38.213
|
||||||
// PUCCH resource indicator
|
// PUCCH resource indicator
|
||||||
dci_pdu_rel15[0].pucch_resource_indicator = pucch_sched->resource_indicator;
|
dci_pdu_rel15[0].pucch_resource_indicator = pucch_sched->resource_indicator;
|
||||||
// PDSCH to HARQ TI
|
// PDSCH to HARQ TI
|
||||||
@@ -587,18 +577,18 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
|
|
||||||
nr_configure_pdcch(nr_mac,
|
nr_configure_pdcch(nr_mac,
|
||||||
pdcch_pdu_rel15,
|
pdcch_pdu_rel15,
|
||||||
UE_info->rnti[UE_id],
|
rnti,
|
||||||
ss,
|
sched_ctrl->search_space,
|
||||||
coreset,
|
sched_ctrl->coreset,
|
||||||
scc,
|
scc,
|
||||||
bwp,
|
bwp,
|
||||||
aggregation_level,
|
sched_ctrl->aggregation_level,
|
||||||
CCEIndex);
|
sched_ctrl->cce_index);
|
||||||
|
|
||||||
int dci_formats[2];
|
int dci_formats[2];
|
||||||
int rnti_types[2];
|
int rnti_types[2];
|
||||||
|
|
||||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats)
|
if (sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats)
|
||||||
dci_formats[0] = NR_DL_DCI_FORMAT_1_1;
|
dci_formats[0] = NR_DL_DCI_FORMAT_1_1;
|
||||||
else
|
else
|
||||||
dci_formats[0] = NR_DL_DCI_FORMAT_1_0;
|
dci_formats[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
@@ -618,17 +608,6 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
|||||||
pdcch_pdu_rel15->StartSymbolIndex,
|
pdcch_pdu_rel15->StartSymbolIndex,
|
||||||
pdcch_pdu_rel15->DurationSymbols);
|
pdcch_pdu_rel15->DurationSymbols);
|
||||||
|
|
||||||
// I don't know why the following is not needed, but in this case we don't
|
|
||||||
// need additional calculations:
|
|
||||||
//const uint16_t N_RE_prime = NR_NB_SC_PER_RB * N_sh_symb - N_PRB_DMRS - N_PRB_oh;
|
|
||||||
//LOG_D(MAC,
|
|
||||||
// "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n",
|
|
||||||
// N_RE_prime,
|
|
||||||
// N_sh_symb,
|
|
||||||
// N_PRB_DMRS,
|
|
||||||
// N_PRB_oh);
|
|
||||||
//pdsch_pdu_rel15->nb_mod_symbols = N_RE_prime*pdsch_pdu_rel15->n_prb*pdsch_pdu_rel15->nb_codewords;
|
|
||||||
|
|
||||||
LOG_D(MAC,
|
LOG_D(MAC,
|
||||||
"DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d "
|
"DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d "
|
||||||
"nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
|
"nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
|
||||||
@@ -1706,6 +1685,20 @@ inline void add_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
|||||||
*cur = UE_id;
|
*cur = UE_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove a UE from NR_UE_list listP
|
||||||
|
*/
|
||||||
|
inline int remove_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
||||||
|
int *cur = &listP->head;
|
||||||
|
while (*cur != -1 && *cur != UE_id)
|
||||||
|
cur = &listP->next[*cur];
|
||||||
|
AssertFatal(*cur != -1, "UE %d not found in UE_list\n", UE_id);
|
||||||
|
int *next = &listP->next[*cur];
|
||||||
|
*cur = listP->next[*cur];
|
||||||
|
*next = -1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP)
|
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
@@ -1784,9 +1777,9 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
|
|||||||
memset((void *) &UE_info->UE_sched_ctrl[UE_id],
|
memset((void *) &UE_info->UE_sched_ctrl[UE_id],
|
||||||
0,
|
0,
|
||||||
sizeof(NR_UE_sched_ctrl_t));
|
sizeof(NR_UE_sched_ctrl_t));
|
||||||
|
UE_info->UE_sched_ctrl[UE_id].ta_frame = 0;
|
||||||
UE_info->UE_sched_ctrl[UE_id].ta_timer = 100;
|
|
||||||
UE_info->UE_sched_ctrl[UE_id].ta_update = 31;
|
UE_info->UE_sched_ctrl[UE_id].ta_update = 31;
|
||||||
|
UE_info->UE_sched_ctrl[UE_id].ta_apply = false;
|
||||||
UE_info->UE_sched_ctrl[UE_id].ul_rssi = 0;
|
UE_info->UE_sched_ctrl[UE_id].ul_rssi = 0;
|
||||||
UE_info->UE_sched_ctrl[UE_id].sched_pucch = (NR_sched_pucch **)malloc(num_slots_ul*sizeof(NR_sched_pucch *));
|
UE_info->UE_sched_ctrl[UE_id].sched_pucch = (NR_sched_pucch **)malloc(num_slots_ul*sizeof(NR_sched_pucch *));
|
||||||
for (int s=0; s<num_slots_ul;s++)
|
for (int s=0; s<num_slots_ul;s++)
|
||||||
@@ -1837,9 +1830,11 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti)
|
|||||||
|
|
||||||
/* UE found, remove it */
|
/* UE found, remove it */
|
||||||
UE_id = i;
|
UE_id = i;
|
||||||
|
|
||||||
UE_info->num_UEs--;
|
UE_info->num_UEs--;
|
||||||
UE_info->active[UE_id] = FALSE;
|
UE_info->active[UE_id] = FALSE;
|
||||||
UE_info->rnti[UE_id] = 0;
|
UE_info->rnti[UE_id] = 0;
|
||||||
|
remove_nr_ue_list(&UE_info->list, UE_id);
|
||||||
free(UE_info->UE_sched_ctrl[UE_id].sched_pucch);
|
free(UE_info->UE_sched_ctrl[UE_id].sched_pucch);
|
||||||
free(UE_info->UE_sched_ctrl[UE_id].sched_pusch);
|
free(UE_info->UE_sched_ctrl[UE_id].sched_pusch);
|
||||||
memset((void *) &UE_info->UE_sched_ctrl[UE_id],
|
memset((void *) &UE_info->UE_sched_ctrl[UE_id],
|
||||||
|
|||||||
@@ -214,12 +214,8 @@ void nr_process_mac_pdu(
|
|||||||
int UE_id = find_nr_UE_id(module_idP, rnti);
|
int UE_id = find_nr_UE_id(module_idP, rnti);
|
||||||
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
|
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
|
||||||
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
|
|
||||||
|
|
||||||
LOG_T(MAC, "\n");
|
|
||||||
#endif
|
#endif
|
||||||
if(IS_SOFTMODEM_NOS1){
|
if(IS_SOFTMODEM_NOS1){
|
||||||
mac_rlc_data_ind(module_idP,
|
mac_rlc_data_ind(module_idP,
|
||||||
@@ -322,49 +318,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
UE_info = &gNB_mac->UE_info;
|
UE_info = &gNB_mac->UE_info;
|
||||||
int target_snrx10 = gNB_mac->pusch_target_snrx10;
|
int target_snrx10 = gNB_mac->pusch_target_snrx10;
|
||||||
|
|
||||||
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[0];
|
|
||||||
|
|
||||||
if (sduP != NULL) {
|
if (sduP != NULL) {
|
||||||
T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP),
|
T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP),
|
||||||
T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */,
|
T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */,
|
||||||
T_BUFFER(sduP, sdu_lenP));
|
T_BUFFER(sduP, sdu_lenP));
|
||||||
}
|
}
|
||||||
|
|
||||||
// random access pusch with TC-RNTI
|
|
||||||
if (ra->state == WAIT_Msg3) {
|
|
||||||
if (sduP != NULL) { // if the CRC passed
|
|
||||||
|
|
||||||
if (ra->rnti != current_rnti) {
|
|
||||||
LOG_E(MAC,
|
|
||||||
"expected TC-RNTI %04x to match current RNTI %04x\n",
|
|
||||||
ra->rnti,
|
|
||||||
current_rnti);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(ra->preambles.preamble_list);
|
|
||||||
ra->state = RA_IDLE;
|
|
||||||
LOG_I(MAC, "reset RA state information for RA-RNTI %04x\n", ra->rnti);
|
|
||||||
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti);
|
|
||||||
UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup;
|
|
||||||
compute_csi_bitlen (ra->secondaryCellGroup, UE_info, UE_id);
|
|
||||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
|
||||||
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
|
|
||||||
AssertFatal(bwpList->list.count == 1,
|
|
||||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
|
||||||
bwpList->list.count);
|
|
||||||
const int bwp_id = 1;
|
|
||||||
UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1];
|
|
||||||
LOG_I(MAC,
|
|
||||||
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
|
||||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
|
||||||
gnb_mod_idP,
|
|
||||||
current_rnti,
|
|
||||||
UE_id,
|
|
||||||
ra->rnti);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UE_id != -1) {
|
if (UE_id != -1) {
|
||||||
UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
|
UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
|
||||||
|
|
||||||
@@ -392,6 +351,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
|
|
||||||
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
||||||
for (int i = 0; i < sdu_lenP ; i++) {
|
for (int i = 0; i < sdu_lenP ; i++) {
|
||||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||||
@@ -399,6 +359,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
printf("%02x ",(unsigned char)sduP[i]);
|
printf("%02x ",(unsigned char)sduP[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sduP != NULL){
|
if (sduP != NULL){
|
||||||
@@ -408,6 +369,54 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!sduP) // check that CRC passed
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* we don't know this UE (yet). Check whether there is a ongoing RA (Msg 3)
|
||||||
|
* and check the corresponding UE's RNTI match, in which case we activate
|
||||||
|
* it. */
|
||||||
|
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||||
|
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
|
||||||
|
if (ra->state != WAIT_Msg3)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// random access pusch with TC-RNTI
|
||||||
|
if (ra->rnti != current_rnti) {
|
||||||
|
LOG_W(MAC,
|
||||||
|
"expected TC-RNTI %04x to match current RNTI %04x\n",
|
||||||
|
ra->rnti,
|
||||||
|
current_rnti);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti);
|
||||||
|
UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup;
|
||||||
|
compute_csi_bitlen(ra->secondaryCellGroup, UE_info, UE_id);
|
||||||
|
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||||
|
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
|
||||||
|
AssertFatal(bwpList->list.count == 1,
|
||||||
|
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||||
|
bwpList->list.count);
|
||||||
|
const int bwp_id = 1;
|
||||||
|
UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1];
|
||||||
|
LOG_I(MAC,
|
||||||
|
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
||||||
|
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||||
|
gnb_mod_idP,
|
||||||
|
current_rnti,
|
||||||
|
UE_id,
|
||||||
|
ra->rnti);
|
||||||
|
// re-initialize ta update variables afrer RA procedure completion
|
||||||
|
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||||
|
|
||||||
|
free(ra->preambles.preamble_list);
|
||||||
|
ra->state = RA_IDLE;
|
||||||
|
LOG_I(MAC,
|
||||||
|
"reset RA state information for RA-RNTI %04x/index %d\n",
|
||||||
|
ra->rnti,
|
||||||
|
i);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -80,7 +80,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
sub_frame_t slot,
|
sub_frame_t slot,
|
||||||
int num_slots_per_tdd);
|
int num_slots_per_tdd);
|
||||||
|
|
||||||
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);
|
/* \brief default preprocessor */
|
||||||
|
void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
||||||
|
frame_t frame,
|
||||||
|
sub_frame_t slot,
|
||||||
|
int num_slots_per_tdd);
|
||||||
|
|
||||||
|
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, uint8_t slots_per_frame);
|
||||||
|
|
||||||
/////// Random Access MAC-PHY interface functions and primitives ///////
|
/////// Random Access MAC-PHY interface functions and primitives ///////
|
||||||
|
|
||||||
@@ -124,43 +130,33 @@ uint16_t nr_mac_compute_RIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs);
|
|||||||
|
|
||||||
/////// Phy test scheduler ///////
|
/////// Phy test scheduler ///////
|
||||||
|
|
||||||
|
/* \brief preprocessor for phytest: schedules UE_id 0 with fixed MCS on all
|
||||||
|
* freq resources */
|
||||||
|
void nr_preprocessor_phytest(module_id_t module_id,
|
||||||
|
frame_t frame,
|
||||||
|
sub_frame_t slot,
|
||||||
|
int num_slots_per_tdd);
|
||||||
|
|
||||||
void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||||
frame_t frameP,
|
frame_t frameP,
|
||||||
sub_frame_t subframeP);
|
sub_frame_t subframeP);
|
||||||
|
|
||||||
void nr_fill_nfapi_dl_pdu(int Mod_id,
|
void nr_fill_nfapi_dl_pdu(int Mod_id,
|
||||||
int UE_id,
|
|
||||||
int bwp_id,
|
|
||||||
NR_SearchSpace_t *ss,
|
|
||||||
NR_ControlResourceSet_t *coreset,
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||||
|
rnti_t rnti,
|
||||||
|
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||||
|
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||||
NR_sched_pucch *pucch_sched,
|
NR_sched_pucch *pucch_sched,
|
||||||
int nrOfLayers,
|
|
||||||
uint8_t mcs,
|
|
||||||
uint16_t rbSize,
|
|
||||||
uint16_t rbStart,
|
|
||||||
uint8_t numDmrsCdmGrpsNoData,
|
|
||||||
nfapi_nr_dmrs_type_e dmrsConfigType,
|
nfapi_nr_dmrs_type_e dmrsConfigType,
|
||||||
uint8_t table_idx,
|
|
||||||
uint16_t R,
|
uint16_t R,
|
||||||
uint8_t Qm,
|
uint8_t Qm,
|
||||||
uint32_t tbs,
|
uint32_t tbs,
|
||||||
int time_domain_assignment,
|
|
||||||
int StartSymbolIndex,
|
int StartSymbolIndex,
|
||||||
int NrOfSymbols,
|
int NrOfSymbols,
|
||||||
uint8_t aggregation_level,
|
|
||||||
int CCEIndex,
|
|
||||||
int harq_pid,
|
int harq_pid,
|
||||||
int ndi,
|
int ndi,
|
||||||
int round);
|
int round);
|
||||||
|
|
||||||
int configure_fapi_dl_pdu_phytest(int Mod_id,
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
|
||||||
NR_sched_pucch *pucch_sched,
|
|
||||||
uint8_t *mcsIndex,
|
|
||||||
uint16_t *rbSize,
|
|
||||||
uint16_t *rbStart);
|
|
||||||
|
|
||||||
void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
|
void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
|
||||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01,
|
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01,
|
||||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234,
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234,
|
||||||
@@ -174,20 +170,6 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
|||||||
int time_domain_assignment, uint8_t tpc,
|
int time_domain_assignment, uint8_t tpc,
|
||||||
int n_ubwp, int bwp_id);
|
int n_ubwp, int bwp_id);
|
||||||
|
|
||||||
void configure_fapi_dl_Tx(module_id_t Mod_idP,
|
|
||||||
frame_t frameP,
|
|
||||||
sub_frame_t slotP,
|
|
||||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
|
||||||
nfapi_nr_pdu_t *tx_req,
|
|
||||||
int tbs_bytes,
|
|
||||||
int16_t pdu_index);
|
|
||||||
|
|
||||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
|
||||||
frame_t frameP,
|
|
||||||
sub_frame_t slotP,
|
|
||||||
NR_sched_pucch *pucch_sched,
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_config);
|
|
||||||
|
|
||||||
void nr_schedule_pusch(int Mod_idP,
|
void nr_schedule_pusch(int Mod_idP,
|
||||||
int UE_id,
|
int UE_id,
|
||||||
int num_slots_per_tdd,
|
int num_slots_per_tdd,
|
||||||
@@ -352,8 +334,6 @@ int get_ulscs(nfapi_nr_config_request_t *cfg);
|
|||||||
|
|
||||||
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
|
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
|
||||||
|
|
||||||
int32_t get_nr_uldl_offset(int nr_bandP);
|
|
||||||
|
|
||||||
void config_nr_mib(int Mod_idP,
|
void config_nr_mib(int Mod_idP,
|
||||||
int CC_idP,
|
int CC_idP,
|
||||||
int p_gNBP,
|
int p_gNBP,
|
||||||
@@ -392,6 +372,8 @@ int binomial(int n, int k);
|
|||||||
|
|
||||||
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot);
|
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot);
|
||||||
|
|
||||||
|
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id);
|
||||||
|
|
||||||
|
|
||||||
/* \brief Function to indicate a received SDU on ULSCH.
|
/* \brief Function to indicate a received SDU on ULSCH.
|
||||||
@param Mod_id Instance ID of gNB
|
@param Mod_id Instance ID of gNB
|
||||||
|
|||||||
@@ -82,6 +82,11 @@ void mac_top_init_gNB(void)
|
|||||||
|
|
||||||
RC.nrmac[i]->ul_handle = 0;
|
RC.nrmac[i]->ul_handle = 0;
|
||||||
|
|
||||||
|
if (get_softmodem_params()->phy_test)
|
||||||
|
RC.nrmac[i]->pre_processor_dl = nr_preprocessor_phytest;
|
||||||
|
else
|
||||||
|
RC.nrmac[i]->pre_processor_dl = nr_simple_dlsch_preprocessor;
|
||||||
|
|
||||||
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||||
|
|
||||||
AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
||||||
|
|||||||
@@ -68,6 +68,9 @@
|
|||||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
#include "NR_TAG.h"
|
#include "NR_TAG.h"
|
||||||
|
|
||||||
|
#include <openair3/UICC/usim_interface.h>
|
||||||
|
|
||||||
|
|
||||||
/* Defs */
|
/* Defs */
|
||||||
#define MAX_NUM_BWP 2
|
#define MAX_NUM_BWP 2
|
||||||
#define MAX_NUM_CORESET 2
|
#define MAX_NUM_CORESET 2
|
||||||
@@ -188,9 +191,9 @@ typedef struct {
|
|||||||
/// Template for RA computations
|
/// Template for RA computations
|
||||||
NR_RA_t ra[NR_NB_RA_PROC_MAX];
|
NR_RA_t ra[NR_NB_RA_PROC_MAX];
|
||||||
/// VRB map for common channels
|
/// VRB map for common channels
|
||||||
uint8_t vrb_map[275];
|
uint16_t vrb_map[275];
|
||||||
/// VRB map for common channels and retransmissions by PHICH
|
/// VRB map for common channels and retransmissions by PHICH
|
||||||
uint8_t vrb_map_UL[275];
|
uint16_t vrb_map_UL[275];
|
||||||
/// number of subframe allocation pattern available for MBSFN sync area
|
/// number of subframe allocation pattern available for MBSFN sync area
|
||||||
uint8_t num_sf_allocation_pattern;
|
uint8_t num_sf_allocation_pattern;
|
||||||
///Number of active SSBs
|
///Number of active SSBs
|
||||||
@@ -372,7 +375,7 @@ typedef struct {
|
|||||||
/// Retransmission-related information
|
/// Retransmission-related information
|
||||||
NR_UE_ret_info_t retInfo[NR_MAX_NB_HARQ_PROCESSES];
|
NR_UE_ret_info_t retInfo[NR_MAX_NB_HARQ_PROCESSES];
|
||||||
|
|
||||||
uint16_t ta_timer;
|
uint16_t ta_frame;
|
||||||
int16_t ta_update;
|
int16_t ta_update;
|
||||||
bool ta_apply;
|
bool ta_apply;
|
||||||
uint8_t tpc0;
|
uint8_t tpc0;
|
||||||
@@ -386,7 +389,11 @@ typedef struct {
|
|||||||
} NR_UE_sched_ctrl_t;
|
} NR_UE_sched_ctrl_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
boolean_t fiveG_connected;
|
||||||
|
uicc_t *uicc;
|
||||||
|
} NRUEcontext_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
int lc_bytes_tx[64];
|
int lc_bytes_tx[64];
|
||||||
int lc_bytes_rx[64];
|
int lc_bytes_rx[64];
|
||||||
int dlsch_rounds[8];
|
int dlsch_rounds[8];
|
||||||
@@ -399,6 +406,7 @@ typedef struct {
|
|||||||
} NR_mac_stats_t;
|
} NR_mac_stats_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief UNR_E_list_t is a "list" of users within UE_info_t. Especial useful in
|
/*! \brief UNR_E_list_t is a "list" of users within UE_info_t. Especial useful in
|
||||||
* the scheduler and to keep "classes" of users. */
|
* the scheduler and to keep "classes" of users. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -406,6 +414,7 @@ typedef struct {
|
|||||||
int next[MAX_MOBILES_PER_GNB];
|
int next[MAX_MOBILES_PER_GNB];
|
||||||
} NR_UE_list_t;
|
} NR_UE_list_t;
|
||||||
|
|
||||||
|
|
||||||
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
||||||
#define MAX_CSI_REPORTCONFIG 48
|
#define MAX_CSI_REPORTCONFIG 48
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -416,6 +425,7 @@ typedef struct {
|
|||||||
NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB];
|
NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB];
|
||||||
NR_UE_list_t list;
|
NR_UE_list_t list;
|
||||||
int num_UEs;
|
int num_UEs;
|
||||||
|
|
||||||
bool active[MAX_MOBILES_PER_GNB];
|
bool active[MAX_MOBILES_PER_GNB];
|
||||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||||
@@ -427,6 +437,11 @@ typedef struct {
|
|||||||
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
|
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
|
||||||
} NR_UE_info_t;
|
} NR_UE_info_t;
|
||||||
|
|
||||||
|
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
|
||||||
|
frame_t frame,
|
||||||
|
sub_frame_t slot,
|
||||||
|
int num_slots_per_tdd);
|
||||||
|
|
||||||
/*! \brief top level eNB MAC structure */
|
/*! \brief top level eNB MAC structure */
|
||||||
typedef struct gNB_MAC_INST_s {
|
typedef struct gNB_MAC_INST_s {
|
||||||
/// Ethernet parameters for northbound midhaul interface
|
/// Ethernet parameters for northbound midhaul interface
|
||||||
@@ -489,6 +504,9 @@ typedef struct gNB_MAC_INST_s {
|
|||||||
int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE];
|
int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE];
|
||||||
/// current slot
|
/// current slot
|
||||||
int current_slot;
|
int current_slot;
|
||||||
|
|
||||||
|
/// DL preprocessor for differentiated scheduling
|
||||||
|
nr_pp_impl_dl pre_processor_dl;
|
||||||
} gNB_MAC_INST;
|
} gNB_MAC_INST;
|
||||||
|
|
||||||
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ int pdcp_fifo_flush_mbms_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
|||||||
//} // PDCP_USE_NETLINK
|
//} // PDCP_USE_NETLINK
|
||||||
|
|
||||||
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
||||||
|
|
||||||
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
||||||
delNotifiedFIFO_elt (sdu_p);
|
delNotifiedFIFO_elt (sdu_p);
|
||||||
pdcp_nb_sdu_sent ++;
|
pdcp_nb_sdu_sent ++;
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void (*rlc_rrc_data_conf)(
|
|||||||
const protocol_ctxt_t *const ctxtP,
|
const protocol_ctxt_t *const ctxtP,
|
||||||
const rb_id_t rb_idP,
|
const rb_id_t rb_idP,
|
||||||
const mui_t muiP,
|
const mui_t muiP,
|
||||||
const rlc_tx_status_t statusP);
|
const rlc_tx_status_t statusP) __attribute__ ((aligned(32)));
|
||||||
|
|
||||||
typedef void (rrc_data_ind_cb_t)(
|
typedef void (rrc_data_ind_cb_t)(
|
||||||
const protocol_ctxt_t *const ctxtP,
|
const protocol_ctxt_t *const ctxtP,
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
#include "nr_pdcp_ue_manager.h"
|
#include "nr_pdcp_ue_manager.h"
|
||||||
#include "NR_RadioBearerConfig.h"
|
#include "NR_RadioBearerConfig.h"
|
||||||
#include "NR_RLC-BearerConfig.h"
|
#include "NR_RLC-BearerConfig.h"
|
||||||
@@ -43,6 +46,7 @@ static uint64_t pdcp_optmask;
|
|||||||
/* rlc_data_req queue - begin */
|
/* rlc_data_req queue - begin */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
/* NR PDCP and RLC both use "big locks". In some cases a thread may do
|
/* NR PDCP and RLC both use "big locks". In some cases a thread may do
|
||||||
@@ -92,6 +96,7 @@ static void *rlc_data_req_thread(void *_)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
pthread_setname_np(pthread_self(), "RLC queue");
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pthread_mutex_lock(&q.m) != 0) abort();
|
if (pthread_mutex_lock(&q.m) != 0) abort();
|
||||||
while (q.length == 0)
|
while (q.length == 0)
|
||||||
@@ -203,6 +208,7 @@ static void *enb_tun_read_thread(void *_)
|
|||||||
protocol_ctxt_t ctxt;
|
protocol_ctxt_t ctxt;
|
||||||
|
|
||||||
int rb_id = 1;
|
int rb_id = 1;
|
||||||
|
pthread_setname_np( pthread_self(),"enb_tun_read");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
||||||
@@ -247,7 +253,7 @@ static void *ue_tun_read_thread(void *_)
|
|||||||
protocol_ctxt_t ctxt;
|
protocol_ctxt_t ctxt;
|
||||||
|
|
||||||
int rb_id = 1;
|
int rb_id = 1;
|
||||||
|
pthread_setname_np( pthread_self(),"ue_tun_read");
|
||||||
while (1) {
|
while (1) {
|
||||||
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
||||||
if (len == -1) {
|
if (len == -1) {
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// L2 Abstraction Layer
|
// L2 Abstraction Layer
|
||||||
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr_dci_indication_pdu_t *dci){
|
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){
|
||||||
|
|
||||||
//printf("handle_dci: rnti %x,dci_type %d\n",rnti,dci_type);
|
//printf("handle_dci: rnti %x,dci_type %d\n",rnti,dci_type);
|
||||||
return nr_ue_process_dci_indication_pdu(module_id, cc_id, gNB_index, dci);
|
return nr_ue_process_dci_indication_pdu(module_id, cc_id, gNB_index, frame, slot, dci);
|
||||||
|
|
||||||
}
|
}
|
||||||
// L2 Abstraction Layer
|
// L2 Abstraction Layer
|
||||||
@@ -135,7 +135,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
|||||||
module_id_t module_id = dl_info->module_id;
|
module_id_t module_id = dl_info->module_id;
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
|
||||||
|
|
||||||
if (!dl_info->dci_ind && !dl_info->rx_ind) {
|
if (!dl_info->dci_ind && !dl_info->rx_ind) {
|
||||||
// UL indication to schedule DCI reception
|
// UL indication to schedule DCI reception
|
||||||
@@ -150,13 +149,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
|||||||
int8_t ret = handle_dci(dl_info->module_id,
|
int8_t ret = handle_dci(dl_info->module_id,
|
||||||
dl_info->cc_id,
|
dl_info->cc_id,
|
||||||
dl_info->gNB_index,
|
dl_info->gNB_index,
|
||||||
|
dl_info->frame,
|
||||||
|
dl_info->slot,
|
||||||
dl_info->dci_ind->dci_list+i);
|
dl_info->dci_ind->dci_list+i);
|
||||||
|
|
||||||
ret_mask |= (ret << FAPI_NR_DCI_IND);
|
ret_mask |= (ret << FAPI_NR_DCI_IND);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" );
|
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" );
|
||||||
AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" );
|
AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" );
|
||||||
fill_scheduled_response(&scheduled_response, dl_config, ul_config, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot);
|
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot);
|
||||||
nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response);
|
nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui
|
|||||||
\param pduP pointer to pdu*/
|
\param pduP pointer to pdu*/
|
||||||
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len);
|
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len);
|
||||||
|
|
||||||
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr_dci_indication_pdu_t *dci);
|
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3295,6 +3295,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
|||||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
|
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
|
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
|
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
|
||||||
|
if (rrc_inst->nr_scg_ssb_freq > 2016666) //FR2
|
||||||
|
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz120;
|
||||||
|
else
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz30;
|
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz30;
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.quantityConfigSet_r15 = 1;
|
MeasObj2->measObject.choice.measObjectNR_r15.quantityConfigSet_r15 = 1;
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.ext1 = calloc(1, sizeof(struct LTE_MeasObjectNR_r15__ext1));
|
MeasObj2->measObject.choice.measObjectNR_r15.ext1 = calloc(1, sizeof(struct LTE_MeasObjectNR_r15__ext1));
|
||||||
@@ -3306,7 +3309,11 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
|||||||
if (MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15 == NULL) exit(1);
|
if (MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15 == NULL) exit(1);
|
||||||
|
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->present = LTE_MeasObjectNR_r15__ext1__bandNR_r15_PR_setup;
|
MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->present = LTE_MeasObjectNR_r15__ext1__bandNR_r15_PR_setup;
|
||||||
|
if (rrc_inst->nr_scg_ssb_freq > 2016666) //FR2
|
||||||
|
MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->choice.setup = 261;
|
||||||
|
else
|
||||||
MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->choice.setup = 78;
|
MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->choice.setup = 78;
|
||||||
|
|
||||||
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj2);
|
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4020,7 +4027,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
|
|||||||
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
|
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
|
||||||
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
|
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
|
||||||
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
|
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
|
||||||
//<<<<<<< HEAD
|
|
||||||
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
|
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
|
||||||
|
|
||||||
if (rrc_inst->carrier[0].sib1->tdd_Config!=NULL) {
|
if (rrc_inst->carrier[0].sib1->tdd_Config!=NULL) {
|
||||||
@@ -4635,6 +4641,7 @@ rrc_eNB_process_MeasurementReport(
|
|||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
LOG_D(RRC, "NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
|
LOG_D(RRC, "NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
|
||||||
|
printf("NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -88,6 +88,12 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO BCCH SIB1 SIBs */
|
/* TODO BCCH SIB1 SIBs */
|
||||||
|
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
||||||
|
memcpy(&buffer_pP[0],
|
||||||
|
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS,
|
||||||
|
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* CCCH */
|
/* CCCH */
|
||||||
if( (Srb_id & RAB_OFFSET ) == CCCH) {
|
if( (Srb_id & RAB_OFFSET ) == CCCH) {
|
||||||
|
|||||||
@@ -200,6 +200,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
|||||||
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
|
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
|
||||||
|
|
||||||
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
|
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
|
||||||
|
/*
|
||||||
|
* The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables
|
||||||
|
* the reverse allocation is in nr_ue_decode_mib()
|
||||||
|
*/
|
||||||
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
||||||
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
||||||
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
||||||
@@ -265,10 +269,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
gNB_RrcConfigurationReq *configuration
|
gNB_RrcConfigurationReq *configuration
|
||||||
) {
|
) {
|
||||||
asn_enc_rval_t enc_rval;
|
asn_enc_rval_t enc_rval;
|
||||||
NR_BCCH_DL_SCH_Message_t *sib1_message ;
|
|
||||||
struct NR_SIB1 *sib1 ;
|
|
||||||
int i;
|
|
||||||
struct NR_PLMN_IdentityInfo nr_plmn_info;
|
|
||||||
|
|
||||||
// TODO : Add support for more than one PLMN
|
// TODO : Add support for more than one PLMN
|
||||||
//int num_plmn = configuration->num_plmn;
|
//int num_plmn = configuration->num_plmn;
|
||||||
@@ -276,31 +276,29 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
||||||
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
||||||
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
||||||
|
memset(nr_plmn,0,sizeof(nr_plmn));
|
||||||
|
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
|
||||||
|
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
|
||||||
|
|
||||||
// struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet;
|
// struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet;
|
||||||
sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||||
memset(sib1_message,0,sizeof(NR_BCCH_DL_SCH_Message_t));
|
|
||||||
carrier->siblock1 = sib1_message;
|
carrier->siblock1 = sib1_message;
|
||||||
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
||||||
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
||||||
memset(sib1_message->message.choice.c1,0,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
|
||||||
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
|
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
|
||||||
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
|
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
|
||||||
sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
|
||||||
memset(sib1,0,sizeof(struct NR_SIB1));
|
|
||||||
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
|
||||||
memset(sib1->cellSelectionInfo,0,sizeof(struct NR_SIB1__cellSelectionInfo));
|
|
||||||
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
|
||||||
memset(&nr_plmn_info.plmn_IdentityList,0,sizeof(struct NR_PLMN_IdentityInfo__plmn_IdentityList));
|
|
||||||
asn_set_empty(&nr_plmn_info.plmn_IdentityList.list);
|
|
||||||
memset(&nr_plmn_info,0,sizeof(struct NR_PLMN_IdentityInfo));
|
|
||||||
memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity));
|
|
||||||
|
|
||||||
for (i = 0; i < num_plmn; ++i) {
|
struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||||
|
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
||||||
|
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
||||||
|
|
||||||
|
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
||||||
|
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
|
||||||
|
for (int i = 0; i < num_plmn; ++i) {
|
||||||
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
|
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
|
||||||
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
|
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
|
||||||
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
|
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
|
||||||
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
|
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
|
||||||
memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC));
|
|
||||||
asn_set_empty(&nr_plmn[i].mcc->list);
|
asn_set_empty(&nr_plmn[i].mcc->list);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
|
||||||
@@ -308,26 +306,23 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
|
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
|
||||||
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
|
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
|
||||||
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
|
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
|
||||||
memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t));
|
|
||||||
nr_plmn[i].mnc.list.size=0;
|
nr_plmn[i].mnc.list.size=0;
|
||||||
nr_plmn[i].mnc.list.count=0;
|
nr_plmn[i].mnc.list.count=0;
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
|
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
|
||||||
ASN_SEQUENCE_ADD(&nr_plmn_info.plmn_IdentityList.list, &nr_plmn[i]);
|
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
|
||||||
}//end plmn loop
|
}//end plmn loop
|
||||||
|
|
||||||
nr_plmn_info.cellIdentity.buf = MALLOC(8);
|
nr_plmn_info->cellIdentity.buf = CALLOC(1,8);
|
||||||
memset(nr_plmn_info.cellIdentity.buf,0,8);
|
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
|
||||||
nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
|
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
|
||||||
nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
|
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
|
||||||
nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
|
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
|
||||||
nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
|
nr_plmn_info->cellIdentity.size= 4;
|
||||||
nr_plmn_info.cellIdentity.size= 4;
|
nr_plmn_info->cellIdentity.bits_unused= 4;
|
||||||
nr_plmn_info.cellIdentity.bits_unused= 4;
|
nr_plmn_info->cellReservedForOperatorUse = 0;
|
||||||
nr_plmn_info.cellReservedForOperatorUse = 0;
|
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
|
||||||
memset(&sib1->cellAccessRelatedInfo,0,sizeof(NR_CellAccessRelatedInfo_t));
|
|
||||||
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, &nr_plmn_info);
|
|
||||||
#if 0
|
#if 0
|
||||||
sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
|
sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
|
||||||
memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo));
|
memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo));
|
||||||
@@ -340,11 +335,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet);
|
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet);
|
||||||
#endif
|
#endif
|
||||||
//encode SIB1 to data
|
//encode SIB1 to data
|
||||||
|
carrier->SIB1=(uint8_t *) malloc16(128);
|
||||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||||
NULL,
|
NULL,
|
||||||
(void *)sib1_message,
|
(void *)sib1_message,
|
||||||
carrier->SIB1,
|
carrier->SIB1,
|
||||||
100);
|
128);
|
||||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||||
enc_rval.failed_type->name, enc_rval.encoded);
|
enc_rval.failed_type->name, enc_rval.encoded);
|
||||||
|
|
||||||
@@ -578,3 +574,8 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
|
|||||||
spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
|
spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int do_DLInformationTransfer_NR (void * p) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*
|
*
|
||||||
* http://www.openairinterface.org/?page_id=698
|
* http://www.openairinterface.org/?page_id=698
|
||||||
*
|
*
|
||||||
|
* Author and copyright: Laurent Thomas, open-cells.com
|
||||||
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -18,25 +20,38 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
#include <openair2/RRC/LTE/MESSAGES/asn1_msg.h>
|
||||||
|
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||||
|
|
||||||
#ifndef MEMORY_POOLS_H_
|
void rrc_gNB_process_NGAP_DOWNLINK_NAS (void ) {
|
||||||
#define MEMORY_POOLS_H_
|
do_DLInformationTransfer(0,NULL,0,0,NULL);
|
||||||
|
// send it as DL data
|
||||||
|
/*
|
||||||
|
rrc_data_req (
|
||||||
|
&ctxt,
|
||||||
|
srb_id,
|
||||||
|
(*rrc_eNB_mui)++,
|
||||||
|
SDU_CONFIRM_NO,
|
||||||
|
length,
|
||||||
|
buffer,
|
||||||
|
PDCP_TRANSMISSION_MODE_CONTROL);
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
}
|
||||||
|
|
||||||
typedef void * memory_pools_handle_t;
|
void rrc_gNB_send_NGAP_NAS_FIRST_REQ(void ) {
|
||||||
typedef void * memory_pool_item_handle_t;
|
// We are noCore only now
|
||||||
|
// create message that should come from 5GC
|
||||||
|
|
||||||
memory_pools_handle_t memory_pools_create (uint32_t pools_number);
|
// send it dow
|
||||||
|
rrc_gNB_process_NGAP_DOWNLINK_NAS();
|
||||||
|
}
|
||||||
|
|
||||||
char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle);
|
void nr_rrc_rx_tx() {
|
||||||
|
// check timers
|
||||||
|
|
||||||
int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size);
|
// check if UEs are lost, to remove them from upper layers
|
||||||
|
|
||||||
memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1);
|
//
|
||||||
|
|
||||||
int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0);
|
}
|
||||||
|
|
||||||
void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info);
|
|
||||||
|
|
||||||
#endif /* MEMORY_POOLS_H_ */
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user