Merge branch 'develop' into NR_RRC_PRACH_procedures
This commit is contained in:
+9
-2
@@ -674,7 +674,8 @@ class SSHConnection():
|
||||
self.command('mkdir -p ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
|
||||
self.command('cd /opt/hss_sim0609', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f hss.log daemon.log', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S echo "Starting sudo session" && sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real ', '\$', 5)
|
||||
# based on Robert's feedback, new method to run simulated HSS
|
||||
self.command('sudo su -c "cd /opt/hss_sim0609 && screen -dm -S simulated_hss ./starthss_real"', '\$', 5)
|
||||
else:
|
||||
logging.error('This option should not occur!')
|
||||
self.close()
|
||||
@@ -1043,6 +1044,12 @@ class SSHConnection():
|
||||
logging.debug('Found a N3xx device --> resetting it')
|
||||
self.command('cd ' + self.UESourceCodePath, '\$', 5)
|
||||
# Initialize_OAI_UE_args usually start with -C and followed by the location in repository
|
||||
# in case of NR-UE, we may have rrc_config_path (Temporary?)
|
||||
modifiedUeOptions = str(self.Initialize_OAI_UE_args)
|
||||
if self.air_interface == 'nr':
|
||||
result = re.search('--rrc_config_path ', modifiedUeOptions)
|
||||
if result is not None:
|
||||
modifiedUeOptions = modifiedUeOptions.replace('rrc_config_path ', 'rrc_config_path ' + self.UESourceCodePath + '/')
|
||||
self.command('source oaienv', '\$', 5)
|
||||
self.command('cd cmake_targets/ran_build/build', '\$', 5)
|
||||
if self.air_interface == 'lte':
|
||||
@@ -1057,7 +1064,7 @@ class SSHConnection():
|
||||
self.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5)
|
||||
self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf .u*', '\$', 5)
|
||||
self.command('echo ' + self.UEPassword + ' | sudo -S ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf -o .', '\$', 5)
|
||||
self.command('echo "ulimit -c unlimited && ./'+ self.air_interface +'-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
|
||||
self.command('echo "ulimit -c unlimited && ./'+ self.air_interface +'-uesoftmodem ' + modifiedUeOptions + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
|
||||
self.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
|
||||
self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5)
|
||||
self.UELogFile = 'ue_' + self.testCase_id + '.log'
|
||||
|
||||
@@ -112,7 +112,7 @@ function analyzeIperfFiles {
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
else
|
||||
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
|
||||
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
|
||||
if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
|
||||
then
|
||||
EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
|
||||
@@ -136,9 +136,9 @@ function analyzeIperfFiles {
|
||||
else
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
|
||||
JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"`
|
||||
PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
|
||||
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
|
||||
JITTER=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*bits/sec *##" -e "s#ms.*#ms#"`
|
||||
PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
|
||||
fi
|
||||
echo " <td>" >> ./test_simulator_results.html
|
||||
echo " <pre>" >> ./test_simulator_results.html
|
||||
@@ -730,8 +730,8 @@ function report_test {
|
||||
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
|
||||
analyzeIperfFiles
|
||||
|
||||
#IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
|
||||
#analyzeIperfFiles
|
||||
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
|
||||
analyzeIperfFiles
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
+105
-25
@@ -342,6 +342,7 @@ function check_iperf {
|
||||
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
|
||||
if [ $FILE_COMPLETE -eq 0 ]
|
||||
then
|
||||
# This part will become obsolete once we have UL
|
||||
if [[ $LOC_IS_RF_SIM -eq 1 ]] && [[ $LOC_IS_NR -eq 1 ]]
|
||||
then
|
||||
echo "no UL integration right now --> normal to have no server report"
|
||||
@@ -350,11 +351,11 @@ function check_iperf {
|
||||
local EFFECTIVE_BANDWIDTH=`tail -n1 ${LOC_BASE_LOG}_server.txt | sed -e "s#^.*MBytes *##" -e "s#^.*KBytes *##" -e "s#sec.*#sec#"`
|
||||
if [[ $2 =~ .*K.* ]]
|
||||
then
|
||||
local BW_SUFFIX="K"
|
||||
local BW_PREFIX="K"
|
||||
else
|
||||
local BW_SUFFIX="M"
|
||||
local BW_PREFIX="M"
|
||||
fi
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_SUFFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_SUFFIX}bits.* ]]
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]]
|
||||
then
|
||||
echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
|
||||
else
|
||||
@@ -370,10 +371,19 @@ function check_iperf {
|
||||
echo "File Report not found"
|
||||
fi
|
||||
else
|
||||
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
|
||||
if [ `egrep -c "Mbits/sec" ${LOC_BASE_LOG}_client.txt` -ne 0 ]
|
||||
then
|
||||
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
|
||||
local BW_PREFIX="M"
|
||||
fi
|
||||
if [ `egrep -c "Kbits/sec" ${LOC_BASE_LOG}_client.txt` -ne 0 ]
|
||||
then
|
||||
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Kbits/sec" | sed -e "s#^.*KBytes *##" -e "s#sec.*#sec#"`
|
||||
local BW_PREFIX="K"
|
||||
fi
|
||||
if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ]
|
||||
then
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*Mbits.* ]]
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*${BW_PREFIX}bits.* ]]
|
||||
then
|
||||
echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
|
||||
else
|
||||
@@ -381,7 +391,7 @@ function check_iperf {
|
||||
IPERF_STATUS=-1
|
||||
fi
|
||||
else
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
|
||||
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]]
|
||||
then
|
||||
if [ $LOC_IS_DL -eq 1 ]
|
||||
then
|
||||
@@ -390,7 +400,7 @@ function check_iperf {
|
||||
echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH"
|
||||
fi
|
||||
else
|
||||
echo "not basic-sim got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
|
||||
echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
|
||||
IPERF_STATUS=-1
|
||||
fi
|
||||
fi
|
||||
@@ -603,8 +613,11 @@ function start_epc {
|
||||
echo "############################################################"
|
||||
echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS
|
||||
echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
|
||||
echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS
|
||||
echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS
|
||||
echo "sudo rm -f hss.log" >> $LOC_EPC_VM_CMDS
|
||||
#echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS
|
||||
#echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS
|
||||
echo "echo \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS
|
||||
echo "sudo su -c \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS
|
||||
|
||||
echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS
|
||||
echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS
|
||||
@@ -860,9 +873,9 @@ function start_l2_sim_ue {
|
||||
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
||||
if [ $LOC_S1_CONFIGURATION -eq 0 ]
|
||||
then
|
||||
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1 --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
|
||||
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
|
||||
else
|
||||
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1 --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1
|
||||
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1
|
||||
fi
|
||||
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
|
||||
echo "cat ./my-lte-softmodem-run.sh" >> $1
|
||||
@@ -895,8 +908,9 @@ function start_l2_sim_ue {
|
||||
else
|
||||
echo "L2-SIM UE is sync'ed w/ eNB"
|
||||
fi
|
||||
local max_interfaces_to_check=1
|
||||
if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi
|
||||
local max_interfaces_to_check=$LOC_NB_UES
|
||||
#local max_interfaces_to_check=1
|
||||
#if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi
|
||||
local j="1"
|
||||
while [ $j -le $max_interfaces_to_check ]
|
||||
do
|
||||
@@ -1260,7 +1274,7 @@ function start_rf_sim_nr_ue {
|
||||
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
|
||||
if [ $LOC_S1_CONFIGURATION -eq 0 ]
|
||||
then
|
||||
echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --numerology 1 -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/ci-scripts/rrc-files --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
|
||||
echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/ci-scripts/rrc-files --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
|
||||
fi
|
||||
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
|
||||
echo "cat ./my-nr-softmodem-run.sh" >> $1
|
||||
@@ -2067,7 +2081,7 @@ function run_test_on_vm {
|
||||
fi
|
||||
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
|
||||
echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client"
|
||||
echo "############################################################"
|
||||
THROUGHPUT="30K"
|
||||
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_dl
|
||||
@@ -2078,6 +2092,18 @@ function run_test_on_vm {
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
|
||||
check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
|
||||
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client"
|
||||
echo "############################################################"
|
||||
THROUGHPUT="30K"
|
||||
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_ul
|
||||
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
|
||||
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
|
||||
generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
|
||||
check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
|
||||
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
|
||||
echo "############################################################"
|
||||
@@ -2192,15 +2218,41 @@ function run_test_on_vm {
|
||||
|
||||
if [ $S1_NOS1_CFG -eq 1 ]
|
||||
then
|
||||
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
|
||||
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : Pinging the EPC from UE(s)"
|
||||
echo "############################################################"
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc.log
|
||||
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
echo " --- Sequentially ---"
|
||||
local j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_seq_from_ue${j}.log
|
||||
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE ${j} 0
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
j=$[$j+1]
|
||||
done
|
||||
if [ $INT_NB_UES -gt 1 ]
|
||||
then
|
||||
echo " --- In parallel ---"
|
||||
j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_para_from_ue${j}.log
|
||||
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE ${j} 1
|
||||
j=$[$j+1]
|
||||
done
|
||||
sleep 25
|
||||
j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_para_from_ue${j}.log
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
j=$[$j+1]
|
||||
done
|
||||
fi
|
||||
else
|
||||
get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
|
||||
|
||||
@@ -2245,10 +2297,38 @@ function run_test_on_vm {
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : Pinging the UE(s) from EPC"
|
||||
echo "############################################################"
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_ue.log
|
||||
ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
echo " --- Sequentially ---"
|
||||
local j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_seq_ue${j}.log
|
||||
ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
j=$[$j+1]
|
||||
done
|
||||
if [ $INT_NB_UES -gt 1 ]
|
||||
then
|
||||
echo " --- In parallel ---"
|
||||
j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_para_ue${j}.log
|
||||
ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 1
|
||||
j=$[$j+1]
|
||||
done
|
||||
sleep 25
|
||||
j="1"
|
||||
while [ $j -le $INT_NB_UES ]
|
||||
do
|
||||
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_para_ue${j}.log
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
|
||||
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
|
||||
j=$[$j+1]
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : Pinging the UE(s) from eNB"
|
||||
@@ -2288,7 +2368,7 @@ function run_test_on_vm {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $S1_NOS1_CFG -eq 2 ]
|
||||
if [ $S1_NOS1_CFG -eq 0 ]
|
||||
then
|
||||
get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
|
||||
echo "############################################################"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<htmlTabRef>run-oai-gnb-nr-ue</htmlTabRef>
|
||||
<htmlTabName>Run-gNB-and-NR-UE</htmlTabName>
|
||||
<htmlTabIcon>tasks</htmlTabIcon>
|
||||
<repeatCount>4</repeatCount>
|
||||
<repeatCount>2</repeatCount>
|
||||
<TestCaseRequestedList>
|
||||
090101 000001 090102 000002 090108 090109
|
||||
</TestCaseRequestedList>
|
||||
@@ -33,7 +33,7 @@
|
||||
<testCase id="090101">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize gNB USRP</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test</Initialize_eNB_args>
|
||||
<air_interface>NR</air_interface>
|
||||
</testCase>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<testCase id="090102">
|
||||
<class>Initialize_OAI_UE</class>
|
||||
<desc>Initialize NR UE USRP</desc>
|
||||
<Initialize_OAI_UE_args>-C 3510000000 --numerology 1 -r 106 --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path ci-scripts/rrc-files</Initialize_OAI_UE_args>
|
||||
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path ci-scripts/rrc-files</Initialize_OAI_UE_args>
|
||||
<air_interface>NR</air_interface>
|
||||
</testCase>
|
||||
|
||||
|
||||
@@ -248,22 +248,18 @@ add_boolean_option(T_TRACER True "Activate the T tracer, a debugging
|
||||
add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs")
|
||||
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
|
||||
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
|
||||
add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode")
|
||||
add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise")
|
||||
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
|
||||
|
||||
add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
|
||||
set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
|
||||
if (${ENABLE_ITTI})
|
||||
add_library(ITTI
|
||||
${OCP_ITTI}/intertask_interface.cpp
|
||||
${OPENAIR_DIR}/common/utils/backtrace.c
|
||||
${OPENAIR_DIR}/common/utils/memory_pools.c
|
||||
)
|
||||
add_library(ITTI
|
||||
${OCP_ITTI}/intertask_interface.cpp
|
||||
${OPENAIR_DIR}/common/utils/backtrace.c
|
||||
${OPENAIR_DIR}/common/utils/memory_pools.c
|
||||
)
|
||||
add_dependencies(ITTI rrc_flag)
|
||||
set(ITTI_LIB ITTI)
|
||||
set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
|
||||
endif (${ENABLE_ITTI})
|
||||
|
||||
|
||||
##################################################
|
||||
# ASN.1 grammar C code generation & dependencies #
|
||||
@@ -661,7 +657,6 @@ set (SHLIB_LOADER_SOURCES
|
||||
include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
|
||||
set(HWLIB_USRP_SOURCE
|
||||
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
|
||||
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
|
||||
)
|
||||
add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} )
|
||||
target_link_libraries(oai_usrpdevif uhd)
|
||||
@@ -1306,14 +1301,35 @@ set(PHY_SMALLBLOCKSRC
|
||||
set(PHY_TURBOIF
|
||||
${OPENAIR1_DIR}/PHY/CODING/coding_load.c
|
||||
)
|
||||
set(PHY_LDPCSRC
|
||||
|
||||
set(PHY_LDPC_ORIG_SRC
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
|
||||
)
|
||||
|
||||
set(PHY_LDPC_OPTIM_SRC
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
|
||||
)
|
||||
set(PHY_LDPC_OPTIM8SEG_SRC
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
|
||||
)
|
||||
set(PHY_LDPC_OPTIM8SEGMULTI_SRC
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
|
||||
)
|
||||
set(PHY_NR_CODINGIF
|
||||
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_load.c;
|
||||
)
|
||||
|
||||
add_library(ldpc_orig MODULE ${PHY_LDPC_ORIG_SRC} )
|
||||
add_library(ldpc_optim MODULE ${PHY_LDPC_OPTIM_SRC} )
|
||||
add_library(ldpc_optim8seg MODULE ${PHY_LDPC_OPTIM8SEG_SRC} )
|
||||
add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} )
|
||||
|
||||
add_library(coding MODULE ${PHY_TURBOSRC} )
|
||||
|
||||
set(PHY_SRC_COMMON
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
|
||||
@@ -1480,6 +1496,7 @@ set(PHY_SRC_UE
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
|
||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
|
||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c
|
||||
@@ -1497,10 +1514,9 @@ set(PHY_SRC_UE
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
|
||||
${PHY_POLARSRC}
|
||||
${PHY_SMALLBLOCKSRC}
|
||||
${PHY_LDPCSRC}
|
||||
${PHY_NR_CODINGIF}
|
||||
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c
|
||||
)
|
||||
|
||||
set(PHY_NR_UE_SRC
|
||||
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/nr_modulation.c
|
||||
@@ -1527,6 +1543,7 @@ set(PHY_SRC_UE
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
|
||||
@@ -1549,7 +1566,7 @@ set(PHY_SRC_UE
|
||||
# ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
|
||||
${PHY_POLARSRC}
|
||||
${PHY_SMALLBLOCKSRC}
|
||||
${PHY_LDPCSRC}
|
||||
${PHY_NR_CODINGIF}
|
||||
)
|
||||
|
||||
|
||||
@@ -1728,7 +1745,6 @@ set(NR_L2_SRC_UE
|
||||
${NR_UE_RRC_DIR}/L2_interface_ue.c
|
||||
${NR_UE_RRC_DIR}/main_ue.c
|
||||
${NR_UE_RRC_DIR}/rrc_UE.c
|
||||
${LTE_RLC_SRC}
|
||||
)
|
||||
|
||||
set (MAC_SRC
|
||||
@@ -2388,6 +2404,9 @@ add_library(rfsimulator MODULE
|
||||
)
|
||||
target_link_libraries(rfsimulator SIMU ${ATLAS_LIBRARIES})
|
||||
|
||||
add_library(oai_iqplayer MODULE
|
||||
${OPENAIR_TARGETS}/ARCH/iqplayer/iqplayer_lib.c
|
||||
)
|
||||
set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}")
|
||||
|
||||
#include T directory even if the T is off because T macros are in the code
|
||||
@@ -2467,6 +2486,7 @@ add_executable(lte-softmodem
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_mbms.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
|
||||
@@ -2481,7 +2501,7 @@ add_executable(lte-softmodem
|
||||
${CONFIG_SOURCES}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
)
|
||||
add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
|
||||
add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
|
||||
|
||||
target_link_libraries (lte-softmodem
|
||||
-Wl,--start-group
|
||||
@@ -2536,6 +2556,7 @@ add_executable(lte-uesoftmodem
|
||||
${OPENAIR_TARGETS}/RT/USER/rfsim.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
|
||||
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
|
||||
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
|
||||
@@ -2582,6 +2603,7 @@ add_executable(nr-softmodem
|
||||
${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
|
||||
@@ -2599,7 +2621,7 @@ target_link_libraries (nr-softmodem
|
||||
-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 GTPV1U SECU_CN SECU_OSA
|
||||
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
|
||||
S1AP_LIB S1AP_ENB L2 L2_LTE L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
S1AP_LIB S1AP_ENB L2 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 ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
@@ -2608,6 +2630,7 @@ target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LI
|
||||
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (nr-softmodem ${T_LIB})
|
||||
|
||||
add_dependencies( nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
|
||||
# nr-uesoftmodem is UE implementation
|
||||
#######################################
|
||||
|
||||
@@ -2621,6 +2644,7 @@ add_executable(nr-uesoftmodem
|
||||
${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}/LAYER2/NR_MAC_COMMON/nr_mac_common.c
|
||||
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
|
||||
@@ -2649,6 +2673,7 @@ target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_
|
||||
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
||||
|
||||
add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
|
||||
|
||||
# USIM process
|
||||
#################
|
||||
@@ -2722,10 +2747,13 @@ target_link_libraries(smallblocktest
|
||||
)
|
||||
|
||||
add_executable(ldpctest
|
||||
${PHY_NR_CODINGIF}
|
||||
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
|
||||
${T_SOURCE}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
)
|
||||
add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
|
||||
|
||||
target_link_libraries(ldpctest
|
||||
-Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group
|
||||
m pthread ${ATLAS_LIBRARIES} dl
|
||||
@@ -2909,14 +2937,15 @@ if (${T_TRACER})
|
||||
nr_ulschsim ldpctest polartest smallblocktest cu_test du_test
|
||||
#all "add_library" definitions
|
||||
ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP
|
||||
params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
|
||||
params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer
|
||||
oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai
|
||||
coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO
|
||||
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
|
||||
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
||||
L2 L2_LTE L2_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR
|
||||
CN_UTILS GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU SIMU_ETH OPENAIR0_LIB)
|
||||
CN_UTILS GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU SIMU_ETH OPENAIR0_LIB
|
||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc)
|
||||
if (TARGET ${i})
|
||||
add_dependencies(${i} generate_T)
|
||||
endif()
|
||||
|
||||
@@ -1082,15 +1082,13 @@
|
||||
<desc>nr_dlsim Test cases. (Test1: 106 PRB),
|
||||
(Test2: 217 PRB),
|
||||
(Test3: 273 PRB),
|
||||
(Test4: 106 PRB 12 CSET-Offset),
|
||||
(Test5: 217 PRB 48 CSET-Offset),
|
||||
(Test6: 106 PRB 25 PDSCH-Offset),
|
||||
(Test7: 106 PRB 51 PDSCH-Offset),
|
||||
(Test8: 217 PRB 100 PDSCH-PRBs),
|
||||
(Test9: 217 PRB 80 PDSCH-Offset),
|
||||
(Test10: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset),
|
||||
(Test11: 106 PRBs 50 PDSCH-PRBs MCS Index 27)
|
||||
(Test12: 106 PRBs 50 PDSCH-PRBs MCS Index 16)</desc>
|
||||
(Test4: 106 PRB 25 PDSCH-Offset),
|
||||
(Test5: 106 PRB 51 PDSCH-Offset),
|
||||
(Test6: 217 PRB 100 PDSCH-PRBs),
|
||||
(Test7: 217 PRB 80 PDSCH-Offset),
|
||||
(Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset),
|
||||
(Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27)
|
||||
(Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16)</desc>
|
||||
<pre_compile_prog></pre_compile_prog>
|
||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
@@ -1100,17 +1098,15 @@
|
||||
<main_exec_args>-n100 -R106 -b106 -s5
|
||||
-n100 -R217 -b217 -s5
|
||||
-n100 -R273 -b273 -s5
|
||||
-n100 -R106 -o12 -s5
|
||||
-n100 -R217 -o48 -s5
|
||||
-n100 -R106 -a25 -s5
|
||||
-n100 -R106 -a51 -s5
|
||||
-n100 -R217 -b100 -s5
|
||||
-n100 -R217 -a80 -s5
|
||||
-n100 -R217 -a110 -s5 -b100
|
||||
-n100 -e27 -s20
|
||||
-n100 -e27 -s30
|
||||
-n100 -e16 -s10
|
||||
</main_exec_args>
|
||||
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12</tags>
|
||||
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 </tags>
|
||||
<search_expr_true>PDSCH test OK</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
<nruns>3</nruns>
|
||||
|
||||
@@ -296,8 +296,8 @@ check_install_usrp_uhd_driver(){
|
||||
x=$((x + 1))
|
||||
done
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev
|
||||
$SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
|
||||
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
|
||||
$SUDO apt-get -y install libuhd-dev libuhd003 uhd-host
|
||||
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
|
||||
$SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake
|
||||
$SUDO -H pip install requests
|
||||
@@ -367,9 +367,9 @@ check_install_bladerf_driver(){
|
||||
$SUDO add-apt-repository -y ppa:bladerf/bladerf
|
||||
$SUDO apt-get update
|
||||
fi
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf libbladerf-dev
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3
|
||||
$SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40
|
||||
$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
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
|
||||
configmodule_interface_t *config_get_if(void) {
|
||||
if (cfgptr == NULL) {
|
||||
CONFIG_PRINTF_ERROR("[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
|
||||
if (isLogInitDone())
|
||||
LOG_W(ENB_APP,"[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
return cfgptr;
|
||||
|
||||
@@ -274,16 +274,6 @@ typedef struct {
|
||||
} log_t;
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
typedef enum log_instance_type_e {
|
||||
LOG_INSTANCE_UNKNOWN,
|
||||
LOG_INSTANCE_ENB,
|
||||
LOG_INSTANCE_UE,
|
||||
} log_instance_type_t;
|
||||
|
||||
void log_set_instance_type (log_instance_type_t instance);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LOG_MAIN
|
||||
log_t *g_log;
|
||||
|
||||
@@ -634,9 +634,6 @@ inline static uint32_t vcd_get_write_index(void)
|
||||
return write_index;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
int signal_mask(void);
|
||||
#endif
|
||||
|
||||
void *vcd_dumper_thread_rt(void *args)
|
||||
{
|
||||
@@ -645,9 +642,7 @@ void *vcd_dumper_thread_rt(void *args)
|
||||
struct sched_param sched_param;
|
||||
uint32_t data_ready_wait;
|
||||
|
||||
# if defined(ENABLE_ITTI)
|
||||
return 0; //signal_mask(); //function defined at common/utils/ocp_itti/intertask_interface.cpp
|
||||
# endif
|
||||
|
||||
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched_param);
|
||||
|
||||
@@ -358,23 +358,21 @@ static void forward(void *_forwarder, char *buf, int size) {
|
||||
|
||||
f->tail = new;
|
||||
#if BASIC_SIMULATOR
|
||||
|
||||
/* When runnng the basic simulator, the tracer may be too slow.
|
||||
* Let's not take too much memory in the tracee and
|
||||
* wait if there is too much data to send. 200MB is
|
||||
* arbitrary.
|
||||
*/
|
||||
while (f->memusage > 200 * 1024 * 1024) {
|
||||
if (pthread_cond_signal(&f->cond)) abort();
|
||||
while (f->memusage > 200 * 1024 * 1024) {
|
||||
if (pthread_cond_signal(&f->cond)) abort();
|
||||
|
||||
if (pthread_mutex_unlock(&f->lock)) abort();
|
||||
if (pthread_mutex_unlock(&f->lock)) abort();
|
||||
|
||||
usleep(1000);
|
||||
usleep(1000);
|
||||
|
||||
if (pthread_mutex_lock(&f->lock)) abort();
|
||||
}
|
||||
|
||||
#endif /* BASIC_SIMULATOR */
|
||||
if (pthread_mutex_lock(&f->lock)) abort();
|
||||
}
|
||||
#endif
|
||||
f->memusage += size+4;
|
||||
|
||||
/* warn every 100MB */
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
# telnet server principles
|
||||
|
||||
The oai telnet server is implemented in a shared library to be loaded by the [oai shared library loader](loader). The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader).
|
||||
The oai telnet server is implemented in shared libraries to be loaded by the [oai shared library loader](loader). `libtelnetsrv.so ` contains the code common to all oai softmodem executables, where `libtelnetsrv_<app>.so` contains the code specific to the executable identified by `app`.
|
||||
|
||||
| `<app>` | executable |
|
||||
| :-----: | :---------------: |
|
||||
| enb | `lte-softmodem` |
|
||||
| gnb | `nr-softmodem` |
|
||||
| 4Gue | `lte-uesoftmodem` |
|
||||
| 5Gue | `nr-uesoftmodem` |
|
||||
|
||||
The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader). it also uses the `get_softmodem_function` call to retrieve the running executable id and possibly loads the corresponding `libtelnetsrv_<app>.so`library.
|
||||
|
||||
Currently the telnet server only supports one user connection. The same dedicated thread is used to wait for a user connection and process the input received from this connection.
|
||||
|
||||
@@ -12,10 +21,11 @@ The telnet server provides an API which can be used by any oai component to add
|
||||
|
||||
telnet server source files are located in [common/utils/telnetsrv](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv)
|
||||
|
||||
1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
|
||||
1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the `telnet` CLI command. This implementation is compatible with all softmodem executables and is in charge of loading any additional `libtelnetsrv_<app> .so` containing code specific to the running executables.
|
||||
1. [telnetsrv.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.h) is the telnet server include file containing both private and public data type definitions. It also contains API prototypes for functions that are used to register a new command in the server.
|
||||
1. `telnetsrv\_\<XXX\>.c`: implementation of \<XXX\> CLI command which are delivered with the telnet server.
|
||||
1. `telnetsrv\_\<XXX\>.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
|
||||
1. `telnetsrv_<XXX\>.c`: implementation of \<XXX\> CLI command which are delivered with the telnet server and are common to all softmodem executables.
|
||||
1. `telnetsrv_<XXX\>.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
|
||||
1. `telnetsrv_<app>_<XXX>.c`: implementation of \<XXX\> CLI command specific to the executable identified by \<app\>.These sources are used to create `libtelnetsrv_<app>.so` at build time.
|
||||
1. [telnetsrv_CMakeLists.txt](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv_CMakeLists.txt): CMakelists file containing the cmake instructions to build the telnet server. this file is included in the [global oai CMakelists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt).
|
||||
|
||||
[oai telnet server home](telnetsrv.md)
|
||||
|
||||
@@ -8,7 +8,7 @@ By default the embedded telnet server, which is implemented in a shared library,
|
||||
./build_oai --build-lib telnetsrv
|
||||
```
|
||||
|
||||
This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository.
|
||||
This will create the `libtelnetsrv.so` and `libtelnetsrv_<app> file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository. <app> can be "enb", "gnb", "4GUE" or "5GUE", each library containing functions specific to a given executable.
|
||||
|
||||
When starting the softmodem, you must specify the **_\-\-telnetsrv_** option to load and start the telnet server. The telnet server is loaded via the [oai shared library loader](loader).
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <sys/resource.h>
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include <readline/history.h>
|
||||
|
||||
|
||||
@@ -376,6 +377,14 @@ int setgetvar(int moduleindex,char getorset,char *params) {
|
||||
client_printf("%hi\n",*(short *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
|
||||
case TELNET_VARTYPE_INT8:
|
||||
client_printf("%i\n",(int)(*(int8_t *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr)));
|
||||
break;
|
||||
|
||||
case TELNET_VARTYPE_UINT:
|
||||
client_printf("%u\n",*(unsigned int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
|
||||
case TELNET_VARTYPE_DOUBLE:
|
||||
client_printf("%g\n",*(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
@@ -404,7 +413,17 @@ int setgetvar(int moduleindex,char getorset,char *params) {
|
||||
*(short *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr) = (short)strtol(varval,NULL,0);
|
||||
client_printf("%hi\n",*(short *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
|
||||
|
||||
case TELNET_VARTYPE_INT8:
|
||||
*(char *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr) = (char)strtol(varval,NULL,0);
|
||||
client_printf("%i\n",*(int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
|
||||
case TELNET_VARTYPE_UINT:
|
||||
*(unsigned int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr) = (unsigned int)strtol(varval,NULL,0);
|
||||
client_printf("%u\n",*(unsigned int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
break;
|
||||
|
||||
case TELNET_VARTYPE_DOUBLE:
|
||||
*(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr) = strtod(varval,NULL);
|
||||
client_printf("%g\n",*(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
|
||||
@@ -546,6 +565,7 @@ void run_telnetsrv(void) {
|
||||
int readc, filled;
|
||||
int status;
|
||||
int optval = 1;
|
||||
char prompt[sizeof(TELNET_PROMPT_PREFIX)+10];
|
||||
pthread_setname_np(pthread_self(), "telnet");
|
||||
set_sched(pthread_self(),0,telnetparams.priority);
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
@@ -570,6 +590,7 @@ void run_telnetsrv(void) {
|
||||
fprintf(stderr,"[TELNETSRV] Error %s on listen call\n",strerror(errno));
|
||||
|
||||
using_history();
|
||||
int plen=sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL));
|
||||
printf("\nInitializing telnet server...\n");
|
||||
|
||||
while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) ) {
|
||||
@@ -613,9 +634,9 @@ void run_telnetsrv(void) {
|
||||
HIST_ENTRY *hisentry = history_get(strtol(buf+1,NULL,0));
|
||||
|
||||
if (hisentry) {
|
||||
char msg[TELNET_MAX_MSGLENGTH + sizeof(TELNET_PROMPT) +10];
|
||||
char msg[TELNET_MAX_MSGLENGTH + plen +10];
|
||||
sprintf(buf,"%s",hisentry->line);
|
||||
sprintf(msg,"%s %s\n",TELNET_PROMPT, hisentry->line);
|
||||
sprintf(msg,"%s %s\n",prompt, hisentry->line);
|
||||
send(telnetparams.new_socket, msg, strlen(msg), MSG_NOSIGNAL);
|
||||
}
|
||||
}
|
||||
@@ -635,7 +656,7 @@ void run_telnetsrv(void) {
|
||||
add_history(buf);
|
||||
}
|
||||
|
||||
send(telnetparams.new_socket, TELNET_PROMPT, sizeof(TELNET_PROMPT), MSG_NOSIGNAL);
|
||||
send(telnetparams.new_socket, prompt, strlen(prompt), MSG_NOSIGNAL);
|
||||
} else {
|
||||
printf ("[TELNETSRV] Closing telnet connection...\n");
|
||||
break;
|
||||
@@ -653,7 +674,7 @@ void run_telnetsrv(void) {
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------------------------*/
|
||||
/* set_telnetmodule loads the commands delivered with the telnet server
|
||||
/* load the commands delivered with the telnet server
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -709,10 +730,17 @@ int add_sharedmodules(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* autoinit functions is called by the loader when the telnet shared library is
|
||||
dynamically loaded
|
||||
*/
|
||||
int telnetsrv_autoinit(void) {
|
||||
memset(&telnetparams,0,sizeof(telnetparams));
|
||||
config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
|
||||
|
||||
/* possibly load a exec specific shared lib */
|
||||
char *execfunc=get_softmodem_function(NULL);
|
||||
char libname[64];
|
||||
sprintf(libname,"telnetsrv_%s",execfunc);
|
||||
load_module_shlib(libname,NULL,0,NULL);
|
||||
if(pthread_create(&telnetparams.telnet_pthread,NULL, (void *(*)(void *))run_telnetsrv, NULL) != 0) {
|
||||
fprintf(stderr,"[TELNETSRV] Error %s on pthread_create call\n",strerror(errno));
|
||||
return -1;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#define TELNET_PORT 9090
|
||||
#define TELNET_MAX_MSGLENGTH 2048
|
||||
#define TELNET_PROMPT "softmodem> "
|
||||
#define TELNET_PROMPT_PREFIX "softmodem"
|
||||
#define TELNET_MAXCMD 20
|
||||
#define TELNET_CMD_MAXSIZE 20
|
||||
#define TELNET_HELPSTR_SIZE 80
|
||||
|
||||
@@ -2,20 +2,32 @@ set(TELNETROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
|
||||
|
||||
set(TELNETSRV_SOURCE
|
||||
${TELNETROOT}/telnetsrv.c
|
||||
${TELNETROOT}/telnetsrv_phycmd.c
|
||||
${TELNETROOT}/telnetsrv_proccmd.c
|
||||
${TELNETROOT}/telnetsrv_loader.c
|
||||
${TELNETROOT}/telnetsrv_measurements.c
|
||||
)
|
||||
|
||||
#set(TELNETSRV_ETHDEVCMD_SOURCE
|
||||
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
|
||||
# )
|
||||
|
||||
|
||||
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
|
||||
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
|
||||
target_link_libraries(telnetsrv PRIVATE history)
|
||||
|
||||
foreach(TELNETLIB enb gnb 4gUE 5gUE)
|
||||
set(TELNETLIB_SRCS "")
|
||||
foreach(TELNETLIB_ASRC measurements phycmd)
|
||||
set(TELNETLIB_SRC ${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_${TELNETLIB}_${TELNETLIB_ASRC}.c)
|
||||
if (EXISTS ${TELNETLIB_SRC})
|
||||
set( TELNETLIB_SRCS "${TELNETLIB_SRC};${TELNETLIB_SRCS}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(NOT "${TELNETLIB_SRCS}" STREQUAL "")
|
||||
message("Add ${TELNETLIB} specific telnet functions in libtelnetsrv_${TELNETLIB}.so")
|
||||
add_library(telnetsrv_${TELNETLIB} MODULE ${TELNETLIB_SRCS} )
|
||||
add_dependencies(telnetsrv telnetsrv_${TELNETLIB})
|
||||
install(TARGETS telnetsrv_${TELNETLIB} DESTINATION bin)
|
||||
else()
|
||||
message("No specific telnet functions for ${TELNETLIB}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
install(TARGETS telnetsrv DESTINATION bin)
|
||||
|
||||
if (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build")
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
|
||||
* \brief: implementation of telnet commands related to eNB measurments
|
||||
* \author Francois TABURET
|
||||
* \date 2019
|
||||
* \version 0.1
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define TELNETSERVERCODE
|
||||
#include "telnetsrv.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "telnetsrv_measurements.h"
|
||||
#include "telnetsrv_ltemeasur_def.h"
|
||||
#include "telnetsrv_cpumeasur_def.h"
|
||||
#include "openair2/LAYER2/MAC/mac.h"
|
||||
#include "openair1/PHY/phy_extern.h"
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
|
||||
|
||||
|
||||
static telnet_measurgroupdef_t enbmeasurgroups[] = {
|
||||
{"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
|
||||
{"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
|
||||
{"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
|
||||
{"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
|
||||
{"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
|
||||
{"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
|
||||
};
|
||||
#define TELNET_NUM_ENBMEASURGROUPS (sizeof(enbmeasurgroups)/sizeof(telnet_measurgroupdef_t))
|
||||
|
||||
static int eNB_id =0;
|
||||
static double cpufreq;
|
||||
|
||||
|
||||
#define HDR "---------------------------------"
|
||||
|
||||
|
||||
int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
|
||||
*measurgroups = enbmeasurgroups;
|
||||
return TELNET_NUM_ENBMEASURGROUPS;
|
||||
}
|
||||
|
||||
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
|
||||
PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
|
||||
eNB_MAC_INST *macvars = RC.mac[eNB_id];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
|
||||
pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
/*----------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
|
||||
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
|
||||
|
||||
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
|
||||
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
|
||||
int CC_id = UE_list->ordered_CCids[i][UE_id];
|
||||
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
|
||||
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
|
||||
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
}
|
||||
} /* measurcmd_display_macstats_ue */
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt) {
|
||||
for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
|
||||
prnt("%s eNB %i mac stats CC %i frame %u %s\n",
|
||||
HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
|
||||
measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
} /* measurcmd_display_macstats */
|
||||
|
||||
|
||||
void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
|
||||
char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
|
||||
|
||||
{
|
||||
int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
|
||||
rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
|
||||
rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
|
||||
rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
|
||||
rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
|
||||
rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
|
||||
|
||||
if (rlc_status == RLC_OP_STATUS_OK) {
|
||||
prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
|
||||
(rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
|
||||
measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
|
||||
}
|
||||
} /* status measurcmd_rlc_stat_req */
|
||||
|
||||
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
|
||||
protocol_ctxt_t ctxt;
|
||||
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
||||
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
||||
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
|
||||
eNB_MAC_INST *eNB = RC.mac[eNB_id];
|
||||
|
||||
for(int i=0; i <num_rlcmeasure ; i++) {
|
||||
statsptr[i].vptr = rlcstats + i;
|
||||
}
|
||||
|
||||
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
|
||||
#define NB_eNB_INST 1
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
|
||||
eNB->frame,eNB->subframe,eNB_id);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
|
||||
}
|
||||
} /* measurcmd_display_macstats_ue */
|
||||
|
||||
|
||||
|
||||
|
||||
+58
-77
@@ -29,7 +29,7 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -39,104 +39,85 @@
|
||||
#define TELNETSRV_PHYCMD_MAIN
|
||||
#include "telnetsrv_phycmd.h"
|
||||
char *prnbuff;
|
||||
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
|
||||
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char *buffer, int length);
|
||||
|
||||
void init_phytelnet(void)
|
||||
{
|
||||
prnbuff=malloc(get_phybsize() );
|
||||
if (prnbuff == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
|
||||
}
|
||||
void init_phytelnet(void) {
|
||||
prnbuff=malloc(get_phybsize() );
|
||||
|
||||
if (prnbuff == NULL) {
|
||||
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
void display_uestatshead( telnet_printfunc_t prnt)
|
||||
{
|
||||
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
|
||||
void display_uestatshead( telnet_printfunc_t prnt) {
|
||||
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
|
||||
}
|
||||
|
||||
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag)
|
||||
{
|
||||
|
||||
int p;
|
||||
|
||||
p=dump_eNB_l2_stats( prnbuff, 0);
|
||||
if(prntflag>=1)
|
||||
prnt("%s\n",prnbuff);
|
||||
if(debug>=1)
|
||||
prnt("%i bytes printed\n",p);
|
||||
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag) {
|
||||
int p;
|
||||
p=dump_eNB_l2_stats( prnbuff, 0);
|
||||
|
||||
if(prntflag>=1)
|
||||
prnt("%s\n",prnbuff);
|
||||
|
||||
if(debug>=1)
|
||||
prnt("%i bytes printed\n",p);
|
||||
}
|
||||
|
||||
void display_uestats(int debug, telnet_printfunc_t prnt, int ue)
|
||||
{
|
||||
for (int cc=0; cc<1 ; cc++)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
void display_uestats(int debug, telnet_printfunc_t prnt, int ue) {
|
||||
for (int cc=0; cc<1 ; cc++) {
|
||||
}
|
||||
}
|
||||
|
||||
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
prnt(" DLSCH kb DLSCH kb/s\n");
|
||||
|
||||
dump_uestats(debug, prnt,0);
|
||||
|
||||
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
prnt(" DLSCH kb DLSCH kb/s\n");
|
||||
dump_uestats(debug, prnt,0);
|
||||
}
|
||||
|
||||
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
|
||||
|
||||
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
if (debug > 0)
|
||||
prnt("phy interface module received %s\n",buf);
|
||||
|
||||
if (debug > 0)
|
||||
prnt("phy interface module received %s\n",buf);
|
||||
if (strcasestr(buf,"phycnt") != NULL)
|
||||
{
|
||||
display_phycounters(buf, debug, prnt);
|
||||
}
|
||||
if (strcasestr(buf,"uestat") != NULL)
|
||||
{
|
||||
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
|
||||
display_uestatshead(prnt);
|
||||
if (cptr != NULL)
|
||||
{
|
||||
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
|
||||
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0)
|
||||
{
|
||||
display_uestats(debug, prnt,ueidx);
|
||||
}
|
||||
} /* if cptr != NULL */
|
||||
else
|
||||
{
|
||||
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++)
|
||||
{
|
||||
display_uestats(debug, prnt,ue);
|
||||
}
|
||||
} /* else cptr != NULL */
|
||||
} /* uestat */
|
||||
if (strcasestr(buf,"uedump") != NULL)
|
||||
{
|
||||
dump_uestats(debug, prnt,1);
|
||||
}
|
||||
return 0;
|
||||
if (strcasestr(buf,"phycnt") != NULL) {
|
||||
display_phycounters(buf, debug, prnt);
|
||||
}
|
||||
|
||||
if (strcasestr(buf,"uestat") != NULL) {
|
||||
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
|
||||
display_uestatshead(prnt);
|
||||
|
||||
if (cptr != NULL) {
|
||||
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
|
||||
|
||||
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0) {
|
||||
display_uestats(debug, prnt,ueidx);
|
||||
}
|
||||
} /* if cptr != NULL */
|
||||
else {
|
||||
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++) {
|
||||
display_uestats(debug, prnt,ue);
|
||||
}
|
||||
} /* else cptr != NULL */
|
||||
} /* uestat */
|
||||
|
||||
if (strcasestr(buf,"uedump") != NULL) {
|
||||
dump_uestats(debug, prnt,1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
telnetshell_cmddef_t phy_cmdarray[] = {
|
||||
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
|
||||
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
|
||||
|
||||
{"","",NULL},
|
||||
{"","",NULL},
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
void add_phy_cmds(void)
|
||||
{
|
||||
|
||||
init_phytelnet();
|
||||
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
|
||||
void add_phy_cmds(void) {
|
||||
init_phytelnet();
|
||||
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
|
||||
}
|
||||
@@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
|
||||
* \brief: implementation of telnet commands related to measurments
|
||||
* \brief: implementation of telnet measurement functions common to all softmodems
|
||||
* \author Francois TABURET
|
||||
* \date 2019
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
@@ -47,40 +47,18 @@
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "telnetsrv_measurements.h"
|
||||
#include "telnetsrv_ltemeasur_def.h"
|
||||
#include "telnetsrv_cpumeasur_def.h"
|
||||
#include "openair2/LAYER2/MAC/mac.h"
|
||||
#include "openair1/PHY/phy_extern.h"
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
|
||||
|
||||
|
||||
static telnet_measurgroupdef_t measurgroups[] = {
|
||||
{"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
|
||||
{"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
|
||||
{"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
|
||||
{"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
|
||||
{"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
|
||||
{"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
|
||||
};
|
||||
#define TELNET_NUM_MEASURGROUPS (sizeof(measurgroups)/sizeof(telnet_measurgroupdef_t))
|
||||
|
||||
static int eNB_id =0;
|
||||
static char *grouptypes[] = {"ltestats","cpustats"};
|
||||
static double cpufreq;
|
||||
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
|
||||
|
||||
#define HDR "---------------------------------"
|
||||
|
||||
void measurcmd_display_groups(telnet_printfunc_t prnt) {
|
||||
void measurcmd_display_groups(telnet_printfunc_t prnt,telnet_measurgroupdef_t *measurgroups,int groups_size) {
|
||||
prnt(" %*s %10s %s\n",TELNET_MAXMEASURNAME_LEN-1,"name","type","nombre de mesures");
|
||||
|
||||
for(int i=0; i<TELNET_NUM_MEASURGROUPS; i++)
|
||||
for(int i=0; i<groups_size; i++)
|
||||
prnt("%02d %*s %10s %i\n",i,TELNET_MAXMEASURNAME_LEN-1,measurgroups[i].groupname,
|
||||
grouptypes[measurgroups[i].type], measurgroups[i].size);
|
||||
} /* measurcmd_display_groups */
|
||||
@@ -96,32 +74,9 @@ void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_
|
||||
prnt("\n\n");
|
||||
} /* measurcmd_display_measures */
|
||||
|
||||
#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
|
||||
PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
|
||||
eNB_MAC_INST *macvars = RC.mac[eNB_id];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
|
||||
pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
/*----------------------------------------------------------------------------------------------------*/
|
||||
/* lte measurements functions */
|
||||
/* cellular measurements functions */
|
||||
uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt) {
|
||||
uint64_t val;
|
||||
|
||||
@@ -164,70 +119,7 @@ void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t
|
||||
prnt("\n\n");
|
||||
} /* measurcmd_display_measures */
|
||||
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
|
||||
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
|
||||
|
||||
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
|
||||
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
|
||||
int CC_id = UE_list->ordered_CCids[i][UE_id];
|
||||
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
|
||||
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
|
||||
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
}
|
||||
} /* measurcmd_display_macstats_ue */
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt) {
|
||||
for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
|
||||
prnt("%s eNB %i mac stats CC %i frame %u %s\n",
|
||||
HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
|
||||
measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
} /* measurcmd_display_macstats */
|
||||
|
||||
|
||||
void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
|
||||
char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
|
||||
|
||||
{
|
||||
int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
|
||||
rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
|
||||
rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
|
||||
rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
|
||||
rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
|
||||
rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
|
||||
|
||||
if (rlc_status == RLC_OP_STATUS_OK) {
|
||||
prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
|
||||
(rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
|
||||
measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
|
||||
}
|
||||
} /* status measurcmd_rlc_stat_req */
|
||||
|
||||
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
|
||||
protocol_ctxt_t ctxt;
|
||||
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
||||
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
||||
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
|
||||
eNB_MAC_INST *eNB = RC.mac[eNB_id];
|
||||
|
||||
for(int i=0; i <num_rlcmeasure ; i++) {
|
||||
statsptr[i].vptr = rlcstats + i;
|
||||
}
|
||||
|
||||
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
|
||||
#define NB_eNB_INST 1
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
|
||||
eNB->frame,eNB->subframe,eNB_id);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
|
||||
}
|
||||
} /* measurcmd_display_macstats_ue */
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* function called by the telnet server when measur command is entered */
|
||||
@@ -238,20 +130,24 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
|
||||
if (debug > 0)
|
||||
prnt(" measurcmd_show received %s\n",buf);
|
||||
|
||||
// char tmp[20480];
|
||||
// dump_eNB_l2_stats(tmp, 0);
|
||||
// prnt("%s\n",tmp);
|
||||
int (*fptr)(telnet_measurgroupdef_t **) = dlsym(RTLD_DEFAULT,"get_measurgroups");
|
||||
if ( fptr == NULL) {
|
||||
prnt("No measures available for this softmodem\n");
|
||||
return 0;
|
||||
}
|
||||
telnet_measurgroupdef_t *measurgroups;
|
||||
int num_measurgroups = fptr( &measurgroups);
|
||||
|
||||
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
|
||||
|
||||
if (s>0) {
|
||||
if ( strcmp(subcmd,"groups") == 0) {
|
||||
measurcmd_display_groups(prnt);
|
||||
measurcmd_display_groups(prnt,measurgroups,num_measurgroups);
|
||||
badcmd=0;
|
||||
} else {
|
||||
for (int i=0; i<TELNET_NUM_MEASURTYPES; i++) {
|
||||
if(strcmp(subcmd,grouptypes[i]) == 0) {
|
||||
for(int j=0; j<TELNET_NUM_MEASURGROUPS; j++) {
|
||||
for(int j=0; j<num_measurgroups; j++) {
|
||||
if(i == measurgroups[j].type) {
|
||||
badcmd=0;
|
||||
measurgroups[j].displayfunc(prnt);
|
||||
@@ -260,7 +156,7 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
}
|
||||
}/* for i...*/
|
||||
|
||||
for (int i=0; i<TELNET_NUM_MEASURGROUPS; i++) {
|
||||
for (int i=0; i<num_measurgroups; i++) {
|
||||
if(strcmp(subcmd,measurgroups[i].groupname) == 0) {
|
||||
measurgroups[i].displayfunc(prnt);
|
||||
badcmd=0;
|
||||
|
||||
@@ -34,16 +34,13 @@
|
||||
#include <dlfcn.h>
|
||||
#include "telnetsrv.h"
|
||||
#include "openair1/PHY/defs_eNB.h"
|
||||
#ifdef TELNETSRV_MEASURMENTS_MAIN
|
||||
|
||||
|
||||
|
||||
#define TELNET_MAXMEASURNAME_LEN 30
|
||||
#define TELNET_MAXMEASURGROUPS 10
|
||||
|
||||
telnetshell_vardef_t measur_vardef[] = {
|
||||
{"",0,NULL}
|
||||
};
|
||||
|
||||
#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
|
||||
typedef struct cpumeasurdef {
|
||||
char statname[TELNET_MAXMEASURNAME_LEN];
|
||||
time_stats_t *astatptr;
|
||||
@@ -75,6 +72,7 @@ typedef struct mesurgroupdef {
|
||||
#define LTEMAC_MEASURGROUP_NAME "ltemac"
|
||||
#define PHYCPU_MEASURGROUP_NAME "phycpu"
|
||||
|
||||
#ifdef TELNETSRV_MEASURMENTS_MAIN
|
||||
int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt);
|
||||
int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt);
|
||||
telnetshell_cmddef_t measur_cmdarray[] = {
|
||||
@@ -83,6 +81,19 @@ telnetshell_cmddef_t measur_cmdarray[] = {
|
||||
{"","",NULL}
|
||||
};
|
||||
|
||||
telnetshell_vardef_t measur_vardef[] = {
|
||||
{"",0,NULL}
|
||||
};
|
||||
/* function to be implemented in any telnetsrv_xxx_measurements.c sources
|
||||
to allow common measurment code to access measurments data */
|
||||
extern int get_measurgroups(telnet_measurgroupdef_t **measurgroups);
|
||||
/* */
|
||||
|
||||
#else
|
||||
extern void add_measur_cmds(void);
|
||||
extern void add_measur_cmds(void);
|
||||
extern void measurcmd_display_groups(telnet_printfunc_t prnt,telnet_measurgroupdef_t *measurgroups,int groups_size);
|
||||
extern void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_t *cpumeasure, int cpumeasure_size) ;
|
||||
extern uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt);
|
||||
extern void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t *statsptr, int stats_size);
|
||||
|
||||
#endif /* TELNETSRV_MEASURCMD_MAIN */
|
||||
|
||||
@@ -93,18 +93,16 @@
|
||||
// extern openair0_device openair0;
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
extern volatile int start_gNB;
|
||||
extern volatile int start_UE;
|
||||
#endif
|
||||
extern volatile int start_gNB;
|
||||
extern volatile int start_UE;
|
||||
extern volatile int oai_exit;
|
||||
|
||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
extern int transmission_mode;
|
||||
|
||||
uint16_t sf_ahead=3;
|
||||
uint16_t sl_ahead;
|
||||
extern uint16_t sf_ahead;
|
||||
extern uint16_t sl_ahead;
|
||||
//pthread_t main_gNB_thread;
|
||||
|
||||
time_stats_t softmodem_stats_mt; // main thread
|
||||
@@ -377,7 +375,7 @@ static void *gNB_L1_thread( void *param ) {
|
||||
}
|
||||
|
||||
|
||||
#if 0 //defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
|
||||
#if 0
|
||||
// Wait for gNB application initialization to be complete (gNB registration to MME)
|
||||
static void wait_system_ready (char *message, volatile int *start_flag) {
|
||||
static char *indicator[] = {". ", ".. ", "... ", ".... ", ".....",
|
||||
|
||||
+3
-2
@@ -132,8 +132,8 @@ void configure_rru(int idx, void *arg);
|
||||
int attach_rru(RU_t *ru);
|
||||
int connect_rau(RU_t *ru);
|
||||
|
||||
extern uint16_t sf_ahead;
|
||||
extern uint16_t sl_ahead;
|
||||
uint16_t sf_ahead;
|
||||
uint16_t sl_ahead;
|
||||
|
||||
extern int emulate_rf;
|
||||
extern int numerology;
|
||||
@@ -1499,6 +1499,7 @@ void *ru_thread( void *param ) {
|
||||
}
|
||||
}
|
||||
|
||||
sf_ahead = (uint16_t) ceil((float)6/(0x01<<fp->numerology_index));
|
||||
LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
|
||||
pthread_mutex_lock(&RC.ru_mutex);
|
||||
RC.ru_mask &= ~(1<<ru->idx);
|
||||
|
||||
@@ -143,9 +143,7 @@ extern int sync_var;
|
||||
extern int transmission_mode;
|
||||
extern double cpuf;
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
extern volatile int start_eNB;
|
||||
extern volatile int start_UE;
|
||||
#endif
|
||||
extern volatile int start_eNB;
|
||||
extern volatile int start_UE;
|
||||
|
||||
#endif
|
||||
|
||||
+28
-26
@@ -71,9 +71,7 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
|
||||
@@ -102,9 +100,7 @@ pthread_mutex_t sync_mutex;
|
||||
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
||||
int config_sync_var=-1;
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
volatile int start_gNB = 0;
|
||||
#endif
|
||||
volatile int start_gNB = 0;
|
||||
volatile int oai_exit = 0;
|
||||
|
||||
static int wait_for_sync = 0;
|
||||
@@ -120,9 +116,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
//Temp fix for inexistent NR upper layer
|
||||
unsigned char NB_gNB_INST = 1;
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
static char *itti_dump_file = NULL;
|
||||
#endif
|
||||
static char *itti_dump_file = NULL;
|
||||
|
||||
int UE_scan = 1;
|
||||
int UE_scan_carrier = 0;
|
||||
@@ -303,7 +297,7 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
void *l2l1_task(void *arg) {
|
||||
MessageDef *message_p = NULL;
|
||||
int result;
|
||||
@@ -376,7 +370,6 @@ void *l2l1_task(void *arg) {
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int create_gNB_tasks(uint32_t gnb_nb) {
|
||||
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
|
||||
@@ -648,7 +641,6 @@ void wait_gNBs(void) {
|
||||
printf("gNB L1 are configured\n");
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
/*
|
||||
* helper function to terminate a certain ITTI task
|
||||
*/
|
||||
@@ -763,7 +755,6 @@ int restart_L1L2(module_id_t gnb_id) {
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void wait_nfapi_init(char *thread_name) {
|
||||
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
|
||||
@@ -822,7 +813,7 @@ int main( int argc, char **argv )
|
||||
configure_linux();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
get_common_options();
|
||||
get_common_options(SOFTMODEM_GNB_BIT );
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
@@ -843,16 +834,16 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
#if defined(ENABLE_ITTI)
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
// initialize mscgen log after ITTI
|
||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||
#endif
|
||||
|
||||
|
||||
init_opt();
|
||||
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
if(!IS_SOFTMODEM_NOS1)
|
||||
netlink_init();
|
||||
#if defined(PDCP_USE_NETLINK_QUEUES)
|
||||
pdcp_netlink_init();
|
||||
@@ -867,7 +858,6 @@ init_opt();
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
init_pdcp();
|
||||
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
|
||||
@@ -876,8 +866,6 @@ init_opt();
|
||||
RCconfig_L1();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||
/*
|
||||
RCconfig_nr_flexran();
|
||||
@@ -991,20 +979,34 @@ init_opt();
|
||||
// wait for end of program
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
//getchar();
|
||||
#if defined(ENABLE_ITTI)
|
||||
printf("Entering ITTI signals handler\n");
|
||||
itti_wait_tasks_end();
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
#else
|
||||
|
||||
while (oai_exit==0)
|
||||
sleep(1);
|
||||
// stop threads
|
||||
/*#ifdef XFORMS
|
||||
|
||||
printf("Terminating application - oai_exit=%d\n",oai_exit);
|
||||
#endif
|
||||
// stop threads
|
||||
printf("waiting for XFORMS thread\n");
|
||||
|
||||
if (do_forms==1) {
|
||||
pthread_join(forms_thread,&status);
|
||||
fl_hide_form(form_stats->stats_form);
|
||||
fl_free_form(form_stats->stats_form);
|
||||
|
||||
fl_hide_form(form_stats_l2->stats_form);
|
||||
fl_free_form(form_stats_l2->stats_form);
|
||||
|
||||
for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
fl_hide_form(form_enb[CC_id][UE_id]->phy_scope_gNB);
|
||||
fl_free_form(form_enb[CC_id][UE_id]->phy_scope_gNB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif*/
|
||||
printf("stopping MODEM threads\n");
|
||||
// cleanup
|
||||
stop_gNB(NB_gNB_INST);
|
||||
|
||||
+41
-26
@@ -463,6 +463,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500);
|
||||
//printf(">>> nr_ue_pdcch_procedures ended\n");
|
||||
#endif
|
||||
|
||||
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_tti_rx==1
|
||||
//Hardcoded rnti value
|
||||
protocol_ctxt_t ctxt;
|
||||
@@ -470,7 +471,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
0x1234, proc->frame_rx,
|
||||
proc->nr_tti_rx, 0);
|
||||
pdcp_run(&ctxt);
|
||||
pdcp_fifo_flush_sdus(&ctxt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,22 +596,21 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
|
||||
void *dummy_tx[UE->frame_parms.nb_antennas_tx];
|
||||
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
|
||||
dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4);
|
||||
|
||||
*timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms);
|
||||
for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) {
|
||||
int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ;
|
||||
// we write before read becasue gNB waits for UE to write and both executions halt
|
||||
// this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot
|
||||
if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer);
|
||||
AssertFatal(unitTransfer ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
timestamp,
|
||||
(void **)UE->common_vars.rxdata,
|
||||
unitTransfer,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
*timestamp += unitTransfer; // this does not affect the read but needed for RFSIM write
|
||||
}
|
||||
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
|
||||
free(dummy_tx[i]);
|
||||
|
||||
}
|
||||
|
||||
int computeSamplesShift(PHY_VARS_NR_UE *UE) {
|
||||
@@ -637,6 +636,22 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int get_firstSymSamp(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
|
||||
if (fp->numerology_index == 0)
|
||||
return fp->nb_prefix_samples0 + fp->ofdm_symbol_size;
|
||||
int num_samples = (slot%(fp->slots_per_subframe/2)) ? fp->nb_prefix_samples : fp->nb_prefix_samples0;
|
||||
num_samples += fp->ofdm_symbol_size;
|
||||
return num_samples;
|
||||
}
|
||||
|
||||
static inline int get_readBlockSize(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
|
||||
int rem_samples = fp->get_samples_per_slot(slot, fp) - get_firstSymSamp(slot, fp);
|
||||
int next_slot_first_symbol = 0;
|
||||
if (slot < (fp->slots_per_frame-1))
|
||||
next_slot_first_symbol = get_firstSymSamp(slot+1, fp);
|
||||
return rem_samples + next_slot_first_symbol;
|
||||
}
|
||||
|
||||
void *UE_thread(void *arg) {
|
||||
//this thread should be over the processing thread to keep in real time
|
||||
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
|
||||
@@ -653,6 +668,7 @@ void *UE_thread(void *arg) {
|
||||
int thread_idx=0;
|
||||
notifiedFIFO_t freeBlocks;
|
||||
initNotifiedFIFO_nothreadSafe(&freeBlocks);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
|
||||
for (int i=0; i<RX_NB_TH+1; i++) // RX_NB_TH working + 1 we are making to be pushed
|
||||
pushNotifiedFIFO_nothreadSafe(&freeBlocks,
|
||||
@@ -670,11 +686,11 @@ void *UE_thread(void *arg) {
|
||||
syncRunning=false;
|
||||
syncData_t *tmp=(syncData_t *)NotifiedFifoData(res);
|
||||
// shift the frame index with all the frames we trashed meanwhile we perform the synch search
|
||||
decoded_frame_rx=(tmp->proc.decoded_frame_rx+trashed_frames) % MAX_FRAME_NUMBER;
|
||||
decoded_frame_rx=(tmp->proc.decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER;
|
||||
delNotifiedFIFO_elt(res);
|
||||
} else {
|
||||
readFrame(UE, ×tamp, true);
|
||||
trashed_frames++;
|
||||
trashed_frames+=2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -709,7 +725,7 @@ void *UE_thread(void *arg) {
|
||||
// and we shifted above to the first slot of next frame
|
||||
decoded_frame_rx++;
|
||||
// we do ++ first in the regular processing, so it will be begin of frame;
|
||||
absolute_slot=decoded_frame_rx*nb_slot_frame + nb_slot_frame -1;
|
||||
absolute_slot=decoded_frame_rx*nb_slot_frame -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -746,10 +762,10 @@ void *UE_thread(void *arg) {
|
||||
}*/
|
||||
#endif
|
||||
|
||||
int firstSymSamp = get_firstSymSamp(slot_nr, &UE->frame_parms);
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
|
||||
UE->frame_parms.nb_prefix_samples0+UE->frame_parms.
|
||||
get_samples_slot_timestamp(slot_nr,&UE->frame_parms,0)];
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][firstSymSamp+
|
||||
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,0)];
|
||||
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
|
||||
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
|
||||
@@ -758,15 +774,13 @@ void *UE_thread(void *arg) {
|
||||
int readBlockSize, writeBlockSize;
|
||||
|
||||
if (slot_nr<(nb_slot_frame - 1)) {
|
||||
readBlockSize=UE->frame_parms.get_samples_per_slot(slot_nr,&UE->frame_parms);
|
||||
writeBlockSize=UE->frame_parms.get_samples_per_slot(slot_nr,&UE->frame_parms);
|
||||
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms);
|
||||
writeBlockSize=UE->frame_parms.get_samples_per_slot(curMsg->proc.nr_tti_tx,&UE->frame_parms);
|
||||
} else {
|
||||
UE->rx_offset_diff = computeSamplesShift(UE);
|
||||
readBlockSize=UE->frame_parms.get_samples_per_slot(slot_nr,&UE->frame_parms) -
|
||||
UE->frame_parms.ofdm_symbol_size -
|
||||
UE->frame_parms.nb_prefix_samples0 -
|
||||
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
|
||||
UE->rx_offset_diff;
|
||||
writeBlockSize=UE->frame_parms.get_samples_per_slot(slot_nr,&UE->frame_parms) -
|
||||
writeBlockSize=UE->frame_parms.get_samples_per_slot(curMsg->proc.nr_tti_tx,&UE->frame_parms) -
|
||||
UE->rx_offset_diff;
|
||||
}
|
||||
|
||||
@@ -781,8 +795,7 @@ void *UE_thread(void *arg) {
|
||||
UE->rfdevice.trx_write_func(&UE->rfdevice,
|
||||
timestamp+
|
||||
UE->frame_parms.get_samples_slot_timestamp(slot_nr,
|
||||
&UE->frame_parms,DURATION_RX_TO_TX) -
|
||||
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
|
||||
&UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp -
|
||||
openair0_cfg[0].tx_sample_advance,
|
||||
txp,
|
||||
writeBlockSize,
|
||||
@@ -791,7 +804,7 @@ void *UE_thread(void *arg) {
|
||||
|
||||
if( slot_nr==(nb_slot_frame-1)) {
|
||||
// read in first symbol of next frame and adjust for timing drift
|
||||
int first_symbols=writeBlockSize-readBlockSize;
|
||||
int first_symbols=UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0; // first symbol of every frames
|
||||
|
||||
if ( first_symbols > 0 )
|
||||
AssertFatal(first_symbols ==
|
||||
@@ -806,8 +819,8 @@ void *UE_thread(void *arg) {
|
||||
|
||||
curMsg->proc.timestamp_tx = timestamp+
|
||||
UE->frame_parms.get_samples_slot_timestamp(slot_nr,
|
||||
&UE->frame_parms,DURATION_RX_TO_TX) -
|
||||
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
|
||||
&UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp;
|
||||
|
||||
notifiedFIFO_elt_t *res;
|
||||
|
||||
while (nbSlotProcessing >= RX_NB_TH) {
|
||||
@@ -816,7 +829,8 @@ void *UE_thread(void *arg) {
|
||||
processingData_t *tmp=(processingData_t *)res->msgData;
|
||||
|
||||
if (tmp->proc.decoded_frame_rx != -1)
|
||||
decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
||||
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
||||
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
||||
|
||||
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
||||
}
|
||||
@@ -842,7 +856,8 @@ void *UE_thread(void *arg) {
|
||||
processingData_t *tmp=(processingData_t *)res->msgData;
|
||||
|
||||
if (tmp->proc.decoded_frame_rx != -1)
|
||||
decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
||||
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
|
||||
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
|
||||
|
||||
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ 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;
|
||||
@@ -334,8 +335,6 @@ void init_scope(void) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
void *l2l1_task(void *arg) {
|
||||
MessageDef *message_p = NULL;
|
||||
int result;
|
||||
@@ -375,7 +374,7 @@ void *l2l1_task(void *arg) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int16_t dlsch_demod_shift;
|
||||
|
||||
@@ -669,7 +668,7 @@ int main( int argc, char **argv ) {
|
||||
logInit();
|
||||
// get options and fill parameters from configuration file
|
||||
get_options (); //Command-line options, enb_properties
|
||||
get_common_options();
|
||||
get_common_options(SOFTMODEM_5GUE_BIT );
|
||||
#if T_TRACER
|
||||
T_Config_Init();
|
||||
#endif
|
||||
@@ -689,6 +688,7 @@ int main( int argc, char **argv ) {
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
|
||||
init_opt() ;
|
||||
load_nrLDPClib();
|
||||
|
||||
if (ouput_vcd) {
|
||||
vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd");
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/telnetsrv/telnetsrv.h"
|
||||
#include "executables/thread-common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "softmodem-common.h"
|
||||
|
||||
static softmodem_params_t softmodem_params;
|
||||
@@ -44,7 +45,7 @@ char *parallel_config=NULL;
|
||||
char *worker_config=NULL;
|
||||
|
||||
|
||||
|
||||
static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
|
||||
static struct timespec start;
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {
|
||||
@@ -60,6 +61,89 @@ softmodem_params_t *get_softmodem_params(void) {
|
||||
return &softmodem_params;
|
||||
}
|
||||
|
||||
int32_t check_execmask(uint64_t execmask) {
|
||||
char *softmodemfunc=map_int_to_str(softmodem_funcs, execmask);
|
||||
if (softmodemfunc != NULL) {
|
||||
set_softmodem_optmask(execmask);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
|
||||
uint64_t fmask=(get_softmodem_optmask()&SOFTMODEM_FUNC_BITS);
|
||||
char *softmodemfunc=map_int_to_str(softmodem_funcs, fmask);
|
||||
if (sofmodemfunc_mask_ptr != NULL)
|
||||
*sofmodemfunc_mask_ptr=fmask;
|
||||
if (softmodemfunc != NULL) {
|
||||
return softmodemfunc;
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
|
||||
void get_common_options(uint32_t execmask) {
|
||||
uint32_t online_log_messages;
|
||||
uint32_t glog_level ;
|
||||
uint32_t start_telnetsrv = 0;
|
||||
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
|
||||
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
|
||||
char *logmem_filename = NULL;
|
||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||
check_execmask(execmask);
|
||||
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
|
||||
sizeof(cmdline_logparams)/sizeof(paramdef_t));
|
||||
config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
|
||||
set_glog_onlinelog(online_log_messages);
|
||||
}
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
|
||||
set_glog(glog_level);
|
||||
}
|
||||
|
||||
if (start_telnetsrv) {
|
||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||
}
|
||||
|
||||
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
|
||||
log_mem_filename = &logmem_filename[0];
|
||||
log_mem_flag = 1;
|
||||
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
|
||||
logInit_log_mem();
|
||||
}
|
||||
|
||||
if (noS1) {
|
||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||
}
|
||||
|
||||
if (nokrnmod) {
|
||||
printf("nokrnmod bit enabled \n");
|
||||
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
||||
}
|
||||
|
||||
if (nonbiot) {
|
||||
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
|
||||
}
|
||||
|
||||
if (rfsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_RFSIM_BIT);
|
||||
}
|
||||
|
||||
if (basicsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||
}
|
||||
|
||||
if (do_forms) {
|
||||
set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
|
||||
}
|
||||
|
||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||
|
||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||
}
|
||||
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
|
||||
struct rusage usage;
|
||||
struct timespec stop;
|
||||
@@ -119,68 +203,4 @@ void set_softmodem_sighandler(void) {
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
}
|
||||
#ifndef PHYSICAL_SIMULATOR
|
||||
void get_common_options(void) {
|
||||
uint32_t online_log_messages;
|
||||
uint32_t glog_level ;
|
||||
uint32_t start_telnetsrv = 0;
|
||||
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
|
||||
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
|
||||
char *logmem_filename = NULL;
|
||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
|
||||
sizeof(cmdline_logparams)/sizeof(paramdef_t));
|
||||
config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
|
||||
set_glog_onlinelog(online_log_messages);
|
||||
}
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
|
||||
set_glog(glog_level);
|
||||
}
|
||||
|
||||
if (start_telnetsrv) {
|
||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||
}
|
||||
|
||||
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
|
||||
log_mem_filename = &logmem_filename[0];
|
||||
log_mem_flag = 1;
|
||||
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
|
||||
logInit_log_mem();
|
||||
}
|
||||
|
||||
if (noS1) {
|
||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||
}
|
||||
|
||||
if (nokrnmod) {
|
||||
printf("nokrnmod bit enabled \n");
|
||||
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
||||
}
|
||||
|
||||
if (nonbiot) {
|
||||
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
|
||||
}
|
||||
|
||||
if (rfsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_RFSIM_BIT);
|
||||
}
|
||||
|
||||
if (basicsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||
}
|
||||
|
||||
if (do_forms) {
|
||||
set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
|
||||
}
|
||||
|
||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||
|
||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||
}
|
||||
#endif
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
#ifndef SOFTMODEM_COMMON_H
|
||||
#define SOFTMODEM_COMMON_H
|
||||
#include "openair1/PHY/defs_common.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
@@ -164,6 +165,14 @@ extern "C"
|
||||
#define SOFTMODEM_BASICSIM_BIT (1<<11)
|
||||
#define SOFTMODEM_SIML1_BIT (1<<12)
|
||||
#define SOFTMODEM_DOFORMS_BIT (1<<15)
|
||||
#define SOFTMODEM_RECPLAY_BIT (1<<16)
|
||||
#define SOFTMODEM_ENB_BIT (1<<20)
|
||||
#define SOFTMODEM_GNB_BIT (1<<21)
|
||||
#define SOFTMODEM_4GUE_BIT (1<<22)
|
||||
#define SOFTMODEM_5GUE_BIT (1<<23)
|
||||
#define SOFTMODEM_FUNC_BITS (SOFTMODEM_ENB_BIT | SOFTMODEM_GNB_BIT | SOFTMODEM_5GUE_BIT | SOFTMODEM_4GUE_BIT)
|
||||
#define MAPPING_SOFTMODEM_FUNCTIONS {{"enb",SOFTMODEM_ENB_BIT},{"gnb",SOFTMODEM_GNB_BIT},{"4Gue",SOFTMODEM_4GUE_BIT},{"5Gue",SOFTMODEM_5GUE_BIT}}
|
||||
|
||||
|
||||
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
|
||||
#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
|
||||
@@ -172,7 +181,11 @@ extern "C"
|
||||
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
|
||||
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
|
||||
#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
|
||||
|
||||
#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
|
||||
#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
|
||||
#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
|
||||
#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
|
||||
#define IS_SOFTMODEM_5GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_5GUE_BIT)
|
||||
|
||||
typedef struct {
|
||||
uint64_t optmask;
|
||||
@@ -195,7 +208,8 @@ typedef struct {
|
||||
extern uint64_t get_softmodem_optmask(void);
|
||||
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
||||
extern softmodem_params_t *get_softmodem_params(void);
|
||||
extern void get_common_options(void);
|
||||
extern void get_common_options(uint32_t execmask);
|
||||
extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
|
||||
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
|
||||
extern void set_softmodem_sighandler(void);
|
||||
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#LDPC coder/decoder implementation
|
||||
The LDPC coder and decoder are implemented in a shared library, dynamically loaded at run-time using the [oai shared library loader](file://../../../../common/utils/DOC/loader.md). The code loading the LDPC library is in [nrLDPC_load.c](file://../nrLDPC_load.c), in function `load_nrLDPClib`, which must be called at init time.
|
||||
|
||||
## Selecting the LDPC library at run time
|
||||
|
||||
By default the function `int load_nrLDPClib(void)` looks for `libldpc.so`, this default behavior can be changed using the oai loader configuration options in the configuration file or from the command line as shown below:
|
||||
|
||||
>loading `libldpc_optim8seg.so` instead of `libldpc.so`
|
||||
|
||||
```
|
||||
./nr-softmodem -O libconfig:gnb.band78.tm1.106PRB.usrpx300.conf:dbgl5 --loader.ldpc.shlibversion _optim8seg
|
||||
.......................
|
||||
[CONFIG] loader.ldpc.shlibversion set to default value ""
|
||||
[LIBCONFIG] loader.ldpc: 2/2 parameters successfully set, (1 to default value)
|
||||
[CONFIG] shlibversion set to _optim8seg from command line
|
||||
[CONFIG] loader.ldpc 1 options set from command line
|
||||
[LOADER] library libldpc_optim8seg.so successfully loaded
|
||||
........................
|
||||
```
|
||||
|
||||
Today, this mechanism is not available in the `ldpctest` phy simulator which doesn't initialize the [configuration module](file://../../../../common/config/DOC/config.md). loads `libldpc.so` and `libldpc_orig.so` to compare the performance of the two implementations.
|
||||
|
||||
###LDPC libraries
|
||||
Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`, they must implement two functions: `nrLDPC_decod` and `nrLDPC_encod`. The prototypes for these functions is defined in [nrLDPC_defs.h](file://nrLDPC_defs.h).
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -25,8 +25,7 @@
|
||||
#include <string.h>
|
||||
#include "assertions.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "PHY/CODING/nrLDPC_encoder/defs.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
|
||||
#define MAX_NUM_DLSCH_SEGMENTS 16
|
||||
@@ -85,6 +84,7 @@ typedef struct {
|
||||
RAN_CONTEXT_t RC;
|
||||
PHY_VARS_UE ***PHY_vars_UE_g;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
nrLDPC_encoderfunc_t encoder_orig;
|
||||
|
||||
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
|
||||
|
||||
@@ -286,16 +286,19 @@ int test_ldpc(short No_iteration,
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*(1/((float)nom_rate/(float)denom_rate)))/Zc;
|
||||
// printf("puncture:%d\n",no_punctured_columns);
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
|
||||
encoder_implemparams_t impp=INIT0_LDPCIMPLEMPARAMS;
|
||||
|
||||
impp.gen_code=1;
|
||||
if (ntrials==0)
|
||||
ldpc_encoder_orig(test_input[0],channel_input[0], Zc, BG, block_length, BG, 1);
|
||||
|
||||
encoder_orig(test_input,channel_input, Zc, BG, block_length, BG, &impp);
|
||||
impp.gen_code=0;
|
||||
for (trial=0; trial < ntrials; trial++)
|
||||
{
|
||||
segment_bler = 0;
|
||||
//// encoder
|
||||
start_meas(&time);
|
||||
for(j=0;j<n_segments;j++) {
|
||||
ldpc_encoder_orig(test_input[j], channel_input[j],Zc,Kb,block_length,BG,0);
|
||||
encoder_orig(&(test_input[j]), &(channel_input[j]),Zc,Kb,block_length,BG,&impp);
|
||||
}
|
||||
stop_meas(&time);
|
||||
|
||||
@@ -305,10 +308,11 @@ int test_ldpc(short No_iteration,
|
||||
ldpc_encoder_optim(test_input[j],channel_input_optim[j],Zc,Kb,block_length,BG,&tinput,&tprep,&tparity,&toutput);
|
||||
}
|
||||
stop_meas(time_optim);*/
|
||||
|
||||
impp.n_segments=n_segments;
|
||||
for(j=0;j<(n_segments/8+1);j++) {
|
||||
start_meas(time_optim);
|
||||
ldpc_encoder_optim_8seg_multi(test_input,channel_input_optim,Zc,Kb,block_length, BG, n_segments,j,&tinput,&tprep,&tparity,&toutput);
|
||||
impp.macro_num=j;
|
||||
nrLDPC_encoder(test_input,channel_input_optim,Zc,Kb,block_length, BG, &impp);
|
||||
stop_meas(time_optim);
|
||||
}
|
||||
|
||||
@@ -598,8 +602,8 @@ int main(int argc, char *argv[])
|
||||
printf("SNR0 %f: \n", SNR0);
|
||||
|
||||
|
||||
|
||||
|
||||
load_nrLDPClib();
|
||||
load_nrLDPClib_ref("_orig", &encoder_orig);
|
||||
//for (block_length=8;block_length<=MAX_BLOCK_LENGTH;block_length+=8)
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
#include "nrLDPC_defs.h"
|
||||
#include "nrLDPCdecoder_defs.h"
|
||||
#include "nrLDPC_types.h"
|
||||
#include "nrLDPC_init.h"
|
||||
#include "nrLDPC_mPass.h"
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler);
|
||||
|
||||
int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler)
|
||||
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler)
|
||||
{
|
||||
uint32_t numLLR;
|
||||
uint32_t numIter = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define __NR_LDPC_INIT__H__
|
||||
|
||||
#include "nrLDPC_lut.h"
|
||||
#include "nrLDPC_defs.h"
|
||||
#include "nrLDPCdecoder_defs.h"
|
||||
|
||||
/**
|
||||
\brief Initializes the decoder and sets correct LUTs
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#define __NR_LDPC_INIT_MEM__H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "nrLDPC_defs.h"
|
||||
#include "nrLDPC_types.h"
|
||||
|
||||
#ifndef malloc32_clear
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define __NR_LDPC_MPASS__H__
|
||||
|
||||
#include <string.h>
|
||||
#include "nrLDPC_defs.h"
|
||||
#include "nrLDPCdecoder_defs.h"
|
||||
|
||||
/**
|
||||
\brief Circular memcpy
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#define __NR_LDPC_TYPES__H__
|
||||
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "nrLDPC_defs.h"
|
||||
|
||||
#include "nrLDPCdecoder_defs.h"
|
||||
// ==============================================================================
|
||||
// TYPES
|
||||
|
||||
@@ -103,4 +102,6 @@ typedef struct nrLDPC_procBuf {
|
||||
int8_t* llrProcBuf; /**< LLR processing buffer */
|
||||
} t_nrLDPC_procBuf;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file nrLDPC_defs.h
|
||||
/*!\file nrLDPCdecoder_defs.h
|
||||
* \brief Defines all constants and buffers for the LDPC decoder
|
||||
* \author Sebastian Wagner (TCL Communications) Email: <mailto:sebastian.wagner@tcl.com>
|
||||
* \date 27-03-2018
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
//============================================================================================================================
|
||||
// encoder interface
|
||||
#ifndef __NRLDPC_DEFS__H__
|
||||
#define __NRLDPC_DEFS__H__
|
||||
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
/**
|
||||
\brief LDPC encoder
|
||||
\param 1 input
|
||||
\param 2 channel_input
|
||||
\param 3 int Zc
|
||||
\param 4 int Kb
|
||||
\param 5 short block_length
|
||||
\param 6 short BG
|
||||
\param 7 int n_segment
|
||||
\param 8 unsigned int macro_num
|
||||
\param 9-12 time_stats_t *tinput,*tprep, *tparity,*toutput
|
||||
*/
|
||||
typedef struct {
|
||||
int n_segments; // optim8seg
|
||||
unsigned int macro_num; // optim8segmulti
|
||||
unsigned char gen_code; //orig
|
||||
time_stats_t *tinput;
|
||||
time_stats_t *tprep;
|
||||
time_stats_t *tparity;
|
||||
time_stats_t *toutput;
|
||||
}encoder_implemparams_t;
|
||||
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
||||
typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,short, short, encoder_implemparams_t*);
|
||||
//============================================================================================================================
|
||||
// decoder interface
|
||||
/**
|
||||
\brief LDPC decoder API type definition
|
||||
\param p_decParams LDPC decoder parameters
|
||||
\param p_llr Input LLRs
|
||||
\param p_llrOut Output vector
|
||||
\param p_profiler LDPC profiler statistics
|
||||
*/
|
||||
typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params* , int8_t*, int8_t* , t_nrLDPC_procBuf* , t_nrLDPC_time_stats* );
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file defs.h
|
||||
* \brief LDPC encoder forward declarations
|
||||
* \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
|
||||
* \email openair_tech@eurecom.fr
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
|
||||
/*ldpc_encoder.c*/
|
||||
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
|
||||
|
||||
/*ldpc_encoder2.c*/
|
||||
void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb);
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,int Zc,int Kb,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
|
||||
/*ldpc_generate_coefficient.c*/
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int Zc,int Kb,short block_length,short BG,unsigned char gen_code);
|
||||
|
||||
/*
|
||||
int encode_parity_check_part(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb);
|
||||
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
|
||||
int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length, double rate);
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code);
|
||||
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
*/
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file ldpc_encode_parity_check.c
|
||||
* \brief Parity check function used by ldpc encoders
|
||||
* \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
|
||||
* \email openair_tech@eurecom.fr
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
|
||||
//#define DEBUG_LDPC
|
||||
|
||||
#include "ldpc384_byte.c"
|
||||
#include "ldpc352_byte.c"
|
||||
#include "ldpc320_byte.c"
|
||||
#include "ldpc288_byte.c"
|
||||
#include "ldpc256_byte.c"
|
||||
#include "ldpc240_byte.c"
|
||||
#include "ldpc224_byte.c"
|
||||
#include "ldpc208_byte.c"
|
||||
#include "ldpc192_byte.c"
|
||||
#include "ldpc176_byte.c"
|
||||
#include "ldpc_BG2_Zc384_byte.c"
|
||||
#include "ldpc_BG2_Zc352_byte.c"
|
||||
#include "ldpc_BG2_Zc320_byte.c"
|
||||
#include "ldpc_BG2_Zc288_byte.c"
|
||||
#include "ldpc_BG2_Zc256_byte.c"
|
||||
#include "ldpc_BG2_Zc240_byte.c"
|
||||
#include "ldpc_BG2_Zc224_byte.c"
|
||||
#include "ldpc_BG2_Zc208_byte.c"
|
||||
#include "ldpc_BG2_Zc192_byte.c"
|
||||
#include "ldpc_BG2_Zc176_byte.c"
|
||||
#include "ldpc_BG2_Zc160_byte.c"
|
||||
#include "ldpc_BG2_Zc144_byte.c"
|
||||
#include "ldpc_BG2_Zc128_byte.c"
|
||||
#include "ldpc_BG2_Zc120_byte.c"
|
||||
#include "ldpc_BG2_Zc112_byte.c"
|
||||
#include "ldpc_BG2_Zc104_byte.c"
|
||||
#include "ldpc_BG2_Zc96_byte.c"
|
||||
#include "ldpc_BG2_Zc88_byte.c"
|
||||
#include "ldpc_BG2_Zc80_byte.c"
|
||||
#include "ldpc_BG2_Zc72_byte.c"
|
||||
|
||||
|
||||
|
||||
static inline void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb)
|
||||
{
|
||||
|
||||
if (BG==1)
|
||||
{
|
||||
switch (Zc)
|
||||
{
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
case 4: break;
|
||||
case 5: break;
|
||||
case 6: break;
|
||||
case 7: break;
|
||||
case 8: break;
|
||||
case 9: break;
|
||||
case 10: break;
|
||||
case 11: break;
|
||||
case 12: break;
|
||||
case 13: break;
|
||||
case 14: break;
|
||||
case 15: break;
|
||||
case 16: break;
|
||||
case 18: break;
|
||||
case 20: break;
|
||||
case 22: break;
|
||||
case 24: break;
|
||||
case 26: break;
|
||||
case 28: break;
|
||||
case 30: break;
|
||||
case 32: break;
|
||||
case 36: break;
|
||||
case 40: break;
|
||||
case 44: break;
|
||||
case 48: break;
|
||||
case 52: break;
|
||||
case 56: break;
|
||||
case 60: break;
|
||||
case 64: break;
|
||||
case 72: break;
|
||||
case 80: break;
|
||||
case 88: break;
|
||||
case 96: break;
|
||||
case 104: break;
|
||||
case 112: break;
|
||||
case 120: break;
|
||||
case 128: break;
|
||||
case 144: break;
|
||||
case 160: break;
|
||||
case 176: ldpc176_byte(c,d); break;
|
||||
case 192: ldpc192_byte(c,d); break;
|
||||
case 208: ldpc208_byte(c,d); break;
|
||||
case 224: ldpc224_byte(c,d); break;
|
||||
case 240: ldpc240_byte(c,d); break;
|
||||
case 256: ldpc256_byte(c,d); break;
|
||||
case 288: ldpc288_byte(c,d); break;
|
||||
case 320: ldpc320_byte(c,d); break;
|
||||
case 352: ldpc352_byte(c,d); break;
|
||||
case 384: ldpc384_byte(c,d); break;
|
||||
default: AssertFatal(0,"BG %d Zc %d is not supported yet\n",BG,Zc); break;
|
||||
}
|
||||
}
|
||||
else if (BG==2) {
|
||||
switch (Zc)
|
||||
{
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
case 4: break;
|
||||
case 5: break;
|
||||
case 6: break;
|
||||
case 7: break;
|
||||
case 8: break;
|
||||
case 9: break;
|
||||
case 10: break;
|
||||
case 11: break;
|
||||
case 12: break;
|
||||
case 13: break;
|
||||
case 14: break;
|
||||
case 15: break;
|
||||
case 16: break;
|
||||
case 18: break;
|
||||
case 20: break;
|
||||
case 22: break;
|
||||
case 24: break;
|
||||
case 26: break;
|
||||
case 28: break;
|
||||
case 30: break;
|
||||
case 32: break;
|
||||
case 36: break;
|
||||
case 40: break;
|
||||
case 44: break;
|
||||
case 48: break;
|
||||
case 52: break;
|
||||
case 56: break;
|
||||
case 60: break;
|
||||
case 64: break;
|
||||
case 72: ldpc_BG2_Zc72_byte(c,d); break;
|
||||
case 80: ldpc_BG2_Zc80_byte(c,d); break;
|
||||
case 88: ldpc_BG2_Zc88_byte(c,d); break;
|
||||
case 96: ldpc_BG2_Zc96_byte(c,d); break;
|
||||
case 104: ldpc_BG2_Zc104_byte(c,d); break;
|
||||
case 112: ldpc_BG2_Zc112_byte(c,d); break;
|
||||
case 120: ldpc_BG2_Zc120_byte(c,d); break;
|
||||
case 128: ldpc_BG2_Zc128_byte(c,d); break;
|
||||
case 144: ldpc_BG2_Zc144_byte(c,d); break;
|
||||
case 160: ldpc_BG2_Zc160_byte(c,d); break;
|
||||
case 176: ldpc_BG2_Zc176_byte(c,d); break;
|
||||
case 192: ldpc_BG2_Zc192_byte(c,d); break;
|
||||
case 208: ldpc_BG2_Zc208_byte(c,d); break;
|
||||
case 224: ldpc_BG2_Zc224_byte(c,d); break;
|
||||
case 240: ldpc_BG2_Zc240_byte(c,d); break;
|
||||
case 256: ldpc_BG2_Zc256_byte(c,d); break;
|
||||
case 288: ldpc_BG2_Zc288_byte(c,d); break;
|
||||
case 320: ldpc_BG2_Zc320_byte(c,d); break;
|
||||
case 352: ldpc_BG2_Zc352_byte(c,d); break;
|
||||
case 384: ldpc_BG2_Zc384_byte(c,d); break;
|
||||
default: AssertFatal(0,"BG %d Zc %d is not supported yet\n",BG,Zc); break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
AssertFatal(0,"BG %d is not supported yet\n",BG);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,77 +37,247 @@
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include "defs.h"
|
||||
#include "assertions.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||
#include "ldpc_generate_coefficient.c"
|
||||
|
||||
short *choose_generator_matrix(short BG,short Zc);
|
||||
extern short no_shift_values_BG1[1012],pointer_shift_values_BG1[1012],no_shift_values_BG2[2109],pointer_shift_values_BG2[2019];
|
||||
|
||||
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length)
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int Zc,int Kb,short block_length, short BG,unsigned char gen_code)
|
||||
{
|
||||
short *Gen_shift_values=choose_generator_matrix(BG,Zc);
|
||||
short *no_shift_values, *pointer_shift_values;
|
||||
int no_punctured_columns;
|
||||
short nrows,ncols,rate=3;
|
||||
int i1,i2,i3,i4,i5,temp_prime;
|
||||
unsigned char c[22*384]; //padded input, unpacked, max size
|
||||
unsigned char d[68*384]; //coded output, unpacked, max size
|
||||
unsigned char channel_temp,temp;
|
||||
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
|
||||
|
||||
short nrows = 46;//parity check bits
|
||||
short ncols = 22;//info bits
|
||||
|
||||
|
||||
int i,i1,i2,i3,i4,i5,temp_prime,var;
|
||||
int no_punctured_columns,removed_bit,rate=3;
|
||||
int nind=0;
|
||||
int indlist[1000];
|
||||
int indlist2[1000];
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
//else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
//BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
rate=5;
|
||||
}
|
||||
|
||||
Gen_shift_values=choose_generator_matrix(BG,Zc);
|
||||
if (Gen_shift_values==NULL) {
|
||||
printf("ldpc_encoder_orig: could not find generator matrix\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//printf("ldpc_encoder_orig: BG %d, Zc %d, Kb %d\n",BG, Zc, Kb);
|
||||
|
||||
// load base graph of generator matrix
|
||||
if (BG==1)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG1;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG1;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
else if (BG==2)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG2;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; //info bits
|
||||
rate=5;
|
||||
}
|
||||
else {
|
||||
printf("problem with BG\n");
|
||||
return(-1);
|
||||
AssertFatal(0,"BG %d is not supported yet\n",BG);
|
||||
}
|
||||
|
||||
|
||||
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*rate);
|
||||
//printf("%d\n",no_punctured_columns);
|
||||
//printf("%d\n",removed_bit);
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
|
||||
//printf("no_punctured_columns = %d\n",no_punctured_columns);
|
||||
|
||||
for (i2=0; i2 < Zc; i2++)
|
||||
for (i=0; i<block_length; i++)
|
||||
{
|
||||
//t=Kb*Zc+i2;
|
||||
//c[i] = test_input[i/8]<<(i%8);
|
||||
//c[i]=c[i]>>7&1;
|
||||
c[i]=(test_input[i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
}
|
||||
|
||||
//rotate matrix here
|
||||
for (i5=0; i5 < Kb; i5++)
|
||||
{
|
||||
temp = c[i5*Zc];
|
||||
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned char));
|
||||
c[i5*Zc+Zc-1] = temp;
|
||||
// parity check part
|
||||
|
||||
if (gen_code==1)
|
||||
{
|
||||
char fname[100];
|
||||
sprintf(fname,"ldpc_BG%d_Zc%d_byte.c",BG,Zc);
|
||||
FILE *fd=fopen(fname,"w");
|
||||
AssertFatal(fd!=NULL,"cannot open %s\n",fname);
|
||||
sprintf(fname,"ldpc_BG%d_Zc%d_16bit.c",BG,Zc);
|
||||
FILE *fd2=fopen(fname,"w");
|
||||
AssertFatal(fd2!=NULL,"cannot open %s\n",fname);
|
||||
|
||||
int shift;
|
||||
char data_type[100];
|
||||
char xor_command[100];
|
||||
int mask;
|
||||
|
||||
|
||||
|
||||
|
||||
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
|
||||
fprintf(fd2,"#include \"PHY/sse_intrin.h\"\n");
|
||||
|
||||
if ((Zc&31)==0) {
|
||||
shift=5; // AVX2 - 256-bit SIMD
|
||||
mask=31;
|
||||
strcpy(data_type,"__m256i");
|
||||
strcpy(xor_command,"_mm256_xor_si256");
|
||||
}
|
||||
else if ((Zc&15)==0) {
|
||||
shift=4; // SSE4 - 128-bit SIMD
|
||||
mask=15;
|
||||
strcpy(data_type,"__m128i");
|
||||
strcpy(xor_command,"_mm_xor_si128");
|
||||
|
||||
// calculate each row in base graph
|
||||
for (i1=0; i1 < nrows-no_punctured_columns; i1++)
|
||||
}
|
||||
else if ((Zc&7)==0) {
|
||||
shift=3; // MMX - 64-bit SIMD
|
||||
mask=7;
|
||||
strcpy(data_type,"__m64");
|
||||
strcpy(xor_command,"_mm_xor_si64");
|
||||
}
|
||||
else {
|
||||
shift=0; // no SIMD
|
||||
mask=0;
|
||||
strcpy(data_type,"uint8_t");
|
||||
strcpy(xor_command,"scalar_xor");
|
||||
fprintf(fd,"#define scalar_xor(a,b) ((a)^(b))\n");
|
||||
fprintf(fd2,"#define scalar_xor(a,b) ((a)^(b))\n");
|
||||
}
|
||||
fprintf(fd,"// generated code for Zc=%d, byte encoding\n",Zc);
|
||||
fprintf(fd2,"// generated code for Zc=%d, 16bit encoding\n",Zc);
|
||||
fprintf(fd,"static inline void ldpc_BG%d_Zc%d_byte(uint8_t *c,uint8_t *d) {\n",BG,Zc);
|
||||
fprintf(fd2,"static inline void ldpc_BG%d_Zc%d_16bit(uint16_t *c,uint16_t *d) {\n",BG,Zc);
|
||||
fprintf(fd," %s *csimd=(%s *)c,*dsimd=(%s *)d;\n\n",data_type,data_type,data_type);
|
||||
fprintf(fd2," %s *csimd=(%s *)c,*dsimd=(%s *)d;\n\n",data_type,data_type,data_type);
|
||||
fprintf(fd," %s *c2,*d2;\n\n",data_type);
|
||||
fprintf(fd2," %s *c2,*d2;\n\n",data_type);
|
||||
fprintf(fd," int i2;\n");
|
||||
fprintf(fd2," int i2;\n");
|
||||
fprintf(fd," for (i2=0; i2<%d; i2++) {\n",Zc>>shift);
|
||||
if (shift > 0)
|
||||
fprintf(fd2," for (i2=0; i2<%d; i2++) {\n",Zc>>(shift-1));
|
||||
for (i2=0; i2 < 1; i2++)
|
||||
{
|
||||
channel_temp=0;
|
||||
for (i3=0; i3 < Kb; i3++)
|
||||
{
|
||||
temp_prime=i1 * ncols + i3;
|
||||
//t=Kb*Zc+i2;
|
||||
|
||||
// calculate each row in base graph
|
||||
|
||||
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
fprintf(fd," c2=&csimd[i2];\n");
|
||||
fprintf(fd," d2=&dsimd[i2];\n");
|
||||
fprintf(fd2," c2=&csimd[i2];\n");
|
||||
fprintf(fd2," d2=&dsimd[i2];\n");
|
||||
|
||||
for (i1=0; i1 < nrows; i1++)
|
||||
|
||||
{
|
||||
channel_temp=0;
|
||||
fprintf(fd,"\n//row: %d\n",i1);
|
||||
fprintf(fd2,"\n//row: %d\n",i1);
|
||||
fprintf(fd," d2[%d]=",(Zc*i1)>>shift);
|
||||
fprintf(fd2," d2[%d]=",(Zc*i1)>>(shift-1));
|
||||
|
||||
nind=0;
|
||||
|
||||
for (i3=0; i3 < ncols; i3++)
|
||||
{
|
||||
channel_temp = channel_temp ^ c[ i3*Zc + Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ] ];
|
||||
temp_prime=i1 * ncols + i3;
|
||||
|
||||
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
{
|
||||
|
||||
var=(int)((i3*Zc + (Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ]+1)%Zc)/Zc);
|
||||
int index =var*2*Zc + (i3*Zc + (Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ]+1)%Zc) % Zc;
|
||||
|
||||
indlist[nind] = ((index&mask)*((2*Zc)>>shift)*Kb)+(index>>shift);
|
||||
indlist2[nind++] = ((index&(mask>>1))*((2*Zc)>>(shift-1))*Kb)+(index>>(shift-1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for (i4=0;i4<nind-1;i4++) {
|
||||
fprintf(fd,"%s(c2[%d],",xor_command,indlist[i4]);
|
||||
fprintf(fd2,"%s(c2[%d],",xor_command,indlist2[i4]);
|
||||
}
|
||||
fprintf(fd,"c2[%d]",indlist[i4]);
|
||||
fprintf(fd2,"c2[%d]",indlist2[i4]);
|
||||
for (i4=0;i4<nind-1;i4++) { fprintf(fd,")"); fprintf(fd2,")"); }
|
||||
fprintf(fd,";\n");
|
||||
fprintf(fd2,";\n");
|
||||
|
||||
}
|
||||
fprintf(fd," }\n}\n");
|
||||
fprintf(fd2," }\n}\n");
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fd2);
|
||||
}
|
||||
else if(gen_code==0)
|
||||
{
|
||||
for (i2=0; i2 < Zc; i2++)
|
||||
{
|
||||
//t=Kb*Zc+i2;
|
||||
|
||||
//rotate matrix here
|
||||
for (i5=0; i5 < Kb; i5++)
|
||||
{
|
||||
temp = c[i5*Zc];
|
||||
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned char));
|
||||
c[i5*Zc+Zc-1] = temp;
|
||||
}
|
||||
|
||||
// calculate each row in base graph
|
||||
for (i1=0; i1 < nrows-no_punctured_columns; i1++)
|
||||
{
|
||||
channel_temp=0;
|
||||
|
||||
for (i3=0; i3 < Kb; i3++)
|
||||
{
|
||||
temp_prime=i1 * ncols + i3;
|
||||
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
{
|
||||
channel_temp = channel_temp ^ c[ i3*Zc + Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ] ];
|
||||
}
|
||||
}
|
||||
|
||||
d[i2+i1*Zc]=channel_temp;
|
||||
//channel_input[t+i1*Zc]=channel_temp;
|
||||
}
|
||||
d[i2+i1*Zc]=channel_temp;
|
||||
//channel_input[t+i1*Zc]=channel_temp;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
|
||||
// information part and puncture columns
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
//memcpy(channel_input,c,Kb*Zc*sizeof(unsigned char));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp) {
|
||||
return ldpc_encoder_orig(test_input[0],channel_input[0],Zc,Kb,block_length,BG,impp->gen_code);
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file ldpc_encoder2.c
|
||||
* \brief Defines the optimized LDPC encoder
|
||||
* \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
|
||||
* \email openair_tech@eurecom.fr
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||
#include "ldpc_encode_parity_check.c"
|
||||
#include "ldpc_generate_coefficient.c"
|
||||
//#define DEBUG_LDPC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
|
||||
{
|
||||
|
||||
short nrows=0,ncols=0;
|
||||
int i,i1,rate=3;
|
||||
int no_punctured_columns,removed_bit;
|
||||
|
||||
int simd_size;
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
//BG=1;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
//else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
//BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
rate=5;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d\n",BG,Zc,Kb,block_length);
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
|
||||
#endif
|
||||
|
||||
if ((Zc&31) > 0) simd_size = 16;
|
||||
else simd_size = 32;
|
||||
|
||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||
|
||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
||||
|
||||
// calculate number of punctured bits
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
|
||||
// printf("%d\n",no_punctured_columns);
|
||||
// printf("%d\n",removed_bit);
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
|
||||
if(impp->tinput != NULL) start_meas(impp->tinput);
|
||||
for (i=0; i<block_length; i++) {
|
||||
c[i] = (test_input[0][i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||
}
|
||||
|
||||
if(impp->tinput != NULL) stop_meas(impp->tinput);
|
||||
|
||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||
// extend matrix
|
||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||
for (i1=0; i1 < ncols; i1++)
|
||||
{
|
||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
}
|
||||
for (i1=1;i1<simd_size;i1++) {
|
||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
||||
/*
|
||||
printf("shift %d: ",i1);
|
||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
||||
printf("\n");
|
||||
*/
|
||||
}
|
||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||
//parity check part
|
||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||
}
|
||||
else {
|
||||
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
|
||||
printf("Problem with encoder\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if(impp->toutput != NULL) start_meas(impp->toutput);
|
||||
// information part and puncture columns
|
||||
memcpy(&channel_input[0][0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[0][block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
|
||||
if(impp->toutput != NULL) stop_meas(impp->toutput);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file ldpc_encoder2.c
|
||||
* \brief Defines the optimized LDPC encoder
|
||||
* \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
|
||||
* \email openair_tech@eurecom.fr
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||
//#define DEBUG_LDPC
|
||||
#include "ldpc_encode_parity_check.c"
|
||||
#include "ldpc_generate_coefficient.c"
|
||||
|
||||
|
||||
|
||||
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
|
||||
{
|
||||
|
||||
short nrows=0,ncols=0;
|
||||
int i,i1,j,rate=3;
|
||||
int no_punctured_columns,removed_bit;
|
||||
char temp;
|
||||
int simd_size;
|
||||
|
||||
#ifdef __AVX2__
|
||||
__m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000);
|
||||
__m256i andmask = _mm256_set1_epi64x(0x0102040810204080); // every 8 bits -> 8 bytes, pattern repeats.
|
||||
__m256i zero256 = _mm256_setzero_si256();
|
||||
__m256i masks[8];
|
||||
register __m256i c256;
|
||||
masks[0] = _mm256_set1_epi8(0x1);
|
||||
masks[1] = _mm256_set1_epi8(0x2);
|
||||
masks[2] = _mm256_set1_epi8(0x4);
|
||||
masks[3] = _mm256_set1_epi8(0x8);
|
||||
masks[4] = _mm256_set1_epi8(0x10);
|
||||
masks[5] = _mm256_set1_epi8(0x20);
|
||||
masks[6] = _mm256_set1_epi8(0x40);
|
||||
masks[7] = _mm256_set1_epi8(0x80);
|
||||
#endif
|
||||
|
||||
AssertFatal((impp->n_segments>0&&impp->n_segments<=8),"0 < n_segments %d <= 8\n",impp->n_segments);
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
//else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
//BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
rate=5;
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
|
||||
#endif
|
||||
|
||||
AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
|
||||
|
||||
if ((Zc&31) > 0) simd_size = 16;
|
||||
else simd_size = 32;
|
||||
|
||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||
|
||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
||||
|
||||
// calculate number of punctured bits
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
|
||||
// printf("%d\n",no_punctured_columns);
|
||||
// printf("%d\n",removed_bit);
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
|
||||
if(impp->tinput != NULL) start_meas(impp->tinput);
|
||||
#if 0
|
||||
for (i=0; i<block_length; i++) {
|
||||
for (j=0; j<n_segments; j++) {
|
||||
|
||||
temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||
c[i] |= (temp << j);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef __AVX2__
|
||||
for (i=0; i<block_length>>5; i++) {
|
||||
c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[0])[i]), shufmask),andmask),zero256),masks[0]);
|
||||
for (j=1; j<impp->n_segments; j++) {
|
||||
c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[j])[i]), shufmask),andmask),zero256),masks[j]),c256);
|
||||
}
|
||||
((__m256i *)c)[i] = c256;
|
||||
}
|
||||
|
||||
for (i=(block_length>>5)<<5;i<block_length;i++) {
|
||||
for (j=0; j<impp->n_segments; j++) {
|
||||
|
||||
temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||
c[i] |= (temp << j);
|
||||
}
|
||||
}
|
||||
#else
|
||||
AssertFatal(1==0,"Need AVX2 for this\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(impp->tinput != NULL) stop_meas(impp->tinput);
|
||||
|
||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||
// extend matrix
|
||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||
for (i1=0; i1 < ncols; i1++)
|
||||
{
|
||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
}
|
||||
for (i1=1;i1<simd_size;i1++) {
|
||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
||||
/*
|
||||
printf("shift %d: ",i1);
|
||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
||||
printf("\n");
|
||||
*/
|
||||
}
|
||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||
//parity check part
|
||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||
}
|
||||
else {
|
||||
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
|
||||
printf("Problem with encoder\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if(impp->toutput != NULL) start_meas(impp->toutput);
|
||||
// information part and puncture columns
|
||||
/*
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
*/
|
||||
#ifdef __AVX2__
|
||||
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||
//AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
|
||||
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
||||
uint32_t l1 = (block_length-(2*Zc))>>5;
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
||||
__m256i *c256p = (__m256i *)&c[2*Zc];
|
||||
__m256i *d256p = (__m256i *)&d[0];
|
||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||
|
||||
for (i=0;i<l1;i++)
|
||||
for (j=0;j<impp->n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
|
||||
|
||||
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
||||
|
||||
for (i1=0;i1<l2;i1++,i++)
|
||||
for (j=0;j<impp->n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_W(PHY,"using non-optimized version\n");
|
||||
#endif
|
||||
// do non-SIMD version
|
||||
for (i=0;i<(block_length-2*Zc);i++)
|
||||
for (j=0; j<impp->n_segments; j++)
|
||||
channel_input[j][i] = (c[2*Zc+i]>>j)&1;
|
||||
for (i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
|
||||
for (j=0; j<impp->n_segments; j++)
|
||||
channel_input[j][block_length-2*Zc+i] = (d[i]>>j)&1;
|
||||
}
|
||||
|
||||
#else
|
||||
AssertFatal(1==0,"Need AVX2 for now\n");
|
||||
#endif
|
||||
|
||||
if(impp->toutput != NULL) stop_meas(impp->toutput);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file ldpc_encoder2.c
|
||||
* \brief Defines the optimized LDPC encoder
|
||||
* \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
|
||||
* \email openair_tech@eurecom.fr
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||
|
||||
//#define DEBUG_LDPC
|
||||
|
||||
#include "ldpc_encode_parity_check.c"
|
||||
#include "ldpc_generate_coefficient.c"
|
||||
|
||||
|
||||
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
|
||||
{
|
||||
|
||||
short nrows=0,ncols=0;
|
||||
int i,i1,j,rate=3;
|
||||
int no_punctured_columns,removed_bit;
|
||||
//Table of possible lifting sizes
|
||||
char temp;
|
||||
int simd_size;
|
||||
unsigned int macro_segment, macro_segment_end;
|
||||
|
||||
|
||||
macro_segment = 8*impp->macro_num;
|
||||
macro_segment_end = (impp->n_segments > 8*(impp->macro_num+1)) ? 8*(impp->macro_num+1) : impp->n_segments;
|
||||
///printf("macro_segment: %d\n", macro_segment);
|
||||
///printf("macro_segment_end: %d\n", macro_segment_end );
|
||||
|
||||
#ifdef __AVX2__
|
||||
__m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000);
|
||||
__m256i andmask = _mm256_set1_epi64x(0x0102040810204080); // every 8 bits -> 8 bytes, pattern repeats.
|
||||
__m256i zero256 = _mm256_setzero_si256();
|
||||
__m256i masks[8];
|
||||
register __m256i c256;
|
||||
masks[0] = _mm256_set1_epi8(0x1);
|
||||
masks[1] = _mm256_set1_epi8(0x2);
|
||||
masks[2] = _mm256_set1_epi8(0x4);
|
||||
masks[3] = _mm256_set1_epi8(0x8);
|
||||
masks[4] = _mm256_set1_epi8(0x10);
|
||||
masks[5] = _mm256_set1_epi8(0x20);
|
||||
masks[6] = _mm256_set1_epi8(0x40);
|
||||
masks[7] = _mm256_set1_epi8(0x80);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//determine number of bits in codeword
|
||||
if (BG==1)
|
||||
{
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
else if (BG==2)
|
||||
{
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
rate=5;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
|
||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
|
||||
#endif
|
||||
|
||||
AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
|
||||
|
||||
if ((Zc&31) > 0) simd_size = 16;
|
||||
else simd_size = 32;
|
||||
|
||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||
|
||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
||||
|
||||
// calculate number of punctured bits
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
|
||||
//printf("%d\n",no_punctured_columns);
|
||||
//printf("%d\n",removed_bit);
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
|
||||
if(impp->tinput != NULL) start_meas(impp->tinput);
|
||||
#if 0
|
||||
for (i=0; i<block_length; i++) {
|
||||
//for (j=0; j<n_segments; j++) {
|
||||
for (j=macro_segment; j < macro_segment_end; j++) {
|
||||
|
||||
temp = (test_input[j][i/8]&(1<<(i&7)))>>(i&7);
|
||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||
c[i] |= (temp << (j-macro_segment));
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef __AVX2__
|
||||
for (i=0; i<block_length>>5; i++) {
|
||||
c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[macro_segment])[i]), shufmask),andmask),zero256),masks[0]);
|
||||
//for (j=1; j<n_segments; j++) {
|
||||
for (j=macro_segment+1; j < macro_segment_end; j++) {
|
||||
c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[j])[i]), shufmask),andmask),zero256),masks[j-macro_segment]),c256);
|
||||
}
|
||||
((__m256i *)c)[i] = c256;
|
||||
}
|
||||
|
||||
for (i=(block_length>>5)<<5;i<block_length;i++) {
|
||||
//for (j=0; j<n_segments; j++) {
|
||||
for (j=macro_segment; j < macro_segment_end; j++) {
|
||||
|
||||
temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||
c[i] |= (temp << (j-macro_segment));
|
||||
}
|
||||
}
|
||||
#else
|
||||
AssertFatal(1==0,"Need AVX2 for this\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(impp->tinput != NULL) stop_meas(impp->tinput);
|
||||
|
||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||
// extend matrix
|
||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||
for (i1=0; i1 < ncols; i1++)
|
||||
{
|
||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
||||
}
|
||||
for (i1=1;i1<simd_size;i1++) {
|
||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
||||
/*
|
||||
printf("shift %d: ",i1);
|
||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
||||
printf("\n");
|
||||
*/
|
||||
}
|
||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||
//parity check part
|
||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||
}
|
||||
else {
|
||||
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
|
||||
printf("Problem with encoder\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if(impp->toutput != NULL) start_meas(impp->toutput);
|
||||
// information part and puncture columns
|
||||
/*
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
*/
|
||||
#ifdef __AVX2__
|
||||
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||
//AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
|
||||
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
||||
uint32_t l1 = (block_length-(2*Zc))>>5;
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
||||
__m256i *c256p = (__m256i *)&c[2*Zc];
|
||||
__m256i *d256p = (__m256i *)&d[0];
|
||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||
|
||||
for (i=0;i<l1;i++)
|
||||
//for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
|
||||
for (j=macro_segment; j < macro_segment_end; j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
|
||||
|
||||
|
||||
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
||||
|
||||
for (i1=0;i1<l2;i1++,i++)
|
||||
//for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
||||
for (j=macro_segment; j < macro_segment_end; j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_W(PHY,"using non-optimized version\n");
|
||||
#endif
|
||||
// do non-SIMD version
|
||||
for (i=0;i<(block_length-2*Zc);i++)
|
||||
//for (j=0; j<n_segments; j++)
|
||||
for (j=macro_segment; j < macro_segment_end; j++)
|
||||
channel_input[j][i] = (c[2*Zc+i]>>(j-macro_segment))&1;
|
||||
for (i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
|
||||
//for (j=0; j<n_segments; j++)
|
||||
for (j=macro_segment; j < macro_segment_end; j++)
|
||||
channel_input[j][block_length-2*Zc+i] = (d[i]>>(j-macro_segment))&1;
|
||||
}
|
||||
|
||||
#else
|
||||
AssertFatal(1==0,"Need AVX2 for now\n");
|
||||
#endif
|
||||
|
||||
if(impp->toutput != NULL) stop_meas(impp->toutput);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@
|
||||
#include <string.h>
|
||||
#include "Gen_shift_value.h"
|
||||
#include "assertions.h"
|
||||
#include "defs.h"
|
||||
|
||||
short *choose_generator_matrix(short BG,short Zc)
|
||||
static inline short *choose_generator_matrix(short BG,short Zc)
|
||||
{
|
||||
short *Gen_shift_values = NULL;
|
||||
|
||||
@@ -361,237 +360,70 @@ short *choose_generator_matrix(short BG,short Zc)
|
||||
return Gen_shift_values;
|
||||
}
|
||||
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int Zc,int Kb,short block_length, short BG,unsigned char gen_code)
|
||||
static inline int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length)
|
||||
{
|
||||
unsigned char c[22*384]; //padded input, unpacked, max size
|
||||
unsigned char d[68*384]; //coded output, unpacked, max size
|
||||
short *Gen_shift_values=choose_generator_matrix(BG,Zc);
|
||||
short *no_shift_values, *pointer_shift_values;
|
||||
int no_punctured_columns;
|
||||
short nrows,ncols,rate=3;
|
||||
int i1,i2,i3,i4,i5,temp_prime;
|
||||
unsigned char channel_temp,temp;
|
||||
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
|
||||
|
||||
short nrows = 46;//parity check bits
|
||||
short ncols = 22;//info bits
|
||||
|
||||
|
||||
int i,i1,i2,i3,i4,i5,temp_prime,var;
|
||||
int no_punctured_columns,removed_bit,rate=3;
|
||||
int nind=0;
|
||||
int indlist[1000];
|
||||
int indlist2[1000];
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
//else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
//BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
rate=5;
|
||||
}
|
||||
|
||||
Gen_shift_values=choose_generator_matrix(BG,Zc);
|
||||
if (Gen_shift_values==NULL) {
|
||||
printf("ldpc_encoder_orig: could not find generator matrix\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//printf("ldpc_encoder_orig: BG %d, Zc %d, Kb %d\n",BG, Zc, Kb);
|
||||
|
||||
// load base graph of generator matrix
|
||||
if (BG==1)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG1;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG1;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
rate=3;
|
||||
}
|
||||
else if (BG==2)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG2;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; //info bits
|
||||
rate=5;
|
||||
}
|
||||
else {
|
||||
AssertFatal(0,"BG %d is not supported yet\n",BG);
|
||||
printf("problem with BG\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*rate);
|
||||
//printf("%d\n",no_punctured_columns);
|
||||
//printf("%d\n",removed_bit);
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
|
||||
for (i=0; i<block_length; i++)
|
||||
//printf("no_punctured_columns = %d\n",no_punctured_columns);
|
||||
|
||||
for (i2=0; i2 < Zc; i2++)
|
||||
{
|
||||
//c[i] = test_input[i/8]<<(i%8);
|
||||
//c[i]=c[i]>>7&1;
|
||||
c[i]=(test_input[i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||
}
|
||||
//t=Kb*Zc+i2;
|
||||
|
||||
// parity check part
|
||||
|
||||
if (gen_code==1)
|
||||
{
|
||||
char fname[100];
|
||||
sprintf(fname,"ldpc_BG%d_Zc%d_byte.c",BG,Zc);
|
||||
FILE *fd=fopen(fname,"w");
|
||||
AssertFatal(fd!=NULL,"cannot open %s\n",fname);
|
||||
sprintf(fname,"ldpc_BG%d_Zc%d_16bit.c",BG,Zc);
|
||||
FILE *fd2=fopen(fname,"w");
|
||||
AssertFatal(fd2!=NULL,"cannot open %s\n",fname);
|
||||
|
||||
int shift;
|
||||
char data_type[100];
|
||||
char xor_command[100];
|
||||
int mask;
|
||||
|
||||
|
||||
|
||||
|
||||
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
|
||||
fprintf(fd2,"#include \"PHY/sse_intrin.h\"\n");
|
||||
|
||||
if ((Zc&31)==0) {
|
||||
shift=5; // AVX2 - 256-bit SIMD
|
||||
mask=31;
|
||||
strcpy(data_type,"__m256i");
|
||||
strcpy(xor_command,"_mm256_xor_si256");
|
||||
}
|
||||
else if ((Zc&15)==0) {
|
||||
shift=4; // SSE4 - 128-bit SIMD
|
||||
mask=15;
|
||||
strcpy(data_type,"__m128i");
|
||||
strcpy(xor_command,"_mm_xor_si128");
|
||||
|
||||
}
|
||||
else if ((Zc&7)==0) {
|
||||
shift=3; // MMX - 64-bit SIMD
|
||||
mask=7;
|
||||
strcpy(data_type,"__m64");
|
||||
strcpy(xor_command,"_mm_xor_si64");
|
||||
}
|
||||
else {
|
||||
shift=0; // no SIMD
|
||||
mask=0;
|
||||
strcpy(data_type,"uint8_t");
|
||||
strcpy(xor_command,"scalar_xor");
|
||||
fprintf(fd,"#define scalar_xor(a,b) ((a)^(b))\n");
|
||||
fprintf(fd2,"#define scalar_xor(a,b) ((a)^(b))\n");
|
||||
}
|
||||
fprintf(fd,"// generated code for Zc=%d, byte encoding\n",Zc);
|
||||
fprintf(fd2,"// generated code for Zc=%d, 16bit encoding\n",Zc);
|
||||
fprintf(fd,"static inline void ldpc_BG%d_Zc%d_byte(uint8_t *c,uint8_t *d) {\n",BG,Zc);
|
||||
fprintf(fd2,"static inline void ldpc_BG%d_Zc%d_16bit(uint16_t *c,uint16_t *d) {\n",BG,Zc);
|
||||
fprintf(fd," %s *csimd=(%s *)c,*dsimd=(%s *)d;\n\n",data_type,data_type,data_type);
|
||||
fprintf(fd2," %s *csimd=(%s *)c,*dsimd=(%s *)d;\n\n",data_type,data_type,data_type);
|
||||
fprintf(fd," %s *c2,*d2;\n\n",data_type);
|
||||
fprintf(fd2," %s *c2,*d2;\n\n",data_type);
|
||||
fprintf(fd," int i2;\n");
|
||||
fprintf(fd2," int i2;\n");
|
||||
fprintf(fd," for (i2=0; i2<%d; i2++) {\n",Zc>>shift);
|
||||
if (shift > 0)
|
||||
fprintf(fd2," for (i2=0; i2<%d; i2++) {\n",Zc>>(shift-1));
|
||||
for (i2=0; i2 < 1; i2++)
|
||||
//rotate matrix here
|
||||
for (i5=0; i5 < Kb; i5++)
|
||||
{
|
||||
//t=Kb*Zc+i2;
|
||||
|
||||
// calculate each row in base graph
|
||||
|
||||
|
||||
fprintf(fd," c2=&csimd[i2];\n");
|
||||
fprintf(fd," d2=&dsimd[i2];\n");
|
||||
fprintf(fd2," c2=&csimd[i2];\n");
|
||||
fprintf(fd2," d2=&dsimd[i2];\n");
|
||||
|
||||
for (i1=0; i1 < nrows; i1++)
|
||||
|
||||
{
|
||||
channel_temp=0;
|
||||
fprintf(fd,"\n//row: %d\n",i1);
|
||||
fprintf(fd2,"\n//row: %d\n",i1);
|
||||
fprintf(fd," d2[%d]=",(Zc*i1)>>shift);
|
||||
fprintf(fd2," d2[%d]=",(Zc*i1)>>(shift-1));
|
||||
|
||||
nind=0;
|
||||
|
||||
for (i3=0; i3 < ncols; i3++)
|
||||
{
|
||||
temp_prime=i1 * ncols + i3;
|
||||
|
||||
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
{
|
||||
|
||||
var=(int)((i3*Zc + (Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ]+1)%Zc)/Zc);
|
||||
int index =var*2*Zc + (i3*Zc + (Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ]+1)%Zc) % Zc;
|
||||
|
||||
indlist[nind] = ((index&mask)*((2*Zc)>>shift)*Kb)+(index>>shift);
|
||||
indlist2[nind++] = ((index&(mask>>1))*((2*Zc)>>(shift-1))*Kb)+(index>>(shift-1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for (i4=0;i4<nind-1;i4++) {
|
||||
fprintf(fd,"%s(c2[%d],",xor_command,indlist[i4]);
|
||||
fprintf(fd2,"%s(c2[%d],",xor_command,indlist2[i4]);
|
||||
}
|
||||
fprintf(fd,"c2[%d]",indlist[i4]);
|
||||
fprintf(fd2,"c2[%d]",indlist2[i4]);
|
||||
for (i4=0;i4<nind-1;i4++) { fprintf(fd,")"); fprintf(fd2,")"); }
|
||||
fprintf(fd,";\n");
|
||||
fprintf(fd2,";\n");
|
||||
|
||||
}
|
||||
fprintf(fd," }\n}\n");
|
||||
fprintf(fd2," }\n}\n");
|
||||
temp = c[i5*Zc];
|
||||
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned char));
|
||||
c[i5*Zc+Zc-1] = temp;
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fd2);
|
||||
}
|
||||
else if(gen_code==0)
|
||||
{
|
||||
for (i2=0; i2 < Zc; i2++)
|
||||
|
||||
// calculate each row in base graph
|
||||
for (i1=0; i1 < nrows-no_punctured_columns; i1++)
|
||||
{
|
||||
//t=Kb*Zc+i2;
|
||||
|
||||
//rotate matrix here
|
||||
for (i5=0; i5 < Kb; i5++)
|
||||
channel_temp=0;
|
||||
for (i3=0; i3 < Kb; i3++)
|
||||
{
|
||||
temp = c[i5*Zc];
|
||||
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned char));
|
||||
c[i5*Zc+Zc-1] = temp;
|
||||
}
|
||||
temp_prime=i1 * ncols + i3;
|
||||
|
||||
// calculate each row in base graph
|
||||
for (i1=0; i1 < nrows-no_punctured_columns; i1++)
|
||||
{
|
||||
channel_temp=0;
|
||||
|
||||
for (i3=0; i3 < Kb; i3++)
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
{
|
||||
temp_prime=i1 * ncols + i3;
|
||||
|
||||
for (i4=0; i4 < no_shift_values[temp_prime]; i4++)
|
||||
{
|
||||
channel_temp = channel_temp ^ c[ i3*Zc + Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ] ];
|
||||
}
|
||||
channel_temp = channel_temp ^ c[ i3*Zc + Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ] ];
|
||||
}
|
||||
|
||||
d[i2+i1*Zc]=channel_temp;
|
||||
//channel_input[t+i1*Zc]=channel_temp;
|
||||
}
|
||||
d[i2+i1*Zc]=channel_temp;
|
||||
//channel_input[t+i1*Zc]=channel_temp;
|
||||
}
|
||||
}
|
||||
|
||||
// information part and puncture columns
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
//memcpy(channel_input,c,Kb*Zc*sizeof(unsigned char));
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
+14
-25
@@ -18,29 +18,18 @@
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||
|
||||
/*!\file nrLDPC_decoder.h
|
||||
* \brief Defines the LDPC decoder core prototypes
|
||||
* \author Sebastian Wagner (TCL Communications) Email: <mailto:sebastian.wagner@tcl.com>
|
||||
* \date 27-03-2018
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __NR_LDPC_DECODER__H__
|
||||
#define __NR_LDPC_DECODER__H__
|
||||
|
||||
#include "nrLDPC_types.h"
|
||||
#include "nrLDPC_init_mem.h"
|
||||
|
||||
/**
|
||||
\brief LDPC decoder
|
||||
\param p_decParams LDPC decoder parameters
|
||||
\param p_llr Input LLRs
|
||||
\param p_llrOut Output vector
|
||||
\param p_profiler LDPC profiler statistics
|
||||
*/
|
||||
int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_llrOut, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler);
|
||||
|
||||
#endif
|
||||
#ifdef LDPC_LOADER
|
||||
nrLDPC_decoderfunc_t nrLDPC_decoder;
|
||||
nrLDPC_encoderfunc_t nrLDPC_encoder;
|
||||
#else
|
||||
/* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */
|
||||
extern int load_nrLDPClib(void) ;
|
||||
extern int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr); // for ldpctest
|
||||
/* ldpc coder/decoder functions, as loaded by load_nrLDPClib(). */
|
||||
extern nrLDPC_decoderfunc_t nrLDPC_decoder;
|
||||
extern nrLDPC_encoderfunc_t nrLDPC_encoder;
|
||||
// inline functions:
|
||||
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file openair1/PHY/CODING/coding_nr_load.c
|
||||
* \brief: load library implementing coding/decoding algorithms
|
||||
* \author Francois TABURET
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#define LDPC_LOADER
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
|
||||
|
||||
/* function description array, to be used when loading the encoding/decoding shared lib */
|
||||
static loader_shlibfunc_t shlib_fdesc[2];
|
||||
|
||||
char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0"};
|
||||
|
||||
int load_nrLDPClib(void) {
|
||||
char *ptr = (char*)config_get_if();
|
||||
if ( ptr==NULL ) {// phy simulators, config module possibly not loaded
|
||||
load_configmodule(3,(char **)arg,CONFIG_ENABLECMDLINEONLY) ;
|
||||
logInit();
|
||||
}
|
||||
shlib_fdesc[0].fname = "nrLDPC_decod";
|
||||
shlib_fdesc[1].fname = "nrLDPC_encod";
|
||||
int ret=load_module_shlib("ldpc",shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading ldpc decoder");
|
||||
nrLDPC_decoder = (nrLDPC_decoderfunc_t)shlib_fdesc[0].fptr;
|
||||
nrLDPC_encoder = (nrLDPC_encoderfunc_t)shlib_fdesc[1].fptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr) {
|
||||
loader_shlibfunc_t shlib_encoder_fdesc;
|
||||
|
||||
shlib_encoder_fdesc.fname = "nrLDPC_encod";
|
||||
char libpath[64];
|
||||
sprintf(libpath,"ldpc%s",libversion);
|
||||
int ret=load_module_shlib(libpath,&shlib_encoder_fdesc,1,NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading ldpc encoder %s\n",libpath);
|
||||
*nrLDPC_encoder_ptr = (nrLDPC_encoderfunc_t)shlib_encoder_fdesc.fptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
//#define DEBUG_SEGMENTATION
|
||||
|
||||
int32_t nr_segmentation(unsigned char *input_buffer,
|
||||
unsigned char **output_buffers,
|
||||
unsigned int B,
|
||||
unsigned int *C,
|
||||
unsigned int *K,
|
||||
unsigned int *Zout, // [hna] Zout is Zc
|
||||
unsigned int *F,
|
||||
uint8_t BG)
|
||||
unsigned char **output_buffers,
|
||||
unsigned int B,
|
||||
unsigned int *C,
|
||||
unsigned int *K,
|
||||
unsigned int *Zout, // [hna] Zout is Zc
|
||||
unsigned int *F,
|
||||
uint8_t BG)
|
||||
{
|
||||
|
||||
unsigned int L,Bprime,Z,r,Kcb,Kb,k,s,crc,Kprime;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"*/
|
||||
#include "openair1/PHY/defs_RU.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_extern.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
@@ -112,6 +113,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
|
||||
crcTableInit();
|
||||
init_dfts();
|
||||
load_nrLDPClib();
|
||||
// PBCH DMRS gold sequences generation
|
||||
nr_init_pbch_dmrs(gNB);
|
||||
//PDCCH DMRS init
|
||||
@@ -154,7 +156,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
|
||||
//PUSCH DMRS init
|
||||
gNB->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(2*sizeof(uint32_t ***));
|
||||
uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs;
|
||||
|
||||
uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs;
|
||||
|
||||
for(int nscid=0; nscid<2; nscid++) {
|
||||
pusch_dmrs[nscid] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
|
||||
@@ -174,7 +177,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
uint32_t Nid_pusch[2] = {cfg->cell_config.phy_cell_id.value,cfg->cell_config.phy_cell_id.value};
|
||||
nr_gold_pusch(gNB, &Nid_pusch[0]);
|
||||
|
||||
//
|
||||
/// Transport init necessary for NR synchro
|
||||
init_nr_transport(gNB);
|
||||
|
||||
@@ -241,6 +243,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates_time = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_mag0 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
|
||||
@@ -256,6 +260,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||
pusch_vars[ULSCH_id]->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
|
||||
pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2*fp->symbols_per_slot ); // max intensity in freq is 1 sc every 2 RBs
|
||||
pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2*fp->symbols_per_slot );
|
||||
pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||
pusch_vars[ULSCH_id]->ul_ch_mag0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*N_RB_UL*12 );
|
||||
pusch_vars[ULSCH_id]->ul_ch_magb0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*N_RB_UL*12 );
|
||||
@@ -324,6 +330,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb0[i]);
|
||||
@@ -336,6 +344,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0);
|
||||
|
||||
@@ -655,6 +655,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
|
||||
int n_scid;
|
||||
abstraction_flag = 0;
|
||||
fp->nb_antennas_tx = 1;
|
||||
fp->nb_antennas_rx=1;
|
||||
dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_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_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
||||
phy_init_nr_top(ue);
|
||||
@@ -706,9 +710,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
//------------- config DMRS parameters--------------//
|
||||
ue->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1;
|
||||
ue->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
|
||||
ue->dmrs_UplinkConfig.pusch_maxLength = pusch_len1;
|
||||
dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1;
|
||||
dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
|
||||
dmrs_Uplink_Config->pusch_maxLength = pusch_len1;
|
||||
//-------------------------------------------------//
|
||||
ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1;
|
||||
ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0;
|
||||
@@ -738,6 +742,23 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////PUSCH PTRS init/////////////////////////
|
||||
///////////
|
||||
|
||||
ue->ptrs_configured = 0; // flag to be toggled by RCC
|
||||
|
||||
//------------- config PTRS parameters--------------//
|
||||
ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration
|
||||
ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 0;
|
||||
ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 0;
|
||||
ptrs_Uplink_Config->frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration
|
||||
ptrs_Uplink_Config->frequencyDensity.n_rb1 = 0;
|
||||
ptrs_Uplink_Config->resourceElementOffset = 0;
|
||||
//-------------------------------------------------//
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
ue->tx_power_dBm[i]=-127;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
//uint8_t ncs_cell[20][7];
|
||||
//#define DEBUG_PUCCH_TXS
|
||||
@@ -801,9 +801,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
for (j=0; j<NUMBER_OF_UE_MAX; j++) {
|
||||
eNB->pucch1_stats_cnt[j][i]=0;
|
||||
eNB->pucch1ab_stats_cnt[j][i]=0;
|
||||
#if defined(USRP_REC_PLAY) // not 100% sure
|
||||
eNB->pucch1_stats_thres[j][i]=0;
|
||||
#endif
|
||||
if ( IS_SOFTMODEM_IQPLAYER)
|
||||
eNB->pucch1_stats_thres[j][i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1193,15 +1192,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
stat_re=0;
|
||||
stat_im=0;
|
||||
// Do detection now
|
||||
#if defined(USRP_REC_PLAY)
|
||||
|
||||
// It looks like the value is a bit messy when RF is replayed.
|
||||
|
||||
// It looks like the pucch1_thres value is a bit messy when RF is replayed.
|
||||
// For instance i assume to skip pucch1_thres from the test below.
|
||||
// Not 100% sure
|
||||
if (sigma2_dB<(dB_fixed(stat_max))) {//
|
||||
#else
|
||||
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
|
||||
#endif
|
||||
|
||||
if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
|
||||
chL = (nsymb>>1)-4;
|
||||
chest_mag=0;
|
||||
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
|
||||
@@ -1339,11 +1336,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
if (fmt==pucch_format1b)
|
||||
*(1+payload) = (stat_im<0) ? 1 : 2;
|
||||
} else { // insufficient energy on PUCCH so NAK
|
||||
#if defined(USRP_REC_PLAY)
|
||||
LOG_D(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
#else
|
||||
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
#endif
|
||||
*payload = 4; // DTX
|
||||
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
|
||||
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
|
||||
|
||||
@@ -139,7 +139,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||
abs_symbol = Ns * frame_parms->symbols_per_slot + symbol;
|
||||
|
||||
for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb < abs_symbol; idx_symb++)
|
||||
rx_offset += (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
|
||||
rx_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
|
||||
|
||||
rx_offset += frame_parms->ofdm_symbol_size * symbol;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
/*
|
||||
#ifdef DEBUG_CH
|
||||
printf("PUSCH Channel Estimation : gNB_offset %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n", gNB_offset,ch_offset,symbol_offset,gNB->frame_parms.ofdm_symbol_size,
|
||||
printf("PUSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n", ,ch_offset,symbol_offset,gNB->frame_parms.ofdm_symbol_size,
|
||||
gNB->frame_parms.Ncp,l,Ns,k, symbol);
|
||||
#endif
|
||||
*/
|
||||
|
||||
@@ -129,19 +129,17 @@ uint8_t is_dmrs_symbol(uint8_t l,
|
||||
uint16_t n,
|
||||
uint8_t delta,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t start_symbol,
|
||||
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
|
||||
uint8_t mapping_type,
|
||||
uint8_t dmrs_type,
|
||||
uint16_t ofdm_symbol_size) {
|
||||
|
||||
uint8_t is_dmrs_freq, is_dmrs_time, dmrs_type, l0;
|
||||
uint8_t is_dmrs_freq, is_dmrs_time, l0;
|
||||
int32_t l_prime_mask;
|
||||
pusch_dmrs_AdditionalPosition_t additional_pos;
|
||||
pusch_dmrs_AdditionalPosition_t additional_pos = pusch_dmrs_pos0;
|
||||
pusch_maxLength_t pusch_maxLength = pusch_len1;
|
||||
uint8_t mapping_type = typeB;
|
||||
|
||||
is_dmrs_freq = 0;
|
||||
is_dmrs_time = 0;
|
||||
dmrs_type = dmrs_UplinkConfig->pusch_dmrs_type;
|
||||
additional_pos = dmrs_UplinkConfig->pusch_dmrs_AdditionalPosition;
|
||||
|
||||
if (mapping_type==typeB)
|
||||
l -= start_symbol;
|
||||
@@ -150,7 +148,7 @@ uint8_t is_dmrs_symbol(uint8_t l,
|
||||
|
||||
|
||||
l0 = get_l0_ul(mapping_type, 2);
|
||||
l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, dmrs_UplinkConfig->pusch_maxLength);
|
||||
l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, pusch_maxLength);
|
||||
|
||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%ofdm_symbol_size))
|
||||
is_dmrs_freq = 1;
|
||||
@@ -164,7 +162,7 @@ uint8_t is_dmrs_symbol(uint8_t l,
|
||||
} else if ( (l==l0) || (((l_prime_mask>>l)&1) == 1 && l!=0) )
|
||||
is_dmrs_time = 1;
|
||||
|
||||
if (dmrs_UplinkConfig->pusch_maxLength == pusch_len2){
|
||||
if (pusch_maxLength == pusch_len2){
|
||||
|
||||
if (((l_prime_mask>>(l-1))&1) == 1 && l!=0 && l!=1)
|
||||
is_dmrs_time = 1;
|
||||
|
||||
@@ -66,9 +66,7 @@ uint8_t is_dmrs_symbol(uint8_t l,
|
||||
uint16_t n,
|
||||
uint8_t delta,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t start_symbol,
|
||||
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
|
||||
uint8_t mapping_type,
|
||||
uint8_t dmrs_type,
|
||||
uint16_t ofdm_symbol_size);
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILENAME : ptrs_nr.c
|
||||
*
|
||||
* MODULE : phase tracking reference signals
|
||||
*
|
||||
* DESCRIPTION : resource element mapping of ptrs sequences
|
||||
* 3GPP TS 38.211 and 3GPP TS 38.214
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "dmrs_nr.h"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
//#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
// TS 38.211 Table 6.4.1.2.2.1-1: The parameter kRE_ref.
|
||||
// The first 4 colomns are DM-RS Configuration type 1 and the last 4 colomns are DM-RS Configuration type 2.
|
||||
|
||||
int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = {
|
||||
{ 0, 2, 6, 8, 0, 1, 6, 7},
|
||||
{ 2, 4, 8, 10, 1, 6, 7, 0},
|
||||
{ 1, 3, 7, 9, 2, 3, 8, 9},
|
||||
{ 3, 5, 9, 11, 3, 8, 9, 2},
|
||||
{-1, -1, -1, -1, 4, 5, 10, 11},
|
||||
{-1, -1, -1, -1, 5, 10, 11, 4},
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : get_kRE_ref
|
||||
*
|
||||
* PARAMETERS : dmrs_antenna_port DMRS antenna port
|
||||
* pusch_dmrs_type PUSCH DMRS type
|
||||
* resourceElementOffset the parameter resourceElementOffset
|
||||
*
|
||||
* RETURN : the parameter k_RE_ref
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.211 Table 6.4.1.2.2.1-1
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) {
|
||||
|
||||
uint8_t colomn;
|
||||
int16_t k_RE_ref;
|
||||
|
||||
colomn = resourceElementOffset;
|
||||
|
||||
if (pusch_dmrs_type == 2)
|
||||
colomn += 4;
|
||||
|
||||
k_RE_ref = table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[dmrs_antenna_port][colomn];
|
||||
|
||||
AssertFatal(k_RE_ref>=0,"invalid k_RE_ref < 0. Check PTRS Configuration\n");
|
||||
|
||||
return k_RE_ref;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : get_K_ptrs
|
||||
*
|
||||
* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration
|
||||
* N_RB number of RBs scheduled for PUSCH
|
||||
*
|
||||
* RETURN : the parameter K_ptrs
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-2
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){
|
||||
|
||||
uint16_t nrb0, nrb1;
|
||||
|
||||
nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0;
|
||||
nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1;
|
||||
|
||||
if (nrb0 == 0 || nrb0 == 0)
|
||||
return 2;
|
||||
|
||||
if (N_RB < nrb0){
|
||||
LOG_I(PHY,"PUSH PT-RS is not present.\n");
|
||||
return 0;
|
||||
}
|
||||
else if (N_RB >= nrb0 && N_RB < nrb1)
|
||||
return 2;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : set_ptrs_symb_idx
|
||||
*
|
||||
* PARAMETERS : ptrs_symbols PTRS OFDM symbol indicies bit mask
|
||||
* duration_in_symbols number of scheduled PUSCH ofdm symbols
|
||||
* start_symbol first ofdm symbol of PUSCH within slot
|
||||
* L_ptrs the parameter L_ptrs
|
||||
* ofdm_symbol_size FFT size
|
||||
*
|
||||
* RETURN : sets the bit map of PTRS ofdm symbol indicies
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2.2.1
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t start_symbol,
|
||||
uint8_t dmrs_type,
|
||||
uint8_t L_ptrs,
|
||||
uint8_t pusch_maxLength,
|
||||
uint16_t ofdm_symbol_size) {
|
||||
|
||||
uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2;
|
||||
int16_t l_ref;
|
||||
|
||||
*ptrs_symbols = 0;
|
||||
i = 0;
|
||||
is_dmrs_symbol1 = 0;
|
||||
is_dmrs_symbol2 = 0;
|
||||
l_ref = start_symbol;
|
||||
last_symbol = start_symbol + duration_in_symbols - 1;
|
||||
|
||||
while ( (l_ref + i*L_ptrs) <= last_symbol) {
|
||||
|
||||
is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
duration_in_symbols,
|
||||
dmrs_type,
|
||||
ofdm_symbol_size);
|
||||
|
||||
is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
duration_in_symbols,
|
||||
dmrs_type,
|
||||
ofdm_symbol_size);
|
||||
|
||||
if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) {
|
||||
|
||||
if (pusch_maxLength == 2)
|
||||
l_ref = l_ref + i*L_ptrs + 1;
|
||||
else
|
||||
l_ref = l_ref + i*L_ptrs;
|
||||
|
||||
i = 1;
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
*ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : get_L_ptrs
|
||||
*
|
||||
* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration
|
||||
* I_mcs MCS index used for PUSCH
|
||||
*
|
||||
* RETURN : the parameter L_ptrs
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-1
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) {
|
||||
|
||||
uint8_t mcs1, mcs2, mcs3;
|
||||
|
||||
mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1;
|
||||
mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2;
|
||||
mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3;
|
||||
|
||||
if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0)
|
||||
return 1;
|
||||
|
||||
if (I_mcs < mcs1){
|
||||
LOG_I(PHY,"PUSH PT-RS is not present.\n");
|
||||
return 0;
|
||||
}
|
||||
else if (I_mcs >= mcs1 && I_mcs < mcs2)
|
||||
return 4;
|
||||
else if (I_mcs >= mcs2 && I_mcs < mcs3)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : is_ptrs_subcarrier
|
||||
*
|
||||
* PARAMETERS : k subcarrier index
|
||||
* K_ptrs the parameter K_ptrs
|
||||
* n_rnti UE CRNTI
|
||||
* N_RB number of RBs scheduled for PUSCH
|
||||
* k_RE_ref the parameter k_RE_ref
|
||||
* start_sc first subcarrier index
|
||||
* ofdm_symbol_size FFT size
|
||||
*
|
||||
* RETURN : 1 if subcarrier k is PTRS, or 0 otherwise
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) {
|
||||
|
||||
uint16_t k_RB_ref, i, sc;
|
||||
|
||||
i = 0;
|
||||
sc = 0;
|
||||
k_RB_ref = 0;
|
||||
|
||||
if (N_RB % K_ptrs == 0)
|
||||
k_RB_ref = n_rnti % K_ptrs;
|
||||
else
|
||||
k_RB_ref = n_rnti % (N_RB % K_ptrs);
|
||||
|
||||
while (k > sc){
|
||||
|
||||
sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size;
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
if (k == sc)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : is_ptrs_symbol
|
||||
*
|
||||
* PARAMETERS : l ofdm symbol index within slot
|
||||
* k subcarrier index
|
||||
* n_rnti UE CRNTI
|
||||
* N_RB number of RBs scheduled for PUSCH
|
||||
* duration_in_symbols number of scheduled PUSCH ofdm symbols
|
||||
* dmrs_antenna_port DMRS antenna port
|
||||
* K_ptrs the parameter K_ptrs
|
||||
* ptrs_symbols bit mask of ptrs
|
||||
* start_sc first subcarrier index
|
||||
* ofdm_symbol_size FFT size
|
||||
* pusch_dmrs_type PUSCH DMRS type (1 or 2)
|
||||
* ptrs_UplinkConfig PTRS uplink configuration
|
||||
*
|
||||
* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is ptrs
|
||||
*
|
||||
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
uint8_t is_ptrs_symbol(uint8_t l,
|
||||
uint16_t k,
|
||||
uint16_t n_rnti,
|
||||
uint16_t N_RB,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t dmrs_antenna_port,
|
||||
uint8_t K_ptrs,
|
||||
uint16_t ptrs_symbols,
|
||||
uint16_t start_sc,
|
||||
uint16_t ofdm_symbol_size,
|
||||
pusch_dmrs_type_t pusch_dmrs_type,
|
||||
uint8_t resourceElementOffset) {
|
||||
|
||||
uint8_t is_ptrs_freq, is_ptrs_time;
|
||||
int16_t k_RE_ref;
|
||||
|
||||
is_ptrs_freq = 0;
|
||||
is_ptrs_time = 0;
|
||||
|
||||
k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset);
|
||||
|
||||
is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size);
|
||||
|
||||
if (is_ptrs_freq == 0)
|
||||
return 0;
|
||||
|
||||
if (((ptrs_symbols>>l)&1) == 1)
|
||||
is_ptrs_time = 1;
|
||||
|
||||
if (is_ptrs_time && is_ptrs_freq)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
|
||||
dmrs_UplinkConfig_t dmrs_Uplink_Config;
|
||||
ptrs_UplinkConfig_t ptrs_Uplink_Config;
|
||||
uint8_t resourceElementOffset;
|
||||
uint8_t dmrs_antenna_port;
|
||||
uint8_t L_ptrs, K_ptrs;
|
||||
int16_t k_RE_ref;
|
||||
uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k;
|
||||
uint8_t duration_in_symbols, I_mcs;
|
||||
uint8_t start_symbol, l;
|
||||
uint8_t ptrs_symbol_flag;
|
||||
uint16_t n_rnti;
|
||||
|
||||
dmrs_Uplink_Config.pusch_dmrs_type = pusch_dmrs_type1;
|
||||
dmrs_Uplink_Config.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos1;
|
||||
dmrs_Uplink_Config.pusch_maxLength = pusch_len2;
|
||||
|
||||
ptrs_Uplink_Config.timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration
|
||||
ptrs_Uplink_Config.timeDensity.ptrs_mcs2 = 0;
|
||||
ptrs_Uplink_Config.timeDensity.ptrs_mcs3 = 0;
|
||||
ptrs_Uplink_Config.frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration
|
||||
ptrs_Uplink_Config.frequencyDensity.n_rb1 = 0;
|
||||
ptrs_Uplink_Config.resourceElementOffset = 0;
|
||||
|
||||
n_rnti = 0x1234;
|
||||
resourceElementOffset = 0;
|
||||
ptrs_symbols = 0;
|
||||
dmrs_antenna_port = 0;
|
||||
N_RB = 50;
|
||||
duration_in_symbols = 14;
|
||||
ofdm_symbol_size = 2048;
|
||||
I_mcs = 9;
|
||||
start_symbol = 0;
|
||||
ptrs_symbol_flag = 0;
|
||||
|
||||
k_RE_ref = get_kRE_ref(dmrs_antenna_port, dmrs_Uplink_Config.pusch_dmrs_type, resourceElementOffset);
|
||||
|
||||
K_ptrs = get_K_ptrs(&ptrs_Uplink_Config, N_RB);
|
||||
|
||||
L_ptrs = get_L_ptrs(&ptrs_Uplink_Config, I_mcs);
|
||||
|
||||
set_ptrs_symb_idx(&ptrs_symbols,
|
||||
&ptrs_Uplink_Config,
|
||||
&dmrs_Uplink_Config,
|
||||
1,
|
||||
duration_in_symbols,
|
||||
start_symbol,
|
||||
L_ptrs,
|
||||
ofdm_symbol_size);
|
||||
|
||||
printf("PTRS OFDM symbol indicies: ");
|
||||
|
||||
for (l = start_symbol; l < start_symbol + duration_in_symbols; l++){
|
||||
|
||||
ptrs_symbol_flag = is_ptrs_symbol(l,
|
||||
0,
|
||||
n_rnti,
|
||||
N_RB,
|
||||
duration_in_symbols,
|
||||
dmrs_antenna_port,
|
||||
K_ptrs,
|
||||
ptrs_symbols,
|
||||
dmrs_Uplink_Config.pusch_dmrs_type,
|
||||
&ptrs_Uplink_Config);
|
||||
|
||||
if (ptrs_symbol_flag == 1)
|
||||
printf(" %d ", l);
|
||||
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("PTRS subcarrier indicies: ");
|
||||
|
||||
for (k = 0; k < N_RB*12; k++){
|
||||
|
||||
if (is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref) == 1)
|
||||
printf(" %d ", k);
|
||||
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILENAME : dmrs.h
|
||||
*
|
||||
* MODULE : demodulation reference signals
|
||||
*
|
||||
* DESCRIPTION : generation of dmrs sequences for NR 5G
|
||||
* 3GPP TS 38.211
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef PTRS_NR_H
|
||||
#define PTRS_NR_H
|
||||
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
/************** CODE GENERATION ***********************************/
|
||||
|
||||
/************** DEFINE ********************************************/
|
||||
|
||||
|
||||
/************* STRUCTURES *****************************************/
|
||||
|
||||
|
||||
/************** VARIABLES *****************************************/
|
||||
|
||||
/************** FUNCTION ******************************************/
|
||||
|
||||
int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset);
|
||||
|
||||
uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB);
|
||||
|
||||
void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t start_symbol,
|
||||
uint8_t dmrs_type,
|
||||
uint8_t L_ptrs,
|
||||
uint8_t pusch_maxLength,
|
||||
uint16_t ofdm_symbol_size);
|
||||
|
||||
uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs);
|
||||
|
||||
uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size);
|
||||
|
||||
uint8_t is_ptrs_symbol(uint8_t l,
|
||||
uint16_t k,
|
||||
uint16_t n_rnti,
|
||||
uint16_t N_RB,
|
||||
uint8_t duration_in_symbols,
|
||||
uint8_t dmrs_antenna_port,
|
||||
uint8_t K_ptrs,
|
||||
uint16_t ptrs_symbols,
|
||||
uint16_t start_sc,
|
||||
uint16_t ofdm_symbol_size,
|
||||
pusch_dmrs_type_t pusch_dmrs_type,
|
||||
uint8_t resourceElementOffset);
|
||||
|
||||
|
||||
|
||||
#endif /* PTRS_NR_H */
|
||||
@@ -35,13 +35,12 @@
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/CODING/nrLDPC_encoder/defs.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "defs.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include <syscall.h>
|
||||
@@ -273,7 +272,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
LOG_D(PHY,"new_gNB_dlsch exit flag %d, size of %ld\n",
|
||||
exit_flag, sizeof(NR_gNB_DLSCH_t));
|
||||
|
||||
free_gNB_dlsch(&dlsch, N_RB);
|
||||
free_gNB_dlsch(&dlsch,N_RB);
|
||||
|
||||
return(NULL);
|
||||
|
||||
@@ -446,11 +445,16 @@ int nr_dlsch_encoding(unsigned char *a,
|
||||
//ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],*Zc,Kb,Kr,BG,0);
|
||||
//ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
|
||||
}
|
||||
encoder_implemparams_t impp;
|
||||
impp.n_segments=dlsch->harq_processes[harq_pid]->C;
|
||||
impp.tprep = tprep;
|
||||
impp.tinput = tinput;
|
||||
impp.tparity = tparity;
|
||||
impp.toutput = toutput;
|
||||
|
||||
for(int j=0;j<((dlsch->harq_processes[harq_pid]->C-1)/8+1);j++) {
|
||||
ldpc_encoder_optim_8seg_multi(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,
|
||||
dlsch->harq_processes[harq_pid]->C,j,
|
||||
tinput,tprep,tparity,toutput);
|
||||
for(int j=0;j<(dlsch->harq_processes[harq_pid]->C/8+1);j++) {
|
||||
impp.macro_num=j;
|
||||
nrLDPC_encoder(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,&impp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -298,5 +298,3 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -64,15 +64,13 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
@param frame_parms, Pointer to frame descriptor structure
|
||||
|
||||
*/
|
||||
void nr_ulsch_extract_rbs_single(int **rxdataF,
|
||||
int **ul_ch_estimates,
|
||||
int **rxdataF_ext,
|
||||
int **ul_ch_estimates_ext,
|
||||
uint32_t rxdataF_ext_offset,
|
||||
|
||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t dmrs_symbol);
|
||||
NR_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
@@ -122,7 +121,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint
|
||||
if (N_RB_UL != 273) {
|
||||
a_segments = a_segments*N_RB_UL;
|
||||
a_segments = a_segments/273;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||
|
||||
@@ -300,8 +299,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
uint32_t frame,
|
||||
uint8_t nr_tti_rx,
|
||||
uint8_t harq_pid,
|
||||
uint32_t G)
|
||||
{
|
||||
uint32_t G) {
|
||||
|
||||
uint32_t A,E;
|
||||
uint32_t ret, offset;
|
||||
int32_t no_iteration_ldpc, length_dec;
|
||||
@@ -439,7 +438,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
if (nb_rb != 273) {
|
||||
a_segments = a_segments*nb_rb;
|
||||
a_segments = a_segments/273;
|
||||
}
|
||||
}
|
||||
|
||||
if (harq_process->C > a_segments) {
|
||||
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,a_segments);
|
||||
@@ -699,7 +698,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
// harq_process->harq_ack.harq_id = harq_pid;
|
||||
// harq_process->harq_ack.send_harq_status = 1;
|
||||
|
||||
|
||||
// LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d (pid %d, round %d, TBS %d)\n",phy_vars_gNB->Mod_id,nr_tti_rx,harq_pid,harq_process->round,harq_process->TBS);
|
||||
|
||||
|
||||
@@ -724,6 +722,16 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
LOG_I(PHY, "Decoder output (payload): \n");
|
||||
for (i = 0; i < harq_process->TBS / 8; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
printf("0x%02x",harq_process->b[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
ulsch->last_iteration_cnt = ret;
|
||||
|
||||
return(ret);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
|
||||
@@ -221,27 +222,29 @@ void nr_idft(uint32_t *z, uint32_t Msc_PUSCH)
|
||||
|
||||
}
|
||||
|
||||
void nr_ulsch_extract_rbs_single(int **rxdataF,
|
||||
int **ul_ch_estimates,
|
||||
int **rxdataF_ext,
|
||||
int **ul_ch_estimates_ext,
|
||||
uint32_t rxdataF_ext_offset,
|
||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t dmrs_symbol)
|
||||
NR_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
unsigned short start_re, re, nb_re_pusch;
|
||||
unsigned char aarx;
|
||||
uint8_t K_ptrs;
|
||||
uint32_t rxF_ext_index = 0;
|
||||
uint32_t ul_ch0_ext_index = 0;
|
||||
uint32_t ul_ch0_index = 0;
|
||||
uint8_t k_prime;
|
||||
uint16_t n=0;
|
||||
uint8_t delta = 0;
|
||||
uint8_t is_dmrs_re;
|
||||
uint32_t ul_ch0_ptrs_ext_index = 0;
|
||||
uint32_t ul_ch0_ptrs_index = 0;
|
||||
uint8_t is_ptrs_symbol_flag,k_prime;
|
||||
uint16_t n=0, num_ptrs_symbols;
|
||||
int16_t *rxF,*rxF_ext;
|
||||
int *ul_ch0,*ul_ch0_ext;
|
||||
int *ul_ch0_ptrs,*ul_ch0_ptrs_ext;
|
||||
uint16_t n_rnti = pusch_pdu->rnti;
|
||||
uint8_t delta = 0;
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
|
||||
@@ -250,24 +253,56 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
|
||||
|
||||
#endif
|
||||
|
||||
uint8_t is_dmrs_re;
|
||||
start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start * NR_NB_SC_PER_RB))%frame_parms->ofdm_symbol_size;
|
||||
|
||||
nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size;
|
||||
is_ptrs_symbol_flag = 0;
|
||||
num_ptrs_symbols = 0;
|
||||
|
||||
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
rxF = (int16_t *)&rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size];
|
||||
rxF_ext = (int16_t *)&rxdataF_ext[aarx][symbol * nb_re_pusch]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6
|
||||
rxF_ext = (int16_t *)&pusch_vars->rxdataF_ext[aarx][symbol * nb_re_pusch]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6
|
||||
|
||||
ul_ch0 = &ul_ch_estimates[aarx][dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
ul_ch0 = &pusch_vars->ul_ch_estimates[aarx][pusch_vars->dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
|
||||
ul_ch0_ext = &ul_ch_estimates_ext[aarx][symbol*nb_re_pusch];
|
||||
ul_ch0_ext = &pusch_vars->ul_ch_estimates_ext[aarx][symbol*nb_re_pusch];
|
||||
|
||||
ul_ch0_ptrs = &pusch_vars->ul_ch_ptrs_estimates[aarx][pusch_vars->ptrs_symbol_index*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
|
||||
ul_ch0_ptrs_ext = &pusch_vars->ul_ch_ptrs_estimates_ext[aarx][symbol*nb_re_pusch];
|
||||
|
||||
n = 0;
|
||||
k_prime = 0;
|
||||
|
||||
for (re = 0; re < nb_re_pusch; re++) {
|
||||
|
||||
if (is_dmrs_symbol)
|
||||
is_dmrs_re = (re == get_dmrs_freq_idx_ul(n, k_prime, delta, pusch_pdu->dmrs_config_type));
|
||||
else
|
||||
is_dmrs_re = 0;
|
||||
|
||||
if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) {
|
||||
|
||||
K_ptrs = (pusch_pdu->pusch_ptrs.ptrs_freq_density)?4:2;
|
||||
is_ptrs_symbol_flag = is_ptrs_symbol(symbol,
|
||||
(start_re + re)%frame_parms->ofdm_symbol_size,
|
||||
n_rnti,
|
||||
pusch_pdu->rb_size,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
aarx,
|
||||
K_ptrs,
|
||||
pusch_vars->ptrs_symbols,
|
||||
start_re,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
pusch_pdu->dmrs_config_type,
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset);
|
||||
|
||||
if (is_ptrs_symbol_flag == 1)
|
||||
num_ptrs_symbols++;
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("re = %d, symbol = %d\n", re, symbol);
|
||||
#endif
|
||||
@@ -278,17 +313,19 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
|
||||
is_dmrs_re = 0;
|
||||
|
||||
|
||||
if ( is_dmrs_re == 0 ) {
|
||||
if ( is_dmrs_re == 0 && is_ptrs_symbol_flag == 0) {
|
||||
|
||||
rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index];
|
||||
ul_ch0_ptrs_ext[ul_ch0_ptrs_ext_index] = ul_ch0_ptrs[ul_ch0_ptrs_index];
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("rxF_ext[%d] = (%d,%d)\n", rxF_ext_index>>1, rxF_ext[rxF_ext_index],rxF_ext[rxF_ext_index+1]);
|
||||
#endif
|
||||
|
||||
ul_ch0_ext_index++;
|
||||
ul_ch0_ptrs_ext_index++;
|
||||
rxF_ext_index +=2;
|
||||
} else {
|
||||
k_prime++;
|
||||
@@ -296,8 +333,12 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
|
||||
n+=(k_prime)?0:1;
|
||||
}
|
||||
ul_ch0_index++;
|
||||
ul_ch0_ptrs_index++;
|
||||
}
|
||||
}
|
||||
|
||||
pusch_vars->ptrs_sc_per_ofdm_symbol = num_ptrs_symbols;
|
||||
|
||||
}
|
||||
|
||||
void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
@@ -986,20 +1027,38 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
unsigned char harq_pid)
|
||||
{
|
||||
|
||||
uint8_t aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
|
||||
uint32_t nb_re_pusch, bwp_start_subcarrier;
|
||||
uint8_t L_ptrs = 0; // PTRS parameter
|
||||
int avgs;
|
||||
int avg[4];
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
uint8_t nodata_dmrs = 1; // FIXME to be properly configured from fapi
|
||||
|
||||
dmrs_symbol_flag = 0;
|
||||
ptrs_symbol_flag = 0;
|
||||
first_symbol_flag = 0;
|
||||
gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol = 0;
|
||||
|
||||
if(symbol == rel15_ul->start_symbol_index){
|
||||
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol = 0;
|
||||
gNB->pusch_vars[UE_id]->cl_done = 0;
|
||||
gNB->pusch_vars[UE_id]->ptrs_symbols = 0;
|
||||
first_symbol_flag = 1;
|
||||
|
||||
if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu
|
||||
L_ptrs = 1<<(rel15_ul->pusch_ptrs.ptrs_time_density);
|
||||
|
||||
set_ptrs_symb_idx(&gNB->pusch_vars[UE_id]->ptrs_symbols,
|
||||
rel15_ul->nr_of_symbols,
|
||||
rel15_ul->start_symbol_index,
|
||||
rel15_ul->dmrs_config_type,
|
||||
L_ptrs,
|
||||
1, // only dmrs of length 1 is currently supported
|
||||
frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
}
|
||||
|
||||
bwp_start_subcarrier = (rel15_ul->rb_start*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
|
||||
@@ -1009,17 +1068,35 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
if (dmrs_symbol_flag == 1){
|
||||
if (((rel15_ul->ul_dmrs_symb_pos)>>((symbol+1)%frame_parms->symbols_per_slot))&0x01)
|
||||
AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
|
||||
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol = symbol;
|
||||
|
||||
if (nodata_dmrs)
|
||||
nb_re_pusch = 0;
|
||||
else
|
||||
nb_re_pusch = rel15_ul->rb_size * ((rel15_ul->dmrs_config_type==pusch_dmrs_type1)?6:8); // 0 means type 1
|
||||
nb_re_pusch = rel15_ul->rb_size * ((rel15_ul->dmrs_config_type==pusch_dmrs_type1)?6:8);
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol = symbol;
|
||||
} else {
|
||||
nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
|
||||
}
|
||||
|
||||
if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu
|
||||
ptrs_symbol_flag = is_ptrs_symbol(symbol,
|
||||
0,
|
||||
rel15_ul->rnti,
|
||||
rel15_ul->rb_size,
|
||||
rel15_ul->nr_of_symbols,
|
||||
0,
|
||||
(rel15_ul->pusch_ptrs.ptrs_freq_density)?4:2,
|
||||
gNB->pusch_vars[UE_id]->ptrs_symbols,
|
||||
0,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
rel15_ul->dmrs_config_type,
|
||||
rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset);
|
||||
}
|
||||
|
||||
if (ptrs_symbol_flag == 1){
|
||||
gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//--------------------- Channel estimation ---------------------
|
||||
//----------------------------------------------------------
|
||||
@@ -1039,14 +1116,11 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
if (nb_re_pusch > 0) {
|
||||
|
||||
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_estimates,
|
||||
gNB->pusch_vars[UE_id]->rxdataF_ext,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
gNB->pusch_vars[UE_id]->rxdataF_ext_offset,
|
||||
gNB->pusch_vars[UE_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul,
|
||||
frame_parms,
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol);
|
||||
frame_parms);
|
||||
|
||||
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
frame_parms,
|
||||
@@ -1056,6 +1130,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
rel15_ul->rb_size,
|
||||
rel15_ul->dmrs_config_type);
|
||||
|
||||
|
||||
if (gNB->pusch_vars[UE_id]->cl_done==0) {
|
||||
|
||||
nr_ulsch_channel_level(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
@@ -1092,9 +1167,9 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-------------------- LLRs computation --------------------
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
//-------------------- LLRs computation --------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB],
|
||||
gNB->pusch_vars[UE_id]->ul_ch_mag0,
|
||||
|
||||
@@ -90,6 +90,7 @@ void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
|
||||
uint32_t rx_power_fil_dB,
|
||||
uint8_t eNB_id);
|
||||
|
||||
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index);
|
||||
int16_t get_nr_PL(PHY_VARS_NR_UE *ue,uint8_t gNB_index);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,8 @@
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "executables/nr-uesoftmodem.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
//#define DEBUG_DLSCH_DECODING 1
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
//#define DEBUG_DLSCH_DECODING
|
||||
//#define ENABLE_PHY_PAYLOAD_DEBUG 1
|
||||
|
||||
//#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
|
||||
@@ -799,8 +798,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint32_t Tbslbrm = 950984;
|
||||
uint16_t nb_rb = 30;
|
||||
double Coderate = 0.0;
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dl_config_pdu = &harq_processes[harq_pid]->dl_config_pdu
|
||||
uint8_t dmrs_type = dl_config_pdu->dmrsConfigType;
|
||||
uint8_t dmrs_type = harq_process->dmrsConfigType;
|
||||
//nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config;
|
||||
//uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value;
|
||||
|
||||
@@ -861,7 +859,8 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
A = harq_process->TBS;
|
||||
|
||||
ret = dlsch->max_ldpc_iterations;
|
||||
ret = dlsch->max_ldpc_iterations + 1;
|
||||
dlsch->last_iteration_cnt = ret;
|
||||
|
||||
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
|
||||
|
||||
@@ -929,9 +928,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
&harq_process->F,
|
||||
p_decParams->BG);
|
||||
|
||||
p_decParams->Z = harq_process->Z;
|
||||
|
||||
}
|
||||
|
||||
p_decParams->Z = harq_process->Z;
|
||||
|
||||
//printf("coderate %f kc %d \n", Coderate, kc);
|
||||
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
|
||||
@@ -1149,11 +1149,13 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||
}
|
||||
|
||||
for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
|
||||
j+=(harq_process->F>>3);
|
||||
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
|
||||
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
|
||||
{
|
||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||
}
|
||||
|
||||
|
||||
for (i=0, j=0; j < ((kc*p_decParams->Z)>>4); i+=2, j++)
|
||||
{
|
||||
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
|
||||
@@ -1480,7 +1482,7 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
}
|
||||
|
||||
harq_process->round =0;
|
||||
if (harq_process->round == 0) {
|
||||
// if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
if (A > 3824)
|
||||
harq_process->B = A+24;
|
||||
@@ -1498,7 +1500,7 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
|
||||
p_decParams->Z = harq_process->Z;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
//printf("round %d Z %d K %d BG %d\n", harq_process->round, p_decParams->Z, harq_process->K, p_decParams->BG);
|
||||
|
||||
@@ -1683,9 +1685,11 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||
}
|
||||
|
||||
for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
|
||||
j+=(harq_process->F>>3);
|
||||
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
|
||||
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
|
||||
{
|
||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||
}
|
||||
|
||||
for (i=0, j=0; j < ((kc*p_decParams->Z)>>4); i+=2, j++)
|
||||
|
||||
@@ -303,7 +303,13 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
|
||||
// sync at symbol ue->symbol_offset
|
||||
// computing the offset wrt the beginning of the frame
|
||||
sync_pos_frame = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)+((ue->symbol_offset)-1)*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
|
||||
ue->rx_offset = ue->ssb_offset - sync_pos_frame;
|
||||
|
||||
if (ue->ssb_offset < sync_pos_frame)
|
||||
ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset;
|
||||
else
|
||||
ue->rx_offset = ue->ssb_offset - sync_pos_frame;
|
||||
|
||||
ue->init_sync_frame = is;
|
||||
}
|
||||
|
||||
nr_gold_pdcch(ue,0, 2);
|
||||
|
||||
@@ -1078,6 +1078,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
|
||||
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
unsigned char harq_pid,
|
||||
uint8_t frame,
|
||||
uint8_t slot,
|
||||
uint8_t thread_id,
|
||||
int gNB_id);
|
||||
|
||||
@@ -240,6 +240,8 @@ typedef struct {
|
||||
int16_t Po_SRS;
|
||||
/// num active cba group
|
||||
uint8_t num_active_cba_groups;
|
||||
/// bit mask of PT-RS ofdm symbol indicies
|
||||
uint16_t ptrs_symbols;
|
||||
/// num dci found for cba
|
||||
//uint8_t num_cba_dci[10];
|
||||
/// allocated CBA RNTI
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/CODING/nrLDPC_encoder/defs.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
@@ -393,8 +393,11 @@ opp_enabled=0;
|
||||
printf("%d \n", harq_process->d[0][cnt]);
|
||||
}
|
||||
printf("\n");*/
|
||||
encoder_implemparams_t impp;
|
||||
impp.n_segments=harq_process->C;
|
||||
impp.macro_num=0;
|
||||
|
||||
ldpc_encoder_optim_8seg(harq_process->c,harq_process->d,*pz,Kb,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
|
||||
nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,BG,&impp);
|
||||
|
||||
//stop_meas(te_stats);
|
||||
//printf("end ldpc encoder -- output\n");
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
@@ -41,9 +42,15 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/TOOLS/tools_defs.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
|
||||
//#define DEBUG_SCFDMA
|
||||
//#define DEBUG_PUSCH_MAPPING
|
||||
//#define DEBUG_MAC_PDU
|
||||
|
||||
//extern int32_t uplink_counter;
|
||||
|
||||
void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
uint32_t size,
|
||||
@@ -86,6 +93,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
|
||||
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
unsigned char harq_pid,
|
||||
uint8_t frame,
|
||||
uint8_t slot,
|
||||
uint8_t thread_id,
|
||||
int gNB_id) {
|
||||
@@ -98,25 +106,34 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
int32_t **txdataF;
|
||||
uint16_t start_sc, start_rb;
|
||||
int8_t Wf[2], Wt[2], l_prime[2], delta;
|
||||
uint16_t n_dmrs, code_rate, number_dmrs_symbols;
|
||||
uint16_t n_dmrs, code_rate, number_dmrs_symbols, k;
|
||||
uint8_t dmrs_type;
|
||||
uint8_t mapping_type;
|
||||
int ap, start_symbol, Nid_cell, i;
|
||||
int sample_offsetF, N_RE_prime, N_PRB_oh;
|
||||
uint16_t n_rnti;
|
||||
uint8_t data_existing =0;
|
||||
uint8_t L_ptrs, K_ptrs; // PTRS parameters
|
||||
uint16_t beta_ptrs; // PTRS parameter related to power control
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue;
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue;
|
||||
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
|
||||
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
||||
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
|
||||
|
||||
num_of_codewords = 1; // tmp assumption
|
||||
n_rnti = 0x1234;
|
||||
Nid_cell = 0;
|
||||
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
<<<<<<< HEAD
|
||||
|
||||
mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
|
||||
int dmrs_symb;
|
||||
=======
|
||||
number_dmrs_symbols = 0;
|
||||
uint8_t mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
|
||||
>>>>>>> develop
|
||||
|
||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
||||
|
||||
@@ -125,20 +142,29 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
start_symbol = harq_process_ul_ue->start_symbol;
|
||||
|
||||
<<<<<<< HEAD
|
||||
dmrs_symb=-1;
|
||||
number_dmrs_symbols = 0;
|
||||
|
||||
for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) {
|
||||
number_dmrs_symbols += is_dmrs_symbol(i,
|
||||
=======
|
||||
for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++)
|
||||
number_dmrs_symbols += is_dmrs_symbol((mapping_type)?i-start_symbol:i,
|
||||
>>>>>>> develop
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
harq_process_ul_ue->number_of_symbols,
|
||||
<<<<<<< HEAD
|
||||
start_symbol,
|
||||
&UE->dmrs_UplinkConfig,
|
||||
mapping_type,
|
||||
=======
|
||||
UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type,
|
||||
>>>>>>> develop
|
||||
frame_parms->ofdm_symbol_size);
|
||||
if (dmrs_symb == -1 && number_dmrs_symbols == 1) dmrs_symb = i;
|
||||
}
|
||||
@@ -148,12 +174,17 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
LOG_D(PHY,"pusch: start_symbol %d, dmrs_symbol %d, num_symbols %d\n",
|
||||
start_symbol,dmrs_symb,harq_process_ul_ue->number_of_symbols);
|
||||
|
||||
ulsch_ue->length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength;
|
||||
ulsch_ue->length_dmrs = number_dmrs_symbols; // pusch.MaxLenght is redundant here as number_dmrs_symbols
|
||||
// contains all dmrs symbols even for double symbol dmrs
|
||||
ulsch_ue->rnti = n_rnti;
|
||||
ulsch_ue->Nid_cell = Nid_cell;
|
||||
<<<<<<< HEAD
|
||||
ulsch_ue->nb_re_dmrs = 12;//((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
|
||||
=======
|
||||
ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4);
|
||||
>>>>>>> develop
|
||||
|
||||
N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh;
|
||||
N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*number_dmrs_symbols - N_PRB_oh;
|
||||
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords;
|
||||
|
||||
@@ -169,13 +200,45 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
0,
|
||||
harq_process_ul_ue->Nl);
|
||||
|
||||
uint8_t access_mode = SCHEDULED_ACCESS;
|
||||
|
||||
//-----------------------------------------------------//
|
||||
// to be removed later when MAC is ready
|
||||
|
||||
if (harq_process_ul_ue != NULL){
|
||||
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
|
||||
harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
data_existing = 0;
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
|
||||
slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode);
|
||||
//IP traffic to be transmitted
|
||||
if(data_existing){
|
||||
//harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char));
|
||||
memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8);
|
||||
|
||||
#ifdef DEBUG_MAC_PDU
|
||||
LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8);
|
||||
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
|
||||
printf("0x%02x",harq_process_ul_ue->a[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
|
||||
if (!IS_SOFTMODEM_NOS1 || !data_existing) {
|
||||
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
|
||||
//and block this traffic from being forwarded to the upper layers at the gNB
|
||||
uint16_t payload_offset = 5;
|
||||
LOG_D(PHY, "Random data to be tranmsitted: \n");
|
||||
//Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver
|
||||
for (i = 0; i<payload_offset; i++)
|
||||
harq_process_ul_ue->a[i] = 0;
|
||||
|
||||
for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) {
|
||||
harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
|
||||
@@ -187,6 +250,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
/////////////////////////ULSCH coding/////////////////////////
|
||||
///////////
|
||||
|
||||
|
||||
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid);
|
||||
|
||||
///////////
|
||||
@@ -231,17 +295,47 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
/////////////////////////DMRS Modulation/////////////////////////
|
||||
///////////
|
||||
pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||
n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs);
|
||||
n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs);
|
||||
int16_t mod_dmrs[n_dmrs<<1];
|
||||
dmrs_type = UE->dmrs_UplinkConfig.pusch_dmrs_type;
|
||||
dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type;
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////PTRS parameters' initialization/////////////////////////
|
||||
///////////
|
||||
|
||||
int16_t mod_ptrs[(harq_process_ul_ue->nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation
|
||||
K_ptrs = 0; // just to avoid a warning
|
||||
|
||||
if (UE->ptrs_configured == 1) {
|
||||
|
||||
K_ptrs = get_K_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->nb_rb);
|
||||
|
||||
L_ptrs = get_L_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->mcs);
|
||||
|
||||
beta_ptrs = 1; // temp value until power control is implemented
|
||||
|
||||
ulsch_ue->ptrs_symbols = 0;
|
||||
|
||||
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
|
||||
harq_process_ul_ue->number_of_symbols,
|
||||
start_symbol,
|
||||
dmrs_type,
|
||||
L_ptrs,
|
||||
ulsch_ue->length_dmrs,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////ULSCH layer mapping/////////////////////////
|
||||
///////////
|
||||
|
||||
@@ -267,16 +361,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) {
|
||||
|
||||
is_dmrs = is_dmrs_symbol(l,
|
||||
is_dmrs = is_dmrs_symbol((mapping_type)?l-start_symbol:l,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
harq_process_ul_ue->number_of_symbols,
|
||||
start_symbol,
|
||||
&UE->dmrs_UplinkConfig,
|
||||
mapping_type,
|
||||
dmrs_type,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
|
||||
if (is_dmrs == 1)
|
||||
@@ -319,17 +411,87 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
|
||||
uint8_t k_prime=0;
|
||||
uint8_t is_dmrs;
|
||||
uint16_t m=0, n=0, dmrs_idx=0, k=0;
|
||||
uint8_t is_dmrs, is_ptrs;
|
||||
uint8_t l_ref;
|
||||
uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0;
|
||||
|
||||
for (l=start_symbol; l<start_symbol+harq_process_ul_ue->number_of_symbols; l++) {
|
||||
|
||||
k = start_sc;
|
||||
n = 0;
|
||||
dmrs_idx = 0;
|
||||
l_ref = (mapping_type) ? l-start_symbol : l;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (l!=dmrs_symb) {
|
||||
for (i=0; i<harq_process_ul_ue->nb_rb*NR_NB_SC_PER_RB; i++) {
|
||||
=======
|
||||
for (i=0; i<harq_process_ul_ue->nb_rb*NR_NB_SC_PER_RB; i++) {
|
||||
|
||||
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
||||
|
||||
is_dmrs = 0;
|
||||
is_ptrs = 0;
|
||||
|
||||
is_dmrs = is_dmrs_symbol(l_ref,
|
||||
k,
|
||||
start_sc,
|
||||
k_prime,
|
||||
n,
|
||||
delta,
|
||||
harq_process_ul_ue->number_of_symbols,
|
||||
dmrs_type,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
|
||||
if (UE->ptrs_configured == 1){
|
||||
is_ptrs = is_ptrs_symbol(l,
|
||||
k,
|
||||
ulsch_ue->rnti,
|
||||
harq_process_ul_ue->nb_rb,
|
||||
harq_process_ul_ue->number_of_symbols,
|
||||
ap,
|
||||
K_ptrs,
|
||||
ulsch_ue->ptrs_symbols,
|
||||
start_sc,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type,
|
||||
ptrs_Uplink_Config->resourceElementOffset);
|
||||
}
|
||||
|
||||
if (is_dmrs == 1) {
|
||||
|
||||
if (k == start_sc){
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
}
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n",
|
||||
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
|
||||
dmrs_idx++;
|
||||
k_prime++;
|
||||
k_prime&=1;
|
||||
n+=(k_prime)?0:1;
|
||||
|
||||
} else if (is_ptrs == 1) {
|
||||
|
||||
if (k == start_sc){
|
||||
nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb/2, DMRS_MOD_ORDER, mod_ptrs);
|
||||
}
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
ptrs_idx++;
|
||||
|
||||
} else {
|
||||
>>>>>>> develop
|
||||
|
||||
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||
@@ -408,10 +570,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
return;
|
||||
LOG_D(PHY, "Is data existing ?: %d \n", data_existing);
|
||||
}
|
||||
|
||||
|
||||
@@ -442,6 +606,13 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
||||
if (tx_offset < 0)
|
||||
tx_offset += frame_parms->samples_per_frame;
|
||||
|
||||
// clear the transmit data array for the current subframe
|
||||
/*for (int aa=0; aa<UE->frame_parms.nb_antennas_tx; aa++) {
|
||||
memset(&UE->common_vars.txdata[aa][tx_offset],0,UE->frame_parms.samples_per_slot*sizeof(int32_t));
|
||||
//memset(&UE->common_vars.txdataF[aa][tx_offset],0,UE->frame_parms.samples_per_slot*sizeof(int32_t));
|
||||
}*/
|
||||
|
||||
|
||||
txdata = UE->common_vars.txdata;
|
||||
txdataF = UE->common_vars.txdataF;
|
||||
|
||||
@@ -460,6 +631,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
return 0;
|
||||
|
||||
@@ -920,7 +920,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
|
||||
// Computing cross-correlation at peak on half the symbol size for data shifted by half symbol size
|
||||
// as it is real and complex it is necessary to shift by a value equal to symbol size to obtain such shift
|
||||
result2 = dot_product64((short*)primary_synchro_time_nr[pss_source]+(frame_parms->ofdm_symbol_size),
|
||||
(short*) &(rxdata[0][peak_position+frame_parms->ofdm_symbol_size+(is*frame_parms->samples_per_frame)]),
|
||||
(short*) &(rxdata[0][peak_position+is*frame_parms->samples_per_frame])+frame_parms->ofdm_symbol_size,
|
||||
frame_parms->ofdm_symbol_size>>1,
|
||||
shift);
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
lte_dfts_sse4: lte_dfts.c
|
||||
<<<<<<< HEAD
|
||||
gcc -O2 -std=gnu99 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
=======
|
||||
gcc-7 -O3 -std=gnu99 -msse4.1 -o lte_dfts_sse4 lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
>>>>>>> origin/develop-nr
|
||||
|
||||
lte_dfts_avx2: lte_dfts.c
|
||||
gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
|
||||
+16
-2
@@ -40,7 +40,7 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
@@ -375,6 +375,14 @@ typedef struct {
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
|
||||
int32_t **ul_ch_estimates_ext;
|
||||
/// \brief Hold the PTRS phase estimates in frequency domain.
|
||||
/// - first index: rx antenna id [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
|
||||
int32_t **ul_ch_ptrs_estimates;
|
||||
/// \brief Uplink phase estimates extracted in PRBS.
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
|
||||
int32_t **ul_ch_ptrs_estimates_ext;
|
||||
/// \brief Holds the compensated signal.
|
||||
/// - first index: rx antenna id [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
|
||||
@@ -416,6 +424,12 @@ typedef struct {
|
||||
int16_t *llr;
|
||||
/// DMRS symbol index, to be updated every DMRS symbol within a slot.
|
||||
uint8_t dmrs_symbol;
|
||||
// PTRS symbol index, to be updated every PTRS symbol within a slot.
|
||||
uint8_t ptrs_symbol_index;
|
||||
/// bit mask of PT-RS ofdm symbol indicies
|
||||
uint16_t ptrs_symbols;
|
||||
// PTRS subcarriers per OFDM symbol
|
||||
uint16_t ptrs_sc_per_ofdm_symbol;
|
||||
/// flag to verify if channel level computation is done
|
||||
uint8_t cl_done;
|
||||
} NR_gNB_PUSCH;
|
||||
@@ -676,7 +690,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
|
||||
/// PDSCH DMRS sequence
|
||||
uint32_t ****nr_gold_pdsch_dmrs;
|
||||
|
||||
|
||||
/// PUSCH DMRS
|
||||
uint32_t ****nr_gold_pusch_dmrs;
|
||||
|
||||
|
||||
@@ -898,7 +898,7 @@ typedef struct {
|
||||
//fapi_nr_dci_indication_t dci_ind;
|
||||
|
||||
// point to the current rxTx thread index
|
||||
uint8_t current_thread_id[40];
|
||||
uint8_t current_thread_id[NR_MAX_SLOTS_PER_FRAME];
|
||||
|
||||
t_nrPolar_params *polarList;
|
||||
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
|
||||
@@ -954,6 +954,9 @@ typedef struct {
|
||||
/// PUSCH DMRS sequence
|
||||
uint32_t ****nr_gold_pusch_dmrs;
|
||||
|
||||
/// flag to indicate if PTRS is configured
|
||||
uint8_t ptrs_configured;
|
||||
|
||||
uint32_t X_u[64][839];
|
||||
|
||||
uint32_t high_speed_flag;
|
||||
@@ -1013,6 +1016,7 @@ typedef struct {
|
||||
// uint8_t prach_timer;
|
||||
uint8_t decode_SIB;
|
||||
uint8_t decode_MIB;
|
||||
uint8_t init_sync_frame;
|
||||
/// temporary offset during cell search prior to MIB decoding
|
||||
int ssb_offset;
|
||||
uint16_t symbol_offset; // offset in terms of symbols for detected ssb in sync
|
||||
@@ -1086,7 +1090,6 @@ typedef struct {
|
||||
|
||||
crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig;
|
||||
supplementaryUplink_t supplementaryUplink;
|
||||
dmrs_UplinkConfig_t dmrs_UplinkConfig;
|
||||
dmrs_DownlinkConfig_t dmrs_DownlinkConfig;
|
||||
csi_MeasConfig_t csi_MeasConfig;
|
||||
PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig;
|
||||
|
||||
@@ -483,9 +483,6 @@ typedef struct {
|
||||
uint8_t startSymbolAndLength;
|
||||
} PUSCH_TimeDomainResourceAllocation_t;
|
||||
////////////////////////////////////////////////////////////////////////////////################################
|
||||
typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS)
|
||||
|
||||
} ptrs_UplinkConfig_t;
|
||||
typedef enum{
|
||||
maxCodeBlockGroupsPerTransportBlock_n2 = 2,
|
||||
maxCodeBlockGroupsPerTransportBlock_n4 = 4,
|
||||
@@ -517,6 +514,12 @@ typedef enum {
|
||||
pusch_dmrs_pos2 = 2,
|
||||
pusch_dmrs_pos3 = 3,
|
||||
} pusch_dmrs_AdditionalPosition_t;
|
||||
typedef enum {
|
||||
offset00 = 0,
|
||||
offset01 = 1,
|
||||
offset10 = 2,
|
||||
offset11 = 3,
|
||||
} ptrs_resource_elementoffset_t;
|
||||
typedef enum {
|
||||
pdsch_len1 = 1,
|
||||
pdsch_len2 = 2
|
||||
@@ -525,6 +528,22 @@ typedef enum {
|
||||
pusch_len1 = 1,
|
||||
pusch_len2 = 2
|
||||
} pusch_maxLength_t;
|
||||
typedef struct {
|
||||
uint8_t ptrs_mcs1;
|
||||
uint8_t ptrs_mcs2;
|
||||
uint8_t ptrs_mcs3;
|
||||
} ptrs_time_density_t;
|
||||
typedef struct {
|
||||
uint16_t n_rb0;
|
||||
uint16_t n_rb1;
|
||||
} ptrs_frequency_density_t;
|
||||
typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS)
|
||||
uint8_t num_ptrs_ports;
|
||||
ptrs_resource_elementoffset_t resourceElementOffset;
|
||||
ptrs_time_density_t timeDensity;
|
||||
ptrs_frequency_density_t frequencyDensity;
|
||||
uint32_t ul_ptrs_power;
|
||||
} ptrs_UplinkConfig_t;
|
||||
typedef struct { // The IE DMRS-DownlinkConfig is used to configure downlink demodulation reference signals for PDSCH
|
||||
pdsch_dmrs_type_t pdsch_dmrs_type;
|
||||
pdsch_dmrs_AdditionalPosition_t pdsch_dmrs_AdditionalPosition;
|
||||
@@ -536,6 +555,7 @@ typedef struct { // The IE DMRS-UplinkConfig is used to configure uplink demodul
|
||||
pusch_dmrs_type_t pusch_dmrs_type;
|
||||
pusch_dmrs_AdditionalPosition_t pusch_dmrs_AdditionalPosition;
|
||||
pusch_maxLength_t pusch_maxLength;
|
||||
ptrs_UplinkConfig_t ptrs_UplinkConfig;
|
||||
uint16_t scramblingID0;
|
||||
uint16_t scramblingID1;
|
||||
} dmrs_UplinkConfig_t;
|
||||
@@ -620,6 +640,10 @@ typedef struct {
|
||||
* resourceAllocation
|
||||
*/
|
||||
ul_resourceAllocation_t ul_resourceAllocation;
|
||||
/*
|
||||
* DMRS-Uplinkconfig
|
||||
*/
|
||||
dmrs_UplinkConfig_t dmrs_UplinkConfig;
|
||||
/*
|
||||
* rgb_Size
|
||||
*/
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
|
||||
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "T.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
#include "assertions.h"
|
||||
#include "msc.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
uint8_t SSB_Table[38]={0,2,4,6,8,10,12,14,254,254,16,18,20,22,24,26,28,30,254,254,32,34,36,38,40,42,44,46,254,254,48,50,52,54,56,58,60,62};
|
||||
|
||||
@@ -229,12 +229,15 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
if (nodata_dmrs)
|
||||
nb_re_dmrs = 12*number_dmrs_symbols;
|
||||
else
|
||||
nb_re_dmrs = ((pusch_pdu->dmrs_config_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
|
||||
nb_re_dmrs = ((pusch_pdu->dmrs_config_type == pusch_dmrs_type1)?6:4);
|
||||
|
||||
|
||||
G = nr_get_G(pusch_pdu->rb_size,
|
||||
number_symbols,
|
||||
nb_re_dmrs,
|
||||
1, // FIXME only single dmrs is implemented
|
||||
pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->nrOfLayers);
|
||||
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
|
||||
pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->nrOfLayers);
|
||||
|
||||
@@ -264,8 +267,14 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
|
||||
if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations)
|
||||
LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id);
|
||||
else
|
||||
LOG_I(PHY, "ULSCH %d received ok\n",ULSCH_id);
|
||||
//gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b
|
||||
else if(gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->b!=NULL){
|
||||
LOG_I(PHY, "ULSCH received ok \n");
|
||||
if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[ULSCH_id][0]->rnti == 0x1234
|
||||
nr_fill_crc_indication(gNB,frame_rx, slot_rx, ULSCH_id, 0);
|
||||
nr_fill_rx_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -277,25 +286,36 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_
|
||||
// --------------------
|
||||
|
||||
nfapi_rx_indication_pdu_t *pdu;
|
||||
|
||||
int timing_advance_update;
|
||||
int sync_pos;
|
||||
|
||||
uint16_t mu = gNB->frame_parms.numerology_index;
|
||||
// pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
||||
|
||||
// gNB->UL_INFO.rx_ind.sfn_sf = frame<<4| slot_rx;
|
||||
// gNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
|
||||
pdu = &gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
|
||||
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4| slot_rx;
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list->rx_indication_rel8.length = gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->TBS;
|
||||
|
||||
// pdu->rx_ue_information.handle = gNB->ulsch[UE_id+1][0]->handle;
|
||||
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
|
||||
// pdu->rx_ue_information.rnti = gNB->ulsch[UE_id+1][0]->rnti;
|
||||
// pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
|
||||
// pdu->rx_indication_rel8.length = gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->TBS>>3;
|
||||
// pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
|
||||
pdu = &gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
|
||||
|
||||
pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b;
|
||||
//pdu->rx_ue_information.handle = gNB->ulsch[ULSCH_id+1][0]->handle;
|
||||
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
|
||||
pdu->rx_ue_information.rnti = gNB->ulsch[ULSCH_id][0]->rnti;
|
||||
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
|
||||
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
|
||||
pdu->data = harq_process->b;//gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b;
|
||||
// estimate timing advance for MAC
|
||||
sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id);
|
||||
timing_advance_update = sync_pos; // - gNB->frame_parms.nb_prefix_samples/4; //to check
|
||||
// printf("\x1B[33m" "timing_advance_update = %d\n" "\x1B[0m", timing_advance_update);
|
||||
|
||||
|
||||
// pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b;
|
||||
sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC
|
||||
timing_advance_update = sync_pos * (1 << mu); // scale by the used scs numerology
|
||||
|
||||
@@ -320,37 +340,37 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_
|
||||
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
|
||||
|
||||
// estimate UL_CQI for MAC (from antenna port 0 only)
|
||||
// int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[UE_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
|
||||
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
|
||||
|
||||
// if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi=0;
|
||||
// else if (SNRtimes10 > 635) pdu->rx_indication_rel8.ul_cqi=255;
|
||||
// else pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5;
|
||||
if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi=0;
|
||||
else if (SNRtimes10 > 635) pdu->rx_indication_rel8.ul_cqi=255;
|
||||
else pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5;
|
||||
|
||||
// LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n",
|
||||
// harq_pid,frame,slot_rx,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance,
|
||||
// timing_advance_update);
|
||||
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
|
||||
// gNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | slot_rx;
|
||||
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | slot_rx;
|
||||
|
||||
// pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
}
|
||||
|
||||
void nr_fill_crc_indication (PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag){
|
||||
// pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
// nfapi_crc_indication_pdu_t *pdu = &gNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
|
||||
// gNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
|
||||
// gNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
|
||||
// gNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
|
||||
// pdu->instance_length = 0; // don't know what to do with this
|
||||
// // pdu->rx_ue_information.handle = handle;
|
||||
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
|
||||
// pdu->rx_ue_information.rnti = gNB->ulsch[UE_id]->rnti;
|
||||
// pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
|
||||
// pdu->crc_indication_rel8.crc_flag = crc_flag;
|
||||
void nr_fill_crc_indication (PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t crc_flag) {
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
nfapi_crc_indication_pdu_t *pdu = &gNB->UL_INFO. crc_ind.crc_indication_body.crc_pdu_list[gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
|
||||
gNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | slot_rx;
|
||||
gNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
|
||||
gNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
|
||||
pdu->instance_length = 0; // don't know what to do with this
|
||||
// pdu->rx_ue_information.handle = handle;
|
||||
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
|
||||
pdu->rx_ue_information.rnti = gNB->ulsch[ULSCH_id][0]->rnti;
|
||||
pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
|
||||
pdu->crc_indication_rel8.crc_flag = crc_flag;
|
||||
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
|
||||
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
|
||||
// pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
}
|
||||
|
||||
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
|
||||
@@ -75,15 +75,7 @@ fifo_dump_emos_UE emos_dump_UE;
|
||||
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
//#include "PHY/defs.h"
|
||||
|
||||
//#include "PHY/CODING/extern.h"
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "T.h"
|
||||
|
||||
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
|
||||
@@ -1290,6 +1282,8 @@ uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){
|
||||
uint16_t bw_scaling;
|
||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||
switch (bwp_ul_NB_RB) {
|
||||
case 32: bw_scaling = 4; break;
|
||||
case 66: bw_scaling = 8; break;
|
||||
case 106: bw_scaling = 16; break;
|
||||
case 217: bw_scaling = 32; break;
|
||||
case 245: bw_scaling = 32; break;
|
||||
@@ -2251,6 +2245,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
|
||||
nr_ue_ulsch_procedures(ue,
|
||||
harq_pid,
|
||||
frame_tx,
|
||||
slot_tx,
|
||||
thread_id,
|
||||
gNB_id);
|
||||
@@ -2264,6 +2259,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
} // UE_mode==PUSCH
|
||||
*/
|
||||
|
||||
|
||||
nr_ue_pusch_common_procedures(ue,
|
||||
harq_pid,
|
||||
slot_tx,
|
||||
@@ -2271,6 +2267,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
gNB_id,
|
||||
&ue->frame_parms);
|
||||
|
||||
|
||||
/* RACH */
|
||||
if ((ue->UE_mode[gNB_id] == PRACH) && (ue->frame_parms.prach_config_common.prach_Config_enabled == 1)) {
|
||||
nr_ue_prach_procedures(ue, proc, gNB_id, mode);
|
||||
@@ -3611,6 +3608,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
|
||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||
switch (ue->frame_parms.N_RB_DL) {
|
||||
case 32: bw_scaling = 4; break;
|
||||
case 66: bw_scaling = 8; break;
|
||||
case 106: bw_scaling = 16; break;
|
||||
case 217: bw_scaling = 32; break;
|
||||
case 245: bw_scaling = 32; break;
|
||||
|
||||
@@ -53,11 +53,7 @@
|
||||
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
@@ -4885,10 +4881,8 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
|
||||
uint8_t abstraction_flag,
|
||||
uint8_t do_pdcch_flag,
|
||||
runmode_t mode) {
|
||||
#if defined(ENABLE_ITTI)
|
||||
MessageDef *msg_p;
|
||||
int result;
|
||||
#endif
|
||||
int frame_rx = proc->frame_rx;
|
||||
int frame_tx = proc->frame_tx;
|
||||
int subframe_rx = proc->subframe_rx;
|
||||
@@ -4905,9 +4899,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
|
||||
if ( LOG_DEBUGFLAG(UE_TIMING)) {
|
||||
start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
do {
|
||||
// Checks if a message has been sent to PHY sub-task
|
||||
itti_poll_msg (TASK_PHY_UE, &msg_p);
|
||||
@@ -4929,8 +4920,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
|
||||
}
|
||||
} while(msg_p != NULL);
|
||||
|
||||
#endif
|
||||
|
||||
for (slot=0; slot<2; slot++) {
|
||||
if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)||
|
||||
(ue->frame_parms.frame_type == FDD)) {
|
||||
|
||||
@@ -58,7 +58,7 @@ struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
|
||||
|
||||
int nas_sock_fd[MAX_MOBILES_PER_ENB];
|
||||
|
||||
int nas_sock_mbms_fd[8];
|
||||
int nas_sock_mbms_fd;
|
||||
|
||||
struct msghdr nas_msg_tx;
|
||||
struct msghdr nas_msg_rx;
|
||||
@@ -95,21 +95,20 @@ static int tun_alloc(char *dev) {
|
||||
}
|
||||
|
||||
|
||||
int netlink_init_mbms_tun(char *ifprefix, int num_if) {
|
||||
int netlink_init_mbms_tun(char *ifprefix) {
|
||||
int ret;
|
||||
char ifname[64];
|
||||
|
||||
int i= num_if-1;
|
||||
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
|
||||
nas_sock_mbms_fd[i] = tun_alloc(ifname);
|
||||
sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
|
||||
nas_sock_mbms_fd = tun_alloc(ifname);
|
||||
|
||||
if (nas_sock_mbms_fd[i] == -1) {
|
||||
if (nas_sock_mbms_fd == -1) {
|
||||
printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd[i]);
|
||||
ret = fcntl(nas_sock_mbms_fd[i],F_SETFL,O_NONBLOCK);
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd);
|
||||
ret = fcntl(nas_sock_mbms_fd,F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
@@ -123,7 +122,7 @@ int netlink_init_mbms_tun(char *ifprefix, int num_if) {
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_mbms_fd[i], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
ret = bind(nas_sock_mbms_fd, (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
@@ -165,7 +164,8 @@ int netlink_init_tun(char *ifprefix, int num_if) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_fd[i]);
|
||||
printf("[NETLINK]Opened socket %s with fd nas_sock_fd[%d]=%d\n",
|
||||
ifname, i, nas_sock_fd[i]);
|
||||
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
|
||||
@@ -63,6 +63,6 @@ void clear_eNB_transport_info(uint8_t);
|
||||
void clear_UE_transport_info(uint8_t);
|
||||
int netlink_init(void);
|
||||
int netlink_init_tun(char *ifsuffix, int num_if);
|
||||
int netlink_init_mbms_tun(char *ifsuffix, int num_if);
|
||||
int netlink_init_mbms_tun(char *ifsuffix);
|
||||
|
||||
#endif /* EMU_PROTO_H_ */
|
||||
|
||||
@@ -78,6 +78,7 @@ int sf_ahead=4 ;
|
||||
int sl_ahead=0;
|
||||
uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
|
||||
// dummy functions
|
||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||
@@ -95,12 +96,17 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||
}
|
||||
|
||||
|
||||
//Dummy Functions
|
||||
//lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms, unsigned char subframe) {return(SF_DL);}
|
||||
int rlc_module_init (int eNB_id) {return(0);}
|
||||
|
||||
|
||||
void pdcp_layer_init(void) {}
|
||||
boolean_t
|
||||
pdcp_data_ind(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const sdu_size_t sdu_buffer_sizeP,
|
||||
mem_block_t *const sdu_buffer_pP
|
||||
) { return(false);}
|
||||
|
||||
int rrc_init_nr_global_param(void){return(0);}
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
@@ -108,28 +114,6 @@ void config_common(int Mod_idP,
|
||||
NR_ServingCellConfigCommon_t *scc
|
||||
);
|
||||
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id) {mac_rlc_status_resp_t mac_rlc_status_resp = {0}; return mac_rlc_status_resp;}
|
||||
tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
char *buffer_pP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id) {return 0;}
|
||||
int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
@@ -141,20 +125,6 @@ int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned short post_padding){return 0;}
|
||||
void nr_ip_over_LTE_DRB_preconfiguration(void){}
|
||||
|
||||
void mac_rlc_data_ind (
|
||||
const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP)
|
||||
{}
|
||||
|
||||
// needed for some functions
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ uint16_t NB_UE_INST = 1;
|
||||
|
||||
// needed for some functions
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
|
||||
void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
int N_RB_DL,
|
||||
@@ -409,7 +410,9 @@ int main(int argc, char **argv)
|
||||
uint8_t n_hf = 0;
|
||||
int cyclic_prefix_type = NFAPI_CP_NORMAL;
|
||||
|
||||
double fs,bw,scs,eps;
|
||||
double fs, eps;
|
||||
double scs = 30000;
|
||||
double bw = 100e6;
|
||||
|
||||
switch (mu) {
|
||||
case 1:
|
||||
|
||||
@@ -65,10 +65,10 @@ void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
||||
uint16_t NB_UE_INST=1;
|
||||
|
||||
|
||||
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
uint8_t nfapi_mode=0;
|
||||
|
||||
|
||||
void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
module_id_t mod_id,
|
||||
int CC_id,
|
||||
@@ -91,6 +91,7 @@ int is_nr_prach_subframe(NR_DL_FRAME_PARMS *fp,uint32_t frame,uint8_t slot) { re
|
||||
|
||||
int get_nr_prach_fmt(int prachConfigIndex,int frame_type,int fr) { return(0xa2); }
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
|
||||
@@ -371,7 +371,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
unsigned char harq_pid = 0;
|
||||
uint8_t is_crnti = 0;
|
||||
unsigned int TBS = 8424;
|
||||
unsigned int available_bits;
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
@@ -385,7 +384,7 @@ int main(int argc, char **argv)
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
|
||||
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid];
|
||||
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &harq_process_gNB->ulsch_pdu.ulsch_pdu_rel15;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0];
|
||||
|
||||
@@ -397,14 +396,15 @@ int main(int argc, char **argv)
|
||||
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
|
||||
/////////// setting rel15_ul parameters ///////////
|
||||
rel15_ul->number_rbs = nb_rb;
|
||||
rel15_ul->number_symbols = nb_symb_sch;
|
||||
rel15_ul->Qm = mod_order;
|
||||
rel15_ul->mcs = Imcs;
|
||||
rel15_ul->rv = rvidx;
|
||||
rel15_ul->n_layers = Nl;
|
||||
rel15_ul->length_dmrs = length_dmrs;
|
||||
rel15_ul->R = code_rate;
|
||||
rel15_ul->rb_size = nb_rb;
|
||||
rel15_ul->nr_of_symbols = nb_symb_sch;
|
||||
rel15_ul->qam_mod_order = mod_order;
|
||||
rel15_ul->mcs_index = Imcs;
|
||||
rel15_ul->pusch_data.rv_index = rvidx;
|
||||
rel15_ul->nrOfLayers = Nl;
|
||||
//rel15_ul->length_dmrs = length_dmrs;
|
||||
rel15_ul->target_code_rate = code_rate;
|
||||
rel15_ul->pusch_data.tb_size = TBS>>3;
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
@@ -527,8 +527,15 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
#endif
|
||||
|
||||
ret = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms,
|
||||
frame, nb_symb_sch, nb_re_dmrs, subframe, harq_pid, is_crnti);
|
||||
uint32_t G = nr_get_G(rel15_ul->rb_size,
|
||||
rel15_ul->nr_of_symbols,
|
||||
nb_re_dmrs,
|
||||
1, // FIXME only single dmrs is implemented
|
||||
rel15_ul->qam_mod_order,
|
||||
rel15_ul->nrOfLayers);
|
||||
|
||||
ret = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
|
||||
frame, subframe, harq_pid, G);
|
||||
|
||||
if (ret > ulsch_gNB->max_ldpc_iterations)
|
||||
n_errors++;
|
||||
|
||||
@@ -55,8 +55,9 @@
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair2/RRC/NR/MESSAGES/asn1_msg.h"
|
||||
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
|
||||
//#define DEBUG_ULSIM
|
||||
|
||||
@@ -70,44 +71,11 @@ int sl_ahead=0;
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
|
||||
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
|
||||
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
|
||||
void mac_rlc_data_ind ( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP){}
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id)
|
||||
{mac_rlc_status_resp_t mac_rlc_status_resp = {0}; return mac_rlc_status_resp;}
|
||||
tbs_size_t mac_rlc_data_req( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
char *buffer_pP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id )
|
||||
{return 0;}
|
||||
int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
@@ -117,8 +85,16 @@ int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char *ue_cont_res_id,
|
||||
unsigned char short_padding,
|
||||
unsigned short post_padding){return 0;}
|
||||
int rlc_module_init (int enb) {return(0);}
|
||||
void pdcp_layer_init (void) {}
|
||||
boolean_t pdcp_data_ind(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const sdu_size_t sdu_buffer_sizeP,
|
||||
mem_block_t *const sdu_buffer_pP
|
||||
) { return(false);}
|
||||
|
||||
void pdcp_run (const protocol_ctxt_t *const ctxt_pP) { return;}
|
||||
void nr_ip_over_LTE_DRB_preconfiguration(void){}
|
||||
int rrc_init_nr_global_param(void){return(0);}
|
||||
@@ -398,8 +374,9 @@ int main(int argc, char **argv)
|
||||
|
||||
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t));
|
||||
gNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t));
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
|
||||
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
@@ -528,6 +505,7 @@ int main(int argc, char **argv)
|
||||
unsigned int TBS;
|
||||
uint16_t number_dmrs_symbols = 1;
|
||||
unsigned int available_bits;
|
||||
|
||||
uint8_t nb_re_dmrs=12; // no PUSCH REs
|
||||
uint8_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
@@ -535,6 +513,7 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
mod_order = nr_get_Qm_ul(Imcs, 0);
|
||||
|
||||
code_rate = nr_get_code_rate_ul(Imcs, 0);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, precod_nbr_layers);
|
||||
@@ -672,6 +651,9 @@ int main(int argc, char **argv)
|
||||
//----------------------------------------------------------
|
||||
//------------------- gNB phy procedures -------------------
|
||||
//----------------------------------------------------------
|
||||
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
if (n_trials==1)
|
||||
|
||||
@@ -45,10 +45,8 @@
|
||||
#define GNB_CONF_STRING_OTG_APP_TYPE "app_type"
|
||||
#define GNB_CONF_STRING_OTG_BG_TRAFFIC "bg_traffic"
|
||||
|
||||
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
|
||||
extern int asn_debug;
|
||||
extern int asn1_xer_print;
|
||||
#endif
|
||||
|
||||
#ifdef LIBCONFIG_LONG
|
||||
#define libconfig_int long
|
||||
|
||||
@@ -57,9 +57,7 @@
|
||||
/* for fair round robin SCHED */
|
||||
#include "eNB_scheduler_fairRR.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
|
||||
@@ -55,14 +55,12 @@
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "LAYER2/MAC/eNB_scheduler_fairRR.h"
|
||||
|
||||
@@ -1353,28 +1351,31 @@ initiate_ra_proc(module_id_t module_idP,
|
||||
|
||||
/* TODO: find better procedure to allocate RNTI */
|
||||
do {
|
||||
#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode
|
||||
static int drnti[MAX_MOBILES_PER_ENB] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
|
||||
int j = 0;
|
||||
int nb_ue = 0;
|
||||
if (IS_SOFTMODEM_IQPLAYER) { /* iq player mode, use deterministic rnti */
|
||||
static int drnti[MAX_MOBILES_PER_ENB];
|
||||
static int drnti_def[]={ 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
|
||||
for (int j=0; j<MAX_MOBILES_PER_ENB && j< (sizeof(drnti_def)/sizeof(int));j++)
|
||||
drnti[i]=drnti_def[i];
|
||||
|
||||
int nb_ue = 0;
|
||||
|
||||
for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
|
||||
if (UE_RNTI(module_idP, j) > 0) {
|
||||
nb_ue++;
|
||||
} else {
|
||||
break;
|
||||
for (int j = 0; j < MAX_MOBILES_PER_ENB; j++) {
|
||||
if (UE_RNTI(module_idP, j) > 0) {
|
||||
nb_ue++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nb_ue >= MAX_MOBILES_PER_ENB) {
|
||||
printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
|
||||
abort();
|
||||
}
|
||||
if (nb_ue >= MAX_MOBILES_PER_ENB || nb_ue >= (sizeof(drnti_def)/sizeof(int))) {
|
||||
printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
ra[i].rnti = drnti[nb_ue];
|
||||
#else
|
||||
ra[i].rnti = taus();
|
||||
#endif
|
||||
ra[i].rnti = drnti[nb_ue];
|
||||
} else {
|
||||
ra[i].rnti = taus();
|
||||
}
|
||||
loop++;
|
||||
} while (loop != 100 &&
|
||||
/* TODO: this is not correct, the rnti may be in use without
|
||||
|
||||
@@ -44,9 +44,7 @@
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
#define DEBUG_eNB_SCHEDULER 1
|
||||
|
||||
@@ -53,9 +53,7 @@
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
@@ -48,10 +48,6 @@
|
||||
#include "pdcp.h"
|
||||
#include "assertions.h"
|
||||
|
||||
//#if defined(ENABLE_ITTI)
|
||||
//#include "intertask_interface.h"
|
||||
//#endif
|
||||
//
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
|
||||
@@ -48,10 +48,8 @@
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "T.h"
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
@@ -2184,9 +2182,8 @@ add_new_ue(module_id_t mod_idP,
|
||||
UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
|
||||
UE_list->num_UEs++;
|
||||
UE_list->active[UE_id] = TRUE;
|
||||
#if defined(USRP_REC_PLAY) // not specific to record/playback ?
|
||||
UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
|
||||
#endif
|
||||
if (IS_SOFTMODEM_IQPLAYER)// not specific to record/playback ?
|
||||
UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
|
||||
UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type;
|
||||
memset((void *) &UE_list->UE_sched_ctrl[UE_id],
|
||||
0,
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
#include "assertions.h"
|
||||
#include "pdcp.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "ENB_APP/flexran_agent_defs.h"
|
||||
#include "flexran_agent_ran_api.h"
|
||||
@@ -936,6 +934,7 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
stop_meas(&mac->rx_ulsch_sdu);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
* Return the BSR table index corresponding to the number of bytes in input
|
||||
@@ -1497,38 +1496,33 @@ schedule_ulsch_rnti(module_id_t module_idP,
|
||||
|
||||
if (status >= RRC_CONNECTED && UE_sched_ctrl_ptr->cqi_req_timer > 30) {
|
||||
if (UE_sched_ctrl_ptr->cqi_received == 0) {
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC) {
|
||||
cqi_req = 0;
|
||||
} else {
|
||||
cqi_req = 1;
|
||||
LOG_D(MAC,"Setting CQI_REQ (timer %d)\n",UE_sched_ctrl_ptr->cqi_req_timer);
|
||||
cqi_req = 1;
|
||||
LOG_D(MAC,
|
||||
"Setting CQI_REQ (timer %d)\n",
|
||||
UE_sched_ctrl_ptr->cqi_req_timer);
|
||||
|
||||
/* TDD: to be safe, do not ask CQI in special Subframes:36.213/7.2.3 CQI definition */
|
||||
if (cc[CC_id].tdd_Config) {
|
||||
switch (cc[CC_id].tdd_Config->subframeAssignment) {
|
||||
case 1:
|
||||
if(subframeP == 1 || subframeP == 6) {
|
||||
cqi_req=0;
|
||||
}
|
||||
/* TDD: to be safe, do not ask CQI in special
|
||||
* Subframes:36.213/7.2.3 CQI definition */
|
||||
if (cc[CC_id].tdd_Config) {
|
||||
switch (cc[CC_id].tdd_Config->subframeAssignment) {
|
||||
case 1:
|
||||
if (subframeP == 1 || subframeP == 6)
|
||||
cqi_req = 0;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (subframeP == 1)
|
||||
cqi_req = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(subframeP == 1) {
|
||||
cqi_req=0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(MAC," TDD config not supported\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_E(MAC, " TDD config not supported\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(cqi_req == 1) {
|
||||
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
|
||||
}
|
||||
if (cqi_req == 1) {
|
||||
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
|
||||
}
|
||||
} else {
|
||||
LOG_D(MAC,"Clearing CQI request timer\n");
|
||||
|
||||
@@ -1294,3 +1294,4 @@ uint8_t ul_subframe2_k_phich(COMMON_channels_t *cc, sub_frame_t ul_subframe);
|
||||
/* MAC ITTI messaging related functions */
|
||||
/* Main loop of MAC itti message handling */
|
||||
void *mac_enb_task(void *arg);
|
||||
|
||||
|
||||
@@ -56,9 +56,7 @@
|
||||
#include "pdcp.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
@@ -2160,7 +2158,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
//Substitute with a static value for the MAC layer abstraction (phy_stub mode)
|
||||
phr_p->PH = 40;
|
||||
phr_p->PH = 60;
|
||||
} else {
|
||||
phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index);
|
||||
}
|
||||
@@ -2455,10 +2453,8 @@ ue_scheduler(const module_id_t module_idP,
|
||||
struct LTE_RACH_ConfigCommon *rach_ConfigCommon =
|
||||
(struct LTE_RACH_ConfigCommon *) NULL;
|
||||
protocol_ctxt_t ctxt;
|
||||
#if defined(ENABLE_ITTI)
|
||||
MessageDef *msg_p;
|
||||
int result;
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&UE_mac_inst[module_idP].ue_scheduler);
|
||||
#endif
|
||||
@@ -2467,7 +2463,6 @@ ue_scheduler(const module_id_t module_idP,
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO,
|
||||
UE_mac_inst[module_idP].crnti, txFrameP,
|
||||
txSubframeP, eNB_indexP);
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
if(module_idP == 0) {
|
||||
do {
|
||||
@@ -2497,8 +2492,6 @@ ue_scheduler(const module_id_t module_idP,
|
||||
} while (msg_p != NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Mac_rlc_xface->frameP=frameP;
|
||||
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
|
||||
//if (subframe%5 == 0)
|
||||
|
||||
@@ -213,5 +213,10 @@ typedef struct {
|
||||
#define UL_SCH_LCID_L_BSR 0x3E
|
||||
#define UL_SCH_LCID_PADDING 0x3F
|
||||
|
||||
#define NR_MAX_NUM_LCID 32
|
||||
#define NR_MAX_NUM_LCGID 8
|
||||
#define MAX_RLC_SDU_SUBHEADER_SIZE 3
|
||||
|
||||
|
||||
#endif /*__LAYER2_MAC_H__ */
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "NR_MAC_COMMON/nr_mac_extern.h"
|
||||
|
||||
/* RRC */
|
||||
#include "NR_DRX-Config.h"
|
||||
@@ -63,10 +64,14 @@
|
||||
#include "NR_SpCellConfig.h"
|
||||
#include "NR_ServingCellConfig.h"
|
||||
|
||||
#include "NR_MAC_COMMON/nr_mac_extern.h"
|
||||
|
||||
#define NB_NR_UE_MAC_INST 1
|
||||
#define MAX_NUM_BWP 2
|
||||
/*!\brief Maximum number of logical channl group IDs */
|
||||
|
||||
|
||||
/*!\brief value for indicating BSR Timer is not running */
|
||||
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
|
||||
|
||||
|
||||
typedef enum {
|
||||
SFN_C_MOD_2_EQ_0,
|
||||
@@ -74,6 +79,71 @@ typedef enum {
|
||||
SFN_C_IMPOSSIBLE
|
||||
} SFN_C_TYPE;
|
||||
|
||||
// LTE structure, might need to be adapted for NR
|
||||
typedef struct {
|
||||
/// buffer status for each lcgid
|
||||
uint8_t BSR[NR_MAX_NUM_LCGID]; // should be more for mesh topology
|
||||
/// keep the number of bytes in rlc buffer for each lcgid
|
||||
int32_t BSR_bytes[NR_MAX_NUM_LCGID];
|
||||
/// after multiplexing buffer remain for each lcid
|
||||
int32_t LCID_buffer_remain[NR_MAX_NUM_LCID];
|
||||
/// sum of all lcid buffer size
|
||||
uint16_t All_lcid_buffer_size_lastTTI;
|
||||
/// buffer status for each lcid
|
||||
uint8_t LCID_status[NR_MAX_NUM_LCID];
|
||||
/// SR pending as defined in 36.321
|
||||
uint8_t SR_pending;
|
||||
/// SR_COUNTER as defined in 36.321
|
||||
uint16_t SR_COUNTER;
|
||||
/// logical channel group ide for each LCID
|
||||
uint8_t LCGID[NR_MAX_NUM_LCID];
|
||||
/// retxBSR-Timer, default value is sf2560
|
||||
uint16_t retxBSR_Timer;
|
||||
/// retxBSR_SF, number of subframe before triggering a regular BSR
|
||||
uint16_t retxBSR_SF;
|
||||
/// periodicBSR-Timer, default to infinity
|
||||
uint16_t periodicBSR_Timer;
|
||||
/// periodicBSR_SF, number of subframe before triggering a periodic BSR
|
||||
uint16_t periodicBSR_SF;
|
||||
/// default value is 0: not configured
|
||||
uint16_t sr_ProhibitTimer;
|
||||
/// sr ProhibitTime running
|
||||
uint8_t sr_ProhibitTimer_Running;
|
||||
/// default value to n5
|
||||
uint16_t maxHARQ_Tx;
|
||||
/// default value is false
|
||||
uint16_t ttiBundling;
|
||||
/// default value is release
|
||||
struct DRX_Config *drx_config;
|
||||
/// default value is release
|
||||
struct MAC_MainConfig__phr_Config *phr_config;
|
||||
///timer before triggering a periodic PHR
|
||||
uint16_t periodicPHR_Timer;
|
||||
///timer before triggering a prohibit PHR
|
||||
uint16_t prohibitPHR_Timer;
|
||||
///DL Pathloss change value
|
||||
uint16_t PathlossChange;
|
||||
///number of subframe before triggering a periodic PHR
|
||||
int16_t periodicPHR_SF;
|
||||
///number of subframe before triggering a prohibit PHR
|
||||
int16_t prohibitPHR_SF;
|
||||
///DL Pathloss Change in db
|
||||
uint16_t PathlossChange_db;
|
||||
|
||||
/// default value is false
|
||||
uint16_t extendedBSR_Sizes_r10;
|
||||
/// default value is false
|
||||
uint16_t extendedPHR_r10;
|
||||
|
||||
//Bj bucket usage per lcid
|
||||
int16_t Bj[NR_MAX_NUM_LCID];
|
||||
// Bucket size per lcid
|
||||
int16_t bucket_size[NR_MAX_NUM_LCID];
|
||||
} NR_UE_SCHEDULING_INFO;
|
||||
|
||||
|
||||
#define MAX_NUM_BWP 2
|
||||
|
||||
typedef enum {
|
||||
RA_UE_IDLE = 0,
|
||||
WAIT_RAR = 1,
|
||||
@@ -178,6 +248,13 @@ typedef struct {
|
||||
nr_ue_if_module_t *if_module;
|
||||
nr_scheduled_response_t scheduled_response;
|
||||
nr_phy_config_t phy_config;
|
||||
|
||||
/// BSR report flag management
|
||||
uint8_t BSR_reporting_active;
|
||||
NR_UE_SCHEDULING_INFO scheduling_info;
|
||||
|
||||
/// PHR
|
||||
uint8_t PHR_reporting_active;
|
||||
} NR_UE_MAC_INST_t;
|
||||
|
||||
typedef enum seach_space_mask_e {
|
||||
|
||||
@@ -63,8 +63,13 @@
|
||||
#include "assertions.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||
#define DEBUG_EXTRACT_DCI 1
|
||||
|
||||
@@ -2918,7 +2923,7 @@ void nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275) :
|
||||
NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
|
||||
int pos;
|
||||
int pos=0;
|
||||
int fsize=0;
|
||||
switch(dci_format) {
|
||||
|
||||
@@ -3511,7 +3516,6 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
}
|
||||
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
|
||||
AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n");
|
||||
}
|
||||
}
|
||||
@@ -3530,7 +3534,8 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
uint16_t truncated_bsr,
|
||||
uint16_t short_bsr,
|
||||
uint16_t long_bsr,
|
||||
unsigned short post_padding) {
|
||||
unsigned short post_padding,
|
||||
uint16_t buflen) {
|
||||
|
||||
NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) pdu;
|
||||
unsigned char last_size = 0, i, mac_header_control_elements[16], *ce_ptr, bsr = 0;
|
||||
@@ -3665,8 +3670,15 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
mac_pdu_ptr += (unsigned char) mac_ce_size;
|
||||
}
|
||||
|
||||
// compute offset before adding padding (if necessary)
|
||||
offset = ((unsigned char *) mac_pdu_ptr - pdu);
|
||||
uint16_t padding_bytes = 0;
|
||||
|
||||
if(buflen > 0) // If the buflen is provided
|
||||
padding_bytes = buflen - offset;
|
||||
|
||||
// Compute final offset for padding
|
||||
if (post_padding > 0) {
|
||||
if (post_padding > 0 || padding_bytes>0) {
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0;
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = UL_SCH_LCID_PADDING;
|
||||
mac_pdu_ptr++;
|
||||
@@ -3681,3 +3693,134 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode) {
|
||||
uint8_t total_rlc_pdu_header_len = 0;
|
||||
int16_t buflen_remain = 0;
|
||||
uint8_t lcid = 0;
|
||||
uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint16_t payload_offset = 0, num_sdus = 0;
|
||||
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
uint16_t sdu_length_total = 0;
|
||||
//unsigned short post_padding = 0;
|
||||
|
||||
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
|
||||
0, lcid_buffer_occupancy_new = 0;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
|
||||
module_idP, frameP, subframe, buflen);
|
||||
AssertFatal(CC_id == 0,
|
||||
"Transmission on secondary CCs is not supported yet\n");
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
|
||||
#endif
|
||||
|
||||
//NR_UE_MAC_INST_t *nr_ue_mac_inst = get_mac_inst(0);
|
||||
|
||||
// Check for DCCH first
|
||||
// TO DO: Multiplex in the order defined by the logical channel prioritization
|
||||
for (lcid = UL_SCH_LCID_SRB1;
|
||||
lcid < NR_MAX_NUM_LCID; lcid++) {
|
||||
|
||||
lcid_buffer_occupancy_old =
|
||||
//TODO: Replace static value with CRNTI
|
||||
mac_rlc_get_buffer_occupancy_ind(module_idP,
|
||||
0x1234, eNB_index, frameP, //nr_ue_mac_inst->crnti
|
||||
subframe, ENB_FLAG_NO,
|
||||
lcid);
|
||||
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
|
||||
|
||||
if(lcid_buffer_occupancy_new){
|
||||
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
LOG_D(MAC,
|
||||
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
|
||||
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
|
||||
module_idP, frameP, lcid, lcid_buffer_occupancy_new,
|
||||
buflen, sdu_length_total,
|
||||
total_rlc_pdu_header_len, buflen_remain); // ,nr_ue_mac_inst->scheduling_info.BSR_bytes[nr_ue_mac_inst->scheduling_info.LCGID[lcid]]
|
||||
|
||||
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
|
||||
|
||||
//TODO: Replace static value with CRNTI
|
||||
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
|
||||
0x1234, eNB_index, //nr_ue_mac_inst->crnti
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
buflen_remain,
|
||||
(char *)&ulsch_sdus[sdu_length_total],0,
|
||||
0
|
||||
);
|
||||
AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
|
||||
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
|
||||
lcid, sdu_lengths[num_sdus], buflen_remain);
|
||||
|
||||
if (sdu_lengths[num_sdus]) {
|
||||
sdu_length_total += sdu_lengths[num_sdus];
|
||||
sdu_lcids[num_sdus] = lcid;
|
||||
|
||||
total_rlc_pdu_header_len += MAX_RLC_SDU_SUBHEADER_SIZE; //rlc_pdu_header_len_last;
|
||||
|
||||
//Update number of SDU
|
||||
num_sdus++;
|
||||
}
|
||||
|
||||
/* Get updated BO after multiplexing this PDU */
|
||||
//TODO: Replace static value with CRNTI
|
||||
|
||||
lcid_buffer_occupancy_new =
|
||||
mac_rlc_get_buffer_occupancy_ind(module_idP,
|
||||
0x1234, //nr_ue_mac_inst->crnti
|
||||
eNB_index, frameP,
|
||||
subframe, ENB_FLAG_NO,
|
||||
lcid);
|
||||
buflen_remain =
|
||||
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generate ULSCH PDU
|
||||
if (num_sdus>0) {
|
||||
payload_offset = nr_generate_ulsch_pdu(ulsch_sdus,
|
||||
ulsch_buffer, // mac header
|
||||
num_sdus, // num sdus
|
||||
sdu_lengths, // sdu length
|
||||
sdu_lcids, // sdu lcid
|
||||
0, // power_headroom
|
||||
0, // crnti
|
||||
0, // truncated_bsr
|
||||
0, // short_bsr
|
||||
0, // long_bsr
|
||||
0, // post_padding
|
||||
buflen); // TBS in bytes
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
// Padding: fill remainder of ULSCH with 0
|
||||
if (buflen - payload_offset > 0){
|
||||
for (int j = payload_offset; j < buflen; j++)
|
||||
ulsch_buffer[j] = 0;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_I(MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset);
|
||||
for (int i = 0; i < buflen ; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
printf("%02x ",(unsigned char)ulsch_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -55,9 +55,7 @@
|
||||
#include "flexran_agent_extern.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
@@ -298,10 +296,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
//printf("gNB_dlsch_ulsch_scheduler frameRX %d slotRX %d frameTX %d slotTX %d\n",frame_rxP,slot_rxP,frame_txP,slot_txP);
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
int CC_id, UE_id = 0; // i = -1
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame_txP, slot_txP,module_idP);
|
||||
int CC_id, UE_id = 0;
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_UE_list_t *UE_list = &gNB->UE_list;
|
||||
// rnti_t rnti;
|
||||
UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
|
||||
@@ -337,7 +335,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
rnti = 0;//UE_RNTI(module_idP, i);
|
||||
CC_id = 0;//UE_PCCID(module_idP, i);
|
||||
|
||||
|
||||
} //END if (UE_list->active[i])
|
||||
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
|
||||
*/
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
#define DEBUG_eNB_SCHEDULER 1
|
||||
|
||||
@@ -34,8 +34,10 @@
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "NR_SCS-SpecificCarrier.h"
|
||||
#include "NR_TDD-UL-DL-ConfigCommon.h"
|
||||
#include "NR_FrequencyInfoUL.h"
|
||||
@@ -769,7 +771,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
pusch_pdu->data_scrambling_id = 0; //It equals the higher-layer parameter Data-scrambling-Identity if configured and the RNTI equals the C-RNTI, otherwise L2 needs to set it to physical cell id.;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
//DMRS
|
||||
pusch_pdu->ul_dmrs_symb_pos = 1;
|
||||
pusch_pdu->ul_dmrs_symb_pos = 1<<2; //for now the gnb assumes dmrs in the first symbol of the scheduled pusch resource
|
||||
pusch_pdu->dmrs_config_type = 0; //dmrs-type 1 (the one with a single DMRS symbol in the beginning)
|
||||
pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id.
|
||||
pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0.
|
||||
@@ -785,20 +787,21 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
//pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
|
||||
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
|
||||
//Resource Allocation in time domain
|
||||
pusch_pdu->start_symbol_index = 0;
|
||||
pusch_pdu->start_symbol_index = 2;
|
||||
pusch_pdu->nr_of_symbols = 12;
|
||||
//Optional Data only included if indicated in pduBitmap
|
||||
pusch_pdu->pusch_data.rv_index = 0;
|
||||
pusch_pdu->pusch_data.harq_process_id = 0;
|
||||
pusch_pdu->pusch_data.new_data_indicator = 0;
|
||||
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
|
||||
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->target_code_rate,
|
||||
pusch_pdu->rb_size,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
6, //nb_re_dmrs - not sure where this is coming from - its not in the FAPI
|
||||
0, //nb_rb_oh
|
||||
0,
|
||||
pusch_pdu->nrOfLayers = 1)>>3;
|
||||
pusch_pdu->nrOfLayers)>>3;
|
||||
|
||||
pusch_pdu->pusch_data.num_cb = 0; //CBG not supported
|
||||
//pusch_pdu->pusch_data.cb_present_and_position;
|
||||
//pusch_pdu->pusch_uci;
|
||||
@@ -848,3 +851,4 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
fill_dci_pdu_rel15(pdcch_pdu_rel15,&dci_pdu_rel15[0],dci_formats,rnti_types,pdcch_pdu_rel15->BWPSize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user