Merge branch 'develop-nr-merge' into develop-nr
lte-softmodem, lte-uesoftmodem, nr-softmodem, nr-uesoftmodem, polartest, ldpctest, ulsim, dlsim all compile functionality and performance to be tested by CI
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/groovy
|
#!/Bin/groovy
|
||||||
/*
|
/*
|
||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
@@ -41,7 +41,7 @@ pipeline {
|
|||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
timestamps()
|
timestamps()
|
||||||
gitLabConnection('OAI GitLab')
|
gitLabConnection('OAI GitLab')
|
||||||
gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test-FDD-Band7"])
|
gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Build gNb-usrp", "Build nr-UE-usrp", "Analysis with cppcheck", "Test phy-sim", "Test-FDD-Band7"])
|
||||||
ansiColor('xterm')
|
ansiColor('xterm')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +146,16 @@ pipeline {
|
|||||||
stage ("Start VM -- ue-ethernet") {
|
stage ("Start VM -- ue-ethernet") {
|
||||||
steps {
|
steps {
|
||||||
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||||
|
|
||||||
|
stage ("Start VM -- gnb-usrp") {
|
||||||
|
steps {
|
||||||
|
sh "./ci-scripts/createVM.sh --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage ("Start VM -- nu-ue-usrp") {
|
||||||
|
steps {
|
||||||
|
sh "./ci-scripts/createVM.sh --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +182,20 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage ("Build 5G gNB-USRP") {
|
||||||
|
steps {
|
||||||
|
gitlabCommitStatus(name: "Build gNb-usrp") {
|
||||||
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ("Build 5G NR-UE-USRP") {
|
||||||
|
steps {
|
||||||
|
gitlabCommitStatus(name: "Build nr-UE-usrp") {
|
||||||
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage ("Build physical simulators") {
|
stage ("Build physical simulators") {
|
||||||
steps {
|
steps {
|
||||||
gitlabCommitStatus(name: "Build phy-sim") {
|
gitlabCommitStatus(name: "Build phy-sim") {
|
||||||
@@ -179,20 +203,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ("Build eNb-ethernet") {
|
|
||||||
steps {
|
|
||||||
gitlabCommitStatus(name: "Build eNb-ethernet") {
|
|
||||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage ("Build UE-ethernet") {
|
|
||||||
steps {
|
|
||||||
gitlabCommitStatus(name: "Build UE-ethernet") {
|
|
||||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage ("Build eNb-USRP on Red Hat") {
|
stage ("Build eNb-USRP on Red Hat") {
|
||||||
when {
|
when {
|
||||||
expression {doRedHatBuild}
|
expression {doRedHatBuild}
|
||||||
@@ -218,7 +228,7 @@ pipeline {
|
|||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
dir ('archives') {
|
dir ('archives') {
|
||||||
sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth red_hat"
|
sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nrue_usrp red_hat"
|
||||||
}
|
}
|
||||||
if(fileExists('archives/vm_build_logs.zip')) {
|
if(fileExists('archives/vm_build_logs.zip')) {
|
||||||
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
|
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
|
||||||
|
|||||||
+38
-4
@@ -48,6 +48,8 @@ function usage {
|
|||||||
echo " --variant basic-sim OR -v2"
|
echo " --variant basic-sim OR -v2"
|
||||||
echo " --variant phy-sim OR -v3"
|
echo " --variant phy-sim OR -v3"
|
||||||
echo " --variant cppcheck OR -v4"
|
echo " --variant cppcheck OR -v4"
|
||||||
|
echo " --variant gnb-usrp OR -v5"
|
||||||
|
echo " --variant nu-ue-usrp OR -v6"
|
||||||
echo " --variant enb-ethernet OR -v7"
|
echo " --variant enb-ethernet OR -v7"
|
||||||
echo " --variant ue-ethernet OR -v8"
|
echo " --variant ue-ethernet OR -v8"
|
||||||
echo " Specify the variant to build."
|
echo " Specify the variant to build."
|
||||||
@@ -68,6 +70,8 @@ function variant_usage {
|
|||||||
echo " --variant basic-sim OR -v2"
|
echo " --variant basic-sim OR -v2"
|
||||||
echo " --variant phy-sim OR -v3"
|
echo " --variant phy-sim OR -v3"
|
||||||
echo " --variant cppcheck OR -v4"
|
echo " --variant cppcheck OR -v4"
|
||||||
|
echo " --variant gnb-usrp OR -v5"
|
||||||
|
echo " --variant nu-ue-usrp OR -v6"
|
||||||
echo " --variant enb-ethernet OR -v7"
|
echo " --variant enb-ethernet OR -v7"
|
||||||
echo " --variant ue-ethernet OR -v8"
|
echo " --variant ue-ethernet OR -v8"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -147,11 +151,27 @@ case $key in
|
|||||||
;;
|
;;
|
||||||
-v4)
|
-v4)
|
||||||
VM_NAME=ci-cppcheck
|
VM_NAME=ci-cppcheck
|
||||||
VM_MEMORY=4096
|
VM_MEMORY=8192
|
||||||
ARCHIVES_LOC=cppcheck
|
ARCHIVES_LOC=cppcheck
|
||||||
LOG_PATTERN=cppcheck.xml
|
LOG_PATTERN=cppcheck.xml
|
||||||
NB_PATTERN_FILES=1
|
NB_PATTERN_FILES=1
|
||||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v5)
|
||||||
|
VM_NAME=ci-gnb-usrp
|
||||||
|
ARCHIVES_LOC=gnb_usrp
|
||||||
|
LOG_PATTERN=.Rel14.txt
|
||||||
|
NB_PATTERN_FILES=4
|
||||||
|
BUILD_OPTIONS="--gNB -w USRP"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v6)
|
||||||
|
VM_NAME=ci-ue-nr-usrp
|
||||||
|
ARCHIVES_LOC=nrue_usrp
|
||||||
|
LOG_PATTERN=.Rel14.txt
|
||||||
|
NB_PATTERN_FILES=4
|
||||||
|
BUILD_OPTIONS="--nrUE -w USRP"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v7)
|
-v7)
|
||||||
@@ -196,11 +216,25 @@ case $key in
|
|||||||
;;
|
;;
|
||||||
cppcheck)
|
cppcheck)
|
||||||
VM_NAME=ci-cppcheck
|
VM_NAME=ci-cppcheck
|
||||||
VM_MEMORY=4096
|
VM_MEMORY=8192
|
||||||
ARCHIVES_LOC=cppcheck
|
ARCHIVES_LOC=cppcheck
|
||||||
LOG_PATTERN=cppcheck.xml
|
LOG_PATTERN=cppcheck.xml
|
||||||
NB_PATTERN_FILES=1
|
NB_PATTERN_FILES=1
|
||||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c"
|
||||||
|
;;
|
||||||
|
gnb-usrp)
|
||||||
|
VM_NAME=ci-gnb-usrp
|
||||||
|
ARCHIVES_LOC=gnb_usrp
|
||||||
|
LOG_PATTERN=.Rel14.txt
|
||||||
|
NB_PATTERN_FILES=4
|
||||||
|
BUILD_OPTIONS="--gNB -w USRP"
|
||||||
|
;;
|
||||||
|
nu-ue-usrp)
|
||||||
|
VM_NAME=ci-ue-nr-usrp
|
||||||
|
ARCHIVES_LOC=nrue_usrp
|
||||||
|
LOG_PATTERN=.Rel14.txt
|
||||||
|
NB_PATTERN_FILES=4
|
||||||
|
BUILD_OPTIONS="--nrUE -w USRP"
|
||||||
;;
|
;;
|
||||||
enb-ethernet)
|
enb-ethernet)
|
||||||
VM_NAME=ci-enb-ethernet
|
VM_NAME=ci-enb-ethernet
|
||||||
|
|||||||
+21
-2
@@ -45,6 +45,8 @@ function usage {
|
|||||||
echo " --variant basic-sim OR -v2"
|
echo " --variant basic-sim OR -v2"
|
||||||
echo " --variant phy-sim OR -v3"
|
echo " --variant phy-sim OR -v3"
|
||||||
echo " --variant cppcheck OR -v4"
|
echo " --variant cppcheck OR -v4"
|
||||||
|
echo " --variant gnb-usrp OR -v5"
|
||||||
|
echo " --variant nu-ue-usrp OR -v6"
|
||||||
echo " --variant enb-ethernet OR -v7"
|
echo " --variant enb-ethernet OR -v7"
|
||||||
echo " --variant ue-ethernet OR -v8"
|
echo " --variant ue-ethernet OR -v8"
|
||||||
echo " Specify the variant to build."
|
echo " Specify the variant to build."
|
||||||
@@ -62,6 +64,8 @@ function variant_usage {
|
|||||||
echo " --variant basic-sim OR -v2"
|
echo " --variant basic-sim OR -v2"
|
||||||
echo " --variant phy-sim OR -v3"
|
echo " --variant phy-sim OR -v3"
|
||||||
echo " --variant cppcheck OR -v4"
|
echo " --variant cppcheck OR -v4"
|
||||||
|
echo " --variant gnb-usrp OR -v5"
|
||||||
|
echo " --variant nu-ue-usrp OR -v6"
|
||||||
echo " --variant enb-ethernet OR -v7"
|
echo " --variant enb-ethernet OR -v7"
|
||||||
echo " --variant ue-ethernet OR -v8"
|
echo " --variant ue-ethernet OR -v8"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -115,7 +119,15 @@ case $key in
|
|||||||
;;
|
;;
|
||||||
-v4)
|
-v4)
|
||||||
VM_NAME=ci-cppcheck
|
VM_NAME=ci-cppcheck
|
||||||
VM_MEMORY=4096
|
VM_MEMORY=8192
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v5)
|
||||||
|
VM_NAME=ci-gnb-usrp
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v6)
|
||||||
|
VM_NAME=ci-ue-nr-usrp
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v7)
|
-v7)
|
||||||
@@ -140,7 +152,13 @@ case $key in
|
|||||||
;;
|
;;
|
||||||
cppcheck)
|
cppcheck)
|
||||||
VM_NAME=ci-cppcheck
|
VM_NAME=ci-cppcheck
|
||||||
VM_MEMORY=4096
|
VM_MEMORY=8192
|
||||||
|
;;
|
||||||
|
gnb-usrp)
|
||||||
|
VM_NAME=ci-gnb-usrp
|
||||||
|
;;
|
||||||
|
nu-ue-usrp)
|
||||||
|
VM_NAME=ci-ue-nr-usrp
|
||||||
;;
|
;;
|
||||||
enb-ethernet)
|
enb-ethernet)
|
||||||
VM_NAME=ci-enb-ethernet
|
VM_NAME=ci-enb-ethernet
|
||||||
@@ -176,6 +194,7 @@ fi
|
|||||||
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
|
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
|
||||||
VM_CMDS=${VM_NAME}_cmds.txt
|
VM_CMDS=${VM_NAME}_cmds.txt
|
||||||
|
|
||||||
|
echo "VM_NAME = $VM_NAME"
|
||||||
echo "VM_MEMORY = $VM_MEMORY MBytes"
|
echo "VM_MEMORY = $VM_MEMORY MBytes"
|
||||||
|
|
||||||
echo "############################################################"
|
echo "############################################################"
|
||||||
|
|||||||
+433
-47
@@ -45,7 +45,7 @@ import xml.etree.ElementTree as ET
|
|||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import signal
|
import signal
|
||||||
from multiprocessing import Process,Lock
|
from multiprocessing import Process, Lock, SimpleQueue
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s"
|
format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s"
|
||||||
@@ -154,6 +154,34 @@ class SSHConnection():
|
|||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m')
|
logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m')
|
||||||
|
|
||||||
|
def copy(self, ipaddress, username, password, source, destination):
|
||||||
|
logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination)
|
||||||
|
scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5)
|
||||||
|
scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
|
||||||
|
if scp_response == 0:
|
||||||
|
scp_spawn.sendline('yes')
|
||||||
|
scp_spawn.expect('password:')
|
||||||
|
scp_spawn.sendline(password)
|
||||||
|
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
|
||||||
|
if scp_response == 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logging.debug('1 - scp_response = ' + str(scp_response))
|
||||||
|
sys.exit('SCP failed')
|
||||||
|
elif scp_response == 1:
|
||||||
|
scp_spawn.sendline(password)
|
||||||
|
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
|
||||||
|
if scp_response == 0 or scp_response == 3:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logging.debug('2 - scp_response = ' + str(scp_response))
|
||||||
|
sys.exit('SCP failed')
|
||||||
|
elif scp_response == 2:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logging.debug('3 - scp_response = ' + str(scp_response))
|
||||||
|
sys.exit('SCP failed')
|
||||||
|
|
||||||
def BuildeNB(self):
|
def BuildeNB(self):
|
||||||
if self.eNBIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.eNBSourceCodePath == '':
|
if self.eNBIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.eNBSourceCodePath == '':
|
||||||
Usage()
|
Usage()
|
||||||
@@ -254,7 +282,13 @@ class SSHConnection():
|
|||||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||||
# Initialize_eNB_args usually start with -O and followed by the location in repository
|
# Initialize_eNB_args usually start with -O and followed by the location in repository
|
||||||
full_config_file = self.Initialize_eNB_args.replace('-O ','')
|
full_config_file = self.Initialize_eNB_args.replace('-O ','')
|
||||||
config_path, config_file = os.path.split(full_config_file)
|
extIdx = full_config_file.find('.conf')
|
||||||
|
if (extIdx > 0):
|
||||||
|
extra_options = full_config_file[extIdx + 5:]
|
||||||
|
full_config_file = full_config_file[:extIdx + 5]
|
||||||
|
config_path, config_file = os.path.split(full_config_file)
|
||||||
|
else:
|
||||||
|
sys.exit('Insufficient Parameter')
|
||||||
ci_full_config_file = config_path + '/ci-' + config_file
|
ci_full_config_file = config_path + '/ci-' + config_file
|
||||||
# Make a copy and adapt to EPC / eNB IP addresses
|
# Make a copy and adapt to EPC / eNB IP addresses
|
||||||
self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
|
self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
|
||||||
@@ -264,7 +298,7 @@ class SSHConnection():
|
|||||||
# Launch eNB with the modified config file
|
# Launch eNB with the modified config file
|
||||||
self.command('source oaienv', '\$', 5)
|
self.command('source oaienv', '\$', 5)
|
||||||
self.command('cd cmake_targets', '\$', 5)
|
self.command('cd cmake_targets', '\$', 5)
|
||||||
self.command('echo "./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + '" > ./my-lte-softmodem-run.sh ', '\$', 5)
|
self.command('echo "./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run.sh ', '\$', 5)
|
||||||
self.command('chmod 775 ./my-lte-softmodem-run.sh ', '\$', 5)
|
self.command('chmod 775 ./my-lte-softmodem-run.sh ', '\$', 5)
|
||||||
self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '.log ./my-lte-softmodem-run.sh', '\$', 5)
|
self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '.log ./my-lte-softmodem-run.sh', '\$', 5)
|
||||||
time.sleep(6)
|
time.sleep(6)
|
||||||
@@ -274,7 +308,7 @@ class SSHConnection():
|
|||||||
loopCounter = loopCounter - 1
|
loopCounter = loopCounter - 1
|
||||||
if (loopCounter == 0):
|
if (loopCounter == 0):
|
||||||
doLoop = False
|
doLoop = False
|
||||||
logging.debug('\u001B[1;37;43m eNB logging system did not show got sync! See with attach later \u001B[0m')
|
logging.debug('\u001B[1;30;43m eNB logging system did not show got sync! See with attach later \u001B[0m')
|
||||||
self.CreateHtmlTestRow(config_file, 'eNB not showing got sync!', 0)
|
self.CreateHtmlTestRow(config_file, 'eNB not showing got sync!', 0)
|
||||||
# Not getting got sync is bypassed for the moment
|
# Not getting got sync is bypassed for the moment
|
||||||
#sys.exit(1)
|
#sys.exit(1)
|
||||||
@@ -319,21 +353,32 @@ class SSHConnection():
|
|||||||
job.join()
|
job.join()
|
||||||
self.CreateHtmlTestRow('N/A', 'OK', 0)
|
self.CreateHtmlTestRow('N/A', 'OK', 0)
|
||||||
|
|
||||||
def AttachUE_common(self, device_id):
|
def AttachUE_common(self, device_id, statusQueue, lock):
|
||||||
try:
|
try:
|
||||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60)
|
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
count = 45
|
max_count = 45
|
||||||
|
count = max_count
|
||||||
while count > 0:
|
while count > 0:
|
||||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell dumpsys telephony.registry | grep mDataConnectionState', '\$', 15)
|
self.command('stdbuf -o0 adb -s ' + device_id + ' shell dumpsys telephony.registry | grep mDataConnectionState', '\$', 15)
|
||||||
result = re.search('mDataConnectionState.*=(?P<state>[0-9\-]+)', str(self.ssh.before))
|
result = re.search('mDataConnectionState.*=(?P<state>[0-9\-]+)', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
logging.debug('\u001B[1;37;41m mDataConnectionState Not Found! \u001B[0m')
|
logging.debug('\u001B[1;37;41m mDataConnectionState Not Found! \u001B[0m')
|
||||||
sys.exit(1)
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put('mDataConnectionState Not Found!')
|
||||||
|
lock.release()
|
||||||
|
break
|
||||||
mDataConnectionState = int(result.group('state'))
|
mDataConnectionState = int(result.group('state'))
|
||||||
if mDataConnectionState == 2:
|
if mDataConnectionState == 2:
|
||||||
logging.debug('\u001B[1mUE (' + device_id + ') Attach Completed\u001B[0m')
|
logging.debug('\u001B[1mUE (' + device_id + ') Attach Completed\u001B[0m')
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(max_count - count)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put('Attach Completed')
|
||||||
|
lock.release()
|
||||||
break
|
break
|
||||||
count = count - 1
|
count = count - 1
|
||||||
if count == 15 or count == 30:
|
if count == 15 or count == 30:
|
||||||
@@ -342,11 +387,15 @@ class SSHConnection():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60)
|
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
logging.debug('\u001B[1mWait UE (' + device_id + ') a second until mDataConnectionState=2 (' + str(45-count) + ' times)\u001B[0m')
|
logging.debug('\u001B[1mWait UE (' + device_id + ') a second until mDataConnectionState=2 (' + str(max_count-count) + ' times)\u001B[0m')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if count == 0:
|
if count == 0:
|
||||||
logging.debug('\u001B[1;37;41m UE (' + device_id + ') Attach Failed \u001B[0m')
|
logging.debug('\u001B[1;37;41m UE (' + device_id + ') Attach Failed \u001B[0m')
|
||||||
sys.exit(1)
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put('Attach Failed')
|
||||||
|
lock.release()
|
||||||
self.close()
|
self.close()
|
||||||
except:
|
except:
|
||||||
os.kill(os.getppid(),signal.SIGUSR1)
|
os.kill(os.getppid(),signal.SIGUSR1)
|
||||||
@@ -358,14 +407,39 @@ class SSHConnection():
|
|||||||
initialize_eNB_flag = False
|
initialize_eNB_flag = False
|
||||||
self.CheckProcessExist(initialize_eNB_flag)
|
self.CheckProcessExist(initialize_eNB_flag)
|
||||||
multi_jobs = []
|
multi_jobs = []
|
||||||
|
status_queue = SimpleQueue()
|
||||||
|
lock = Lock()
|
||||||
for device_id in self.UEDevices:
|
for device_id in self.UEDevices:
|
||||||
p = Process(target = SSH.AttachUE_common, args = (device_id,))
|
p = Process(target = SSH.AttachUE_common, args = (device_id, status_queue, lock,))
|
||||||
p.daemon = True
|
p.daemon = True
|
||||||
p.start()
|
p.start()
|
||||||
multi_jobs.append(p)
|
multi_jobs.append(p)
|
||||||
for job in multi_jobs:
|
for job in multi_jobs:
|
||||||
job.join()
|
job.join()
|
||||||
self.CreateHtmlTestRow('N/A', 'OK', len(self.UEDevices))
|
|
||||||
|
if (status_queue.empty()):
|
||||||
|
self.CreateHtmlTestRow('N/A', 'KO', len(self.UEDevices))
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
attach_status = True
|
||||||
|
html_queue = SimpleQueue()
|
||||||
|
while (not status_queue.empty()):
|
||||||
|
count = status_queue.get()
|
||||||
|
if (count < 0):
|
||||||
|
attach_status = False
|
||||||
|
device_id = status_queue.get()
|
||||||
|
message = status_queue.get()
|
||||||
|
if (count < 0):
|
||||||
|
html_cell = "<pre>UE (" + device_id + ")\n" + message + "</pre>"
|
||||||
|
else:
|
||||||
|
html_cell = "<pre>UE (" + device_id + ")\n" + message + ' in ' + str(count + 2) + ' seconds</pre>'
|
||||||
|
html_queue.put(html_cell)
|
||||||
|
if (attach_status):
|
||||||
|
self.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue)
|
||||||
|
else:
|
||||||
|
self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue)
|
||||||
|
self.CreateHtmlFooter()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def DetachUE_common(self, device_id):
|
def DetachUE_common(self, device_id):
|
||||||
try:
|
try:
|
||||||
@@ -481,7 +555,7 @@ class SSHConnection():
|
|||||||
self.UEIPAddresses.append(UE_IPAddress)
|
self.UEIPAddresses.append(UE_IPAddress)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def Ping_common(self, lock, UE_IPAddress, device_id):
|
def Ping_common(self, lock, UE_IPAddress, device_id,statusQueue):
|
||||||
try:
|
try:
|
||||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||||
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
|
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
|
||||||
@@ -490,32 +564,65 @@ class SSHConnection():
|
|||||||
self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
|
self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
|
||||||
result = re.search(', (?P<packetloss>[0-9\.]+)% packet loss, time [0-9\.]+ms', str(self.ssh.before))
|
result = re.search(', (?P<packetloss>[0-9\.]+)% packet loss, time [0-9\.]+ms', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
logging.debug('\u001B[1;37;41m Packet Loss Not Found! \u001B[0m')
|
message = 'Packet Loss Not Found!'
|
||||||
sys.exit(1)
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(message)
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
packetloss = result.group('packetloss')
|
packetloss = result.group('packetloss')
|
||||||
if float(packetloss) == 100:
|
if float(packetloss) == 100:
|
||||||
logging.debug('\u001B[1;37;41m Packet Loss is 100% \u001B[0m')
|
message = 'Packet Loss is 100%'
|
||||||
sys.exit(1)
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(message)
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
result = re.search('rtt min\/avg\/max\/mdev = (?P<rtt_min>[0-9\.]+)\/(?P<rtt_avg>[0-9\.]+)\/(?P<rtt_max>[0-9\.]+)\/[0-9\.]+ ms', str(self.ssh.before))
|
result = re.search('rtt min\/avg\/max\/mdev = (?P<rtt_min>[0-9\.]+)\/(?P<rtt_avg>[0-9\.]+)\/(?P<rtt_max>[0-9\.]+)\/[0-9\.]+ ms', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
logging.debug('\u001B[1;37;41m Ping RTT_Min RTT_Avg RTT_Max Not Found! \u001B[0m')
|
message = 'Ping RTT_Min RTT_Avg RTT_Max Not Found!'
|
||||||
sys.exit(1)
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(message)
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
rtt_min = result.group('rtt_min')
|
rtt_min = result.group('rtt_min')
|
||||||
rtt_avg = result.group('rtt_avg')
|
rtt_avg = result.group('rtt_avg')
|
||||||
rtt_max = result.group('rtt_max')
|
rtt_max = result.group('rtt_max')
|
||||||
|
pal_msg = 'Packet Loss : ' + packetloss + '%'
|
||||||
|
min_msg = 'RTT(Min) : ' + rtt_min + ' ms'
|
||||||
|
avg_msg = 'RTT(Avg) : ' + rtt_avg + ' ms'
|
||||||
|
max_msg = 'RTT(Max) : ' + rtt_max + ' ms'
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
logging.debug('\u001B[1;37;44m ping result (' + UE_IPAddress + ') \u001B[0m')
|
logging.debug('\u001B[1;37;44m ping result (' + UE_IPAddress + ') \u001B[0m')
|
||||||
logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m')
|
logging.debug('\u001B[1;34m ' + pal_msg + '\u001B[0m')
|
||||||
logging.debug('\u001B[1;34m RTT(Min) : ' + rtt_min + ' ms' + '\u001B[0m')
|
logging.debug('\u001B[1;34m ' + min_msg + '\u001B[0m')
|
||||||
logging.debug('\u001B[1;34m RTT(Avg) : ' + rtt_avg + ' ms' + '\u001B[0m')
|
logging.debug('\u001B[1;34m ' + avg_msg + '\u001B[0m')
|
||||||
logging.debug('\u001B[1;34m RTT(Max) : ' + rtt_max + ' ms' + '\u001B[0m')
|
logging.debug('\u001B[1;34m ' + max_msg + '\u001B[0m')
|
||||||
lock.release()
|
qMsg = pal_msg + '\n' + min_msg + '\n' + avg_msg + '\n' + max_msg
|
||||||
|
packetLossOK = True
|
||||||
if packetloss is not None:
|
if packetloss is not None:
|
||||||
if float(packetloss) > float(self.ping_packetloss_threshold):
|
if float(packetloss) > float(self.ping_packetloss_threshold):
|
||||||
|
qMsg += '\nPacket Loss too high'
|
||||||
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
||||||
sys.exit(1)
|
packetLossOK = False
|
||||||
elif float(packetloss) > 0:
|
elif float(packetloss) > 0:
|
||||||
|
qMsg += '\nPacket Loss is not 0%'
|
||||||
logging.debug('\u001B[1;37;43m Packet Loss is not 0% \u001B[0m')
|
logging.debug('\u001B[1;37;43m Packet Loss is not 0% \u001B[0m')
|
||||||
|
if (packetLossOK):
|
||||||
|
statusQueue.put(0)
|
||||||
|
else:
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put(qMsg)
|
||||||
|
lock.release()
|
||||||
self.close()
|
self.close()
|
||||||
except:
|
except:
|
||||||
os.kill(os.getppid(),signal.SIGUSR1)
|
os.kill(os.getppid(),signal.SIGUSR1)
|
||||||
@@ -530,16 +637,38 @@ class SSHConnection():
|
|||||||
multi_jobs = []
|
multi_jobs = []
|
||||||
i = 0
|
i = 0
|
||||||
lock = Lock()
|
lock = Lock()
|
||||||
|
status_queue = SimpleQueue()
|
||||||
for UE_IPAddress in self.UEIPAddresses:
|
for UE_IPAddress in self.UEIPAddresses:
|
||||||
device_id = self.UEDevices[i]
|
device_id = self.UEDevices[i]
|
||||||
p = Process(target = SSH.Ping_common, args = (lock,UE_IPAddress,device_id,))
|
p = Process(target = SSH.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,))
|
||||||
p.daemon = True
|
p.daemon = True
|
||||||
p.start()
|
p.start()
|
||||||
multi_jobs.append(p)
|
multi_jobs.append(p)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
for job in multi_jobs:
|
for job in multi_jobs:
|
||||||
job.join()
|
job.join()
|
||||||
self.CreateHtmlTestRow(self.ping_args, 'OK', 0)
|
|
||||||
|
if (status_queue.empty()):
|
||||||
|
self.CreateHtmlTestRow(self.ping_args, 'KO', len(self.UEDevices))
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
ping_status = True
|
||||||
|
html_queue = SimpleQueue()
|
||||||
|
while (not status_queue.empty()):
|
||||||
|
count = status_queue.get()
|
||||||
|
if (count < 0):
|
||||||
|
ping_status = False
|
||||||
|
device_id = status_queue.get()
|
||||||
|
ip_addr = status_queue.get()
|
||||||
|
message = status_queue.get()
|
||||||
|
html_cell = "<pre>UE (" + device_id + ")\nIP Address : " + ip_addr + "\n" + message + "</pre>"
|
||||||
|
html_queue.put(html_cell)
|
||||||
|
if (ping_status):
|
||||||
|
self.CreateHtmlTestRowQueue(self.ping_args, 'OK', len(self.UEDevices), html_queue)
|
||||||
|
else:
|
||||||
|
self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue)
|
||||||
|
self.CreateHtmlFooter()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def Iperf_ComputeTime(self):
|
def Iperf_ComputeTime(self):
|
||||||
result = re.search('-t (?P<iperf_time>\d+)', str(self.iperf_args))
|
result = re.search('-t (?P<iperf_time>\d+)', str(self.iperf_args))
|
||||||
@@ -573,7 +702,7 @@ class SSHConnection():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def Iperf_analyzeV2Output(self, lock, UE_IPAddress):
|
def Iperf_analyzeV2Output(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options):
|
||||||
result = re.search('Server Report:', str(self.ssh.before))
|
result = re.search('Server Report:', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
result = re.search('read failed: Connection refused', str(self.ssh.before))
|
result = re.search('read failed: Connection refused', str(self.ssh.before))
|
||||||
@@ -581,7 +710,25 @@ class SSHConnection():
|
|||||||
logging.debug('\u001B[1;37;41m Could not connect to iperf server! \u001B[0m')
|
logging.debug('\u001B[1;37;41m Could not connect to iperf server! \u001B[0m')
|
||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1;37;41m Server Report and Connection refused Not Found! \u001B[0m')
|
logging.debug('\u001B[1;37;41m Server Report and Connection refused Not Found! \u001B[0m')
|
||||||
sys.exit(1)
|
return -1
|
||||||
|
# Computing the requested bandwidth in float
|
||||||
|
result = re.search('-b (?P<iperf_bandwidth>[0-9\.]+)[KMG]', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = result.group('iperf_bandwidth')
|
||||||
|
req_bw = float(req_bandwidth)
|
||||||
|
result = re.search('-b [0-9\.]+K', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Kbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000
|
||||||
|
result = re.search('-b [0-9\.]+M', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Mbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000000
|
||||||
|
result = re.search('-b [0-9\.]+G', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Gbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000000000
|
||||||
|
|
||||||
result = re.search('Server Report:\\\\r\\\\n(?:|\[ *\d+\].*) (?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(\d+\/..\d+) (\((?P<packetloss>[0-9\.]+)%\))', str(self.ssh.before))
|
result = re.search('Server Report:\\\\r\\\\n(?:|\[ *\d+\].*) (?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(\d+\/..\d+) (\((?P<packetloss>[0-9\.]+)%\))', str(self.ssh.before))
|
||||||
if result is not None:
|
if result is not None:
|
||||||
bitrate = result.group('bitrate')
|
bitrate = result.group('bitrate')
|
||||||
@@ -589,41 +736,201 @@ class SSHConnection():
|
|||||||
jitter = result.group('jitter')
|
jitter = result.group('jitter')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
logging.debug('\u001B[1;37;44m iperf result (' + UE_IPAddress + ') \u001B[0m')
|
logging.debug('\u001B[1;37;44m iperf result (' + UE_IPAddress + ') \u001B[0m')
|
||||||
|
iperfStatus = True
|
||||||
|
msg = 'Req Bitrate : ' + req_bandwidth + '\n'
|
||||||
|
logging.debug('\u001B[1;34m Req Bitrate : ' + req_bandwidth + '\u001B[0m')
|
||||||
if bitrate is not None:
|
if bitrate is not None:
|
||||||
|
msg += 'Bitrate : ' + bitrate + '\n'
|
||||||
logging.debug('\u001B[1;34m Bitrate : ' + bitrate + '\u001B[0m')
|
logging.debug('\u001B[1;34m Bitrate : ' + bitrate + '\u001B[0m')
|
||||||
|
result = re.search('(?P<real_bw>[0-9\.]+) [KMG]bits/sec', str(bitrate))
|
||||||
|
if result is not None:
|
||||||
|
actual_bw = float(str(result.group('real_bw')))
|
||||||
|
result = re.search('[0-9\.]+ K', bitrate)
|
||||||
|
if result is not None:
|
||||||
|
actual_bw = actual_bw * 1000
|
||||||
|
result = re.search('[0-9\.]+ M', bitrate)
|
||||||
|
if result is not None:
|
||||||
|
actual_bw = actual_bw * 1000000
|
||||||
|
result = re.search('[0-9\.]+ G', bitrate)
|
||||||
|
if result is not None:
|
||||||
|
actual_bw = actual_bw * 1000000000
|
||||||
|
br_loss = 100 * actual_bw / req_bw
|
||||||
|
bitperf = '%.2f ' % br_loss
|
||||||
|
msg += 'Bitrate Perf: ' + bitperf + '%\n'
|
||||||
|
logging.debug('\u001B[1;34m Bitrate Perf: ' + bitperf + '%\u001B[0m')
|
||||||
if packetloss is not None:
|
if packetloss is not None:
|
||||||
|
msg += 'Packet Loss : ' + packetloss + '%\n'
|
||||||
logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m')
|
logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m')
|
||||||
if float(packetloss) > float(self.iperf_packetloss_threshold):
|
if float(packetloss) > float(self.iperf_packetloss_threshold):
|
||||||
|
msg += 'Packet Loss too high!\n'
|
||||||
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
||||||
lock.release()
|
iperfStatus = False
|
||||||
sys.exit(1)
|
|
||||||
if jitter is not None:
|
if jitter is not None:
|
||||||
|
msg += 'Jitter : ' + jitter + '\n'
|
||||||
logging.debug('\u001B[1;34m Jitter : ' + jitter + '\u001B[0m')
|
logging.debug('\u001B[1;34m Jitter : ' + jitter + '\u001B[0m')
|
||||||
|
if (iperfStatus):
|
||||||
|
statusQueue.put(0)
|
||||||
|
else:
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put(msg)
|
||||||
|
lock.release()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options):
|
||||||
|
if (not os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put('Could not analyze from server log')
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
|
# Computing the requested bandwidth in float
|
||||||
|
result = re.search('-b (?P<iperf_bandwidth>[0-9\.]+)[KMG]', str(iperf_real_options))
|
||||||
|
if result is None:
|
||||||
|
logging.debug('Iperf bandwidth Not Found!')
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put('Could not compute Iperf bandwidth!')
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
req_bandwidth = result.group('iperf_bandwidth')
|
||||||
|
req_bw = float(req_bandwidth)
|
||||||
|
result = re.search('-b [0-9\.]+K', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Kbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000
|
||||||
|
result = re.search('-b [0-9\.]+M', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Mbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000000
|
||||||
|
result = re.search('-b [0-9\.]+G', str(iperf_real_options))
|
||||||
|
if result is not None:
|
||||||
|
req_bandwidth = '%.1f Gbits/sec' % req_bw
|
||||||
|
req_bw = req_bw * 1000000000
|
||||||
|
|
||||||
|
server_file = open('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', 'r')
|
||||||
|
br_sum = 0.0
|
||||||
|
ji_sum = 0.0
|
||||||
|
pl_sum = 0
|
||||||
|
ps_sum = 0
|
||||||
|
row_idx = 0
|
||||||
|
for line in server_file.readlines():
|
||||||
|
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(?P<lostPack>[0-9]+)/ +(?P<sentPack>[0-9]+)', str(line))
|
||||||
|
if result is not None:
|
||||||
|
bitrate = result.group('bitrate')
|
||||||
|
jitter = result.group('jitter')
|
||||||
|
packetlost = result.group('lostPack')
|
||||||
|
packetsent = result.group('sentPack')
|
||||||
|
br = bitrate.split(' ')
|
||||||
|
ji = jitter.split(' ')
|
||||||
|
row_idx = row_idx + 1
|
||||||
|
curr_br = float(br[0])
|
||||||
|
pl_sum = pl_sum + int(packetlost)
|
||||||
|
ps_sum = ps_sum + int(packetsent)
|
||||||
|
if (br[1] == 'Kbits/sec'):
|
||||||
|
curr_br = curr_br * 1000
|
||||||
|
if (br[1] == 'Mbits/sec'):
|
||||||
|
curr_br = curr_br * 1000 * 1000
|
||||||
|
br_sum = curr_br + br_sum
|
||||||
|
ji_sum = float(ji[0]) + ji_sum
|
||||||
|
if (row_idx > 0):
|
||||||
|
br_sum = br_sum / row_idx
|
||||||
|
ji_sum = ji_sum / row_idx
|
||||||
|
br_loss = 100 * br_sum / req_bw
|
||||||
|
if (br_sum > 1000):
|
||||||
|
br_sum = br_sum / 1000
|
||||||
|
if (br_sum > 1000):
|
||||||
|
br_sum = br_sum / 1000
|
||||||
|
bitrate = '%.2f Mbits/sec' % br_sum
|
||||||
|
else:
|
||||||
|
bitrate = '%.2f Kbits/sec' % br_sum
|
||||||
|
else:
|
||||||
|
bitrate = '%.2f bits/sec' % br_sum
|
||||||
|
bitperf = '%.2f ' % br_loss
|
||||||
|
bitperf += '%'
|
||||||
|
jitter = '%.2f ms' % (ji_sum)
|
||||||
|
if (ps_sum > 0):
|
||||||
|
pl = float(100 * pl_sum / ps_sum)
|
||||||
|
packetloss = '%2.1f ' % (pl)
|
||||||
|
packetloss += '%'
|
||||||
|
else:
|
||||||
|
packetloss = 'unknown'
|
||||||
|
lock.acquire()
|
||||||
|
if (br_loss < 90):
|
||||||
|
statusQueue.put(1)
|
||||||
|
else:
|
||||||
|
statusQueue.put(0)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
req_msg = 'Req Bitrate : ' + req_bandwidth
|
||||||
|
bir_msg = 'Bitrate : ' + bitrate
|
||||||
|
brl_msg = 'Bitrate Perf: ' + bitperf
|
||||||
|
jit_msg = 'Jitter : ' + jitter
|
||||||
|
pal_msg = 'Packet Loss : ' + packetloss
|
||||||
|
statusQueue.put(req_msg + '\n' + bir_msg + '\n' + brl_msg + '\n' + jit_msg + '\n' + pal_msg + '\n')
|
||||||
|
logging.debug('\u001B[1;37;45m iperf result (' + UE_IPAddress + ') \u001B[0m')
|
||||||
|
logging.debug('\u001B[1;35m ' + req_msg + '\u001B[0m')
|
||||||
|
logging.debug('\u001B[1;35m ' + bir_msg + '\u001B[0m')
|
||||||
|
logging.debug('\u001B[1;35m ' + brl_msg + '\u001B[0m')
|
||||||
|
logging.debug('\u001B[1;35m ' + jit_msg + '\u001B[0m')
|
||||||
|
logging.debug('\u001B[1;35m ' + pal_msg + '\u001B[0m')
|
||||||
|
lock.release()
|
||||||
|
else:
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put('Could not analyze from server log')
|
||||||
lock.release()
|
lock.release()
|
||||||
|
|
||||||
def Iperf_analyzeV3Output(self, lock, UE_IPAddress):
|
server_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
def Iperf_analyzeV3Output(self, lock, UE_IPAddress, device_id, statusQueue):
|
||||||
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?:|[0-9\.]+ ms +\d+\/\d+ \((?P<packetloss>[0-9\.]+)%\)) +(?:|receiver)\\\\r\\\\n(?:|\[ *\d+\] Sent \d+ datagrams)\\\\r\\\\niperf Done\.', str(self.ssh.before))
|
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?:|[0-9\.]+ ms +\d+\/\d+ \((?P<packetloss>[0-9\.]+)%\)) +(?:|receiver)\\\\r\\\\n(?:|\[ *\d+\] Sent \d+ datagrams)\\\\r\\\\niperf Done\.', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
result = re.search('(?P<error>iperf: error - [a-zA-Z0-9 :]+)', str(self.ssh.before))
|
result = re.search('(?P<error>iperf: error - [a-zA-Z0-9 :]+)', str(self.ssh.before))
|
||||||
|
lock.acquire()
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
logging.debug('\u001B[1;37;41m ' + result.group('error') + ' \u001B[0m')
|
logging.debug('\u001B[1;37;41m ' + result.group('error') + ' \u001B[0m')
|
||||||
|
statusQueue.put(result.group('error'))
|
||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1;37;41m Bitrate and/or Packet Loss Not Found! \u001B[0m')
|
logging.debug('\u001B[1;37;41m Bitrate and/or Packet Loss Not Found! \u001B[0m')
|
||||||
sys.exit(1)
|
statusQueue.put('Bitrate and/or Packet Loss Not Found!')
|
||||||
|
lock.release()
|
||||||
|
|
||||||
bitrate = result.group('bitrate')
|
bitrate = result.group('bitrate')
|
||||||
packetloss = result.group('packetloss')
|
packetloss = result.group('packetloss')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
logging.debug('\u001B[1;37;44m iperf result (' + UE_IPAddress + ') \u001B[0m')
|
logging.debug('\u001B[1;37;44m iperf result (' + UE_IPAddress + ') \u001B[0m')
|
||||||
logging.debug('\u001B[1;34m Bitrate : ' + bitrate + '\u001B[0m')
|
logging.debug('\u001B[1;34m Bitrate : ' + bitrate + '\u001B[0m')
|
||||||
|
msg = 'Bitrate : ' + bitrate + '\n'
|
||||||
|
iperfStatus = True
|
||||||
if packetloss is not None:
|
if packetloss is not None:
|
||||||
logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m')
|
logging.debug('\u001B[1;34m Packet Loss : ' + packetloss + '%\u001B[0m')
|
||||||
|
msg += 'Packet Loss : ' + packetloss + '%\n'
|
||||||
if float(packetloss) > float(self.iperf_packetloss_threshold):
|
if float(packetloss) > float(self.iperf_packetloss_threshold):
|
||||||
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
||||||
lock.release()
|
msg += 'Packet Loss too high!\n'
|
||||||
sys.exit(1)
|
iperfStatus = False
|
||||||
|
if (iperfStatus):
|
||||||
|
statusQueue.put(0)
|
||||||
|
else:
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
lock.release()
|
lock.release()
|
||||||
|
|
||||||
def Iperf_UL_common(self, lock, UE_IPAddress, device_id, idx, ue_num):
|
def Iperf_UL_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
|
||||||
ipnumbers = UE_IPAddress.split('.')
|
ipnumbers = UE_IPAddress.split('.')
|
||||||
if (len(ipnumbers) == 4):
|
if (len(ipnumbers) == 4):
|
||||||
ipnumbers[3] = '1'
|
ipnumbers[3] = '1'
|
||||||
@@ -645,25 +952,32 @@ class SSHConnection():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
modified_options = self.Iperf_ComputeModifiedBW(idx, ue_num)
|
modified_options = self.Iperf_ComputeModifiedBW(idx, ue_num)
|
||||||
|
modified_options = modified_options.replace('-R','')
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||||
self.Iperf_analyzeV2Output(lock, UE_IPAddress)
|
clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||||
|
|
||||||
# Launch iperf server on EPC side
|
# Launch iperf server on EPC side
|
||||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||||
self.command('killall --signal SIGKILL iperf', self.EPCUserName, 5)
|
self.command('killall --signal SIGKILL iperf', self.EPCUserName, 5)
|
||||||
self.close()
|
self.close()
|
||||||
|
if (clientStatus == -1):
|
||||||
|
time.sleep(1)
|
||||||
|
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||||
|
os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')
|
||||||
|
self.copy(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.')
|
||||||
|
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||||
|
|
||||||
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num):
|
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
|
||||||
try:
|
try:
|
||||||
# Single-UE profile -- iperf only on one UE
|
# Single-UE profile -- iperf only on one UE
|
||||||
if SSH.iperf_profile == 'single-ue' and idx != 0:
|
if SSH.iperf_profile == 'single-ue' and idx != 0:
|
||||||
return
|
return
|
||||||
useIperf3 = False
|
useIperf3 = False
|
||||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||||
# if by chance ADB server and EPC are on the same remote host, at least log collection will take of it
|
# if by chance ADB server and EPC are on the same remote host, at least log collection will take care of it
|
||||||
self.command('if [ ! -d ' + self.EPCSourceCodePath + '/scripts ]; then mkdir -p ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5)
|
self.command('if [ ! -d ' + self.EPCSourceCodePath + '/scripts ]; then mkdir -p ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5)
|
||||||
self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
|
self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
|
||||||
# Checking if iperf / iperf3 are installed
|
# Checking if iperf / iperf3 are installed
|
||||||
@@ -672,8 +986,16 @@ class SSHConnection():
|
|||||||
if result is None:
|
if result is None:
|
||||||
result = re.search('iperf', str(self.ssh.before))
|
result = re.search('iperf', str(self.ssh.before))
|
||||||
if result is None:
|
if result is None:
|
||||||
logging.debug('\u001B[1;37;41m Neither iperf nor iperf3 installed on UE! \u001B[0m')
|
message = 'Neither iperf nor iperf3 installed on UE!'
|
||||||
sys.exit(1)
|
lock.acquire()
|
||||||
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
||||||
|
statusQueue.put(-1)
|
||||||
|
statusQueue.put(device_id)
|
||||||
|
statusQueue.put(UE_IPAddress)
|
||||||
|
statusQueue.put(message)
|
||||||
|
lock.release()
|
||||||
|
return
|
||||||
|
#sys.exit(1)
|
||||||
else:
|
else:
|
||||||
useIperf3 = True
|
useIperf3 = True
|
||||||
# in case of iperf, UL has its own function
|
# in case of iperf, UL has its own function
|
||||||
@@ -681,7 +1003,7 @@ class SSHConnection():
|
|||||||
result = re.search('-R', str(self.iperf_args))
|
result = re.search('-R', str(self.iperf_args))
|
||||||
if result is not None:
|
if result is not None:
|
||||||
self.close()
|
self.close()
|
||||||
self.Iperf_UL_common(lock, UE_IPAddress, device_id, idx, ue_num)
|
self.Iperf_UL_common(lock, UE_IPAddress, device_id, idx, ue_num, statusQueue)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (useIperf3):
|
if (useIperf3):
|
||||||
@@ -704,11 +1026,12 @@ class SSHConnection():
|
|||||||
if (useIperf3):
|
if (useIperf3):
|
||||||
self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||||
|
|
||||||
self.Iperf_analyzeV3Output(lock, UE_IPAddress)
|
clientStatus = 0
|
||||||
|
self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue)
|
||||||
else:
|
else:
|
||||||
self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||||
|
|
||||||
self.Iperf_analyzeV2Output(lock, UE_IPAddress)
|
clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||||
@@ -718,6 +1041,12 @@ class SSHConnection():
|
|||||||
pid_iperf = result.group('pid')
|
pid_iperf = result.group('pid')
|
||||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5)
|
self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5)
|
||||||
self.close()
|
self.close()
|
||||||
|
if (clientStatus == -1):
|
||||||
|
time.sleep(1)
|
||||||
|
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||||
|
os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')
|
||||||
|
self.copy(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.')
|
||||||
|
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||||
except:
|
except:
|
||||||
os.kill(os.getppid(),signal.SIGUSR1)
|
os.kill(os.getppid(),signal.SIGUSR1)
|
||||||
|
|
||||||
@@ -732,16 +1061,43 @@ class SSHConnection():
|
|||||||
i = 0
|
i = 0
|
||||||
ue_num = len(self.UEIPAddresses)
|
ue_num = len(self.UEIPAddresses)
|
||||||
lock = Lock()
|
lock = Lock()
|
||||||
|
status_queue = SimpleQueue()
|
||||||
for UE_IPAddress in self.UEIPAddresses:
|
for UE_IPAddress in self.UEIPAddresses:
|
||||||
device_id = self.UEDevices[i]
|
device_id = self.UEDevices[i]
|
||||||
p = Process(target = SSH.Iperf_common, args = (lock,UE_IPAddress,device_id,i,ue_num,))
|
p = Process(target = SSH.Iperf_common, args = (lock,UE_IPAddress,device_id,i,ue_num,status_queue,))
|
||||||
p.daemon = True
|
p.daemon = True
|
||||||
p.start()
|
p.start()
|
||||||
multi_jobs.append(p)
|
multi_jobs.append(p)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
for job in multi_jobs:
|
for job in multi_jobs:
|
||||||
job.join()
|
job.join()
|
||||||
self.CreateHtmlTestRow(self.iperf_args, 'OK', 0)
|
|
||||||
|
if (status_queue.empty()):
|
||||||
|
self.CreateHtmlTestRow(self.iperf_args, 'KO', len(self.UEDevices))
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
iperf_status = True
|
||||||
|
iperf_noperf = False
|
||||||
|
html_queue = SimpleQueue()
|
||||||
|
while (not status_queue.empty()):
|
||||||
|
count = status_queue.get()
|
||||||
|
if (count < 0):
|
||||||
|
iperf_status = False
|
||||||
|
if (count > 0):
|
||||||
|
iperf_noperf = True
|
||||||
|
device_id = status_queue.get()
|
||||||
|
ip_addr = status_queue.get()
|
||||||
|
message = status_queue.get()
|
||||||
|
html_cell = "<pre>UE (" + device_id + ")\nIP Address : " + ip_addr + "\n" + message + "</pre>"
|
||||||
|
html_queue.put(html_cell)
|
||||||
|
if (iperf_noperf and iperf_status):
|
||||||
|
self.CreateHtmlTestRowQueue(self.iperf_args, 'PERF NOT MET', len(self.UEDevices), html_queue)
|
||||||
|
elif (iperf_status):
|
||||||
|
self.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue)
|
||||||
|
else:
|
||||||
|
self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
|
||||||
|
self.CreateHtmlFooter()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def CheckProcessExist(self, initialize_eNB_flag):
|
def CheckProcessExist(self, initialize_eNB_flag):
|
||||||
multi_jobs = []
|
multi_jobs = []
|
||||||
@@ -872,6 +1228,7 @@ class SSHConnection():
|
|||||||
self.command('cd /opt/ltebox/tools', '\$', 5)
|
self.command('cd /opt/ltebox/tools', '\$', 5)
|
||||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./stop_mme', '\$', 5)
|
self.command('echo ' + self.EPCPassword + ' | sudo -S ./stop_mme', '\$', 5)
|
||||||
self.close()
|
self.close()
|
||||||
|
self.CreateHtmlTestRow('N/A', 'OK', 0)
|
||||||
|
|
||||||
def TerminateSPGW(self):
|
def TerminateSPGW(self):
|
||||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||||
@@ -1099,6 +1456,35 @@ class SSHConnection():
|
|||||||
i += 1
|
i += 1
|
||||||
self.htmlFile.write(' </tr>\n')
|
self.htmlFile.write(' </tr>\n')
|
||||||
|
|
||||||
|
def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue):
|
||||||
|
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
|
||||||
|
addOrangeBK = False
|
||||||
|
self.htmlFile.write(' <tr>\n')
|
||||||
|
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + SSH.testCase_id + '</td>\n')
|
||||||
|
self.htmlFile.write(' <td>' + SSH.desc + '</td>\n')
|
||||||
|
self.htmlFile.write(' <td>' + str(options) + '</td>\n')
|
||||||
|
if (str(status) == 'OK'):
|
||||||
|
self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n')
|
||||||
|
elif (str(status) == 'KO'):
|
||||||
|
self.htmlFile.write(' <td bgcolor = "lightcoral" >' + str(status) + '</td>\n')
|
||||||
|
else:
|
||||||
|
addOrangeBK = True
|
||||||
|
self.htmlFile.write(' <td bgcolor = "orange" >' + str(status) + '</td>\n')
|
||||||
|
i = 0
|
||||||
|
while (i < self.htmlUEConnected):
|
||||||
|
if (i < ue_status):
|
||||||
|
if (not ue_queue.empty()):
|
||||||
|
if (addOrangeBK):
|
||||||
|
self.htmlFile.write(' <td bgcolor = "orange" >' + str(ue_queue.get()) + '</td>\n')
|
||||||
|
else:
|
||||||
|
self.htmlFile.write(' <td>' + str(ue_queue.get()) + '</td>\n')
|
||||||
|
else:
|
||||||
|
self.htmlFile.write(' <td>-</td>\n')
|
||||||
|
else:
|
||||||
|
self.htmlFile.write(' <td>-</td>\n')
|
||||||
|
i += 1
|
||||||
|
self.htmlFile.write(' </tr>\n')
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Usage()
|
# Usage()
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
@@ -1110,8 +1496,8 @@ def Usage():
|
|||||||
print(' --help Show this help.')
|
print(' --help Show this help.')
|
||||||
print(' --mode=[Mode]')
|
print(' --mode=[Mode]')
|
||||||
print(' TesteNB')
|
print(' TesteNB')
|
||||||
print(' TerminateeNB, TerminateEPC')
|
print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW')
|
||||||
print(' LogCollectBuild, LogCollecteNB, LogCollectEPC, LogCollectADB')
|
print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf')
|
||||||
print(' --eNBIPAddress=[eNB\'s IP Address]')
|
print(' --eNBIPAddress=[eNB\'s IP Address]')
|
||||||
print(' --eNBRepository=[eNB\'s Repository URL]')
|
print(' --eNBRepository=[eNB\'s Repository URL]')
|
||||||
print(' --eNBBranch=[eNB\'s Branch Name]')
|
print(' --eNBBranch=[eNB\'s Branch Name]')
|
||||||
|
|||||||
@@ -531,6 +531,27 @@ summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt
|
|||||||
summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html
|
summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html
|
||||||
summary_table_footer
|
summary_table_footer
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f archives/gnb_usrp/nr-softmodem.Rel14.txt ]
|
||||||
|
then
|
||||||
|
summary_table_header "OAI Build gNB -- USRP option"
|
||||||
|
summary_table_row "LTE SoftModem - Release 15" ./archives/gnb_usrp/nr-softmodem.Rel14.txt "Built target nr-softmodem" ./gnb_usrp_row1.html
|
||||||
|
summary_table_row "Coding - Release 14" ./archives/gnb_usrp/coding.Rel14.txt "Built target coding" ./gnb_usrp_row2.html
|
||||||
|
summary_table_row "OAI USRP device if - Release 14" ./archives/gnb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html
|
||||||
|
summary_table_row "Parameters Lib Config - Release 14" ./archives/gnb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./gnb_usrp_row4.html
|
||||||
|
summary_table_footer
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f archives/nrue_usrp/nr-uesoftmodem.Rel14.txt ]
|
||||||
|
then
|
||||||
|
summary_table_header "OAI Build 5G NR UE -- USRP option"
|
||||||
|
summary_table_row "UE SoftModem - Release 15" ./archives/nrue_usrp/nr-uesoftmodem.Rel14.txt "Built target nr-uesoftmodem" ./nrue_usrp_row1.html
|
||||||
|
summary_table_row "Coding - Release 14" ./archives/nrue_usrp/coding.Rel14.txt "Built target coding" ./nrue_usrp_row2.html
|
||||||
|
summary_table_row "OAI USRP device if - Release 14" ./archives/nrue_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./nrue_usrp_row3.html
|
||||||
|
summary_table_row "Parameters Lib Config - Release 14" ./archives/nrue_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./nrue_usrp_row4.html
|
||||||
|
summary_table_footer
|
||||||
|
fi
|
||||||
|
|
||||||
summary_table_header "OAI Build eNB -- ETHERNET transport option"
|
summary_table_header "OAI Build eNB -- ETHERNET transport option"
|
||||||
summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html
|
summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html
|
||||||
summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html
|
summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html
|
||||||
@@ -572,6 +593,15 @@ for DETAILS_TABLE in `ls ./phy_sim_row*.html`
|
|||||||
do
|
do
|
||||||
cat $DETAILS_TABLE >> ./build_results.html
|
cat $DETAILS_TABLE >> ./build_results.html
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for DETAILS_TABLE in `ls ./gnb_usrp_row*.html`
|
||||||
|
do
|
||||||
|
cat $DETAILS_TABLE >> ./build_results.html
|
||||||
|
done
|
||||||
|
for DETAILS_TABLE in `ls ./nrue_usrp_row*.html`
|
||||||
|
do
|
||||||
|
cat $DETAILS_TABLE >> ./build_results.html
|
||||||
|
done
|
||||||
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
|
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
|
||||||
do
|
do
|
||||||
cat $DETAILS_TABLE >> ./build_results.html
|
cat $DETAILS_TABLE >> ./build_results.html
|
||||||
|
|||||||
@@ -21,31 +21,31 @@
|
|||||||
|
|
||||||
-->
|
-->
|
||||||
<testCaseList>
|
<testCaseList>
|
||||||
<TestCaseRequestedList>010101 050101 060101 070101 040101 030101 040301 040501 040601 040602 040603 040604 040605 040641 040401 040201 030201 030111 040301 040511 040611 040612 040613 040614 040615 040651 040401 040201 030201 030121 040301 040521 040621 040622 040623 040661 040401 040201 030201 </TestCaseRequestedList>
|
<TestCaseRequestedList>010101 050101 060101 070101 040101 030101 040301 040501 040601 040602 040603 040604 040605 040641 040642 040401 040201 030201 030111 040301 040511 040611 040612 040613 040614 040615 040651 040652 040401 040201 030201 030121 040301 040521 040621 040622 040623 040624 040625 040662 040661 040401 040201 030201 </TestCaseRequestedList>
|
||||||
<TestCaseExclusionList></TestCaseExclusionList>
|
<TestCaseExclusionList></TestCaseExclusionList>
|
||||||
|
|
||||||
<testCase id="010101">
|
<testCase id="010101">
|
||||||
<class>Build_eNB</class>
|
<class>Build_eNB</class>
|
||||||
<desc>Build eNB (USRP)</desc>
|
<desc>Build eNB (USRP)</desc>
|
||||||
<Build_eNB_args>-w USRP -x -c --eNB</Build_eNB_args>
|
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="030101">
|
<testCase id="030101">
|
||||||
<class>Initialize_eNB</class>
|
<class>Initialize_eNB</class>
|
||||||
<desc>Initialize eNB (FDD/Band7/5MHz)</desc>
|
<desc>Initialize eNB (FDD/Band7/5MHz)</desc>
|
||||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf</Initialize_eNB_args>
|
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="030111">
|
<testCase id="030111">
|
||||||
<class>Initialize_eNB</class>
|
<class>Initialize_eNB</class>
|
||||||
<desc>Initialize eNB (FDD/Band7/10MHz)</desc>
|
<desc>Initialize eNB (FDD/Band7/10MHz)</desc>
|
||||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf</Initialize_eNB_args>
|
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="030121">
|
<testCase id="030121">
|
||||||
<class>Initialize_eNB</class>
|
<class>Initialize_eNB</class>
|
||||||
<desc>Initialize eNB (FDD/Band7/20MHz)</desc>
|
<desc>Initialize eNB (FDD/Band7/20MHz)</desc>
|
||||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf</Initialize_eNB_args>
|
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="030201">
|
<testCase id="030201">
|
||||||
@@ -138,6 +138,14 @@
|
|||||||
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="040642">
|
||||||
|
<class>Iperf</class>
|
||||||
|
<desc>iperf (5MHz - UL/9Mbps/UDP)(60 sec)(single-ue profile)</desc>
|
||||||
|
<iperf_args>-u -b 9M -t 60 -i 1 -R</iperf_args>
|
||||||
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
|
<iperf_profile>single-ue</iperf_profile>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
<testCase id="040611">
|
<testCase id="040611">
|
||||||
<class>Iperf</class>
|
<class>Iperf</class>
|
||||||
<desc>iperf (10MHz - DL/10Mbps/UDP)(60 sec)</desc>
|
<desc>iperf (10MHz - DL/10Mbps/UDP)(60 sec)</desc>
|
||||||
@@ -182,6 +190,14 @@
|
|||||||
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="040652">
|
||||||
|
<class>Iperf</class>
|
||||||
|
<desc>iperf (10MHz - UL/20Mbps/UDP)(60 sec)(single-ue profile)</desc>
|
||||||
|
<iperf_args>-u -b 20M -t 60 -i 1 -R</iperf_args>
|
||||||
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
|
<iperf_profile>single-ue</iperf_profile>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
<testCase id="040621">
|
<testCase id="040621">
|
||||||
<class>Iperf</class>
|
<class>Iperf</class>
|
||||||
<desc>iperf (20MHz - DL/20Mbps/UDP)(60 sec)</desc>
|
<desc>iperf (20MHz - DL/20Mbps/UDP)(60 sec)</desc>
|
||||||
@@ -211,7 +227,7 @@
|
|||||||
<iperf_profile>single-ue</iperf_profile>
|
<iperf_profile>single-ue</iperf_profile>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="040624">
|
<testCase id="040625">
|
||||||
<class>Iperf</class>
|
<class>Iperf</class>
|
||||||
<desc>iperf (20MHz - DL/70Mbps/UDP)(60 sec)(unbalanced profile)</desc>
|
<desc>iperf (20MHz - DL/70Mbps/UDP)(60 sec)(unbalanced profile)</desc>
|
||||||
<iperf_args>-u -b 70M -t 60 -i 1</iperf_args>
|
<iperf_args>-u -b 70M -t 60 -i 1</iperf_args>
|
||||||
@@ -226,6 +242,14 @@
|
|||||||
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
|
<testCase id="040662">
|
||||||
|
<class>Iperf</class>
|
||||||
|
<desc>iperf (20MHz - UL/20Mbps/UDP)(60 sec)(single-ue profile)</desc>
|
||||||
|
<iperf_args>-u -b 20M -t 60 -i 1 -R</iperf_args>
|
||||||
|
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
|
||||||
|
<iperf_profile>single-ue</iperf_profile>
|
||||||
|
</testCase>
|
||||||
|
|
||||||
<testCase id="050101">
|
<testCase id="050101">
|
||||||
<class>Initialize_HSS</class>
|
<class>Initialize_HSS</class>
|
||||||
<desc>Initialize HSS</desc>
|
<desc>Initialize HSS</desc>
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
<testCase id="010101">
|
<testCase id="010101">
|
||||||
<class>Build_eNB</class>
|
<class>Build_eNB</class>
|
||||||
<desc>Build eNB (USRP)</desc>
|
<desc>Build eNB (USRP)</desc>
|
||||||
<Build_eNB_args>-w USRP -x -c --eNB</Build_eNB_args>
|
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="010102">
|
<testCase id="010102">
|
||||||
<class>Build_eNB</class>
|
<class>Build_eNB</class>
|
||||||
<desc>Build eNB (USRP)</desc>
|
<desc>Build eNB (USRP)</desc>
|
||||||
<Build_eNB_args>-w BLADERF -x -c --eNB</Build_eNB_args>
|
<Build_eNB_args>-w BLADERF -c --eNB</Build_eNB_args>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
<testCase id="030101">
|
<testCase id="030101">
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ execute_process(COMMAND mkdir -p ${NR_RRC_FULL_DIR}
|
|||||||
COMMAND env "ASN1C_PREFIX=NR_" asn1c -fcompound-names -findirect-choice -gen-PER -no-gen-OER -no-gen-example -D ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR}
|
COMMAND env "ASN1C_PREFIX=NR_" asn1c -fcompound-names -findirect-choice -gen-PER -no-gen-OER -no-gen-example -D ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR}
|
||||||
RESULT_VARIABLE ret
|
RESULT_VARIABLE ret
|
||||||
OUTPUT_QUIET
|
OUTPUT_QUIET
|
||||||
ERROR_QUIET)
|
ERROR_QUIET)
|
||||||
|
|
||||||
if (NOT ${ret} STREQUAL 0)
|
if (NOT ${ret} STREQUAL 0)
|
||||||
message(FATAL_ERROR "${ret}: error")
|
message(FATAL_ERROR "${ret}: error")
|
||||||
@@ -387,7 +387,6 @@ include_directories ("${NR_RRC_FULL_DIR}")
|
|||||||
|
|
||||||
add_custom_command (OUTPUT ${NR_RRC_FULL_DIR}/NR_asn_constant.h
|
add_custom_command (OUTPUT ${NR_RRC_FULL_DIR}/NR_asn_constant.h
|
||||||
COMMAND mkdir -p ${NR_RRC_FULL_DIR}
|
COMMAND mkdir -p ${NR_RRC_FULL_DIR}
|
||||||
#COMMAND env "ASN1C_PREFIX=NR_" asn1c -fcompound-names -findirect-choice -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR}
|
|
||||||
DEPENDS ${NR_RRC_GRAMMAR}
|
DEPENDS ${NR_RRC_GRAMMAR}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -949,7 +948,7 @@ set(UTIL_SRC
|
|||||||
${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
|
${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
|
||||||
${OPENAIR2_DIR}/UTIL/LISTS/list.c
|
${OPENAIR2_DIR}/UTIL/LISTS/list.c
|
||||||
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
|
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
|
||||||
${OPENAIR2_DIR}/UTIL/LOG/log.c
|
${OPENAIR_DIR}/common/utils/LOG/log.c
|
||||||
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
|
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
|
||||||
${OPENAIR2_DIR}/UTIL/MATH/oml.c
|
${OPENAIR2_DIR}/UTIL/MATH/oml.c
|
||||||
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
|
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
|
||||||
@@ -1313,7 +1312,7 @@ set(PHY_SRC_UE
|
|||||||
# depend on code generation from asn1c
|
# depend on code generation from asn1c
|
||||||
${RRC_FULL_DIR}/asn_constant.h
|
${RRC_FULL_DIR}/asn_constant.h
|
||||||
# actual source
|
# actual source
|
||||||
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
|
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_nr.c
|
||||||
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
|
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/pss_nr.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/pss_nr.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
|
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
|
||||||
@@ -1385,7 +1384,12 @@ set(PHY_MEX_UE
|
|||||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
|
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
|
||||||
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
|
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
|
||||||
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
|
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
|
||||||
${OPENAIR2_DIR}/UTIL/LOG/log.c
|
${OPENAIR_DIR}/common/utils/LOG/log.c
|
||||||
|
${OPENAIR_DIR}/common/utils/T/T.c
|
||||||
|
${OPENAIR_DIR}/common/utils/T/local_tracer.c
|
||||||
|
${OPENAIR_DIR}/common/config/config_cmdline.c
|
||||||
|
${OPENAIR_DIR}/common/config/config_userapi.c
|
||||||
|
${OPENAIR_DIR}/common/config/config_load_configmodule.c
|
||||||
)
|
)
|
||||||
add_library(PHY_MEX ${PHY_MEX_UE})
|
add_library(PHY_MEX ${PHY_MEX_UE})
|
||||||
|
|
||||||
@@ -2129,9 +2133,13 @@ endif (${T_TRACER})
|
|||||||
#This rule and the following deal with it.
|
#This rule and the following deal with it.
|
||||||
add_custom_command (
|
add_custom_command (
|
||||||
OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h
|
OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h
|
||||||
COMMAND make
|
COMMAND $(MAKE) clean
|
||||||
|
COMMAND $(MAKE)
|
||||||
|
COMMAND $(MAKE) check_vcd
|
||||||
WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
|
WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
|
||||||
DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt
|
DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt
|
||||||
|
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.c
|
||||||
|
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h
|
||||||
)
|
)
|
||||||
|
|
||||||
#This rule is specifically needed to generate T files
|
#This rule is specifically needed to generate T files
|
||||||
@@ -2314,7 +2322,7 @@ add_executable(nr-softmodem
|
|||||||
${rrc_h}
|
${rrc_h}
|
||||||
${nr_rrc_h}
|
${nr_rrc_h}
|
||||||
${s1ap_h}
|
${s1ap_h}
|
||||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
|
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-ru.c
|
${OPENAIR_TARGETS}/RT/USER/nr-ru.c
|
||||||
@@ -2336,13 +2344,13 @@ add_executable(nr-softmodem
|
|||||||
target_link_libraries (nr-softmodem
|
target_link_libraries (nr-softmodem
|
||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
|
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_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}
|
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ATLAS_LIBRARIES}
|
||||||
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2
|
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2
|
||||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
target_link_libraries (nr-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (nr-softmodem ${T_LIB})
|
target_link_libraries (nr-softmodem ${T_LIB})
|
||||||
|
|
||||||
@@ -2352,7 +2360,7 @@ target_link_libraries (nr-softmodem ${T_LIB})
|
|||||||
add_executable(nr-softmodem-nos1
|
add_executable(nr-softmodem-nos1
|
||||||
${rrc_h}
|
${rrc_h}
|
||||||
${s1ap_h}
|
${s1ap_h}
|
||||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
|
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-ru.c
|
${OPENAIR_TARGETS}/RT/USER/nr-ru.c
|
||||||
@@ -2392,7 +2400,7 @@ target_link_libraries (nr-softmodem-nos1 ${T_LIB})
|
|||||||
add_executable(nr-uesoftmodem
|
add_executable(nr-uesoftmodem
|
||||||
${rrc_h}
|
${rrc_h}
|
||||||
${s1ap_h}
|
${s1ap_h}
|
||||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-ue.c
|
${OPENAIR_TARGETS}/RT/USER/nr-ue.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-uesoftmodem.c
|
${OPENAIR_TARGETS}/RT/USER/nr-uesoftmodem.c
|
||||||
@@ -2412,12 +2420,12 @@ add_executable(nr-uesoftmodem
|
|||||||
|
|
||||||
target_link_libraries (nr-uesoftmodem
|
target_link_libraries (nr-uesoftmodem
|
||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_NR_UE_LIB PHY_NR_UE PHY_RU LFDS NR_L2_UE NR_LTE_UE_REUSE_LIB
|
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE #NR_LTE_UE_REUSE_LIB
|
||||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
|
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
|
||||||
-Wl,--end-group z dl)
|
-Wl,--end-group z dl)
|
||||||
|
|
||||||
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||||
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
||||||
|
|
||||||
@@ -2427,7 +2435,7 @@ target_link_libraries (nr-uesoftmodem ${T_LIB})
|
|||||||
add_executable(nr-uesoftmodem-nos1
|
add_executable(nr-uesoftmodem-nos1
|
||||||
${rrc_h}
|
${rrc_h}
|
||||||
${s1ap_h}
|
${s1ap_h}
|
||||||
${OPENAIR_BIN_DIR}/messages_xml.h
|
# ${OPENAIR_BIN_DIR}/messages_xml.h
|
||||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-ue.c
|
${OPENAIR_TARGETS}/RT/USER/nr-ue.c
|
||||||
${OPENAIR_TARGETS}/RT/USER/nr-uesoftmodem.c
|
${OPENAIR_TARGETS}/RT/USER/nr-uesoftmodem.c
|
||||||
@@ -2584,14 +2592,15 @@ if (${T_TRACER})
|
|||||||
#all "add_executable" definitions (except tests, rb_tool, updatefw)
|
#all "add_executable" definitions (except tests, rb_tool, updatefw)
|
||||||
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
|
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
|
||||||
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
|
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
|
||||||
pdcchsim pucchsim prachsim syncsim
|
pdcchsim pucchsim prachsim syncsim ulsim
|
||||||
#all "add_library" definitions
|
#all "add_library" definitions
|
||||||
ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB
|
ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB
|
||||||
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
|
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
|
||||||
oai_eth_transpro
|
oai_eth_transpro
|
||||||
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
|
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
|
||||||
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
|
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
|
||||||
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB)
|
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX
|
||||||
|
coding)
|
||||||
if (TARGET ${i})
|
if (TARGET ${i})
|
||||||
add_dependencies(${i} generate_T)
|
add_dependencies(${i} generate_T)
|
||||||
endif()
|
endif()
|
||||||
@@ -2602,43 +2611,6 @@ endif (${T_TRACER})
|
|||||||
# Generated specific cases is not regular code
|
# Generated specific cases is not regular code
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
##################""
|
|
||||||
# itti symbolic debug print require to generate a specific include file
|
|
||||||
########################################
|
|
||||||
|
|
||||||
# retrieve the compiler options to send it to gccxml
|
|
||||||
get_directory_property( DirDefs COMPILE_DEFINITIONS )
|
|
||||||
foreach( d ${DirDefs} )
|
|
||||||
list(APPEND itti_compiler_options "-D${d}")
|
|
||||||
endforeach()
|
|
||||||
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
|
|
||||||
foreach( d ${DirDefs} )
|
|
||||||
list(APPEND itti_compiler_options "-I${d}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# castxml doesn't work with c11 (gcc 5 default)
|
|
||||||
# force castxml and clang compilation with gnu89 standard
|
|
||||||
# we can't use cXX standard as pthread_rwlock_t is gnu standard
|
|
||||||
list(APPEND itti_compiler_options "-std=gnu89")
|
|
||||||
set (ITTI_H ${OPENAIR_DIR}/common/utils/T/T.h) #${ITTI_DIR}/intertask_interface_types.h)
|
|
||||||
if(EXISTS /usr/bin/gccxml)
|
|
||||||
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
|
|
||||||
else()
|
|
||||||
set(xml_command castxml --castxml-gccxml ${itti_compiler_options} ${ITTI_H} -o ${OPENAIR_BIN_DIR}/messages.xml)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command (
|
|
||||||
OUTPUT ${OPENAIR_BIN_DIR}/messages.xml
|
|
||||||
COMMAND ${xml_command}
|
|
||||||
DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/asn_constant.h
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command (
|
|
||||||
OUTPUT ${OPENAIR_BIN_DIR}/messages_xml.h
|
|
||||||
COMMAND sed -e 's/ *//' -e 's/\"/\\\\\"/g' -e 's/^/\"/' -e 's/$$/\\\\n\"/' ${OPENAIR_BIN_DIR}/messages.xml > ${OPENAIR_BIN_DIR}/messages_xml.h
|
|
||||||
DEPENDS ${OPENAIR_BIN_DIR}/messages.xml ${RRC_FULL_DIR}/asn_constant.h
|
|
||||||
)
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# Kernel modules
|
# Kernel modules
|
||||||
###############
|
###############
|
||||||
@@ -2671,7 +2643,7 @@ function(make_driver name dir)
|
|||||||
endforeach()
|
endforeach()
|
||||||
CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
|
CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
|
||||||
add_custom_command(OUTPUT ${name}.ko
|
add_custom_command(OUTPUT ${name}.ko
|
||||||
COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
|
COMMAND $(MAKE) -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
|
||||||
WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
|
WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
|
||||||
COMMENT "building ${module}.ko"
|
COMMENT "building ${module}.ko"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
|
|||||||
@@ -557,7 +557,9 @@ function main() {
|
|||||||
exec=lte-uesoftmodem
|
exec=lte-uesoftmodem
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ "$T_TRACER" = "False" ] ; then
|
||||||
|
lte_build_dir=${lte_build_dir}_noLOG
|
||||||
|
fi
|
||||||
# configuration module libraries, one currently available, using libconfig
|
# configuration module libraries, one currently available, using libconfig
|
||||||
config_libconfig_shlib=params_libconfig
|
config_libconfig_shlib=params_libconfig
|
||||||
|
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ install_asn1c_from_source(){
|
|||||||
# better to use a given commit than a branch in case the branch
|
# better to use a given commit than a branch in case the branch
|
||||||
# is updated and requires modifications in the source of OAI
|
# is updated and requires modifications in the source of OAI
|
||||||
#git checkout velichkov_s1ap_plus_option_group
|
#git checkout velichkov_s1ap_plus_option_group
|
||||||
git checkout ec830d70bbb014b769810355a2f321a91ccd8a58
|
git checkout 73d6b23dcec9ab36605b4af884143824392134c1
|
||||||
autoreconf -iv
|
autoreconf -iv
|
||||||
./configure
|
./configure
|
||||||
make -j`nproc`
|
make -j`nproc`
|
||||||
|
|||||||
@@ -37,6 +37,35 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "config_userapi.h"
|
#include "config_userapi.h"
|
||||||
|
|
||||||
|
|
||||||
|
void parse_stringlist(paramdef_t *cfgoptions, char *val)
|
||||||
|
{
|
||||||
|
char *atoken;
|
||||||
|
char *tokctx;
|
||||||
|
char *tmpval=strdup(val);
|
||||||
|
int numelt=0;
|
||||||
|
|
||||||
|
cfgoptions->numelt=0;
|
||||||
|
|
||||||
|
atoken=strtok_r(tmpval, ",",&tokctx);
|
||||||
|
while(atoken != NULL) {
|
||||||
|
numelt++ ;
|
||||||
|
atoken=strtok_r(NULL, ",",&tokctx);
|
||||||
|
}
|
||||||
|
free(tmpval);
|
||||||
|
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
|
||||||
|
cfgoptions->numelt=numelt;
|
||||||
|
|
||||||
|
atoken=strtok_r(val, ",",&tokctx);
|
||||||
|
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
|
||||||
|
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
|
||||||
|
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
|
||||||
|
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
|
||||||
|
atoken=strtok_r(NULL, ",",&tokctx);
|
||||||
|
}
|
||||||
|
cfgoptions->numelt=numelt;
|
||||||
|
}
|
||||||
|
|
||||||
int processoption(paramdef_t *cfgoptions, char *value)
|
int processoption(paramdef_t *cfgoptions, char *value)
|
||||||
{
|
{
|
||||||
char *tmpval = value;
|
char *tmpval = value;
|
||||||
@@ -66,6 +95,7 @@ char defbool[2]="1";
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_STRINGLIST:
|
case TYPE_STRINGLIST:
|
||||||
|
parse_stringlist(cfgoptions,tmpval);
|
||||||
break;
|
break;
|
||||||
case TYPE_UINT32:
|
case TYPE_UINT32:
|
||||||
case TYPE_INT32:
|
case TYPE_INT32:
|
||||||
@@ -140,7 +170,7 @@ char *cfgpath;
|
|||||||
exit_fun("[CONFIG] Exiting after displaying help\n");
|
exit_fun("[CONFIG] Exiting after displaying help\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pp=strtok_r(NULL, "_",&tokctx);
|
pp=strtok_r(NULL, " ",&tokctx);
|
||||||
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
||||||
printf ("Help for %s section:\n",prefix);
|
printf ("Help for %s section:\n",prefix);
|
||||||
config_printhelp(cfgoptions,numoptions);
|
config_printhelp(cfgoptions,numoptions);
|
||||||
@@ -167,17 +197,19 @@ char *cfgpath;
|
|||||||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
|
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
|
||||||
char *valptr=NULL;
|
char *valptr=NULL;
|
||||||
int ret;
|
int ret;
|
||||||
pp = config_get_if()->argv[i+1];
|
if (c > 0) {
|
||||||
if (pp != NULL && c > 1) {
|
pp = config_get_if()->argv[i+1];
|
||||||
ret = strlen(pp);
|
if (pp != NULL ) {
|
||||||
if (ret > 0 ) {
|
ret = strlen(pp);
|
||||||
if (pp[0] != '-')
|
if (ret > 0 ) {
|
||||||
valptr=pp;
|
if (pp[0] != '-')
|
||||||
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
|
valptr=pp;
|
||||||
valptr=pp;
|
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
|
||||||
}
|
valptr=pp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
j += processoption(&(cfgoptions[n]), pp);
|
j += processoption(&(cfgoptions[n]), valptr);
|
||||||
if ( valptr != NULL ) {
|
if ( valptr != NULL ) {
|
||||||
i++;
|
i++;
|
||||||
c--;
|
c--;
|
||||||
|
|||||||
@@ -0,0 +1,707 @@
|
|||||||
|
/*
|
||||||
|
* 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 log.c
|
||||||
|
* \brief log implementaion
|
||||||
|
* \author Navid Nikaein
|
||||||
|
* \date 2009 - 2014
|
||||||
|
* \version 0.5
|
||||||
|
* @ingroup util
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE /* required for pthread_getname_np */
|
||||||
|
//#define LOG_TEST 1
|
||||||
|
|
||||||
|
#define COMPONENT_LOG
|
||||||
|
#define COMPONENT_LOG_IF
|
||||||
|
#include <ctype.h>
|
||||||
|
#define LOG_MAIN
|
||||||
|
#include "log.h"
|
||||||
|
#include "vcd_signal_dumper.h"
|
||||||
|
#include "assertions.h"
|
||||||
|
|
||||||
|
#if defined(ENABLE_ITTI)
|
||||||
|
# include "intertask_interface.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# include <pthread.h>
|
||||||
|
# include <string.h>
|
||||||
|
#include <linux/prctl.h>
|
||||||
|
#include "common/config/config_userapi.h"
|
||||||
|
// main log variables
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mapping log_level_names[] = {
|
||||||
|
{"error", OAILOG_ERR},
|
||||||
|
{"file", OAILOG_FILE},
|
||||||
|
{"warn", OAILOG_WARNING},
|
||||||
|
{"info", OAILOG_INFO},
|
||||||
|
{"debug", OAILOG_DEBUG},
|
||||||
|
{"trace", OAILOG_TRACE},
|
||||||
|
{NULL, -1}
|
||||||
|
};
|
||||||
|
|
||||||
|
mapping log_options[] = {
|
||||||
|
{"nocolor", FLAG_NOCOLOR },
|
||||||
|
{"level", FLAG_LEVEL },
|
||||||
|
{"thread", FLAG_THREAD },
|
||||||
|
{NULL,-1}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
mapping log_maskmap[] = {
|
||||||
|
{"prach", DEBUG_PRACH},
|
||||||
|
{"RU", DEBUG_RU},
|
||||||
|
{"LTEESTIM", DEBUG_LTEESTIM},
|
||||||
|
{"ctrlsocket", DEBUG_CTRLSOCKET},
|
||||||
|
{"UE_PHYPROC", DEBUG_UE_PHYPROC},
|
||||||
|
{"UE_TIMING", UE_TIMING},
|
||||||
|
{NULL,-1}
|
||||||
|
};
|
||||||
|
|
||||||
|
char *log_level_highlight_start[] = {LOG_RED, LOG_GREEN, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
|
||||||
|
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
|
||||||
|
|
||||||
|
|
||||||
|
int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format)
|
||||||
|
{
|
||||||
|
|
||||||
|
FILE *fp=NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (data == NULL)
|
||||||
|
return -1;
|
||||||
|
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||||
|
|
||||||
|
|
||||||
|
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||||
|
fp = fopen(fname,"a+");
|
||||||
|
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
||||||
|
fp = fopen(fname,"w+");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (fp== NULL) {
|
||||||
|
printf("[OPENAIR][FILE OUTPUT] Cannot open file %s\n",fname);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||||
|
fprintf(fp,"%s = [",vname);
|
||||||
|
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case 0: // real 16-bit
|
||||||
|
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%d\n",((short *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // complex 16-bit
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
case 15:
|
||||||
|
|
||||||
|
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||||
|
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // real 32-bit
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%d\n",((int *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // complex 32-bit
|
||||||
|
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||||
|
fprintf(fp,"%d + j*(%d)\n",((int *)data)[i],((int *)data)[i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // real 8-bit
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%d\n",((char *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // complex 8-bit
|
||||||
|
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||||
|
fprintf(fp,"%d + j*(%d)\n",((char *)data)[i],((char *)data)[i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: // real 64-bit
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%lld\n",((long long*)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7: // real double
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%g\n",((double *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8: // complex double
|
||||||
|
for (i=0; i<length<<1; i+=2*dec) {
|
||||||
|
fprintf(fp,"%g + j*(%g)\n",((double *)data)[i], ((double *)data)[i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9: // real unsigned 8-bit
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
fprintf(fp,"%d\n",((unsigned char *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 10 : // case eren 16 bit complex :
|
||||||
|
|
||||||
|
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||||
|
|
||||||
|
if((i < 2*(length-1)) && (i > 0))
|
||||||
|
fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||||
|
else if (i == 2*(length-1))
|
||||||
|
fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]);
|
||||||
|
else if (i == 0)
|
||||||
|
fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11 : //case eren 16 bit real for channel magnitudes:
|
||||||
|
for (i=0; i<length; i+=dec) {
|
||||||
|
|
||||||
|
if((i <(length-1))&& (i > 0))
|
||||||
|
fprintf(fp,"%d,",((short *)data)[i]);
|
||||||
|
else if (i == (length-1))
|
||||||
|
fprintf(fp,"%d;",((short *)data)[i]);
|
||||||
|
else if (i == 0)
|
||||||
|
fprintf(fp,"\n%d,",((short *)data)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n eren: length :%d",length);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||||
|
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||||
|
fprintf(fp,"];\n");
|
||||||
|
fclose(fp);
|
||||||
|
return(0);
|
||||||
|
} else if (format == 10 || format ==11 || format == 12 || format == 13 || format == 15) {
|
||||||
|
fclose(fp);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get log parameters from configuration file */
|
||||||
|
void log_getconfig(log_t *g_log) {
|
||||||
|
char *gloglevel = NULL;
|
||||||
|
int level;
|
||||||
|
|
||||||
|
|
||||||
|
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
|
||||||
|
paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
|
||||||
|
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
|
||||||
|
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
|
||||||
|
paramdef_t logparams_matlab[sizeof(log_maskmap)/sizeof(mapping)];
|
||||||
|
|
||||||
|
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||||
|
if (ret <0) {
|
||||||
|
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0; i<logparams_defaults[LOG_OPTIONS_IDX].numelt ; i++) {
|
||||||
|
for(int j=0; log_options[j].name != NULL ; j++) {
|
||||||
|
if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) {
|
||||||
|
g_log->flag = g_log->flag | log_options[j].value;
|
||||||
|
break;
|
||||||
|
} else if (log_options[j+1].name == NULL){
|
||||||
|
fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build the parameter array for setting per component log level and infile options */
|
||||||
|
memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||||
|
memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||||
|
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||||
|
if(g_log->log_component[i].name == NULL) {
|
||||||
|
g_log->log_component[i].name = malloc(16);
|
||||||
|
sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
|
||||||
|
logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||||
|
logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||||
|
}
|
||||||
|
sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name);
|
||||||
|
sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name);
|
||||||
|
/* workaround: all log options in existing configuration files use lower case component names
|
||||||
|
where component names include uppercase char in log.h.... */
|
||||||
|
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||||
|
logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
|
||||||
|
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||||
|
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
|
||||||
|
/* */
|
||||||
|
logparams_level[i].defstrval = gloglevel;
|
||||||
|
logparams_logfile[i].defuintval = 0;
|
||||||
|
logparams_logfile[i].numelt = 0;
|
||||||
|
logparams_level[i].numelt = 0;
|
||||||
|
logparams_level[i].type = TYPE_STRING;
|
||||||
|
logparams_logfile[i].type = TYPE_UINT;
|
||||||
|
|
||||||
|
logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
|
||||||
|
}
|
||||||
|
/* read the per component parameters */
|
||||||
|
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||||
|
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||||
|
/* now set the log levels and infile option, according to what we read */
|
||||||
|
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||||
|
level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
|
||||||
|
set_log(i, level,1);
|
||||||
|
if (*(logparams_logfile[i].uptr) == 1)
|
||||||
|
set_component_filelog(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build then read the debug and matlab parameter array */
|
||||||
|
for (int i=0;log_maskmap[i].name != NULL ; i++) {
|
||||||
|
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
|
||||||
|
sprintf(logparams_matlab[i].optname, LOG_CONFIG_MATLAB_FORMAT, log_maskmap[i].name);
|
||||||
|
logparams_debug[i].defuintval = 0;
|
||||||
|
logparams_debug[i].type = TYPE_UINT;
|
||||||
|
logparams_debug[i].paramflags = PARAMFLAG_BOOL;
|
||||||
|
logparams_debug[i].uptr = NULL;
|
||||||
|
logparams_debug[i].chkPptr = NULL;
|
||||||
|
logparams_debug[i].numelt = 0;
|
||||||
|
logparams_matlab[i].defuintval = 0;
|
||||||
|
logparams_matlab[i].type = TYPE_UINT;
|
||||||
|
logparams_matlab[i].paramflags = PARAMFLAG_BOOL;
|
||||||
|
logparams_matlab[i].uptr = NULL;
|
||||||
|
logparams_matlab[i].chkPptr = NULL;
|
||||||
|
logparams_matlab[i].numelt = 0;
|
||||||
|
}
|
||||||
|
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||||
|
config_get( logparams_matlab,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||||
|
/* set the debug mask according to the debug parameters values */
|
||||||
|
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
||||||
|
if (*(logparams_debug[i].uptr) )
|
||||||
|
g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
|
||||||
|
if (*(logparams_matlab[i].uptr) )
|
||||||
|
g_log->matlab_mask = g_log->matlab_mask | log_maskmap[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int register_log_component(char *name, char *fext, int compidx)
|
||||||
|
{
|
||||||
|
int computed_compidx=compidx;
|
||||||
|
|
||||||
|
if (strlen(fext) > 3) {
|
||||||
|
fext[3]=0; /* limit log file extension to 3 chars */
|
||||||
|
}
|
||||||
|
if (compidx < 0) { /* this is not a pre-defined component */
|
||||||
|
for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) {
|
||||||
|
if (g_log->log_component[i].name == NULL) {
|
||||||
|
computed_compidx=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
|
||||||
|
g_log->log_component[computed_compidx].name = strdup(name);
|
||||||
|
g_log->log_component[computed_compidx].level = LOG_ERR;
|
||||||
|
g_log->log_component[computed_compidx].interval = 1;
|
||||||
|
g_log->log_component[computed_compidx].stream = NULL;
|
||||||
|
g_log->log_component[computed_compidx].filelog = 0;
|
||||||
|
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s rounded to ^2 */
|
||||||
|
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
|
||||||
|
}
|
||||||
|
return computed_compidx;
|
||||||
|
}
|
||||||
|
|
||||||
|
int logInit (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
g_log = calloc(1, sizeof(log_t));
|
||||||
|
|
||||||
|
if (g_log == NULL) {
|
||||||
|
perror ("cannot allocated memory for log generation module \n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
memset(g_log,0,sizeof(log_t));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register_log_component("PHY","log",PHY);
|
||||||
|
register_log_component("MAC","log",MAC);
|
||||||
|
register_log_component("OPT","log",OPT);
|
||||||
|
register_log_component("RLC","log",RLC);
|
||||||
|
register_log_component("PDCP","log",PDCP);
|
||||||
|
register_log_component("RRC","log",RRC);
|
||||||
|
register_log_component("OMG","csv",OMG);
|
||||||
|
register_log_component("OTG","log",OTG);
|
||||||
|
register_log_component("OTG_LATENCY","dat",OTG_LATENCY);
|
||||||
|
register_log_component("OTG_LATENCY_BG","dat",OTG_LATENCY_BG);
|
||||||
|
register_log_component("OTG_GP","dat",OTG_GP);
|
||||||
|
register_log_component("OTG_GP_BG","dat",OTG_GP_BG);
|
||||||
|
register_log_component("OTG_JITTER","dat",OTG_JITTER);
|
||||||
|
register_log_component("OCG","",OCG);
|
||||||
|
register_log_component("PERF","",PERF);
|
||||||
|
register_log_component("OIP","",OIP);
|
||||||
|
register_log_component("CLI","",CLI);
|
||||||
|
register_log_component("MSC","log",MSC);
|
||||||
|
register_log_component("OCM","log",OCM);
|
||||||
|
register_log_component("HW","",HW);
|
||||||
|
register_log_component("OSA","",OSA);
|
||||||
|
register_log_component("eRAL","",RAL_ENB);
|
||||||
|
register_log_component("mRAL","",RAL_UE);
|
||||||
|
register_log_component("ENB_APP","log",ENB_APP);
|
||||||
|
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
|
||||||
|
register_log_component("TMR","",TMR);
|
||||||
|
register_log_component("USIM","txt",USIM);
|
||||||
|
register_log_component("SIM","txt",SIM);
|
||||||
|
|
||||||
|
/* following log component are used for the localization*/
|
||||||
|
register_log_component("LOCALIZE","log",LOCALIZE);
|
||||||
|
register_log_component("NAS","log",NAS);
|
||||||
|
register_log_component("UDP","",UDP_);
|
||||||
|
|
||||||
|
|
||||||
|
register_log_component("GTPV1U","",GTPU);
|
||||||
|
|
||||||
|
|
||||||
|
register_log_component("S1AP","",S1AP);
|
||||||
|
|
||||||
|
|
||||||
|
register_log_component("SCTP","",SCTP);
|
||||||
|
register_log_component("RRH","",RRH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
g_log->level2string[OAILOG_ERR] = "E"; // ERROR
|
||||||
|
g_log->level2string[OAILOG_WARNING] = "W"; // WARNING
|
||||||
|
g_log->level2string[OAILOG_INFO] = "I"; //INFO
|
||||||
|
g_log->level2string[OAILOG_DEBUG] = "D"; // DEBUG
|
||||||
|
g_log->level2string[OAILOG_FILE] = "F"; // file
|
||||||
|
g_log->level2string[OAILOG_TRACE] = "T"; // TRACE
|
||||||
|
|
||||||
|
|
||||||
|
g_log->onlinelog = 1; //online log file
|
||||||
|
g_log->filelog = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
g_log->filelog_name = "/tmp/openair.log";
|
||||||
|
|
||||||
|
log_getconfig(g_log);
|
||||||
|
|
||||||
|
|
||||||
|
// could put a loop here to check for all comps
|
||||||
|
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||||
|
if (g_log->log_component[i].filelog == 1 ) {
|
||||||
|
g_log->log_component[i].stream = fopen(g_log->log_component[i].filelog_name,"w");
|
||||||
|
g_log->log_component[i].fwrite = vfprintf;
|
||||||
|
} else if (g_log->log_component[i].filelog == 1 ) {
|
||||||
|
g_log->log_component[i].stream = fopen(g_log->filelog_name,"w");
|
||||||
|
g_log->log_component[i].fwrite = vfprintf;
|
||||||
|
} else if (g_log->onlinelog == 1 ) {
|
||||||
|
g_log->log_component[i].stream = stdout;
|
||||||
|
g_log->log_component[i].fwrite = vfprintf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set all unused component items to 0, they are for non predefined components
|
||||||
|
for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||||
|
memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
|
||||||
|
}
|
||||||
|
printf("log init done\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *log_getthreadname(char *threadname, int bufsize) {
|
||||||
|
|
||||||
|
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
|
||||||
|
if (rt == 0)
|
||||||
|
{
|
||||||
|
return threadname;
|
||||||
|
} else {
|
||||||
|
return "thread?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char* format, ... )
|
||||||
|
{
|
||||||
|
|
||||||
|
char threadname[PR_SET_NAME];
|
||||||
|
char log_buffer[MAX_LOG_TOTAL];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
snprintf(log_buffer, MAX_LOG_TOTAL , "%s%s[%s]%s %s %s",
|
||||||
|
log_level_highlight_end[level],
|
||||||
|
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
|
||||||
|
g_log->log_component[comp].name,
|
||||||
|
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:""),
|
||||||
|
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
|
||||||
|
format);
|
||||||
|
|
||||||
|
g_log->log_component[comp].fwrite(g_log->log_component[comp].stream,log_buffer, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int set_log(int component, int level, int interval)
|
||||||
|
{
|
||||||
|
/* Checking parameters */
|
||||||
|
DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
|
||||||
|
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
|
||||||
|
DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_ERR), level, NUM_LOG_LEVEL,
|
||||||
|
OAILOG_ERR);
|
||||||
|
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
|
||||||
|
|
||||||
|
g_log->log_component[component].level = level;
|
||||||
|
|
||||||
|
|
||||||
|
g_log->log_component[component].interval = interval;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void set_glog(int level)
|
||||||
|
{
|
||||||
|
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
|
||||||
|
g_log->log_component[c].level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_glog_onlinelog(int enable)
|
||||||
|
{
|
||||||
|
g_log->onlinelog = enable;
|
||||||
|
}
|
||||||
|
void set_glog_filelog(int enable)
|
||||||
|
{
|
||||||
|
g_log->filelog = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_component_filelog(int comp)
|
||||||
|
{
|
||||||
|
if (g_log->log_component[comp].filelog == 0) {
|
||||||
|
g_log->log_component[comp].filelog = 1;
|
||||||
|
|
||||||
|
if (g_log->log_component[comp].stream == NULL) {
|
||||||
|
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* for the two functions below, the passed array must have a final entry
|
||||||
|
* with string value NULL
|
||||||
|
*/
|
||||||
|
/* map a string to an int. Takes a mapping array and a string as arg */
|
||||||
|
int map_str_to_int(mapping *map, const char *str)
|
||||||
|
{
|
||||||
|
while (1) {
|
||||||
|
if (map->name == NULL) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(map->name, str)) {
|
||||||
|
return(map->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
map++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* map an int to a string. Takes a mapping array and a value */
|
||||||
|
char *map_int_to_str(mapping *map, int val)
|
||||||
|
{
|
||||||
|
while (1) {
|
||||||
|
if (map->name == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map->value == val) {
|
||||||
|
return map->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
map++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int is_newline( char *str, int size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for ( i = 0; i < size; i++ ) {
|
||||||
|
if ( str[i] == '\n' ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we get all the way to here, there must not have been a newline! */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void logClean (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
LOG_I(PHY,"\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||||
|
if (g_log->log_component[i].stream != NULL) {
|
||||||
|
fclose(g_log->log_component[i].stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOG_TEST
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
logInit();
|
||||||
|
|
||||||
|
|
||||||
|
test_log();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_log(void)
|
||||||
|
{
|
||||||
|
LOG_ENTER(MAC); // because the default level is DEBUG
|
||||||
|
LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_D(MAC, "1 debug MAC \n");
|
||||||
|
LOG_W(MAC, "1 warning MAC \n");
|
||||||
|
|
||||||
|
set_log(EMU, OAILOG_INFO, FLAG_ONLINE);
|
||||||
|
set_log(MAC, OAILOG_WARNING, 0);
|
||||||
|
|
||||||
|
LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_E(MAC, "2 error MAC\n");
|
||||||
|
LOG_D(MAC, "2 debug MAC \n");
|
||||||
|
LOG_W(MAC, "2 warning MAC \n");
|
||||||
|
LOG_I(MAC, "2 info MAC \n");
|
||||||
|
|
||||||
|
|
||||||
|
set_log(MAC, OAILOG_NOTICE, 1);
|
||||||
|
|
||||||
|
LOG_ENTER(MAC);
|
||||||
|
LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_D(MAC, "3 debug MAC \n");
|
||||||
|
LOG_W(MAC, "3 warning MAC \n");
|
||||||
|
LOG_I(MAC, "3 info MAC \n");
|
||||||
|
|
||||||
|
set_log(MAC, LOG_DEBUG,1);
|
||||||
|
set_log(EMU, LOG_DEBUG,1);
|
||||||
|
|
||||||
|
LOG_ENTER(MAC);
|
||||||
|
LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_D(MAC, "4 debug MAC \n");
|
||||||
|
LOG_W(MAC, "4 warning MAC \n");
|
||||||
|
LOG_I(MAC, "4 info MAC \n");
|
||||||
|
|
||||||
|
|
||||||
|
set_log(MAC, LOG_DEBUG,0);
|
||||||
|
set_log(EMU, LOG_DEBUG,0);
|
||||||
|
|
||||||
|
LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_D(MAC, "5 debug MAC \n");
|
||||||
|
LOG_W(MAC, "5 warning MAC \n");
|
||||||
|
LOG_I(MAC, "5 info MAC \n");
|
||||||
|
|
||||||
|
|
||||||
|
set_log(MAC, LOG_TRACE,0X07F);
|
||||||
|
set_log(EMU, LOG_TRACE,0X07F);
|
||||||
|
|
||||||
|
LOG_ENTER(MAC);
|
||||||
|
LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
|
||||||
|
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||||
|
LOG_D(MAC, "6 debug MAC \n");
|
||||||
|
LOG_W(MAC, "6 warning MAC \n");
|
||||||
|
LOG_I(MAC, "6 info MAC \n");
|
||||||
|
LOG_EXIT(MAC);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "T.h"
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -73,8 +73,7 @@ extern "C" {
|
|||||||
* @ingroup _macro
|
* @ingroup _macro
|
||||||
* @brief the macros that describe the maximum length of LOG
|
* @brief the macros that describe the maximum length of LOG
|
||||||
* @{*/
|
* @{*/
|
||||||
#define MAX_LOG_ITEM 100 /*!< \brief the maximum length of a LOG item, what is LOG_ITEM ??? */
|
|
||||||
#define MAX_LOG_INFO 1000 /*!< \brief the maximum length of a log */
|
|
||||||
#define MAX_LOG_TOTAL 1500 /*!< \brief the maximum length of a log */
|
#define MAX_LOG_TOTAL 1500 /*!< \brief the maximum length of a log */
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
@@ -82,18 +81,15 @@ extern "C" {
|
|||||||
* @ingroup _macro
|
* @ingroup _macro
|
||||||
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
|
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
|
||||||
* @{*/
|
* @{*/
|
||||||
# define LOG_EMERG 0 /*!< \brief system is unusable */
|
|
||||||
# define LOG_ALERT 1 /*!< \brief action must be taken immediately */
|
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
|
||||||
# define LOG_CRIT 2 /*!< \brief critical conditions */
|
# define OAILOG_FILE 1 /*!< \brief important informational messages, but everything OK */
|
||||||
# define LOG_ERR 3 /*!< \brief error conditions */
|
# define OAILOG_WARNING 2 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
|
||||||
# define LOG_WARNING 4 /*!< \brief warning conditions */
|
# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
|
||||||
# define LOG_NOTICE 5 /*!< \brief normal but significant condition */
|
# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
|
||||||
# define LOG_INFO 6 /*!< \brief informational */
|
# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
|
||||||
# define LOG_DEBUG 7 /*!< \brief debug-level messages */
|
|
||||||
# define LOG_FILE 8 /*!< \brief message sequence chart -level */
|
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG */
|
||||||
# define LOG_TRACE 9 /*!< \brief trace-level messages */
|
|
||||||
# define LOG_MATLAB 10 /*!< \brief output to matlab file */
|
|
||||||
#define NUM_LOG_LEVEL 11 /*!< \brief the number of message levels users have with LOG */
|
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +100,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* .log_format = 0x13 uncolored standard messages
|
/* .log_format = 0x13 uncolored standard messages
|
||||||
* .log_format = 0x93 colored standard messages */
|
* .log_format = 0x93 colored standard messages */
|
||||||
|
/* keep white space in first position; switching it to 0 allows colors to be disabled*/
|
||||||
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
|
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
|
||||||
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
|
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
|
||||||
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
|
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
|
||||||
@@ -118,34 +114,37 @@ extern "C" {
|
|||||||
* @ingroup _macro
|
* @ingroup _macro
|
||||||
* @brief Macros used to write lines (local/remote) in syslog.conf
|
* @brief Macros used to write lines (local/remote) in syslog.conf
|
||||||
* @{*/
|
* @{*/
|
||||||
#define LOG_LOCAL 0x01
|
|
||||||
#define LOG_REMOTE 0x02
|
|
||||||
|
|
||||||
#define FLAG_COLOR 0x001 /*!< \brief defaults */
|
|
||||||
#define FLAG_PID 0x002 /*!< \brief defaults */
|
|
||||||
#define FLAG_COMP 0x004
|
|
||||||
#define FLAG_THREAD 0x008 /*!< \brief all : 255/511 */
|
|
||||||
#define FLAG_LEVEL 0x010
|
|
||||||
#define FLAG_FUNCT 0x020
|
|
||||||
#define FLAG_FILE_LINE 0x040
|
|
||||||
#define FLAG_TIME 0x100
|
|
||||||
|
|
||||||
#define LOG_NONE 0x00
|
|
||||||
#define LOG_LOW 0x5
|
|
||||||
#define LOG_MED 0x15
|
|
||||||
#define LOG_HIGH 0x35
|
|
||||||
#define LOG_FULL 0x75
|
|
||||||
|
|
||||||
#define OAI_OK 0 /*!< \brief all ok */
|
|
||||||
#define OAI_ERR 1 /*!< \brief generic error */
|
|
||||||
#define OAI_ERR_READ_ONLY 2 /*!< \brief tried to write to read-only item */
|
|
||||||
#define OAI_ERR_NOTFOUND 3 /*!< \brief something wasn't found */
|
|
||||||
/* @}*/
|
|
||||||
|
|
||||||
|
|
||||||
//static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_BLUE, "", "", "", LOG_GREEN}; /*!< \brief Optional start-format strings for highlighting */
|
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
|
||||||
|
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
|
||||||
|
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
|
||||||
|
#define FLAG_FUNCT 0x0020
|
||||||
|
#define FLAG_FILE_LINE 0x0040
|
||||||
|
#define FLAG_TIME 0x0100
|
||||||
|
|
||||||
|
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
|
||||||
|
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
|
||||||
|
|
||||||
|
/** @defgroup macros to identify a debug entity
|
||||||
|
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
|
||||||
|
* it allows to dynamically activate or not blocks of code
|
||||||
|
* @brief
|
||||||
|
* @{*/
|
||||||
|
#define DEBUG_PRACH (1<<0)
|
||||||
|
#define DEBUG_RU (1<<1)
|
||||||
|
#define DEBUG_UE_PHYPROC (1<<2)
|
||||||
|
#define DEBUG_LTEESTIM (1<<3)
|
||||||
|
#define DEBUG_CTRLSOCKET (1<<10)
|
||||||
|
#define UE_TIMING (1<<20)
|
||||||
|
|
||||||
|
#define SET_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask | O)
|
||||||
|
#define CLEAR_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask & (~O))
|
||||||
|
|
||||||
|
#define SET_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask | O)
|
||||||
|
#define CLEAR_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask & (~O))
|
||||||
|
|
||||||
|
|
||||||
//static char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, "", "", "", LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MIN_LOG_COMPONENTS = 0,
|
MIN_LOG_COMPONENTS = 0,
|
||||||
@@ -198,60 +197,40 @@ comp_name_t;
|
|||||||
|
|
||||||
#define MAX_LOG_DYNALLOC_COMPONENTS 20
|
#define MAX_LOG_DYNALLOC_COMPONENTS 20
|
||||||
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
|
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
|
||||||
//#define msg printf
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name; /*!< \brief string name of item */
|
char *name; /*!< \brief string name of item */
|
||||||
int value; /*!< \brief integer value of mapping */
|
int value; /*!< \brief integer value of mapping */
|
||||||
} mapping;
|
} mapping;
|
||||||
|
|
||||||
|
typedef int(*log_write_func_t)(FILE *stream, const char *format, va_list ap );
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
int level;
|
int level;
|
||||||
int flag;
|
int flag;
|
||||||
int interval;
|
int interval;
|
||||||
int fd;
|
int filelog;
|
||||||
int filelog;
|
char *filelog_name;
|
||||||
char *filelog_name;
|
FILE *stream;
|
||||||
|
log_write_func_t fwrite;
|
||||||
/* SR: make the log buffer component relative */
|
/* SR: make the log buffer component relative */
|
||||||
char log_buffer[MAX_LOG_TOTAL];
|
char log_buffer[MAX_LOG_TOTAL];
|
||||||
} log_component_t;
|
} log_component_t;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int remote_ip;
|
|
||||||
unsigned int audit_ip;
|
|
||||||
int remote_level;
|
|
||||||
int facility;
|
|
||||||
int audit_facility;
|
|
||||||
int format;
|
|
||||||
} log_config_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
log_component_t log_component[MAX_LOG_COMPONENTS];
|
log_component_t log_component[MAX_LOG_COMPONENTS];
|
||||||
log_config_t config;
|
|
||||||
char* level2string[NUM_LOG_LEVEL];
|
char* level2string[NUM_LOG_LEVEL];
|
||||||
int level;
|
|
||||||
int onlinelog;
|
int onlinelog;
|
||||||
int flag;
|
int flag;
|
||||||
int syslog;
|
|
||||||
int filelog;
|
int filelog;
|
||||||
char* filelog_name;
|
char* filelog_name;
|
||||||
int async; // asynchronous mode, via dedicated log thread + log buffer
|
uint64_t debug_mask;
|
||||||
|
uint64_t matlab_mask;
|
||||||
} log_t;
|
} log_t;
|
||||||
|
|
||||||
typedef struct LOG_params {
|
|
||||||
const char *file;
|
|
||||||
const char *func;
|
|
||||||
int line;
|
|
||||||
int comp;
|
|
||||||
int level;
|
|
||||||
const char *format;
|
|
||||||
char l_buff_info [MAX_LOG_INFO];
|
|
||||||
int len;
|
|
||||||
} LOG_params;
|
|
||||||
|
|
||||||
#if defined(ENABLE_ITTI)
|
#if defined(ENABLE_ITTI)
|
||||||
typedef enum log_instance_type_e {
|
typedef enum log_instance_type_e {
|
||||||
@@ -263,10 +242,6 @@ typedef enum log_instance_type_e {
|
|||||||
void log_set_instance_type (log_instance_type_t instance);
|
void log_set_instance_type (log_instance_type_t instance);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOG_MEM_SIZE 100*1024*1024
|
|
||||||
#define LOG_MEM_FILE "./logmem.log"
|
|
||||||
int logInit_log_mem(void);
|
|
||||||
void output_log_mem(void);
|
|
||||||
|
|
||||||
#ifdef LOG_MAIN
|
#ifdef LOG_MAIN
|
||||||
log_t *g_log;
|
log_t *g_log;
|
||||||
@@ -284,28 +259,20 @@ extern log_t *g_log;
|
|||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
int logInit (void);
|
int logInit (void);
|
||||||
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
||||||
void logRecord(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
|
||||||
int set_comp_log(int component, int level, int verbosity, int interval);
|
|
||||||
int set_log(int component, int level, int interval);
|
int set_log(int component, int level, int interval);
|
||||||
void set_glog(int level, int verbosity);
|
void set_glog(int level);
|
||||||
void set_log_syslog(int enable);
|
|
||||||
void set_glog_onlinelog(int enable);
|
void set_glog_onlinelog(int enable);
|
||||||
void set_glog_filelog(int enable);
|
void set_glog_filelog(int enable);
|
||||||
|
|
||||||
void set_component_filelog(int comp);
|
void set_component_filelog(int comp);
|
||||||
|
|
||||||
int map_str_to_int(mapping *map, const char *str);
|
int map_str_to_int(mapping *map, const char *str);
|
||||||
char *map_int_to_str(mapping *map, int val);
|
char *map_int_to_str(mapping *map, int val);
|
||||||
void logClean (void);
|
void logClean (void);
|
||||||
int is_newline( char *str, int size);
|
int is_newline( char *str, int size);
|
||||||
void *log_thread_function(void * list);
|
|
||||||
int register_log_component(char *name, char *fext, int compidx);
|
int register_log_component(char *name, char *fext, int compidx);
|
||||||
/** @defgroup _logIt logIt function
|
|
||||||
* @ingroup _macro
|
|
||||||
* @brief Macro used to call tr_log_full_ex with file, function and line information
|
|
||||||
* @{*/
|
|
||||||
|
|
||||||
#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
|
|
||||||
|
|
||||||
|
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
@@ -324,24 +291,34 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
|||||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||||
|
|
||||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
|
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
|
||||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY "global_log_verbosity"
|
|
||||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
|
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
|
||||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_INFILE "global_log_infile"
|
#define LOG_CONFIG_STRING_GLOBAL_LOG_INFILE "global_log_infile"
|
||||||
|
#define LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS "global_log_options"
|
||||||
|
|
||||||
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
|
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
|
||||||
#define LOG_CONFIG_VERBOSITY_FORMAT "%s_log_verbosity"
|
|
||||||
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
|
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
|
||||||
|
#define LOG_CONFIG_DEBUG_FORMAT "%s_debug"
|
||||||
|
#define LOG_CONFIG_MATLAB_FORMAT "%s_matlab"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
|
||||||
/* LOG globalconfiguration parameters */
|
" nocolor: disable color usage in log messages\n"\
|
||||||
/* optname help paramflags XXXptr defXXXval type numelt */
|
" level: add log level indication in log messages\n"\
|
||||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
" thread: add threads names in log messages\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
/* LOG globalconfiguration parameters */
|
||||||
|
/* optname help paramflags XXXptr defXXXval type numelt */
|
||||||
|
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define LOG_GLOBALPARAMS_DESC { \
|
#define LOG_GLOBALPARAMS_DESC { \
|
||||||
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, NULL, 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
|
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
|
||||||
{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL, 0, strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name, TYPE_STRING, 0}, \
|
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
|
||||||
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, NULL, 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
|
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
|
||||||
{LOG_CONFIG_STRING_GLOBAL_LOG_INFILE, NULL, 0, iptr:&(g_log->filelog), defintval:0, TYPE_INT, 0}, \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LOG_OPTIONS_IDX 2
|
||||||
/*----------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------------*/
|
||||||
/** @defgroup _debugging debugging macros
|
/** @defgroup _debugging debugging macros
|
||||||
* @ingroup _macro
|
* @ingroup _macro
|
||||||
@@ -349,32 +326,46 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
|||||||
* @{*/
|
* @{*/
|
||||||
|
|
||||||
// debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
|
// debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
|
||||||
# if T_TRACER
|
# if T_TRACER
|
||||||
# include "T.h"
|
/* per component, level dependant macros */
|
||||||
# define LOG_I(c, x...) do { if (T_stdout) { logIt(c, LOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
|
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
|
||||||
# define LOG_W(c, x...) do { if (T_stdout) { logIt(c, LOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
|
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
|
||||||
# define LOG_E(c, x...) do { if (T_stdout) { logIt(c, LOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
|
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
|
||||||
# define LOG_D(c, x...) do { if (T_stdout) { logIt(c, LOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
|
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
|
||||||
# define LOG_T(c, x...) do { if (T_stdout) { logIt(c, LOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
|
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
|
||||||
# define LOG_G(c, x...) do { if (T_stdout) { logIt(c, LOG_EMERG, x) ;}} while (0) /* */
|
# define LOG_F(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_FILE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_FILE, x) ;}} while (0) /* */
|
||||||
# define LOG_A(c, x...) do { if (T_stdout) { logIt(c, LOG_ALERT, x) ;}} while (0) /* */
|
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
|
||||||
# define LOG_C(c, x...) do { if (T_stdout) { logIt(c, LOG_CRIT, x) ;}} while (0) /* */
|
/* bitmask dependant macros, to isolate debugging code */
|
||||||
# define LOG_N(c, x...) do { if (T_stdout) { logIt(c, LOG_NOTICE, x) ;}} while (0) /* */
|
# define LOG_DEBUG_BEGIN(D) if (g_log->debug_mask & D) {
|
||||||
# define LOG_F(c, x...) do { if (T_stdout) { logIt(c, LOG_FILE, x) ;}} while (0) /* */
|
# define LOG_DEBUG_END }
|
||||||
# define LOG_M(file, vector, data, len, dec, format) write_file_matlab(file, vector, data, len, dec, format)/* */
|
/* bitmask dependant macros, to generate matlab files */
|
||||||
# else /* T_TRACER */
|
# define LOG_M_BEGIN(D) if (g_log->matlab_mask & D) {
|
||||||
|
# define LOG_M_END }
|
||||||
|
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
|
||||||
|
/* define variable only used in LOG macro's */
|
||||||
|
# define LOG_VAR(A,B) A B
|
||||||
|
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||||
# define LOG_I(c, x...) /* */
|
# define LOG_I(c, x...) /* */
|
||||||
# define LOG_W(c, x...) /* */
|
# define LOG_W(c, x...) /* */
|
||||||
# define LOG_E(c, x...) /* */
|
# define LOG_E(c, x...) /* */
|
||||||
# define LOG_D(c, x...) /* */
|
# define LOG_D(c, x...) /* */
|
||||||
# define LOG_T(c, x...) /* */
|
# define LOG_T(c, x...) /* */
|
||||||
# define LOG_G(c, x...) /* */
|
|
||||||
# define LOG_A(c, x...) /* */
|
|
||||||
# define LOG_C(c, x...) /* */
|
|
||||||
# define LOG_N(c, x...) /* */
|
|
||||||
# define LOG_F(c, x...) /* */
|
# define LOG_F(c, x...) /* */
|
||||||
# define LOG_M(file, vector, data, len, dec, format) /* */
|
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
||||||
|
# define LOG_DEBUG_BEGIN(D) if (0) {
|
||||||
|
# define LOG_DEBUG_END }
|
||||||
|
# define LOG_M_BEGIN(D) if (0) {
|
||||||
|
# define LOG_M_END }
|
||||||
|
# define LOG_M(file, vector, data, len, dec, format)
|
||||||
|
# define LOG_VAR(A,B)
|
||||||
# endif /* T_TRACER */
|
# endif /* T_TRACER */
|
||||||
|
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
||||||
|
#define LOG_USEDINLOG_VAR(A,B) __attribute__((unused)) A B
|
||||||
|
|
||||||
|
/* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
|
||||||
|
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||||
|
|
||||||
|
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
|
|
||||||
@@ -23,15 +23,8 @@
|
|||||||
|
|
||||||
extern log_t *g_log;
|
extern log_t *g_log;
|
||||||
|
|
||||||
#if !defined(LOG_NO_THREAD)
|
|
||||||
extern LOG_params log_list[2000];
|
|
||||||
extern pthread_mutex_t log_lock;
|
|
||||||
extern pthread_cond_t log_notify;
|
|
||||||
extern int log_shutdown;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern mapping log_level_names[];
|
extern mapping log_level_names[];
|
||||||
extern mapping log_verbosity_names[];
|
extern mapping log_options[];
|
||||||
|
extern mapping log_maskmap[];
|
||||||
|
|
||||||
extern int log_mem_flag;
|
|
||||||
extern char * log_mem_filename;
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
/* WARNING: if you edit the enums below, update also string definitions in vcd_signal_dumper.c */
|
/* WARNING: if you edit the enums below, update also string definitions in vcd_signal_dumper.c */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB = 0,
|
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB=0,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,
|
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,
|
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,
|
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,
|
||||||
@@ -91,12 +91,12 @@ typedef enum {
|
|||||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM,
|
VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
|
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
|
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
|
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_SEND_MSG,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
|
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_POLL_MSG,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
|
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_RECV_MSG,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG,
|
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_ALLOC_MSG,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
|
VCD_SIGNAL_DUMPER_VARIABLES_MP_ALLOC,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
|
VCD_SIGNAL_DUMPER_VARIABLES_MP_FREE,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_RX,
|
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_RX,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_TX,
|
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_TX,
|
||||||
VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,
|
VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,
|
||||||
@@ -15,4 +15,5 @@ tracer/to_vcd
|
|||||||
tracer/extract_input_subframe
|
tracer/extract_input_subframe
|
||||||
tracer/extract_output_subframe
|
tracer/extract_output_subframe
|
||||||
tracer/extract
|
tracer/extract
|
||||||
|
tracer/multi
|
||||||
tracee/tracee
|
tracee/tracee
|
||||||
|
|||||||
+11
-2
@@ -18,6 +18,15 @@ T_messages.txt.h: T_messages.txt
|
|||||||
T_IDs.h: $(GENIDS) T_messages.txt
|
T_IDs.h: $(GENIDS) T_messages.txt
|
||||||
./$(GENIDS) T_messages.txt T_IDs.h
|
./$(GENIDS) T_messages.txt T_IDs.h
|
||||||
|
|
||||||
|
check_vcd:
|
||||||
|
gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
|
||||||
|
./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
|
||||||
|
rm -f ./_check_vcd
|
||||||
|
|
||||||
|
.PHONY: check_vcd
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h
|
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h _check_vcd
|
||||||
cd tracer && make clean
|
|
||||||
|
cleanall: clean
|
||||||
|
cd tracer && $(MAKE) clean
|
||||||
|
|||||||
+37
-26
@@ -31,6 +31,12 @@ volatile int _T_freelist_head;
|
|||||||
volatile int *T_freelist_head = &_T_freelist_head;
|
volatile int *T_freelist_head = &_T_freelist_head;
|
||||||
T_cache_t *T_cache;
|
T_cache_t *T_cache;
|
||||||
|
|
||||||
|
#if BASIC_SIMULATOR
|
||||||
|
/* global variables used by T_GET_SLOT, see in T.h */
|
||||||
|
volatile uint64_t T_next_id;
|
||||||
|
volatile uint64_t T_active_id;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void get_message(int s)
|
static void get_message(int s)
|
||||||
{
|
{
|
||||||
char t;
|
char t;
|
||||||
@@ -91,7 +97,7 @@ static void new_thread(void *(*f)(void *), void *data)
|
|||||||
|
|
||||||
/* defined in local_tracer.c */
|
/* defined in local_tracer.c */
|
||||||
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||||
int local_socket, char *shm_file);
|
int local_socket, void *shm_array);
|
||||||
|
|
||||||
/* We monitor the tracee and the local tracer processes.
|
/* We monitor the tracee and the local tracer processes.
|
||||||
* When one dies we forcefully kill the other.
|
* When one dies we forcefully kill the other.
|
||||||
@@ -114,22 +120,31 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
|||||||
{
|
{
|
||||||
int socket_pair[2];
|
int socket_pair[2];
|
||||||
int s;
|
int s;
|
||||||
int T_shm_fd;
|
|
||||||
int child1, child2;
|
int child1, child2;
|
||||||
char shm_file[128];
|
int i;
|
||||||
|
|
||||||
sprintf(shm_file, "/%s%d", T_SHM_FILENAME, getpid());
|
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
|
||||||
{ perror("socketpair"); abort(); }
|
{ perror("socketpair"); abort(); }
|
||||||
|
|
||||||
|
/* setup shared memory */
|
||||||
|
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
||||||
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||||
|
if (T_cache == MAP_FAILED)
|
||||||
|
{ perror("mmap"); abort(); }
|
||||||
|
|
||||||
|
/* let's garbage the memory to catch some potential problems
|
||||||
|
* (think multiprocessor sync issues, barriers, etc.)
|
||||||
|
*/
|
||||||
|
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
|
||||||
|
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
|
||||||
|
|
||||||
/* child1 runs the local tracer and child2 (or main) runs the tracee */
|
/* child1 runs the local tracer and child2 (or main) runs the tracee */
|
||||||
|
|
||||||
child1 = fork(); if (child1 == -1) abort();
|
child1 = fork(); if (child1 == -1) abort();
|
||||||
if (child1 == 0) {
|
if (child1 == 0) {
|
||||||
close(socket_pair[1]);
|
close(socket_pair[1]);
|
||||||
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
|
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
|
||||||
shm_file);
|
T_cache);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
close(socket_pair[0]);
|
close(socket_pair[0]);
|
||||||
@@ -138,6 +153,7 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
|||||||
child2 = fork(); if (child2 == -1) abort();
|
child2 = fork(); if (child2 == -1) abort();
|
||||||
if (child2 != 0) {
|
if (child2 != 0) {
|
||||||
close(socket_pair[1]);
|
close(socket_pair[1]);
|
||||||
|
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
|
||||||
monitor_and_kill(child1, child2);
|
monitor_and_kill(child1, child2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,34 +164,29 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
|||||||
|
|
||||||
T_socket = s;
|
T_socket = s;
|
||||||
|
|
||||||
/* setup shared memory */
|
|
||||||
T_shm_fd = shm_open(shm_file, O_RDWR /*| O_SYNC*/, 0666);
|
|
||||||
shm_unlink(shm_file);
|
|
||||||
if (T_shm_fd == -1) { perror(shm_file); abort(); }
|
|
||||||
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
|
|
||||||
if (T_cache == MAP_FAILED)
|
|
||||||
{ perror(shm_file); abort(); }
|
|
||||||
close(T_shm_fd);
|
|
||||||
|
|
||||||
new_thread(T_receive_thread, NULL);
|
new_thread(T_receive_thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_Config_Init(void)
|
void T_Config_Init(void)
|
||||||
{
|
{
|
||||||
int T_port; /* by default we wait for the tracer */
|
int T_port; /* by default we wait for the tracer */
|
||||||
int T_nowait; /* default port to listen to to wait for the tracer */
|
int T_nowait; /* default port to listen to to wait for the tracer */
|
||||||
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
|
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
|
||||||
|
|
||||||
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC ;
|
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
|
||||||
|
|
||||||
/* for a cleaner config file, TTracer params should be defined in a specific section... */
|
/* for a cleaner config file, TTracer params should be defined in a
|
||||||
config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),TTRACER_CONFIG_PREFIX);
|
* specific section...
|
||||||
|
*/
|
||||||
|
config_get(ttraceparams,
|
||||||
|
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||||
|
TTRACER_CONFIG_PREFIX);
|
||||||
|
|
||||||
/* compatibility: look for TTracer command line options in root section */
|
/* compatibility: look for TTracer command line options in root section */
|
||||||
config_process_cmdline( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),NULL);
|
config_process_cmdline(ttraceparams,
|
||||||
|
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (T_stdout == 0) {
|
if (T_stdout == 0)
|
||||||
T_init(T_port, 1-T_nowait, T_dont_fork);
|
T_init(T_port, 1-T_nowait, T_dont_fork);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-11
@@ -112,13 +112,37 @@ extern volatile int *T_freelist_head;
|
|||||||
extern T_cache_t *T_cache;
|
extern T_cache_t *T_cache;
|
||||||
extern int *T_active;
|
extern int *T_active;
|
||||||
/* When running the basic simulator, we may fill the T cache too fast.
|
/* When running the basic simulator, we may fill the T cache too fast.
|
||||||
* Let's not crash if it's full, just wait.
|
* Let's serialize write accesses to the T cache. For that, we use a
|
||||||
|
* 'ticket' mechanism. To acquire a T slot the caller needs to own the
|
||||||
|
* current active ticket. We also wait for the slot to be free if
|
||||||
|
* it is already in use.
|
||||||
*/
|
*/
|
||||||
#if BASIC_SIMULATOR
|
#if BASIC_SIMULATOR
|
||||||
# define T_BASIC_SIMULATOR_WAIT \
|
# define T_GET_SLOT \
|
||||||
while (T_cache[T_LOCAL_slot].busy) usleep(100)
|
do { \
|
||||||
|
extern volatile uint64_t T_next_id; \
|
||||||
|
extern volatile uint64_t T_active_id; \
|
||||||
|
uint64_t id; \
|
||||||
|
/* get a ticket */ \
|
||||||
|
id = __sync_fetch_and_add(&T_next_id, 1); \
|
||||||
|
/* wait for our turn */ \
|
||||||
|
while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
|
||||||
|
/* this is our turn, try to acquire the slot until it's free */ \
|
||||||
|
do { \
|
||||||
|
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
|
||||||
|
if (T_LOCAL_busy & 0x01) usleep(100); \
|
||||||
|
} while (T_LOCAL_busy & 0x01); \
|
||||||
|
/* check that there are still some tickets */ \
|
||||||
|
if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
|
||||||
|
printf("T: reached the end of times, bye...\n"); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
/* free our ticket, which signals the next waiter that it's its turn */ \
|
||||||
|
(void)__sync_fetch_and_add(&T_active_id, 1); \
|
||||||
|
} while (0)
|
||||||
#else
|
#else
|
||||||
# define T_BASIC_SIMULATOR_WAIT /* */
|
# define T_GET_SLOT \
|
||||||
|
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* used at header of Tn, allocates buffer */
|
/* used at header of Tn, allocates buffer */
|
||||||
@@ -126,11 +150,12 @@ extern int *T_active;
|
|||||||
char *T_LOCAL_buf; \
|
char *T_LOCAL_buf; \
|
||||||
int T_LOCAL_size = 0; \
|
int T_LOCAL_size = 0; \
|
||||||
int T_LOCAL_slot; \
|
int T_LOCAL_slot; \
|
||||||
|
int T_LOCAL_busy; \
|
||||||
T_LOCAL_slot = __sync_fetch_and_add(T_freelist_head, 1) \
|
T_LOCAL_slot = __sync_fetch_and_add(T_freelist_head, 1) \
|
||||||
& (T_CACHE_SIZE - 1); \
|
& (T_CACHE_SIZE - 1); \
|
||||||
(void)__sync_fetch_and_and(T_freelist_head, T_CACHE_SIZE - 1); \
|
(void)__sync_fetch_and_and(T_freelist_head, T_CACHE_SIZE - 1); \
|
||||||
T_BASIC_SIMULATOR_WAIT; \
|
T_GET_SLOT; \
|
||||||
if (T_cache[T_LOCAL_slot].busy) { \
|
if (T_LOCAL_busy & 0x01) { \
|
||||||
printf("%s:%d:%s: T cache is full - consider increasing its size\n", \
|
printf("%s:%d:%s: T cache is full - consider increasing its size\n", \
|
||||||
__FILE__, __LINE__, __FUNCTION__); \
|
__FILE__, __LINE__, __FUNCTION__); \
|
||||||
abort(); \
|
abort(); \
|
||||||
@@ -142,7 +167,7 @@ extern int *T_active;
|
|||||||
#define T_COMMIT() \
|
#define T_COMMIT() \
|
||||||
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
|
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
|
||||||
__sync_synchronize(); \
|
__sync_synchronize(); \
|
||||||
T_cache[T_LOCAL_slot].busy = 1; \
|
(void)__sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x02);
|
||||||
|
|
||||||
#define T_CHECK_SIZE(len, argnum) \
|
#define T_CHECK_SIZE(len, argnum) \
|
||||||
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
|
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
|
||||||
@@ -578,10 +603,10 @@ extern int *T_active;
|
|||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define CMDLINE_TTRACEPARAMS_DESC { \
|
#define CMDLINE_TTRACEPARAMS_DESC { \
|
||||||
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
|
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
|
||||||
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
|
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
|
||||||
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
|
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
|
||||||
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
|
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* 'busy' is a bit field
|
||||||
|
* bit 0: 1 means that slot is acquired by writer
|
||||||
|
* bit 1: 1 means that slot is ready for consumption
|
||||||
|
*/
|
||||||
volatile int busy;
|
volatile int busy;
|
||||||
char buffer[T_BUFFER_MAX];
|
char buffer[T_BUFFER_MAX];
|
||||||
int length;
|
int length;
|
||||||
} T_cache_t;
|
} T_cache_t;
|
||||||
|
|
||||||
#define T_SHM_FILENAME "/T_shm_segment"
|
|
||||||
|
|
||||||
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
|
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
|
||||||
#define VCD_NUM_FUNCTIONS 190
|
#define VCD_NUM_FUNCTIONS 190
|
||||||
|
|
||||||
|
|||||||
+322
-24
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,249 @@
|
|||||||
|
/*
|
||||||
|
* To disable the checks done by this program, see below at the beginning
|
||||||
|
* of the function 'main'.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "database.h"
|
||||||
|
|
||||||
|
#define T_TRACER 1
|
||||||
|
#include "T.h"
|
||||||
|
|
||||||
|
/* VCD specific defines and includes
|
||||||
|
* If the codebase changes, it may need to be updated
|
||||||
|
*/
|
||||||
|
#define ENB_MODE
|
||||||
|
#define ENABLE_USE_CPU_EXECUTION_TIME
|
||||||
|
#include "../LOG/vcd_signal_dumper.c"
|
||||||
|
|
||||||
|
void err(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
void err(char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
|
||||||
|
printf("\x1b[31m");
|
||||||
|
printf("error: ");
|
||||||
|
vprintf(fmt, ap);
|
||||||
|
printf("\n"
|
||||||
|
"\x1b[33m\n"
|
||||||
|
"You probably added a VCD trace (variable or function) but you did not\n"
|
||||||
|
"update T_messages.txt and/or T_defs.h in common/utils/T/\n"
|
||||||
|
"\n"
|
||||||
|
"Be sure to add the new trace to T_messages.txt, at the right place in the\n"
|
||||||
|
"file. Do not forget to define VCD_NAME with an identical value as found\n"
|
||||||
|
"in the array eurecomVariablesNames or eurecomFunctionsNames.\n"
|
||||||
|
"\n"
|
||||||
|
"Be sure to update VCD_NUM_FUNCTIONS, VCD_NUM_VARIABLES, VCD_FIRST_FUNCTION\n"
|
||||||
|
"and VCD_FIRST_VARIABLE in T_defs.h\n"
|
||||||
|
"\n"
|
||||||
|
"The same procedure has to be followed when you delete a VCD trace.\n"
|
||||||
|
"Delete it in T_messages.txt as well and update T_defs.h\n"
|
||||||
|
"\n"
|
||||||
|
"You can disable those VCD checks at development time.\n"
|
||||||
|
"To disable the VCD checks see the file common/utils/T/check_vcd.c\n"
|
||||||
|
"Do not push any modification that disables the VCD checks to the\n"
|
||||||
|
"main repository.\n");
|
||||||
|
|
||||||
|
printf("\x1b[m\n");
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* to disable the checks done by this program, uncomment the following
|
||||||
|
* line, ie. remove the leading '//'
|
||||||
|
*/
|
||||||
|
//return 0;
|
||||||
|
|
||||||
|
void *database = parse_database("T_messages.txt");
|
||||||
|
int number_of_events;
|
||||||
|
int first_var = -1;
|
||||||
|
int last_var;
|
||||||
|
int first_fun = -1;
|
||||||
|
int last_fun;
|
||||||
|
char *prefix;
|
||||||
|
int prefix_len;
|
||||||
|
char *name;
|
||||||
|
char *vcd_name;
|
||||||
|
int i;
|
||||||
|
FILE *in;
|
||||||
|
char *l = NULL;
|
||||||
|
size_t lsize;
|
||||||
|
|
||||||
|
if (database == NULL) err("something wrong with T_messages.txt");
|
||||||
|
|
||||||
|
/* check the value of VCD_NUM_FUNCTIONS */
|
||||||
|
if (VCD_NUM_FUNCTIONS != sizeof(eurecomFunctionsNames) / sizeof(char *))
|
||||||
|
err("VCD_NUM_FUNCTIONS (%d) must be equal to %zd",
|
||||||
|
VCD_NUM_FUNCTIONS,
|
||||||
|
sizeof(eurecomFunctionsNames) / sizeof(char *));
|
||||||
|
|
||||||
|
/* check the value of VCD_NUM_VARIABLES */
|
||||||
|
if (VCD_NUM_VARIABLES != sizeof(eurecomVariablesNames) / sizeof(char *))
|
||||||
|
err("VCD_NUM_VARIABLES (%d) must be equal to %zd",
|
||||||
|
VCD_NUM_VARIABLES,
|
||||||
|
sizeof(eurecomVariablesNames) / sizeof(char *));
|
||||||
|
|
||||||
|
number_of_events = number_of_ids(database);
|
||||||
|
if (number_of_events == 0) err("no event defined in T_messages.txt");
|
||||||
|
|
||||||
|
/* T_messages.txt ends with VCD VARIABLES followed by VCD FUNCTIONS
|
||||||
|
* followed by nothing.
|
||||||
|
* Let's check.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* check VCD VARIABLES traces in T_messages.txt */
|
||||||
|
prefix = "VCD_VARIABLE_";
|
||||||
|
prefix_len = strlen(prefix);
|
||||||
|
|
||||||
|
for (i = 0; i < number_of_events; i++) {
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len)) continue;
|
||||||
|
first_var = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (first_var == -1)
|
||||||
|
err("no VCD_VARIABLE_ found in T_messages.txt");
|
||||||
|
for (; i < number_of_events; i++) {
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len)) break;
|
||||||
|
}
|
||||||
|
last_var = i-1;
|
||||||
|
|
||||||
|
/* check VCD FUNCTIONS traces in T_messages.txt */
|
||||||
|
if (i == number_of_events)
|
||||||
|
err("no VCD_FUNCTION_ found in T_messages.txt");
|
||||||
|
|
||||||
|
prefix = "VCD_FUNCTION_";
|
||||||
|
prefix_len = strlen(prefix);
|
||||||
|
|
||||||
|
first_fun = i;
|
||||||
|
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len))
|
||||||
|
err("last VCD_VARIABLE_ not followed by a VCD_FUNCTION_ in T_messages.txt");
|
||||||
|
|
||||||
|
for (; i < number_of_events; i++) {
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len)) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != number_of_events)
|
||||||
|
err("T_messages.txt does not end with a VCD_FUNCTION_ trace");
|
||||||
|
|
||||||
|
last_fun = i-1;
|
||||||
|
|
||||||
|
if (first_var != (unsigned)VCD_FIRST_VARIABLE)
|
||||||
|
err("VCD_FIRST_VARIABLE is not correct in T_defs.h");
|
||||||
|
if (first_fun != (unsigned)VCD_FIRST_FUNCTION)
|
||||||
|
err("VCD_FIRST_FUNCTION is not correct in T_defs.h");
|
||||||
|
if (last_var-first_var+1 != VCD_NUM_VARIABLES)
|
||||||
|
err("VCD_NUM_VARIABLES is not correct in T_defs.h");
|
||||||
|
if (last_fun-first_fun+1 != VCD_NUM_FUNCTIONS)
|
||||||
|
err("VCD_NUM_FUNCTIONS is not correct in T_defs.h");
|
||||||
|
|
||||||
|
/* check that VCD_NAME is identical to
|
||||||
|
* eurecomVariablesNames[x]/eurecomFunctionsNames[x]
|
||||||
|
*/
|
||||||
|
prefix = "VCD_VARIABLE_";
|
||||||
|
prefix_len = strlen(prefix);
|
||||||
|
|
||||||
|
for (i = 0; i < number_of_events; i++) {
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len)) continue;
|
||||||
|
vcd_name = event_vcd_name_from_id(database, i);
|
||||||
|
if (vcd_name == NULL)
|
||||||
|
err("%s has no VCD_NAME in T_messages.txt", name);
|
||||||
|
if (strcmp(vcd_name, eurecomVariablesNames[i - first_var]))
|
||||||
|
err("%s has a wrong VCD_NAME in T_messages.txt", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix = "VCD_FUNCTION_";
|
||||||
|
prefix_len = strlen(prefix);
|
||||||
|
|
||||||
|
for (i = 0; i < number_of_events; i++) {
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strncmp(name, prefix, prefix_len)) continue;
|
||||||
|
vcd_name = event_vcd_name_from_id(database, i);
|
||||||
|
if (vcd_name == NULL)
|
||||||
|
err("%s has no VCD_NAME in T_messages.txt", name);
|
||||||
|
if (strcmp(vcd_name, eurecomFunctionsNames[i - first_fun]))
|
||||||
|
err("%s has a wrong VCD_NAME in T_messages.txt", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check IDs - these checks are difficult because we parse
|
||||||
|
* common/utils/LOG/vcd_signal_dumper.h which is expected to
|
||||||
|
* be formatted as is:
|
||||||
|
* - define vcd_signal_dump_variables then vcd_signal_dump_functions
|
||||||
|
* - one VCD_XXXX per line starting with two spaces
|
||||||
|
* followed by ',' or '=' with no space in between
|
||||||
|
* - no #ifdef / #if is taken into account
|
||||||
|
* - we require VCD_SIGNAL_DUMPER_VARIABLES_END and
|
||||||
|
* VCD_SIGNAL_DUMPER_FUNCTIONS_END at the end of each array,
|
||||||
|
* each on a line of its own with two spaces before and nothing after.
|
||||||
|
*
|
||||||
|
* If these checks fail, consider formatting
|
||||||
|
* common/utils/LOG/vcd_signal_dumper.h as expected here, if
|
||||||
|
* it makes sense of course. Otherwise, change the code below.
|
||||||
|
*
|
||||||
|
* In common/utils/LOG/vcd_signal_dumper.h a valid name is
|
||||||
|
* either VCD_SIGNAL_DUMPER_VARIABLES_ABC or
|
||||||
|
* VCD_SIGNAL_DUMPER_FUNCTIONS_XYZ
|
||||||
|
* and in T_messages.txt the corresponding name has to be
|
||||||
|
* VCD_VARIABLE_ABC or VCD_FUNCTION_XYZ
|
||||||
|
*/
|
||||||
|
i = first_var;
|
||||||
|
in = fopen("../LOG/vcd_signal_dumper.h", "r");
|
||||||
|
if (in == NULL) err("could not open ../LOG/vcd_signal_dumper.h");
|
||||||
|
while (1) {
|
||||||
|
char *x = " VCD_SIGNAL_DUMPER_VARIABLES_";
|
||||||
|
ssize_t r;
|
||||||
|
free(l);
|
||||||
|
l = NULL;
|
||||||
|
lsize = 0;
|
||||||
|
r = getline(&l, &lsize, in);
|
||||||
|
if (r == -1) break;
|
||||||
|
if (!strcmp(l, " VCD_SIGNAL_DUMPER_VARIABLES_END\n")) break;
|
||||||
|
/* remove ',' or '=' if found */
|
||||||
|
{ char *s=l; while (*s) { if (*s==','||*s=='=') { *s=0; break; } s++; } }
|
||||||
|
if (strncmp(l, x, strlen(x))) continue;
|
||||||
|
if (!(i >= first_var && i <= last_var))
|
||||||
|
err("T_messages.txt is not correct with respect to VCD VARIABLES");
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strcmp(l+strlen(x), name+strlen("VCD_VARIABLE_")))
|
||||||
|
err("%s is not correct in T_messages.txt", name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (i != last_var + 1) err("VCD VARIABLES wrong in T_messages.txt");
|
||||||
|
while (1) {
|
||||||
|
char *x = " VCD_SIGNAL_DUMPER_FUNCTIONS_";
|
||||||
|
ssize_t r;
|
||||||
|
free(l);
|
||||||
|
l = NULL;
|
||||||
|
lsize = 0;
|
||||||
|
r = getline(&l, &lsize, in);
|
||||||
|
if (r == -1) break;
|
||||||
|
if (!strcmp(l, " VCD_SIGNAL_DUMPER_FUNCTIONS_END\n")) break;
|
||||||
|
/* remove ',' or '=' if found */
|
||||||
|
{ char *s=l; while (*s) { if (*s==','||*s=='=') { *s=0; break; } s++; } }
|
||||||
|
if (strncmp(l, x, strlen(x))) continue;
|
||||||
|
if (!(i >= first_fun && i <= last_fun))
|
||||||
|
err("T_messages.txt is not correct with respect to VCD FUNCTIONS");
|
||||||
|
name = event_name_from_id(database, i);
|
||||||
|
if (strcmp(l+strlen(x), name+strlen("VCD_FUNCTION_")))
|
||||||
|
err("%s is not correct in T_messages.txt", name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
fclose(in);
|
||||||
|
if (i != last_fun + 1) err("VCD FUNCTIONS wrong in T_messages.txt");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+11
-10
@@ -14,21 +14,21 @@ int cmp(const void *p1, const void *p2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return 1 if s was not already known, 0 if it was */
|
/* return 1 if s was not already known, 0 if it was */
|
||||||
int new_unique_id(char *s)
|
int new_unique_id(char *s, char *input_file)
|
||||||
{
|
{
|
||||||
if (unique_ids_size)
|
if (unique_ids_size)
|
||||||
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
|
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
|
||||||
printf("FATAL: ID %s is not unique\n", s);
|
printf("error: ID %s is not unique in %s\n", s, input_file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (unique_ids_size == unique_ids_maxsize) {
|
if (unique_ids_size == unique_ids_maxsize) {
|
||||||
unique_ids_maxsize += 256;
|
unique_ids_maxsize += 256;
|
||||||
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
|
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
|
||||||
if (unique_ids == NULL) { printf("out of memory\n"); abort(); }
|
if (unique_ids == NULL) { printf("erorr: out of memory\n"); abort(); }
|
||||||
}
|
}
|
||||||
unique_ids[unique_ids_size] = strdup(s);
|
unique_ids[unique_ids_size] = strdup(s);
|
||||||
if (unique_ids[unique_ids_size] == NULL)
|
if (unique_ids[unique_ids_size] == NULL)
|
||||||
{ printf("out of memory\n"); abort(); }
|
{ printf("erorr: out of memory\n"); abort(); }
|
||||||
unique_ids_size++;
|
unique_ids_size++;
|
||||||
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
|
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -43,7 +43,8 @@ void putname(int c)
|
|||||||
if (bufname_size == bufname_maxsize) {
|
if (bufname_size == bufname_maxsize) {
|
||||||
bufname_maxsize += 256;
|
bufname_maxsize += 256;
|
||||||
bufname = realloc(bufname, bufname_maxsize);
|
bufname = realloc(bufname, bufname_maxsize);
|
||||||
if (bufname == NULL) { printf("memory allocation error\n"); exit(1); }
|
if (bufname == NULL)
|
||||||
|
{ printf("erorr: memory allocation error\n"); exit(1); }
|
||||||
}
|
}
|
||||||
bufname[bufname_size] = c;
|
bufname[bufname_size] = c;
|
||||||
bufname_size++;
|
bufname_size++;
|
||||||
@@ -58,7 +59,8 @@ void putvalue(int c)
|
|||||||
if (bufvalue_size == bufvalue_maxsize) {
|
if (bufvalue_size == bufvalue_maxsize) {
|
||||||
bufvalue_maxsize += 256;
|
bufvalue_maxsize += 256;
|
||||||
bufvalue = realloc(bufvalue, bufvalue_maxsize);
|
bufvalue = realloc(bufvalue, bufvalue_maxsize);
|
||||||
if (bufvalue == NULL) { printf("memory allocation error\n"); exit(1); }
|
if (bufvalue == NULL)
|
||||||
|
{ printf("error: memory allocation error\n"); exit(1); }
|
||||||
}
|
}
|
||||||
bufvalue[bufvalue_size] = c;
|
bufvalue[bufvalue_size] = c;
|
||||||
bufvalue_size++;
|
bufvalue_size++;
|
||||||
@@ -119,7 +121,7 @@ int main(int n, char **v)
|
|||||||
char *in_name;
|
char *in_name;
|
||||||
char *out_name;
|
char *out_name;
|
||||||
|
|
||||||
if (n != 3) { printf("gimme <source> <dest>\n"); exit(1); }
|
if (n != 3) { printf("error: gimme <source> <dest>\n"); exit(1); }
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
@@ -134,14 +136,13 @@ int main(int n, char **v)
|
|||||||
while (1) {
|
while (1) {
|
||||||
get_line(in, &name, &value);
|
get_line(in, &name, &value);
|
||||||
if (name == NULL) break;
|
if (name == NULL) break;
|
||||||
printf("name '%s' value '%s'\n", name, value);
|
|
||||||
if (isspace(value[strlen(value)-1])) {
|
if (isspace(value[strlen(value)-1])) {
|
||||||
printf("bad value '%s' (no space at the end please!)\n", value);
|
printf("error: bad value '%s' (no space at the end please!)\n", value);
|
||||||
unlink(out_name);
|
unlink(out_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!strcmp(name, "ID")) {
|
if (!strcmp(name, "ID")) {
|
||||||
if (!new_unique_id(value)) { unlink(out_name); exit(1); }
|
if (!new_unique_id(value, in_name)) { unlink(out_name); exit(1); }
|
||||||
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
|
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -337,54 +337,34 @@ static void forward(void *_forwarder, char *buf, int size)
|
|||||||
|
|
||||||
static void wait_message(void)
|
static void wait_message(void)
|
||||||
{
|
{
|
||||||
while (T_local_cache[T_busylist_head].busy == 0) usleep(1000);
|
while ((T_local_cache[T_busylist_head].busy & 0x02) == 0) usleep(1000);
|
||||||
}
|
|
||||||
|
|
||||||
static void init_shm(char *shm_file)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int s = shm_open(shm_file, O_RDWR | O_CREAT /*| O_SYNC*/, 0666);
|
|
||||||
if (s == -1) { perror(shm_file); abort(); }
|
|
||||||
if (ftruncate(s, T_CACHE_SIZE * sizeof(T_cache_t)))
|
|
||||||
{ perror(shm_file); abort(); }
|
|
||||||
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
|
|
||||||
if (T_local_cache == MAP_FAILED)
|
|
||||||
{ perror(shm_file); abort(); }
|
|
||||||
close(s);
|
|
||||||
|
|
||||||
/* let's garbage the memory to catch some potential problems
|
|
||||||
* (think multiprocessor sync issues, barriers, etc.)
|
|
||||||
*/
|
|
||||||
memset(T_local_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
|
|
||||||
for (i = 0; i < T_CACHE_SIZE; i++) T_local_cache[i].busy = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||||
int local_socket, char *shm_file)
|
int local_socket, void *shm_array)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
int port = remote_port;
|
int port = remote_port;
|
||||||
int dont_wait = wait_for_tracer ? 0 : 1;
|
int dont_wait = wait_for_tracer ? 0 : 1;
|
||||||
void *f;
|
void *f;
|
||||||
printf("local tracer starting\n");
|
|
||||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR){
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||||
printf("local tracer received SIGPIPE\n");
|
printf("local tracer received SIGPIPE\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_local_cache = shm_array;
|
||||||
|
|
||||||
init_shm(shm_file);
|
|
||||||
s = local_socket;
|
s = local_socket;
|
||||||
printf("local tracer starting step 2\n");
|
|
||||||
if (dont_wait) {
|
if (dont_wait) {
|
||||||
char t = 2;
|
char t = 2;
|
||||||
printf("local tracer in no wait mode \n");
|
|
||||||
if (write(s, &t, 1) != 1) abort();
|
if (write(s, &t, 1) != 1) abort();
|
||||||
}
|
}
|
||||||
printf("local tracer starting step 3\n");
|
|
||||||
f = forwarder(port, s);
|
f = forwarder(port, s);
|
||||||
printf("local tracer main loop.... \n");
|
|
||||||
/* read messages */
|
/* read messages */
|
||||||
while (1) {
|
while (1) {
|
||||||
wait_message();
|
wait_message();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ LIBS=-lm
|
|||||||
XLIBS=-lX11 -lpng -lXft
|
XLIBS=-lX11 -lpng -lXft
|
||||||
|
|
||||||
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
|
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
|
||||||
extract_input_subframe extract_output_subframe to_vcd extract
|
extract_input_subframe extract_output_subframe to_vcd extract multi
|
||||||
|
|
||||||
record: utils.o record.o database.o config.o
|
record: utils.o record.o database.o config.o
|
||||||
$(CC) $(CFLAGS) -o record $^ $(LIBS)
|
$(CC) $(CFLAGS) -o record $^ $(LIBS)
|
||||||
@@ -57,19 +57,22 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
|
|||||||
config.o
|
config.o
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
multi: multi.o utils.o database.o config.o
|
||||||
|
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
|
||||||
|
|
||||||
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
|
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
|
||||||
|
|
||||||
gui/gui.a:
|
gui/gui.a:
|
||||||
cd gui && make
|
cd gui && $(MAKE)
|
||||||
|
|
||||||
view/view.a:
|
view/view.a:
|
||||||
cd view && make
|
cd view && $(MAKE)
|
||||||
|
|
||||||
logger/logger.a:
|
logger/logger.a:
|
||||||
cd logger && make
|
cd logger && $(MAKE)
|
||||||
|
|
||||||
filter/filter.a:
|
filter/filter.a:
|
||||||
cd filter && make
|
cd filter && $(MAKE)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
@@ -77,9 +80,9 @@ filter/filter.a:
|
|||||||
clean:
|
clean:
|
||||||
rm -f *.o core tracer_remote textlog enb ue vcd record replay
|
rm -f *.o core tracer_remote textlog enb ue vcd record replay
|
||||||
rm -f extract_config macpdu2wireshark extract_input_subframe
|
rm -f extract_config macpdu2wireshark extract_input_subframe
|
||||||
rm -f extract_output_subframe to_vcd extract
|
rm -f extract_output_subframe to_vcd extract multi
|
||||||
cd gui && make clean
|
cd gui && $(MAKE) clean
|
||||||
cd view && make clean
|
cd view && $(MAKE) clean
|
||||||
cd logger && make clean
|
cd logger && $(MAKE) clean
|
||||||
cd filter && make clean
|
cd filter && $(MAKE) clean
|
||||||
cd hacks && make clean
|
cd hacks && $(MAKE) clean
|
||||||
|
|||||||
@@ -60,3 +60,9 @@ void verify_config(void)
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_local_config(char **txt, int *len)
|
||||||
|
{
|
||||||
|
*txt = local;
|
||||||
|
*len = local_size;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ void clear_remote_config(void);
|
|||||||
void append_received_config_chunk(char *buf, int length);
|
void append_received_config_chunk(char *buf, int length);
|
||||||
void load_config_file(char *filename);
|
void load_config_file(char *filename);
|
||||||
void verify_config(void);
|
void verify_config(void);
|
||||||
|
void get_local_config(char **txt, int *len);
|
||||||
|
|
||||||
#endif /* _CONFIG_H_ */
|
#endif /* _CONFIG_H_ */
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ typedef struct {
|
|||||||
char **arg_type;
|
char **arg_type;
|
||||||
char **arg_name;
|
char **arg_name;
|
||||||
int asize;
|
int asize;
|
||||||
|
char *vcd_name;
|
||||||
int id;
|
int id;
|
||||||
} id;
|
} id;
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ id *add_id(database *r, char *idname, int i)
|
|||||||
r->i[r->isize].arg_type = NULL;
|
r->i[r->isize].arg_type = NULL;
|
||||||
r->i[r->isize].arg_name = NULL;
|
r->i[r->isize].arg_name = NULL;
|
||||||
r->i[r->isize].asize = 0;
|
r->i[r->isize].asize = 0;
|
||||||
|
r->i[r->isize].vcd_name = NULL;
|
||||||
r->i[r->isize].id = i;
|
r->i[r->isize].id = i;
|
||||||
r->isize++;
|
r->isize++;
|
||||||
qsort(r->i, r->isize, sizeof(id), id_cmp);
|
qsort(r->i, r->isize, sizeof(id), id_cmp);
|
||||||
@@ -224,6 +226,12 @@ void add_desc(id *i, char *desc)
|
|||||||
i->desc = strdup(desc); if (i->desc == NULL) abort();
|
i->desc = strdup(desc); if (i->desc == NULL) abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void add_vcd_name(id *i, char *vcd_name)
|
||||||
|
{
|
||||||
|
if (i == NULL) {printf("ERROR: VCD_NAME line before ID line\n");exit(1);}
|
||||||
|
i->vcd_name = strdup(vcd_name); if (i->vcd_name == NULL) abort();
|
||||||
|
}
|
||||||
|
|
||||||
char *format_get_next_token(char **cur)
|
char *format_get_next_token(char **cur)
|
||||||
{
|
{
|
||||||
char *start;
|
char *start;
|
||||||
@@ -320,6 +328,7 @@ void *parse_database(char *filename)
|
|||||||
if (!strcmp(name, "GROUP")) add_groups(r, last_id, value);
|
if (!strcmp(name, "GROUP")) add_groups(r, last_id, value);
|
||||||
if (!strcmp(name, "DESC")) add_desc(last_id, value);
|
if (!strcmp(name, "DESC")) add_desc(last_id, value);
|
||||||
if (!strcmp(name, "FORMAT")) add_format(last_id, value);
|
if (!strcmp(name, "FORMAT")) add_format(last_id, value);
|
||||||
|
if (!strcmp(name, "VCD_NAME")) add_vcd_name(last_id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(in);
|
fclose(in);
|
||||||
@@ -424,6 +433,12 @@ char *event_name_from_id(void *_database, int id)
|
|||||||
return d->i[d->id_to_pos[id]].name;
|
return d->i[d->id_to_pos[id]].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *event_vcd_name_from_id(void *_database, int id)
|
||||||
|
{
|
||||||
|
database *d = _database;
|
||||||
|
return d->i[d->id_to_pos[id]].vcd_name;
|
||||||
|
}
|
||||||
|
|
||||||
int event_id_from_name(void *_database, char *name)
|
int event_id_from_name(void *_database, char *name)
|
||||||
{
|
{
|
||||||
database *d = _database;
|
database *d = _database;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ void list_ids(void *database);
|
|||||||
void list_groups(void *database);
|
void list_groups(void *database);
|
||||||
void on_off(void *d, char *item, int *a, int onoff);
|
void on_off(void *d, char *item, int *a, int onoff);
|
||||||
char *event_name_from_id(void *database, int id);
|
char *event_name_from_id(void *database, int id);
|
||||||
|
char *event_vcd_name_from_id(void *_database, int id);
|
||||||
int event_id_from_name(void *database, char *name);
|
int event_id_from_name(void *database, char *name);
|
||||||
int number_of_ids(void *database);
|
int number_of_ids(void *database);
|
||||||
int database_get_ids(void *database, char ***ids);
|
int database_get_ids(void *database, char ***ids);
|
||||||
|
|||||||
@@ -878,6 +878,7 @@ int main(int n, char **v)
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
clear_remote_config();
|
clear_remote_config();
|
||||||
|
if (enb_data.socket != -1) close(enb_data.socket);
|
||||||
enb_data.socket = connect_to(ip, port);
|
enb_data.socket = connect_to(ip, port);
|
||||||
|
|
||||||
/* send the first message - activate selected traces */
|
/* send the first message - activate selected traces */
|
||||||
|
|||||||
@@ -0,0 +1,385 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <poll.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "database.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "../T.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define DEFAULT_LOCAL_PORT 2022
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int id; /* increases at each new tracer's connection */
|
||||||
|
int s; /* socket */
|
||||||
|
int *is_on; /* local vision of is_on for this tracer */
|
||||||
|
int poll_id; /* -1: invalid, otherwise index in fds array */
|
||||||
|
} ti_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ti_t *ti; /* data for tracers */
|
||||||
|
int ti_size;
|
||||||
|
int ti_maxsize;
|
||||||
|
} multi_t;
|
||||||
|
|
||||||
|
void set_is_on(int *is_on, int pos, int val)
|
||||||
|
{
|
||||||
|
if (val) is_on[pos]++; else is_on[pos]--;
|
||||||
|
/* TODO: remove check? */
|
||||||
|
if (is_on[pos] < 0) { printf("%s:%d:nonono\n",__FILE__,__LINE__); abort(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
int send_messages_txt(int s, char *T_messages_txt, int T_messages_txt_len)
|
||||||
|
{
|
||||||
|
char buf[T_BUFFER_MAX];
|
||||||
|
char *T_LOCAL_buf = buf;
|
||||||
|
int32_t T_LOCAL_size;
|
||||||
|
unsigned char *src;
|
||||||
|
int src_len;
|
||||||
|
|
||||||
|
/* trace T_message.txt
|
||||||
|
* Send several messages -1 with content followed by message -2.
|
||||||
|
*/
|
||||||
|
src = (unsigned char *)T_messages_txt;
|
||||||
|
src_len = T_messages_txt_len;
|
||||||
|
while (src_len) {
|
||||||
|
int send_size = src_len;
|
||||||
|
if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int))
|
||||||
|
send_size = T_PAYLOAD_MAXSIZE - sizeof(int);
|
||||||
|
/* TODO: be careful, we use internal T stuff, to rewrite? */
|
||||||
|
T_LOCAL_size = 0;
|
||||||
|
T_HEADER(T_ID(-1));
|
||||||
|
T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)}));
|
||||||
|
if (socket_send(s, &T_LOCAL_size, 4) == -1) return -1;
|
||||||
|
if (socket_send(s, buf, T_LOCAL_size) == -1) return -1;
|
||||||
|
src += send_size;
|
||||||
|
src_len -= send_size;
|
||||||
|
}
|
||||||
|
T_LOCAL_size = 0;
|
||||||
|
T_HEADER(T_ID(-2));
|
||||||
|
if (socket_send(s, &T_LOCAL_size, 4) == -1) return -1;
|
||||||
|
return socket_send(s, buf, T_LOCAL_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void new_tracer(multi_t *m, int s, int is_on_size, char *t, int t_size, int id)
|
||||||
|
{
|
||||||
|
if (send_messages_txt(s, t, t_size) == -1) {
|
||||||
|
printf("error sending T_messages.txt to new tracer %d => remove tracer\n",
|
||||||
|
id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m->ti_size == m->ti_maxsize) {
|
||||||
|
m->ti_maxsize += 64;
|
||||||
|
m->ti = realloc(m->ti, m->ti_maxsize * sizeof(ti_t));
|
||||||
|
if (m->ti == NULL) abort();
|
||||||
|
}
|
||||||
|
m->ti[m->ti_size].id = id;
|
||||||
|
m->ti[m->ti_size].s = s;
|
||||||
|
m->ti[m->ti_size].is_on = calloc(is_on_size, sizeof(int));
|
||||||
|
if (m->ti[m->ti_size].is_on == NULL) abort();
|
||||||
|
m->ti[m->ti_size].poll_id = -1;
|
||||||
|
m->ti_size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_tracer(multi_t *m, int t)
|
||||||
|
{
|
||||||
|
free(m->ti[t].is_on);
|
||||||
|
shutdown(m->ti[t].s, SHUT_RDWR);
|
||||||
|
close(m->ti[t].s);
|
||||||
|
m->ti_size--;
|
||||||
|
memmove(&m->ti[t], &m->ti[t+1], (m->ti_size - t) * sizeof(ti_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
int send_is_on(int socket, int number_of_events, int *is_on)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char mt = 1;
|
||||||
|
if (socket_send(socket, &mt, 1) == -1 ||
|
||||||
|
socket_send(socket, &number_of_events, sizeof(int)) == -1) return -1;
|
||||||
|
for (i = 0; i < number_of_events; i++) {
|
||||||
|
int v = is_on[i] ? 1 : 0;
|
||||||
|
if (socket_send(socket, &v, sizeof(int)) == -1) return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_tracee(int s, OBUF *ebuf, int *_type, int32_t *_length)
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
int32_t length;
|
||||||
|
char *v;
|
||||||
|
int vpos = 0;
|
||||||
|
|
||||||
|
if (fullread(s, &length, 4) == -1) return -1;
|
||||||
|
if (ebuf->omaxsize < length) {
|
||||||
|
ebuf->omaxsize = (length + 65535) & ~65535;
|
||||||
|
ebuf->obuf = realloc(ebuf->obuf, ebuf->omaxsize);
|
||||||
|
if (ebuf->obuf == NULL) { printf("out of memory\n"); exit(1); }
|
||||||
|
}
|
||||||
|
v = ebuf->obuf;
|
||||||
|
memcpy(v+vpos, &length, 4);
|
||||||
|
vpos += 4;
|
||||||
|
#ifdef T_SEND_TIME
|
||||||
|
if (fullread(s,v+vpos,sizeof(struct timespec))==-1) return -1;
|
||||||
|
vpos += sizeof(struct timespec);
|
||||||
|
length -= sizeof(struct timespec);
|
||||||
|
#endif
|
||||||
|
if (fullread(s, &type, sizeof(int)) == -1) return -1;
|
||||||
|
memcpy(v+vpos, &type, sizeof(int));
|
||||||
|
vpos += sizeof(int);
|
||||||
|
length -= sizeof(int);
|
||||||
|
if (fullread(s, v+vpos, length) == -1) return -1;
|
||||||
|
vpos += length;
|
||||||
|
|
||||||
|
ebuf->osize = vpos;
|
||||||
|
|
||||||
|
*_type = type;
|
||||||
|
*_length = length;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void forward_event(multi_t *m, int number_of_events, OBUF *ebuf, int type)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (type < 0 || type >= number_of_events)
|
||||||
|
{ printf("error: bad type of event to forward %d\n", type); abort(); }
|
||||||
|
|
||||||
|
for (i = 0; i < m->ti_size; i++) {
|
||||||
|
if (!m->ti[i].is_on[type]) continue;
|
||||||
|
if (socket_send(m->ti[i].s, ebuf->obuf, ebuf->osize) == -1)
|
||||||
|
printf("warning: error forwarding event to tracer %d\n", m->ti[i].id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int connect_to_tracee(char *ip, int port, int number_of_events, int *is_on)
|
||||||
|
{
|
||||||
|
int s;
|
||||||
|
|
||||||
|
printf("connecting to %s:%d\n", ip, port);
|
||||||
|
|
||||||
|
s = try_connect_to(ip, port);
|
||||||
|
if (s == -1) return -1;
|
||||||
|
|
||||||
|
if (send_is_on(s, number_of_events, is_on) == -1) {
|
||||||
|
shutdown(s, SHUT_RDWR);
|
||||||
|
close(s);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void usage(void)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"options:\n"
|
||||||
|
" -d <database file> this option is mandatory\n"
|
||||||
|
" -ip <host> connect to given IP address (default %s)\n"
|
||||||
|
" -p <port> connect to given port (default %d)\n"
|
||||||
|
" -lp <port> listen on local port (default %d)\n",
|
||||||
|
DEFAULT_REMOTE_IP,
|
||||||
|
DEFAULT_REMOTE_PORT,
|
||||||
|
DEFAULT_LOCAL_PORT
|
||||||
|
);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int n, char **v)
|
||||||
|
{
|
||||||
|
char *database_filename = NULL;
|
||||||
|
void *database;
|
||||||
|
char *ip = DEFAULT_REMOTE_IP;
|
||||||
|
int port = DEFAULT_REMOTE_PORT;
|
||||||
|
int local_port = DEFAULT_LOCAL_PORT;
|
||||||
|
int *is_on;
|
||||||
|
int number_of_events;
|
||||||
|
int i, j;
|
||||||
|
char *T_messages_txt;
|
||||||
|
int T_messages_txt_len;
|
||||||
|
int l; /* listen socket for tracers' connections */
|
||||||
|
int s = -1; /* socket connected to tracee. -1 if not connected */
|
||||||
|
multi_t m;
|
||||||
|
int is_on_changed;
|
||||||
|
int current_nfd;
|
||||||
|
struct pollfd *fds = NULL;
|
||||||
|
int next_id = 0;
|
||||||
|
|
||||||
|
memset(&m, 0, sizeof(m));
|
||||||
|
|
||||||
|
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||||
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||||
|
|
||||||
|
for (i = 1; i < n; i++) {
|
||||||
|
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
|
||||||
|
if (!strcmp(v[i], "-d"))
|
||||||
|
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
|
||||||
|
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
|
||||||
|
if (!strcmp(v[i], "-p"))
|
||||||
|
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
|
||||||
|
if (!strcmp(v[i], "-lp"))
|
||||||
|
{ if (i > n-2) usage(); local_port = atoi(v[++i]); continue; }
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (database_filename == NULL) {
|
||||||
|
printf("ERROR: provide a database file (-d)\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
database = parse_database(database_filename);
|
||||||
|
|
||||||
|
load_config_file(database_filename);
|
||||||
|
get_local_config(&T_messages_txt, &T_messages_txt_len);
|
||||||
|
|
||||||
|
number_of_events = number_of_ids(database);
|
||||||
|
is_on = calloc(number_of_events, sizeof(int));
|
||||||
|
if (is_on == NULL) abort();
|
||||||
|
|
||||||
|
/* create listener socket */
|
||||||
|
l = create_listen_socket("0.0.0.0", local_port);
|
||||||
|
|
||||||
|
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||||
|
|
||||||
|
current_nfd = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
int nfd;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
|
if (s == -1) s = connect_to_tracee(ip, port, number_of_events, is_on);
|
||||||
|
|
||||||
|
/* poll on s (if there), l, and all tracers' sockets */
|
||||||
|
nfd = 1 + (s != -1) + m.ti_size;
|
||||||
|
if (nfd != current_nfd) {
|
||||||
|
current_nfd = nfd;
|
||||||
|
free(fds);
|
||||||
|
fds = calloc(nfd, sizeof(struct pollfd));
|
||||||
|
if (fds == NULL) { perror("calloc"); exit(1); }
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
fds[i].fd = l;
|
||||||
|
fds[i].events = POLLIN;
|
||||||
|
i++;
|
||||||
|
if (s != -1) {
|
||||||
|
fds[i].fd = s;
|
||||||
|
fds[i].events = POLLIN;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
for (j = 0; j < m.ti_size; j++) {
|
||||||
|
m.ti[j].poll_id = i;
|
||||||
|
fds[i].fd = m.ti[j].s;
|
||||||
|
fds[i].events = POLLIN;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (s == -1) timeout = 1000; else timeout = -1;
|
||||||
|
if (poll(fds, nfd, timeout) == -1) { perror("poll"); exit(1); }
|
||||||
|
|
||||||
|
if (fds[0].revents & ~POLLIN) {
|
||||||
|
printf("TODO: error on listen socket?\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* new tracer connecting? */
|
||||||
|
if (fds[0].revents & POLLIN) {
|
||||||
|
int t;
|
||||||
|
printf("tracer %d connecting\n", next_id);
|
||||||
|
t = socket_accept(l);
|
||||||
|
if (t == -1) perror("accept");
|
||||||
|
else new_tracer(&m, t, number_of_events,
|
||||||
|
T_messages_txt, T_messages_txt_len, next_id);
|
||||||
|
next_id++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s != -1 && fds[1].revents & ~POLLIN) {
|
||||||
|
printf("TODO: error on tracee socket?\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* data from tracee */
|
||||||
|
if (s != -1 && fds[1].revents & POLLIN) {
|
||||||
|
int type;
|
||||||
|
int32_t length;
|
||||||
|
if (read_tracee(s, &ebuf, &type, &length) == -1) {
|
||||||
|
clear_remote_config();
|
||||||
|
shutdown(s, SHUT_RDWR);
|
||||||
|
close(s);
|
||||||
|
s = -1;
|
||||||
|
} else {
|
||||||
|
if (type == -1)
|
||||||
|
append_received_config_chunk(ebuf.obuf+ebuf.osize-length, length);
|
||||||
|
else if (type == -2) verify_config();
|
||||||
|
else forward_event(&m, number_of_events, &ebuf, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* status of each tracer */
|
||||||
|
is_on_changed = 0;
|
||||||
|
for (j = 0; j < m.ti_size; j++) {
|
||||||
|
int l;
|
||||||
|
int s;
|
||||||
|
int *t_is_on;
|
||||||
|
if (m.ti[j].poll_id == -1) continue;
|
||||||
|
i = m.ti[j].poll_id;
|
||||||
|
s = m.ti[j].s;
|
||||||
|
t_is_on = m.ti[j].is_on;
|
||||||
|
if (fds[i].revents & (POLLHUP | POLLERR)) goto tracer_error;
|
||||||
|
/* error? */
|
||||||
|
if (fds[i].revents & ~POLLIN) {
|
||||||
|
printf("TODO: error with tracer?\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* data in */
|
||||||
|
if (fds[i].revents & POLLIN) {
|
||||||
|
char t;
|
||||||
|
int len;
|
||||||
|
int v;
|
||||||
|
if (fullread(s, &t, 1) != 1) goto tracer_error;
|
||||||
|
switch (t) {
|
||||||
|
case 0:
|
||||||
|
is_on_changed = 1;
|
||||||
|
if (fullread(s, &len, sizeof(int)) == -1) goto tracer_error;
|
||||||
|
for (l = 0; l < len; l++) {
|
||||||
|
if (fullread(s, &v, sizeof(int)) == -1) goto tracer_error;
|
||||||
|
if (v < 0 || v >= number_of_events) goto tracer_error;
|
||||||
|
t_is_on[v] = 1 - t_is_on[v];
|
||||||
|
set_is_on(is_on, v, t_is_on[v]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
is_on_changed = 1;
|
||||||
|
if (fullread(s, &len, sizeof(int)) == -1) goto tracer_error;
|
||||||
|
if (len < 0 || len > number_of_events) goto tracer_error;
|
||||||
|
for (l = 0; l < len; l++) {
|
||||||
|
if (fullread(s, &v, sizeof(int)) == -1) goto tracer_error;
|
||||||
|
if (v < 0 || v > 1) goto tracer_error;
|
||||||
|
if (t_is_on[l] != v) set_is_on(is_on, l, v);
|
||||||
|
t_is_on[l] = v;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: break;
|
||||||
|
default: printf("error: unhandled message type %d\n", t); //abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
tracer_error:
|
||||||
|
printf("remove tracer %d\n", m.ti[j].id);
|
||||||
|
for (l = 0; l < number_of_events; l++)
|
||||||
|
if (m.ti[j].is_on[l]) { is_on_changed = 1; set_is_on(is_on, l, 0); }
|
||||||
|
remove_tracer(&m, j);
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
if (is_on_changed && s != -1)
|
||||||
|
if (send_is_on(s, number_of_events, is_on) == -1) {
|
||||||
|
clear_remote_config();
|
||||||
|
shutdown(s, SHUT_RDWR);
|
||||||
|
close(s);
|
||||||
|
s = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -12,7 +12,14 @@
|
|||||||
#include "logger/logger.h"
|
#include "logger/logger.h"
|
||||||
#include "view/view.h"
|
#include "view/view.h"
|
||||||
|
|
||||||
|
enum var_type {
|
||||||
|
DEFAULT,
|
||||||
|
VCD_FUNCTION,
|
||||||
|
VCD_VARIABLE
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
enum var_type type;
|
||||||
char *event;
|
char *event;
|
||||||
char *arg;
|
char *arg;
|
||||||
char *vcd_name;
|
char *vcd_name;
|
||||||
@@ -44,16 +51,39 @@ void vcd_write_header(vcd_vars *v, int n)
|
|||||||
"$version\n"
|
"$version\n"
|
||||||
" to_vcd\n"
|
" to_vcd\n"
|
||||||
"$end\n"
|
"$end\n"
|
||||||
"$timescale 1ns $end\n"
|
"$timescale 1ns $end\n") <= 0) abort();
|
||||||
|
|
||||||
|
if (fprintf(out,
|
||||||
"$scope module logic $end\n") <= 0) abort();
|
"$scope module logic $end\n") <= 0) abort();
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
if (v[i].type == DEFAULT)
|
||||||
|
if (fprintf(out, "$var wire %d %s %s $end\n",
|
||||||
|
v[i].boolean ? 1 : 64,
|
||||||
|
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
|
||||||
|
if (fprintf(out,
|
||||||
|
"$upscope $end\n") <= 0) abort();
|
||||||
|
|
||||||
|
if (fprintf(out,
|
||||||
|
"$scope module functions $end\n") <= 0) abort();
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
if (v[i].type == VCD_FUNCTION)
|
||||||
|
if (fprintf(out, "$var wire %d %s %s $end\n",
|
||||||
|
v[i].boolean ? 1 : 64,
|
||||||
|
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
|
||||||
|
if (fprintf(out,
|
||||||
|
"$upscope $end\n") <= 0) abort();
|
||||||
|
|
||||||
|
if (fprintf(out,
|
||||||
|
"$scope module variables $end\n") <= 0) abort();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
if (fprintf(out, "$var wire %d %s %s $end\n",
|
if (v[i].type == VCD_VARIABLE)
|
||||||
v[i].boolean ? 1 : 64,
|
if (fprintf(out, "$var wire %d %s %s $end\n",
|
||||||
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
|
v[i].boolean ? 1 : 64,
|
||||||
|
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
|
||||||
|
if (fprintf(out,
|
||||||
|
"$upscope $end\n") <= 0) abort();
|
||||||
|
|
||||||
if (fprintf(out,
|
if (fprintf(out,
|
||||||
"$upscope $end\n"
|
|
||||||
"$enddefinitions $end\n"
|
"$enddefinitions $end\n"
|
||||||
"$dumpvars\n") <= 0) abort();
|
"$dumpvars\n") <= 0) abort();
|
||||||
|
|
||||||
@@ -174,7 +204,8 @@ void usage(void)
|
|||||||
" -ip <host> connect to given IP address (default %s)\n"
|
" -ip <host> connect to given IP address (default %s)\n"
|
||||||
" -p <port> connect to given port (default %d)\n"
|
" -p <port> connect to given port (default %d)\n"
|
||||||
" -b <event> <arg> <vcd name> trace as binary (0 off, anything else on)\n"
|
" -b <event> <arg> <vcd name> trace as binary (0 off, anything else on)\n"
|
||||||
" -l <event> <arg> <vcd name> trace as uint64_t\n",
|
" -l <event> <arg> <vcd name> trace as uint64_t\n"
|
||||||
|
" -vcd trace all VCD variables and functions\n",
|
||||||
DEFAULT_REMOTE_IP,
|
DEFAULT_REMOTE_IP,
|
||||||
DEFAULT_REMOTE_PORT
|
DEFAULT_REMOTE_PORT
|
||||||
);
|
);
|
||||||
@@ -192,6 +223,21 @@ void force_stop(int x)
|
|||||||
run = 0;
|
run = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vcd_vars *add_var(vcd_vars *vars, int nvars,
|
||||||
|
char *event, char *arg, char *vcd_name, int is_boolean, enum var_type t)
|
||||||
|
{
|
||||||
|
if (nvars % 64 == 0) {
|
||||||
|
vars = realloc(vars, (nvars+64) * sizeof(vcd_vars));
|
||||||
|
if (vars == NULL) abort();
|
||||||
|
}
|
||||||
|
vars[nvars].type = t;
|
||||||
|
vars[nvars].event = event;
|
||||||
|
vars[nvars].arg = arg;
|
||||||
|
vars[nvars].vcd_name = vcd_name;
|
||||||
|
vars[nvars].boolean = is_boolean;
|
||||||
|
return vars;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int n, char **v)
|
int main(int n, char **v)
|
||||||
{
|
{
|
||||||
char *output_filename = NULL;
|
char *output_filename = NULL;
|
||||||
@@ -202,11 +248,12 @@ int main(int n, char **v)
|
|||||||
int *is_on;
|
int *is_on;
|
||||||
int number_of_events;
|
int number_of_events;
|
||||||
int i;
|
int i;
|
||||||
vcd_vars vars[n];
|
vcd_vars *vars = NULL;
|
||||||
int nvars = 0;
|
int nvars = 0;
|
||||||
view *vcd_view;
|
view *vcd_view;
|
||||||
event_handler *h;
|
event_handler *h;
|
||||||
logger *textlog;
|
logger *textlog;
|
||||||
|
int all_vcd = 0;
|
||||||
|
|
||||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||||
@@ -221,19 +268,22 @@ int main(int n, char **v)
|
|||||||
if (!strcmp(v[i], "-p"))
|
if (!strcmp(v[i], "-p"))
|
||||||
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
|
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
|
||||||
if (!strcmp(v[i], "-b")) { if(i>n-4)usage();
|
if (!strcmp(v[i], "-b")) { if(i>n-4)usage();
|
||||||
vars[nvars].event = v[++i];
|
char *event = v[++i];
|
||||||
vars[nvars].arg = v[++i];
|
char *arg = v[++i];
|
||||||
vars[nvars].vcd_name = v[++i];
|
char *vcd_name = v[++i];
|
||||||
vars[nvars++].boolean = 1;
|
vars = add_var(vars, nvars, event, arg, vcd_name, 1, DEFAULT);
|
||||||
|
nvars++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(v[i], "-l")) { if(i>n-4)usage();
|
if (!strcmp(v[i], "-l")) { if(i>n-4)usage();
|
||||||
vars[nvars].event = v[++i];
|
char *event = v[++i];
|
||||||
vars[nvars].arg = v[++i];
|
char *arg = v[++i];
|
||||||
vars[nvars].vcd_name = v[++i];
|
char *vcd_name = v[++i];
|
||||||
vars[nvars++].boolean = 0;
|
vars = add_var(vars, nvars, event, arg, vcd_name, 0, DEFAULT);
|
||||||
|
nvars++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(v[i], "-vcd")) { all_vcd = 1; continue; }
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,11 +310,42 @@ int main(int n, char **v)
|
|||||||
/* create the view */
|
/* create the view */
|
||||||
vcd_view = new_view_vcd();
|
vcd_view = new_view_vcd();
|
||||||
|
|
||||||
|
if (all_vcd) {
|
||||||
|
/* activate all VCD traces */
|
||||||
|
for (i = 0; i < number_of_events; i++) {
|
||||||
|
int is_boolean;
|
||||||
|
enum var_type type;
|
||||||
|
int prefix_length;
|
||||||
|
char *name = event_name_from_id(database, i);
|
||||||
|
char *vcd_name;
|
||||||
|
char *var_prefix = "VCD_VARIABLE_";
|
||||||
|
char *fun_prefix = "VCD_FUNCTION_";
|
||||||
|
if (!strncmp(name, var_prefix, strlen(var_prefix))) {
|
||||||
|
prefix_length = strlen(var_prefix);
|
||||||
|
is_boolean = 0;
|
||||||
|
type = VCD_VARIABLE;
|
||||||
|
} else if (!strncmp(name, fun_prefix, strlen(fun_prefix))) {
|
||||||
|
prefix_length = strlen(fun_prefix);
|
||||||
|
is_boolean = 1;
|
||||||
|
type = VCD_FUNCTION;
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
|
vcd_name = event_vcd_name_from_id(database, i);
|
||||||
|
if (vcd_name == NULL) {
|
||||||
|
vcd_name = name+prefix_length;
|
||||||
|
printf("WARNING: ID %s does not define VCD_NAME in the file %s, using %s\n",
|
||||||
|
name, database_filename, vcd_name);
|
||||||
|
}
|
||||||
|
vars = add_var(vars, nvars,
|
||||||
|
name, "value", vcd_name, is_boolean, type);
|
||||||
|
nvars++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* setup traces */
|
/* setup traces */
|
||||||
for (i = 0; i < nvars; i++) {
|
for (i = 0; i < nvars; i++) {
|
||||||
char format[256];
|
char format[256];
|
||||||
if (strlen(vars[i].arg) > 256-3) abort();
|
if (strlen(vars[i].arg) + strlen(vars[i].vcd_name) > 256-16) abort();
|
||||||
if (strlen(vars[i].vcd_name) > 256-1) abort();
|
|
||||||
sprintf(format, "%c [%s] %s",
|
sprintf(format, "%c [%s] %s",
|
||||||
vars[i].boolean ? 'b' : 'l',
|
vars[i].boolean ? 'b' : 'l',
|
||||||
vars[i].arg,
|
vars[i].arg,
|
||||||
|
|||||||
@@ -857,6 +857,7 @@ int main(int n, char **v)
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
clear_remote_config();
|
clear_remote_config();
|
||||||
|
if (ue_data.socket != -1) close(ue_data.socket);
|
||||||
ue_data.socket = connect_to(ip, port);
|
ue_data.socket = connect_to(ip, port);
|
||||||
|
|
||||||
/* send the first message - activate selected traces */
|
/* send the first message - activate selected traces */
|
||||||
|
|||||||
@@ -79,6 +79,36 @@ list *list_append(list *l, void *data)
|
|||||||
/* socket */
|
/* socket */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int create_listen_socket(char *addr, int port)
|
||||||
|
{
|
||||||
|
struct sockaddr_in a;
|
||||||
|
int s;
|
||||||
|
int v;
|
||||||
|
|
||||||
|
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (s == -1) { perror("socket"); exit(1); }
|
||||||
|
v = 1;
|
||||||
|
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int)))
|
||||||
|
{ perror("setsockopt"); exit(1); }
|
||||||
|
|
||||||
|
a.sin_family = AF_INET;
|
||||||
|
a.sin_port = htons(port);
|
||||||
|
a.sin_addr.s_addr = inet_addr(addr);
|
||||||
|
|
||||||
|
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
|
||||||
|
if (listen(s, 5)) { perror("listen"); exit(1); }
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int socket_accept(int s)
|
||||||
|
{
|
||||||
|
struct sockaddr_in a;
|
||||||
|
socklen_t alen;
|
||||||
|
alen = sizeof(a);
|
||||||
|
return accept(s, (struct sockaddr *)&a, &alen);
|
||||||
|
}
|
||||||
|
|
||||||
int socket_send(int socket, void *buffer, int size)
|
int socket_send(int socket, void *buffer, int size)
|
||||||
{
|
{
|
||||||
char *x = buffer;
|
char *x = buffer;
|
||||||
@@ -94,26 +124,13 @@ int socket_send(int socket, void *buffer, int size)
|
|||||||
|
|
||||||
int get_connection(char *addr, int port)
|
int get_connection(char *addr, int port)
|
||||||
{
|
{
|
||||||
struct sockaddr_in a;
|
|
||||||
socklen_t alen;
|
|
||||||
int s, t;
|
int s, t;
|
||||||
|
|
||||||
printf("waiting for connection on %s:%d\n", addr, port);
|
printf("waiting for connection on %s:%d\n", addr, port);
|
||||||
|
|
||||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
s = create_listen_socket(addr, port);
|
||||||
if (s == -1) { perror("socket"); exit(1); }
|
|
||||||
t = 1;
|
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)))
|
|
||||||
{ perror("setsockopt"); exit(1); }
|
|
||||||
|
|
||||||
a.sin_family = AF_INET;
|
t = socket_accept(s);
|
||||||
a.sin_port = htons(port);
|
|
||||||
a.sin_addr.s_addr = inet_addr(addr);
|
|
||||||
|
|
||||||
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
|
|
||||||
if (listen(s, 5)) { perror("bind"); exit(1); }
|
|
||||||
alen = sizeof(a);
|
|
||||||
t = accept(s, (struct sockaddr *)&a, &alen);
|
|
||||||
if (t == -1) { perror("accept"); exit(1); }
|
if (t == -1) { perror("accept"); exit(1); }
|
||||||
close(s);
|
close(s);
|
||||||
|
|
||||||
@@ -137,14 +154,11 @@ int fullread(int fd, void *_buf, int count)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int connect_to(char *addr, int port)
|
int try_connect_to(char *addr, int port)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_in a;
|
struct sockaddr_in a;
|
||||||
|
|
||||||
printf("connecting to %s:%d\n", addr, port);
|
|
||||||
|
|
||||||
again:
|
|
||||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (s == -1) { perror("socket"); exit(1); }
|
if (s == -1) { perror("socket"); exit(1); }
|
||||||
|
|
||||||
@@ -155,6 +169,21 @@ again:
|
|||||||
if (connect(s, (struct sockaddr *)&a, sizeof(a)) == -1) {
|
if (connect(s, (struct sockaddr *)&a, sizeof(a)) == -1) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
close(s);
|
close(s);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int connect_to(char *addr, int port)
|
||||||
|
{
|
||||||
|
int s;
|
||||||
|
|
||||||
|
printf("connecting to %s:%d\n", addr, port);
|
||||||
|
|
||||||
|
again:
|
||||||
|
s = try_connect_to(addr, port);
|
||||||
|
if (s == -1) {
|
||||||
printf("trying again in 1s\n");
|
printf("trying again in 1s\n");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
goto again;
|
goto again;
|
||||||
|
|||||||
@@ -24,11 +24,14 @@ list *list_append(list *l, void *data);
|
|||||||
#define DEFAULT_REMOTE_IP "127.0.0.1"
|
#define DEFAULT_REMOTE_IP "127.0.0.1"
|
||||||
#define DEFAULT_REMOTE_PORT 2021
|
#define DEFAULT_REMOTE_PORT 2021
|
||||||
|
|
||||||
|
int create_listen_socket(char *addr, int port);
|
||||||
|
int socket_accept(int s);
|
||||||
/* socket_send: return 0 if okay, -1 on error */
|
/* socket_send: return 0 if okay, -1 on error */
|
||||||
int socket_send(int socket, void *buffer, int size);
|
int socket_send(int socket, void *buffer, int size);
|
||||||
int get_connection(char *addr, int port);
|
int get_connection(char *addr, int port);
|
||||||
/* fullread: return length read if okay (that is: 'count'), -1 on error */
|
/* fullread: return length read if okay (that is: 'count'), -1 on error */
|
||||||
int fullread(int fd, void *_buf, int count);
|
int fullread(int fd, void *_buf, int count);
|
||||||
|
int try_connect_to(char *addr, int port);
|
||||||
int connect_to(char *addr, int port);
|
int connect_to(char *addr, int port);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ void output_log_mem(void);
|
|||||||
#define _Assert_Exit_ \
|
#define _Assert_Exit_ \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, "\nExiting execution\n"); \
|
fprintf(stderr, "\nExiting execution\n"); \
|
||||||
output_log_mem(); \
|
|
||||||
display_backtrace(); \
|
display_backtrace(); \
|
||||||
fflush(stdout); \
|
fflush(stdout); \
|
||||||
fflush(stderr); \
|
fflush(stderr); \
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ void itti_exit_task(void)
|
|||||||
|
|
||||||
#if defined(OAI_EMU) || defined(RTAI)
|
#if defined(OAI_EMU) || defined(RTAI)
|
||||||
if (task_id > TASK_UNKNOWN) {
|
if (task_id > TASK_UNKNOWN) {
|
||||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
|
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_ITTI_RECV_MSG,
|
||||||
__sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
|
__sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -117,19 +117,16 @@ int signal_handle(int *end)
|
|||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
SIG_DEBUG("Received SIGUSR1\n");
|
SIG_DEBUG("Received SIGUSR1\n");
|
||||||
*end = 1;
|
*end = 1;
|
||||||
output_log_mem();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGSEGV: /* Fall through */
|
case SIGSEGV: /* Fall through */
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
SIG_DEBUG("Received SIGABORT\n");
|
SIG_DEBUG("Received SIGABORT\n");
|
||||||
output_log_mem();
|
|
||||||
backtrace_handle_signal(&info);
|
backtrace_handle_signal(&info);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
printf("Received SIGINT\n");
|
printf("Received SIGINT\n");
|
||||||
output_log_mem();
|
|
||||||
itti_send_terminate_message(TASK_UNKNOWN);
|
itti_send_terminate_message(TASK_UNKNOWN);
|
||||||
*end = 1;
|
*end = 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#ifdef TELNETSRV_LOADER_MAIN
|
#ifdef TELNETSRV_LOADER_MAIN
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
|
||||||
|
|
||||||
#include "common/utils/load_module_shlib.h"
|
#include "common/utils/load_module_shlib.h"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#ifdef TELNETSRV_PHYCMD_MAIN
|
#ifdef TELNETSRV_PHYCMD_MAIN
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
|
||||||
|
|
||||||
#include "openair1/PHY/phy_extern.h"
|
#include "openair1/PHY/phy_extern.h"
|
||||||
|
|||||||
@@ -52,8 +52,7 @@
|
|||||||
#define TELNETSERVERCODE
|
#define TELNETSERVERCODE
|
||||||
#include "telnetsrv.h"
|
#include "telnetsrv.h"
|
||||||
#define TELNETSRV_PROCCMD_MAIN
|
#define TELNETSRV_PROCCMD_MAIN
|
||||||
#include "log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "log_extern.h"
|
|
||||||
#include "common/config/config_userapi.h"
|
#include "common/config/config_userapi.h"
|
||||||
#include "openair1/PHY/phy_extern.h"
|
#include "openair1/PHY/phy_extern.h"
|
||||||
#include "telnetsrv_proccmd.h"
|
#include "telnetsrv_proccmd.h"
|
||||||
@@ -200,16 +199,30 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
|
|||||||
print_threads(buf,debug,prnt);
|
print_threads(buf,debug,prnt);
|
||||||
}
|
}
|
||||||
if (strcasestr(buf,"loglvl") != NULL) {
|
if (strcasestr(buf,"loglvl") != NULL) {
|
||||||
prnt("component verbosity level enabled\n");
|
prnt(" component level enabled\n");
|
||||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||||
if (g_log->log_component[i].name != NULL) {
|
if (g_log->log_component[i].name != NULL) {
|
||||||
prnt("%02i %17.17s:%10.10s%10.10s %s\n",i ,g_log->log_component[i].name,
|
prnt("%02i %17.17s:%10.10s %s\n",i ,g_log->log_component[i].name,
|
||||||
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
|
|
||||||
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
||||||
((g_log->log_component[i].interval>0)?"Y":"N") );
|
((g_log->log_component[i].interval>0)?"Y":"N") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (strcasestr(buf,"logopt") != NULL) {
|
||||||
|
prnt(" option enabled\n");
|
||||||
|
for (int i=0; log_options[i].name != NULL; i++) {
|
||||||
|
prnt("%02i %17.17s %10.10s \n",i ,log_options[i].name,
|
||||||
|
((g_log->flag & log_options[i].value)?"Y":"N") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (strcasestr(buf,"dbgopt") != NULL) {
|
||||||
|
prnt(" option debug matlab\n");
|
||||||
|
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
||||||
|
prnt("%02i %17.17s %5.5s %5.5s\n",i ,log_maskmap[i].name,
|
||||||
|
((g_log->debug_mask & log_maskmap[i].value)?"Y":"N"),
|
||||||
|
((g_log->matlab_mask & log_maskmap[i].value)?"Y":"N") );
|
||||||
|
}
|
||||||
|
}
|
||||||
if (strcasestr(buf,"config") != NULL) {
|
if (strcasestr(buf,"config") != NULL) {
|
||||||
prnt("Command line arguments:\n");
|
prnt("Command line arguments:\n");
|
||||||
for (int i=0; i < config_get_if()->argc; i++) {
|
for (int i=0; i < config_get_if()->argc; i++) {
|
||||||
@@ -324,24 +337,76 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
|
|||||||
prnt("Available log levels: \n ");
|
prnt("Available log levels: \n ");
|
||||||
for (int i=0; log_level_names[i].name != NULL; i++)
|
for (int i=0; log_level_names[i].name != NULL; i++)
|
||||||
prnt("%s ",log_level_names[i].name);
|
prnt("%s ",log_level_names[i].name);
|
||||||
prnt("\nAvailable verbosity: \n ");
|
prnt("\n");
|
||||||
for (int i=0; log_verbosity_names[i].name != NULL; i++)
|
prnt("Available display options: \n ");
|
||||||
prnt("%s ",log_verbosity_names[i].name);
|
for (int i=0; log_options[i].name != NULL; i++)
|
||||||
|
prnt("%s ",log_options[i].name);
|
||||||
|
prnt("\n");
|
||||||
|
prnt("Available debug or matlab options: \n ");
|
||||||
|
for (int i=0; log_maskmap[i].name != NULL; i++)
|
||||||
|
prnt("%s ",log_maskmap[i].name);
|
||||||
prnt("\n");
|
prnt("\n");
|
||||||
proccmd_show("loglvl",debug,prnt);
|
proccmd_show("loglvl",debug,prnt);
|
||||||
|
proccmd_show("logopt",debug,prnt);
|
||||||
|
proccmd_show("dbgopt",debug,prnt);
|
||||||
}
|
}
|
||||||
else if (strcasestr(logsubcmd,"help") != NULL) {
|
else if (strcasestr(logsubcmd,"help") != NULL) {
|
||||||
prnt(PROCCMD_LOG_HELP_STRING);
|
prnt(PROCCMD_LOG_HELP_STRING);
|
||||||
} else {
|
} else {
|
||||||
prnt("%s: wrong log command...\n",logsubcmd);
|
prnt("%s: wrong log command...\n",logsubcmd);
|
||||||
}
|
}
|
||||||
|
} else if ( s == 2 && logsubcmd != NULL) {
|
||||||
|
char *opt=NULL;
|
||||||
|
char *logparam=NULL;
|
||||||
|
int l;
|
||||||
|
int optbit;
|
||||||
|
|
||||||
|
l=sscanf(logsubcmd,"%m[^'_']_%ms",&logparam,&opt);
|
||||||
|
if (l == 2 && strcmp(logparam,"print") == 0){
|
||||||
|
optbit=map_str_to_int(log_options,opt);
|
||||||
|
if (optbit < 0) {
|
||||||
|
prnt("option %s unknown\n",opt);
|
||||||
|
} else {
|
||||||
|
if (idx1 > 0)
|
||||||
|
SET_LOG_OPTION(optbit);
|
||||||
|
else
|
||||||
|
CLEAR_LOG_OPTION(optbit);
|
||||||
|
proccmd_show("logopt",debug,prnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (l == 2 && strcmp(logparam,"debug") == 0){
|
||||||
|
optbit=map_str_to_int(log_maskmap,opt);
|
||||||
|
if (optbit < 0) {
|
||||||
|
prnt("debug flag %s unknown\n",opt);
|
||||||
|
} else {
|
||||||
|
if (idx1 > 0)
|
||||||
|
SET_LOG_DEBUG(optbit);
|
||||||
|
else
|
||||||
|
CLEAR_LOG_DEBUG(optbit);
|
||||||
|
proccmd_show("dbgopt",debug,prnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (l == 2 && strcmp(logparam,"matlab") == 0){
|
||||||
|
optbit=map_str_to_int(log_maskmap,opt);
|
||||||
|
if (optbit < 0) {
|
||||||
|
prnt("matlab flag %s unknown\n",opt);
|
||||||
|
} else {
|
||||||
|
if (idx1 > 0)
|
||||||
|
SET_LOG_MATLAB(optbit);
|
||||||
|
else
|
||||||
|
CLEAR_LOG_MATLAB(optbit);
|
||||||
|
proccmd_show("dbgopt",debug,prnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (logparam != NULL) free(logparam);
|
||||||
|
if (opt != NULL) free(opt);
|
||||||
} else if ( s == 3 && logsubcmd != NULL) {
|
} else if ( s == 3 && logsubcmd != NULL) {
|
||||||
int level, verbosity, interval;
|
int level, interval;
|
||||||
char *tmpstr=NULL;
|
char *tmpstr=NULL;
|
||||||
char *logparam=NULL;
|
char *logparam=NULL;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
level = verbosity = interval = -1;
|
level = interval = -1;
|
||||||
l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
|
l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
|
||||||
if (debug > 0)
|
if (debug > 0)
|
||||||
prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
|
prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
|
||||||
@@ -349,9 +414,6 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
|
|||||||
if (strcmp(logparam,"level") == 0) {
|
if (strcmp(logparam,"level") == 0) {
|
||||||
level=map_str_to_int(log_level_names,tmpstr);
|
level=map_str_to_int(log_level_names,tmpstr);
|
||||||
if (level < 0) prnt("level %s unknown\n",tmpstr);
|
if (level < 0) prnt("level %s unknown\n",tmpstr);
|
||||||
} else if (strcmp(logparam,"verbos") == 0) {
|
|
||||||
verbosity=map_str_to_int(log_verbosity_names,tmpstr);
|
|
||||||
if (verbosity < 0) prnt("verbosity %s unknown\n",tmpstr);
|
|
||||||
} else {
|
} else {
|
||||||
prnt("%s%s unknown log sub command \n",logparam, tmpstr);
|
prnt("%s%s unknown log sub command \n",logparam, tmpstr);
|
||||||
}
|
}
|
||||||
@@ -372,17 +434,13 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
|
|||||||
if (level < 0) {
|
if (level < 0) {
|
||||||
level=g_log->log_component[i].level;
|
level=g_log->log_component[i].level;
|
||||||
}
|
}
|
||||||
if (verbosity < 0) {
|
|
||||||
verbosity=g_log->log_component[i].flag;
|
|
||||||
}
|
|
||||||
if (interval < 0) {
|
if (interval < 0) {
|
||||||
interval=g_log->log_component[i].interval;
|
interval=g_log->log_component[i].interval;
|
||||||
}
|
}
|
||||||
set_comp_log(i, level, verbosity, interval);
|
set_log(i, level, interval);
|
||||||
prnt("log level/verbosity comp %i %s set to %s / %s (%s)\n",
|
prnt("log level comp %i %s set to %s (%s)\n",
|
||||||
i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
|
i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
|
||||||
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
map_int_to_str(log_level_names,g_log->log_component[i].level),
|
||||||
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
|
|
||||||
((g_log->log_component[i].interval>0)?"enabled":"disabled"));
|
((g_log->log_component[i].interval>0)?"enabled":"disabled"));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,12 @@ telnetshell_vardef_t proc_vardef[] = {
|
|||||||
online, noonline: enable or disable console logs \n\
|
online, noonline: enable or disable console logs \n\
|
||||||
enable, disable id1-id2: enable or disable logs for components index id1 to id2 \n\
|
enable, disable id1-id2: enable or disable logs for components index id1 to id2 \n\
|
||||||
level_<level> id1-id2: set log level to <level> for components index id1 to id2 \n\
|
level_<level> id1-id2: set log level to <level> for components index id1 to id2 \n\
|
||||||
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2 \n\
|
use the show command to get the authorized values for <level> and the list of component \
|
||||||
use the show command to get the values for <level>, <verbosity> and the list of component indexes \
|
indexes that can be used for id1 and id2 \n\
|
||||||
that can be used for id1 and id2 \n"
|
print_<opt> <0|1> disable or enable the \"opt\" log option, use the show command to get \
|
||||||
|
the available options\n\
|
||||||
|
matlab_<opt> debug_<func> disable or enable the debug code or matlab file generation \
|
||||||
|
for \"func\" function. use the show command to get the available options\n"
|
||||||
|
|
||||||
#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
|
#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
|
||||||
<thread id> aff <core> : set affinity of thread <thread id> to core <core> \n\
|
<thread id> aff <core> : set affinity of thread <thread id> to core <core> \n\
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ extern RAN_CONTEXT_t RC;
|
|||||||
#include <vendor_ext.h>
|
#include <vendor_ext.h>
|
||||||
#include "fapi_stub.h"
|
#include "fapi_stub.h"
|
||||||
//#include "fapi_l1.h"
|
//#include "fapi_l1.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||||
|
|
||||||
#include "PHY/INIT/phy_init.h"
|
#include "PHY/INIT/phy_init.h"
|
||||||
@@ -193,26 +193,25 @@ typedef struct {
|
|||||||
static pnf_info pnf;
|
static pnf_info pnf;
|
||||||
static pthread_t pnf_start_pthread;
|
static pthread_t pnf_start_pthread;
|
||||||
|
|
||||||
extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
|
int nfapitooai_level(int nfapi_level) {
|
||||||
|
switch(nfapi_level) {
|
||||||
|
case NFAPI_TRACE_ERROR:
|
||||||
|
return LOG_ERR;
|
||||||
|
case NFAPI_TRACE_WARN:
|
||||||
|
return LOG_WARNING;
|
||||||
|
case NFAPI_TRACE_NOTE:
|
||||||
|
return LOG_INFO;
|
||||||
|
case NFAPI_TRACE_INFO:
|
||||||
|
return LOG_DEBUG;
|
||||||
|
}
|
||||||
|
return LOG_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
|
void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
int oai_level;
|
|
||||||
|
|
||||||
if (nfapi_level==NFAPI_TRACE_ERROR) {
|
|
||||||
oai_level = LOG_ERR;
|
|
||||||
} else if (nfapi_level==NFAPI_TRACE_WARN) {
|
|
||||||
oai_level = LOG_WARNING;
|
|
||||||
} else if (nfapi_level==NFAPI_TRACE_NOTE) {
|
|
||||||
oai_level = LOG_INFO;
|
|
||||||
} else if (nfapi_level==NFAPI_TRACE_INFO) {
|
|
||||||
oai_level = LOG_DEBUG;
|
|
||||||
} else {
|
|
||||||
oai_level = LOG_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
|
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -680,36 +680,13 @@ void vnf_deallocate(void* ptr) {
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
|
|
||||||
|
|
||||||
void vnf_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
|
void vnf_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
int oai_level;
|
|
||||||
|
|
||||||
if (nfapi_level==NFAPI_TRACE_ERROR)
|
|
||||||
{
|
|
||||||
oai_level = LOG_ERR;
|
|
||||||
}
|
|
||||||
else if (nfapi_level==NFAPI_TRACE_WARN)
|
|
||||||
{
|
|
||||||
oai_level = LOG_WARNING;
|
|
||||||
}
|
|
||||||
else if (nfapi_level==NFAPI_TRACE_NOTE)
|
|
||||||
{
|
|
||||||
oai_level = LOG_INFO;
|
|
||||||
}
|
|
||||||
else if (nfapi_level==NFAPI_TRACE_INFO)
|
|
||||||
{
|
|
||||||
oai_level = LOG_INFO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oai_level = LOG_INFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
|
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ extern "C" {
|
|||||||
// todo : move to public_inc so can be used by vendor extensions
|
// todo : move to public_inc so can be used by vendor extensions
|
||||||
|
|
||||||
#define MAX_BAD_TAG 3
|
#define MAX_BAD_TAG 3
|
||||||
|
int nfapitooai_level(int nfapilevel);
|
||||||
uint8_t push8(uint8_t in, uint8_t **out, uint8_t *end);
|
uint8_t push8(uint8_t in, uint8_t **out, uint8_t *end);
|
||||||
uint8_t pushs8(int8_t in, uint8_t **out, uint8_t *end);
|
uint8_t pushs8(int8_t in, uint8_t **out, uint8_t *end);
|
||||||
uint8_t push16(uint16_t in, uint8_t **out, uint8_t *end);
|
uint8_t push16(uint16_t in, uint8_t **out, uint8_t *end);
|
||||||
|
|||||||
@@ -67,15 +67,12 @@ void generate_qpsk_table(void)
|
|||||||
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
||||||
{
|
{
|
||||||
|
|
||||||
ccodedot11_init();
|
|
||||||
ccodedot11_init_inv();
|
|
||||||
|
|
||||||
ccodelte_init();
|
ccodelte_init();
|
||||||
ccodelte_init_inv();
|
ccodelte_init_inv();
|
||||||
|
|
||||||
|
init_dfts();
|
||||||
|
|
||||||
|
|
||||||
phy_generate_viterbi_tables();
|
|
||||||
phy_generate_viterbi_tables_lte();
|
phy_generate_viterbi_tables_lte();
|
||||||
|
|
||||||
load_codinglib();
|
load_codinglib();
|
||||||
@@ -86,6 +83,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
|||||||
|
|
||||||
generate_64qam_table();
|
generate_64qam_table();
|
||||||
generate_16qam_table();
|
generate_16qam_table();
|
||||||
|
generate_qpsk_table();
|
||||||
generate_RIV_tables();
|
generate_RIV_tables();
|
||||||
|
|
||||||
init_unscrambling_lut();
|
init_unscrambling_lut();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "RadioResourceConfigDedicated.h"
|
#include "RadioResourceConfigDedicated.h"
|
||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
|||||||
|
|
||||||
if (mbsfn_Area_idx == 0) {
|
if (mbsfn_Area_idx == 0) {
|
||||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
||||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
LOG_I(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
lte_gold_mbsfn(fp,RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
lte_gold_mbsfn(fp,RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "RadioResourceConfigDedicated.h"
|
#include "RadioResourceConfigDedicated.h"
|
||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "RadioResourceConfigDedicated.h"
|
#include "RadioResourceConfigDedicated.h"
|
||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||||
@@ -190,7 +190,7 @@ void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_A
|
|||||||
|
|
||||||
if (mbsfn_Area_idx == 0) {
|
if (mbsfn_Area_idx == 0) {
|
||||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
||||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
LOG_I(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "LAYER2/MAC/mac_extern.h"
|
#include "LAYER2/MAC/mac_extern.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "RadioResourceConfigDedicated.h"
|
#include "RadioResourceConfigDedicated.h"
|
||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
#include "phy_init.h"
|
#include "phy_init.h"
|
||||||
#include "SCHED_UE/sched_UE.h"
|
#include "SCHED_UE/sched_UE.h"
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "SIMULATION/TOOLS/sim.h"
|
//#include "SIMULATION/TOOLS/sim.h"
|
||||||
#include "RadioResourceConfigCommonSIB.h"
|
#include "RadioResourceConfigCommonSIB.h"
|
||||||
#include "RadioResourceConfigDedicated.h"
|
#include "RadioResourceConfigDedicated.h"
|
||||||
#include "TDD-Config.h"
|
#include "TDD-Config.h"
|
||||||
#include "MBSFN-SubframeConfigList.h"
|
#include "MBSFN-SubframeConfigList.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||||
|
|||||||
@@ -383,6 +383,8 @@ void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
|||||||
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
|
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
|
||||||
int l1_north_init_gNB(void);
|
int l1_north_init_gNB(void);
|
||||||
|
|
||||||
|
void init_dfts(void);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "PHY/phy_extern_ue.h"
|
#include "PHY/phy_extern_ue.h"
|
||||||
#include "lte_estimation.h"
|
#include "lte_estimation.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||||
|
|
||||||
#define DEBUG_PHY
|
#define DEBUG_PHY
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "PHY/defs_eNB.h"
|
#include "PHY/defs_eNB.h"
|
||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#define DEBUG_PHY
|
#define DEBUG_PHY
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "PHY/impl_defs_top.h"
|
#include "PHY/impl_defs_top.h"
|
||||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#define DEBUG_PHY
|
#define DEBUG_PHY
|
||||||
|
|
||||||
|
|||||||
@@ -274,11 +274,11 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_PHY
|
LOG_M_BEGIN(DEBUG_LTEESTIM);
|
||||||
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
||||||
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
||||||
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
||||||
#endif
|
LOG_M_END
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,10 +330,6 @@ static inline int abs32(int x)
|
|||||||
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
|
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PHY
|
|
||||||
int debug_cnt=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SHIFT 17
|
#define SHIFT 17
|
||||||
|
|
||||||
int lte_sync_time(int **rxdata, ///rx data in time domain
|
int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||||
@@ -464,7 +460,8 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
|||||||
LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
|
LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_PHY
|
LOG_M_BEGIN(DEBUG_LTEESTIM)
|
||||||
|
static int debug_cnt;
|
||||||
if (debug_cnt == 0) {
|
if (debug_cnt == 0) {
|
||||||
LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
||||||
LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
||||||
@@ -474,9 +471,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
|||||||
} else {
|
} else {
|
||||||
debug_cnt++;
|
debug_cnt++;
|
||||||
}
|
}
|
||||||
|
LOG_M_END
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
return(peak_pos);
|
return(peak_pos);
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
|||||||
|
|
||||||
//compute frequency-domain representation of 6144-sample chunk
|
//compute frequency-domain representation of 6144-sample chunk
|
||||||
dft6144((int16_t *)rxp,
|
dft6144((int16_t *)rxp,
|
||||||
sp,
|
sp,1);
|
||||||
1);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -23,9 +23,8 @@
|
|||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
//#define DEBUG_CH
|
//#define DEBUG_CH
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||||
#include "T.h"
|
|
||||||
#include "lte_estimation.h"
|
#include "lte_estimation.h"
|
||||||
|
|
||||||
// round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
|
// round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
#include "transport_common_proto.h"
|
#include "transport_common_proto.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_extern.h"
|
#include "PHY/LTE_TRANSPORT/transport_extern.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||||
#include "SCHED/sched_eNB.h"
|
#include "SCHED/sched_eNB.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include "targets/RT/USER/rt_wrapper.h"
|
#include "targets/RT/USER/rt_wrapper.h"
|
||||||
|
|
||||||
@@ -511,16 +511,15 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
proc->tep[i].total_worker = worker_num;
|
proc->tep[i].total_worker = worker_num;
|
||||||
proc->tep[i].current_worker = i;
|
proc->tep[i].current_worker = i;
|
||||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||||
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
||||||
exit_fun( "ERROR pthread_cond_signal" );
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||||
// outputs for each code segment, see Section 5.1.5 p.20
|
// outputs for each code segment, see Section 5.1.5 p.20
|
||||||
|
|
||||||
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||||
|
|
||||||
// get information for E for the segments that are handled by the worker thread
|
// get information for E for the segments that are handled by the worker thread
|
||||||
|
|||||||
@@ -35,11 +35,11 @@
|
|||||||
#include "PHY/CODING/coding_extern.h"
|
#include "PHY/CODING/coding_extern.h"
|
||||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||||
//#define DEBUG_DLSCH_MODULATION
|
//#define DEBUG_DLSCH_MODULATION
|
||||||
#define NEW_ALLOC_RE
|
//#define NEW_ALLOC_RE
|
||||||
|
|
||||||
//#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0)
|
//#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0)
|
||||||
|
|
||||||
@@ -706,6 +706,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
int *P2_SHIFT)
|
int *P2_SHIFT)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
uint8_t *x0 = NULL;
|
uint8_t *x0 = NULL;
|
||||||
MIMO_mode_t mimo_mode = -1;
|
MIMO_mode_t mimo_mode = -1;
|
||||||
|
|
||||||
@@ -2099,10 +2100,33 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
uint8_t mod_order0 = 0;
|
uint8_t mod_order0 = 0;
|
||||||
uint8_t mod_order1 = 0;
|
uint8_t mod_order1 = 0;
|
||||||
int16_t amp_rho_a, amp_rho_b;
|
int16_t amp_rho_a, amp_rho_b;
|
||||||
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];//qpsk_table_a0[2],qpsk_table_b0[2]
|
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8],qpsk_table_a0[2],qpsk_table_b0[2];
|
||||||
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];//qpsk_table_a1[2],qpsk_table_b1[2]
|
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8],qpsk_table_a1[2],qpsk_table_b1[2];
|
||||||
|
|
||||||
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
|
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
|
||||||
|
int (*allocate_REs)(PHY_VARS_eNB*,
|
||||||
|
int **,
|
||||||
|
uint32_t*,
|
||||||
|
uint32_t*,
|
||||||
|
uint16_t,
|
||||||
|
uint32_t,
|
||||||
|
LTE_DL_eNB_HARQ_t *,
|
||||||
|
LTE_DL_eNB_HARQ_t *,
|
||||||
|
uint8_t,
|
||||||
|
int16_t,
|
||||||
|
uint8_t,
|
||||||
|
int16_t *,
|
||||||
|
int16_t *,
|
||||||
|
uint32_t *,
|
||||||
|
uint8_t,
|
||||||
|
uint8_t,
|
||||||
|
uint8_t,
|
||||||
|
uint8_t,
|
||||||
|
uint8_t,
|
||||||
|
int *,
|
||||||
|
int *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int P1_SHIFT[13],P2_SHIFT[13];
|
int P1_SHIFT[13],P2_SHIFT[13];
|
||||||
int offset,nushiftmod3;
|
int offset,nushiftmod3;
|
||||||
@@ -2201,7 +2225,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
|
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if(mod_order0 == 2)
|
if(mod_order0 == 2)
|
||||||
{
|
{
|
||||||
for(i=0;i<2;i++)
|
for(i=0;i<2;i++)
|
||||||
{
|
{
|
||||||
@@ -2209,7 +2233,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else*/ if (mod_order0 == 4)
|
else if (mod_order0 == 4)
|
||||||
for (i=0;i<4; i++) {
|
for (i=0;i<4; i++) {
|
||||||
qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
||||||
qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
||||||
@@ -2220,14 +2244,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15);
|
qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (mod_order1 == 2)
|
if (mod_order1 == 2)
|
||||||
{
|
{
|
||||||
for (i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15);
|
qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15);
|
||||||
qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else*/ if (mod_order1 == 4)
|
else if (mod_order1 == 4)
|
||||||
for (i=0; i<4; i++) {
|
for (i=0; i<4; i++) {
|
||||||
qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
||||||
qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
||||||
@@ -2348,24 +2372,36 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
|
|
||||||
re_offset = frame_parms->first_carrier_offset;
|
re_offset = frame_parms->first_carrier_offset;
|
||||||
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
|
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
|
||||||
|
allocate_REs = allocate_REs_in_RB;
|
||||||
|
|
||||||
switch (mod_order0) {
|
switch (mod_order0) {
|
||||||
case 2:
|
case 2:
|
||||||
qam_table_s0 = NULL;
|
qam_table_s0 = NULL;
|
||||||
/*if (pilots) {
|
if (pilots) {
|
||||||
qam_table_s0 = qpsk_table_b0;
|
qam_table_s0 = qpsk_table_b0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
|
allocate_REs_in_RB_pilots_QPSK_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qam_table_s0 = qpsk_table_a0;
|
qam_table_s0 = qpsk_table_a0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
}*/
|
allocate_REs_in_RB_no_pilots_QPSK_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (pilots) {
|
if (pilots) {
|
||||||
qam_table_s0 = qam16_table_b0;
|
qam_table_s0 = qam16_table_b0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
|
allocate_REs_in_RB_pilots_16QAM_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qam_table_s0 = qam16_table_a0;
|
qam_table_s0 = qam16_table_a0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
|
allocate_REs_in_RB_no_pilots_16QAM_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2373,23 +2409,41 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
case 6:
|
case 6:
|
||||||
if (pilots) {
|
if (pilots) {
|
||||||
qam_table_s0 = qam64_table_b0;
|
qam_table_s0 = qam64_table_b0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
|
allocate_REs_in_RB_pilots_64QAM_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qam_table_s0 = qam64_table_a0;
|
qam_table_s0 = qam64_table_a0;
|
||||||
|
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||||
|
allocate_REs_in_RB_no_pilots_64QAM_siso :
|
||||||
|
allocate_REs_in_RB;
|
||||||
}
|
}
|
||||||
|
/* TODO: this is a quick hack to be removed. There is a problem
|
||||||
|
* with above code that needs to be analyzed and fixed. In the
|
||||||
|
* meantime, let's use the generic function.
|
||||||
|
*/
|
||||||
|
allocate_REs = allocate_REs_in_RB;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: hack, to be removed. The power is too different from
|
||||||
|
* previous version. Some more work/validation is needed before
|
||||||
|
* we switch to the new version.
|
||||||
|
*/
|
||||||
|
allocate_REs = allocate_REs_in_RB;
|
||||||
|
|
||||||
switch (mod_order1) {
|
switch (mod_order1) {
|
||||||
case 2:
|
case 2:
|
||||||
qam_table_s1 = NULL;
|
qam_table_s1 = NULL;
|
||||||
/*if (pilots) {
|
allocate_REs = allocate_REs_in_RB;
|
||||||
|
if (pilots) {
|
||||||
qam_table_s1 = qpsk_table_b1;
|
qam_table_s1 = qpsk_table_b1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qam_table_s1 = qpsk_table_a1;
|
qam_table_s1 = qpsk_table_a1;
|
||||||
}*/
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (pilots) {
|
if (pilots) {
|
||||||
@@ -2465,7 +2519,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
rb);
|
rb);
|
||||||
|
|
||||||
|
|
||||||
allocate_REs_in_RB(phy_vars_eNB,
|
allocate_REs(phy_vars_eNB,
|
||||||
txdataF,
|
txdataF,
|
||||||
&jj,
|
&jj,
|
||||||
&jj2,
|
&jj2,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||||
#include "transport_eNB.h"
|
#include "transport_eNB.h"
|
||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
int mbsfn_flag,
|
int mbsfn_flag,
|
||||||
|
|||||||
@@ -40,8 +40,7 @@
|
|||||||
#include "transport_proto.h"
|
#include "transport_proto.h"
|
||||||
#include "transport_common_proto.h"
|
#include "transport_common_proto.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "T.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/log.h"
|
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
//#define DEBUG_DCI_ENCODING 1
|
//#define DEBUG_DCI_ENCODING 1
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
|
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
|
||||||
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
//#define DEBUG_DL_MOBIPASS
|
//#define DEBUG_DL_MOBIPASS
|
||||||
//#define DEBUG_UL_MOBIPASS
|
//#define DEBUG_UL_MOBIPASS
|
||||||
#define SUBFRAME_SKIP_NUM_MOBIPASS 8
|
#define SUBFRAME_SKIP_NUM_MOBIPASS 8
|
||||||
|
|||||||
@@ -712,12 +712,10 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
|
||||||
int32_t **txdataF = eNB->common_vars.txdataF;
|
int32_t **txdataF = eNB->common_vars.txdataF;
|
||||||
uint8_t harq_pid;
|
|
||||||
uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH;
|
uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH;
|
||||||
uint8_t NSF_PHICH = 4;
|
uint8_t NSF_PHICH = 4;
|
||||||
uint8_t pusch_subframe;
|
uint8_t pusch_subframe;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint32_t pusch_frame;
|
|
||||||
int subframe = proc->subframe_tx;
|
int subframe = proc->subframe_tx;
|
||||||
phich_config_t *phich;
|
phich_config_t *phich;
|
||||||
|
|
||||||
@@ -732,9 +730,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
|||||||
NSF_PHICH = 2;
|
NSF_PHICH = 2;
|
||||||
|
|
||||||
if (eNB->phich_vars[subframe&1].num_hi > 0) {
|
if (eNB->phich_vars[subframe&1].num_hi > 0) {
|
||||||
pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
|
|
||||||
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
|
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
|
||||||
harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
|
for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
|
||||||
@@ -753,13 +749,15 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
|||||||
nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) +
|
nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) +
|
||||||
phich->n_DMRS)%(2*NSF_PHICH);
|
phich->n_DMRS)%(2*NSF_PHICH);
|
||||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n",
|
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n",
|
||||||
eNB->Mod_id,harq_pid,proc->frame_tx,
|
eNB->Mod_id,subframe2harq_pid(frame_parms,
|
||||||
|
phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe),proc->frame_tx,
|
||||||
subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
|
subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
|
||||||
phich->hi,
|
phich->hi,
|
||||||
phich->first_rb);
|
phich->first_rb);
|
||||||
|
|
||||||
T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe),
|
T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe),
|
||||||
T_INT(-1 /* TODO: rnti */), T_INT(harq_pid),
|
T_INT(-1 /* TODO: rnti */),
|
||||||
|
T_INT(subframe2harq_pid(frame_parms,phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe)),
|
||||||
T_INT(Ngroup_PHICH), T_INT(NSF_PHICH),
|
T_INT(Ngroup_PHICH), T_INT(NSF_PHICH),
|
||||||
T_INT(ngroup_PHICH), T_INT(nseq_PHICH),
|
T_INT(ngroup_PHICH), T_INT(nseq_PHICH),
|
||||||
T_INT(phich->hi),
|
T_INT(phich->hi),
|
||||||
|
|||||||
@@ -35,14 +35,9 @@
|
|||||||
//#include "prach.h"
|
//#include "prach.h"
|
||||||
#include "PHY/LTE_TRANSPORT/if4_tools.h"
|
#include "PHY/LTE_TRANSPORT/if4_tools.h"
|
||||||
#include "SCHED/sched_eNB.h"
|
#include "SCHED/sched_eNB.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "prach_extern.h"
|
#include "prach_extern.h"
|
||||||
|
|
||||||
//#define PRACH_DEBUG 1
|
|
||||||
//#define PRACH_WRITE_OUTPUT_DEBUG 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
|
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
|
||||||
#define rx_prach0 rx_prach
|
#define rx_prach0 rx_prach
|
||||||
#endif
|
#endif
|
||||||
@@ -70,10 +65,6 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
uint8_t Ncs_config;
|
uint8_t Ncs_config;
|
||||||
uint8_t restricted_set;
|
uint8_t restricted_set;
|
||||||
uint8_t n_ra_prb;
|
uint8_t n_ra_prb;
|
||||||
|
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
int frame;
|
|
||||||
#endif
|
|
||||||
int subframe;
|
int subframe;
|
||||||
int16_t *prachF=NULL;
|
int16_t *prachF=NULL;
|
||||||
int16_t **rxsigF=NULL;
|
int16_t **rxsigF=NULL;
|
||||||
@@ -92,7 +83,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
uint8_t not_found;
|
uint8_t not_found;
|
||||||
int k=0;
|
int k=0;
|
||||||
uint16_t u;
|
uint16_t u;
|
||||||
int16_t *Xu;
|
int16_t *Xu=0;
|
||||||
uint16_t offset;
|
uint16_t offset;
|
||||||
int16_t Ncp;
|
int16_t Ncp;
|
||||||
uint16_t first_nonzero_root_idx=0;
|
uint16_t first_nonzero_root_idx=0;
|
||||||
@@ -107,10 +98,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||||
int prach_ifft_cnt=0;
|
int prach_ifft_cnt=0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
int en=0;
|
|
||||||
int en0=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ru) {
|
if (ru) {
|
||||||
fp = ru->frame_parms;
|
fp = ru->frame_parms;
|
||||||
@@ -162,61 +150,49 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||||
if (br_flag == 1) {
|
if (br_flag == 1) {
|
||||||
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
|
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
frame = eNB->proc.frame_prach_br;
|
|
||||||
#endif
|
|
||||||
subframe = eNB->proc.subframe_prach_br;
|
subframe = eNB->proc.subframe_prach_br;
|
||||||
prachF = eNB->prach_vars_br.prachF;
|
prachF = eNB->prach_vars_br.prachF;
|
||||||
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
|
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||||
br_flag,ce_level,frame,subframe,
|
br_flag,ce_level,ru->proc.frame_prach,subframe,
|
||||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||||
prach_ConfigIndex,rootSequenceIndex,
|
prach_ConfigIndex,rootSequenceIndex,
|
||||||
eNB->prach_vars_br.repetition_number[ce_level],
|
eNB->prach_vars_br.repetition_number[ce_level],
|
||||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]);
|
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
prach_ifftp = eNB->prach_vars.prach_ifft[0];
|
prach_ifftp = eNB->prach_vars.prach_ifft[0];
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
frame = eNB->proc.frame_prach;
|
|
||||||
#endif
|
|
||||||
subframe = eNB->proc.subframe_prach;
|
subframe = eNB->proc.subframe_prach;
|
||||||
prachF = eNB->prach_vars.prachF;
|
prachF = eNB->prach_vars.prachF;
|
||||||
rxsigF = eNB->prach_vars.rxsigF[0];
|
rxsigF = eNB->prach_vars.rxsigF[0];
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
//if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||||
if (br_flag == 1) {
|
if (br_flag == 1) {
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
frame = ru->proc.frame_prach_br;
|
|
||||||
#endif
|
|
||||||
subframe = ru->proc.subframe_prach_br;
|
subframe = ru->proc.subframe_prach_br;
|
||||||
rxsigF = ru->prach_rxsigF_br[ce_level];
|
rxsigF = ru->prach_rxsigF_br[ce_level];
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||||
br_flag,ce_level,frame,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
|
br_flag,ce_level,ru->proc.frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
frame = ru->proc.frame_prach;
|
|
||||||
#endif
|
|
||||||
subframe = ru->proc.subframe_prach;
|
subframe = ru->proc.subframe_prach;
|
||||||
rxsigF = ru->prach_rxsigF;
|
rxsigF = ru->prach_rxsigF;
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||||
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
|
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -227,31 +203,28 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node
|
if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node
|
||||||
// DJP - indexing below in subframe zero takes us off the beginning of the array???
|
// DJP - indexing below in subframe zero takes us off the beginning of the array???
|
||||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
|
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
|
||||||
#ifdef PRACH_DEBUG
|
|
||||||
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
|
|
||||||
int8_t dbEn0 = dB_fixed(en0);
|
|
||||||
int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
|
|
||||||
|
|
||||||
#ifdef PRACH_WRITE_OUTPUT_DEBUG
|
LOG_M_BEGIN(PRACH)
|
||||||
|
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
|
||||||
|
int8_t dbEn0 = dB_fixed(en0);
|
||||||
|
int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
|
||||||
|
char buffer[80];
|
||||||
if (dbEn0>32 && prach[0]!= NULL)
|
if (dbEn0>32 && prach[0]!= NULL)
|
||||||
{
|
{
|
||||||
static int counter=0;
|
static int counter=0;
|
||||||
|
|
||||||
char buffer[80];
|
|
||||||
//counter++;
|
|
||||||
sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
|
sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
|
||||||
LOG_M(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
|
LOG_M(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
|
||||||
}
|
}
|
||||||
#endif
|
if (dB_fixed(en0)>32)
|
||||||
|
|
||||||
if (dbEn0>32)
|
|
||||||
{
|
{
|
||||||
#ifdef PRACH_WRITE_OUTPUT_DEBUG
|
sprintf(buffer, "rach_dBm:%d",rach_dBm);
|
||||||
if (prach[0]!= NULL) LOG_M("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
|
if (prach[0]!= NULL) LOG_M("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
|
||||||
#endif
|
LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d %s rxdata:%p index:%d\n",
|
||||||
LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d rach_dBm:%d rxdata:%p index:%d\n",ru->idx,br_flag,ce_level,frame,subframe,fp->samples_per_tti,prach[aa],dbEn0,ru->N_TA_offset,rach_dBm,ru->common.rxdata[aa], (subframe*fp->samples_per_tti)-ru->N_TA_offset);
|
ru->idx,br_flag,ce_level,ru->proc.frame_prach,subframe,fp->samples_per_tti,
|
||||||
|
prach[aa],dbEn0,ru->N_TA_offset,buffer,ru->common.rxdata[aa],
|
||||||
|
(subframe*fp->samples_per_tti)-ru->N_TA_offset);
|
||||||
}
|
}
|
||||||
#endif
|
LOG_M_END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,9 +306,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
|
if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
|
||||||
((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
|
((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
|
||||||
// Do forward transform
|
// Do forward transform
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp);
|
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
for (aa=0; aa<nb_rx; aa++) {
|
for (aa=0; aa<nb_rx; aa++) {
|
||||||
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
|
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
|
||||||
prach2 = prach[aa] + (Ncp<<1);
|
prach2 = prach[aa] + (Ncp<<1);
|
||||||
@@ -386,10 +359,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
if (prach_fmt == 4) {
|
if (prach_fmt == 4) {
|
||||||
dft2048(prach2,rxsigF[aa],1);
|
dft2048(prach2,rxsigF[aa],1);
|
||||||
} else {
|
} else {
|
||||||
dft12288(prach2,rxsigF[aa]);
|
dft12288(prach2,rxsigF[aa],1);
|
||||||
|
|
||||||
if (prach_fmt>1)
|
if (prach_fmt>1)
|
||||||
dft12288(prach2+24576,rxsigF[aa]+24576);
|
dft12288(prach2+24576,rxsigF[aa]+24576,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -398,10 +371,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
if (prach_fmt == 4) {
|
if (prach_fmt == 4) {
|
||||||
dft3072(prach2,rxsigF[aa],1);
|
dft3072(prach2,rxsigF[aa],1);
|
||||||
} else {
|
} else {
|
||||||
dft18432(prach2,rxsigF[aa]);
|
dft18432(prach2,rxsigF[aa],1);
|
||||||
|
|
||||||
if (prach_fmt>1)
|
if (prach_fmt>1)
|
||||||
dft18432(prach2+36864,rxsigF[aa]+36864);
|
dft18432(prach2+36864,rxsigF[aa]+36864,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -411,19 +384,19 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
if (prach_fmt == 4) {
|
if (prach_fmt == 4) {
|
||||||
dft4096(prach2,rxsigF[aa],1);
|
dft4096(prach2,rxsigF[aa],1);
|
||||||
} else {
|
} else {
|
||||||
dft24576(prach2,rxsigF[aa]);
|
dft24576(prach2,rxsigF[aa],1);
|
||||||
|
|
||||||
if (prach_fmt>1)
|
if (prach_fmt>1)
|
||||||
dft24576(prach2+49152,rxsigF[aa]+49152);
|
dft24576(prach2+49152,rxsigF[aa]+49152,1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (prach_fmt == 4) {
|
if (prach_fmt == 4) {
|
||||||
dft3072(prach2,rxsigF[aa],1);
|
dft3072(prach2,rxsigF[aa],1);
|
||||||
} else {
|
} else {
|
||||||
dft18432(prach2,rxsigF[aa]);
|
dft18432(prach2,rxsigF[aa],1);
|
||||||
|
|
||||||
if (prach_fmt>1)
|
if (prach_fmt>1)
|
||||||
dft18432(prach2+36864,rxsigF[aa]+36864);
|
dft18432(prach2+36864,rxsigF[aa]+36864,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,10 +439,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
return;
|
return;
|
||||||
} else if (eNB!=NULL) {
|
} else if (eNB!=NULL) {
|
||||||
|
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
|
if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case of RAU and prach received rx_thread wakes up prach
|
// in case of RAU and prach received rx_thread wakes up prach
|
||||||
@@ -504,9 +477,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
*max_preamble_energy=0;
|
*max_preamble_energy=0;
|
||||||
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
|
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
|
||||||
|
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d (br_flag %d)\n",frame,subframe,preamble_index,br_flag);
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
#endif
|
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d (br_flag %d)\n",ru->proc.frame_prach,subframe,preamble_index,br_flag);
|
||||||
|
LOG_DEBUG_END
|
||||||
if (restricted_set == 0) {
|
if (restricted_set == 0) {
|
||||||
// This is the relative offset in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
|
// This is the relative offset in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
|
||||||
preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
|
preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
|
||||||
@@ -589,10 +563,11 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex
|
// Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d: offset %d, preamble shift %d (br_flag %d, en %d)\n",
|
if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d: offset %d, preamble shift %d (br_flag %d, en %d)\n",
|
||||||
frame,subframe,preamble_index,preamble_offset,preamble_shift,br_flag,en);
|
ru->proc.frame_prach,subframe,preamble_index,preamble_offset,preamble_shift,br_flag,en);
|
||||||
#endif
|
LOG_DEBUG_END
|
||||||
log2_ifft_size = 10;
|
log2_ifft_size = 10;
|
||||||
fft_size = 6144;
|
fft_size = 6144;
|
||||||
|
|
||||||
@@ -614,12 +589,12 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(prachF, 0, sizeof(int16_t)*2*1024 );
|
memset(prachF, 0, sizeof(int16_t)*2*1024 );
|
||||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
LOG_M_BEGIN(PRACH)
|
||||||
if (prach[0]!= NULL) LOG_M("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
|
if (prach[0]!= NULL) LOG_M("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
|
||||||
#endif
|
LOG_M("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
|
||||||
// LOG_M("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
|
LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
|
||||||
// LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
|
LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
|
||||||
// LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
|
LOG_M_END
|
||||||
|
|
||||||
for (aa=0;aa<nb_rx; aa++) {
|
for (aa=0;aa<nb_rx; aa++) {
|
||||||
// Do componentwise product with Xu* on each antenna
|
// Do componentwise product with Xu* on each antenna
|
||||||
@@ -647,11 +622,11 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
for (i=0;i<256;i++)
|
for (i=0;i<256;i++)
|
||||||
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
|
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
LOG_M_BEGIN(PRACH)
|
||||||
if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||||
#endif
|
if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
|
||||||
// if (aa=1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
|
LOG_M_END
|
||||||
}// antennas_rx
|
}// antennas_rx
|
||||||
} // new dft
|
} // new dft
|
||||||
|
|
||||||
@@ -662,9 +637,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]))
|
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain (br_flag %d, en %d)\n",frame,subframe,br_flag,en);
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
#endif
|
if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain (br_flag %d, en %d)\n",ru->proc.frame_prach,subframe,br_flag,en);
|
||||||
|
LOG_DEBUG_END
|
||||||
preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
|
preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
|
||||||
|
|
||||||
|
|
||||||
@@ -676,17 +652,18 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
*max_preamble_energy = levdB;
|
*max_preamble_energy = levdB;
|
||||||
*max_preamble_delay = ((i*fft_size)>>log2_ifft_size)*update_TA/update_TA2;
|
*max_preamble_delay = ((i*fft_size)>>log2_ifft_size)*update_TA/update_TA2;
|
||||||
*max_preamble = preamble_index;
|
*max_preamble = preamble_index;
|
||||||
#ifdef PRACH_DEBUG
|
LOG_DEBUG_BEGIN(PRACH)
|
||||||
if ((en>60) && (br_flag==1)) LOG_D(PHY,"frame %d, subframe %d : max_preamble_energy %d, max_preamble_delay %d, max_preamble %d (br_flag %d,ce_level %d, levdB %d, lev %d)\n",frame,subframe,*max_preamble_energy,*max_preamble_delay,*max_preamble,br_flag,ce_level,levdB,lev);
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
#endif
|
if ((en>60) && (br_flag==1)) LOG_D(PHY,"frame %d, subframe %d : max_preamble_energy %d, max_preamble_delay %d, max_preamble %d (br_flag %d,ce_level %d, levdB %d, lev %d)\n",ru->proc.frame_prach,subframe,*max_preamble_energy,*max_preamble_delay,*max_preamble,br_flag,ce_level,levdB,lev);
|
||||||
|
LOG_DEBUG_END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}// preamble_index
|
}// preamble_index
|
||||||
|
|
||||||
#ifdef PRACH_DEBUG
|
LOG_M_BEGIN(PRACH)
|
||||||
|
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||||
if (en>60) {
|
if (en>60) {
|
||||||
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
|
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
|
||||||
|
|
||||||
@@ -697,26 +674,22 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
|||||||
k*=2;
|
k*=2;
|
||||||
|
|
||||||
if (br_flag == 0) {
|
if (br_flag == 0) {
|
||||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
|
||||||
LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
|
LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
|
||||||
LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||||
LOG_M("Xu.m","xu",Xu,N_ZC,1,1);
|
LOG_M("Xu.m","xu",Xu,N_ZC,1,1);
|
||||||
LOG_M("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
|
LOG_M("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
LOG_E(PHY,"Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
|
||||||
printf("Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
|
|
||||||
LOG_M("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
|
LOG_M("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
|
||||||
LOG_M("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
|
LOG_M("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
|
||||||
LOG_M("Xu_br.m","xu_br",Xu,N_ZC,1,1);
|
LOG_M("Xu_br.m","xu_br",Xu,N_ZC,1,1);
|
||||||
LOG_M("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
|
LOG_M("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
LOG_M_END
|
||||||
if (eNB) stop_meas(&eNB->rx_prach);
|
if (eNB) stop_meas(&eNB->rx_prach);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "PHY/defs_common.h"
|
#include "PHY/defs_common.h"
|
||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "PHY/phy_extern_ue.h"
|
#include "PHY/phy_extern_ue.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
|
|
||||||
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
|
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
|
||||||
|
|||||||
@@ -34,10 +34,9 @@
|
|||||||
#include "LAYER2/MAC/mac.h"
|
#include "LAYER2/MAC/mac.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#include "T.h"
|
|
||||||
|
|
||||||
//uint8_t ncs_cell[20][7];
|
//uint8_t ncs_cell[20][7];
|
||||||
//#define DEBUG_PUCCH_TXS
|
//#define DEBUG_PUCCH_TXS
|
||||||
|
|||||||
@@ -33,11 +33,10 @@
|
|||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "LAYER2/MAC/mac.h"
|
#include "LAYER2/MAC/mac.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
#include "T.h"
|
|
||||||
|
|
||||||
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7])
|
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "PHY/phy_extern.h"
|
#include "PHY/phy_extern.h"
|
||||||
#include "SCHED/sched_eNB.h"
|
#include "SCHED/sched_eNB.h"
|
||||||
#include "LAYER2/MAC/mac.h"
|
#include "LAYER2/MAC/mac.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#ifndef __TRANSPORT_ENB__H__
|
#ifndef __TRANSPORT_ENB__H__
|
||||||
#define __TRANSPORT_ENB__H__
|
#define __TRANSPORT_ENB__H__
|
||||||
#include "transport_common.h"
|
#include "transport_common.h"
|
||||||
#include "PHY/defs_eNB.h"
|
//#include "PHY/defs_eNB.h"
|
||||||
#include "dci.h"
|
#include "dci.h"
|
||||||
#include "mdci.h"
|
#include "mdci.h"
|
||||||
#include "uci_common.h"
|
#include "uci_common.h"
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "RRC/LTE/rrc_extern.h"
|
#include "RRC/LTE/rrc_extern.h"
|
||||||
#include "PHY_INTERFACE/phy_interface.h"
|
#include "PHY_INTERFACE/phy_interface.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
//#define DEBUG_ULSCH_DECODING
|
//#define DEBUG_ULSCH_DECODING
|
||||||
#include "targets/RT/USER/rt_wrapper.h"
|
#include "targets/RT/USER/rt_wrapper.h"
|
||||||
#include "transport_proto.h"
|
#include "transport_proto.h"
|
||||||
|
|||||||
@@ -1350,70 +1350,70 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
|
|||||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
|
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
|
||||||
sprintf(fname,"/tmp/ulsch_r%d_d",round);
|
sprintf(fname,"/tmp/ulsch_r%d_d",round);
|
||||||
sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
|
sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
|
||||||
LOG_M(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
|
LOG_UM(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
|
||||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
|
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
|
||||||
if (eNB->common_vars.rxdata) {
|
if (eNB->common_vars.rxdata) {
|
||||||
sprintf(fname,"/tmp/rxsig0_r%d.m",round);
|
sprintf(fname,"/tmp/rxsig0_r%d.m",round);
|
||||||
sprintf(vname,"rxs0_r%d",round);
|
sprintf(vname,"rxs0_r%d",round);
|
||||||
LOG_M(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
LOG_UM(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||||
|
|
||||||
if (eNB->frame_parms.nb_antennas_rx>1)
|
if (eNB->frame_parms.nb_antennas_rx>1)
|
||||||
if (eNB->common_vars.rxdata) {
|
if (eNB->common_vars.rxdata) {
|
||||||
sprintf(fname,"/tmp/rxsig1_r%d.m",round);
|
sprintf(fname,"/tmp/rxsig1_r%d.m",round);
|
||||||
sprintf(vname,"rxs1_r%d",round);
|
sprintf(vname,"rxs1_r%d",round);
|
||||||
LOG_M(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
LOG_UM(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
|
sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
|
||||||
sprintf(vname,"rxsF0_r%d",round);
|
sprintf(vname,"rxsF0_r%d",round);
|
||||||
LOG_M(fname,vname, (void*)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
LOG_UM(fname,vname, (void*)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||||
|
|
||||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||||
sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
|
sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
|
||||||
sprintf(vname,"rxsF1_r%d",round);
|
sprintf(vname,"rxsF1_r%d",round);
|
||||||
LOG_M(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
LOG_UM(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
|
sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
|
||||||
sprintf(vname,"rxsF0_ext_r%d",round);
|
sprintf(vname,"rxsF0_ext_r%d",round);
|
||||||
LOG_M(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
|
|
||||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||||
sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
|
sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
|
||||||
sprintf(vname,"rxsF1_ext_r%d",round);
|
sprintf(vname,"rxsF1_ext_r%d",round);
|
||||||
LOG_M(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_M("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
|
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||||
|
|
||||||
if (eNB->frame_parms.nb_antennas_rx>1)
|
if (eNB->frame_parms.nb_antennas_rx>1)
|
||||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_M("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
|
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(fname,"/tmp/drs_est0_r%d.m",round);
|
sprintf(fname,"/tmp/drs_est0_r%d.m",round);
|
||||||
sprintf(vname,"drsest0_r%d",round);
|
sprintf(vname,"drsest0_r%d",round);
|
||||||
LOG_M(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
|
|
||||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||||
sprintf(fname,"/tmp/drs_est1_r%d.m",round);
|
sprintf(fname,"/tmp/drs_est1_r%d.m",round);
|
||||||
sprintf(vname,"drsest1_r%d",round);
|
sprintf(vname,"drsest1_r%d",round);
|
||||||
LOG_M(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
|
sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
|
||||||
sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
|
sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
|
||||||
LOG_M(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
// LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
// LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
|
sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
|
||||||
sprintf(vname,"ulsch_llr_r%d",round);
|
sprintf(vname,"ulsch_llr_r%d",round);
|
||||||
LOG_M(fname,vname,eNB->pusch_vars[UE_id]->llr,
|
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->llr,
|
||||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm
|
eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm
|
||||||
*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch,1,0);
|
*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch,1,0);
|
||||||
sprintf(fname,"/tmp/ulsch_ch_mag_r%d.m",round);
|
sprintf(fname,"/tmp/ulsch_ch_mag_r%d.m",round);
|
||||||
sprintf(vname,"ulsch_ch_mag_r%d",round);
|
sprintf(vname,"ulsch_ch_mag_r%d",round);
|
||||||
LOG_M(fname,vname,&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
// LOG_M("ulsch_ch_mag1.m","ulsch_ch_mag1",&eNB->pusch_vars[UE_id]->ul_ch_mag[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
// LOG_UM("ulsch_ch_mag1.m","ulsch_ch_mag1",&eNB->pusch_vars[UE_id]->ul_ch_mag[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3128,7 +3128,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
|||||||
// this is the cba mcs uci for cba transmission
|
// this is the cba mcs uci for cba transmission
|
||||||
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||||
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti = rnti;
|
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti = rnti;
|
||||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ue_selected:
|
case ue_selected:
|
||||||
@@ -3182,7 +3182,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
|||||||
// this is the cba mcs uci for cba transmission
|
// this is the cba mcs uci for cba transmission
|
||||||
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||||
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti = rnti;
|
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti = rnti;
|
||||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ue_selected:
|
case ue_selected:
|
||||||
@@ -3236,7 +3236,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
|||||||
// this is the cba mcs uci for cba transmission
|
// this is the cba mcs uci for cba transmission
|
||||||
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||||
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti = rnti;
|
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti = rnti;
|
||||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ue_selected:
|
case ue_selected:
|
||||||
|
|||||||
@@ -43,9 +43,8 @@
|
|||||||
#include "SCHED/sched_common.h"
|
#include "SCHED/sched_common.h"
|
||||||
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "T.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
|
||||||
|
|
||||||
//#define DEBUG_DCI_ENCODING 1
|
//#define DEBUG_DCI_ENCODING 1
|
||||||
//#define DEBUG_DCI_DECODING 1
|
//#define DEBUG_DCI_DECODING 1
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "PHY/CODING/coding_extern.h"
|
#include "PHY/CODING/coding_extern.h"
|
||||||
#include "SCHED/sched_common_extern.h"
|
#include "SCHED/sched_common_extern.h"
|
||||||
#include "SIMULATION/TOOLS/sim.h"
|
#include "SIMULATION/TOOLS/sim.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||||
//#define DEBUG_DLSCH_DECODING
|
//#define DEBUG_DLSCH_DECODING
|
||||||
#define UE_DEBUG_TRACE 1
|
#define UE_DEBUG_TRACE 1
|
||||||
|
|||||||
@@ -40,8 +40,14 @@
|
|||||||
#include<math.h>
|
#include<math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
#if RHEL_RELEASE_CODE >= 1796
|
||||||
|
#include <lapacke/lapacke_utils.h>
|
||||||
|
#include <lapacke/lapacke.h>
|
||||||
|
#else
|
||||||
#include <lapacke_utils.h>
|
#include <lapacke_utils.h>
|
||||||
#include <lapacke.h>
|
#include <lapacke.h>
|
||||||
|
#endif
|
||||||
#include <cblas.h>
|
#include <cblas.h>
|
||||||
#include "linear_preprocessing_rec.h"
|
#include "linear_preprocessing_rec.h"
|
||||||
|
|
||||||
@@ -1314,14 +1320,17 @@ void dlsch_channel_compensation(int **rxdataF_ext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||||
|
/* TODO: hack to be removed. There is crash for 1 antenna case, so
|
||||||
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*2 + aarx][symbol*frame_parms->N_RB_DL*12];
|
* for 1 antenna case, I put back the value 2 as it was before
|
||||||
|
* Elena's commit.
|
||||||
|
*/
|
||||||
|
int x = frame_parms->nb_antennas_rx > 1 ? frame_parms->nb_antennas_rx : 2;
|
||||||
|
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*x + aarx][symbol*frame_parms->N_RB_DL*12];
|
||||||
//print_shorts("dl_ch128[0]=",&dl_ch128[0]);*/
|
//print_shorts("dl_ch128[0]=",&dl_ch128[0]);*/
|
||||||
dl_ch_mag128 = (__m128i *)&dl_ch_mag[aatx*2 + aarx][symbol*frame_parms->N_RB_DL*12];
|
dl_ch_mag128 = (__m128i *)&dl_ch_mag[aatx*x + aarx][symbol*frame_parms->N_RB_DL*12];
|
||||||
dl_ch_mag128b = (__m128i *)&dl_ch_magb[aatx*2 + aarx][symbol*frame_parms->N_RB_DL*12];
|
dl_ch_mag128b = (__m128i *)&dl_ch_magb[aatx*x + aarx][symbol*frame_parms->N_RB_DL*12];
|
||||||
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12];
|
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12];
|
||||||
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*2 + aarx][symbol*frame_parms->N_RB_DL*12];
|
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*x + aarx][symbol*frame_parms->N_RB_DL*12];
|
||||||
|
|
||||||
|
|
||||||
for (rb=0; rb<nb_rb; rb++) {
|
for (rb=0; rb<nb_rb; rb++) {
|
||||||
if (mod_order>2) {
|
if (mod_order>2) {
|
||||||
@@ -1771,12 +1780,17 @@ void dlsch_channel_compensation_core(int **rxdataF_ext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (aarx=0; aarx<n_rx; aarx++) {
|
for (aarx=0; aarx<n_rx; aarx++) {
|
||||||
|
/* TODO: hack to be removed. There is crash for 1 antenna case, so
|
||||||
|
* for 1 antenna case, I put back the value 2 as it was before
|
||||||
|
* Elena's commit.
|
||||||
|
*/
|
||||||
|
int x = n_rx > 1 ? n_rx : 2;
|
||||||
|
|
||||||
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*2 + aarx][start_point];
|
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*x + aarx][start_point];
|
||||||
dl_ch_mag128 = (__m128i *)&dl_ch_mag[aatx*2 + aarx][start_point];
|
dl_ch_mag128 = (__m128i *)&dl_ch_mag[aatx*x + aarx][start_point];
|
||||||
dl_ch_mag128b = (__m128i *)&dl_ch_magb[aatx*2 + aarx][start_point];
|
dl_ch_mag128b = (__m128i *)&dl_ch_magb[aatx*x + aarx][start_point];
|
||||||
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][start_point];
|
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][start_point];
|
||||||
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*2 + aarx][start_point];
|
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*x + aarx][start_point];
|
||||||
|
|
||||||
length_mod8 = length&7;
|
length_mod8 = length&7;
|
||||||
if (length_mod8 == 0){
|
if (length_mod8 == 0){
|
||||||
@@ -3950,15 +3964,11 @@ void dlsch_channel_level_median(int **dl_ch_estimates_ext,
|
|||||||
|
|
||||||
short ii;
|
short ii;
|
||||||
int aatx,aarx;
|
int aatx,aarx;
|
||||||
int length_mod4;
|
|
||||||
int length2;
|
int length2;
|
||||||
int max = 0, min=0;
|
int max = 0, min=0;
|
||||||
int norm_pack;
|
int norm_pack;
|
||||||
__m128i *dl_ch128, norm128D;
|
__m128i *dl_ch128, norm128D;
|
||||||
|
|
||||||
int16_t x = factor2(length);
|
|
||||||
int16_t y = (length)>>x;
|
|
||||||
|
|
||||||
for (aatx=0; aatx<n_tx; aatx++){
|
for (aatx=0; aatx<n_tx; aatx++){
|
||||||
for (aarx=0; aarx<n_rx; aarx++) {
|
for (aarx=0; aarx<n_rx; aarx++) {
|
||||||
max = 0;
|
max = 0;
|
||||||
@@ -3967,8 +3977,6 @@ void dlsch_channel_level_median(int **dl_ch_estimates_ext,
|
|||||||
|
|
||||||
dl_ch128=(__m128i *)&dl_ch_estimates_ext[aatx*2 + aarx][start_point];
|
dl_ch128=(__m128i *)&dl_ch_estimates_ext[aatx*2 + aarx][start_point];
|
||||||
|
|
||||||
length_mod4=length&3;
|
|
||||||
|
|
||||||
length2 = length>>2;
|
length2 = length>>2;
|
||||||
|
|
||||||
for (ii=0;ii<length2;ii++) {
|
for (ii=0;ii<length2;ii++) {
|
||||||
@@ -3980,17 +3988,12 @@ void dlsch_channel_level_median(int **dl_ch_estimates_ext,
|
|||||||
((int32_t*)&norm128D)[2] +
|
((int32_t*)&norm128D)[2] +
|
||||||
((int32_t*)&norm128D)[3];
|
((int32_t*)&norm128D)[3];
|
||||||
|
|
||||||
if (ii<1){
|
|
||||||
print_ints("norm128D",&norm128D[0]);
|
|
||||||
printf("norm_pack[%d] %d\n", aatx*n_rx + aarx, norm_pack);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (norm_pack > max)
|
if (norm_pack > max)
|
||||||
max = norm_pack;
|
max = norm_pack;
|
||||||
if (norm_pack < min)
|
if (norm_pack < min)
|
||||||
min = norm_pack;
|
min = norm_pack;
|
||||||
|
|
||||||
dl_ch128+=1;
|
dl_ch128+=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
median[aatx*n_rx + aarx] = (max+min)>>1;
|
median[aatx*n_rx + aarx] = (max+min)>>1;
|
||||||
@@ -6921,79 +6924,90 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
|
|||||||
|
|
||||||
void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid)
|
void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid)
|
||||||
{
|
{
|
||||||
unsigned int nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12;
|
#define NSYMB ((ue->frame_parms.Ncp == 0) ? 14 : 12)
|
||||||
char fname[32],vname[32];
|
char fname[32],vname[32];
|
||||||
int N_RB_DL=ue->frame_parms.N_RB_DL;
|
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_ext0.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_ext0.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_rxF_r%d_ext0",eNB_id,round);
|
sprintf(vname,"dl%d_rxF_r%d_ext0",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
if (ue->frame_parms.nb_antennas_rx >1) {
|
if (ue->frame_parms.nb_antennas_rx >1) {
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_ext1.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_ext1.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_rxF_r%d_ext1",eNB_id,round);
|
sprintf(vname,"dl%d_rxF_r%d_ext1",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_ch_r%d_ext00.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_ch_r%d_ext00.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round);
|
sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
if (ue->transmission_mode[eNB_id]==7){
|
if (ue->transmission_mode[eNB_id]==7){
|
||||||
sprintf(fname,"dlsch%d_bf_ch_r%d.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_bf_ch_r%d.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_bf_ch_r%d",eNB_id,round);
|
sprintf(vname,"dl%d_bf_ch_r%d",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates[0],512*NSYMB,1,1);
|
||||||
//LOG_M(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512,1,1);
|
//LOG_M(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512,1,1);
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_bf_ch_r%d_ext00.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_bf_ch_r%d_ext00.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_bf_ch_r%d_ext00",eNB_id,round);
|
sprintf(vname,"dl%d_bf_ch_r%d_ext00",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates_ext[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ue->frame_parms.nb_antennas_rx == 2) {
|
if (ue->frame_parms.nb_antennas_rx == 2) {
|
||||||
sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round);
|
sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[1],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ue->frame_parms.nb_antenna_ports_eNB == 2) {
|
if (ue->frame_parms.nb_antenna_ports_eNB == 2) {
|
||||||
sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round);
|
sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[2],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
if (ue->frame_parms.nb_antennas_rx == 2) {
|
if (ue->frame_parms.nb_antennas_rx == 2) {
|
||||||
sprintf(fname,"dlsch%d_ch_r%d_ext11.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_ch_r%d_ext11.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_ch_r%d_ext11",eNB_id,round);
|
sprintf(vname,"dl%d_ch_r%d_ext11",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[3],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round);
|
sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_uespec_pilots[0],12*N_RB_DL,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_uespec_pilots[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1);
|
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB,1,1);
|
||||||
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1);
|
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB,1,1);
|
||||||
LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1);
|
LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*NSYMB,1,1);
|
||||||
*/
|
*/
|
||||||
sprintf(fname,"dlsch%d_r%d_rho.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_r%d_rho.m",eNB_id,round);
|
||||||
sprintf(vname,"dl_rho_r%d_%d",eNB_id,round);
|
sprintf(vname,"dl_rho_r%d_%d",eNB_id,round);
|
||||||
|
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho_ext[harq_pid][round][0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho_ext[harq_pid][round][0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_r%d_rho2.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_r%d_rho2.m",eNB_id,round);
|
||||||
sprintf(vname,"dl_rho2_r%d_%d",eNB_id,round);
|
sprintf(vname,"dl_rho2_r%d_%d",eNB_id,round);
|
||||||
|
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho2_ext[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round);
|
sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
if (ue->frame_parms.nb_antenna_ports_eNB == 2) {
|
if (ue->frame_parms.nb_antenna_ports_eNB == 2) {
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round);
|
sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[harq_pid][round][0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname,"dlsch%d_rxF_r%d_llr.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_rxF_r%d_llr.m",eNB_id,round);
|
||||||
@@ -7001,52 +7015,13 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *c
|
|||||||
LOG_M(fname,vname, ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->llr[0],coded_bits_per_codeword[0],1,0);
|
LOG_M(fname,vname, ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->llr[0],coded_bits_per_codeword[0],1,0);
|
||||||
sprintf(fname,"dlsch%d_r%d_mag1.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_r%d_mag1.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_r%d_mag1",eNB_id,round);
|
sprintf(vname,"dl%d_r%d_mag1",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
sprintf(fname,"dlsch%d_r%d_mag2.m",eNB_id,round);
|
sprintf(fname,"dlsch%d_r%d_mag2.m",eNB_id,round);
|
||||||
sprintf(vname,"dl%d_r%d_mag2",eNB_id,round);
|
sprintf(vname,"dl%d_r%d_mag2",eNB_id,round);
|
||||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0],
|
||||||
|
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||||
// printf("log2_maxh = %d\n",ue->pdsch_vars[eNB_id]->log2_maxh);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_DEMOD
|
|
||||||
/*
|
|
||||||
void print_bytes(char *s,__m128i *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
char *tempb = (char *)x;
|
|
||||||
|
|
||||||
printf("%s : %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",s,
|
|
||||||
tempb[0],tempb[1],tempb[2],tempb[3],tempb[4],tempb[5],tempb[6],tempb[7],
|
|
||||||
tempb[8],tempb[9],tempb[10],tempb[11],tempb[12],tempb[13],tempb[14],tempb[15]
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_shorts(char *s,__m128i *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
short *tempb = (short *)x;
|
|
||||||
printf("%s : %d,%d,%d,%d,%d,%d,%d,%d\n",s,
|
|
||||||
tempb[0],tempb[1],tempb[2],tempb[3],tempb[4],tempb[5],tempb[6],tempb[7]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_shorts2(char *s,__m64 *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
short *tempb = (short *)x;
|
|
||||||
printf("%s : %d,%d,%d,%d\n",s,
|
|
||||||
tempb[0],tempb[1],tempb[2],tempb[3]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_ints(char *s,__m128i *x)
|
|
||||||
{
|
|
||||||
|
|
||||||
int *tempb = (int *)x;
|
|
||||||
printf("%s : %d,%d,%d,%d\n",s,
|
|
||||||
tempb[0],tempb[1],tempb[2],tempb[3]);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -13,9 +13,14 @@ data storage. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <cblas.h>
|
#include <cblas.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
#if RHEL_RELEASE_CODE >= 1796
|
||||||
|
#include <lapacke/lapacke_utils.h>
|
||||||
|
#include <lapacke/lapacke.h>
|
||||||
|
#else
|
||||||
#include <lapacke_utils.h>
|
#include <lapacke_utils.h>
|
||||||
#include <lapacke.h>
|
#include <lapacke.h>
|
||||||
|
#endif
|
||||||
//#define DEBUG_PREPROC
|
//#define DEBUG_PREPROC
|
||||||
|
|
||||||
|
|
||||||
@@ -366,4 +371,4 @@ float sqrt_float(float x, float sqrt_x)
|
|||||||
{
|
{
|
||||||
sqrt_x = (float)(sqrt((double)(x)));
|
sqrt_x = (float)(sqrt((double)(x)));
|
||||||
return sqrt_x;
|
return sqrt_x;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,34 +43,32 @@
|
|||||||
void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe)
|
void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int nsymb_pmch=12;
|
|
||||||
char fname[32],vname[32];
|
char fname[32],vname[32];
|
||||||
int N_RB_DL=ue->frame_parms.N_RB_DL;
|
#define NSYMB_PMCH 12
|
||||||
|
|
||||||
sprintf(fname,"mch_rxF_ext0.m");
|
sprintf(fname,"mch_rxF_ext0.m");
|
||||||
sprintf(vname,"pmch_rxF_ext0");
|
sprintf(vname,"pmch_rxF_ext0");
|
||||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*(ue->frame_parms.N_RB_DL)*12,1,1);
|
||||||
sprintf(fname,"mch_ch_ext00.m");
|
sprintf(fname,"mch_ch_ext00.m");
|
||||||
sprintf(vname,"pmch_ch_ext00");
|
sprintf(vname,"pmch_ch_ext00");
|
||||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||||
/*
|
/*
|
||||||
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||||
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||||
LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||||
LOG_M("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||||
*/
|
*/
|
||||||
sprintf(fname,"mch_rxF_comp0.m");
|
sprintf(fname,"mch_rxF_comp0.m");
|
||||||
sprintf(vname,"pmch_rxF_comp0");
|
sprintf(vname,"pmch_rxF_comp0");
|
||||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||||
sprintf(fname,"mch_rxF_llr.m");
|
sprintf(fname,"mch_rxF_llr.m");
|
||||||
sprintf(vname,"pmch_llr");
|
sprintf(vname,"pmch_llr");
|
||||||
LOG_M(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
|
LOG_M(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
|
||||||
sprintf(fname,"mch_mag1.m");
|
sprintf(fname,"mch_mag1.m");
|
||||||
sprintf(vname,"pmch_mag1");
|
sprintf(vname,"pmch_mag1");
|
||||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||||
sprintf(fname,"mch_mag2.m");
|
sprintf(fname,"mch_mag2.m");
|
||||||
sprintf(vname,"pmch_mag2");
|
sprintf(vname,"pmch_mag2");
|
||||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||||
|
|
||||||
LOG_M("mch00_ch0.m","pmch00_ch0",
|
LOG_M("mch00_ch0.m","pmch00_ch0",
|
||||||
&(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
|
&(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "SCHED_UE/sched_UE.h"
|
#include "SCHED_UE/sched_UE.h"
|
||||||
#include "SCHED/sched_common_extern.h"
|
#include "SCHED/sched_common_extern.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#include "../LTE_TRANSPORT/prach_extern.h"
|
#include "../LTE_TRANSPORT/prach_extern.h"
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
|||||||
memmove( prach, prach+4096, Ncp<<2 );
|
memmove( prach, prach+4096, Ncp<<2 );
|
||||||
prach_len = 2048+Ncp;
|
prach_len = 2048+Ncp;
|
||||||
} else {
|
} else {
|
||||||
idft12288(prachF,prach2);
|
idft12288(prachF,prach2,1);
|
||||||
memmove( prach, prach+24576, Ncp<<2 );
|
memmove( prach, prach+24576, Ncp<<2 );
|
||||||
prach_len = 12288+Ncp;
|
prach_len = 12288+Ncp;
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
|||||||
memmove( prach, prach+6144, Ncp<<2 );
|
memmove( prach, prach+6144, Ncp<<2 );
|
||||||
prach_len = 3072+Ncp;
|
prach_len = 3072+Ncp;
|
||||||
} else {
|
} else {
|
||||||
idft18432(prachF,prach2);
|
idft18432(prachF,prach2,1);
|
||||||
memmove( prach, prach+36864, Ncp<<2 );
|
memmove( prach, prach+36864, Ncp<<2 );
|
||||||
prach_len = 18432+Ncp;
|
prach_len = 18432+Ncp;
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
|||||||
memmove( prach, prach+8192, Ncp<<2 );
|
memmove( prach, prach+8192, Ncp<<2 );
|
||||||
prach_len = 4096+Ncp;
|
prach_len = 4096+Ncp;
|
||||||
} else {
|
} else {
|
||||||
idft24576(prachF,prach2);
|
idft24576(prachF,prach2,1);
|
||||||
memmove( prach, prach+49152, Ncp<<2 );
|
memmove( prach, prach+49152, Ncp<<2 );
|
||||||
prach_len = 24576+Ncp;
|
prach_len = 24576+Ncp;
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
|||||||
memmove( prach, prach+6144, Ncp<<2 );
|
memmove( prach, prach+6144, Ncp<<2 );
|
||||||
prach_len = 3072+Ncp;
|
prach_len = 3072+Ncp;
|
||||||
} else {
|
} else {
|
||||||
idft18432(prachF,prach2);
|
idft18432(prachF,prach2,1);
|
||||||
memmove( prach, prach+36864, Ncp<<2 );
|
memmove( prach, prach+36864, Ncp<<2 );
|
||||||
prach_len = 18432+Ncp;
|
prach_len = 18432+Ncp;
|
||||||
printf("Generated prach for 100 PRB, 3/4 sampling\n");
|
printf("Generated prach for 100 PRB, 3/4 sampling\n");
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
#include "PHY/phy_extern_ue.h"
|
#include "PHY/phy_extern_ue.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "PHY/phy_extern_ue.h"
|
#include "PHY/phy_extern_ue.h"
|
||||||
#include "SCHED_UE/sched_UE.h"
|
#include "SCHED_UE/sched_UE.h"
|
||||||
#include "LAYER2/MAC/mac.h"
|
#include "LAYER2/MAC/mac.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "transport_proto_ue.h"
|
#include "transport_proto_ue.h"
|
||||||
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "PHY/defs_UE.h"
|
#include "PHY/defs_UE.h"
|
||||||
#include "PHY/phy_extern_ue.h"
|
#include "PHY/phy_extern_ue.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
|
||||||
unsigned short msrsb_6_40[8][4] = {{36,12,4,4},
|
unsigned short msrsb_6_40[8][4] = {{36,12,4,4},
|
||||||
{32,16,8,4},
|
{32,16,8,4},
|
||||||
@@ -134,7 +134,6 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
|
|||||||
//uint32_t subframe_offset;
|
//uint32_t subframe_offset;
|
||||||
uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth;
|
uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth;
|
||||||
uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
|
uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
|
||||||
uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig;
|
|
||||||
uint8_t n_RRC = soundingrs_ul_config_dedicated->freqDomainPosition;
|
uint8_t n_RRC = soundingrs_ul_config_dedicated->freqDomainPosition;
|
||||||
uint8_t kTC = soundingrs_ul_config_dedicated->transmissionComb;
|
uint8_t kTC = soundingrs_ul_config_dedicated->transmissionComb;
|
||||||
|
|
||||||
@@ -144,7 +143,9 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
|
|||||||
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
||||||
|
|
||||||
LOG_D(PHY,"SRS root sequence: u %d, v %d\n",u,v);
|
LOG_D(PHY,"SRS root sequence: u %d, v %d\n",u,v);
|
||||||
LOG_D(PHY,"CommonSrsConfig: Csrs %d, Ssrs %d, AnSrsSimultan %d \n",Csrs,Ssrs,frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission);
|
LOG_D(PHY,"CommonSrsConfig: Csrs %d, Ssrs %d, AnSrsSimultan %d \n",Csrs,
|
||||||
|
frame_parms->soundingrs_ul_config_common.srs_SubframeConfig,
|
||||||
|
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission);
|
||||||
LOG_D(PHY,"DedicatedSrsConfig: Bsrs %d, bhop %d, nRRC %d, Isrs %d, kTC %d, n_SRS %d\n",Bsrs,soundingrs_ul_config_dedicated->srs_HoppingBandwidth,n_RRC
|
LOG_D(PHY,"DedicatedSrsConfig: Bsrs %d, bhop %d, nRRC %d, Isrs %d, kTC %d, n_SRS %d\n",Bsrs,soundingrs_ul_config_dedicated->srs_HoppingBandwidth,n_RRC
|
||||||
,soundingrs_ul_config_dedicated->srs_ConfigIndex,kTC
|
,soundingrs_ul_config_dedicated->srs_ConfigIndex,kTC
|
||||||
,soundingrs_ul_config_dedicated->cyclicShift);
|
,soundingrs_ul_config_dedicated->cyclicShift);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "PHY/CODING/coding_extern.h"
|
#include "PHY/CODING/coding_extern.h"
|
||||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||||
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
|
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
//#define DEBUG_ULSCH_CODING
|
//#define DEBUG_ULSCH_CODING
|
||||||
//#define DEBUG_ULSCH_FREE 1
|
//#define DEBUG_ULSCH_FREE 1
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
|
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
|
||||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||||
#include "modulation_eNB.h"
|
#include "modulation_eNB.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
int beam_precoding(int32_t **txdataF,
|
int beam_precoding(int32_t **txdataF,
|
||||||
int32_t **txdataF_BF,
|
int32_t **txdataF_BF,
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ This section deals with basic functions for OFDM Modulation.
|
|||||||
#include "PHY/defs_eNB.h"
|
#include "PHY/defs_eNB.h"
|
||||||
#include "PHY/defs_gNB.h"
|
#include "PHY/defs_gNB.h"
|
||||||
#include "PHY/impl_defs_top.h"
|
#include "PHY/impl_defs_top.h"
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "modulation_common.h"
|
#include "modulation_common.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||||
//#define DEBUG_OFDM_MOD
|
//#define DEBUG_OFDM_MOD
|
||||||
|
|||||||
@@ -20,282 +20,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PHY/defs_UE.h"
|
#include "PHY/defs_UE.h"
|
||||||
#include "PHY/defs_nr_UE.h"
|
|
||||||
#include "modulation_UE.h"
|
#include "modulation_UE.h"
|
||||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
|
||||||
|
|
||||||
//#define DEBUG_FEP
|
//#define DEBUG_FEP
|
||||||
|
|
||||||
#define SOFFSET 0
|
#define SOFFSET 0
|
||||||
|
|
||||||
int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
|
||||||
unsigned char l,
|
|
||||||
unsigned char Ns,
|
|
||||||
int sample_offset,
|
|
||||||
int no_prefix,
|
|
||||||
int reset_freq_est,
|
|
||||||
NR_CHANNEL_EST_t channel)
|
|
||||||
{
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
|
||||||
NR_UE_COMMON *common_vars = &ue->common_vars;
|
|
||||||
uint8_t eNB_id = 0;//ue_common_vars->eNb_id;
|
|
||||||
unsigned char aa;
|
|
||||||
unsigned char symbol = l;//+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
|
|
||||||
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
|
|
||||||
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
|
|
||||||
unsigned int subframe_offset;//,subframe_offset_F;
|
|
||||||
unsigned int slot_offset;
|
|
||||||
//int i;
|
|
||||||
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
|
|
||||||
unsigned int rx_offset;
|
|
||||||
//NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0];
|
|
||||||
uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset+516;
|
|
||||||
uint16_t nb_rb_coreset = 24;
|
|
||||||
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset;
|
|
||||||
uint16_t nb_rb_pdsch = 100;
|
|
||||||
|
|
||||||
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
|
|
||||||
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
|
|
||||||
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
|
|
||||||
int uespec_pilot[9][1200];*/
|
|
||||||
|
|
||||||
void (*dft)(int16_t *,int16_t *, int);
|
|
||||||
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
|
|
||||||
|
|
||||||
switch (frame_parms->ofdm_symbol_size) {
|
|
||||||
case 128:
|
|
||||||
dft = dft128;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 256:
|
|
||||||
dft = dft256;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 512:
|
|
||||||
dft = dft512;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1024:
|
|
||||||
dft = dft1024;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1536:
|
|
||||||
dft = dft1536;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2048:
|
|
||||||
dft = dft2048;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
dft = dft512;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (no_prefix) {
|
|
||||||
subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
|
|
||||||
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2);
|
|
||||||
} else {
|
|
||||||
subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
|
|
||||||
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if (l<0 || l>=7-frame_parms->Ncp) {
|
|
||||||
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
|
|
||||||
return(-1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (Ns<0 || Ns>=20) {
|
|
||||||
printf("slot_fep: Ns must be between 0 and 19\n");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
|
||||||
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
|
||||||
|
|
||||||
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
|
|
||||||
// Align with 256 bit
|
|
||||||
// rx_offset = rx_offset&0xfffffff8;
|
|
||||||
|
|
||||||
if (l==0) {
|
|
||||||
|
|
||||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
|
||||||
memcpy((short *)&common_vars->rxdata[aa][frame_length_samples],
|
|
||||||
(short *)&common_vars->rxdata[aa][0],
|
|
||||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
|
||||||
|
|
||||||
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
|
|
||||||
memcpy((void *)tmp_dft_in,
|
|
||||||
(void *)&common_vars->rxdata[aa][rx_offset % frame_length_samples],
|
|
||||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
|
||||||
dft((int16_t *)tmp_dft_in,
|
|
||||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
|
||||||
} else { // use dft input from RX buffer directly
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->rx_dft_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
|
||||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->rx_dft_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
|
|
||||||
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
// if (ue->frame <100)
|
|
||||||
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
|
|
||||||
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
|
||||||
memcpy((void *)&common_vars->rxdata[aa][frame_length_samples],
|
|
||||||
(void *)&common_vars->rxdata[aa][0],
|
|
||||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->rx_dft_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
|
|
||||||
memcpy((void *)tmp_dft_in,
|
|
||||||
(void *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
|
||||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
|
||||||
dft((int16_t *)tmp_dft_in,
|
|
||||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
|
||||||
} else { // use dft input from RX buffer directly
|
|
||||||
|
|
||||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
|
||||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
|
||||||
}
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->rx_dft_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
// if (ue->frame <100)
|
|
||||||
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ue->perfect_ce == 0) {
|
|
||||||
|
|
||||||
switch(channel){
|
|
||||||
case NR_PBCH_EST:
|
|
||||||
//if ((l>4) && (l<8)) {
|
|
||||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
|
||||||
|
|
||||||
//#ifdef DEBUG_FEP
|
|
||||||
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
|
||||||
//#endif
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
nr_pbch_channel_estimation(ue,eNB_id,0,
|
|
||||||
Ns,
|
|
||||||
aa,
|
|
||||||
l,
|
|
||||||
symbol);
|
|
||||||
//}
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// do frequency offset estimation here!
|
|
||||||
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
printf("Frequency offset estimation\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (l==(4-frame_parms->Ncp)) {
|
|
||||||
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->dlsch_freq_offset_estimation_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[0],
|
|
||||||
frame_parms,
|
|
||||||
l,
|
|
||||||
&common_vars->freq_offset,
|
|
||||||
reset_freq_est);*/
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_PDCCH_EST:
|
|
||||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
printf("PDCCH Channel estimation eNB %d, aatx %d, slot %d, symbol %d start_sc %d\n",eNB_id,aa,Ns,l,coreset_start_subcarrier);
|
|
||||||
#endif
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
nr_pdcch_channel_estimation(ue,eNB_id,0,
|
|
||||||
Ns,
|
|
||||||
aa,
|
|
||||||
l,
|
|
||||||
symbol,
|
|
||||||
coreset_start_subcarrier,
|
|
||||||
nb_rb_coreset);
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_PDSCH_EST:
|
|
||||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
|
||||||
#endif
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
nr_pdsch_channel_estimation(ue,eNB_id,0,
|
|
||||||
Ns,
|
|
||||||
aa,
|
|
||||||
l,
|
|
||||||
symbol,
|
|
||||||
bwp_start_subcarrier,
|
|
||||||
nb_rb_pdsch);
|
|
||||||
#if UE_TIMING_TRACE
|
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_SSS_EST:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(PHY,"[UE][FATAL] Unknown channel format %d\n",channel);
|
|
||||||
return(-1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_FEP
|
|
||||||
printf("slot_fep: done\n");
|
|
||||||
#endif
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int slot_fep(PHY_VARS_UE *ue,
|
int slot_fep(PHY_VARS_UE *ue,
|
||||||
unsigned char l,
|
unsigned char l,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
|
|||||||
@@ -0,0 +1,298 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||||
|
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.openairinterface.org/?page_id=698
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*-------------------------------------------------------------------------------
|
||||||
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
|
* contact@openairinterface.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PHY/defs_UE.h"
|
||||||
|
#include "PHY/defs_nr_UE.h"
|
||||||
|
#include "modulation_UE.h"
|
||||||
|
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||||
|
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||||
|
|
||||||
|
//#define DEBUG_FEP
|
||||||
|
|
||||||
|
#define SOFFSET 0
|
||||||
|
|
||||||
|
int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||||
|
unsigned char l,
|
||||||
|
unsigned char Ns,
|
||||||
|
int sample_offset,
|
||||||
|
int no_prefix,
|
||||||
|
int reset_freq_est,
|
||||||
|
NR_CHANNEL_EST_t channel)
|
||||||
|
{
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||||
|
NR_UE_COMMON *common_vars = &ue->common_vars;
|
||||||
|
uint8_t eNB_id = 0;//ue_common_vars->eNb_id;
|
||||||
|
unsigned char aa;
|
||||||
|
unsigned char symbol = l;//+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
|
||||||
|
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
|
||||||
|
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
|
||||||
|
unsigned int subframe_offset;//,subframe_offset_F;
|
||||||
|
unsigned int slot_offset;
|
||||||
|
//int i;
|
||||||
|
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
|
||||||
|
unsigned int rx_offset;
|
||||||
|
//NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0];
|
||||||
|
uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset+516;
|
||||||
|
uint16_t nb_rb_coreset = 24;
|
||||||
|
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset;
|
||||||
|
uint16_t nb_rb_pdsch = 100;
|
||||||
|
|
||||||
|
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
|
||||||
|
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
|
||||||
|
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
|
||||||
|
int uespec_pilot[9][1200];*/
|
||||||
|
|
||||||
|
void (*dft)(int16_t *,int16_t *, int);
|
||||||
|
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
|
||||||
|
|
||||||
|
switch (frame_parms->ofdm_symbol_size) {
|
||||||
|
case 128:
|
||||||
|
dft = dft128;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 256:
|
||||||
|
dft = dft256;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 512:
|
||||||
|
dft = dft512;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1024:
|
||||||
|
dft = dft1024;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1536:
|
||||||
|
dft = dft1536;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2048:
|
||||||
|
dft = dft2048;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
dft = dft512;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (no_prefix) {
|
||||||
|
subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
|
||||||
|
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2);
|
||||||
|
} else {
|
||||||
|
subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
|
||||||
|
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (l<0 || l>=7-frame_parms->Ncp) {
|
||||||
|
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
|
||||||
|
return(-1);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (Ns<0 || Ns>=20) {
|
||||||
|
printf("slot_fep: Ns must be between 0 and 19\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||||
|
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
||||||
|
|
||||||
|
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
|
||||||
|
// Align with 256 bit
|
||||||
|
// rx_offset = rx_offset&0xfffffff8;
|
||||||
|
|
||||||
|
if (l==0) {
|
||||||
|
|
||||||
|
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||||
|
memcpy((short *)&common_vars->rxdata[aa][frame_length_samples],
|
||||||
|
(short *)&common_vars->rxdata[aa][0],
|
||||||
|
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||||
|
|
||||||
|
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
|
||||||
|
memcpy((void *)tmp_dft_in,
|
||||||
|
(void *)&common_vars->rxdata[aa][rx_offset % frame_length_samples],
|
||||||
|
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||||
|
dft((int16_t *)tmp_dft_in,
|
||||||
|
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||||
|
} else { // use dft input from RX buffer directly
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->rx_dft_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||||
|
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->rx_dft_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
|
||||||
|
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
||||||
|
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
// if (ue->frame <100)
|
||||||
|
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
|
||||||
|
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||||
|
memcpy((void *)&common_vars->rxdata[aa][frame_length_samples],
|
||||||
|
(void *)&common_vars->rxdata[aa][0],
|
||||||
|
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->rx_dft_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
|
||||||
|
memcpy((void *)tmp_dft_in,
|
||||||
|
(void *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||||
|
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||||
|
dft((int16_t *)tmp_dft_in,
|
||||||
|
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||||
|
} else { // use dft input from RX buffer directly
|
||||||
|
|
||||||
|
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||||
|
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||||
|
}
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->rx_dft_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
// if (ue->frame <100)
|
||||||
|
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ue->perfect_ce == 0) {
|
||||||
|
|
||||||
|
switch(channel){
|
||||||
|
case NR_PBCH_EST:
|
||||||
|
//if ((l>4) && (l<8)) {
|
||||||
|
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||||
|
|
||||||
|
//#ifdef DEBUG_FEP
|
||||||
|
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
||||||
|
//#endif
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
nr_pbch_channel_estimation(ue,eNB_id,0,
|
||||||
|
Ns,
|
||||||
|
aa,
|
||||||
|
l,
|
||||||
|
symbol);
|
||||||
|
//}
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// do frequency offset estimation here!
|
||||||
|
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
printf("Frequency offset estimation\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (l==(4-frame_parms->Ncp)) {
|
||||||
|
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[0],
|
||||||
|
frame_parms,
|
||||||
|
l,
|
||||||
|
&common_vars->freq_offset,
|
||||||
|
reset_freq_est);*/
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_PDCCH_EST:
|
||||||
|
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||||
|
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
printf("PDCCH Channel estimation eNB %d, aatx %d, slot %d, symbol %d start_sc %d\n",eNB_id,aa,Ns,l,coreset_start_subcarrier);
|
||||||
|
#endif
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
nr_pdcch_channel_estimation(ue,eNB_id,0,
|
||||||
|
Ns,
|
||||||
|
aa,
|
||||||
|
l,
|
||||||
|
symbol,
|
||||||
|
coreset_start_subcarrier,
|
||||||
|
nb_rb_coreset);
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_PDSCH_EST:
|
||||||
|
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||||
|
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
||||||
|
#endif
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
nr_pdsch_channel_estimation(ue,eNB_id,0,
|
||||||
|
Ns,
|
||||||
|
aa,
|
||||||
|
l,
|
||||||
|
symbol,
|
||||||
|
bwp_start_subcarrier,
|
||||||
|
nb_rb_pdsch);
|
||||||
|
#if UE_TIMING_TRACE
|
||||||
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_SSS_EST:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
LOG_E(PHY,"[UE][FATAL] Unknown channel format %d\n",channel);
|
||||||
|
return(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_FEP
|
||||||
|
printf("slot_fep: done\n");
|
||||||
|
#endif
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
|
|||||||
uint32_t slot_offset,slot_offset2;
|
uint32_t slot_offset,slot_offset2;
|
||||||
uint8_t aa;
|
uint8_t aa;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
LTE_DL_FRAME_PARMS *frame_parms=&ru->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms=ru->frame_parms;
|
||||||
|
|
||||||
switch (frame_parms->N_RB_UL) {
|
switch (frame_parms->N_RB_UL) {
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,14 @@
|
|||||||
\param symbol symbol within frame
|
\param symbol symbol within frame
|
||||||
*/
|
*/
|
||||||
int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t eNB_id,
|
uint8_t eNB_id,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned char p,
|
unsigned char p,
|
||||||
unsigned char l,
|
unsigned char l,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
unsigned short coreset_start_subcarrier,
|
unsigned short coreset_start_subcarrier,
|
||||||
unsigned short nb_rb_coreset);
|
unsigned short nb_rb_coreset);
|
||||||
|
|
||||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t eNB_id,
|
uint8_t eNB_id,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "PHY/CODING/coding_extern.h"
|
#include "PHY/CODING/coding_extern.h"
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
#include "SIMULATION/TOOLS/sim.h"
|
//#include "SIMULATION/TOOLS/sim.h"
|
||||||
|
|
||||||
//#define DEBUG_PBCH 1
|
//#define DEBUG_PBCH 1
|
||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
//#include "PHY/extern.h"
|
//#include "PHY/extern.h"
|
||||||
//#include "LAYER2/MAC/extern.h"
|
//#include "LAYER2/MAC/extern.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
#define DEBUG_PUCCH_TX
|
#define DEBUG_PUCCH_TX
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
lte_dfts_sse4: lte_dfts.c
|
lte_dfts_sse4: lte_dfts.c
|
||||||
gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
gcc -O2 -std=gnu99 -msse4.1 -g -ggdb -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 -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||||
|
|
||||||
lte_dfts_avx2: lte_dfts.c
|
lte_dfts_avx2: lte_dfts.c
|
||||||
gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o lte_dfts_avx2 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 -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||||
|
|
||||||
lte_dfts_avx2.s: lte_dfts.c
|
lte_dfts_avx2.s: lte_dfts.c
|
||||||
gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
gcc -O2 -std=gnu99 -mavx2 -S 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 -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||||
|
|
||||||
lte_dfts_sse4.s: lte_dfts.c
|
lte_dfts_sse4.s: lte_dfts.c
|
||||||
gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
|
gcc -O2 -std=gnu99 -msse4.1 -S 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 -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm # -DD256STATS #-DD64STATS
|
||||||
|
|
||||||
dft_cycles_avx2: lte_dfts_avx2
|
dft_cycles_avx2: lte_dfts_avx2
|
||||||
./lte_dfts_avx2 | egrep cycles
|
./lte_dfts_avx2 | egrep cycles
|
||||||
|
|||||||
+897
-10709
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user