diff --git a/ci-scripts/Jenkinsfile-inria-r2lab b/ci-scripts/Jenkinsfile-inria-r2lab index ca6893dc4f..ada52277f4 100644 --- a/ci-scripts/Jenkinsfile-inria-r2lab +++ b/ci-scripts/Jenkinsfile-inria-r2lab @@ -62,6 +62,7 @@ def r2labUE0IpAddr = r2labBaseIpAddr + r2labUE0Idx def r2labENB1Idx = '16' def r2labENB1 = 'fit' + r2labENB1Idx def r2labENB1IpAddr = r2labBaseIpAddr + r2labENB1Idx +def r2labDoAllOff = true pipeline { agent { @@ -136,22 +137,28 @@ pipeline { sh "python3 /home/eurecom/inria-scripts/booking-lease.py --book-lease --from ${BOOK_TIMESTAMP}T${r2labStartTime} --duration ${r2labDuration} --slice inria_oaici ${r2labuser} ${r2labpassword}" sh "python3 /home/eurecom/inria-scripts/booking-lease.py --get-leases ${r2labuser} ${r2labpassword} | grep -v nightly" } + + // Adding a tempo after booking leases + sh "sleep 10" + LEASE_STATUS = sh returnStdout: true, script: "ssh -t inria_oaici@faraday.inria.fr 'rleases --check'" + LEASE_STATUS = LEASE_STATUS.trim() + if (LEASE_STATUS ==~ /.*Access currently denied to inria_oaici.*/) { + r2labDoAllOff = false + currentBuild.result = 'ABORTED' + error('Stopping early because R2LAB not available') + } } } } stage ("Load Images") { steps { script { - // Adding a tempo after booking leases - sh "sleep 10" - sh "ssh -t inria_oaici@faraday.inria.fr 'rleases --check'" sh "ssh -t inria_oaici@faraday.inria.fr 'all-off'" sh "sleep 10" echo '\u2705 \u001B[32mLoad Image for Python Executor\u001B[0m' try { - //sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labPythonExeIdx} > /dev/null 2>&1'" - sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labPythonExeIdx}'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labPythonExeIdx} > /dev/null 2>&1'" } catch (Exception e) { echo "Why is it wrong?" } @@ -164,14 +171,12 @@ pipeline { echo '\u2705 \u001B[32mLoad Image for two (2) eNBs\u001B[0m' try { - //sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labENB0Idx},${r2labENB1Idx} > /dev/null 2>&1'" - sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labENB0Idx},${r2labENB1Idx}" + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labENB0Idx},${r2labENB1Idx} > /dev/null 2>&1'" } catch (Exception e) { echo "Why is it wrong?" } try { - //sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labENB0Idx},${r2labENB1Idx}'" - sh "ssh -t inria_oaici@faraday.inria.fr 'rwait ${r2labENB0Idx},${r2labENB1Idx}'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labENB0Idx},${r2labENB1Idx}'" } catch (Exception e) { echo "Why is it wrong?" } @@ -441,9 +446,11 @@ pipeline { post { always { script { - echo '\u2705 \u001B[32mShutdown every node\u001B[0m' - sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' - sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' + if (r2labDoAllOff) { + echo '\u2705 \u001B[32mShutdown every node\u001B[0m' + sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' + sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' + } } } } diff --git a/ci-scripts/checkAddedWarnings.sh b/ci-scripts/checkAddedWarnings.sh index d366059a85..bda8287a78 100755 --- a/ci-scripts/checkAddedWarnings.sh +++ b/ci-scripts/checkAddedWarnings.sh @@ -110,7 +110,7 @@ MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-sta NB_WARNINGS_FILES=0 # Retrieve list of warnings -LIST_WARNING_FILES=`egrep "error:|warning:" archives/*/*.Rel15.txt archives/*/basic_simulator_*txt | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto" | sed -e "s#^.*/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" -e "s#common/utils/.*/itti#common/utils/itti#" | awk -F ":" '{print $1}' | sort | uniq` +LIST_WARNING_FILES=`egrep "error:|warning:" archives/*/*.Rel15.txt | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto" | sed -e "s#^.*/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" -e "s#common/utils/.*/itti#common/utils/itti#" | awk -F ":" '{print $1}' | sort | uniq` echo "" echo "List of files that have been modified by the Merge Request AND" diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py new file mode 100644 index 0000000000..4ca36b8cf0 --- /dev/null +++ b/ci-scripts/cls_physim.py @@ -0,0 +1,191 @@ +# * 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 +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#to use logging.info() +import logging +#to create a SSH object locally in the methods +import sshconnection +#to update the HTML object +import html +from multiprocessing import SimpleQueue +#for log folder maintenance +import os + +class PhySim: + def __init__(self): + self.buildargs = "" + self.runargs = "" + self.eNBIpAddr = "" + self.eNBUserName = "" + self.eNBPassWord = "" + self.eNBSourceCodePath = "" + self.ranRepository = "" + self.ranBranch = "" + self.ranCommitID= "" + self.ranAllowMerge= "" + self.ranTargetBranch= "" + self.exitStatus=0 + self.forced_workspace_cleanup=False + #private attributes + self.__workSpacePath='' + self.__buildLogFile='compile_phy_sim.log' + self.__runLogFile='' + self.__runResults=[] + self.__runLogPath='phy_sim_logs' + + +#----------------- +#PRIVATE Methods +#----------------- + + def __CheckResults_PhySim(self,HTML,CONST,testcase_id): + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + #retrieve run log file and store it locally$ + mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') + mySSH.close() + #parse results looking for Encoding and Decoding mean values + self.__runResults=[] + with open(self.__runLogFile) as f: + for line in f: + if 'mean' in line: + self.__runResults.append(line) + #the values are appended for each mean value (2), so we take these 2 values from the list + info=self.__runResults[0]+self.__runResults[1] + + #once parsed move the local logfile to its folder for tidiness + os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') + + #updating the HTML with results + html_cell = '
' + info  + '
' + html_queue=SimpleQueue() + html_queue.put(html_cell) + HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, html_queue) + return HTML + + + def __CheckBuild_PhySim(self, HTML, CONST): + self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + #retrieve compile log file and store it locally + mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__buildLogFile, '.') + #delete older run log file + mySSH.command('rm ' + self.__workSpacePath+self.__runLogFile, '\$', 5) + mySSH.close() + #check build result from local compile log file + buildStatus=False + with open(self.__buildLogFile) as f: + #nr_prachsim is the last compile step + if 'nr_prachsim compiled' in f.read(): + buildStatus=True + #update HTML based on build status + if buildStatus: + HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'LDPC') + self.exitStatus=0 + else: + logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC') + HTML.CreateHtmlTabFooter(False) + #exitStatus=1 will do a sys.exit in main + self.exitStatus=1 + return HTML + + +#-----------------$ +#PUBLIC Methods$ +#-----------------$ + + def Build_PhySim(self,htmlObj,constObj): + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + + #create working dir + mySSH.command('mkdir -p ' + self.eNBSourceCodePath, '\$', 5) + mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) + + if not self.ranRepository.lower().endswith('.git'): + self.ranRepository+='.git' + + #git clone + mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.ranRepository + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + #git config + mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) + + #git clean depending on self.forced_workspace_cleanup captured in xml + if self.forced_workspace_cleanup==True: + logging.info('Cleaning workspace ...') + mySSH.command('echo ' + self.eNBPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + else: + logging.info('Workspace cleaning was disabled') + + # if the commit ID is provided, use it to point to it + if self.ranCommitID != '': + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should have already been checked earlier + if (self.ranAllowMerge): + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.info('Merging with the target branch: ' + self.ranTargetBranch) + mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + + #build + mySSH.command('source oaienv', '\$', 5) + mySSH.command('cd cmake_targets', '\$', 5) + mySSH.command('mkdir -p log', '\$', 5) + mySSH.command('chmod 777 log', '\$', 5) + mySSH.command('stdbuf -o0 ./build_oai ' + self.buildargs + ' 2>&1 | stdbuf -o0 tee ' + self.__buildLogFile, 'Bypassing the Tests|build have failed', 1500) + + mySSH.close() + #check build status and update HTML object + lHTML = html.HTMLManagement() + lHTML=self.__CheckBuild_PhySim(htmlObj,constObj) + return lHTML + + + def Run_PhySim(self,htmlObj,constObj,testcase_id): + #create run logs folder locally + os.system('mkdir -p ./'+self.__runLogPath) + #log file is tc_.log remotely + self.__runLogFile='physim_'+str(testcase_id)+'.log' + #open a session for test run + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + mySSH.command('cd '+self.__workSpacePath,'\$',5) + #run and redirect the results to a log file + mySSH.command(self.__workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) + mySSH.close() + #return updated HTML to main + lHTML = html.HTMLManagement() + lHTML=self.__CheckResults_PhySim(htmlObj,constObj,testcase_id) + return lHTML diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py index 1e7e84fb32..c5698c5a3e 100644 --- a/ci-scripts/constants.py +++ b/ci-scripts/constants.py @@ -57,6 +57,7 @@ OAI_UE_PROCESS_ASSERTION = -22 OAI_UE_PROCESS_FAILED = -23 OAI_UE_PROCESS_NO_TUNNEL_INTERFACE = -24 OAI_UE_PROCESS_SEG_FAULT = -25 +OAI_UE_PROCESS_NO_MBMS_MSGS = -26 OAI_UE_PROCESS_OK = +6 UE_STATUS_DETACHED = 0 diff --git a/ci-scripts/cppcheck_suppressions.list b/ci-scripts/cppcheck_suppressions.list index cad2aab88b..727fd22e74 100644 --- a/ci-scripts/cppcheck_suppressions.list +++ b/ci-scripts/cppcheck_suppressions.list @@ -37,6 +37,7 @@ memleak:openair2/UTIL/OMG/omg_hashtable.c // _emm_as_encode function creates the encoded buffer // memleak:openair3/NAS/UE/EMM/SAP/emm_as.c +memleak:openair1/PHY/INIT/nr_init_ue.c //----------------------------------------------------------------------------- //***************************************************************************** // section for files not used in oai exec's included in CI. diff --git a/ci-scripts/doc/vm_based_simulator_env.md b/ci-scripts/doc/vm_based_simulator_env.md index 5dbcfbd931..95b9d920d5 100644 --- a/ci-scripts/doc/vm_based_simulator_env.md +++ b/ci-scripts/doc/vm_based_simulator_env.md @@ -38,7 +38,6 @@ Last point, this documentation is valid for all CI-supported branches: * `master` * `develop` -* `develop-nr` But the feature set may not be aligned. **The principles still apply.** diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index 3a52a6118c..09d500f203 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -63,6 +63,8 @@ class EPCManagement(): self.PcapFileName = '' self.htmlObj = None self.testCase_id = '' + self.MmeIPAddress = '' + self.containerPrefix = 'prod' #----------------------------------------------------------- # Setter and Getters on Public Members @@ -92,6 +94,10 @@ class EPCManagement(): self.htmlObj = obj def SetTestCase_id(self, idx): self.testCase_id = idx + def GetMmeIPAddress(self): + return self.MmeIPAddress + def SetContainerPrefix(self, prefix): + self.containerPrefix = prefix #----------------------------------------------------------- # EPC management functions @@ -104,7 +110,14 @@ class EPCManagement(): sys.exit('Insufficient EPC Parameters') mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 Cassandra-based HSS in Docker') + mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) + mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts', '\$', 5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-hss /bin/bash -c "nohup tshark -i eth0 -i eth1 -w /tmp/hss_check_run.pcap 2>&1 > /dev/null"', '\$', 5) + time.sleep(5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-hss /bin/bash -c "nohup ./bin/oai_hss -j ./etc/hss_rel14.json --reloadkey true > hss_check_run.log 2>&1"', '\$', 5) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 Cassandra-based HSS') mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) logging.debug('\u001B[1m Launching tshark on all interfaces \u001B[0m') @@ -142,7 +155,12 @@ class EPCManagement(): sys.exit('Insufficient EPC Parameters') mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 MME in Docker') + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup tshark -i eth0 -i lo:s10 -w /tmp/mme_check_run.pcap 2>&1 > /dev/null"', '\$', 5) + time.sleep(5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup ./bin/oai_mme -c ./etc/mme.conf > mme_check_run.log 2>&1"', '\$', 5) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 MME') mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('echo ' + self.Password + ' | sudo -S rm -f mme_' + self.testCase_id + '.log', '\$', 5) @@ -169,6 +187,25 @@ class EPCManagement(): if self.htmlObj is not None: self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) + def SetMmeIPAddress(self): + # Not an error if we don't need an EPC + if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '': + return + if self.IPAddress == 'none': + return + # Only in case of Docker containers, MME IP address is not the EPC HOST IP address + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH = SSH.SSHConnection() + mySSH.open(self.IPAddress, self.UserName, self.Password) + mySSH.command('docker inspect --format="MME_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ' + self.containerPrefix + '-oai-mme', '\$', 5) + result = re.search('MME_IP_ADDR = (?P[0-9\.]+)', mySSH.getBefore()) + if result is not None: + self.MmeIPAddress = result.group('mme_ip_addr') + logging.debug('MME IP Address is ' + self.MmeIPAddress) + mySSH.close() + else: + self.MmeIPAddress = self.IPAddress + def InitializeSPGW(self): if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '': HELP.GenericHelp(CONST.Version) @@ -176,7 +213,15 @@ class EPCManagement(): sys.exit('Insufficient EPC Parameters') mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 SPGW-CUPS in Docker') + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "nohup tshark -i eth0 -i lo:p5c -i lo:s5c -w /tmp/spgwc_check_run.pcap 2>&1 > /dev/null"', '\$', 5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "nohup tshark -i eth0 -w /tmp/spgwu_check_run.pcap 2>&1 > /dev/null"', '\$', 5) + time.sleep(5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "nohup ./bin/oai_spgwc -o -c ./etc/spgw_c.conf > spgwc_check_run.log 2>&1"', '\$', 5) + time.sleep(5) + mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "nohup ./bin/oai_spgwu -o -c ./etc/spgw_u.conf > spgwu_check_run.log 2>&1"', '\$', 5) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 SPGW-CUPS') mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('echo ' + self.Password + ' | sudo -S rm -f spgwc_' + self.testCase_id + '.log spgwu_' + self.testCase_id + '.log', '\$', 5) @@ -205,8 +250,11 @@ class EPCManagement(): try: mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - mySSH.command('stdbuf -o0 ps -aux | grep --color=never hss | grep -v grep', '\$', 5) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "ps aux | grep oai_hss"', '\$', 5) + else: + mySSH.command('stdbuf -o0 ps -aux | grep --color=never hss | grep -v grep', '\$', 5) + if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): result = re.search('oai_hss -j', mySSH.getBefore()) elif re.match('OAI', self.Type, re.IGNORECASE): result = re.search('\/bin\/bash .\/run_', mySSH.getBefore()) @@ -227,8 +275,13 @@ class EPCManagement(): try: mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - mySSH.command('stdbuf -o0 ps -aux | grep --color=never mme | grep -v grep', '\$', 5) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "ps aux | grep oai_mme"', '\$', 5) + else: + mySSH.command('stdbuf -o0 ps -aux | grep --color=never mme | grep -v grep', '\$', 5) + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + result = re.search('oai_mme -c ', mySSH.getBefore()) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): result = re.search('mme -c', mySSH.getBefore()) elif re.match('OAI', self.Type, re.IGNORECASE): result = re.search('\/bin\/bash .\/run_', mySSH.getBefore()) @@ -249,7 +302,13 @@ class EPCManagement(): try: mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "ps aux | grep oai_spgwc"', '\$', 5) + result = re.search('oai_spgwc -o -c ', mySSH.getBefore()) + if result is not None: + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "ps aux | grep oai_spgwu"', '\$', 5) + result = re.search('oai_spgwu -o -c ', mySSH.getBefore()) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('stdbuf -o0 ps -aux | grep --color=never spgw | grep -v grep', '\$', 5) result = re.search('spgwu -c ', mySSH.getBefore()) elif re.match('OAI', self.Type, re.IGNORECASE): @@ -272,7 +331,14 @@ class EPCManagement(): def TerminateHSS(self): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGINT oai_hss tshark"', '\$', 5) + time.sleep(2) + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "ps aux | grep oai_hss"', '\$', 5) + result = re.search('oai_hss -j ', mySSH.getBefore()) + if result is not None: + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGKILL oai_hss"', '\$', 5) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGINT oai_hss || true', '\$', 5) time.sleep(2) mySSH.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5) @@ -301,7 +367,14 @@ class EPCManagement(): def TerminateMME(self): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGINT oai_mme tshark"', '\$', 5) + time.sleep(2) + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "ps aux | grep oai_mme"', '\$', 5) + result = re.search('oai_mme -c ', mySSH.getBefore()) + if result is not None: + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGKILL oai_mme"', '\$', 5) + elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGINT run_mme mme || true', '\$', 5) time.sleep(2) mySSH.command('stdbuf -o0 ps -aux | grep mme | grep -v grep', '\$', 5) @@ -321,7 +394,19 @@ class EPCManagement(): def TerminateSPGW(self): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) - if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGINT oai_spgwc tshark"', '\$', 5) + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "killall --signal SIGINT oai_spgwu tshark"', '\$', 5) + time.sleep(2) + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "ps aux | grep oai_spgwc"', '\$', 5) + result = re.search('oai_spgwc -o -c ', mySSH.getBefore()) + if result is not None: + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGKILL oai_spgwc"', '\$', 5) + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "ps aux | grep oai_spgwu"', '\$', 5) + result = re.search('oai_spgwu -o -c ', mySSH.getBefore()) + if result is not None: + mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "killall --signal SIGKILL oai_spgwu"', '\$', 5) + elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGINT spgwc spgwu || true', '\$', 5) time.sleep(2) mySSH.command('stdbuf -o0 ps -aux | grep spgw | grep -v grep', '\$', 5) @@ -355,7 +440,11 @@ class EPCManagement(): mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f hss.log.zip', '\$', 5) - if re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker cp ' + self.containerPrefix + '-oai-hss:/openair-hss/hss_check_run.log .', '\$', 60) + mySSH.command('docker cp ' + self.containerPrefix + '-oai-hss:/tmp/hss_check_run.pcap .', '\$', 60) + mySSH.command('zip hss.log.zip hss_check_run.*', '\$', 60) + elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip hss.log.zip hss*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm hss*.log', '\$', 5) if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): @@ -373,7 +462,11 @@ class EPCManagement(): mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f mme.log.zip', '\$', 5) - if re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker cp ' + self.containerPrefix + '-oai-mme:/openair-mme/mme_check_run.log .', '\$', 60) + mySSH.command('docker cp ' + self.containerPrefix + '-oai-mme:/tmp/mme_check_run.pcap .', '\$', 60) + mySSH.command('zip mme.log.zip mme_check_run.*', '\$', 60) + elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip mme.log.zip mme*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm mme*.log', '\$', 5) elif re.match('ltebox', self.Type, re.IGNORECASE): @@ -388,7 +481,13 @@ class EPCManagement(): mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f spgw.log.zip', '\$', 5) - if re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): + if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): + mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwc:/openair-spgwc/spgwc_check_run.log .', '\$', 60) + mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwu-tiny:/openair-spgwu-tiny/spgwu_check_run.log .', '\$', 60) + mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwc:/tmp/spgwc_check_run.pcap .', '\$', 60) + mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap .', '\$', 60) + mySSH.command('zip spgw.log.zip spgw*_check_run.*', '\$', 60) + elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip spgw.log.zip spgw*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm spgw*.log', '\$', 5) elif re.match('ltebox', self.Type, re.IGNORECASE): diff --git a/ci-scripts/html.py b/ci-scripts/html.py index 1a6e3f8fdb..8fa99fa61b 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -326,7 +326,7 @@ class HTMLManagement(): continue self.htmlFile.write(' \n') - self.htmlFile.write(' ' + str('eNB') + ' Server Characteristics\n') + self.htmlFile.write(' ' + str(machine) + ' Server Characteristics\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' OS Version\n') diff --git a/ci-scripts/main.py b/ci-scripts/main.py index a01eed2ac5..6bec183255 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -30,6 +30,7 @@ import constants as CONST + #----------------------------------------------------------- # Import #----------------------------------------------------------- @@ -176,7 +177,7 @@ class OaiCiTest(): SSH.command('mkdir -p log', '\$', 5) SSH.command('chmod 777 log', '\$', 5) # no need to remove in log (git clean did the trick) - SSH.command('stdbuf -o0 ./build_oai ' + self.Build_OAI_UE_args + ' 2>&1 | stdbuf -o0 tee compile_oai_ue.log', 'Bypassing the Tests|build have failed', 600) + SSH.command('stdbuf -o0 ./build_oai ' + self.Build_OAI_UE_args + ' 2>&1 | stdbuf -o0 tee compile_oai_ue.log', 'Bypassing the Tests|build have failed', 900) SSH.command('ls ran_build/build', '\$', 3) SSH.command('ls ran_build/build', '\$', 3) buildStatus = True @@ -332,12 +333,6 @@ class OaiCiTest(): logging.debug('Found a N3xx device --> resetting it') SSH.command('cd ' + self.UESourceCodePath, '\$', 5) # Initialize_OAI_UE_args usually start with -C and followed by the location in repository - # in case of NR-UE, we may have rrc_config_path (Temporary?) - modifiedUeOptions = str(self.Initialize_OAI_UE_args) - if RAN.Getair_interface() == 'nr': - result = re.search('--rrc_config_path ', modifiedUeOptions) - if result is not None: - modifiedUeOptions = modifiedUeOptions.replace('rrc_config_path ', 'rrc_config_path ' + self.UESourceCodePath + '/') SSH.command('source oaienv', '\$', 5) SSH.command('cd cmake_targets/ran_build/build', '\$', 5) if RAN.Getair_interface() == 'lte': @@ -352,7 +347,17 @@ class OaiCiTest(): SSH.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5) SSH.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf .u*', '\$', 5) SSH.command('echo ' + self.UEPassword + ' | sudo -S ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf -o .', '\$', 5) - SSH.command('echo "ulimit -c unlimited && ./'+ RAN.Getair_interface() +'-uesoftmodem ' + modifiedUeOptions + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) + else: + SSH.command('if [ -e rbconfig.raw ]; then echo ' + self.UEPassword + ' | sudo -S rm rbconfig.raw; fi', '\$', 5) + SSH.command('if [ -e rbconfig.raw ]; then echo ' + self.UEPassword + ' | sudo -S rm reconfig.raw; fi', '\$', 5) + # Copy the RAW files from gNB running directory (maybe on another machine) + copyin_res = SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/rbconfig.raw', '.') + if (copyin_res == 0): + SSH.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, './rbconfig.raw', self.UESourceCodePath + '/cmake_targets/ran_build/build') + copyin_res = SSH.copyin(RAN.GeteNBIPAddress(), RAN.GeteNBUserName(), RAN.GeteNBPassword(), RAN.GeteNBSourceCodePath() + '/cmake_targets/reconfig.raw', '.') + if (copyin_res == 0): + SSH.copyout(self.UEIPAddress, self.UEUserName, self.UEPassword, './reconfig.raw', self.UESourceCodePath + '/cmake_targets/ran_build/build') + SSH.command('echo "ulimit -c unlimited && ./'+ RAN.Getair_interface() +'-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) SSH.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) SSH.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5) self.UELogFile = 'ue_' + self.testCase_id + '.log' @@ -403,23 +408,50 @@ class OaiCiTest(): if (outterLoopCounter == 0): doOutterLoop = False continue + # We are now checking if sync w/ eNB DOES NOT OCCUR + # Usually during the cell synchronization stage, the UE returns with No cell synchronization message + # That is the case for LTE + # In NR case, it's a positive message that will show if synchronization occurs + doLoop = True if RAN.Getair_interface() == 'nr': - fullSyncStatus = True - doOutterLoop = False + loopCounter = 10 else: # We are now checking if sync w/ eNB DOES NOT OCCUR # Usually during the cell synchronization stage, the UE returns with No cell synchronization message - doLoop = True loopCounter = 10 - while (doLoop): - loopCounter = loopCounter - 1 - if (loopCounter == 0): + while (doLoop): + loopCounter = loopCounter - 1 + if (loopCounter == 0): + if RAN.Getair_interface() == 'nr': + # Here we do have great chances that UE did NOT cell-sync w/ gNB + doLoop = False + fullSyncStatus = False + logging.debug('Never seen the NR-Sync message (Measured Carrier Frequency) --> try again') + time.sleep(6) + # Stopping the NR-UE + SSH.command('ps -aux | grep --text --color=never softmodem | grep -v grep', '\$', 4) + result = re.search('nr-uesoftmodem', SSH.getBefore()) + if result is not None: + SSH.command('echo ' + self.UEPassword + ' | sudo -S killall --signal=SIGINT nr-uesoftmodem', '\$', 4) + time.sleep(6) + else: # Here we do have a great chance that the UE did cell-sync w/ eNB doLoop = False doOutterLoop = False fullSyncStatus = True continue - SSH.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) + SSH.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Frequency"', '\$', 4) + if RAN.Getair_interface() == 'nr': + # Positive messaging --> + result = re.search('Measured Carrier Frequency', SSH.getBefore()) + if result is not None: + doLoop = False + doOutterLoop = False + fullSyncStatus = True + else: + time.sleep(6) + else: + # Negative messaging --> result = re.search('No cell synchronization found', SSH.getBefore()) if result is None: time.sleep(6) @@ -432,13 +464,22 @@ class OaiCiTest(): result = re.search('lte-uesoftmodem', SSH.getBefore()) if result is not None: SSH.command('echo ' + self.UEPassword + ' | sudo -S killall --signal=SIGINT lte-uesoftmodem', '\$', 4) - outterLoopCounter = outterLoopCounter - 1 - if (outterLoopCounter == 0): - doOutterLoop = False + outterLoopCounter = outterLoopCounter - 1 + if (outterLoopCounter == 0): + doOutterLoop = False - if fullSyncStatus and gotSyncStatus and RAN.Getair_interface() == 'lte': - result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) - if result is None: + if fullSyncStatus and gotSyncStatus: + doInterfaceCheck = False + if RAN.Getair_interface() == 'lte': + result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) + if result is None: + doInterfaceCheck = True + # For the moment, only in explicit noS1 without kernel module (ie w/ tunnel interface) + if RAN.Getair_interface() == 'nr': + result = re.search('--noS1 --nokrnmod 1', str(self.Initialize_OAI_UE_args)) + if result is not None: + doInterfaceCheck = True + if doInterfaceCheck: SSH.command('ifconfig oaitun_ue1', '\$', 4) SSH.command('ifconfig oaitun_ue1', '\$', 4) # ifconfig output is different between ubuntu 16 and ubuntu 18 @@ -2396,6 +2437,7 @@ class OaiCiTest(): nrCRCOK = 0 mbms_messages = 0 HTML.SethtmlUEFailureMsg('') + global_status = CONST.ALL_PROCESSES_OK for line in ue_log_file.readlines(): result = re.search('nr_synchro_time', str(line)) if result is not None: @@ -2589,36 +2631,36 @@ class OaiCiTest(): else: statMsg = 'UE did NOT SHOW "TRIED TO PUSH MBMS DATA" message(s)' logging.debug('\u001B[1;30;41m ' + statMsg + ' \u001B[0m') + global_status = OAI_UE_PROCESS_NO_MBMS_MSGS HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + statMsg + '\n') if foundSegFault: logging.debug('\u001B[1;37;41m UE ended with a Segmentation Fault! \u001B[0m') if not nrUEFlag: - return CONST.OAI_UE_PROCESS_SEG_FAULT + global_status = CONST.OAI_UE_PROCESS_SEG_FAULT else: if not frequency_found: - return CONST.OAI_UE_PROCESS_SEG_FAULT + global_status = CONST.OAI_UE_PROCESS_SEG_FAULT if foundAssertion: logging.debug('\u001B[1;30;43m UE showed an assertion! \u001B[0m') HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE showed an assertion!\n') if not nrUEFlag: if not mib_found or not frequency_found: - return CONST.OAI_UE_PROCESS_ASSERTION + global_status = CONST.OAI_UE_PROCESS_ASSERTION else: if not frequency_found: - return CONST.OAI_UE_PROCESS_ASSERTION + global_status = CONST.OAI_UE_PROCESS_ASSERTION if foundRealTimeIssue: logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m') HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE faced real time issues!\n') - #return CONST.ENB_PROCESS_REALTIME_ISSUE if nrUEFlag: if not frequency_found: - return CONST.OAI_UE_PROCESS_COULD_NOT_SYNC + global_status = CONST.OAI_UE_PROCESS_COULD_NOT_SYNC else: if no_cell_sync_found and not mib_found: logging.debug('\u001B[1;37;41m UE could not synchronize ! \u001B[0m') HTML.SethtmlUEFailureMsg(HTML.GethtmlUEFailureMsg() + 'UE could not synchronize!\n') - return CONST.OAI_UE_PROCESS_COULD_NOT_SYNC - return 0 + global_status = CONST.OAI_UE_PROCESS_COULD_NOT_SYNC + return global_status def TerminateFlexranCtrl(self): @@ -3025,7 +3067,7 @@ class OaiCiTest(): logging.debug('\u001B[1m----------------------------------------\u001B[0m') def CheckClassValidity(action,id): - if action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover': + if action!='Build_PhySim' and action!='Run_PhySim' and action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover': logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action) return False return True @@ -3172,6 +3214,19 @@ def GetParametersFromXML(action): else: CiTestObj.x2_ho_options = string_field + if action == 'Build_PhySim': + ldpc.buildargs = test.findtext('physim_build_args') + forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') + if (forced_workspace_cleanup is None): + ldpc.forced_workspace_cleanup=False + else: + if re.match('true', forced_workspace_cleanup, re.IGNORECASE): + ldpc.forced_workspace_cleanup=True + else: + ldpc.forced_workspace_cleanup=False + + if action == 'Run_PhySim': + ldpc.runargs = test.findtext('physim_run_args') #check if given test is in list #it is in list if one of the strings in 'list' is at the beginning of 'test' @@ -3207,6 +3262,9 @@ EPC.SetHtmlObj(HTML) RAN.SetHtmlObj(HTML) RAN.SetEpcObj(EPC) +import cls_physim #class PhySim for physical simulators build and test +ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build + argvs = sys.argv argc = len(argvs) cwd = os.getcwd() @@ -3228,12 +3286,14 @@ while len(argvs) > 1: CiTestObj.ranRepository = matchReg.group(1) RAN.SetranRepository(matchReg.group(1)) HTML.SetranRepository(matchReg.group(1)) + ldpc.ranRepository=matchReg.group(1) elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) else: matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE) doMerge = matchReg.group(1) + ldpc.ranAllowMerge=matchReg.group(1) if ((doMerge == 'true') or (doMerge == 'True')): CiTestObj.ranAllowMerge = True RAN.SetranAllowMerge(True) @@ -3246,6 +3306,7 @@ while len(argvs) > 1: CiTestObj.ranBranch = matchReg.group(1) RAN.SetranBranch(matchReg.group(1)) HTML.SetranBranch(matchReg.group(1)) + ldpc.ranBranch=matchReg.group(1) elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) @@ -3254,6 +3315,7 @@ while len(argvs) > 1: CiTestObj.ranCommitID = matchReg.group(1) RAN.SetranCommitID(matchReg.group(1)) HTML.SetranCommitID(matchReg.group(1)) + ldpc.ranCommitID=matchReg.group(1) elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) @@ -3262,10 +3324,12 @@ while len(argvs) > 1: CiTestObj.ranTargetBranch = matchReg.group(1) RAN.SetranTargetBranch(matchReg.group(1)) HTML.SetranTargetBranch(matchReg.group(1)) + ldpc.ranTargetBranch=matchReg.group(1) elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNBIPAddress(matchReg.group(1)) + ldpc.eNBIpAddr=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNB1IPAddress(matchReg.group(1)) @@ -3276,6 +3340,7 @@ while len(argvs) > 1: if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNBUserName(matchReg.group(1)) + ldpc.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNB1UserName(matchReg.group(1)) @@ -3286,6 +3351,7 @@ while len(argvs) > 1: if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNBPassword(matchReg.group(1)) + ldpc.eNBPassWord=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNB1Password(matchReg.group(1)) @@ -3296,6 +3362,7 @@ while len(argvs) > 1: if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNBSourceCodePath(matchReg.group(1)) + ldpc.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.SeteNB1SourceCodePath(matchReg.group(1)) @@ -3316,10 +3383,13 @@ while len(argvs) > 1: EPC.SetSourceCodePath(matchReg.group(1)) elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE) - if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE): + if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE): EPC.SetType(matchReg.group(1)) else: - sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS)') + sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)') + elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE) + EPC.SetContainerPrefix(matchReg.group(1)) elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE) CiTestObj.ADBIPAddress = matchReg.group(1) @@ -3460,7 +3530,7 @@ elif re.match('^InitiateHtml$', mode, re.IGNORECASE): foundCount += 1 count += 1 if foundCount != HTML.GetnbTestXMLfiles(): - HTML.SetnbTestXMLfiles(foundcount) + HTML.SetnbTestXMLfiles(foundCount) if (CiTestObj.ADBIPAddress != 'none'): terminate_ue_flag = False @@ -3542,6 +3612,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re sys.exit(1) if (EPC.GetIPAddress() != '') and (EPC.GetIPAddress() != 'none'): CiTestObj.CheckFlexranCtrlInstallation() + EPC.SetMmeIPAddress() #get the list of tests to be done todo_tests=[] @@ -3662,6 +3733,11 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re CiTestObj.IdleSleep() elif action == 'Perform_X2_Handover': CiTestObj.Perform_X2_Handover() + elif action == 'Build_PhySim': + HTML=ldpc.Build_PhySim(HTML,CONST) + if ldpc.exitStatus==1:sys.exit() + elif action == 'Run_PhySim': + HTML=ldpc.Run_PhySim(HTML,CONST,id) else: sys.exit('Invalid action') CiTestObj.FailReportCnt += 1 diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 3fa91b862c..9b9fe462f1 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -197,7 +197,7 @@ function variant__v4__cppcheck { } function variant__v5__gnb_usrp { - VM_MEMORY=8192 + VM_MEMORY=10240 VM_CPU=8 NB_PATTERN_FILES=9 BUILD_OPTIONS="--gNB -w USRP" diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 350098e66e..c968521bda 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -366,7 +366,7 @@ class RANManagement(): count = 40 buildOAIprocess = True while (count > 0) and buildOAIprocess: - mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 3) + mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 6) result = re.search('build_oai', mySSH.getBefore()) if result is None: buildOAIprocess = False @@ -522,8 +522,8 @@ class RANManagement(): # Make a copy and adapt to EPC / eNB IP addresses mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) if self.epcObj is not None: - localEpcIpAddr = self.epcObj.GetIPAddress() - mySSH.command('sed -i -e \'s/CI_MME_IP_ADDR/' + localEpcIpAddr + '/\' ' + ci_full_config_file, '\$', 2); + localMmeIpAddr = self.epcObj.GetMmeIPAddress() + mySSH.command('sed -i -e \'s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_RCC_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_RRU1_IP_ADDR/' + self.eNB1IPAddress + '/\' ' + ci_full_config_file, '\$', 2); @@ -546,6 +546,9 @@ class RANManagement(): # Launch eNB with the modified config file mySSH.command('source oaienv', '\$', 5) mySSH.command('cd cmake_targets', '\$', 5) + if self.air_interface == 'nr': + mySSH.command('if [ -e rbconfig.raw ]; then echo ' + lPassWord + ' | sudo -S rm rbconfig.raw; fi', '\$', 5) + mySSH.command('if [ -e rbconfig.raw ]; then echo ' + lPassWord + ' | sudo -S rm reconfig.raw; fi', '\$', 5) mySSH.command('echo "ulimit -c unlimited && ./ran_build/build/' + self.air_interface + '-softmodem -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) @@ -607,7 +610,11 @@ class RANManagement(): enbDidSync = True time.sleep(10) - if enbDidSync and eNBinNoS1: + rruCheck = False + result = re.search('^rru|^du.band', str(config_file)) + if result is not None: + rruCheck = True + if enbDidSync and eNBinNoS1 and not rruCheck: mySSH.command('ifconfig oaitun_enb1', '\$', 4) mySSH.command('ifconfig oaitun_enb1', '\$', 4) result = re.search('inet addr:1|inet 1', mySSH.getBefore()) @@ -774,7 +781,7 @@ class RANManagement(): mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) mySSH.command('cd cmake_targets', '\$', 5) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5) - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 60) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt physim_*.log', '\$', 60) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5) mySSH.close() @@ -800,7 +807,10 @@ class RANManagement(): uciStatMsgCount = 0 pdcpFailure = 0 ulschFailure = 0 + ulschAllocateCCEerror = 0 + uplinkSegmentsAborted = 0 ulschReceiveOK = 0 + gnbRxTxWakeUpFailure = 0 cdrxActivationMessageCount = 0 dropNotEnoughRBs = 0 mbmsRequestMsg = 0 @@ -811,6 +821,7 @@ class RANManagement(): X2HO_state = CONST.X2_HO_REQ_STATE__IDLE X2HO_inNbProcedures = 0 X2HO_outNbProcedures = 0 + global_status = CONST.ALL_PROCESSES_OK for line in enb_log_file.readlines(): if X2HO_state == CONST.X2_HO_REQ_STATE__IDLE: result = re.search('target eNB Receives X2 HO Req X2AP_HANDOVER_REQ', str(line)) @@ -910,9 +921,18 @@ class RANManagement(): result = re.search('PDCP.*Out of Resources.*reason', str(line)) if result is not None: pdcpFailure += 1 - result = re.search('ULSCH in error in round', str(line)) + result = re.search('could not wakeup gNB rxtx process', str(line)) + if result is not None: + gnbRxTxWakeUpFailure += 1 + result = re.search('ULSCH in error in round|ULSCH 0 in error', str(line)) if result is not None: ulschFailure += 1 + result = re.search('ERROR ALLOCATING CCEs', str(line)) + if result is not None: + ulschAllocateCCEerror += 1 + result = re.search('uplink segment error.*aborted [1-9] segments', str(line)) + if result is not None: + uplinkSegmentsAborted += 1 result = re.search('ULSCH received ok', str(line)) if result is not None: ulschReceiveOK += 1 @@ -940,6 +960,10 @@ class RANManagement(): statMsg = nodeB_prefix + 'NB showed ' + str(ulschReceiveOK) + ' "ULSCH received ok" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') htmleNBFailureMsg += statMsg + '\n' + if gnbRxTxWakeUpFailure > 0: + statMsg = nodeB_prefix + 'NB showed ' + str(gnbRxTxWakeUpFailure) + ' "could not wakeup gNB rxtx process" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + htmleNBFailureMsg += statMsg + '\n' if uciStatMsgCount > 0: statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') @@ -952,6 +976,14 @@ class RANManagement(): statMsg = nodeB_prefix + 'NB showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') htmleNBFailureMsg += statMsg + '\n' + if ulschAllocateCCEerror > 0: + statMsg = nodeB_prefix + 'NB showed ' + str(ulschAllocateCCEerror) + ' "eNB_dlsch_ulsch_scheduler(); ERROR ALLOCATING CCEs" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + htmleNBFailureMsg += statMsg + '\n' + if uplinkSegmentsAborted > 0: + statMsg = nodeB_prefix + 'NB showed ' + str(uplinkSegmentsAborted) + ' "uplink segment error 0/2, aborted * segments" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + htmleNBFailureMsg += statMsg + '\n' if dropNotEnoughRBs > 0: statMsg = 'eNB showed ' + str(dropNotEnoughRBs) + ' "dropping, not enough RBs" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') @@ -1022,30 +1054,23 @@ class RANManagement(): rruMsg = 'Slave RRU DID NOT receive the RRU_frame_resynch command from RAU' logging.debug('\u001B[1;37;41m ' + rruMsg + ' \u001B[0m') htmleNBFailureMsg += rruMsg + '\n' - self.prematureExit(True) - return CONST.ENB_PROCESS_SLAVE_RRU_NOT_SYNCED + self.prematureExit = True + global_status = CONST.ENB_PROCESS_SLAVE_RRU_NOT_SYNCED if foundSegFault: logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with a Segmentation Fault! \u001B[0m') - if self.htmlObj is not None: - self.htmlObj.SetHmleNBFailureMsg(htmleNBFailureMsg) - return CONST.ENB_PROCESS_SEG_FAULT + global_status = CONST.ENB_PROCESS_SEG_FAULT if foundAssertion: logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with an assertion! \u001B[0m') htmleNBFailureMsg += msgAssertion - if self.htmlObj is not None: - self.htmlObj.SetHmleNBFailureMsg(htmleNBFailureMsg) - return CONST.ENB_PROCESS_ASSERTION + global_status = CONST.ENB_PROCESS_ASSERTION if foundRealTimeIssue: logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB faced real time issues! \u001B[0m') htmleNBFailureMsg += nodeB_prefix + 'NB faced real time issues!\n' - #return CONST.ENB_PROCESS_REALTIME_ISSUE if rlcDiscardBuffer > 0: rlcMsg = nodeB_prefix + 'NB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)' logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') htmleNBFailureMsg += rlcMsg + '\n' - if self.htmlObj is not None: - self.htmlObj.SetHmleNBFailureMsg(htmleNBFailureMsg) - return CONST.ENB_PROCESS_REALTIME_ISSUE + global_status = CONST.ENB_PROCESS_REALTIME_ISSUE if self.htmlObj is not None: self.htmlObj.SetHmleNBFailureMsg(htmleNBFailureMsg) - return 0 + return global_status diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 0a75ff25b7..44d200c3b6 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -53,7 +53,7 @@ function details_table { echo " Message" >> $3 echo " " >> $3 - LIST_MESSAGES=`egrep "error:|warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto"` + LIST_MESSAGES=`egrep "error:|warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto|disabling jobserver mode"` COMPLETE_MESSAGE="start" for MESSAGE in $LIST_MESSAGES do @@ -146,7 +146,7 @@ function summary_table_row { else echo " $NB_ERRORS" >> ./build_results.html fi - NB_WARNINGS=`egrep "warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto" | egrep -c "warning:"` + NB_WARNINGS=`egrep "warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto|disabling jobserver mode" | egrep -c "warning:"` if [ $NB_WARNINGS -eq 0 ] then echo " $NB_WARNINGS" >> ./build_results.html diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index b74fe93a1f..897f9285e9 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -724,8 +724,8 @@ function report_test { echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html fi - #PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null` - #analyzePingFiles + PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ping*.log 2> /dev/null` + analyzePingFiles IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null` analyzeIperfFiles diff --git a/ci-scripts/rrc-files/rbconfig.raw b/ci-scripts/rrc-files/rbconfig.raw deleted file mode 100644 index b03f18d121..0000000000 Binary files a/ci-scripts/rrc-files/rbconfig.raw and /dev/null differ diff --git a/ci-scripts/rrc-files/reconfig.raw b/ci-scripts/rrc-files/reconfig.raw deleted file mode 100644 index 97b41d9b6b..0000000000 Binary files a/ci-scripts/rrc-files/reconfig.raw and /dev/null differ diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 64af11c8ba..0db2264c76 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -89,6 +89,9 @@ function start_basic_sim_enb { fi done ENB_SYNC=0 + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 rm $1 if [ $i -lt 50 ] then @@ -151,6 +154,9 @@ function start_basic_sim_ue { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 rm $1 if [ $i -lt 50 ] then @@ -523,9 +529,9 @@ function install_epc_on_vm { echo "############################################################" echo "[ -f 01proxy ] && sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS - echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev iperf\"" >> $LOC_EPC_VM_CMDS echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS - echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS + echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS # Installing HSS echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS @@ -588,8 +594,6 @@ function start_epc { echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS echo "sudo rm -f hss.log" >> $LOC_EPC_VM_CMDS - #echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS - #echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS echo "echo \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS echo "sudo su -c \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS @@ -656,8 +660,6 @@ function terminate_epc { echo "cd /opt/ltebox/tools" >> $1 echo "echo \"sudo ./stop_ltebox\"" >> $1 echo "sudo ./stop_ltebox" >> $1 - echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1 - echo "sudo daemon --name=simulated_hss --stop" >> $1 echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1 echo "sudo killall --signal SIGKILL hss_sim" >> $1 ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 @@ -764,6 +766,9 @@ function start_l2_sim_enb { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1 rm $1 ENB_SYNC=1 if [ $i -lt 50 ] @@ -872,6 +877,9 @@ function start_l2_sim_ue { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1 rm $1 UE_SYNC=1 if [ $i -lt 50 ] @@ -985,6 +993,9 @@ function start_rf_sim_enb { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1 rm $1 if [ $i -lt 50 ] then @@ -1114,6 +1125,9 @@ function start_rf_sim_ue { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1 rm $1 if [ $i -lt 50 ] then @@ -1158,6 +1172,10 @@ function start_rf_sim_gnb { local LOC_CONF_FILE=$5 # 1 is with S1 and 0 without S1 aka noS1 local LOC_S1_CONFIGURATION=$6 + + if [ -e rbconfig.raw ]; then rm -f rbconfig.raw; fi + if [ -e reconfig.raw ]; then rm -f reconfig.raw; fi + echo "cd /home/ubuntu/tmp" > $1 echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1 echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 @@ -1171,6 +1189,7 @@ function start_rf_sim_gnb { echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1 echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 + echo "sudo rm -f r*config.raw" >> $1 if [ $LOC_S1_CONFIGURATION -eq 0 ] then echo "echo \"RFSIMULATOR=server ./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1 @@ -1231,6 +1250,13 @@ function start_rf_sim_gnb { fi fi sleep 10 + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR < $1 + rm $1 + # Copy the RAW files from the gNB run for the NR-UE + scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/rbconfig.raw . + scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/reconfig.raw . } function start_rf_sim_nr_ue { @@ -1241,14 +1267,21 @@ function start_rf_sim_nr_ue { local LOC_FREQUENCY=$6 # 1 is with S1 and 0 without S1 aka noS1 local LOC_S1_CONFIGURATION=$7 + + # Copy the RAW files from the gNB run + scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp + scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp + echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1 echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1 echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 + echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 + echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1 echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 if [ $LOC_S1_CONFIGURATION -eq 0 ] then - echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/ci-scripts/rrc-files --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1 + echo "echo \"RFSIMULATOR=${LOC_GNB_VM_IP_ADDR} ./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1 fi echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1 echo "cat ./my-nr-softmodem-run.sh" >> $1 @@ -1295,6 +1328,9 @@ function start_rf_sim_nr_ue { i=$[$i+1] fi done + echo "echo \"free -m\"" > $1 + echo "free -m" >> $1 + ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_NR_UE_VM_IP_ADDR < $1 rm $1 if [ $i -lt 50 ] then @@ -2028,7 +2064,7 @@ function run_test_on_vm { NR_STATUS=0 ######### start of loop - while [ $try_cnt -lt 5 ] + while [ $try_cnt -lt 1 ] do SYNC_STATUS=0 PING_STATUS=0 @@ -2050,6 +2086,8 @@ function run_test_on_vm { echo "Problem w/ gNB and NR-UE not syncing" terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2 terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1 + scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC SYNC_STATUS=-1 try_cnt=$[$try_cnt+1] continue @@ -2089,6 +2127,8 @@ function run_test_on_vm { echo "DL test not OK" terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2 terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1 + scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC try_cnt=$[$try_cnt+1] continue fi diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index 68a1d7836c..ba0f900f29 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -52,15 +52,19 @@ class SSHConnection(): self.picocom_closure = True def open(self, ipaddress, username, password): + extraSshOptions = '' count = 0 connect_status = False + if ipaddress == '192.168.18.197': + extraSshOptions = ' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' while count < 4: - self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5) + self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress + extraSshOptions], timeout = 5) self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) if self.sshresponse == 0: self.ssh.sendline('yes') - self.ssh.expect('password:') - self.ssh.sendline(password) + self.sshresponse = self.ssh.expect(['password:', username + '@']) + if self.sshresponse == 0: + self.ssh.sendline(password) self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) if self.sshresponse == 0: count = 10 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml index a28a81d970..73d1216199 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml @@ -24,6 +24,7 @@ test-05-tm1-rrc-no-flex Test-05MHz-TM1-RRC-Inactivity tasks + 2 030201 040101 @@ -33,8 +34,8 @@ IdleSleep - Waiting for 35 seconds - 35 + Waiting for 55 seconds + 55 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml index 07cd8fbb30..6ee9247ef3 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml @@ -36,8 +36,8 @@ IdleSleep - Waiting for 45 seconds - 45 + Waiting for 55 seconds + 55 diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index f3e80c576a..c51093c178 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path ci-scripts/rrc-files + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path . NR diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml index e1644f3931..8276294e9a 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml @@ -24,6 +24,7 @@ test-10 Test-10MHz tasks + 2 030201 040101 diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml index 0196bf1ab6..ae348b6b25 100644 --- a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml @@ -46,7 +46,7 @@ Initialize_eNB Initialize eNB (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml index c2835d0461..b77c6273e6 100644 --- a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml @@ -52,7 +52,7 @@ Initialize_eNB Initialize eNB (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --noS1 --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --noS1 --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml index 964550d872..df41385f83 100644 --- a/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml @@ -93,7 +93,7 @@ Initialize_eNB Initialize eNB (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml index 22f8b63266..852f48c370 100644 --- a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml @@ -64,7 +64,7 @@ Initialize_eNB Initialize eNB #0 (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT --eNBs.[0].enable_measurement_reports yes --eNBs.[0].enable_x2 yes --eNBs.[0].nr_cellid 123456 + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --eNBs.[0].enable_measurement_reports yes --eNBs.[0].enable_x2 yes --eNBs.[0].nr_cellid 123456 0 0 @@ -72,7 +72,7 @@ Initialize_eNB Initialize eNB #1 (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT --eNBs.[0].enable_measurement_reports yes --eNBs.[0].enable_x2 yes --eNBs.[0].nr_cellid 98765 + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --eNBs.[0].enable_measurement_reports yes --eNBs.[0].enable_x2 yes --eNBs.[0].nr_cellid 98765 1 1 diff --git a/ci-scripts/xml_files/ldpc_gpu_test.xml b/ci-scripts/xml_files/ldpc_gpu_test.xml new file mode 100644 index 0000000000..a0191fbd76 --- /dev/null +++ b/ci-scripts/xml_files/ldpc_gpu_test.xml @@ -0,0 +1,161 @@ + + + test-ldpc-gpu + Test-ldpc-GPU + tasks + 1 + 000001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021 + + + + Build_PhySim + Build for physical simulator + --phy_simulators --ninja + FALSE + + + + Run_PhySim + Run LDPC Test with CPU + -l 3872 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 3872 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 4224 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 4224 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 4576 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 4576 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 4928 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 4928 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 5280 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 5280 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 5632 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 5632 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 6336 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 6336 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 7040 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 7040 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 7744 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 7744 -s10 -n100 -G 1 + + + + Run_PhySim + Run LDPC Test with CPU + -l 8448 -s10 -n100 + + + + Run_PhySim + Run LDPC Test with GPU + -l 8448 -s10 -n100 -G 1 + + + + + diff --git a/ci-scripts/xml_files/multi_rru_band38_build.xml b/ci-scripts/xml_files/multi_rru_band38_build.xml index 614ef394f3..ba45eab10a 100644 --- a/ci-scripts/xml_files/multi_rru_band38_build.xml +++ b/ci-scripts/xml_files/multi_rru_band38_build.xml @@ -33,7 +33,7 @@ Build_eNB Build RCC - -w USRP -c --eNB + -w USRP -c --eNB --ninja 0 0 True @@ -42,7 +42,7 @@ WaitEndBuild_eNB Wait for end of Build RCC - -w USRP -c --eNB + -w USRP -c --eNB --ninja 0 0 @@ -50,7 +50,7 @@ Build_eNB Build Master RRU - -w USRP -c --eNB + -w USRP -c --eNB --ninja 1 1 True @@ -59,7 +59,7 @@ WaitEndBuild_eNB Wait for end of Build Master RRU - -w USRP -c --eNB + -w USRP -c --eNB --ninja 1 1 @@ -67,7 +67,7 @@ Build_eNB Build Slave RRU - -w USRP -c --eNB + -w USRP -c --eNB --ninja 2 2 True @@ -76,7 +76,7 @@ WaitEndBuild_eNB Wait for end of Build Slave RRU - -w USRP -c --eNB + -w USRP -c --eNB --ninja 2 2 diff --git a/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml b/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml index 7658f8a0e5..cca14c0696 100644 --- a/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml +++ b/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml @@ -24,7 +24,7 @@ test-multi-rru-10 Test-Multi-RRU-10MHz tasks - 4 + 2 030211 030212 030213 030111 030112 030113 diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b8f68a810b..2e229ada2c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -39,6 +39,33 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) project (OpenAirInterface) + + +############################################## +# Base CUDA setting +############################################## +find_package(CUDA) +if (CUDA_FOUND) + message ("cuda include ${CUDA_INCLUDE_DIRS}") + message ("cuda library ${CUDA_LIBRARY_DIRS}") + + add_definitions("-L/usr/local/cuda/lib64") + + SET(CUDA_NVCC_FLAGS + "${CUDA_NVCC_FLAGS};-arch=sm_60;") + + # Disable warnings for CUDA + SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt") + SET(CUDA_VERBOSE_BUILD ON) + SET(CUDA_HOST_COMPILER "/usr/bin/g++") + + SET(CUDA_SEPARABLE_COMPILATION ON) + +else (CUDA_FOUND) + message ("No CUDA tool installed") +endif () + + ########################################### # macros to define options as there is numerous options in oai ################################################ @@ -167,15 +194,32 @@ endif() # set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC") + "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -pipe -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC") # add autotools definitions that were maybe used! -set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'") -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}" -) -set(CMAKE_CXX_FLAGS +if (CUDA_FOUND) + set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'") + set(CUDA_CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D CUDA_FLAG" + ) + set(CUDA_CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D CUDA_FLAG" + ) + + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER} -D CUDA_FLAG" + ) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER} -D CUDA_FLAG" + ) +else (CUDA_FOUND) + set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'") + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}" + ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}" -) + ) +endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") @@ -2287,26 +2331,28 @@ add_library(LFDS7 ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} ) -# Simulation library -########################## -set (SIMUSRC -${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/channel_sim.c -${OPENAIR1_DIR}/SIMULATION/RF/rf.c -${OPENAIR1_DIR}/SIMULATION/RF/dac.c -${OPENAIR1_DIR}/SIMULATION/RF/adc.c -${OPENAIR_DIR}/targets/ARCH/rfsimulator/apply_channelmod.c -#${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c -) +add_library(SIMU_COMMON + ${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c + ) # Simulation library ########################## -add_library( SIMU SHARED ${SIMUSRC} ) +set (SIMUSRC + ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/channel_sim.c + ${OPENAIR1_DIR}/SIMULATION/RF/rf.c + ${OPENAIR1_DIR}/SIMULATION/RF/dac.c + ${OPENAIR1_DIR}/SIMULATION/RF/adc.c + #${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ) + +# Simulation library +########################## +add_library(SIMU SHARED ${SIMUSRC} ) add_library(SIMU_ETH ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -2464,9 +2510,11 @@ target_link_libraries(gnbscope ${XFORMS_LIBRARIES}) add_library(rfsimulator MODULE - ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c + ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c + ${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c + ${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c ) -target_link_libraries(rfsimulator SIMU ${ATLAS_LIBRARIES}) +target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES}) add_library(oai_iqplayer MODULE ${OPENAIR_TARGETS}/ARCH/iqplayer/iqplayer_lib.c @@ -2488,9 +2536,9 @@ endif (${T_TRACER}) #This rule and the following deal with it. add_custom_command ( OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h - COMMAND $(MAKE) clean - COMMAND $(MAKE) - COMMAND $(MAKE) check_vcd + COMMAND make clean + COMMAND make -j2 + COMMAND make check_vcd WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt ${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.c @@ -2612,7 +2660,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (ocp-enb -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB - PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 + PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB}) @@ -2682,7 +2730,7 @@ target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON - PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB + PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -2778,29 +2826,6 @@ target_link_libraries (nr-uesoftmodem ${T_LIB}) add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) -# USIM process -################# -#add_executable(usim -# ${OPENAIR3_DIR}/NAS/TOOLS/usim_data.c -# ${OPENAIR3_DIR}/NAS/USER/API/USIM/usim_api.c -# ${OPENAIR3_DIR}/NAS/USER/API/USIM/aka_functions.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/memory.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/nas_log.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/OctetString.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/TLVEncoder.c -# ) -#target_link_libraries (usim ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m) - -# ??? -##################### -#add_executable(nvram -# ${OPENAIR3_DIR}/NAS/TOOLS/ue_data.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/memory.c -# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/nas_log.c -# ) -#target_link_libraries (nvram LIB_NAS_UE UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m) - - ###################################" # Addexecutables for tests #################################### @@ -2817,7 +2842,7 @@ add_executable(dlsim_tm4 ${T_SOURCE} ) target_link_libraries (dlsim_tm4 - -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group + -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) @@ -2830,7 +2855,7 @@ add_executable(polartest ${SHLIB_LOADER_SOURCES} ) target_link_libraries(polartest - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE CONFIG_LIB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) @@ -2845,20 +2870,62 @@ add_executable(smallblocktest target_link_libraries(smallblocktest - -Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) -add_executable(ldpctest - ${PHY_NR_CODINGIF} - ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c - ${T_SOURCE} - ${SHLIB_LOADER_SOURCES} - ) + +# temp_C_flag = CMAKE_C_FLAGS +#set(CMAKE_C_FLAGS " ") +set (TEMP_C_FLAG ${CMAKE_C_FLAGS}) +set (CMAKE_C_FLAGS ${CUDA_CMAKE_C_FLAGS}) + +set (TEMP_CXX_FLAG ${CMAKE_CXX_FLAGS}) +set (CMAKE_CXX_FLAGS ${CUDA_CMAKE_CXX_FLAGS}) +if (CUDA_FOUND) +################################################### +# For CUDA library +################################################### + + CUDA_ADD_LIBRARY(LDPC_CU + ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu + ) + CUDA_ADD_CUFFT_TO_TARGET(LDPC_CU) + cuda_add_executable(ldpctest + ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c + ${T_SOURCE} + ${SHLIB_LOADER_SOURCES} + ) + target_link_libraries(ldpctest -ldl + -Wl,--start-group + LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB + -Wl,--end-group + m pthread ${ATLAS_LIBRARIES} dl + ) + +else (CUDA_FOUND) + add_executable(ldpctest + ${PHY_NR_CODINGIF} + ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c + ${T_SOURCE} + ${SHLIB_LOADER_SOURCES} + ) + +endif () +set (CMAKE_C_FLAGS ${TEMP_C_FLAG}) +set (CMAKE_CXX_FLAGS ${TEMP_CXX_FLAG}) + + +# add_executable(ldpctest + # ${PHY_NR_CODINGIF} + # ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c + # ${T_SOURCE} + # ${SHLIB_LOADER_SOURCES} + # ) add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) target_link_libraries(ldpctest - -Wl,--start-group UTIL SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} dl ) @@ -2871,7 +2938,7 @@ add_executable(nr_dlschsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_dlschsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) @@ -2884,7 +2951,7 @@ add_executable(nr_pbchsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_pbchsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) @@ -2899,7 +2966,7 @@ add_executable(nr_pucchsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_pucchsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) @@ -2913,7 +2980,7 @@ add_executable(nr_dlsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_dlsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -2927,7 +2994,7 @@ add_executable(nr_prachsim ${T_SOURCE} ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB MAC_UE_NR SCHED_NR_UE_LIB RRC_LIB NR_RRC_LIB L2_NR CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB MAC_UE_NR SCHED_NR_UE_LIB RRC_LIB NR_RRC_LIB L2_NR CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c @@ -2938,7 +3005,7 @@ add_executable(nr_ulschsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_ulschsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) @@ -2952,7 +3019,7 @@ add_executable(nr_ulsim ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_ulsim - -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -2971,7 +3038,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ${NFAPI_USER_DIR}/nfapi.c ) target_link_libraries (${myExe} - -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group + -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) @@ -3051,8 +3118,8 @@ if (${T_TRACER}) NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_UE NR_L2_UE MAC_NR_COMMON MAC_NR MAC_UE_NR - CN_UTILS GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU SIMU_ETH OPENAIR0_LIB - ldpc_orig ldpc_optim ldpc_optim8seg ldpc) + CN_UTILS GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) endif() @@ -3095,7 +3162,7 @@ function(make_driver name dir) endforeach() CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild) add_custom_command(OUTPUT ${name}.ko - COMMAND $(MAKE) -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name} + COMMAND make -j2 -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name} WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name} COMMENT "building ${module}.ko" VERBATIM diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 65849c24d1..9bdf60476f 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1036,7 +1036,9 @@ execution polartest Test cases. (Test1: PBCH polar test), - (Test2: DCI polar test) + (Test2: DCI polar test), + (Test3: UCI polar test,6-bit CRC), + (Test4: UCI polar test,11-bit CRC) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1044,8 +1046,10 @@ $OPENAIR_DIR/targets/bin/polartest.Rel15 -q -s-10 -f0 - -q -s-10 -f0 -m1 - polartest.test1 polartest.test2 + -q -s-10 -f0 -m1 + -q -s-2 -f2 -m2 -k12 + -q -s-2 -f2 -m2 -k20 + polartest.test1 polartest.test2 polartest.test3 polartest.test4 BLER= 0.000000 segmentation fault|assertion|exiting|fatal 3 @@ -1112,7 +1116,7 @@ -n100 -s1 -t33 -n100 -s1 -t50 - nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 + nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 PDSCH test OK segmentation fault|assertion|exiting|fatal 3 @@ -1186,15 +1190,20 @@ nr_pucchsim Test cases. (Test1: Format 0 1-bit ACK miss 106 PRB), (Test2: Format 0 2-bit ACK miss 106 PRB), (Test3: Format 0 2-bit ACK miss, 1-bit SR 106 PRB), - (Test4: Format 2 3-bit 106 PRB), - (Test5: Format 2 4-bit 106 PRB), - (Test6: Format 2 5-bit 106 PRB), - (Test7: Format 2 6-bit 106 PRB), - (Test8: Format 2 7-bit 106 PRB), - (Test9: Format 2 8-bit 106 PRB), - (Test10: Format 2 9-bit 106 PRB), - (Test11: Format 2 10-bit 106 PRB), - (Test12: Format 2 11-bit 106 PRB) + (Test4: Format 2 3-bit 2/106 PRB), + (Test5: Format 2 4-bit 2/106 PRB), + (Test6: Format 2 5-bit 2/106 PRB), + (Test7: Format 2 6-bit 2/106 PRB), + (Test8: Format 2 7-bit 2/106 PRB), + (Test9: Format 2 8-bit 2/106 PRB), + (Test10: Format 2 9-bit 2/106 PRB), + (Test11: Format 2 10-bit 2/106 PRB), + (Test12: Format 2 11-bit 2/106 PRB), + (Test13: Format 2 12-bit 8/106 PRB), + (Test14: Format 2 19-bit 8/106 PRB), + (Test15: Format 2 32-bit 8/106 PRB), + (Test16: Format 2 32-bit 16/106 PRB), + (Test17: Format 2 64-bit 16/106 PRB) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1213,8 +1222,13 @@ -R 106 -i 1 -P 2 -b 9 -s5 -n1000 -R 106 -i 1 -P 2 -b 10 -s6 -n1000 -R 106 -i 1 -P 2 -b 11 -s6 -n1000 - - nr_pucchsim.test1 nr_pucchsim.test2 nr_pucchsim.test3 nr_pucchsim.test4 nr_pucchsim.test5 nr_pucchsim.test6 nr_pucchsim.test7 nr_pucchsim.test8 nr_pucchsim.test9 nr_pucchsim.test10 nr_pucchsim.test11 nr_pucchsim.test12 + -R 106 -i 1 -P 2 -q8 -b 12 -s-3 -n1000 + -R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n1000 + -R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n1000 + -R 106 -i 1 -P 2 -q8 -b 32 -s-3 -n1000 + -R 106 -i 1 -P 2 -q16 -b 32 -s-3 -n1000 + -R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n1000 + nr_pucchsim.test1 nr_pucchsim.test2 nr_pucchsim.test3 nr_pucchsim.test4 nr_pucchsim.test5 nr_pucchsim.test6 nr_pucchsim.test7 nr_pucchsim.test8 nr_pucchsim.test9 nr_pucchsim.test10 nr_pucchsim.test11 nr_pucchsim.test12 nr_pucchsim.test13 nr_pucchsim.test14 nr_pucchsim.test15 nr_pucchsim.test16 nr_pucchsim.test17 PUCCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 965dfaea3a..88b8811575 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -406,8 +406,12 @@ function main() { shift 1;; -k | --skip-shared-libraries) SKIP_SHARED_LIB_FLAG="True" - echo_info "Skipping build of shared libraries, rfsimulator, basicsimulator and transport protocol libraries" + echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries" shift;; + --ninja) + CMAKE_CMD="$CMAKE_CMD -GNinja" + MAKE_CMD=ninja + shift;; -h | --help) print_help exit 1;; @@ -698,6 +702,7 @@ function main() { echo_info "Compiling physical unitary tests simulators" # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim" + # simlist="ldpctest" for f in $simlist ; do compilations \ phy_simulators $f \ @@ -892,7 +897,7 @@ function main() { $build_dir rfsimulator \ librfsimulator.so $dbin/librfsimulator.so.$REL - echo_info "Compiling basicsimulator" + echo_info "Compiling tcp_bridge_oai" compilations \ $build_dir tcp_bridge_oai \ libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL @@ -954,6 +959,7 @@ function main() { wait else echo_info "10. Bypassing the Tests ..." + echo_success "BUILD SHOULD BE SUCCESSFUL" fi } diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 8e4ae59a7f..b8f0125b10 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -150,7 +150,9 @@ clean_all_files() { set_openair_env dir=$OPENAIR_DIR/cmake_targets rm -rf $dir/log $OPENAIR_DIR/targets/bin/* - rm -rf $dir/ran_build $dir/lte-simulators/build + rm -rf $dir/ran_build $dir/ran_build_noLOG + rm -rf $dir/lte-simulators/build + rm -rf $dir/phy_simulators/build $dir/nas_sim_tools/build rm -rf $dir/oaisim_build_oai/build $dir/oaisim_build_oai/CMakeLists.txt rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build } @@ -167,36 +169,59 @@ check_warnings() { #we look for 'warning:' in the compilation log file #this is how gcc starts a warning #this is not perfect, we may get false positive - warning_count=`grep "warning:" "$1"|wc -l` + warning_count=`grep "warning:" "$1" | egrep -v "jobserver unavailable|disabling jobserver mode" | wc -l` if [ $warning_count -gt 0 ]; then echo_error "WARNING: $warning_count warnings. See $1" fi } +#check_errors: +# print error message if the compilation had errors +#argument: +# $1: log file +check_errors() { + #we look for 'warning:' in the compilation log file + error_count=`grep "error:" "$1" | wc -l` + if [ $error_count -gt 0 ]; then + echo_error "ERROR: $error_count error. See $1" + fi +} + compilations() { cd $OPENAIR_DIR/cmake_targets/$1/build + echo_info "Log file for compilation is being written to: $dlog/$2.$REL.txt" set +e { - rm -f $3 if [ "$BUILD_COVERITY_SCAN" == "1" ]; then COV_SCAN_PREFIX="cov-build --dir cov-int" else COV_SCAN_PREFIX="" fi + if [ "$MAKE_CMD" != "" ]; then + $MAKE_CMD $2 + else if [ "$VERBOSE_COMPILE" == "1" ]; then $COV_SCAN_PREFIX make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE else $COV_SCAN_PREFIX make -j`nproc` $2 fi - + fi + ret=$? } > $dlog/$2.$REL.txt 2>&1 set -e - echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt" + if [[ $ret -ne 0 ]]; then + check_warnings "$dlog/$2.$REL.txt" + check_errors "$dlog/$2.$REL.txt" + echo_error "$2 compilation failed" + exit 1 + fi if [ -s $3 ] ; then cp $3 $4 echo_success "$2 compiled" check_warnings "$dlog/$2.$REL.txt" else + check_warnings "$dlog/$2.$REL.txt" + check_errors "$dlog/$2.$REL.txt" echo_error "$2 compilation failed" exit 1 fi @@ -619,6 +644,7 @@ check_install_oai_software() { build-essential \ cmake \ cmake-curses-gui \ + ninja-build \ doxygen \ doxygen-gui \ texlive-latex-base \ diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index 2d861f2dc3..2e9fd614c5 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -179,8 +179,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { *(cfgoptions[i].u64ptr) = (uint64_t)llu; printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) ); } else { - *(cfgoptions[i].iptr) = llu; - printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); + *(cfgoptions[i].i64ptr) = llu; + printf_params("[LIBCONFIG] %s: %lld\n", cfgpath,(long long)(*(cfgoptions[i].i64ptr)) ); } } else { defval=config_setdefault_int64(&(cfgoptions[i]),prefix); diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index 0043eb3238..79db7f1c0e 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -248,7 +248,8 @@ const char* eurecomVariablesNames[] = { "slot_number_TX1_gNB", "slot_number_RX0_gNB", "slot_number_RX1_gNB", - "ru_tx_ofdm_mask" + "ru_tx_ofdm_mask", + "usrp_send_return" }; const char* eurecomFunctionsNames[] = { @@ -282,6 +283,8 @@ const char* eurecomFunctionsNames[] = { "lock_mutex_ru", "lock_mutex_ru1", "lock_mutex_ru2", + /* uhd signals */ + "trx_write_thread", /* simulation signals */ "do_DL_sig", "do_UL_sig", diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index 20588bb828..88655977bb 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -226,6 +226,7 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, + VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, VCD_SIGNAL_DUMPER_VARIABLES_END @@ -262,6 +263,8 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU, VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU1, VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU2, + /* uhd signals */ + VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, /* SIMULATION signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL, VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL, diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 4cb4bf2bba..2221dbbcac 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -73,10 +73,10 @@ typedef struct { } T_cache_t; /* number of VCD functions (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_FUNCTIONS (248) +#define VCD_NUM_FUNCTIONS (249) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_VARIABLES (186) +#define VCD_NUM_VARIABLES (187) /* first VCD function (to be kept up to date! see in T_messages.txt) */ #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index f8b746669c..3838518834 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -2138,6 +2138,11 @@ ID = VCD_VARIABLE_RU_TX_OFDM_MASK GROUP = ALL:VCD:ENB:VCD_VARIABLE FORMAT = ulong,value VCD_NAME = ru_tx_ofdm_mask +ID = VCD_VARIABLE_USRP_SEND_RETURN + DESC = VCD variable USRP_SEND_RETURN + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = usrp_send_return #functions @@ -2286,6 +2291,11 @@ ID = VCD_FUNCTION_LOCK_MUTEX_RU2 GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value VCD_NAME = lock_mutex_ru2 +ID = VCD_FUNCTION_TRX_WRITE_THREAD + DESC = VCD function TRX_WRITE_THREAD + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = trx_write_thread ID = VCD_FUNCTION_SIM_DO_DL_SIGNAL DESC = VCD function SIM_DO_DL_SIGNAL GROUP = ALL:VCD:ENB:VCD_FUNCTION diff --git a/common/utils/T/tracer/config.h b/common/utils/T/tracer/config.h index 07290c71a3..765b126133 100644 --- a/common/utils/T/tracer/config.h +++ b/common/utils/T/tracer/config.h @@ -1,5 +1,5 @@ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ +#ifndef __COMMON_UTILS_T_TRACER_CONFIG__H__ +#define __COMMON_UTILS_T_TRACER_CONFIG__H__ void clear_remote_config(void); void append_received_config_chunk(char *buf, int length); @@ -7,4 +7,4 @@ void load_config_file(char *filename); void verify_config(void); void get_local_config(char **txt, int *len); -#endif /* _CONFIG_H_ */ +#endif /* __COMMON_UTILS_T_TRACER_CONFIG__H__ */ diff --git a/common/utils/T/tracer/packet-mac-lte.h b/common/utils/T/tracer/packet-mac-lte.h index 1bc6df632b..54e6d1a09b 100644 --- a/common/utils/T/tracer/packet-mac-lte.h +++ b/common/utils/T/tracer/packet-mac-lte.h @@ -33,6 +33,9 @@ * SUCH DAMAGE */ +#ifndef __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ +#define __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ + //#include "ws_symbol_export.h" /* radioType */ @@ -139,3 +142,4 @@ continues until the end of the frame) */ #define MAC_LTE_PAYLOAD_TAG 0x01 +#endif diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 97f1866274..48d8df401c 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef __COMMON_UTILS_ASSERTIONS__H__ +#define __COMMON_UTILS_ASSERTIONS__H__ + #include #include #include @@ -30,9 +33,6 @@ # include "backtrace.h" #endif -#ifndef ASSERTIONS_H_ -#define ASSERTIONS_H_ - void output_log_mem(void); #define _Assert_Exit_ \ fprintf(stderr, "\nExiting execution\n"); \ @@ -83,4 +83,4 @@ do { \ } \ } while(0) -#endif /* ASSERTIONS_H_ */ +#endif /* __COMMON_UTILS_ASSERTIONS__H__ */ diff --git a/common/utils/itti_analyzer/common/queue.h b/common/utils/itti_analyzer/common/queue.h deleted file mode 100644 index 294d485110..0000000000 --- a/common/utils/itti_analyzer/common/queue.h +++ /dev/null @@ -1,592 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The - * elements are singly linked for minimum space and pointer manipulation - * overhead at the expense of O(n) removal for arbitrary elements. New - * elements can be added to the list after an existing element or at the - * head of the list. Elements being removed from the head of the list - * should use the explicit macro for this purpose for optimum - * efficiency. A singly-linked list may only be traversed in the forward - * direction. Singly-linked lists are ideal for applications with large - * datasets and few or no removals or for implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - * SLIST LIST STAILQ TAILQ CIRCLEQ - * _HEAD + + + + + - * _HEAD_INITIALIZER + + + + + - * _ENTRY + + + + + - * _INIT + + + + + - * _EMPTY + + + + + - * _FIRST + + + + + - * _NEXT + + + + + - * _PREV - - - + + - * _LAST - - + + + - * _FOREACH + + + + + - * _FOREACH_REVERSE - - - + + - * _INSERT_HEAD + + + + + - * _INSERT_BEFORE - + - + + - * _INSERT_AFTER + + + + + - * _INSERT_TAIL - - + + + - * _REMOVE_HEAD + - + - - - * _REMOVE + + + + + - */ - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ -#define LIST_INIT(head) do { \ - (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) - -/* - * List access methods. - */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) do { \ - (head)->slh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while(curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) - -/* - * Singly-linked List access methods. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first; /* first element */ \ - struct type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) do { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (listelm)->field.stqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->stqh_first; \ - while (curelm->field.stqe_next != (elm)) \ - curelm = curelm->field.stqe_next; \ - if ((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define STAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->stqh_first); \ - (var); \ - (var) = ((var)->field.stqe_next)) - -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Singly-linked Tail queue access methods. - */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ -} - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ - if ((head)->sqh_first == (elm)) { \ - SIMPLEQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->sqh_first; \ - while (curelm->field.sqe_next != (elm)) \ - curelm = curelm->field.sqe_next; \ - if ((curelm->field.sqe_next = \ - curelm->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(curelm)->field.sqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->sqh_first); \ - (var); \ - (var) = ((var)->field.sqe_next)) - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - - -/* - * Tail queue definitions. - */ -#define _TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} -#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define _TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} -#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) - -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Tail queue access methods. - */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { (void *)&head, (void *)&head } - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->cqh_first); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_next)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = ((head)->cqh_last); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_prev)) - -/* - * Circular queue access methods. - */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ - (((elm)->field.cqe_next == (void *)(head)) \ - ? ((head)->cqh_first) \ - : (elm->field.cqe_next)) -#define CIRCLEQ_LOOP_PREV(head, elm, field) \ - (((elm)->field.cqe_prev == (void *)(head)) \ - ? ((head)->cqh_last) \ - : (elm->field.cqe_prev)) - -#endif /* sys/queue.h */ diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 979cf86343..5601c0fcbf 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __COMMON_UTILS_NR_NR_COMMON__H__ +#define __COMMON_UTILS_NR_NR_COMMON__H__ + #include #include "assertions.h" @@ -63,3 +66,5 @@ void SLIV2SL(int SLIV,int *S,int *L); #define max(a,b) cmax(a,b) #define min(a,b) cmin(a,b) #endif + +#endif diff --git a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h index 89ced509a4..7a45b351f3 100644 --- a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h +++ b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h @@ -32,6 +32,8 @@ * \warning */ +#ifndef __TELNETSRV_CPUMEASUR_DEF__H__ +#define __TELNETSRV_CPUMEASUR_DEF__H__ #define CPU_PHYENB_MEASURE \ { \ @@ -97,3 +99,5 @@ {"pdcp_ip", &(pdcpvars->pdcp_ip),0},\ {"ip_pdcp", &(pdcpvars->ip_pdcp),0},\ } + +#endif diff --git a/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h b/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h index 160111f15e..c1aab51e23 100644 --- a/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h +++ b/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h @@ -32,6 +32,8 @@ * \warning */ +#ifndef __TELNETSRV_LTEMEASUR_DEF__H__ +#define __TELNETSRV_LTEMEASUR_DEF__H__ #define LTEMAC_MEASURE \ { \ @@ -125,3 +127,5 @@ {"timer_poll_retrans_tout", NULL, TELNET_VARTYPE_UINT, 0},\ {"timer_status_prohibit_tout", NULL, TELNET_VARTYPE_UINT, 0},\ } + +#endif diff --git a/common/utils/telnetsrv/telnetsrv_measurements.h b/common/utils/telnetsrv/telnetsrv_measurements.h index 80276bc2d0..08136df0fd 100644 --- a/common/utils/telnetsrv/telnetsrv_measurements.h +++ b/common/utils/telnetsrv/telnetsrv_measurements.h @@ -31,6 +31,10 @@ * \note * \warning */ + +#ifndef __TELNETSRV_MEASUREMENTS__H__ +#define __TELNETSRV_MEASUREMENTS__H__ + #include #include "telnetsrv.h" #include "openair1/PHY/defs_eNB.h" @@ -97,3 +101,4 @@ extern uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_prin extern void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t *statsptr, int stats_size); #endif /* TELNETSRV_MEASURCMD_MAIN */ +#endif diff --git a/common/utils/telnetsrv/telnetsrv_phycmd.h b/common/utils/telnetsrv/telnetsrv_phycmd.h index e35b2a53ab..0d574027fb 100644 --- a/common/utils/telnetsrv/telnetsrv_phycmd.h +++ b/common/utils/telnetsrv/telnetsrv_phycmd.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __TELNETSRV_PHYCMD__H__ +#define __TELNETSRV_PHYCMD__H__ + #ifdef TELNETSRV_PHYCMD_MAIN #include "common/utils/LOG/log.h" @@ -61,3 +64,4 @@ extern void add_phy_cmds(void); /*-------------------------------------------------------------------------------------*/ +#endif diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.h b/common/utils/telnetsrv/telnetsrv_proccmd.h index 1a0a8d25dc..f130606b6c 100644 --- a/common/utils/telnetsrv/telnetsrv_proccmd.h +++ b/common/utils/telnetsrv/telnetsrv_proccmd.h @@ -30,6 +30,10 @@ * \note * \warning */ + +#ifndef __TELNETSRV_PROCCMD__H__ +#define __TELNETSRV_PROCCMD__H__ + #include #include "telnetsrv.h" @@ -79,3 +83,4 @@ telnetshell_cmddef_t proc_cmdarray[] = { extern void add_proccmd_cmds(void); #endif /* TELNETSRV_PROCCMD_MAIN */ +#endif diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index f71b9acb33..23d32effbb 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -1,6 +1,8 @@ **Table of Contents** -1. [OpenAirInterface eNB Feature Set](#openairinterface-enb-feature-set) +1. [Functional Split Architecture](#functional-split-architecture) +2. [OpenAirInterface Block Diagram](#openairinterface-block-diagram) +2. [OpenAirInterface 4G-LTE eNB Feature Set](#openairinterface-4g-lte-enb-feature-set) 1. [eNB PHY Layer](#enb-phy-layer) 2. [eNB MAC Layer](#enb-mac-layer) 3. [eNB RLC Layer](#enb-rlc-layer) @@ -9,29 +11,38 @@ 6. [eNB X2AP](#enb-x2ap) 7. [eNB/MCE M2AP](#enbmce-m2ap) 8. [MCE/MME M3AP](#mcemme-m3ap) - 9. [eNB Advanced Features](#enb-advanced-features) -2. [OpenAirInterface Functional Split](#openairinterface-functional-split) -3. [OpenAirInterface UE Feature Set](#openairinterface-ue-feature-set) +3. [OpenAirInterface 4G-LTE UE Feature Set](#openairinterface-4g-lte-ue-feature-set) 1. [LTE UE PHY Layer](#lte-ue-phy-layer) 2. [LTE UE MAC Layer](#lte-ue-mac-layer) 3. [LTE UE RLC Layer](#lte-ue-rlc-layer) 4. [LTE UE PDCP Layer](#lte-ue-pdcp-layer) 5. [LTE UE RRC Layer](#lte-ue-rrc-layer) -4. [OpenAirInterface Functional Split](#openairinterface-functional-split) -5. [OpenAirInterface 5G-NR Feature Set](#openairinterface-5g-nr-feature-set) +4. [OpenAirInterface 5G-NR gNB Feature Set](#openairinterface-5g-nr-feature-set) 1. [General Parameters](#general-parameters) - 2. [gNB Features](#gnb-features) - 1. [gNB Physical Layer](#gnb-phy-layer) - 2. [gNB Higher Layers](#gnb-higher-layers) - 3. [NR UE Features](#nr-ue-features) - 1. [NR UE Physical Layer](#nr-ue-phy-layer) - 2. [NR UE Higher Layers](#nr-ue-higher-layers) + 2. [gNB Physical Layer](#gnb-phy-layer) + 3. [gNB Higher Layers](#gnb-higher-layers) +5. [OpenAirInterface 5G-NR UE Feature Set](#openairinterface-5g-nr-ue-feature-set) + 1. [UE Physical Layer](#ue-phy-layer) + 2. [UE Higher Layers](#ue-higher-layers) -# OpenAirInterface Block diagram # + +# Functional Split Architecture # + +- RCC: Radio-Cloud Center +- RAU: Radio-Access Unit +- RRU: Remote Radio-Unit +- IF4.5 / IF5 : similar to IEEE P1914.1 +- FAPI (IF2) : specified by Small Cell Forum (open-nFAPI implementation) +- IF1 : F1 in 3GPP Release 15 + +![Functional Split Architecture](./oai_enb_func_split_arch.png) + + +# OpenAirInterface Block Diagram # ![Block Diagram](./oai_enb_block_diagram.png) -# OpenAirInterface eNB Feature Set # +# OpenAirInterface 4G LTE eNB Feature Set # ## eNB PHY Layer ## @@ -82,7 +93,11 @@ TDD UL: 20 MHz, 100 PRBS/ MCS **XX** | 3.0 Mbit/s | TM1: 4.21 Mbits/s The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support of BCH, DLSCH, RACH, and ULSCH channels. - RRC interface for CCCH, DCCH, and DTCH -- Proportional fair scheduler (round robin scheduler soon) +- Proportional fair scheduler (round robin scheduler soon), with the following improvements: + - Up to 30 users tested in the L2 simulator, CCE allocation in the preprocessor ; the scheduler was also simplified and made more modular + - Adaptative UL-HARQ + - Remove out-of-sync UEs + - No use of the `first_rb` in the UL scheduler ; respects `vrb_map_UL` and `vrb_map` in the DL - DCI generation - HARQ Support - RA procedures and RNTI management @@ -123,7 +138,7 @@ The current PDCP layer is header compliant with **3GPP 36.323** Rel 10.1.0 and i ## eNB RRC Layer ## -The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following functions: +The RRC layer is based on **3GPP 36.331** v15.6 and implements the following functions: - System Information broadcast (SIB 1, 2, 3, and 13) * SIB1: Up to 6 PLMN IDs broadcast @@ -150,6 +165,10 @@ The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following - X2 timers (t_reloc_prep, tx2_reloc_overall) - Handover Cancel - X2-U interface implemented + - EN-DC is implemented + - X2AP : Handling of SgNB Addition Request / Addition Request Acknowledge / Reconfiguration Complete + - RRC : Handling of RRC Connection Reconfiguration with 5G cell info, configuration of 5G-NR measurements + - S1AP : Handling of E-RAB Modification Indication / Confirmation ## eNB/MCE M2AP ## @@ -171,11 +190,8 @@ The M3AP layer is based on **3GPP 36.444** v14.0.1: - M3 Session Start Request - M3 Session Start Response -## eNB Advanced Features ## -**To be completed** - -# OpenAirInterface UE Feature Set # +# OpenAirInterface 4G LTE UE Feature Set # ## LTE UE PHY Layer ## @@ -230,17 +246,6 @@ The NAS layer is based on **3GPP 24.301** and implements the following functions - EMM attach/detach, authentication, tracking area update, and more - ESM default/dedicated bearer, PDN connectivity, and more -# OpenAirInterface Functional Split # - -- RCC: Radio-Cloud Center -- RAU: Radio-Access Unit -- RRU: Remote Radio-Unit - -![Functional Split Architecture](./oai_enb_func_split_arch.png) - -- IF4.5 / IF5 : similar to IEEE P1914.1 -- FAPI (IF2) : specified by Small Cell Forum (open-nFAPI implementation) -- IF1 : F1 in 3GPP Release 15 # OpenAirInterface 5G-NR Feature Set # @@ -258,49 +263,103 @@ The following features are valid for the gNB and the 5G-NR UE. * Highly efficient 3GPP compliant polar encoder and decoder * Encoder and decoder for short blocks -## gNB Features ## -### gNB PHY Layer ### +## gNB PHY Layer ## -* Generation of PSS/SSS/PBCH for multiple beams and -* Generation of PDCCH for SIB1 (including generation of DCI, polar encoding, scrambling, modulation, RB mapping, etc) +* 30KHz SCS for FR1 and 120 KHz SCS for FR2 +* Generation of NR-PSS/NR-SSS +* NR-PBCH supports multiple SSBs and flexible periodicity +* Generation of NR-PDCCH for SIB1 (including generation of DCI, polar encoding, scrambling, modulation, RB mapping, etc) - common search space configured by MIB - user-specific search space configured by RRC - - DCI formats: 00, 10 -* Generation of PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). - - Single symbol DMRS, dmrs-TypeA-Position Pos2, DMRS configuration type 1 - - PDSCH mapping type A + - DCI formats: 00, 10 (01 and 11 **under integration**) +* Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). + - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1 + - PDSCH mapping type A +* NR-CSI Generation of sequence at PHY (**under integration**) * NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). * NR-PUCCH - - Format 0 (ACK/NACK) + - Format 0 (2 bits, mainly for ACK/NACK) + - Format 2 (up to 64 bits, mainly for CSI feedback) +* NR-PRACH + - Formats 0,1,2,3, A1-A3, B1-B3 +* Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported) +* Highly efficient 3GPP compliant polar encoder and decoder +* Encoder and decoder for short block -### gNB higher Layers ### - +## gNB Higher Layers ## + +**gNB RRC** - NR RRC (38.331) Rel 15 messages using new asn1c - LTE RRC (36.331) also updated to Rel 15 -- Generation of MIB +- Generation of CellGroupConfig (for eNB) and MIB - Application to read configuration file and program gNB RRC -- RRC -> MAC configuration -- MAC -> PHY configuration (using NR FAPI P5 interface) -- FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU +- RRC can configure PDCP, RLC, MAC -For more details see [this document](https://gitlab.eurecom.fr/oai/openairinterface5g/uploads/ba5368448d627743a28c770c29e8978e/OAI_Software_Architecture_for_Dual_Connectivity_in_E-UTRA_and_5G-NR_and_nFAPI_for_MAC-PHY_Interface.docx) +**gNB X2AP** +- X2 setup with eNB +- Handling of SgNB Addition Request / Addition Request Acknowledge / Reconfiguration Complete -## NR UE Features ## +**gNB MAC** +- MAC -> PHY configuration using NR FAPI P5 interface +- MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU +- Scheduler for RA procedreat gNB +- MAC downlink scheduler (fixed allocations) +- MAC header generation (including timing advance) +- ACK / NACK handling and HARQ procedures for downlink +- **As of May 2020** only DL was validated with COTS phone ; UL in progress, validated with OAI UE in noS1 mode -### NR UE PHY Layer ### +# OpenAirInterface 5G-NR UE Feature Set # -- initial synchronization -- Time tracking based on PDCCH DMRS -- Frequency offset estimation -- PBCH RX -- PDCCH RX -- PDSCH RX - - including first version of dual stream receiver for PDSCH +**as of May 2020** only supporting "noS1" mode (DL): +- Creates TUN interface to PDCP to inject and receive user-place traffic +- Will only work with OAI gNB configured in the same mode + +## UE PHY Layer ## + +* Initial synchronization +* Time tracking based on PBCH DMRS +* Time tracking based on PBCH DMRS +* Frequency offset estimation +* PBCH RX +* PDCCH RX +* PDSCH RX, including a first version of dual stream receiver for PDSCH +* 30KHz SCS for FR1 and 120 KHz SCS for FR2 +* Generation of NR-PSS/NR-SSS +* NR-PBCH supports multiple SSBs and flexible periodicity +* Generation of NR-PDCCH for SIB1 (including generation of DCI, polar encoding, scrambling, modulation, RB mapping, etc) + - common search space configured by MIB + - user-specific search space configured by RRC + - DCI formats: 00, 10 (01 and 11 **under integration**) +* Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). + - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1 + - PDSCH mapping type A +* NR-CSI Generation of sequence at PHY (**under integration**) +* NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). +* NR-PUCCH + - Format 0 (2 bits, mainly for ACK/NACK) + - Format 2 (up to 64 bits, mainly for CSI feedback) +* NR-PRACH + - Formats 0,1,2,3, A1-A3, B1-B3 +* Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported) +* Highly efficient 3GPP compliant polar encoder and decoder +* Encoder and decoder for short block + + +## UE Higher Layers ## + +**gNB MAC** +- Initial sync and MIB detection +- MAC -> PHY configuration of PHY via UE FAPI P5 interface +- Basic MAC to control PHY via UE FAPI P7 interface +- Random access procedure + + +**RLC** + +**PDCP** -### NR UE higher Layers ### -For more details see [this document](https://gitlab.eurecom.fr/oai/openairinterface5g/uploads/f7386f3a64806fd6b2ac1fc3d0252fff/UE_FAPI-like_interface.docx) [OAI wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 70074c65ed..37eadd92f3 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -70,7 +70,7 @@ This setup requires an EPC, an OAI eNB and gNB, and a COTS Phone. A dedicated pa ### Launch eNB -```bash sudo ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +```bash sudo ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf``` @@ -93,6 +93,14 @@ At the UE the --phy-test flag will ```bash sudo ./nr-uesoftmodem --phy-test [--rrc_config_path ../../../ci-scripts/rrc-files]``` +Some other useful paramters of the UE are + + - --ue-fo-compensation: enables the frequency offset compenstation at the UE. This is useful when running over the air and/or without an external clock/time source + - --usrp-args: this is the equivalend paramter of sdr_addrs field in the gNB config file and can be used to identify the USRP and set some basic paramters (like the clock source) + - --clock-source: sets the clock-source (internal or external). + - --time-source: sets the time-source (internal or external). + + ## noS1 setup with OAI UE Instead of randomly generated payload, in the phy-test mode we can also inject/receive user-plane traffic over a TUN interface. This is the so-called noS1 mode. diff --git a/executables/main-fs6.c b/executables/main-fs6.c index 45a6271887..ffa44bd978 100644 --- a/executables/main-fs6.c +++ b/executables/main-fs6.c @@ -1194,6 +1194,8 @@ void phy_procedures_eNB_TX_tosplit(uint8_t *bufferZone, PHY_VARS_eNB *eNB, L1_rx for (int i=0; iulsch[i]; + if (ulsch == NULL) + continue; if (ulsch->ue_type > NOCE) harq_pid = 0; @@ -1209,9 +1211,10 @@ void phy_procedures_eNB_TX_tosplit(uint8_t *bufferZone, PHY_VARS_eNB *eNB, L1_rx for (int k=0; k<8; k++) { ulsch_harq = ulsch->harq_processes[k]; + if (ulsch_harq == NULL) + continue; - if (ulsch && - (ulsch->rnti>0) && + if ((ulsch->rnti>0) && (ulsch_harq->status == ACTIVE) && (ulsch_harq->frame == frame) && (ulsch_harq->subframe == subframe) && @@ -1510,6 +1513,7 @@ void *cu_fs6(void *arg) { char remoteIP[1024]; strncpy(remoteIP,get_softmodem_params()->split73+3, 1023); //three first char should be cu: or du: char port_def[256]=DU_PORT; + for (int i=0; i <1000; i++) if (remoteIP[i]==':') { strncpy(port_def,remoteIP+i+1,255); @@ -1558,12 +1562,14 @@ void *du_fs6(void *arg) { char remoteIP[1024]; strncpy(remoteIP,get_softmodem_params()->split73+3,1023); //three first char should be cu: or du: char port_def[256]=CU_PORT; + for (int i=0; i <1000; i++) if (remoteIP[i]==':') { strncpy(port_def,remoteIP+i+1,255); remoteIP[i]=0; break; } + AssertFatal(createUDPsock(NULL, DU_PORT, remoteIP, port_def, &sockFS6), ""); if (ru->rfdevice.trx_start_func(&ru->rfdevice) != 0) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e1e2c5b3e4..27b0ed08dd 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -47,7 +47,7 @@ #include "SCHED/sched_eNB.h" #include "SCHED_NR/sched_nr.h" #include "SCHED_NR/fapi_nr_l1.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all @@ -740,9 +740,7 @@ void init_gNB_proc(int inst) { gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx; // LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]); gNB = RC.gNB[inst]; -#ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing gNB processes instance:%d CC_id %d \n",inst,CC_id); -#endif proc = &gNB->proc; L1_proc = &proc->L1_proc; @@ -956,9 +954,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);*/ LOG_I(PHY,"Initializing gNB %d single_thread_flag:%d\n",inst,gNB->single_thread_flag); -#ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing gNB %d\n",inst); -#endif LOG_I(PHY,"Registering with MAC interface module (before %p)\n",gNB->if_inst); AssertFatal((gNB->if_inst = NR_IF_Module_init(inst))!=NULL,"Cannot register interface"); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6a3a25d9f0..b2c6e94acf 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -51,13 +51,12 @@ #include "PHY/defs_nr_common.h" #include "PHY/phy_extern.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/INIT/phy_init.h" #include "SCHED/sched_eNB.h" #include "SCHED_NR/sched_nr.h" -#include "NR_MAC_COMMON/nr_mac_extern.h" - +#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "RRC/LTE/rrc_extern.h" #include "PHY_INTERFACE/phy_interface.h" @@ -119,6 +118,7 @@ uint16_t sl_ahead; extern int emulate_rf; extern int numerology; +extern int usrp_tx_thread; /*************************************************************/ /* Functions to attach and configure RRU */ @@ -775,7 +775,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d\n",ru->idx, (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); - AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen); + //AssertFatal(txs == 0,"trx write function error %d\n", txs); } } @@ -1509,6 +1509,18 @@ void *ru_thread( void *param ) { // if this is a slave RRU, try to synchronize on the DL frequency if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); + + // start trx write thread + if(usrp_tx_thread == 1){ + if (ru->start_write_thread){ + if(ru->start_write_thread(ru) != 0){ + LOG_E(HW,"Could not start tx write thread\n"); + } + else{ + LOG_I(PHY,"tx write thread ready\n"); + } + } + } } pthread_mutex_lock(&proc->mutex_FH1); @@ -1729,14 +1741,15 @@ int stop_rf(RU_t *ru) { return 0; } +int start_write_thread(RU_t *ru) { + return(ru->rfdevice.trx_write_init(&ru->rfdevice)); +} void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; char name[100]; -#ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); -#endif proc = &ru->proc; memset((void *)proc,0,sizeof(RU_proc_t)); proc->ru = ru; @@ -2124,6 +2137,7 @@ void set_function_spec_param(RU_t *ru) { ru->fh_south_out = tx_rf; // local synchronous RF TX ru->start_rf = start_rf; // need to start the local RF interface ru->stop_rf = stop_rf; + ru->start_write_thread = start_write_thread; // starting RF TX in different thread printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf); /* if (ru->function == gNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise @@ -2149,6 +2163,7 @@ void set_function_spec_param(RU_t *ru) { ru->fh_south_asynch_in = NULL; // no asynchronous UL ru->start_rf = NULL; // no local RF ru->stop_rf = NULL; + ru->start_write_thread = NULL; ru->nr_start_if = nr_start_if; // need to start if interface for IF5 ru->ifdevice.host_type = RAU_HOST; ru->ifdevice.eth_params = &ru->eth_params; @@ -2175,6 +2190,7 @@ void set_function_spec_param(RU_t *ru) { ru->fh_north_asynch_in = NULL; ru->start_rf = NULL; // no local RF ru->stop_rf = NULL; + ru->start_write_thread = NULL; ru->nr_start_if = nr_start_if; // need to start if interface for IF4p5 ru->ifdevice.host_type = RAU_HOST; ru->ifdevice.eth_params = &ru->eth_params; diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 305e4c4fc8..c968fee7b6 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -90,6 +90,7 @@ #define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n" #define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n" #define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n" +#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n" @@ -144,6 +145,10 @@ extern int sync_var; extern int transmission_mode; extern double cpuf; +extern int emulate_rf; +extern int numerology; +extern int usrp_tx_thread; + extern volatile int start_eNB; extern volatile int start_UE; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 054b02dd0d..bf77125975 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -183,6 +183,7 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; +int usrp_tx_thread = 0; static char *parallel_config = NULL; @@ -963,7 +964,9 @@ if(!IS_SOFTMODEM_NOS1) scopeParms_t p; p.argc=&argc; p.argv=argv; - startScope(&p); + p.gNB=RC.gNB[0]; + p.ru=RC.ru[0]; + gNBinitScope(&p); } if (nfapi_mode != 1 && nfapi_mode != 2) { diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 27e3ba1e3e..d113ae45aa 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -34,6 +34,7 @@ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ + {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ } diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 417b75e8b5..a11dc27d13 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -157,6 +157,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, // initialize all signal buffers init_nr_ue_signal(ue, nb_connected_gNB, abstraction_flag); + // intialize transport init_nr_ue_transport(ue, abstraction_flag); } @@ -365,62 +366,31 @@ static void UE_synch(void *arg) { } void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { - uint32_t nb_rb, start_rb; - uint8_t nb_symb_sch, start_symbol, mcs, precod_nbr_layers, harq_pid, rvidx; - uint16_t n_rnti; - module_id_t mod_id; + fapi_nr_config_request_t *cfg = &UE->nrUE_config; + int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_tti_tx); + uint8_t gNB_id = 0; - nr_dcireq_t dcireq; - nr_scheduled_response_t scheduled_response; + if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){ - // program PUSCH. this should actually be done by the MAC upon reception of an UL DCI - if (proc->nr_tti_tx == 8 || proc->nr_tti_tx == 7 || UE->frame_parms.frame_type == FDD){ + // trigger L2 to run ue_scheduler thru IF module + // [TODO] mapping right after NR initial sync + if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { + nr_uplink_indication_t ul_indication; + memset((void*)&ul_indication, 0, sizeof(ul_indication)); - mod_id = UE->Mod_id; + ul_indication.module_id = UE->Mod_id; + ul_indication.gNB_index = gNB_id; + ul_indication.cc_id = UE->CC_id; + ul_indication.frame_rx = proc->frame_rx; + ul_indication.slot_rx = proc->nr_tti_rx; + ul_indication.frame_tx = proc->frame_tx; + ul_indication.slot_tx = proc->nr_tti_tx; - dcireq.module_id = mod_id; - dcireq.gNB_index = 0; - dcireq.cc_id = 0; - dcireq.frame = proc->frame_rx; - dcireq.slot = proc->nr_tti_rx; - - scheduled_response.dl_config = NULL; - scheduled_response.ul_config = &dcireq.ul_config_req; - scheduled_response.tx_request = NULL; - scheduled_response.module_id = mod_id; - scheduled_response.CC_id = 0; - scheduled_response.frame = proc->frame_rx; - scheduled_response.slot = proc->nr_tti_rx; - //--------------------------Temporary configuration-----------------------------// - n_rnti = 0x1234; - nb_rb = 50; - start_rb = 0; - nb_symb_sch = 12; - start_symbol = 2; - precod_nbr_layers = 1; - mcs = 9; - harq_pid = 0; - rvidx = 0; - //------------------------------------------------------------------------------// - - scheduled_response.ul_config->slot = proc->nr_tti_tx; - scheduled_response.ul_config->number_pdus = 1; - scheduled_response.ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.rnti = n_rnti; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = nb_rb; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = mcs; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; - scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid; - - nr_ue_scheduled_response(&scheduled_response); + UE->if_inst->ul_indication(&ul_indication); + } if (UE->mode != loop_through_memory) { - uint8_t thread_id = PHY_vars_UE_g[mod_id][0]->current_thread_id[proc->nr_tti_rx]; + uint8_t thread_id = PHY_vars_UE_g[UE->Mod_id][0]->current_thread_id[proc->nr_tti_rx]; phy_procedures_nrUE_TX(UE,proc,0,thread_id); } } @@ -428,41 +398,26 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { - nr_dcireq_t dcireq; - nr_scheduled_response_t scheduled_response; - uint8_t ssb_period = UE->nrUE_config.ssb_table.ssb_period; + fapi_nr_config_request_t *cfg = &UE->nrUE_config; + int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_tti_rx); + uint8_t gNB_id = 0; - //program DCI for slot 1 - //TODO: all of this has to be moved to the MAC!!! - if (proc->nr_tti_rx == NR_DOWNLINK_SLOT || UE->frame_parms.frame_type == FDD){ - dcireq.module_id = UE->Mod_id; - dcireq.gNB_index = 0; - dcireq.cc_id = 0; - dcireq.frame = proc->frame_rx; - dcireq.slot = proc->nr_tti_rx; - nr_ue_dcireq(&dcireq); //to be replaced with function pointer later + if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ - // we should have received a DL DCI here, so configure DL accordingly - scheduled_response.dl_config = &dcireq.dl_config_req; - scheduled_response.ul_config = NULL; - scheduled_response.tx_request = NULL; - scheduled_response.module_id = UE->Mod_id; - scheduled_response.CC_id = 0; - if (!((proc->frame_rx)%(1<<(ssb_period-1)))) { - if(proc->frame_rx > dcireq.dl_config_req.sfn) - UE->frame_gap = proc->frame_rx - dcireq.dl_config_req.sfn; - if(proc->frame_rx < dcireq.dl_config_req.sfn) - UE->frame_gap = dcireq.dl_config_req.sfn - proc->frame_rx; - proc->frame_rx = dcireq.dl_config_req.sfn; + if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) { + nr_downlink_indication_t dl_indication; + memset((void*)&dl_indication, 0, sizeof(dl_indication)); + + dl_indication.module_id = UE->Mod_id; + dl_indication.gNB_index = gNB_id; + dl_indication.cc_id = UE->CC_id; + dl_indication.frame = proc->frame_rx; + dl_indication.slot = proc->nr_tti_rx; + + UE->if_inst->dl_indication(&dl_indication, NULL); } - scheduled_response.frame = proc->frame_rx; - scheduled_response.slot = proc->nr_tti_rx; - - nr_ue_scheduled_response(&scheduled_response); - } // Process Rx data for one sub-frame - if ( proc->nr_tti_rx >=0 && proc->nr_tti_rx <= 1 ) { #ifdef UE_SLOT_PARALLELISATION phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL ); #else @@ -482,7 +437,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { } } - // no UL for now // no UL for now /* if (UE->mac_enabled==1) { @@ -498,6 +452,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { } } */ + } /*! @@ -518,11 +473,7 @@ void UE_processing(void *arg) { UE_nr_rxtx_proc_t *proc = &rxtxD->proc; PHY_VARS_NR_UE *UE = rxtxD->UE; - uint8_t gNB_id = 0, CC_id = 0; - module_id_t mod_id = 0; - - nr_uplink_indication_t ul_indication; - memset((void*)&ul_indication, 0, sizeof(ul_indication)); + uint8_t gNB_id = 0; // params for UL time alignment procedure NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &UE->ul_time_alignment[gNB_id]; @@ -538,7 +489,7 @@ void UE_processing(void *arg) { if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) { LOG_D(PHY,"Applying timing advance -- frame %d -- slot %d\n", frame_tx, slot_tx); - //if (nfapi_mode!=3){ + //if (nfapi_mode!=3){ nr_process_timing_advance(UE->Mod_id, UE->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB); ul_time_alignment->ta_frame = -1; @@ -548,24 +499,7 @@ void UE_processing(void *arg) { } processSlotRX(UE, proc); - - if (UE->mac_enabled == 1) { - // trigger L2 to run ue_scheduler thru IF module - // [TODO] mapping right after NR initial sync - if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { - ul_indication.module_id = mod_id; - ul_indication.gNB_index = gNB_id; - ul_indication.cc_id = CC_id; - ul_indication.frame_rx = proc->frame_rx; - ul_indication.slot_rx = proc->nr_tti_rx; - ul_indication.frame_tx = proc->frame_tx; - ul_indication.slot_tx = proc->nr_tti_tx; - UE->if_inst->ul_indication(&ul_indication); - } - } - processSlotTX(UE, proc); - } void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { @@ -620,8 +554,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { - LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); - void *dummy_tx[UE->frame_parms.nb_antennas_tx]; + LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { @@ -642,6 +575,12 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { int computeSamplesShift(PHY_VARS_NR_UE *UE) { + if (IS_SOFTMODEM_RFSIM) { + LOG_D(PHY,"SET rx_offset %d \n",UE->rx_offset); + //UE->rx_offset_diff=0; + return 0; + } + // compute TO compensation that should be applied for this frame if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2 && UE->rx_offset > 0 ) { @@ -707,8 +646,11 @@ void *UE_thread(void *arg) { if (res) { syncRunning=false; syncData_t *tmp=(syncData_t *)NotifiedFifoData(res); - // shift the frame index with all the frames we trashed meanwhile we perform the synch search - decoded_frame_rx=(tmp->proc.decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER; + if (UE->is_synchronized) { + decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); + // shift the frame index with all the frames we trashed meanwhile we perform the synch search + decoded_frame_rx=(decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER; + } delNotifiedFIFO_elt(res); } else { readFrame(UE, ×tamp, true); @@ -753,6 +695,7 @@ void *UE_thread(void *arg) { absolute_slot++; + // whatever means thread_idx // Fix me: will be wrong when slot 1 is slow, as slot 2 finishes // Slot 3 will overlap if RX_NB_TH is 2 @@ -765,20 +708,20 @@ void *UE_thread(void *arg) { curMsg->UE=UE; // update thread index for received subframe curMsg->UE->current_thread_id[slot_nr] = thread_idx; - curMsg->proc.CC_id = 0; + curMsg->proc.CC_id = UE->CC_id; curMsg->proc.nr_tti_rx= slot_nr; curMsg->proc.subframe_rx=slot_nr/(nb_slot_frame/10); curMsg->proc.nr_tti_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame; curMsg->proc.subframe_tx=curMsg->proc.nr_tti_rx; - curMsg->proc.frame_rx = ((absolute_slot/nb_slot_frame)+UE->frame_gap) % MAX_FRAME_NUMBER; - curMsg->proc.frame_tx = (((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame)+UE->frame_gap) % MAX_FRAME_NUMBER; + curMsg->proc.frame_rx = (absolute_slot/nb_slot_frame) % MAX_FRAME_NUMBER; + curMsg->proc.frame_tx = ((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame) % MAX_FRAME_NUMBER; curMsg->proc.decoded_frame_rx=-1; //LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB); #ifdef OAI_ADRV9371_ZC706 /*uint32_t total_gain_dB_prev = 0; if (total_gain_dB_prev != UE->rx_total_gain_dB) { - total_gain_dB_prev = UE->rx_total_gain_dB; + total_gain_dB_prev = UE->rx_total_gain_dB; openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB; UE->rfdevice.trx_set_gains_func(&UE->rfdevice,&openair0_cfg[0]); }*/ @@ -863,7 +806,7 @@ void *UE_thread(void *arg) { if ( (decoded_frame_rx != curMsg->proc.frame_rx) && (((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx) && (((decoded_frame_rx+2) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx)) - LOG_D(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", + LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", decoded_frame_rx, curMsg->proc.frame_rx ); nbSlotProcessing++; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 8a38f40624..e66898490b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -76,36 +76,11 @@ unsigned short config_frames[4] = {2,9,11,13}; #include #include -#include - - -/* Callbacks, globals and object handlers */ - -extern void reset_stats( FL_OBJECT *, long ); -//extern void initTpool(char *params, tpool_t *pool, bool performanceMeas); - -/* Forms and Objects */ - -typedef struct { - FL_FORM *stats_form; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *stats_text; - FL_OBJECT *stats_button; -} FD_stats_form; - -extern FD_stats_form *create_form_stats_form( void ); - -#include "PHY/TOOLS/nr_phy_scope.h" //#include "stats.h" // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) +#include "PHY/TOOLS/nr_phy_scope.h" // at eNB 0, an UL scope for every UE -FD_phy_scope_nrue *form_nrue[NUMBER_OF_UE_MAX]; //FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -//FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; -char title[255]; -static pthread_t forms_thread; //xforms #include #include "executables/softmodem-common.h" @@ -198,6 +173,7 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots int transmission_mode=1; int numerology = 0; +int usrp_tx_thread = 0; /* flag set by eNB conf file to specify if the radio head is local or remote (default option is local) */ //uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD; @@ -274,7 +250,7 @@ void exit_function(const char *file, const char *function, const int line, const } -void reset_stats(FL_OBJECT *button, long arg) { +void reset_stats(long arg) { //int i,j,k; /*PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[0][0]; @@ -304,35 +280,6 @@ void reset_stats(FL_OBJECT *button, long arg) { }*/ } -static void *scope_thread(void *arg) { - sleep(5); - - while (!oai_exit) { - phy_scope_nrUE(form_nrue[0], - PHY_vars_UE_g[0][0], - 0,0,1); - usleep(100*1000); - } - - pthread_exit((void *)arg); -} - - -void init_scope(void) { - int fl_argc=1; - - if (do_forms==1) { - char *name="5G-UE-scope"; - fl_initialize (&fl_argc, &name, NULL, 0, 0); - int UE_id = 0; - form_nrue[UE_id] = create_phy_scope_nrue(); - sprintf (title, "NR DL SCOPE UE"); - fl_show_form (form_nrue[UE_id]->phy_scope_nrue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW); - } - -} - void *l2l1_task(void *arg) { MessageDef *message_p = NULL; int result; @@ -814,7 +761,8 @@ int main( int argc, char **argv ) { memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs); configure_linux(); mlockall(MCL_CURRENT | MCL_FUTURE); - init_scope(); + if (do_forms) + nrUEinitScope(PHY_vars_UE_g[0][0]); number_of_cards = 1; for(int CC_id=0; CC_id65535 + +}nfapi_nr_ue_dig_bf_interface_t; + +typedef struct +{ + nfapi_nr_ue_dig_bf_interface_t* dig_bf_interface_list; + +} nfapi_nr_ue_ul_beamforming_number_of_prgs_t; + +typedef struct +{ + uint16_t num_prgs; + uint16_t prg_size; + //watchout: dig_bf_interface here, in table 3-43 it's dig_bf_interfaces + uint8_t dig_bf_interface; + nfapi_nr_ue_ul_beamforming_number_of_prgs_t* prgs_list;// + +} nfapi_nr_ue_ul_beamforming_t; + +typedef struct +{ + uint16_t pdu_bit_map;//Bitmap indicating presence of optional PDUs (see above) uint16_t rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t ulsch_pdu_rel15; -} fapi_nr_ul_config_pusch_pdu; + uint32_t handle;//An opaque handling returned in the RxData.indication and/or UCI.indication message + //BWP + uint16_t bwp_size; + uint16_t bwp_start; + uint8_t subcarrier_spacing; + uint8_t cyclic_prefix; + //pusch information always include + uint16_t target_code_rate; + uint8_t qam_mod_order; + uint8_t mcs_index; + uint8_t mcs_table; + uint8_t transform_precoding; + uint16_t data_scrambling_id; + uint8_t nrOfLayers; + //DMRS + uint16_t ul_dmrs_symb_pos; + uint8_t dmrs_config_type; + uint16_t ul_dmrs_scrambling_id; + uint8_t scid; + uint8_t num_dmrs_cdm_grps_no_data; + uint16_t dmrs_ports;//DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports. Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011 and for each bit 0: DMRS port not used 1: DMRS port used + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] + uint8_t resource_alloc; + uint8_t rb_bitmap[36];// + uint16_t rb_start; + uint16_t rb_size; + uint8_t vrb_to_prb_mapping; + uint8_t frequency_hopping; + uint16_t tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE] + uint8_t uplink_frequency_shift_7p5khz; + //Resource Allocation in time domain + uint8_t start_symbol_index; + uint8_t nr_of_symbols; + //Optional Data only included if indicated in pduBitmap + nfapi_nr_ue_pusch_data_t pusch_data; + nfapi_nr_ue_pusch_uci_t pusch_uci; + nfapi_nr_ue_pusch_ptrs_t pusch_ptrs; + nfapi_nr_ue_dfts_ofdm_t dfts_ofdm; + //beamforming + nfapi_nr_ue_ul_beamforming_t beamforming; + //OAI specific + int8_t absolute_delta_PUSCH; +} nfapi_nr_ue_pusch_pdu_t; typedef struct { @@ -307,7 +393,7 @@ typedef struct { union { fapi_nr_ul_config_prach_pdu prach_config_pdu; fapi_nr_ul_config_pucch_pdu pucch_config_pdu; - fapi_nr_ul_config_pusch_pdu ulsch_config_pdu; + nfapi_nr_ue_pusch_pdu_t pusch_config_pdu; fapi_nr_ul_config_srs_pdu srs_config_pdu; }; } fapi_nr_ul_config_request_pdu_t; @@ -348,7 +434,6 @@ typedef struct { uint8_t SubcarrierSpacing; uint16_t number_rbs; uint16_t start_rb; - uint8_t frame_offset; uint16_t number_symbols; uint16_t start_symbol; uint16_t dlDmrsSymbPos; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index dd3e2d037f..fea64e3f3e 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -1492,7 +1492,7 @@ typedef struct //for dci_pusch_pdu typedef struct { - uint8_t pdu_bit_map; + uint8_t pduBitmap; uint32_t handle; uint16_t rnti; uint8_t ul_cqi; @@ -1507,7 +1507,7 @@ typedef struct //for PUCCH PDU Format 0/1 typedef struct { - uint8_t pdu_bit_map; + uint8_t pduBitmap; uint32_t handle; uint16_t rnti; uint8_t pucch_format;//PUCCH format Value: 0 -> 1 0: PUCCH Format0 1: PUCCH Format1 @@ -1523,7 +1523,7 @@ typedef struct //PUCCH PDU Format 2/3/4 typedef struct { - uint8_t pdu_bit_map; + uint8_t pduBitmap; uint32_t handle; uint16_t rnti; uint8_t pucch_format;//PUCCH format Value: 0 -> 2 0: PUCCH Format2 1: PUCCH Format3 2: PUCCH Format4 diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi.c b/nfapi/open-nFAPI/nfapi/src/nfapi.c index 156a48ec05..61c6875bc6 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi.c @@ -526,7 +526,7 @@ uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len, return 0; } - if((end - out) >= sizeof(uint8_t) * len) + if((end - (*in)) >= sizeof(uint8_t) * len) { memcpy(out, (*in), len); (*in)+=len; diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index ce6f9996de..345122ca1d 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -27,7 +27,7 @@ #include "SIMULATION/TOOLS/sim.h" #include "PHY/CODING/nrLDPC_extern.h" #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" - +#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h" #define MAX_NUM_DLSCH_SEGMENTS 16 #define MAX_BLOCK_LENGTH 8448 @@ -102,7 +102,8 @@ int test_ldpc(short No_iteration, unsigned int *crc_misses, time_stats_t *time_optim, time_stats_t *time_decoder, - n_iter_stats_t *dec_iter) + n_iter_stats_t *dec_iter, + short run_cuda) { //clock initiate //time_stats_t time,time_optim,tinput,tprep,tparity,toutput, time_decoder; @@ -114,7 +115,6 @@ int test_ldpc(short No_iteration, double sigma; sigma = 1.0/sqrt(2*SNR); - opp_enabled=1; cpu_freq_GHz = get_cpu_freq_GHz(); //short test_input[block_length]; @@ -400,12 +400,22 @@ int test_ldpc(short No_iteration, for(j=0;j 3840 -> BG1, rest BG2 ), Default: 8448\n"); + printf("-G give 1 to run cuda for LDPC, Default: 0\n"); printf("-n Number of simulation trials, Default: 1\n"); //printf("-M MCS2 for TB 2\n"); printf("-s SNR per information bit (EbNo) in dB, Default: -2\n"); @@ -674,7 +691,8 @@ int main(int argc, char *argv[]) &crc_misses, time_optim, time_decoder, - dec_iter); + dec_iter, + run_cuda); printf("SNR %f, BLER %f (%u/%d)\n", SNR, (float)decoded_errors[i]/(float)n_trials, decoded_errors[i], n_trials); printf("SNR %f, BER %f (%u/%d)\n", SNR, (float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments, decoded_errors[i], n_trials); diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 806d8de28c..d9adf3e24f 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -12,7 +12,6 @@ #include "PHY/CODING/coding_defs.h" #include "SIMULATION/TOOLS/sim.h" #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" -//#include "PHY/NR_TRANSPORT/nr_transport.h" //#include "common/utils/LOG/log.h" //#define DEBUG_DCI_POLAR_PARAMS @@ -27,7 +26,7 @@ int main(int argc, char *argv[]) { //Default simulation values (Aim for iterations = 1000000.) int decoder_int16=0; - int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI + int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, 2=UCI double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB double SNR, SNR_lin; int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks). @@ -42,6 +41,7 @@ int main(int argc, char *argv[]) switch (arguments) { case 's': SNRstart = atof(optarg); + SNRstop = SNRstart + 2; break; case 'd': @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) case 'k': testLength=atoi(optarg); - if (testLength < 12 || testLength > 60) { + if (testLength < 12 || testLength > 127) { printf("Illegal packet bitlength %d \n",testLength); exit(-1); } @@ -120,12 +120,13 @@ int main(int argc, char *argv[]) crcTableInit(); if (polarMessageType == 0) { //PBCH - aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; + aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; } else if (polarMessageType == 1) { //DCI - coderLength = 108*aggregation_level; - } else if (polarMessageType == -1) { //UCI - printf("UCI testing not supported yet\n"); - exit(-1); + coderLength = 108*aggregation_level; + } else if (polarMessageType == 2) { //UCI + //pucch2 parameters, 1 symbol, aggregation_level = NPRB + AssertFatal(aggregation_level>2,"For UCI formats, aggregation (N_RB) should be > 2\n"); + coderLength = 16*aggregation_level; } //Logging diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index da19ec40e2..7f466c7097 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -382,12 +382,24 @@ unsigned int crc16 (unsigned char * inptr, int bitlen); @param bitlen length of inputs in bits*/ unsigned int crc12 (unsigned char * inptr, int bitlen); +/*!\fn uint32_t crc12(uint8_t *inPtr, int32_t bitlen) +\brief This computes an 11-bit crc based on 3GPP NR specifications. +@param inPtr Pointer to input byte stream +@param bitlen length of inputs in bits*/ +unsigned int crc11 (unsigned char * inptr, int bitlen); + /*!\fn uint32_t crc8(uint8_t *inPtr, int32_t bitlen) \brief This computes a 8-bit crc based on 3GPP UMTS specifications. @param inPtr Pointer to input byte stream @param bitlen length of inputs in bits*/ unsigned int crc8 (unsigned char * inptr, int bitlen); +/*!\fn uint32_t crc8(uint8_t *inPtr, int32_t bitlen) +\brief This computes a 6-bit crc based on 3GPP NR specifications. +@param inPtr Pointer to input byte stream +@param bitlen length of inputs in bits*/ +unsigned int crc6 (unsigned char * inptr, int bitlen); + int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type); /*!\fn void phy_viterbi_dot11_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n,int offset,int traceback) diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index ee5c302adb..0769ab992a 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -90,7 +90,9 @@ static unsigned int crc24bTable[256]; static unsigned int crc24cTable[256]; static unsigned short crc16Table[256]; static unsigned short crc12Table[256]; +static unsigned short crc11Table[256]; static unsigned char crc8Table[256]; +static unsigned char crc6Table[256]; void crcTableInit (void) { @@ -102,7 +104,9 @@ void crcTableInit (void) crc24cTable[c] = crcbit (&c, 1, poly24c); crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16); crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16); + crc11Table[c] = (unsigned short) (crcbit (&c, 1, poly11) >> 16); crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); + crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24); } while (++c); } @@ -207,6 +211,24 @@ crc12 (unsigned char * inptr, int bitlen) return crc; } +unsigned int +crc11 (unsigned char * inptr, int bitlen) +{ + int octetlen, resbit; + unsigned int crc = 0; + octetlen = bitlen / 8; /* Change in octets */ + resbit = (bitlen % 8); + + while (octetlen-- > 0) { + crc = (crc << 8) ^ (crc11Table[(*inptr++) ^ (crc >> 24)] << 16); + } + + if (resbit > 0) + crc = (crc << resbit) ^ (crc11Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); + + return crc; +} + unsigned int crc8 (unsigned char * inptr, int bitlen) { @@ -225,6 +247,24 @@ crc8 (unsigned char * inptr, int bitlen) return crc; } +unsigned int +crc6 (unsigned char * inptr, int bitlen) +{ + int octetlen, resbit; + unsigned int crc = 0; + octetlen = bitlen / 8; /* Change in octets */ + resbit = (bitlen % 8); + + while (octetlen-- > 0) { + crc = crc6Table[(*inptr++) ^ (crc >> 24)] << 24; + } + + if (resbit > 0) + crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24); + + return crc; +} + int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type) { uint32_t crc=0,oldcrc=0; diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I0 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I0 new file mode 100644 index 0000000000..3223238db8 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I0 @@ -0,0 +1,48 @@ +int h_base_0 [46*68] = { + 250, 69, 226, 159, -1, 100, 10, -1, -1, 59, 229, 110, 191, 9, -1, 195, 23, -1, 190, 35, 239, 31, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 2, -1, 239, 117, 124, 71, -1, 222, 104, 173, -1, 220, 102, -1, 109, 132, 142, 155, -1, 255, -1, 28, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 106, 111, 185, -1, 63, 117, 93, 229, 177, 95, 39, -1, -1, 142, 225, 225, -1, 245, 205, 251, 117, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 121, 89, -1, 84, 20, -1, 150, 131, 243, -1, 136, 86, 246, 219, 211, -1, 240, 76, 244, -1, 144, 12, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 157, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 205, 236, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, -1, 28, -1, -1, -1, -1, 123, 115, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 183, -1, -1, -1, -1, -1, 22, -1, -1, -1, 28, 67, -1, 244, -1, -1, -1, 11, 157, -1, 211, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 220, 44, -1, -1, 159, -1, -1, 31, 167, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 112, 4, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, 102, -1, -1, 164, -1, 109, 241, -1, 90, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 103, 182, -1, -1, -1, -1, -1, -1, -1, -1, 109, 21, -1, 142, -1, -1, -1, 14, 61, -1, 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 98, 149, -1, 167, -1, -1, 160, 49, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, -1, 182, -1, -1, -1, -1, 78, 252, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 160, 42, -1, -1, -1, -1, -1, -1, -1, -1, 21, 32, -1, 234, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 177, -1, -1, 248, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 206, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, 206, 127, 16, -1, -1, -1, 229, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 40, 96, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, 63, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 64, -1, 49, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, 59, 1, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233, 8, -1, -1, -1, -1, 155, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 60, 73, -1, -1, -1, -1, -1, 72, 127, -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 151, -1, -1, 186, -1, -1, -1, -1, -1, 217, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 249, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, 131, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, 188, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 156, 147, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 112, -1, -1, 86, 236, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 23, -1, -1, -1, -1, 136, 116, -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 195, -1, 243, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 25, -1, -1, -1, -1, 104, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 128, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 181, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 95, -1, -1, -1, -1, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2, 187, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 127, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, 164, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 161, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, 51, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 167, -1, -1, -1, -1, -1, -1, -1, -1, 151, 157, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 173, -1, 139, -1, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 157, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 167, -1, 173, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 149, -1, -1, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, -1, 173, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 139, -1, -1, -1, -1, -1, -1, 157, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 149, -1, -1, -1, -1, 151, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I1 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I1 new file mode 100644 index 0000000000..6137aee2f8 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I1 @@ -0,0 +1,48 @@ +int h_base_1 [46*68] = { + 307, 19, 50, 369, -1, 181, 216, -1, -1, 317, 288, 109, 17, 357, -1, 215, 106, -1, 242, 180, 330, 346, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 76, -1, 76, 73, 288, 144, -1, 331, 331, 178, -1, 295, 342, -1, 217, 99, 354, 114, -1, 331, -1, 112, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 205, 250, 328, -1, 332, 256, 161, 267, 160, 63, 129, -1, -1, 200, 88, 53, -1, 131, 240, 205, 13, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 276, 87, -1, 0, 275, -1, 199, 153, 56, -1, 132, 305, 231, 341, 212, -1, 304, 300, 271, -1, 39, 357, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 332, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 195, 14, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, 166, -1, -1, -1, 241, -1, -1, -1, -1, 51, 157, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 278, -1, -1, -1, -1, -1, 257, -1, -1, -1, 1, 351, -1, 92, -1, -1, -1, 253, 18, -1, 225, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9, 62, -1, -1, 316, -1, -1, 333, 290, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 307, 179, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, 39, -1, -1, 224, -1, 368, 67, -1, 170, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 366, 232, -1, -1, -1, -1, -1, -1, -1, -1, 321, 133, -1, 57, -1, -1, -1, 303, 63, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 101, 339, -1, 274, -1, -1, 111, 383, -1, -1, -1, -1, -1, 354, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 48, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, 47, -1, -1, -1, -1, 188, 334, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, 186, -1, -1, -1, -1, -1, -1, -1, -1, 174, 232, -1, 50, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 313, -1, -1, 177, -1, -1, -1, 266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, 370, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, 137, 89, 347, -1, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 241, 2, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 318, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 13, -1, 338, -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, 289, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 303, -1, 81, 358, -1, -1, -1, 375, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, 280, -1, -1, -1, -1, 132, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 145, 213, -1, -1, -1, -1, -1, 344, 242, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 187, -1, -1, 206, -1, -1, -1, -1, -1, 264, -1, 341, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 205, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 328, -1, -1, -1, 213, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 233, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 24, 89, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 298, -1, -1, 158, 235, -1, -1, -1, -1, -1, -1, 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 72, -1, -1, -1, -1, 17, 383, -1, -1, -1, -1, -1, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 71, -1, 81, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 194, -1, -1, -1, -1, 194, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 222, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 244, -1, 274, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 252, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 147, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, -1, -1, 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 100, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 258, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 201, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 323, 8, -1, -1, -1, -1, -1, -1, -1, -1, 361, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 230, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, 202, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 320, -1, -1, -1, -1, 335, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, 297, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 185, -1, -1, -1, -1, -1, -1, -1, -1, 177, 289, -1, 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 258, -1, 93, -1, -1, -1, 346, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 175, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 52, -1, 314, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 113, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, 114, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 80, -1, -1, -1, -1, -1, -1, 78, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 135, -1, -1, -1, -1, 149, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I2 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I2 new file mode 100644 index 0000000000..debaee7f7e --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I2 @@ -0,0 +1,48 @@ +int h_base_2 [46*68] = { + 73, 15, 103, 49, -1, 240, 39, -1, -1, 15, 162, 215, 164, 133, -1, 298, 110, -1, 113, 16, 189, 32, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 303, -1, 294, 27, 261, 161, -1, 133, 4, 80, -1, 129, 300, -1, 76, 266, 72, 83, -1, 260, -1, 301, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 68, 7, 80, -1, 280, 38, 227, 202, 200, 71, 106, -1, -1, 295, 283, 301, -1, 184, 246, 230, 276, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 220, 208, -1, 30, 197, -1, 61, 175, 79, -1, 281, 303, 253, 164, 53, -1, 44, 28, 77, -1, 319, 68, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 233, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 83, 292, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, 318, -1, -1, -1, 201, -1, -1, -1, -1, 267, 279, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 289, -1, -1, -1, -1, -1, 21, -1, -1, -1, 293, 13, -1, 232, -1, -1, -1, 302, 138, -1, 235, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 12, 88, -1, -1, 207, -1, -1, 50, 25, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 295, 133, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, -1, 296, -1, -1, 110, -1, 269, 245, -1, 154, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 189, 244, -1, -1, -1, -1, -1, -1, -1, -1, 36, 286, -1, 151, -1, -1, -1, 267, 135, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 14, 80, -1, 211, -1, -1, 75, 161, -1, -1, -1, -1, -1, 311, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 16, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 290, -1, -1, -1, 289, -1, -1, -1, -1, 177, 43, 280, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 229, 235, -1, -1, -1, -1, -1, -1, -1, -1, 169, 48, -1, 105, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, -1, -1, 302, -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, 54, 61, 179, -1, -1, -1, 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 229, 290, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, 130, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 69, -1, 140, -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1, 128, 51, -1, -1, -1, 228, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 294, 291, -1, -1, -1, -1, 141, 295, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64, 181, -1, -1, -1, -1, -1, 101, 270, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 301, -1, -1, 162, -1, -1, -1, -1, -1, 40, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 79, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, 283, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 55, -1, -1, -1, 316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 249, 50, -1, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 289, -1, -1, 280, 110, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 281, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 172, -1, -1, -1, -1, 295, 96, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 270, -1, 110, -1, 318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 210, -1, -1, -1, -1, 29, -1, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, -1, -1, -1, 293, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, 234, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 308, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 222, -1, -1, -1, -1, -1, 308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 170, 20, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 187, -1, -1, -1, -1, -1, -1, 296, -1, -1, -1, -1, -1, -1, -1, 5, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 207, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, 178, -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 298, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 151, -1, -1, -1, -1, -1, -1, -1, -1, 179, 64, -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 102, -1, 77, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 32, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 154, -1, 47, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 226, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 228, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 176, -1, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 234, -1, -1, -1, -1, -1, -1, 227, -1, 259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 101, -1, -1, -1, -1, 228, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I3 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I3 new file mode 100644 index 0000000000..13c6ddca76 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I3 @@ -0,0 +1,48 @@ +int h_base_3 [46*68] = { + 223, 16, 94, 91, -1, 74, 10, -1, -1, 0, 205, 216, 21, 215, -1, 14, 70, -1, 141, 198, 104, 81, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 141, -1, 45, 151, 46, 119, -1, 157, 133, 87, -1, 206, 93, -1, 79, 9, 118, 194, -1, 31, -1, 187, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 207, 203, 31, -1, 176, 180, 186, 95, 153, 177, 70, -1, -1, 77, 214, 77, -1, 198, 117, 223, 90, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 201, 18, -1, 165, 5, -1, 45, 142, 16, -1, 34, 155, 213, 147, 69, -1, 96, 74, 99, -1, 30, 158, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 170, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 164, 59, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, 182, -1, -1, -1, -1, 130, 153, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 158, -1, -1, -1, -1, -1, 119, -1, -1, -1, 113, 21, -1, 63, -1, -1, -1, 51, 136, -1, 116, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 17, 76, -1, -1, 104, -1, -1, 100, 150, -1, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 33, 95, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, -1, -1, 204, -1, -1, 39, -1, 58, 44, -1, 201, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9, 37, -1, -1, -1, -1, -1, -1, -1, -1, 213, 105, -1, 89, -1, -1, -1, 185, 109, -1, 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 82, 165, -1, 174, -1, -1, 19, 194, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 52, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, 35, -1, -1, -1, -1, 32, 84, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 142, 175, -1, -1, -1, -1, -1, -1, -1, -1, 136, 3, -1, 28, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 81, -1, -1, 56, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, 211, 191, 51, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 90, 120, -1, -1, -1, -1, -1, -1, -1, -1, 131, -1, -1, 209, -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 164, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, 200, 63, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, 200, -1, -1, -1, -1, 143, 186, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8, 6, -1, -1, -1, -1, -1, 103, 198, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 105, -1, -1, 210, -1, -1, -1, -1, -1, 121, -1, 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 192, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220, -1, -1, -1, 50, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 88, 203, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 49, -1, -1, 157, 64, -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1, -1, -1, -1, -1, 166, 65, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, -1, 176, -1, 212, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 208, -1, -1, -1, -1, 141, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 146, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, -1, -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 175, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 114, 49, -1, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, 68, -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 192, -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 0, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 123, -1, -1, -1, -1, -1, -1, -1, -1, 90, 73, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 12, -1, 77, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 67, -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 23, -1, 215, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 114, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 206, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 134, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 84, -1, -1, -1, -1, -1, -1, 4, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 184, -1, -1, -1, -1, 121, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I4 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I4 new file mode 100644 index 0000000000..f7c89c6947 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I4 @@ -0,0 +1,48 @@ +int h_base_4 [46*68] = { + 211, 198, 188, 186, -1, 219, 4, -1, -1, 29, 144, 116, 216, 115, -1, 233, 144, -1, 95, 216, 73, 261, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 179, -1, 162, 223, 256, 160, -1, 76, 202, 117, -1, 109, 15, -1, 72, 152, 158, 147, -1, 156, -1, 119, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 258, 167, 220, -1, 133, 243, 202, 218, 63, 0, 3, -1, -1, 74, 229, 0, -1, 216, 269, 200, 234, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 187, 145, -1, 166, 108, -1, 82, 132, 197, -1, 41, 162, 57, 36, 115, -1, 242, 165, 0, -1, 113, 108, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 246, 235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 261, 181, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, 283, -1, -1, -1, 254, -1, -1, -1, -1, 79, 144, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 80, -1, -1, -1, -1, -1, 144, -1, -1, -1, 169, 90, -1, 59, -1, -1, -1, 177, 151, -1, 108, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 169, 189, -1, -1, 154, -1, -1, 184, 104, -1, -1, -1, -1, -1, 164, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 54, 0, -1, 252, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, 98, -1, -1, 46, -1, 15, 230, -1, 54, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 162, 159, -1, -1, -1, -1, -1, -1, -1, -1, 93, 134, -1, 45, -1, -1, -1, 132, 76, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 178, 1, -1, 28, -1, -1, 267, 234, -1, -1, -1, -1, -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 55, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, 181, -1, -1, -1, -1, 273, 39, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 225, 162, -1, -1, -1, -1, -1, -1, -1, -1, 244, 151, -1, 238, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 231, -1, -1, 0, -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186, -1, -1, 253, 16, 0, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 170, 0, -1, -1, -1, -1, -1, -1, -1, -1, 183, -1, -1, 108, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 270, -1, 13, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, 0, 0, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, 0, -1, -1, -1, -1, 241, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 0, -1, -1, -1, -1, -1, 118, 144, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 265, -1, -1, 81, -1, -1, -1, -1, -1, 90, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 228, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 64, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, 9, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 189, 72, -1, -1, -1, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 236, -1, -1, 199, 0, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 205, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 45, -1, -1, -1, -1, 36, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 275, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, 252, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 144, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 166, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 197, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 108, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 199, -1, -1, -1, -1, 278, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 190, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 153, -1, 0, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 216, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 0, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 27, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, 0, -1, -1, -1, -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 18, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 168, -1, -1, -1, -1, 0, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I5 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I5 new file mode 100644 index 0000000000..475e6a2920 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I5 @@ -0,0 +1,48 @@ +int h_base_5 [46*68] = { + 294, 118, 167, 330, -1, 207, 165, -1, -1, 243, 250, 1, 339, 201, -1, 53, 347, -1, 304, 167, 47, 188, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, -1, 225, 96, 338, 268, -1, 112, 302, 50, -1, 167, 253, -1, 334, 242, 257, 133, -1, 9, -1, 302, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 226, 35, 213, -1, 302, 111, 265, 128, 237, 294, 127, -1, -1, 110, 286, 125, -1, 131, 163, 210, 7, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 97, 94, -1, 49, 279, -1, 139, 166, 91, -1, 106, 246, 345, 269, 185, -1, 249, 215, 143, -1, 121, 121, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 42, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 219, 130, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, 295, -1, -1, -1, -1, 258, 283, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 294, -1, -1, -1, -1, -1, 73, -1, -1, -1, 330, 99, -1, 172, -1, -1, -1, 150, 284, -1, 305, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 3, 103, -1, -1, 224, -1, -1, 297, 215, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 348, 75, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, 312, -1, -1, -1, 224, -1, -1, 17, -1, 59, 314, -1, 244, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 156, 88, -1, -1, -1, -1, -1, -1, -1, -1, 293, 111, -1, 92, -1, -1, -1, 152, 23, -1, 337, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 175, 253, -1, 27, -1, -1, 231, 49, -1, -1, -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, 322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, -1, 351, -1, -1, -1, -1, 166, 338, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 123, 217, -1, -1, -1, -1, -1, -1, -1, -1, 142, 110, -1, 176, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 311, -1, -1, 251, -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, -1, -1, 277, 156, 66, -1, -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 176, 348, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, -1, 81, -1, -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 190, -1, 293, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, -1, -1, -1, 331, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 228, -1, 247, 116, -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 286, 246, -1, -1, -1, -1, 181, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 87, 110, -1, -1, -1, -1, -1, 147, 258, -1, 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 89, -1, -1, 65, -1, -1, -1, -1, -1, 155, -1, 244, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 162, -1, -1, -1, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 346, -1, -1, -1, 143, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 236, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 18, 6, -1, -1, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, -1, -1, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 38, -1, -1, 170, 249, -1, -1, -1, -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 279, -1, -1, -1, -1, 255, 111, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 325, -1, 326, -1, 226, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 91, -1, -1, -1, -1, 326, -1, 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 102, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 212, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 101, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 279, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 351, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, 338, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 56, 304, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 60, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, -1, 112, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 100, -1, -1, -1, -1, 210, -1, -1, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 35, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 164, -1, -1, -1, -1, -1, -1, -1, -1, 196, 209, -1, 246, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 236, -1, 264, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 304, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 123, -1, 77, -1, -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 288, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, 53, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 79, -1, -1, -1, -1, -1, -1, 244, -1, 293, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 82, -1, -1, -1, -1, 67, -1, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I6 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I6 new file mode 100644 index 0000000000..f9500d8d04 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I6 @@ -0,0 +1,48 @@ +int h_base_6 [46*68] = { + 0, 0, 0, 0, -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, 11, 124, 0, 10, -1, 0, 0, 2, -1, 16, 60, -1, 0, 6, 30, 0, -1, 168, -1, 31, 105, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 132, 37, 21, -1, 180, 4, 149, 48, 38, 122, 195, -1, -1, 155, 28, 85, -1, 47, 179, 42, 66, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 6, -1, 33, 113, -1, 49, 21, 6, -1, 151, 83, 154, 87, 5, -1, 92, 173, 120, -1, 2, 142, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 24, 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 185, 100, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, 207, -1, -1, -1, -1, 161, 72, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, -1, -1, -1, -1, -1, 27, -1, -1, -1, 163, 50, -1, 48, -1, -1, -1, 24, 38, -1, 91, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 145, 88, -1, -1, 112, -1, -1, 153, 159, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 172, 2, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, 96, -1, -1, 99, -1, 101, 35, -1, 116, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, 145, 53, -1, 201, -1, -1, -1, 4, 164, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 126, 77, -1, 156, -1, -1, 16, 12, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 184, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, 16, -1, -1, -1, -1, 104, 109, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, 20, -1, -1, -1, -1, -1, -1, -1, -1, 203, 153, -1, 104, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 52, -1, -1, 147, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 202, -1, -1, 118, 130, 1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 173, 6, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, 182, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 88, -1, 198, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 184, -1, 30, 3, -1, -1, -1, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, 167, -1, -1, -1, -1, 68, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 12, 6, -1, -1, -1, -1, -1, 166, 184, -1, 191, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, -1, -1, 12, -1, -1, -1, -1, -1, 15, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 6, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, -1, -1, -1, 42, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 130, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 45, 18, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9, -1, -1, 125, 191, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, -1, -1, -1, -1, 74, 16, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 21, -1, 142, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 98, -1, -1, -1, -1, 140, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 136, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 126, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, 30, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, -1, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, 197, -1, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, 177, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, -1, -1, -1, -1, -1, -1, 64, 198, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 4, -1, 28, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 2, -1, 75, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 163, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, -1, 99, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 4, -1, -1, -1, -1, -1, -1, 6, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 181, -1, -1, -1, -1, 45, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I7 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I7 new file mode 100644 index 0000000000..aa2e90086f --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG1_I7 @@ -0,0 +1,48 @@ +int h_base_7 [46*68] = { + 135, 227, 126, 134, -1, 84, 83, -1, -1, 53, 225, 205, 128, 75, -1, 135, 217, -1, 220, 90, 105, 137, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 96, -1, 236, 136, 221, 128, -1, 92, 172, 56, -1, 11, 189, -1, 95, 85, 153, 87, -1, 163, -1, 216, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 189, 4, 225, -1, 151, 236, 117, 179, 92, 24, 68, -1, -1, 6, 101, 33, -1, 96, 125, 67, 230, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 128, 23, -1, 162, 220, -1, 43, 186, 96, -1, 1, 216, 22, 24, 167, -1, 200, 32, 235, -1, 172, 219, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64, 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 2, 171, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, 210, -1, -1, -1, -1, 180, 180, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 199, -1, -1, -1, -1, -1, 22, -1, -1, -1, 23, 100, -1, 92, -1, -1, -1, 207, 52, -1, 13, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, 146, -1, -1, 209, -1, -1, 32, 166, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 181, 105, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, 177, -1, -1, 145, -1, 199, 153, -1, 38, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 169, 12, -1, -1, -1, -1, -1, -1, -1, -1, 206, 221, -1, 17, -1, -1, -1, 212, 92, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 116, 151, -1, 70, -1, -1, 230, 115, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 45, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, 1, -1, -1, -1, -1, 152, 165, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 186, 215, -1, -1, -1, -1, -1, -1, -1, -1, 124, 180, -1, 98, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 220, -1, -1, 185, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 178, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, 182, 95, 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, 138, -1, -1, -1, -1, -1, -1, -1, -1, 220, -1, -1, 173, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 78, -1, 152, -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, 106, 219, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, 180, -1, -1, -1, -1, 143, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 179, 108, -1, -1, -1, -1, -1, 159, 138, -1, 196, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, -1, -1, 187, -1, -1, -1, -1, -1, 203, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 197, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, -1, -1, -1, 65, 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 126, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 185, 127, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 32, -1, -1, 178, 2, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 27, -1, -1, -1, -1, 141, 11, -1, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 163, -1, 131, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 165, -1, -1, -1, -1, 232, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 32, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 73, -1, -1, -1, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 199, 132, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 161, -1, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, -1, -1, -1, 142, -1, 180, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 231, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 207, 42, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 121, -1, -1, -1, -1, -1, -1, -1, -1, 90, 26, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 115, -1, 188, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 4, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, 53, -1, 189, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + 222, -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, 49, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 191, -1, -1, -1, -1, -1, -1, 211, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 177, -1, -1, -1, -1, 114, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I0 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I0 new file mode 100644 index 0000000000..d4bdc783d6 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I0 @@ -0,0 +1,44 @@ +int h_base_8 [42*52] = { + 9, 117, 204, 26, -1, -1, 189, -1, -1, 205, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 167, -1, -1, 166, 253, 125, 226, 156, 224, 252, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 81, 114, -1, 44, 52, -1, -1, -1, 240, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 8, 58, -1, 158, 104, 209, 54, 18, 128, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 179, 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 231, 41, -1, -1, -1, 194, -1, 159, -1, -1, -1, 103, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 155, -1, -1, -1, -1, 228, -1, 45, -1, 28, -1, 158, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 129, -1, -1, -1, 147, -1, 140, -1, -1, -1, 3, -1, 116, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 142, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 203, -1, -1, -1, -1, -1, -1, 205, -1, 61, 247, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, 185, -1, -1, -1, -1, 0, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, -1, -1, -1, -1, -1, -1, 236, -1, 210, -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 63, -1, 111, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 83, 2, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 115, -1, -1, -1, -1, 145, -1, -1, -1, -1, 3, -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, 175, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 203, -1, -1, -1, -1, -1, -1, -1, 142, -1, 8, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 254, -1, -1, -1, 124, -1, -1, -1, -1, -1, 114, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 220, -1, -1, -1, -1, -1, 194, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 87, 20, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 26, -1, -1, 105, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 76, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 222, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 23, -1, -1, 235, -1, 238, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 46, 139, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 228, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, -1, 143, -1, -1, -1, -1, 160, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 98, 101, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 18, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 71, -1, -1, 240, -1, 9, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 242, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 132, -1, -1, -1, -1, 164, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 57, -1, -1, -1, 40, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 140, -1, 38, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 31, -1, -1, -1, 66, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 239, -1, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 129, -1, -1, -1, 229, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I1 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I1 new file mode 100644 index 0000000000..99909bcf5f --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I1 @@ -0,0 +1,44 @@ +int h_base_9 [42*52] = { + 174, 97, 166, 66, -1, -1, 71, -1, -1, 172, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 27, -1, -1, 36, 48, 92, 31, 187, 185, 3, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, 114, -1, 117, 110, -1, -1, -1, 114, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 136, 175, -1, 113, 72, 123, 118, 28, 186, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 72, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, 44, -1, -1, -1, 121, -1, 80, -1, -1, -1, 48, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 129, -1, -1, -1, -1, 92, -1, 100, -1, 49, -1, 184, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 80, -1, -1, -1, 186, -1, 16, -1, -1, -1, 102, -1, 143, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 118, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 28, -1, -1, -1, -1, -1, -1, 132, -1, 185, 178, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, 104, -1, -1, -1, -1, 22, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 32, -1, -1, -1, -1, -1, -1, 92, -1, 174, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 39, -1, 93, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 49, 125, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, -1, -1, -1, -1, 118, -1, -1, -1, -1, 21, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 87, -1, -1, -1, -1, -1, -1, -1, 177, -1, 135, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 158, -1, -1, -1, 23, -1, -1, -1, -1, -1, 9, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 186, -1, -1, -1, -1, -1, 6, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 58, 42, -1, -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 76, -1, -1, 61, -1, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 157, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 20, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 106, -1, -1, 86, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 182, 153, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 45, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 67, -1, -1, -1, -1, 137, -1, -1, -1, -1, 55, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 103, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 70, 111, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 110, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 120, -1, -1, 154, -1, 52, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 84, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 165, -1, -1, -1, -1, 179, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 77, -1, -1, -1, 184, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 25, -1, 151, -1, -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 84, -1, -1, -1, 151, -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 93, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 147, -1, -1, -1, 7, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I2 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I2 new file mode 100644 index 0000000000..df209d30ce --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I2 @@ -0,0 +1,44 @@ +int h_base_10 [42*52] = { + 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 137, -1, -1, 124, 0, 0, 88, 0, 0, 55, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 20, 94, -1, 99, 9, -1, -1, -1, 108, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 38, 15, -1, 102, 146, 12, 57, 53, 46, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 131, -1, -1, -1, 142, -1, 141, -1, -1, -1, 64, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, 124, -1, 99, -1, 45, -1, 148, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, 45, -1, 148, -1, -1, -1, 96, -1, 78, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, 97, -1, 51, 85, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 17, -1, -1, -1, -1, 156, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, 7, -1, 4, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, 113, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 112, -1, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, 138, -1, -1, -1, -1, 57, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, 79, -1, 111, 143, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, 24, -1, -1, -1, -1, -1, 109, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, 18, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 158, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, 148, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, 75, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, 69, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 0, -1, -1, -1, -1, 100, -1, -1, -1, -1, 13, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, 126, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 0, -1, -1, 35, -1, 51, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 0, -1, -1, -1, -1, 88, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, 157, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 0, -1, 63, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 0, -1, -1, -1, 93, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 0, -1, -1, -1, 2, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I3 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I3 new file mode 100644 index 0000000000..d9efe76f46 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I3 @@ -0,0 +1,44 @@ +int h_base_11 [42*52] = { + 72, 110, 23, 181, -1, -1, 95, -1, -1, 8, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 53, -1, -1, 156, 115, 156, 115, 200, 29, 31, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 152, 131, -1, 46, 191, -1, -1, -1, 91, -1, 0, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 185, 6, -1, 36, 124, 124, 110, 156, 133, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 200, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 185, 138, -1, -1, -1, 170, -1, 219, -1, -1, -1, 193, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 123, -1, -1, -1, -1, 55, -1, 31, -1, 222, -1, 209, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 103, -1, -1, -1, 13, -1, 105, -1, -1, -1, 150, -1, 181, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 147, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2, -1, -1, -1, -1, -1, -1, 30, -1, 184, 83, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 174, 150, -1, -1, -1, -1, 8, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 99, -1, -1, -1, -1, -1, -1, 138, -1, 110, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 46, -1, 217, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 37, 113, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 36, -1, -1, -1, -1, 95, -1, -1, -1, -1, 40, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 75, -1, -1, -1, -1, -1, -1, -1, 158, -1, 134, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, 132, -1, -1, -1, -1, -1, 206, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 68, -1, -1, -1, -1, -1, 16, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 35, 138, -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 6, -1, -1, 20, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 80, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 49, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 156, -1, -1, 54, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 153, 88, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 211, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 90, -1, -1, -1, -1, 6, -1, -1, -1, -1, 221, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 27, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 216, 212, -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 108, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 106, -1, -1, 44, -1, 185, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 108, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 71, -1, -1, -1, -1, 12, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 201, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 91, -1, -1, -1, 165, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 1, -1, 175, -1, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 37, -1, -1, -1, 97, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 106, -1, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 120, -1, -1, -1, 101, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I4 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I4 new file mode 100644 index 0000000000..2522b14f2e --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I4 @@ -0,0 +1,44 @@ +int h_base_12 [42*52] = { + 3, 26, 53, 35, -1, -1, 115, -1, -1, 127, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 19, -1, -1, 94, 104, 66, 84, 98, 69, 50, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 95, 106, -1, 92, 110, -1, -1, -1, 111, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 120, 121, -1, 22, 4, 73, 49, 128, 79, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 42, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 40, 140, -1, -1, -1, 84, -1, 137, -1, -1, -1, 71, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 109, -1, -1, -1, -1, 87, -1, 107, -1, 133, -1, 139, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, 135, -1, 35, -1, -1, -1, 108, -1, 65, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 70, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 97, -1, -1, -1, -1, -1, -1, 40, -1, 24, 49, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 46, 41, -1, -1, -1, -1, 101, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 28, -1, -1, -1, -1, -1, -1, 30, -1, 116, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 33, -1, 122, -1, -1, -1, -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 76, 37, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 143, -1, -1, -1, -1, 51, -1, -1, -1, -1, 130, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, -1, -1, -1, -1, 9, -1, 28, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 120, -1, -1, -1, 43, -1, -1, -1, -1, -1, 65, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 17, -1, -1, -1, -1, -1, 106, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 79, 28, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2, -1, -1, 103, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 54, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 68, -1, -1, 115, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 30, 42, -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 128, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 142, -1, -1, -1, -1, 28, -1, -1, -1, -1, 100, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 13, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 77, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 133, -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 87, -1, -1, 56, -1, 104, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 32, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 135, -1, -1, -1, -1, 6, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 60, -1, -1, -1, 137, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 121, -1, 129, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 1, -1, -1, -1, 70, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 119, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 48, -1, -1, -1, 47, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I5 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I5 new file mode 100644 index 0000000000..f392ef5182 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I5 @@ -0,0 +1,44 @@ +int h_base_13 [42*52] = { + 156, 143, 14, 3, -1, -1, 40, -1, -1, 123, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 17, -1, -1, 65, 63, 1, 55, 37, 171, 133, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 98, 168, -1, 107, 82, -1, -1, -1, 142, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 53, 174, -1, 174, 127, 17, 89, 17, 105, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 86, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 79, 84, -1, -1, -1, 35, -1, 103, -1, -1, -1, 60, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 47, -1, -1, -1, -1, 154, -1, 10, -1, 155, -1, 29, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, 125, -1, 24, -1, -1, -1, 47, -1, 55, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 53, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 104, -1, -1, -1, -1, -1, -1, 142, -1, 99, 64, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 111, 25, -1, -1, -1, -1, 174, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, -1, -1, -1, -1, 175, -1, 24, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 122, -1, 11, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 29, 91, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 11, -1, -1, -1, -1, 145, -1, -1, -1, -1, 8, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 78, -1, -1, -1, -1, -1, -1, -1, 158, -1, 17, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 134, -1, -1, -1, 23, -1, -1, -1, -1, -1, 62, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 173, -1, -1, -1, -1, -1, 31, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 13, 135, -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 128, -1, -1, 52, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 156, -1, -1, -1, -1, -1, -1, -1, 166, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 18, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 110, -1, -1, 132, -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 113, 108, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 72, -1, -1, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 36, -1, -1, -1, -1, 38, -1, -1, -1, -1, 53, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 42, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 64, 24, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 139, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 84, -1, -1, 173, -1, 93, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 116, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 105, -1, -1, -1, -1, 137, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 126, -1, -1, -1, 152, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 73, -1, 154, -1, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 112, -1, -1, -1, 7, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 109, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 132, -1, -1, -1, 6, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I6 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I6 new file mode 100644 index 0000000000..2cbaa1aca3 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I6 @@ -0,0 +1,44 @@ +int h_base_14 [42*52] = { + 143, 19, 176, 165, -1, -1, 196, -1, -1, 13, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 18, -1, -1, 27, 3, 102, 185, 17, 14, 180, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 126, 163, -1, 47, 183, -1, -1, -1, 132, -1, 1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 36, 48, -1, 18, 111, 203, 3, 191, 160, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 43, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 136, 49, -1, -1, -1, 36, -1, 132, -1, -1, -1, 62, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 7, -1, -1, -1, -1, 34, -1, 198, -1, 168, -1, 12, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 163, -1, -1, -1, 78, -1, 143, -1, -1, -1, 107, -1, 58, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 101, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 186, -1, -1, -1, -1, -1, -1, 27, -1, 205, 81, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 125, 60, -1, -1, -1, -1, 177, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, -1, -1, -1, -1, -1, -1, 29, -1, 35, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 18, -1, 155, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 32, 53, -1, -1, -1, -1, -1, -1, 95, -1, -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 91, -1, -1, -1, -1, 20, -1, -1, -1, -1, 52, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 125, -1, -1, -1, -1, -1, -1, -1, 31, -1, 54, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 57, -1, -1, -1, 201, -1, -1, -1, -1, -1, 142, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 129, -1, -1, -1, -1, -1, 203, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 110, 124, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 196, -1, -1, 35, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 202, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 52, -1, -1, 170, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 113, 161, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 197, -1, -1, -1, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 164, -1, -1, -1, -1, 172, -1, -1, -1, -1, 49, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 168, -1, -1, -1, -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 14, 186, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 50, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 70, -1, -1, 17, -1, 50, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 110, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 163, -1, -1, -1, -1, 173, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 157, -1, -1, -1, 167, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 197, -1, 167, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 181, -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 157, -1, -1, -1, 173, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 181, -1, -1, -1, -1, -1, -1, 157, -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, 163, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 191, -1, -1, -1, 197, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I7 b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I7 new file mode 100644 index 0000000000..c6cd7c09ff --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/bgs/BG2_I7 @@ -0,0 +1,44 @@ +int h_base_15 [42*52] = { + 145, 131, 71, 21, -1, -1, 23, -1, -1, 112, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 142, -1, -1, 174, 183, 27, 96, 23, 9, 167, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 74, 31, -1, 3, 53, -1, -1, -1, 155, -1, 0, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 239, 171, -1, 95, 110, 159, 199, 43, 75, 1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 29, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 121, 41, -1, -1, -1, 169, -1, 88, -1, -1, -1, 207, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 137, -1, -1, -1, -1, 72, -1, 172, -1, 124, -1, 56, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 86, -1, -1, -1, 186, -1, 87, -1, -1, -1, 172, -1, 154, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 176, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 167, -1, -1, -1, -1, -1, -1, 238, -1, 48, 68, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 38, 217, -1, -1, -1, -1, 208, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 178, -1, -1, -1, -1, -1, -1, 214, -1, 168, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 122, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 48, 57, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 82, -1, -1, -1, -1, 232, -1, -1, -1, -1, 204, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 170, -1, -1, -1, -1, -1, -1, -1, 23, -1, 175, 202, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 196, -1, -1, -1, 173, -1, -1, -1, -1, -1, 195, 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 128, -1, -1, -1, -1, -1, 211, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, 84, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 117, -1, -1, 227, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 238, -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 195, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 5, -1, -1, 94, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 81, 19, -1, -1, -1, -1, -1, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 66, -1, -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 146, -1, -1, -1, -1, 66, -1, -1, -1, -1, 190, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 7, 144, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, -1, -1, 139, -1, 221, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 179, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 46, -1, -1, -1, -1, 2, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + 184, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, 85, -1, -1, -1, 225, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + 178, -1, 112, -1, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, 42, -1, -1, -1, 41, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + 167, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, 78, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, 180, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 53, -1, -1, -1, 215, -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, +}; \ No newline at end of file diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu new file mode 100644 index 0000000000..161b3624d3 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu @@ -0,0 +1,548 @@ + /*! \file PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu + * \brief LDPC cuda support BG1 all length + * \author NCTU OpinConnect Terng-Yin Hsu,WEI-YING,LIN + * \email tyhsu@cs.nctu.edu.tw + * \date 13-05-2020 + * \version + * \note + * \warning + */ + +#include +#include +#include +#include +#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" +#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h" + +#include "bgs/BG1_I0" +#include "bgs/BG1_I1" +#include "bgs/BG1_I2" +#include "bgs/BG1_I3" +#include "bgs/BG1_I4" +#include "bgs/BG1_I5" +#include "bgs/BG1_I6" +#include "bgs/BG1_I7" +#include "bgs/BG2_I0" +#include "bgs/BG2_I1" +#include "bgs/BG2_I2" +#include "bgs/BG2_I3" +#include "bgs/BG2_I4" +#include "bgs/BG2_I5" +#include "bgs/BG2_I6" +#include "bgs/BG2_I7" + +#define MAX_ITERATION 5 +#define MC 1 + +#define cudaCheck(ans) { cudaAssert((ans), __FILE__, __LINE__); } +inline void cudaAssert(cudaError_t code, const char *file, int line) +{ + if (code != cudaSuccess){ + fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line); + exit(code); + } +} + +typedef struct{ + char x; + char y; + short value; +} h_element; + + +h_element h_compact1 [46*19] = {}; +h_element h_compact2 [68*30] = {}; + +__device__ __constant__ h_element dev_h_compact1[46*19]; // used in kernel 1 +__device__ __constant__ h_element dev_h_compact2[68*30]; // used in kernel 2 + +// row and col element count +__device__ __constant__ char h_ele_row_bg1_count[46] = { + 19, 19, 19, 19, 3, 8, 9, 7, 10, 9, + 7, 8, 7, 6, 7, 7, 6, 6, 6, 6, + 6, 6, 5, 5, 6, 5, 5, 4, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 4, 5, 4, 5, 5, 4}; +__device__ __constant__ char h_ele_col_bg1_count[68] = { + 30, 28, 7, 11, 9, 4, 8, 12, 8, 7, + 12, 10, 12, 11, 10, 7, 10, 10, 13, 7, + 8, 11, 12, 5, 6, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1}; +__device__ __constant__ char h_ele_row_bg2_count[42] = { + 8, 10, 8, 10, 4, 6, 6, 6, 4, 5, + 5, 5, 4, 5, 5, 4, 5, 5, 4, 4, + 4, 4, 3, 4, 4, 3, 5, 3, 4, 3, + 5, 3, 4, 4, 4, 4, 4, 3, 4, 4, + 4, 4}; +__device__ __constant__ char h_ele_col_bg2_count[52] = { + 22, 23, 10, 5, 5, 14, 7, 13, 6, 8, + 9, 16, 9, 12, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1}; + + +__global__ void warmup() +{ + // warm up gpu for time measurement +} + + +// Kernel 1 +__global__ void ldpc_cnp_kernel_1st_iter(char * dev_llr, char * dev_dt, int BG, int row, int col, int Zc) +{ +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp %d\n", threadIdx.x); + int iMCW = blockIdx.y; // codeword id + int iBlkRow = blockIdx.x; // block row in h_base + int iBlkCol; // block col in h_base + int iSubRow = threadIdx.x; // row index in sub_block of h_base + int iCol; // overall col index in h_base + int offsetR; + int shift_t; + +// For 2-min algorithm. + int Q_sign = 0; + int sq; + int Q, Q_abs; + int R_temp; + + int sign = 1; + int rmin1 = INT32_MAX; + int rmin2 = INT32_MAX; + char idx_min = 0; + + h_element h_element_t; + int s = (BG==1)? h_ele_row_bg1_count[iBlkRow]:h_ele_row_bg2_count[iBlkRow]; + offsetR = (iMCW * row*col*Zc) + iBlkRow * Zc + iSubRow; // row*col*Zc = size of dev_dt +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("s: %d, offset %d\n", s, offsetR); +// The 1st recursion + for(int i = 0; i < s; i++) // loop through all the ZxZ sub-blocks in a row + { + h_element_t = dev_h_compact1[i*row+iBlkRow]; // compact_col == row + + iBlkCol = h_element_t.y; + shift_t = h_element_t.value; + + shift_t = (iSubRow + shift_t) % Zc; + iCol = (iMCW * col*Zc) + iBlkCol * Zc + shift_t; // col*Zc = size of llr + Q = dev_llr[iCol]; + Q_abs = (Q>0)? Q : -Q; + sq = Q < 0; +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("i %d, icol %d, Q: %d\n", i, iCol, Q); + // quick version + sign = sign * (1 - sq * 2); + Q_sign |= sq << i; + + if (Q_abs < rmin1){ + rmin2 = rmin1; + rmin1 = Q_abs; + idx_min = i; + } else if (Q_abs < rmin2){ + rmin2 = Q_abs; + } + } + +// if(blockIdx.x == 0 && threadIdx.x == 1)printf("min1 %d, min2 %d, min1_idx %d\n", rmin1, rmin2, idx_min); + +// The 2nd recursion + for(int i = 0; i < s; i++){ + // v0: Best performance so far. 0.75f is the value of alpha. + sq = 1 - 2 * ((Q_sign >> i) & 0x01); + R_temp = 0.8 * sign * sq * (i != idx_min ? rmin1 : rmin2); + // write results to global memory + h_element_t = dev_h_compact1[i*row+iBlkRow]; + int addr_temp = offsetR + h_element_t.y * row * Zc; + dev_dt[addr_temp] = R_temp; +// if(blockIdx.x == 0 && threadIdx.x == 1)printf("R_temp %d, temp_addr %d\n", R_temp, addr_temp); + } +} + +// Kernel_1 +__global__ void ldpc_cnp_kernel(char * dev_llr, char * dev_dt, int BG, int row, int col, int Zc) +{ +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp\n"); + int iMCW = blockIdx.y; + int iBlkRow = blockIdx.x; // block row in h_base + int iBlkCol; // block col in h_base + int iSubRow = threadIdx.x; // row index in sub_block of h_base + int iCol; // overall col index in h_base + int offsetR; + int shift_t; + +// For 2-min algorithm. + int Q_sign = 0; + int sq; + int Q, Q_abs; + int R_temp; + + int sign = 1; + int rmin1 = INT32_MAX; + int rmin2 = INT32_MAX; + char idx_min = 0; + + h_element h_element_t; + int s = (BG==1)? h_ele_row_bg1_count[iBlkRow]: h_ele_row_bg2_count[iBlkRow]; + offsetR = (iMCW *row*col*Zc) + iBlkRow * Zc + iSubRow; // row * col * Zc = size of dev_dt +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("s: %d, offset %d\n", s, offsetR); +// The 1st recursion + for(int i = 0; i < s; i++) // loop through all the ZxZ sub-blocks in a row + { + h_element_t = dev_h_compact1[i*row+iBlkRow]; + + iBlkCol = h_element_t.y; + shift_t = h_element_t.value; + shift_t = (iSubRow + shift_t) % Zc; + iCol = iBlkCol * Zc + shift_t; + + R_temp = dev_dt[offsetR + iBlkCol * row * Zc]; + + Q = dev_llr[iMCW * (col*Zc) + iCol] - R_temp; + Q_abs = (Q>0)? Q : -Q; +// if(blockIdx.x == 0 && threadIdx.x == 1) printf("i %d, icol %d, Q: %d\n", i, iCol, Q); + sq = Q < 0; + sign = sign * (1 - sq * 2); + Q_sign |= sq << i; + + if (Q_abs < rmin1){ + rmin2 = rmin1; + rmin1 = Q_abs; + idx_min = i; + } else if (Q_abs < rmin2){ + rmin2 = Q_abs; + } + + } + +// if(blockIdx.x == 0 && threadIdx.x == 1)printf("min1 %d, min2 %d, min1_idx %d\n", rmin1, rmin2, idx_min); + +// The 2nd recursion + for(int i = 0; i < s; i ++){ + sq = 1 - 2 * ((Q_sign >> i) & 0x01); + R_temp = 0.8 * sign * sq * (i != idx_min ? rmin1 : rmin2); + + + // write results to global memory + h_element_t = dev_h_compact1[i*row+iBlkRow]; + int addr_temp = h_element_t.y * row * Zc + offsetR; + dev_dt[addr_temp] = R_temp; +// if(blockIdx.x == 0 && threadIdx.x == 1)printf("R_temp %d, temp_addr %d\n", R_temp, addr_temp); + } +} + +// Kernel 2: VNP processing +__global__ void +ldpc_vnp_kernel_normal(char * dev_llr, char * dev_dt, char * dev_const_llr, int BG, int row, int col, int Zc) +{ + int iMCW = blockIdx.y; + int iBlkCol = blockIdx.x; + int iBlkRow; + int iSubCol = threadIdx.x; + int iRow; + int iCol; + + int shift_t, sf; + int APP; + + h_element h_element_t; + + // update all the llr values + iCol = iBlkCol * Zc + iSubCol; + APP = dev_const_llr[iMCW *col*Zc + iCol]; + int offsetDt = iMCW *row*col*Zc + iBlkCol * row * Zc; + int s = (BG==1)? h_ele_col_bg1_count[iBlkCol]:h_ele_col_bg2_count[iBlkCol]; + + for(int i = 0; i < s; i++) + { + h_element_t = dev_h_compact2[i*col+iBlkCol]; + + shift_t = h_element_t.value%Zc; + iBlkRow = h_element_t.x; + + sf = iSubCol - shift_t; + sf = (sf + Zc) % Zc; + + iRow = iBlkRow * Zc + sf; + APP = APP + dev_dt[offsetDt + iRow]; + } + if(APP > SCHAR_MAX) APP = SCHAR_MAX; + if(APP < SCHAR_MIN) APP = SCHAR_MIN; + // write back to device global memory + dev_llr[iMCW *col*Zc + iCol] = APP; +} + + +__global__ void pack_decoded_bit(char *dev, unsigned char *host, int col, int Zc) +{ + __shared__ unsigned char tmp[128]; + int iMCW = blockIdx.y; + int tid = iMCW * col*Zc + blockIdx.x*128 + threadIdx.x; + int btid = threadIdx.x; + tmp[btid] = 0; + + if(dev[tid] < 0){ + tmp[btid] = 1 << (7-(btid&7)); + } + __syncthreads(); + + if(threadIdx.x < 16){ + host[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] = 0; + for(int i = 0; i < 8; i++){ + host[iMCW * col*Zc + blockIdx.x*16+threadIdx.x] += tmp[threadIdx.x*8+i]; + } + } +} + +void read_BG(int BG, int *h, int row, int col) +{ + int compact_row = 30, compact_col = 19; + if(BG==2){compact_row = 10, compact_col = 23;} + + h_element h_element_temp; + + // init the compact matrix + for(int i = 0; i < compact_col; i++){ + for(int j = 0; j < row; j++){ + h_element_temp.x = 0; + h_element_temp.y = 0; + h_element_temp.value = -1; + h_compact1[i*row+j] = h_element_temp; // h[i][0-11], the same column + } + } + // scan the h matrix, and gengerate compact mode of h + for(int i = 0; i < row; i++){ + int k = 0; + for(int j = 0; j < col; j++){ + if(h[i*col+j] != -1){ + h_element_temp.x = i; + h_element_temp.y = j; + h_element_temp.value = h[i*col+j]; + h_compact1[k*row+i] = h_element_temp; + k++; + } + } + } + + // h_compact2 + // init the compact matrix + for(int i = 0; i < compact_row; i++){ + for(int j = 0; j < col; j++){ + h_element_temp.x = 0; + h_element_temp.y = 0; + h_element_temp.value = -1; + h_compact2[i*col+j] = h_element_temp; + } + } + + for(int j = 0; j < col; j++){ + int k=0; + for(int i = 0; i < row; i++){ + if(h[i*col+j] != -1){ + // although h is transposed, the (x,y) is still (iBlkRow, iBlkCol) + h_element_temp.x = i; + h_element_temp.y = j; + h_element_temp.value = h[i*col+j]; + h_compact2[k*col+j] = h_element_temp; + k++; + } + } + } + + /* + for(int i = 0; i < compact_col; i++){ + for(int j = 0; j < row; j++){ + printf("%3d, ", h_compact1[i*row+j].value); + } + printf("\n"); + } + + for(int i = 0; i < compact_row; i++){ + for(int j = 0; j < col; j++){ + printf("%3d,", h_compact2[i*col+j].value); + } + printf("\n"); + } + */ +} + + +extern "C" +int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length, time_stats_t *time_decoder) +{ + // alloc mem + //unsigned char *decision = (unsigned char*)p_out; + + uint16_t Zc = p_decParams->Z; + uint8_t BG = p_decParams->BG; + uint8_t numMaxIter = p_decParams->numMaxIter; + e_nrLDPC_outMode outMode = p_decParams->outMode; + + uint8_t row,col; + if(BG == 1){ + row = 46; + col = 68; + } + else{ + row = 42; + col = 52; + } + int compact_row = 30, compact_col = 19, lift_index=0;; + if(BG==2){compact_row = 10, compact_col = 23;} + + short lift_set[][9] = { + {2,4,8,16,32,64,128,256}, + {3,6,12,24,48,96,192,384}, + {5,10,20,40,80,160,320}, + {7,14,28,56,112,224}, + {9,18,36,72,144,288}, + {11,22,44,88,176,352}, + {13,26,52,104,208}, + {15,30,60,120,240}, + {0} + }; + + for(int i = 0; lift_set[i][0] != 0; i++){ + for(int j = 0; lift_set[i][j] != 0; j++){ + if(Zc == lift_set[i][j]){ + lift_index = i; + break; + } + } + } + + int *h = NULL; + switch(lift_index){ + case 0: + h = (BG == 1)? h_base_0:h_base_8; + break; + case 1: + h = (BG == 1)? h_base_1:h_base_9; + break; + case 2: + h = (BG == 1)? h_base_2:h_base_10; + break; + case 3: + h = (BG == 1)? h_base_3:h_base_11; + break; + case 4: + h = (BG == 1)? h_base_4:h_base_12; + break; + case 5: + h = (BG == 1)? h_base_5:h_base_13; + break; + case 6: + h = (BG == 1)? h_base_6:h_base_14; + break; + case 7: + h = (BG == 1)? h_base_7:h_base_15; + break; + } + /* pack BG in compact graph */ + read_BG(BG, h, row, col); + + + int memorySize_h_compact1 = row * compact_col * sizeof(h_element); + int memorySize_h_compact2 = compact_row * col * sizeof(h_element); + +// cpu + int memorySize_hard_decision = col * Zc * sizeof(unsigned char) * MC; + + +// alloc memory + unsigned char *hard_decision = (unsigned char*)p_out; + +// gpu + int memorySize_llr_cuda = col * Zc * sizeof(char) * MC; + int memorySize_dt_cuda = row * Zc * col * sizeof(char) * MC; + + +// alloc memory + char *dev_llr; + char *dev_dt; + char *dev_const_llr; + unsigned char *dev_tmp; + + cudaCheck( cudaMalloc((void **)&dev_tmp, memorySize_hard_decision) ); + cudaCheck( cudaMalloc((void **)&dev_llr, memorySize_llr_cuda) ); + cudaCheck( cudaMalloc((void **)&dev_const_llr, memorySize_llr_cuda) ); + cudaCheck( cudaMalloc((void **)&dev_dt, memorySize_dt_cuda) ); + +// memcpy host to device + + cudaCheck( cudaMemcpyToSymbol(dev_h_compact1, h_compact1, memorySize_h_compact1) ); + cudaCheck( cudaMemcpyToSymbol(dev_h_compact2, h_compact2, memorySize_h_compact2) ); + cudaCheck( cudaMemcpy((void*)dev_const_llr, p_llr, memorySize_llr_cuda, cudaMemcpyHostToDevice) ); +start_meas(time_decoder); + cudaCheck( cudaMemcpy((void*)dev_llr, p_llr, memorySize_llr_cuda, cudaMemcpyHostToDevice) ); + + +// Define CUDA kernel dimension + int blockSizeX = Zc; + dim3 dimGridKernel1(row, MC, 1); // dim of the thread blocks + dim3 dimBlockKernel1(blockSizeX, 1, 1); + + dim3 dimGridKernel2(col, MC, 1); + dim3 dimBlockKernel2(blockSizeX, 1, 1); + cudaDeviceSynchronize(); + + cudaEvent_t start, end; + float time; + + warmup<<>>(); + warmup<<>>(); + + + cudaEventCreate(&start); + cudaEventCreate(&end); + cudaEventRecord(start, 0); + +// cudaProfilerStart(); + +// lauch kernel + for(int ii = 0; ii < MAX_ITERATION; ii++){ + // first kernel + if(ii == 0){ + ldpc_cnp_kernel_1st_iter + <<>> + (dev_llr, dev_dt, BG, row, col, Zc); + }else{ + ldpc_cnp_kernel + <<>> + (dev_llr, dev_dt, BG, row, col, Zc); + } + + // second kernel + + ldpc_vnp_kernel_normal + <<>> + (dev_llr, dev_dt, dev_const_llr, BG, row, col, Zc); + + } + int pack = (block_length/128)+1; + dim3 pack_block(pack, MC, 1); + pack_decoded_bit<<>>(dev_llr, dev_tmp, col, Zc); + + + cudaEventRecord(end, 0); + cudaEventSynchronize(end); + cudaEventElapsedTime(&time, start, end); + + + //cudaCheck( cudaMemcpy((*)hard_decision, (const void*)dev_tmp, memorySize_hard_decision, cudaMemcpyDeviceToHost) ); + cudaCheck( cudaMemcpy((void*)hard_decision, (const void*)dev_tmp, (block_length/8)*sizeof(unsigned char), cudaMemcpyDeviceToHost) ); + cudaDeviceSynchronize(); +stop_meas(time_decoder); + + cudaCheck( cudaFree(dev_llr) ); + cudaCheck( cudaFree(dev_dt) ); + cudaCheck( cudaFree(dev_const_llr) ); + cudaCheck( cudaFree(dev_tmp) ); + + //free(hard_decision); + return MAX_ITERATION; + +} diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h new file mode 100644 index 0000000000..0e78f988ba --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h @@ -0,0 +1,26 @@ +#ifndef __NR_LDPC_DECODER_LYC__H__ +#define __NR_LDPC_DECODER_LYC__H__ + + +/*! \file PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h + * \brief LDPC cuda support BG1 all length + * \author NCTU OpinConnect Terng-Yin Hsu,WEI-YING,LIN + * \email tyhsu@cs.nctu.edu.tw + * \date 13-05-2020 + * \version + * \note + * \warning + */ + + +/*** + \brief LDPC decoder + \param p_decParams LDPC decoder parameters + \param p_llr Input LLRs + \param p_llrOut Output vector + \param p_profiler LDPC profiler statistics +****/ + +int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length, time_stats_t *time_decoder); + +#endif diff --git a/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC_debug.cu b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC_debug.cu new file mode 100644 index 0000000000..0d22a312bd --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC_debug.cu @@ -0,0 +1,396 @@ +#include +#include +#include +#include +#include "PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_types.h" +#include "PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_defs.h" + +#define MAX_ITERATION 5 +#define CW 1 + +#define cudaCheck(ans) { cudaAssert((ans), __FILE__, __LINE__); } +inline void cudaAssert(cudaError_t code, const char *file, int line) +{ + if (code != cudaSuccess){ + fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line); + exit(code); + } +} +// row and col element count + + + +typedef struct{ + char x; + char y; + short value; +} h_element; + +__device__ __constant__ char h_element_count1_bg1[46] = { + 19, 19, 19, 19, 3, 8, 9, 7, 10, 9, + 7, 8, 7, 6, 7, 7, 6, 6, 6, 6, + 6, 6, 5, 5, 6, 5, 5, 4, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 4, 5, 4, 5, 5, 4}; +__device__ __constant__ char h_element_count2_bg1[68] = { + 30, 28, 7, 11, 9, 4, 8, 12, 8, 7, + 12, 10, 12, 11, 10, 7, 10, 10, 13, 7, + 8, 11, 12, 5, 6, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1}; +__device__ __constant__ char h_element_count1_bg2[42] = { + 8, 10, 8, 10, 4, 6, 6, 6, 4, 5, + 5, 5, 4, 5, 5, 4, 5, 5, 4, 4, + 4, 4, 3, 4, 4, 3, 5, 3, 4, 3, + 5, 3, 4, 4, 4, 4, 4, 3, 4, 4, + 4, 4}; +__device__ __constant__ char h_element_count2_bg2[52] = { + 22, 23, 10, 5, 5, 14, 7, 13, 6, 8, + 9, 16, 9, 12, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1}; + +// BG +__device__ __constant__ h_element dev_h_base1_1[316]={ + { .x= 0, .y= 0, .value=307 }, { .x= 0, .y= 1, .value= 19 }, { .x= 0, .y= 2, .value= 50 }, { .x= 0, .y= 3, .value=369 }, { .x= 0, .y= 5, .value=181 }, { .x= 0, .y= 6, .value=216 }, { .x= 0, .y= 9, .value=317 }, { .x= 0, .y=10, .value=288 }, { .x= 0, .y=11, .value=109 }, { .x= 0, .y=12, .value= 17 }, + { .x= 0, .y=13, .value=357 }, { .x= 0, .y=15, .value=215 }, { .x= 0, .y=16, .value=106 }, { .x= 0, .y=18, .value=242 }, { .x= 0, .y=19, .value=180 }, { .x= 0, .y=20, .value=330 }, { .x= 0, .y=21, .value=346 }, { .x= 0, .y=22, .value= 1 }, { .x= 0, .y=23, .value= 0 }, { .x= 1, .y= 0, .value= 76 }, + { .x= 1, .y= 2, .value= 76 }, { .x= 1, .y= 3, .value= 73 }, { .x= 1, .y= 4, .value=288 }, { .x= 1, .y= 5, .value=144 }, { .x= 1, .y= 7, .value=331 }, { .x= 1, .y= 8, .value=331 }, { .x= 1, .y= 9, .value=178 }, { .x= 1, .y=11, .value=295 }, { .x= 1, .y=12, .value=342 }, { .x= 1, .y=14, .value=217 }, + { .x= 1, .y=15, .value= 99 }, { .x= 1, .y=16, .value=354 }, { .x= 1, .y=17, .value=114 }, { .x= 1, .y=19, .value=331 }, { .x= 1, .y=21, .value=112 }, { .x= 1, .y=22, .value= 0 }, { .x= 1, .y=23, .value= 0 }, { .x= 1, .y=24, .value= 0 }, { .x= 2, .y= 0, .value=205 }, { .x= 2, .y= 1, .value=250 }, + { .x= 2, .y= 2, .value=328 }, { .x= 2, .y= 4, .value=332 }, { .x= 2, .y= 5, .value=256 }, { .x= 2, .y= 6, .value=161 }, { .x= 2, .y= 7, .value=267 }, { .x= 2, .y= 8, .value=160 }, { .x= 2, .y= 9, .value= 63 }, { .x= 2, .y=10, .value=129 }, { .x= 2, .y=13, .value=200 }, { .x= 2, .y=14, .value= 88 }, + { .x= 2, .y=15, .value= 53 }, { .x= 2, .y=17, .value=131 }, { .x= 2, .y=18, .value=240 }, { .x= 2, .y=19, .value=205 }, { .x= 2, .y=20, .value= 13 }, { .x= 2, .y=24, .value= 0 }, { .x= 2, .y=25, .value= 0 }, { .x= 3, .y= 0, .value=276 }, { .x= 3, .y= 1, .value= 87 }, { .x= 3, .y= 3, .value= 0 }, + { .x= 3, .y= 4, .value=275 }, { .x= 3, .y= 6, .value=199 }, { .x= 3, .y= 7, .value=153 }, { .x= 3, .y= 8, .value= 56 }, { .x= 3, .y=10, .value=132 }, { .x= 3, .y=11, .value=305 }, { .x= 3, .y=12, .value=231 }, { .x= 3, .y=13, .value=341 }, { .x= 3, .y=14, .value=212 }, { .x= 3, .y=16, .value=304 }, + { .x= 3, .y=17, .value=300 }, { .x= 3, .y=18, .value=271 }, { .x= 3, .y=20, .value= 39 }, { .x= 3, .y=21, .value=357 }, { .x= 3, .y=22, .value= 1 }, { .x= 3, .y=25, .value= 0 }, { .x= 4, .y= 0, .value=332 }, { .x= 4, .y= 1, .value=181 }, { .x= 4, .y=26, .value= 0 }, { .x= 5, .y= 0, .value=195 }, + { .x= 5, .y= 1, .value= 14 }, { .x= 5, .y= 3, .value=115 }, { .x= 5, .y=12, .value=166 }, { .x= 5, .y=16, .value=241 }, { .x= 5, .y=21, .value= 51 }, { .x= 5, .y=22, .value=157 }, { .x= 5, .y=27, .value= 0 }, { .x= 6, .y= 0, .value=278 }, { .x= 6, .y= 6, .value=257 }, { .x= 6, .y=10, .value= 1 }, + { .x= 6, .y=11, .value=351 }, { .x= 6, .y=13, .value= 92 }, { .x= 6, .y=17, .value=253 }, { .x= 6, .y=18, .value= 18 }, { .x= 6, .y=20, .value=225 }, { .x= 6, .y=28, .value= 0 }, { .x= 7, .y= 0, .value= 9 }, { .x= 7, .y= 1, .value= 62 }, { .x= 7, .y= 4, .value=316 }, { .x= 7, .y= 7, .value=333 }, + { .x= 7, .y= 8, .value=290 }, { .x= 7, .y=14, .value=114 }, { .x= 7, .y=29, .value= 0 }, { .x= 8, .y= 0, .value=307 }, { .x= 8, .y= 1, .value=179 }, { .x= 8, .y= 3, .value=165 }, { .x= 8, .y=12, .value= 18 }, { .x= 8, .y=16, .value= 39 }, { .x= 8, .y=19, .value=224 }, { .x= 8, .y=21, .value=368 }, + { .x= 8, .y=22, .value= 67 }, { .x= 8, .y=24, .value=170 }, { .x= 8, .y=30, .value= 0 }, { .x= 9, .y= 0, .value=366 }, { .x= 9, .y= 1, .value=232 }, { .x= 9, .y=10, .value=321 }, { .x= 9, .y=11, .value=133 }, { .x= 9, .y=13, .value= 57 }, { .x= 9, .y=17, .value=303 }, { .x= 9, .y=18, .value= 63 }, + { .x= 9, .y=20, .value= 82 }, { .x= 9, .y=31, .value= 0 }, { .x=10, .y= 1, .value=101 }, { .x=10, .y= 2, .value=339 }, { .x=10, .y= 4, .value=274 }, { .x=10, .y= 7, .value=111 }, { .x=10, .y= 8, .value=383 }, { .x=10, .y=14, .value=354 }, { .x=10, .y=32, .value= 0 }, { .x=11, .y= 0, .value= 48 }, + { .x=11, .y= 1, .value=102 }, { .x=11, .y=12, .value= 8 }, { .x=11, .y=16, .value= 47 }, { .x=11, .y=21, .value=188 }, { .x=11, .y=22, .value=334 }, { .x=11, .y=23, .value=115 }, { .x=11, .y=33, .value= 0 }, { .x=12, .y= 0, .value= 77 }, { .x=12, .y= 1, .value=186 }, { .x=12, .y=10, .value=174 }, + { .x=12, .y=11, .value=232 }, { .x=12, .y=13, .value= 50 }, { .x=12, .y=18, .value= 74 }, { .x=12, .y=34, .value= 0 }, { .x=13, .y= 0, .value=313 }, { .x=13, .y= 3, .value=177 }, { .x=13, .y= 7, .value=266 }, { .x=13, .y=20, .value=115 }, { .x=13, .y=23, .value=370 }, { .x=13, .y=35, .value= 0 }, + { .x=14, .y= 0, .value=142 }, { .x=14, .y=12, .value=248 }, { .x=14, .y=15, .value=137 }, { .x=14, .y=16, .value= 89 }, { .x=14, .y=17, .value=347 }, { .x=14, .y=21, .value= 12 }, { .x=14, .y=36, .value= 0 }, { .x=15, .y= 0, .value=241 }, { .x=15, .y= 1, .value= 2 }, { .x=15, .y=10, .value=210 }, + { .x=15, .y=13, .value=318 }, { .x=15, .y=18, .value= 55 }, { .x=15, .y=25, .value=269 }, { .x=15, .y=37, .value= 0 }, { .x=16, .y= 1, .value= 13 }, { .x=16, .y= 3, .value=338 }, { .x=16, .y=11, .value= 57 }, { .x=16, .y=20, .value=289 }, { .x=16, .y=22, .value= 57 }, { .x=16, .y=38, .value= 0 }, + { .x=17, .y= 0, .value=260 }, { .x=17, .y=14, .value=303 }, { .x=17, .y=16, .value= 81 }, { .x=17, .y=17, .value=358 }, { .x=17, .y=21, .value=375 }, { .x=17, .y=39, .value= 0 }, { .x=18, .y= 1, .value=130 }, { .x=18, .y=12, .value=163 }, { .x=18, .y=13, .value=280 }, { .x=18, .y=18, .value=132 }, + { .x=18, .y=19, .value= 4 }, { .x=18, .y=40, .value= 0 }, { .x=19, .y= 0, .value=145 }, { .x=19, .y= 1, .value=213 }, { .x=19, .y= 7, .value=344 }, { .x=19, .y= 8, .value=242 }, { .x=19, .y=10, .value=197 }, { .x=19, .y=41, .value= 0 }, { .x=20, .y= 0, .value=187 }, { .x=20, .y= 3, .value=206 }, + { .x=20, .y= 9, .value=264 }, { .x=20, .y=11, .value=341 }, { .x=20, .y=22, .value= 59 }, { .x=20, .y=42, .value= 0 }, { .x=21, .y= 1, .value=205 }, { .x=21, .y= 5, .value=102 }, { .x=21, .y=16, .value=328 }, { .x=21, .y=20, .value=213 }, { .x=21, .y=21, .value= 97 }, { .x=21, .y=43, .value= 0 }, + { .x=22, .y= 0, .value= 30 }, { .x=22, .y=12, .value= 11 }, { .x=22, .y=13, .value=233 }, { .x=22, .y=17, .value= 22 }, { .x=22, .y=44, .value= 0 }, { .x=23, .y= 1, .value= 24 }, { .x=23, .y= 2, .value= 89 }, { .x=23, .y=10, .value= 61 }, { .x=23, .y=18, .value= 27 }, { .x=23, .y=45, .value= 0 }, + { .x=24, .y= 0, .value=298 }, { .x=24, .y= 3, .value=158 }, { .x=24, .y= 4, .value=235 }, { .x=24, .y=11, .value=339 }, { .x=24, .y=22, .value=234 }, { .x=24, .y=46, .value= 0 }, { .x=25, .y= 1, .value= 72 }, { .x=25, .y= 6, .value= 17 }, { .x=25, .y= 7, .value=383 }, { .x=25, .y=14, .value=312 }, + { .x=25, .y=47, .value= 0 }, { .x=26, .y= 0, .value= 71 }, { .x=26, .y= 2, .value= 81 }, { .x=26, .y= 4, .value= 76 }, { .x=26, .y=15, .value=136 }, { .x=26, .y=48, .value= 0 }, { .x=27, .y= 1, .value=194 }, { .x=27, .y= 6, .value=194 }, { .x=27, .y= 8, .value=101 }, { .x=27, .y=49, .value= 0 }, + { .x=28, .y= 0, .value=222 }, { .x=28, .y= 4, .value= 19 }, { .x=28, .y=19, .value=244 }, { .x=28, .y=21, .value=274 }, { .x=28, .y=50, .value= 0 }, { .x=29, .y= 1, .value=252 }, { .x=29, .y=14, .value= 5 }, { .x=29, .y=18, .value=147 }, { .x=29, .y=25, .value= 78 }, { .x=29, .y=51, .value= 0 }, + { .x=30, .y= 0, .value=159 }, { .x=30, .y=10, .value=229 }, { .x=30, .y=13, .value=260 }, { .x=30, .y=24, .value= 90 }, { .x=30, .y=52, .value= 0 }, { .x=31, .y= 1, .value=100 }, { .x=31, .y= 7, .value=215 }, { .x=31, .y=22, .value=258 }, { .x=31, .y=25, .value=256 }, { .x=31, .y=53, .value= 0 }, + { .x=32, .y= 0, .value=102 }, { .x=32, .y=12, .value=201 }, { .x=32, .y=14, .value=175 }, { .x=32, .y=24, .value=287 }, { .x=32, .y=54, .value= 0 }, { .x=33, .y= 1, .value=323 }, { .x=33, .y= 2, .value= 8 }, { .x=33, .y=11, .value=361 }, { .x=33, .y=21, .value=105 }, { .x=33, .y=55, .value= 0 }, + { .x=34, .y= 0, .value=230 }, { .x=34, .y= 7, .value=148 }, { .x=34, .y=15, .value=202 }, { .x=34, .y=17, .value=312 }, { .x=34, .y=56, .value= 0 }, { .x=35, .y= 1, .value=320 }, { .x=35, .y= 6, .value=335 }, { .x=35, .y=12, .value= 2 }, { .x=35, .y=22, .value=266 }, { .x=35, .y=57, .value= 0 }, + { .x=36, .y= 0, .value=210 }, { .x=36, .y=14, .value=313 }, { .x=36, .y=15, .value=297 }, { .x=36, .y=18, .value= 21 }, { .x=36, .y=58, .value= 0 }, { .x=37, .y= 1, .value=269 }, { .x=37, .y=13, .value= 82 }, { .x=37, .y=23, .value=115 }, { .x=37, .y=59, .value= 0 }, { .x=38, .y= 0, .value=185 }, + { .x=38, .y= 9, .value=177 }, { .x=38, .y=10, .value=289 }, { .x=38, .y=12, .value=214 }, { .x=38, .y=60, .value= 0 }, { .x=39, .y= 1, .value=258 }, { .x=39, .y= 3, .value= 93 }, { .x=39, .y= 7, .value=346 }, { .x=39, .y=19, .value=297 }, { .x=39, .y=61, .value= 0 }, { .x=40, .y= 0, .value=175 }, + { .x=40, .y= 8, .value= 37 }, { .x=40, .y=17, .value=312 }, { .x=40, .y=62, .value= 0 }, { .x=41, .y= 1, .value= 52 }, { .x=41, .y= 3, .value=314 }, { .x=41, .y= 9, .value=139 }, { .x=41, .y=18, .value=288 }, { .x=41, .y=63, .value= 0 }, { .x=42, .y= 0, .value=113 }, { .x=42, .y= 4, .value= 14 }, + { .x=42, .y=24, .value=218 }, { .x=42, .y=64, .value= 0 }, { .x=43, .y= 1, .value=113 }, { .x=43, .y=16, .value=132 }, { .x=43, .y=18, .value=114 }, { .x=43, .y=25, .value=168 }, { .x=43, .y=65, .value= 0 }, { .x=44, .y= 0, .value= 80 }, { .x=44, .y= 7, .value= 78 }, { .x=44, .y= 9, .value=163 }, + { .x=44, .y=22, .value=274 }, { .x=44, .y=66, .value= 0 }, { .x=45, .y= 1, .value=135 }, { .x=45, .y= 6, .value=149 }, { .x=45, .y=10, .value= 15 }, { .x=45, .y=67, .value= 0 } }; +__device__ __constant__ h_element* dev_h_compact1[46]={ + &(dev_h_base1_1[ 0]), &(dev_h_base1_1[ 19]), &(dev_h_base1_1[ 38]), &(dev_h_base1_1[ 57]), &(dev_h_base1_1[ 76]), &(dev_h_base1_1[ 79]), &(dev_h_base1_1[ 87]), &(dev_h_base1_1[ 96]), &(dev_h_base1_1[103]), &(dev_h_base1_1[113]), + &(dev_h_base1_1[122]), &(dev_h_base1_1[129]), &(dev_h_base1_1[137]), &(dev_h_base1_1[144]), &(dev_h_base1_1[150]), &(dev_h_base1_1[157]), &(dev_h_base1_1[164]), &(dev_h_base1_1[170]), &(dev_h_base1_1[176]), &(dev_h_base1_1[182]), + &(dev_h_base1_1[188]), &(dev_h_base1_1[194]), &(dev_h_base1_1[200]), &(dev_h_base1_1[205]), &(dev_h_base1_1[210]), &(dev_h_base1_1[216]), &(dev_h_base1_1[221]), &(dev_h_base1_1[226]), &(dev_h_base1_1[230]), &(dev_h_base1_1[235]), + &(dev_h_base1_1[240]), &(dev_h_base1_1[245]), &(dev_h_base1_1[250]), &(dev_h_base1_1[255]), &(dev_h_base1_1[260]), &(dev_h_base1_1[265]), &(dev_h_base1_1[270]), &(dev_h_base1_1[275]), &(dev_h_base1_1[279]), &(dev_h_base1_1[284]), + &(dev_h_base1_1[289]), &(dev_h_base1_1[293]), &(dev_h_base1_1[298]), &(dev_h_base1_1[302]), &(dev_h_base1_1[307]), &(dev_h_base1_1[312]) }; +__device__ __constant__ h_element dev_h_base2_1[316]={ + { .x= 0, .y= 0, .value=307 }, { .x= 1, .y= 0, .value= 76 }, { .x= 2, .y= 0, .value=205 }, { .x= 3, .y= 0, .value=276 }, { .x= 4, .y= 0, .value=332 }, { .x= 5, .y= 0, .value=195 }, { .x= 6, .y= 0, .value=278 }, { .x= 7, .y= 0, .value= 9 }, { .x= 8, .y= 0, .value=307 }, { .x= 9, .y= 0, .value=366 }, + { .x=11, .y= 0, .value= 48 }, { .x=12, .y= 0, .value= 77 }, { .x=13, .y= 0, .value=313 }, { .x=14, .y= 0, .value=142 }, { .x=15, .y= 0, .value=241 }, { .x=17, .y= 0, .value=260 }, { .x=19, .y= 0, .value=145 }, { .x=20, .y= 0, .value=187 }, { .x=22, .y= 0, .value= 30 }, { .x=24, .y= 0, .value=298 }, + { .x=26, .y= 0, .value= 71 }, { .x=28, .y= 0, .value=222 }, { .x=30, .y= 0, .value=159 }, { .x=32, .y= 0, .value=102 }, { .x=34, .y= 0, .value=230 }, { .x=36, .y= 0, .value=210 }, { .x=38, .y= 0, .value=185 }, { .x=40, .y= 0, .value=175 }, { .x=42, .y= 0, .value=113 }, { .x=44, .y= 0, .value= 80 }, + { .x= 0, .y= 1, .value= 19 }, { .x= 2, .y= 1, .value=250 }, { .x= 3, .y= 1, .value= 87 }, { .x= 4, .y= 1, .value=181 }, { .x= 5, .y= 1, .value= 14 }, { .x= 7, .y= 1, .value= 62 }, { .x= 8, .y= 1, .value=179 }, { .x= 9, .y= 1, .value=232 }, { .x=10, .y= 1, .value=101 }, { .x=11, .y= 1, .value=102 }, + { .x=12, .y= 1, .value=186 }, { .x=15, .y= 1, .value= 2 }, { .x=16, .y= 1, .value= 13 }, { .x=18, .y= 1, .value=130 }, { .x=19, .y= 1, .value=213 }, { .x=21, .y= 1, .value=205 }, { .x=23, .y= 1, .value= 24 }, { .x=25, .y= 1, .value= 72 }, { .x=27, .y= 1, .value=194 }, { .x=29, .y= 1, .value=252 }, + { .x=31, .y= 1, .value=100 }, { .x=33, .y= 1, .value=323 }, { .x=35, .y= 1, .value=320 }, { .x=37, .y= 1, .value=269 }, { .x=39, .y= 1, .value=258 }, { .x=41, .y= 1, .value= 52 }, { .x=43, .y= 1, .value=113 }, { .x=45, .y= 1, .value=135 }, { .x= 0, .y= 2, .value= 50 }, { .x= 1, .y= 2, .value= 76 }, + { .x= 2, .y= 2, .value=328 }, { .x=10, .y= 2, .value=339 }, { .x=23, .y= 2, .value= 89 }, { .x=26, .y= 2, .value= 81 }, { .x=33, .y= 2, .value= 8 }, { .x= 0, .y= 3, .value=369 }, { .x= 1, .y= 3, .value= 73 }, { .x= 3, .y= 3, .value= 0 }, { .x= 5, .y= 3, .value=115 }, { .x= 8, .y= 3, .value=165 }, + { .x=13, .y= 3, .value=177 }, { .x=16, .y= 3, .value=338 }, { .x=20, .y= 3, .value=206 }, { .x=24, .y= 3, .value=158 }, { .x=39, .y= 3, .value= 93 }, { .x=41, .y= 3, .value=314 }, { .x= 1, .y= 4, .value=288 }, { .x= 2, .y= 4, .value=332 }, { .x= 3, .y= 4, .value=275 }, { .x= 7, .y= 4, .value=316 }, + { .x=10, .y= 4, .value=274 }, { .x=24, .y= 4, .value=235 }, { .x=26, .y= 4, .value= 76 }, { .x=28, .y= 4, .value= 19 }, { .x=42, .y= 4, .value= 14 }, { .x= 0, .y= 5, .value=181 }, { .x= 1, .y= 5, .value=144 }, { .x= 2, .y= 5, .value=256 }, { .x=21, .y= 5, .value=102 }, { .x= 0, .y= 6, .value=216 }, + { .x= 2, .y= 6, .value=161 }, { .x= 3, .y= 6, .value=199 }, { .x= 6, .y= 6, .value=257 }, { .x=25, .y= 6, .value= 17 }, { .x=27, .y= 6, .value=194 }, { .x=35, .y= 6, .value=335 }, { .x=45, .y= 6, .value=149 }, { .x= 1, .y= 7, .value=331 }, { .x= 2, .y= 7, .value=267 }, { .x= 3, .y= 7, .value=153 }, + { .x= 7, .y= 7, .value=333 }, { .x=10, .y= 7, .value=111 }, { .x=13, .y= 7, .value=266 }, { .x=19, .y= 7, .value=344 }, { .x=25, .y= 7, .value=383 }, { .x=31, .y= 7, .value=215 }, { .x=34, .y= 7, .value=148 }, { .x=39, .y= 7, .value=346 }, { .x=44, .y= 7, .value= 78 }, { .x= 1, .y= 8, .value=331 }, + { .x= 2, .y= 8, .value=160 }, { .x= 3, .y= 8, .value= 56 }, { .x= 7, .y= 8, .value=290 }, { .x=10, .y= 8, .value=383 }, { .x=19, .y= 8, .value=242 }, { .x=27, .y= 8, .value=101 }, { .x=40, .y= 8, .value= 37 }, { .x= 0, .y= 9, .value=317 }, { .x= 1, .y= 9, .value=178 }, { .x= 2, .y= 9, .value= 63 }, + { .x=20, .y= 9, .value=264 }, { .x=38, .y= 9, .value=177 }, { .x=41, .y= 9, .value=139 }, { .x=44, .y= 9, .value=163 }, { .x= 0, .y=10, .value=288 }, { .x= 2, .y=10, .value=129 }, { .x= 3, .y=10, .value=132 }, { .x= 6, .y=10, .value= 1 }, { .x= 9, .y=10, .value=321 }, { .x=12, .y=10, .value=174 }, + { .x=15, .y=10, .value=210 }, { .x=19, .y=10, .value=197 }, { .x=23, .y=10, .value= 61 }, { .x=30, .y=10, .value=229 }, { .x=38, .y=10, .value=289 }, { .x=45, .y=10, .value= 15 }, { .x= 0, .y=11, .value=109 }, { .x= 1, .y=11, .value=295 }, { .x= 3, .y=11, .value=305 }, { .x= 6, .y=11, .value=351 }, + { .x= 9, .y=11, .value=133 }, { .x=12, .y=11, .value=232 }, { .x=16, .y=11, .value= 57 }, { .x=20, .y=11, .value=341 }, { .x=24, .y=11, .value=339 }, { .x=33, .y=11, .value=361 }, { .x= 0, .y=12, .value= 17 }, { .x= 1, .y=12, .value=342 }, { .x= 3, .y=12, .value=231 }, { .x= 5, .y=12, .value=166 }, + { .x= 8, .y=12, .value= 18 }, { .x=11, .y=12, .value= 8 }, { .x=14, .y=12, .value=248 }, { .x=18, .y=12, .value=163 }, { .x=22, .y=12, .value= 11 }, { .x=32, .y=12, .value=201 }, { .x=35, .y=12, .value= 2 }, { .x=38, .y=12, .value=214 }, { .x= 0, .y=13, .value=357 }, { .x= 2, .y=13, .value=200 }, + { .x= 3, .y=13, .value=341 }, { .x= 6, .y=13, .value= 92 }, { .x= 9, .y=13, .value= 57 }, { .x=12, .y=13, .value= 50 }, { .x=15, .y=13, .value=318 }, { .x=18, .y=13, .value=280 }, { .x=22, .y=13, .value=233 }, { .x=30, .y=13, .value=260 }, { .x=37, .y=13, .value= 82 }, { .x= 1, .y=14, .value=217 }, + { .x= 2, .y=14, .value= 88 }, { .x= 3, .y=14, .value=212 }, { .x= 7, .y=14, .value=114 }, { .x=10, .y=14, .value=354 }, { .x=17, .y=14, .value=303 }, { .x=25, .y=14, .value=312 }, { .x=29, .y=14, .value= 5 }, { .x=32, .y=14, .value=175 }, { .x=36, .y=14, .value=313 }, { .x= 0, .y=15, .value=215 }, + { .x= 1, .y=15, .value= 99 }, { .x= 2, .y=15, .value= 53 }, { .x=14, .y=15, .value=137 }, { .x=26, .y=15, .value=136 }, { .x=34, .y=15, .value=202 }, { .x=36, .y=15, .value=297 }, { .x= 0, .y=16, .value=106 }, { .x= 1, .y=16, .value=354 }, { .x= 3, .y=16, .value=304 }, { .x= 5, .y=16, .value=241 }, + { .x= 8, .y=16, .value= 39 }, { .x=11, .y=16, .value= 47 }, { .x=14, .y=16, .value= 89 }, { .x=17, .y=16, .value= 81 }, { .x=21, .y=16, .value=328 }, { .x=43, .y=16, .value=132 }, { .x= 1, .y=17, .value=114 }, { .x= 2, .y=17, .value=131 }, { .x= 3, .y=17, .value=300 }, { .x= 6, .y=17, .value=253 }, + { .x= 9, .y=17, .value=303 }, { .x=14, .y=17, .value=347 }, { .x=17, .y=17, .value=358 }, { .x=22, .y=17, .value= 22 }, { .x=34, .y=17, .value=312 }, { .x=40, .y=17, .value=312 }, { .x= 0, .y=18, .value=242 }, { .x= 2, .y=18, .value=240 }, { .x= 3, .y=18, .value=271 }, { .x= 6, .y=18, .value= 18 }, + { .x= 9, .y=18, .value= 63 }, { .x=12, .y=18, .value= 74 }, { .x=15, .y=18, .value= 55 }, { .x=18, .y=18, .value=132 }, { .x=23, .y=18, .value= 27 }, { .x=29, .y=18, .value=147 }, { .x=36, .y=18, .value= 21 }, { .x=41, .y=18, .value=288 }, { .x=43, .y=18, .value=114 }, { .x= 0, .y=19, .value=180 }, + { .x= 1, .y=19, .value=331 }, { .x= 2, .y=19, .value=205 }, { .x= 8, .y=19, .value=224 }, { .x=18, .y=19, .value= 4 }, { .x=28, .y=19, .value=244 }, { .x=39, .y=19, .value=297 }, { .x= 0, .y=20, .value=330 }, { .x= 2, .y=20, .value= 13 }, { .x= 3, .y=20, .value= 39 }, { .x= 6, .y=20, .value=225 }, + { .x= 9, .y=20, .value= 82 }, { .x=13, .y=20, .value=115 }, { .x=16, .y=20, .value=289 }, { .x=21, .y=20, .value=213 }, { .x= 0, .y=21, .value=346 }, { .x= 1, .y=21, .value=112 }, { .x= 3, .y=21, .value=357 }, { .x= 5, .y=21, .value= 51 }, { .x= 8, .y=21, .value=368 }, { .x=11, .y=21, .value=188 }, + { .x=14, .y=21, .value= 12 }, { .x=17, .y=21, .value=375 }, { .x=21, .y=21, .value= 97 }, { .x=28, .y=21, .value=274 }, { .x=33, .y=21, .value=105 }, { .x= 0, .y=22, .value= 1 }, { .x= 1, .y=22, .value= 0 }, { .x= 3, .y=22, .value= 1 }, { .x= 5, .y=22, .value=157 }, { .x= 8, .y=22, .value= 67 }, + { .x=11, .y=22, .value=334 }, { .x=16, .y=22, .value= 57 }, { .x=20, .y=22, .value= 59 }, { .x=24, .y=22, .value=234 }, { .x=31, .y=22, .value=258 }, { .x=35, .y=22, .value=266 }, { .x=44, .y=22, .value=274 }, { .x= 0, .y=23, .value= 0 }, { .x= 1, .y=23, .value= 0 }, { .x=11, .y=23, .value=115 }, + { .x=13, .y=23, .value=370 }, { .x=37, .y=23, .value=115 }, { .x= 1, .y=24, .value= 0 }, { .x= 2, .y=24, .value= 0 }, { .x= 8, .y=24, .value=170 }, { .x=30, .y=24, .value= 90 }, { .x=32, .y=24, .value=287 }, { .x=42, .y=24, .value=218 }, { .x= 2, .y=25, .value= 0 }, { .x= 3, .y=25, .value= 0 }, + { .x=15, .y=25, .value=269 }, { .x=29, .y=25, .value= 78 }, { .x=31, .y=25, .value=256 }, { .x=43, .y=25, .value=168 }, { .x= 4, .y=26, .value= 0 }, { .x= 5, .y=27, .value= 0 }, { .x= 6, .y=28, .value= 0 }, { .x= 7, .y=29, .value= 0 }, { .x= 8, .y=30, .value= 0 }, { .x= 9, .y=31, .value= 0 }, + { .x=10, .y=32, .value= 0 }, { .x=11, .y=33, .value= 0 }, { .x=12, .y=34, .value= 0 }, { .x=13, .y=35, .value= 0 }, { .x=14, .y=36, .value= 0 }, { .x=15, .y=37, .value= 0 }, { .x=16, .y=38, .value= 0 }, { .x=17, .y=39, .value= 0 }, { .x=18, .y=40, .value= 0 }, { .x=19, .y=41, .value= 0 }, + { .x=20, .y=42, .value= 0 }, { .x=21, .y=43, .value= 0 }, { .x=22, .y=44, .value= 0 }, { .x=23, .y=45, .value= 0 }, { .x=24, .y=46, .value= 0 }, { .x=25, .y=47, .value= 0 }, { .x=26, .y=48, .value= 0 }, { .x=27, .y=49, .value= 0 }, { .x=28, .y=50, .value= 0 }, { .x=29, .y=51, .value= 0 }, + { .x=30, .y=52, .value= 0 }, { .x=31, .y=53, .value= 0 }, { .x=32, .y=54, .value= 0 }, { .x=33, .y=55, .value= 0 }, { .x=34, .y=56, .value= 0 }, { .x=35, .y=57, .value= 0 }, { .x=36, .y=58, .value= 0 }, { .x=37, .y=59, .value= 0 }, { .x=38, .y=60, .value= 0 }, { .x=39, .y=61, .value= 0 }, + { .x=40, .y=62, .value= 0 }, { .x=41, .y=63, .value= 0 }, { .x=42, .y=64, .value= 0 }, { .x=43, .y=65, .value= 0 }, { .x=44, .y=66, .value= 0 }, { .x=45, .y=67, .value= 0 } }; +__device__ __constant__ h_element* dev_h_compact2[68]={ + &(dev_h_base2_1[ 0]), &(dev_h_base2_1[ 30]), &(dev_h_base2_1[ 58]), &(dev_h_base2_1[ 65]), &(dev_h_base2_1[ 76]), &(dev_h_base2_1[ 85]), &(dev_h_base2_1[ 89]), &(dev_h_base2_1[ 97]), &(dev_h_base2_1[109]), &(dev_h_base2_1[117]), + &(dev_h_base2_1[124]), &(dev_h_base2_1[136]), &(dev_h_base2_1[146]), &(dev_h_base2_1[158]), &(dev_h_base2_1[169]), &(dev_h_base2_1[179]), &(dev_h_base2_1[186]), &(dev_h_base2_1[196]), &(dev_h_base2_1[206]), &(dev_h_base2_1[219]), + &(dev_h_base2_1[226]), &(dev_h_base2_1[234]), &(dev_h_base2_1[245]), &(dev_h_base2_1[257]), &(dev_h_base2_1[262]), &(dev_h_base2_1[268]), &(dev_h_base2_1[274]), &(dev_h_base2_1[275]), &(dev_h_base2_1[276]), &(dev_h_base2_1[277]), + &(dev_h_base2_1[278]), &(dev_h_base2_1[279]), &(dev_h_base2_1[280]), &(dev_h_base2_1[281]), &(dev_h_base2_1[282]), &(dev_h_base2_1[283]), &(dev_h_base2_1[284]), &(dev_h_base2_1[285]), &(dev_h_base2_1[286]), &(dev_h_base2_1[287]), + &(dev_h_base2_1[288]), &(dev_h_base2_1[289]), &(dev_h_base2_1[290]), &(dev_h_base2_1[291]), &(dev_h_base2_1[292]), &(dev_h_base2_1[293]), &(dev_h_base2_1[294]), &(dev_h_base2_1[295]), &(dev_h_base2_1[296]), &(dev_h_base2_1[297]), + &(dev_h_base2_1[298]), &(dev_h_base2_1[299]), &(dev_h_base2_1[300]), &(dev_h_base2_1[301]), &(dev_h_base2_1[302]), &(dev_h_base2_1[303]), &(dev_h_base2_1[304]), &(dev_h_base2_1[305]), &(dev_h_base2_1[306]), &(dev_h_base2_1[307]), + &(dev_h_base2_1[308]), &(dev_h_base2_1[309]), &(dev_h_base2_1[310]), &(dev_h_base2_1[311]), &(dev_h_base2_1[312]), &(dev_h_base2_1[313]), &(dev_h_base2_1[314]), &(dev_h_base2_1[315]) }; + + + + +__device__ void cnp_1st(int row, char* dev_llr, char* dev_buf, int blk, int thd) +{ + int subrow = threadIdx.x, subcol = threadIdx.x, Zc = blockDim.x; + + for(int i = 0; i < row; i++) + { + int cnt = h_element_count1_bg1[i]; + int min1 = INT32_MAX, min2 = INT32_MAX; + int sign = 0, tsign = 1, idx = 0; + int irow = subrow + Zc*i; + + for(int j = 0; j < cnt; j++) + { + h_element tmp = dev_h_compact1[i][j]; + int icol = tmp.y * Zc + (subcol+tmp.value)%Zc; + + int Q = dev_llr[icol]; + int Q_abs = (Q>0)? Q:-Q; + char sq = (Q<0); + tsign = tsign*(1-sq*2); + sign |= (sq << j); + + if(threadIdx.x == thd && i == blk){ + printf("dev_llr[%d](Q): %d, total_sign: %d, sign: %d\n", icol, dev_llr[icol], tsign, sign); + } + + + if(Q_abs < min1){ + min2 = min1; + min1 = Q_abs; + idx = j; + }else if(Q_abs < min2){ + min2 = Q_abs; + } + } + + if(threadIdx.x == thd && i == blk){ + printf("sign: %d, idx: %d, min1: %d, min2: %d\n", sign, idx, min1, min2); + } + + + for(int j = 0; j < cnt; j++) + { + char sq = 1 - 2 * ((sign >> j) & 0x01); + int temp = tsign * sq * ((j != idx)? min1 : min2); + h_element tmp = dev_h_compact1[i][j]; + int addr = irow + tmp.y * row * Zc; + dev_buf[addr] = temp; + + if(threadIdx.x == thd && i == blk){ + printf("temp: %d, addr: %d\n", temp, addr); + } + } + } + __syncthreads(); +} + +__device__ void bnp(int row, int col, char* dev_llr, char* dev_const_llr, char* dev_buf, int blk, int thd) +{ + int subrow = threadIdx.x, subcol = threadIdx.x, Zc = blockDim.x; + for(int i = 0; i < col; i++) + { + int cnt = h_element_count2_bg1[i]; + int icol = i * Zc + subcol; + int sum = dev_const_llr[icol]; + + for(int j = 0; j < cnt; j++) + { + h_element tmp = dev_h_compact2[i][j]; + int irow = tmp.x * Zc + (subrow + Zc - tmp.value)%Zc; + int addr = i * row * Zc + irow; + sum = sum + dev_buf[addr]; + + if(threadIdx.x == thd && i == blk){ + printf("dev_buf[%d]: %d, sum: %d, x: %d, value: %d, irow: %d\n", addr, dev_buf[addr], sum, tmp.x, tmp.value, irow); + } + + } + if(sum > SCHAR_MAX) sum = SCHAR_MAX; + if(sum < SCHAR_MIN) sum = SCHAR_MIN; + dev_llr[icol] = sum; + } + __syncthreads(); +} + + +__device__ void cnp(int row, char* dev_llr, char* dev_buf, int blk, int thd) +{ + int subrow = threadIdx.x, subcol = threadIdx.x, Zc = blockDim.x; + + for(int i = 0; i < row; i++) + { + int cnt = h_element_count1_bg1[i]; + int min1 = INT32_MAX, min2 = INT32_MAX; + int sign = 0, tsign = 1, idx = 0; + int irow = subrow + Zc*i; + + for(int j = 0; j < cnt; j++) + { + h_element tmp = dev_h_compact1[i][j]; + int icol = tmp.y * Zc + (subcol+tmp.value)%Zc; + + int Q_last = dev_buf[tmp.y * row * Zc + irow]; + + int Q = dev_llr[icol] - Q_last; + int Q_abs = (Q>0)? Q:-Q; + char sq = (Q<0); + tsign = tsign*(1-sq*2); + sign |= (sq << j); + + if(threadIdx.x == thd && i == blk){ + printf("dev_llr[%d](Q): %d, total_sign: %d, sign: %d, last Q: %d, last_pos: %d\n", icol, dev_llr[icol], tsign, sign, Q_last, tmp.y * row * Zc + irow); + } + + + if(Q_abs < min1){ + min2 = min1; + min1 = Q_abs; + idx = j; + }else if(Q_abs < min2){ + min2 = Q_abs; + } + } + + if(threadIdx.x == thd && i == blk){ + printf("sign: %d, idx: %d, min1: %d, min2: %d\n", sign, idx, min1, min2); + } + + + for(int j = 0; j < cnt; j++) + { + char sq = 1 - 2 * ((sign >> j) & 0x01); + int temp = tsign * sq * ((j != idx)? min1 : min2); + h_element tmp = dev_h_compact1[i][j]; + int addr = irow + tmp.y * row * Zc; + dev_buf[addr] = temp; + + + if(threadIdx.x == thd && i == blk){ + printf("temp: %d, addr: %d\n", temp, addr); + } + } + } + __syncthreads(); +} + + + +__global__ void ldpc_decoder_gpu(int BG, char *dev_llr, char *dev_const_llr, char *dev_buf, int blk, int thd) +{ + int iteration = 5; + int row = 46, col = 68; + if(BG == 2){ + row = 42; + col = 52; + } + //extern __shared__ sh_llr[]; + //for() + + for(int i = 0; i < iteration; i++){ + if(i == 0){ + cnp_1st(row, dev_llr, dev_buf, blk, thd); + }else{ + cnp(row, dev_llr, dev_buf, blk, thd); + } + + bnp(row, col, dev_llr, dev_const_llr, dev_buf, blk, thd); + } + +} + + +__global__ void pack_decoded_bit(char *dev, unsigned char *host) +{ + __shared__ unsigned char tmp[256]; + int tid = blockIdx.x*128 + threadIdx.x; + int btid = threadIdx.x; + tmp[btid] = 0; + + if(dev[tid] < 0){ + tmp[btid] = 1 << (7-(btid&7)); + } + __syncthreads(); + + if(threadIdx.x < 16){ + host[blockIdx.x*16+threadIdx.x] = 0; + for(int i = 0; i < 8; i++){ + host[blockIdx.x*16+threadIdx.x] += tmp[threadIdx.x*8+i]; + } + } +} + + +//void nrLDPC_decoder_LYC(int BG, int row, int col, int Zc, int block_length) +extern "C" +int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length) +{ + // alloc mem + unsigned char *decision = (unsigned char*)p_out; + + uint16_t Zc = p_decParams->Z; + uint8_t BG = p_decParams->BG; + uint8_t numMaxIter = p_decParams->numMaxIter; + e_nrLDPC_outMode outMode = p_decParams->outMode; + + uint8_t row,col; + if(BG == 1){ + row = 46; + col = 68; + } + else{ + row = 42; + col = 52; + } + // gpu mem size + int memsize_llr = col * Zc * sizeof(char); + int memsize_buf = col * Zc * row * sizeof(char); + + // gpu + char *dev_llr; + char *dev_const_llr; + char *dev_buf; + unsigned char *dev_tmp; + + // gpu alloc + int p; + cudaCheck( cudaMallocPitch((void**)&dev_llr, (size_t*)&p, memsize_llr, 1) ); + cudaCheck( cudaMallocPitch((void**)&dev_const_llr, (size_t*)&p, memsize_llr, 1) ); + cudaCheck( cudaMallocPitch((void**)&dev_buf, (size_t*)&p, memsize_buf, 1) ); + cudaCheck( cudaMallocPitch((void**)&dev_tmp, (size_t*)&p, memsize_llr, 1) ); + + // gpu memcpy + cudaCheck( cudaMemcpy((void*)dev_llr, p_llr, memsize_llr, cudaMemcpyHostToDevice) ); + cudaCheck( cudaMemcpy((void*)dev_const_llr, p_llr, memsize_llr, cudaMemcpyHostToDevice) ); + //cudaCheck( cudaMemcpy((void*)dev_const_llr, (const void*)p_llr, memsize_llr, cudaMemcpyHostToDevice) ); + + // gpu argument + dim3 block(CW, 1, 1); + dim3 thread(Zc, 1, 1); + + // debug info + int blk, thd; + fprintf(stderr, "block thread focus: \n"); + scanf("%d%d", &blk, &thd); + + ldpc_decoder_gpu<<>>(BG, dev_llr, dev_const_llr, dev_buf, blk, thd); + + int pack = block_length/128; + pack_decoded_bit<<>>(dev_llr, dev_tmp); + + cudaCheck( cudaMemcpy((void*)decision, (const void*)dev_tmp, block_length*sizeof(unsigned char), cudaMemcpyDeviceToHost) ); + + return MAX_ITERATION; + +} diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 53119a1c2b..18db8a01fb 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -569,7 +569,7 @@ int8_t polar_decoder_dci(double *input, } void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { - AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); + AssertFatal(polarParams->K > 17, "K = %d < 18, is not allowed\n",polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); int bit_i,ip,ipmod64; int numbytes = polarParams->K>>3; @@ -670,7 +670,9 @@ uint32_t polar_decoder_int16(int16_t *input, A32_flip[1+offset]=((uint8_t *)&Aprime)[2]; A32_flip[2+offset]=((uint8_t *)&Aprime)[1]; A32_flip[3+offset]=((uint8_t *)&Aprime)[0]; - crc = (uint64_t)(crc24c(A32_flip,8*offset+len)>>8); + if (crclen == 24) crc = (uint64_t)((crc24c(A32_flip,8*offset+len)>>8)&0xffffff); + else if (crclen == 11) crc = (uint64_t)((crc11(A32_flip,8*offset+len)>>21)&0x7ff); + else if (crclen == 6) crc = (uint64_t)((crc6(A32_flip,8*offset+len)>>26)&0x3f); } else if (len<=64) { Ar = (B[0]>>crclen) | (B[1]<<(64-crclen));; uint8_t A64_flip[8+offset]; @@ -688,7 +690,9 @@ uint32_t polar_decoder_int16(int16_t *input, A64_flip[5+offset]=((uint8_t *)&Aprime)[2]; A64_flip[6+offset]=((uint8_t *)&Aprime)[1]; A64_flip[7+offset]=((uint8_t *)&Aprime)[0]; - crc = (uint64_t)(crc24c(A64_flip,8*offset+len)>>8); + if (crclen==24) crc = (uint64_t)(crc24c(A64_flip,8*offset+len)>>8)&0xffffff; + else if (crclen==11) crc = (uint64_t)(crc11(A64_flip,8*offset+len)>>21)&0x7ff; + else if (crclen==6) crc = (uint64_t)(crc6(A64_flip,8*offset+len)>>26)&0x3f; } #if 0 diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index 8e4b45f744..70791302cc 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -295,8 +295,8 @@ static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,vo void build_polar_tables(t_nrPolar_params *polarParams) { // build table b -> c' - AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); - AssertFatal(polarParams->K < 129, "K = %d > 64, is not supported yet\n",polarParams->K); + AssertFatal(polarParams->K > 17, "K = %d < 18, is not possible\n",polarParams->K); + AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); int bit_i,ip; int numbytes = polarParams->K>>3; int residue = polarParams->K&7; @@ -327,7 +327,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) { AssertFatal(polarParams->N==512 || polarParams->N==256 || polarParams->N==128,"N = %d, not done yet\n",polarParams->N); // build G bit vectors for information bit positions and convert the bit as bytes tables in nr_polar_kronecker_power_matrices.c to 64 bit packed vectors. // keep only rows of G which correspond to information/crc bits - polarParams->G_N_tab = (uint64_t **)malloc(polarParams->K * sizeof(int64_t *)); + polarParams->G_N_tab = (uint64_t **)malloc((polarParams->K + polarParams->n_pc) * sizeof(int64_t *)); int k=0; for (int i=0; iN; i++) { @@ -412,14 +412,14 @@ void polar_encoder_fast(uint64_t *A, int32_t crcmask, uint8_t ones_flag, t_nrPolar_params *polarParams) { - AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); + // AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits); uint64_t B[4]= {0,0,0,0},Cprime[4]= {0,0,0,0}; int bitlen = polarParams->payloadBits; // append crc AssertFatal(bitlen<129,"support for payloads <= 128 bits\n"); - AssertFatal(polarParams->crcParityBits == 24,"support for 24-bit crc only for now\n"); + // AssertFatal(polarParams->crcParityBits == 24,"support for 24-bit crc only for now\n"); //int bitlen0=bitlen; uint64_t tcrc=0; uint8_t offset = 0; @@ -444,7 +444,9 @@ void polar_encoder_fast(uint64_t *A, A32_flip[1+offset]=((uint8_t *)&Aprime)[2]; A32_flip[2+offset]=((uint8_t *)&Aprime)[1]; A32_flip[3+offset]=((uint8_t *)&Aprime)[0]; - tcrc = (uint64_t)((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8))); + if (polarParams->crcParityBits == 24) tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff); + else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff); + else if (polarParams->crcParityBits == 6) tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f); } else if (bitlen<=64) { uint8_t A64_flip[8+offset]; if (ones_flag) { @@ -461,7 +463,8 @@ void polar_encoder_fast(uint64_t *A, A64_flip[5+offset]=((uint8_t *)&Aprime)[2]; A64_flip[6+offset]=((uint8_t *)&Aprime)[1]; A64_flip[7+offset]=((uint8_t *)&Aprime)[0]; - tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8))); + if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff; + else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff; } else if (bitlen<=128) { uint8_t A128_flip[16+offset]; @@ -479,7 +482,8 @@ void polar_encoder_fast(uint64_t *A, A128_flip[10+offset]=((uint8_t*)&Aprime)[5]; A128_flip[11+offset]=((uint8_t*)&Aprime)[4]; A128_flip[12+offset]=((uint8_t*)&Aprime)[3]; A128_flip[13+offset]=((uint8_t*)&Aprime)[2]; A128_flip[14+offset]=((uint8_t*)&Aprime)[1]; A128_flip[15+offset]=((uint8_t*)&Aprime)[0]; - tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8))); + if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff; + else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff; } int n; @@ -522,6 +526,7 @@ void polar_encoder_fast(uint64_t *A, #ifdef DEBUG_POLAR_ENCODER + printf("Polar encoder: (N,K) : (%d,%d)\n",polarParams->N,polarParams->K); if (polarParams->K<65) printf("A %llx B %llx Cprime %llx (payload bits %d,crc %x)\n", (unsigned long long)(A[0]&(((uint64_t)1<>8); } -#endif + #endif /* printf("Bbytes : %x.%x.%x.%x.%x.%x.%x.%x\n",Bbyte[0],Bbyte[1],Bbyte[2],Bbyte[3],Bbyte[4],Bbyte[5],Bbyte[6],Bbyte[7]); printf("%llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n",polarParams->cprime_tab[0][Bbyte[0]] , polarParams->cprime_tab[1][Bbyte[1]] , diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h index 42051eb1b5..1ab664e5a2 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h @@ -33,8 +33,8 @@ #ifndef __NR_POLAR_UCI_DEFS__H__ #define __NR_POLAR_UCI_DEFS__H__ -#define NR_POLAR_UCI_MESSAGE_TYPE -1 //int8_t -#define NR_POLAR_UCI_CRC_ERROR_CORRECTION_BITS 3 +#define NR_POLAR_UCI_PUCCH_MESSAGE_TYPE 2 //int8_t +#define NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS 3 #define NR_POLAR_PUCCH_PAYLOAD_BITS 32 #define NR_POLAR_PUCCH_E 32 diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index f6a06b3f7f..f6a700117d 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -43,11 +43,12 @@ static void nr_polar_init(t_nrPolar_params * *polarParams, uint8_t aggregation_level, int decoder_flag) { t_nrPolar_params *currentPtr = *polarParams; - uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level); + uint16_t aggregation_prime = (messageType >= 2) ? aggregation_level : nr_polar_aggregation_prime(aggregation_level); //Parse the list. If the node is already created, return without initialization. while (currentPtr != NULL) { //printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength); + //LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime)); if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return; else currentPtr = currentPtr->nextPtr; } @@ -55,8 +56,9 @@ static void nr_polar_init(t_nrPolar_params * *polarParams, // printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams); //Else, initialize and add node to the end of the linked list. t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1); - + if (newPolarInitNode != NULL) { + // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); newPolarInitNode->idx = (messageType * messageLength * aggregation_prime); newPolarInitNode->nextPtr = NULL; //printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level); @@ -87,15 +89,44 @@ static void nr_polar_init(t_nrPolar_params * *polarParams, newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); - } else if (messageType == -1) { //UCI + } else if (messageType == 2) { //UCI PUCCH2 + AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level); + AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength); + newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX; + newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL; + newPolarInitNode->encoderLength = aggregation_level * 16; + + newPolarInitNode->i_seg = 0; + + if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)|| + (messageLength >= 1013)) newPolarInitNode->i_seg = 1; + + newPolarInitNode->crcParityBits = 11; + newPolarInitNode->n_pc = 0; + newPolarInitNode->n_pc_wm = 0; + + if (messageLength < 20) { + newPolarInitNode->crcParityBits = 6; + newPolarInitNode->n_pc = 3; + if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1; + } + + + + newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL; + + newPolarInitNode->payloadBits = messageLength; + newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS; + //newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P + //LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level); } else { AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType); } newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode. newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K, - newPolarInitNode->encoderLength, - newPolarInitNode->n_max); + newPolarInitNode->encoderLength, + newPolarInitNode->n_max); newPolarInitNode->n = log2(newPolarInitNode->N); newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n); //polar_encoder vectors: @@ -191,16 +222,19 @@ t_nrPolar_params *nr_polar_params (int8_t messageType, nr_polar_init(polarList_ext != NULL ? polarList_ext : &polarList, messageType,messageLength,aggregation_level,decoding_flag); t_nrPolar_params *polarParams=polarList_ext != NULL ? *polarList_ext : polarList; - const int tag=messageType * messageLength * nr_polar_aggregation_prime(aggregation_level); + const int tag=messageType * messageLength * (messageType>=2 ? aggregation_level : nr_polar_aggregation_prime(aggregation_level)); + + while (polarParams != NULL) { + // LOG_D(PHY,"nr_polar_params : tag %d (from nr_polar_init %d)\n",tag,polarParams->idx); if (polarParams->idx == tag) return polarParams; polarParams = polarParams->nextPtr; } - AssertFatal(false,"Polar Init tables internal failure\n"); + AssertFatal(false,"Polar Init tables internal failure, no polarParams found\n"); return NULL; } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 6a022b4fb1..9e095d5ab5 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -25,9 +25,8 @@ #include "PHY/NR_REFSIG/nr_refsig.h" #include "PHY/INIT/phy_init.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" /*#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "TDD-Config.h" diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 30700b4cc6..5deca65aed 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -22,7 +22,7 @@ #include "phy_init.h" #include "SCHED/sched_common.h" #include "PHY/phy_extern.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "SIMULATION/TOOLS/sim.h" /*#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index b10ec80205..1729ac0d9e 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -657,8 +657,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, abstraction_flag = 0; fp->nb_antennas_tx = 1; fp->nb_antennas_rx=1; - dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; - ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; + // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; + // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); phy_init_nr_top(ue); @@ -710,9 +710,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } //------------- config DMRS parameters--------------// - dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; - dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; - dmrs_Uplink_Config->pusch_maxLength = pusch_len1; + // dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; + // dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; + // dmrs_Uplink_Config->pusch_maxLength = pusch_len1; //-------------------------------------------------// ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1; ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0; @@ -745,15 +745,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, /////////////////////////PUSCH PTRS init///////////////////////// /////////// - ue->ptrs_configured = 0; // flag to be toggled by RCC - //------------- config PTRS parameters--------------// - ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration - ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 0; - ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 0; - ptrs_Uplink_Config->frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration - ptrs_Uplink_Config->frequencyDensity.n_rb1 = 0; - ptrs_Uplink_Config->resourceElementOffset = 0; + // ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 2; // setting MCS values to 0 indicate abscence of time_density field in the configuration + // ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 4; + // ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 10; + // ptrs_Uplink_Config->frequencyDensity.n_rb0 = 25; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration + // ptrs_Uplink_Config->frequencyDensity.n_rb1 = 75; + // ptrs_Uplink_Config->resourceElementOffset = 0; //-------------------------------------------------// /////////// diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c index aaa138fcd9..f85162e095 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c @@ -112,18 +112,12 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, } -int lte_est_timing_advance_pusch(PHY_VARS_eNB *eNB, - module_id_t UE_id) +int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **ul_ch_estimates_time) { int temp, i, aa, max_pos=0, max_val=0; short Re,Im; - RU_t *ru; - ru = RC.ru[UE_id]; - LTE_DL_FRAME_PARMS *frame_parms = (eNB==NULL) ? ru->frame_parms : &eNB->frame_parms; - LTE_eNB_PUSCH *eNB_pusch_vars = (eNB!=NULL) ? eNB->pusch_vars[UE_id] : (LTE_eNB_PUSCH*)NULL; - RU_CALIBRATION *calibration = &ru->calibration; - int32_t **ul_ch_estimates_time = (eNB==NULL) ? calibration->drs_ch_estimates_time : eNB_pusch_vars->drs_ch_estimates_time; uint8_t cyclic_shift = 0; int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size); @@ -149,7 +143,7 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB *eNB, max_pos = max_pos-frame_parms->ofdm_symbol_size; //#ifdef DEBUG_PHY - LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos); + LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos); //#endif //DEBUG_PHY return max_pos - sync_pos; diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h index 01883224db..fc40280853 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h +++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h @@ -220,8 +220,12 @@ void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint32_t rx_power_fil_dB, unsigned char eNB_id); -int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB, +int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, L1_rxtx_proc_t *proc, + LTE_eNB_ULSCH_t * ulsch, + int32_t **ul_ch_estimates, + int32_t **ul_ch_estimates_time, + int32_t **rxdataF_ext, module_id_t UE_id, uint8_t l, uint8_t Ns); @@ -258,7 +262,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, unsigned char number_of_cards, short coef); -int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,module_id_t UE_id); +int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **ul_ch_estimates_time); void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB, int subframe, diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 7caaf07406..755111feb8 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -34,23 +34,17 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32 #define SCALE 0x3FFF -int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, +int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, L1_rxtx_proc_t *proc, + LTE_eNB_ULSCH_t * ulsch, + int32_t **ul_ch_estimates, + int32_t **ul_ch_estimates_time, + int32_t **rxdataF_ext, module_id_t UE_id, unsigned char l, unsigned char Ns) { - RU_t *ru; - ru = RC.ru[UE_id]; - LTE_DL_FRAME_PARMS *frame_parms = (eNB!=NULL) ? &eNB->frame_parms : ru->frame_parms; - LTE_eNB_PUSCH *pusch_vars = (eNB!=NULL) ? eNB->pusch_vars[UE_id] : NULL; - RU_CALIBRATION *calibration = &ru->calibration; - int32_t **ul_ch_estimates = (eNB!=NULL) ? pusch_vars->drs_ch_estimates : calibration->drs_ch_estimates; - AssertFatal(ul_ch_estimates != NULL, "ul_ch_estimates is null (eNB %p, pusch %p, pusch->drs_ch_estimates %p, pusch->drs_ch_estimates[0] %p ul_ch_estimates %p UE_id %d)\n",eNB,pusch_vars, - pusch_vars->drs_ch_estimates,pusch_vars->drs_ch_estimates[0],ul_ch_estimates,UE_id); - int32_t **ul_ch_estimates_time = (eNB!=NULL) ? pusch_vars->drs_ch_estimates_time : calibration->drs_ch_estimates_time; + AssertFatal(ul_ch_estimates != NULL, "ul_ch_estimates is null "); AssertFatal(ul_ch_estimates_time != NULL, "ul_ch_estimates_time is null\n"); - int32_t **rxdataF_ext = (eNB!=NULL) ? pusch_vars->rxdataF_ext : calibration->rxdataF_ext; - int subframe = proc->subframe_rx; uint8_t harq_pid; @@ -83,16 +77,16 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, #endif int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32))); - if (eNB->ulsch[UE_id]->ue_type > 0) harq_pid = 0; + if (ulsch->ue_type > 0) harq_pid = 0; else { harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe); } - uint16_t N_rb_alloc = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; + uint16_t N_rb_alloc = ulsch->harq_processes[harq_pid]->nb_rb; int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16))); Msc_RS = N_rb_alloc*12; cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + - eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 + + ulsch->harq_processes[harq_pid]->n_DMRS2 + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12; Msc_idx_ptr = (uint16_t *) bsearch(&Msc_RS, dftsizes, 34, sizeof(uint16_t), compareints); @@ -276,7 +270,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, #if T_TRACER if (aa == 0) - T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(eNB->ulsch[UE_id]->rnti), + T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(ulsch->rnti), T_INT(proc->frame_rx), T_INT(subframe), T_INT(0), T_BUFFER(ul_ch_estimates_time[0], 512 * 4)); diff --git a/openair1/PHY/LTE_REFSIG/mod_table.h b/openair1/PHY/LTE_REFSIG/mod_table.h index 7bdc1f518f..29ae9f4495 100644 --- a/openair1/PHY/LTE_REFSIG/mod_table.h +++ b/openair1/PHY/LTE_REFSIG/mod_table.h @@ -19,9 +19,14 @@ * contact@openairinterface.org */ +#ifndef __PHY_LTE_REFSIG_MOD_TABLE__H__ +#define __PHY_LTE_REFSIG_MOD_TABLE__H__ + #define MOD_TABLE_SIZE_SHORT 304 #define MOD_TABLE_QPSK_OFFSET 1 #define MOD_TABLE_16QAM_OFFSET 5 #define MOD_TABLE_64QAM_OFFSET 21 #define MOD_TABLE_PSS_OFFSET 85 short mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,768,768,768,-768,-768,768,-768,-768,343,343,343,1030,1030,343,1030,1030,343,-343,343,-1030,1030,-343,1030,-1030,-343,343,-343,1030,-1030,343,-1030,1030,-343,-343,-343,-1030,-1030,-343,-1030,-1030,503,503,503,168,168,503,168,168,503,838,503,1173,168,838,168,1173,838,503,838,168,1173,503,1173,168,838,838,838,1173,1173,838,1173,1173,503,-503,503,-168,168,-503,168,-168,503,-838,503,-1173,168,-838,168,-1173,838,-503,838,-168,1173,-503,1173,-168,838,-838,838,-1173,1173,-838,1173,-1173,-503,503,-503,168,-168,503,-168,168,-503,838,-503,1173,-168,838,-168,1173,-838,503,-838,168,-1173,503,-1173,168,-838,838,-838,1173,-1173,838,-1173,1173,-503,-503,-503,-168,-168,-503,-168,-168,-503,-838,-503,-1173,-168,-838,-168,-1173,-838,-503,-838,-168,-1173,-503,-1173,-168,-838,-838,-838,-1173,-1173,-838,-1173,-1173,1086,0,1081,-108,1065,-215,1038,-320,1001,-422,954,-519,897,-612,832,-698,758,-777,677,-849,589,-912,495,-966,397,-1011,294,-1046,189,-1070,81,-1083,-27,-1086,-135,-1078,-242,-1059,-346,-1030,-447,-990,-543,-941,-634,-882,-719,-814,-796,-739,-866,-656,-927,-566,-979,-471,-1021,-371,-1053,-268,-1074,-162,-1085,-54,-1085,54,-1074,162,-1053,268,-1021,371,-979,471,-927,566,-866,656,-796,739,-719,814,-634,882,-543,941,-447,990,-346,1030,-242,1059,-135,1078,-27,1086,81,1083,189,1070,294,1045,397,1011,495,966,589,912,677,849,758,777,832,698,897,612,954,519,1001,422,1038,320,1065,215,1081,108,16384,0,8192,0,4096,0,2048,0}; + +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 15eb5206a1..14036ad43a 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -422,6 +422,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, else r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C)); } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); return(0); } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h index 9673ba15b5..5a08b7a402 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef __DLSCH_TBS_FULL__H__ +#define __DLSCH_TBS_FULL__H__ + #define TBStable_rowCnt 27 /** \brief "Transport block size table" @@ -54,3 +57,4 @@ unsigned int TBStable[TBStable_rowCnt][110] = {{16,32,56,88,120,152,176,208,224, }; unsigned int TBStable1C[32] = {40, 56, 72, 120, 136, 144, 176, 208, 224, 256, 280, 296, 328, 336, 392, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1224, 1288, 1384, 1480, 1608, 1736}; +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h index 2f8a83e24f..47fbd93ad7 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h @@ -29,6 +29,10 @@ * \note * \warning */ + +#ifndef __PHY_LTE_TRANSPORT_PRACH_EXTERN__H__ +#define __PHY_LTE_TRANSPORT_PRACH_EXTERN__H__ + #include "PHY/sse_intrin.h" #include "PHY/defs_eNB.h" #include "PHY/phy_extern.h" @@ -91,3 +95,4 @@ void compute_prach_seq(uint16_t rootSequenceIndex, lte_frame_type_t frame_type, uint32_t X_u[64][839]); +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/pucch_extern.h b/openair1/PHY/LTE_TRANSPORT/pucch_extern.h index 899b904306..b151374888 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/pucch_extern.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __PHY_LTE_TRANSPORT_PUCCH_EXTERN__H__ +#define __PHY_LTE_TRANSPORT_PUCCH_EXTERN__H__ + #include /* PUCCH format3 >> */ @@ -76,3 +79,5 @@ extern uint8_t Np4_TBL[4]; // alpha_TBL extern int16_t alphaTBL_re[12]; extern int16_t alphaTBL_im[12]; + +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/transport_extern.h b/openair1/PHY/LTE_TRANSPORT/transport_extern.h index 357d31ca10..8b33449cca 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_extern.h @@ -22,7 +22,7 @@ extern unsigned int dlsch_tbs25[27][25],TBStable[27][110],TBStable1C[32]; extern unsigned short lte_cqi_eff1024[16]; extern char lte_cqi_snr_dB[15]; -extern short conjugate[8],conjugate2[8]; +extern const short conjugate[8],conjugate2[8]; extern short minus_one[8]; extern short minus_one[8]; extern short *ul_ref_sigs[30][2][34]; diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 90492b9999..92fe777201 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -495,7 +495,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, } AssertFatal(sumKr>0, - "[eNB] ulsch_decoding.c: FATAL sumKr is 0! (Nid_cell %d, rnti %x, x2 %x): harq_pid %d round %d, RV %d, O_RI %d, O_ACK %d, G %d, subframe %d\n", + "[eNB] ulsch_decoding.c: FATAL sumKr is 0! (Nid_cell %d, rnti %x, x2 %x): harq_pid %d round %d, RV %d, O_RI %d, O_ACK %d, G %u, subframe %d\n", frame_parms->Nid_cell,ulsch->rnti,x2, harq_pid, ulsch_harq->round, diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index f357e385f0..1b23fc99bf 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1047,7 +1047,11 @@ void rx_ulsch(PHY_VARS_eNB *eNB, l%(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2), frame_parms); - lte_ul_channel_estimation(eNB,proc, + lte_ul_channel_estimation(&eNB->frame_parms,proc, + eNB->ulsch[UE_id], + eNB->pusch_vars[UE_id]->drs_ch_estimates, + eNB->pusch_vars[UE_id]->drs_ch_estimates_time, + eNB->pusch_vars[UE_id]->rxdataF_ext, UE_id, l%(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2)); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 2fd84f563c..556a9f2d23 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -821,15 +821,14 @@ int rx_pdsch(PHY_VARS_UE *ue, pllr_symbol_cw0 += llr_offset_symbol; pllr_symbol_cw1 += llr_offset_symbol; - /* - LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n", + LOG_D(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p energy: %d\n", frame, subframe,symbol, nb_rb,dlsch0_harq->Qm, pdsch_vars[eNB_id]->llr_length[symbol], pdsch_vars[eNB_id]->llr_offset[symbol], (int16_t*)pdsch_vars[eNB_id]->llr[0], - pllr_symbol_cw0); - */ + pllr_symbol_cw0, + signal_energy(pdsch_vars[eNB_id]->rxdataF_comp0[0], 7*2*frame_parms->N_RB_DL*12)); switch (dlsch0_harq->Qm) { case 2 : if ((rx_type==rx_standard) || (codeword_TB1 == -1)) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/sldch.c b/openair1/PHY/LTE_UE_TRANSPORT/sldch.c index 9c9d36c974..8769d5f81b 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/sldch.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/sldch.c @@ -29,8 +29,6 @@ * \note * \warning */ -#ifndef __LTE_TRANSPORT_SLSS__C__ -#define __LTE_TRANSPORT_SLSS__C__ #include "PHY/defs_UE.h" extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); @@ -63,4 +61,3 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx) } -#endif diff --git a/openair1/PHY/LTE_UE_TRANSPORT/slsch.c b/openair1/PHY/LTE_UE_TRANSPORT/slsch.c index e51e33626d..e4e94a232d 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/slsch.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/slsch.c @@ -29,8 +29,6 @@ * \note * \warning */ -#ifndef __LTE_TRANSPORT_SLSS__C__ -#define __LTE_TRANSPORT_SLSS__C__ #include "PHY/defs_UE.h" extern int @@ -66,5 +64,3 @@ void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx) } } - -#endif diff --git a/openair1/PHY/LTE_UE_TRANSPORT/slss.c b/openair1/PHY/LTE_UE_TRANSPORT/slss.c index 18bc5a28de..3cd1c1acb0 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/slss.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/slss.c @@ -29,8 +29,6 @@ * \note * \warning */ -#ifndef __LTE_TRANSPORT_SLSS__C__ -#define __LTE_TRANSPORT_SLSS__C__ #include "PHY/defs_UE.h" @@ -39,5 +37,3 @@ void generate_slss(PHY_VARS_UE *ue,SLSS_t *slss,int frame_tx,int subframe_tx) { AssertFatal(1==0,"Should get here yet for UE %d\n",ue->Mod_id); } - -#endif diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 0a3047a56d..cf0a50a018 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -25,6 +25,7 @@ #include "nr_modulation.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" +#include //#define DEBUG_FEP @@ -456,13 +457,14 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, memcpy((void *)&tmp_dft_in[sample_offset-rxdata_offset], (void *) &rxdata[0], (frame_parms->ofdm_symbol_size-sample_offset+rxdata_offset)*sizeof(int)); - + dft(dftsize,(int16_t *)&tmp_dft_in, (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); } else - dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset], - (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); + dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset], + (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1); + // clear DC carrier from OFDM symbols rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0; diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index 34c887be30..7042c152fd 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -33,150 +33,34 @@ #include "PHY/NR_REFSIG/ss_pbch_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h" -/***********************************************************************/ - -// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 -// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. - -int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) -{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) -{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) -}; -// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 - -int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) -{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) -{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) -}; - -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { - - uint8_t row, colomn; - int32_t l_prime; - - colomn = additional_pos; - - if (mapping_type == typeB) - colomn += 4; - - if (duration_in_symbols < 4) - row = 0; +uint8_t allowed_xlsch_re_in_dmrs_symbol(uint16_t k, + uint16_t start_sc, + uint8_t numDmrsCdmGrpsNoData, + uint8_t dmrs_type) { + uint8_t delta; + uint16_t diff; + if (k>start_sc) + diff = k-start_sc; else - row = duration_in_symbols - 3; - - if (pusch_maxLength == pusch_len1) - l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; - else - l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; - - AssertFatal(l_prime>0,"invalid l_prime < 0\n"); - - return l_prime; -} - -/******************************************************************* -* -* NAME : is_dmrs_symbol -* -* PARAMETERS : l ofdm symbol index within slot -* k subcarrier index -* start_sc first subcarrier index -* k_prime index alternating 0 and 1 -* n index starting 0,1,... -* delta see Table 6.4.1.1.3 -* duration_in_symbols number of scheduled PUSCH ofdm symbols -* start_symbol first symbol index in PUSCH allocation -* dmrs_UplinkConfig DMRS uplink configuration -* mapping_type PUSCH mapping type (A or B) -* ofdm_symbol_size IFFT size -* -* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is dmrs -* -* DESCRIPTION : 3GPP TS 38.211 6.4.1.1 Demodulation reference signal for PUSCH -* -*********************************************************************/ - -uint8_t is_dmrs_symbol(uint8_t l, - uint16_t k, - uint16_t start_sc, - uint8_t k_prime, - uint16_t n, - uint8_t delta, - uint8_t duration_in_symbols, - uint8_t dmrs_type, - uint16_t ofdm_symbol_size) { - - uint8_t is_dmrs_freq, is_dmrs_time, l0; - int32_t l_prime_mask; - pusch_dmrs_AdditionalPosition_t additional_pos = pusch_dmrs_pos0; - pusch_maxLength_t pusch_maxLength = pusch_len1; - uint8_t mapping_type = typeB; - - is_dmrs_freq = 0; - is_dmrs_time = 0; - - AssertFatal(l >= 0,"Check DMRS configuration (start_symbol) !\n"); - - - l0 = get_l0_ul(mapping_type, 2); - l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, pusch_maxLength); - - if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%ofdm_symbol_size)) - is_dmrs_freq = 1; - - - if (l_prime_mask == 1){ - - if (l == l0) - is_dmrs_time = 1; - - } else if ( (l==l0) || (((l_prime_mask>>l)&1) == 1 && l!=0) ) - is_dmrs_time = 1; - - if (pusch_maxLength == pusch_len2){ - - if (((l_prime_mask>>(l-1))&1) == 1 && l!=0 && l!=1) - is_dmrs_time = 1; - - if (l-1 == l0) - is_dmrs_time = 1; - + diff = start_sc-k; + for (int i = 0; i (b)) ? (a) : (b)) +//#define max(a,b) (((a) > (b)) ? (a) : (b)) // TS 38.211 Table 6.4.1.2.2.1-1: The parameter kRE_ref. // The first 4 colomns are DM-RS Configuration type 1 and the last 4 colomns are DM-RS Configuration type 2. int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = { -{ 0, 2, 6, 8, 0, 1, 6, 7}, -{ 2, 4, 8, 10, 1, 6, 7, 0}, -{ 1, 3, 7, 9, 2, 3, 8, 9}, -{ 3, 5, 9, 11, 3, 8, 9, 2}, -{-1, -1, -1, -1, 4, 5, 10, 11}, -{-1, -1, -1, -1, 5, 10, 11, 4}, + { 0, 2, 6, 8, 0, 1, 6, 7}, + { 2, 4, 8, 10, 1, 6, 7, 0}, + { 1, 3, 7, 9, 2, 3, 8, 9}, + { 3, 5, 9, 11, 3, 8, 9, 2}, + {-1, -1, -1, -1, 4, 5, 10, 11}, + {-1, -1, -1, -1, 5, 10, 11, 4}, }; @@ -68,55 +68,20 @@ int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = { *********************************************************************/ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) { - uint8_t colomn; int16_t k_RE_ref; - colomn = resourceElementOffset; if (pusch_dmrs_type == 2) colomn += 4; k_RE_ref = table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[dmrs_antenna_port][colomn]; - AssertFatal(k_RE_ref>=0,"invalid k_RE_ref < 0. Check PTRS Configuration\n"); - return k_RE_ref; } -/******************************************************************* -* -* NAME : get_K_ptrs -* -* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration -* N_RB number of RBs scheduled for PUSCH -* -* RETURN : the parameter K_ptrs -* -* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-2 -* -*********************************************************************/ -uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){ - - uint16_t nrb0, nrb1; - - nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0; - nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1; - - if (nrb0 == 0 || nrb0 == 0) - return 2; - - if (N_RB < nrb0){ - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } - else if (N_RB >= nrb0 && N_RB < nrb1) - return 2; - else - return 4; -} /******************************************************************* * @@ -126,7 +91,7 @@ uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){ * duration_in_symbols number of scheduled PUSCH ofdm symbols * start_symbol first ofdm symbol of PUSCH within slot * L_ptrs the parameter L_ptrs -* ofdm_symbol_size FFT size +* ul_dmrs_symb_pos bitmap of the time domain positions of the DMRS symbols in the scheduled PUSCH * * RETURN : sets the bit map of PTRS ofdm symbol indicies * @@ -137,54 +102,31 @@ uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t duration_in_symbols, uint8_t start_symbol, - uint8_t dmrs_type, uint8_t L_ptrs, - uint8_t pusch_maxLength, - uint16_t ofdm_symbol_size) { + uint16_t ul_dmrs_symb_pos) { - uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2; - int16_t l_ref; - - *ptrs_symbols = 0; - i = 0; - is_dmrs_symbol1 = 0; - is_dmrs_symbol2 = 0; - l_ref = start_symbol; - last_symbol = start_symbol + duration_in_symbols - 1; + uint8_t i = 0, last_symbol, is_dmrs_symbol, l_ref; + int8_t l_counter; + l_ref = start_symbol; + last_symbol = start_symbol + duration_in_symbols - 1; while ( (l_ref + i*L_ptrs) <= last_symbol) { - is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref), - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); + is_dmrs_symbol = 0; - is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs, - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); + for(l_counter = l_ref + i*L_ptrs; l_counter >= max(l_ref + (i-1)*L_ptrs + 1, l_ref); l_counter--) { - if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { + if((ul_dmrs_symb_pos >> l_counter) & 0x01) { + is_dmrs_symbol = 1; + break; + } - if (pusch_maxLength == 2) - l_ref = l_ref + i*L_ptrs + 1; - else - l_ref = l_ref + i*L_ptrs; - - i = 1; - - continue; + } + if (is_dmrs_symbol) { + l_ref = l_counter; + i = 1; + continue; } *ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs)); @@ -192,53 +134,19 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, } } -/******************************************************************* -* -* NAME : get_L_ptrs -* -* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration -* I_mcs MCS index used for PUSCH -* -* RETURN : the parameter L_ptrs -* -* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-1 -* -*********************************************************************/ - -uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { - - uint8_t mcs1, mcs2, mcs3; - - mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1; - mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2; - mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3; - - if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0) - return 1; - - if (I_mcs < mcs1){ - LOG_I(PHY,"PUSH PT-RS is not present.\n"); - return 0; - } - else if (I_mcs >= mcs1 && I_mcs < mcs2) - return 4; - else if (I_mcs >= mcs2 && I_mcs < mcs3) - return 2; - else - return 1; -} - /******************************************************************* * * NAME : is_ptrs_subcarrier * * PARAMETERS : k subcarrier index -* K_ptrs the parameter K_ptrs * n_rnti UE CRNTI +* dmrs_antenna_port DMRS antenna port +* K_ptrs the parameter K_ptrs +* pusch_dmrs_type the DMRS configuration type used for PUSCH * N_RB number of RBs scheduled for PUSCH * k_RE_ref the parameter k_RE_ref * start_sc first subcarrier index -* ofdm_symbol_size FFT size +* ofdm_symbol_size number of samples in an OFDM symbol * * RETURN : 1 if subcarrier k is PTRS, or 0 otherwise * @@ -246,107 +154,48 @@ uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) { * *********************************************************************/ -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) { +uint8_t is_ptrs_subcarrier(uint16_t k, + uint16_t n_rnti, + uint8_t dmrs_antenna_port, + uint8_t pusch_dmrs_type, + uint8_t K_ptrs, + uint16_t N_RB, + uint8_t k_RE_ref, + uint16_t start_sc, + uint16_t ofdm_symbol_size) +{ + // int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); + uint16_t k_RB_ref; - uint16_t k_RB_ref, i, sc; - - i = 0; - sc = 0; - k_RB_ref = 0; - - if (N_RB % K_ptrs == 0) - k_RB_ref = n_rnti % K_ptrs; - else - k_RB_ref = n_rnti % (N_RB % K_ptrs); - - while (k > sc){ - - sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size; - i++; - - } - - if (k == sc) - return 1; - else - return 0; - -} - -/******************************************************************* -* -* NAME : is_ptrs_symbol -* -* PARAMETERS : l ofdm symbol index within slot -* k subcarrier index -* n_rnti UE CRNTI -* N_RB number of RBs scheduled for PUSCH -* duration_in_symbols number of scheduled PUSCH ofdm symbols -* dmrs_antenna_port DMRS antenna port -* K_ptrs the parameter K_ptrs -* ptrs_symbols bit mask of ptrs -* start_sc first subcarrier index -* ofdm_symbol_size FFT size -* pusch_dmrs_type PUSCH DMRS type (1 or 2) -* ptrs_UplinkConfig PTRS uplink configuration -* -* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is ptrs -* -* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH -* -*********************************************************************/ - -uint8_t is_ptrs_symbol(uint8_t l, - uint16_t k, - uint16_t n_rnti, - uint16_t N_RB, - uint8_t duration_in_symbols, - uint8_t dmrs_antenna_port, - uint8_t K_ptrs, - uint16_t ptrs_symbols, - uint16_t start_sc, - uint16_t ofdm_symbol_size, - pusch_dmrs_type_t pusch_dmrs_type, - uint8_t resourceElementOffset) { - - uint8_t is_ptrs_freq, is_ptrs_time; - int16_t k_RE_ref; - - is_ptrs_freq = 0; - is_ptrs_time = 0; - - k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset); - - is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size); - - if (is_ptrs_freq == 0) - return 0; - - if (((ptrs_symbols>>l)&1) == 1) - is_ptrs_time = 1; - - if (is_ptrs_time && is_ptrs_freq) - return 1; + if (N_RB % K_ptrs == 0) + k_RB_ref = n_rnti % K_ptrs; else - return 0; + k_RB_ref = n_rnti % (N_RB % K_ptrs); + if (k < start_sc) + k += ofdm_symbol_size; + + if ((k - k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc) % (K_ptrs*NR_NB_SC_PER_RB) == 0) + return 1; + + return 0; } /* int main(int argc, char const *argv[]) { - dmrs_UplinkConfig_t dmrs_Uplink_Config; - ptrs_UplinkConfig_t ptrs_Uplink_Config; - uint8_t resourceElementOffset; - uint8_t dmrs_antenna_port; - uint8_t L_ptrs, K_ptrs; - int16_t k_RE_ref; - uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k; - uint8_t duration_in_symbols, I_mcs; - uint8_t start_symbol, l; - uint8_t ptrs_symbol_flag; - uint16_t n_rnti; + dmrs_UplinkConfig_t dmrs_Uplink_Config; + ptrs_UplinkConfig_t ptrs_Uplink_Config; + uint8_t resourceElementOffset; + uint8_t dmrs_antenna_port; + uint8_t L_ptrs, K_ptrs; + int16_t k_RE_ref; + uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k; + uint8_t duration_in_symbols, I_mcs; + uint8_t start_symbol, l; + uint8_t ptrs_symbol_flag; + uint16_t n_rnti; dmrs_Uplink_Config.pusch_dmrs_type = pusch_dmrs_type1; dmrs_Uplink_Config.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos1; @@ -362,13 +211,13 @@ int main(int argc, char const *argv[]) n_rnti = 0x1234; resourceElementOffset = 0; ptrs_symbols = 0; - dmrs_antenna_port = 0; - N_RB = 50; - duration_in_symbols = 14; - ofdm_symbol_size = 2048; - I_mcs = 9; - start_symbol = 0; - ptrs_symbol_flag = 0; + dmrs_antenna_port = 0; + N_RB = 50; + duration_in_symbols = 14; + ofdm_symbol_size = 2048; + I_mcs = 9; + start_symbol = 0; + ptrs_symbol_flag = 0; k_RE_ref = get_kRE_ref(dmrs_antenna_port, dmrs_Uplink_Config.pusch_dmrs_type, resourceElementOffset); @@ -418,6 +267,6 @@ int main(int argc, char const *argv[]) printf("\n"); - return 0; + return 0; } */ diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h index 291ff4a555..e8a4e61232 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.h +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h @@ -49,32 +49,36 @@ int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset); -uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB); - void set_ptrs_symb_idx(uint16_t *ptrs_symbols, uint8_t duration_in_symbols, uint8_t start_symbol, - uint8_t dmrs_type, uint8_t L_ptrs, - uint8_t pusch_maxLength, - uint16_t ofdm_symbol_size); + uint16_t ul_dmrs_symb_pos); -uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs); +uint8_t is_ptrs_subcarrier(uint16_t k, + uint16_t n_rnti, + uint8_t dmrs_antenna_port, + uint8_t pusch_dmrs_type, + uint8_t K_ptrs, + uint16_t N_RB, + uint8_t k_RE_ref, + uint16_t start_sc, + uint16_t ofdm_symbol_size); -uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size); +/******************************************************************* +* +* NAME : is_ptrs_symbol +* +* PARAMETERS : l ofdm symbol index within slot +* ptrs_symbols bit mask of ptrs +* +* RETURN : 1 if symbol is ptrs, or 0 otherwise +* +* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH +* +*********************************************************************/ -uint8_t is_ptrs_symbol(uint8_t l, - uint16_t k, - uint16_t n_rnti, - uint16_t N_RB, - uint8_t duration_in_symbols, - uint8_t dmrs_antenna_port, - uint8_t K_ptrs, - uint16_t ptrs_symbols, - uint16_t start_sc, - uint16_t ofdm_symbol_size, - pusch_dmrs_type_t pusch_dmrs_type, - uint8_t resourceElementOffset); +static inline uint8_t is_ptrs_symbol(uint8_t l, uint16_t ptrs_symbols) { return ((ptrs_symbols >> l) & 1); } diff --git a/openair1/PHY/NR_REFSIG/scrambling_luts.c b/openair1/PHY/NR_REFSIG/scrambling_luts.c index eae54f94fb..790d3f7719 100644 --- a/openair1/PHY/NR_REFSIG/scrambling_luts.c +++ b/openair1/PHY/NR_REFSIG/scrambling_luts.c @@ -27,11 +27,12 @@ #include "PHY/impl_defs_nr.h" #include "PHY/sse_intrin.h" +#include __m64 byte2m64_re[256]; __m64 byte2m64_im[256]; -void init_byte2m64() { +void init_byte2m64(void) { for (int s=0;s<256;s++) { byte2m64_re[s] = _mm_insert_pi16(byte2m64_re[s],(1-2*(s&1)),0); @@ -42,7 +43,7 @@ void init_byte2m64() { byte2m64_im[s] = _mm_insert_pi16(byte2m64_im[s],(1-2*((s>>5)&1)),2); byte2m64_re[s] = _mm_insert_pi16(byte2m64_re[s],(1-2*((s>>6)&1)),3); byte2m64_im[s] = _mm_insert_pi16(byte2m64_im[s],(1-2*((s>>7)&1)),3); - printf("init_scrambling_luts: s %x (%d) ((%d,%d),(%d,%d),(%d,%d),(%d,%d))\n", + LOG_T(PHY,"init_scrambling_luts: s %x (%d) ((%d,%d),(%d,%d),(%d,%d),(%d,%d))\n", ((uint16_t*)&s)[0], (1-2*(s&1)), ((int16_t*)&byte2m64_re[s])[0],((int16_t*)&byte2m64_im[s])[0], @@ -53,7 +54,7 @@ void init_byte2m64() { } } -void init_scrambling_luts() { +void init_scrambling_luts(void) { init_byte2m64(); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index fbb982b973..1e65797719 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -131,13 +131,13 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, void nr_pdcch_scrambling(uint32_t *in, uint32_t size, uint32_t Nid, - uint32_t n_RNTI, + uint32_t scrambling_RNTI, uint32_t *out) { uint8_t reset; uint32_t x1, x2, s=0; reset = 1; - x2 = (n_RNTI<<16) + Nid; - LOG_D(PHY,"PDCCH Scrambling x2 %x : n_RNTI %x\n",x2,n_RNTI); + x2 = (scrambling_RNTI<<16) + Nid; + LOG_D(PHY,"PDCCH Scrambling x2 %x : scrambling_RNTI %x \n", x2, scrambling_RNTI); for (int i=0; inumDmrsCdmGrpsNoData,dmrs_Type)) { + if( (l != dmrs_symbol) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 101b142c51..fc4c086e2c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -36,7 +36,7 @@ #include "PHY/CODING/coding_defs.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/CODING/nrLDPC_extern.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index b6a4787193..f5a26aec80 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -32,7 +32,7 @@ */ #include "PHY/defs_gNB.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 887cc7cd84..dc754fb3b0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -31,8 +31,8 @@ */ #include "PHY/defs_gNB.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" extern uint16_t prach_root_sequence_map_0_3[838]; extern uint16_t prach_root_sequence_map_abc[138]; @@ -160,14 +160,15 @@ void rx_nr_prach_ru(RU_t *ru, rxsigF = ru->prach_rxsigF; AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n"); + for (int aa=0; aanb_rx; aa++){ if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe; prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))-ru->N_TA_offset]; } - + int dftlen=0; int mu = fp->numerology_index; - int Ncp; + int Ncp = 0; int16_t *prach2; if (prach_sequence_length == 0) { @@ -267,12 +268,10 @@ void rx_nr_prach_ru(RU_t *ru, k*=K; k+=kbar; int reps=1; - int dftlen=0; for (int aa=0; aanb_rx; aa++) { AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa); - // do DFT if (fp->N_RB_UL <= 100) AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL); @@ -295,7 +294,7 @@ void rx_nr_prach_ru(RU_t *ru, dft(DFT_49152,prach2+(98304*3),rxsigF[aa]+(98304*3),1); reps+=2; } - if (prachFormat == 3) { + if (prachFormat == 3) { dftlen=12288; for (int i=0;i<4;i++) dft(DFT_12288,prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1); reps=4; @@ -308,20 +307,20 @@ void rx_nr_prach_ru(RU_t *ru, if (mu==0) AssertFatal(1==0,"Shouldn't get here\n"); else if (mu==1) { - dftlen=2048; - dft(DFT_2048,prach2,rxsigF[aa],1); + dftlen=2048; + dft(DFT_2048,prach2,rxsigF[aa],1); if (prachFormat != 7) { // !=C0 dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); reps++; } if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { - dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); - dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); + dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); + dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); reps+=2; } if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { - dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); - dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); + dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); + dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); reps+=2; } if (prachFormat == 6) { @@ -339,8 +338,8 @@ void rx_nr_prach_ru(RU_t *ru, if (prach_sequence_length == 0) { AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n"); if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=36864; - dft(DFT_36864,prach2,rxsigF[aa],1); + dftlen=36864; + dft(DFT_36864,prach2,rxsigF[aa],1); reps++; } if (prachFormat == 1 || prachFormat == 2) { @@ -348,7 +347,7 @@ void rx_nr_prach_ru(RU_t *ru, reps++; } if (prachFormat == 2) { - dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); + dft(DFT_36864,prach2+(73728*2),rxsigF[aa]+(73728*2),1); dft(DFT_36864,prach2+(73728*3),rxsigF[aa]+(73728*3),1); reps+=2; } @@ -398,15 +397,15 @@ void rx_nr_prach_ru(RU_t *ru, if (prach_sequence_length == 0) { if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=98304; - dft(DFT_98304,prach2,rxsigF[aa],1); + dftlen=98304; + dft(DFT_98304,prach2,rxsigF[aa],1); } if (prachFormat == 1 || prachFormat == 2) { dft(DFT_98304,prach2+196608,rxsigF[aa]+196608,1); reps++; } if (prachFormat == 2) { - dft(DFT_98304,prach2+196608*2,rxsigF[aa]+196608*2,1); + dft(DFT_98304,prach2+(196608*2),rxsigF[aa]+(196608*2),1); dft(DFT_98304,prach2+(196608*3),rxsigF[aa]+(196608*3),1); reps+=2; } @@ -431,13 +430,13 @@ void rx_nr_prach_ru(RU_t *ru, } if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { - dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); - dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); + dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); + dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); reps+=2; } if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { - dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); - dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); + dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); + dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); reps+=2; } if (prachFormat == 6) { @@ -455,7 +454,7 @@ void rx_nr_prach_ru(RU_t *ru, // 80 MHz @ 92.16 Ms/s if (prach_sequence_length == 0) { if (prachFormat == 0 || prachFormat == 1 || prachFormat == 2) { - dftlen=73728; + dftlen=73728; dft(DFT_73728,prach2,rxsigF[aa],1); reps++; } @@ -464,7 +463,7 @@ void rx_nr_prach_ru(RU_t *ru, reps++; } if (prachFormat == 3) { - dftlen=18432; + dftlen=18432; for (int i=0;i<4;i++) dft(DFT_18432,prach2+(i*2*18432),rxsigF[aa]+(i*2*18432),1); reps=4; } @@ -483,13 +482,13 @@ void rx_nr_prach_ru(RU_t *ru, } if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { - dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); - dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); + dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); + dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); reps+=2; } if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { - dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); - dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); + dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); + dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); reps+=2; } if (prachFormat == 6) { @@ -531,6 +530,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, uint16_t *max_preamble_delay ) { + AssertFatal(gNB!=NULL,"Can only be called from gNB\n"); int i; @@ -568,9 +568,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32))); int32_t *prach_ifft=(int32_t*)NULL; - - AssertFatal(gNB!=NULL,"gNB is null\n"); - fp = &gNB->frame_parms; nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value; @@ -586,7 +583,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, restricted_set = cfg->restricted_set_config.value; - uint8_t prach_fmt = prach_pdu->prach_format; uint16_t N_ZC = (prach_sequence_length==0)?839:139; @@ -598,13 +594,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, rootSequenceIndex %d\n", subframe,msg1_frequencystart,rootSequenceIndex); } - - - - start_meas(&gNB->rx_prach); - prach_root_sequence_map = (cfg->prach_sequence_length.value==0) ? prach_root_sequence_map_0_3 : prach_root_sequence_map_abc; // PDP is oversampled, e.g. 1024 sample instead of 839 @@ -802,7 +793,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, if (LOG_DUMPFLAG(PRACH)) { int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); - if (en>60) { + // if (en>60) { int k = (12*n_ra_prb) - 6*fp->N_RB_UL; if (k<0) k+=fp->ofdm_symbol_size; @@ -816,7 +807,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, 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("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1); - } + // } } /* LOG_DUMPFLAG(PRACH) */ stop_meas(&gNB->rx_prach); diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c index 8373e775bd..251d1cbfd8 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c @@ -34,7 +34,7 @@ #include "PHY/impl_defs_nr.h" #include "PHY/defs_nr_UE.h" #include "PHY/NR_TRANSPORT/nr_prach.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h" diff --git a/openair1/PHY/NR_TRANSPORT/nr_pss.c b/openair1/PHY/NR_TRANSPORT/nr_pss.c index be9e011e60..535ce99143 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pss.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pss.c @@ -20,7 +20,7 @@ */ -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" //#define NR_PSS_DEBUG diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c index d74819f87f..04045380eb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c @@ -84,27 +84,6 @@ uint16_t get_dmrs_freq_idx(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t d return dmrs_idx; } - -uint8_t allowed_pdsch_re_in_dmrs_symbol(uint16_t k, - uint16_t start_sc, - uint8_t numDmrsCdmGrpsNoData, - uint8_t dmrs_type) { - uint8_t delta; - for (int i = 0; i -#include "nfapi_interface.h" - -// Functions below implement 36-211 and 36-212 - -/** @addtogroup _PHY_TRANSPORT_ - * @{ - */ - -void fill_UE_dlsch_MCH(PHY_VARS_NR_UE *ue,int mcs,int ndi,int rvidx,int eNB_id); - -int rx_pmch(PHY_VARS_NR_UE *phy_vars_ue, - unsigned char eNB_id, - uint8_t subframe, - unsigned char symbol); - -/** \brief Dump OCTAVE/MATLAB files for PMCH debugging - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param coded_bits_per_codeword G from 36.211 - @param subframe Index of subframe - @returns 0 on success -*/ -void dump_mch(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe); - - - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qpsk(int16_t *stream0_in, - int16_t *stream1_in, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/QPSK) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t nr_dlsch_qpsk_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint32_t len, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qam16(int16_t *stream0_in, - int16_t *stream1_in, - short *ch_mag_i, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qam64(int16_t *stream0_in, - int16_t *stream1_in, - short *ch_mag_i, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/QPSK reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qpsk(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *stream0_out, - short *rho01, - int length); -/** \brief This function perform LLR computation for dual-stream (16QAM/QPSK) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qam16(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (16QAM/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_16qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - uint32_t len, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qam64(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (16QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qpsk(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam16(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam16_avx2(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **dl_ch_mag_i, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam64(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam64_avx2(int32_t *stream0_in, - int32_t *stream1_in, - int32_t *ch_mag, - int32_t *ch_mag_i, - int16_t *stream0_out, - int32_t *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int nr_dlsch_64qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **dl_ch_mag_i, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - uint32_t len, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - //short **llr16p, - uint32_t llr_offset); - - -/** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr - @param beamforming_mode beamforming mode -*/ -int32_t nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - uint8_t symbol, - uint32_t len, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint8_t beamforming_mode); - -/** - \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation and weighted for mid-point in 16QAM constellation - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adjust Adjustment factor in RE for PBCH/PSS/SSS allocations - @param llr128p pointer to pointer to symbol in dlsch_llr - @param beamforming_mode beamforming mode -*/ - -int32_t nr_dlsch_qpsk_llr_SIC(NR_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int32_t **sic_buffer, - int **rho_i, - short *dlsch_llr, - uint8_t num_pdcch_symbols, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - -void nr_dlsch_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - int32_t **dl_ch_mag, - uint8_t symbol, - uint32_t len, - uint8_t first_symbol_flag, - uint16_t nb_rb, - int16_t **llr32p, - uint8_t beamforming_mode); -/** - \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by first mid-point of 64-QAM constellation - @param dl_ch_magb Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by second mid-point of 64-QAM constellation - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adjust PBCH/PSS/SSS RE adjustment (in REs) - @param beamforming_mode beamforming mode -*/ -void nr_dlsch_16qam_llr_SIC (NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **sic_buffer, //Q15 - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t num_pdcch_symbols, - int32_t **dl_ch_mag, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - -void dlsch_64qam_llr_SIC(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **sic_buffer, //Q15 - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t num_pdcch_symbols, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - -void nr_dlsch_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint32_t len, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint32_t llr_offset, - uint8_t beamforming_mode); - - -/** \fn dlsch_siso(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb) - \brief This function does the first stage of llr computation for SISO, by just extracting the pilots, PBCH and primary/secondary synchronization sequences. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param l symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ - -void dlsch_siso(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb); - -/** \fn dlsch_alamouti(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_alamouti(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_antcyc(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does antenna selection (based on antenna cycling pattern) on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. Note that this is not LTE, it is just included for comparison purposes. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_antcyc(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE) - - \brief This function does maximal-ratio combining for dual-antenna receivers. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho Cross correlation between spatial channels - @param rho_i Cross correlation between signal and inteference channels - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation - @param dual_stream_UE Flag to indicate dual-stream detection -*/ -void dlsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **dl_ch_mag_i, - int32_t **dl_ch_magb_i, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE); - -void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms, - NR_UE_PDSCH *lte_ue_pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE); - -/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - NR_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param vrb_type Flag to indicate distributed VRB type - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -/*uint16_t nr_dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms);*/ - -unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned char symbol, - uint8_t pilots, - unsigned short start_rb, - unsigned short nb_pdsch_rb, - unsigned char nr_tti_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms); - -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - NR_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe index - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned char symbol, - uint8_t pilots, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - unsigned char nr_tti_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); - -/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_bf_ch_estimates Beamforming channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms); - -/** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) - @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated - @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated - @param dl_ch_mag First Channel magnitudes (16QAM/64QAM) - @param dl_ch_magb Second weighted Channel magnitudes (64QAM) - @param rxdataF_comp Compensated received waveform - @param rho Cross-correlation between two spatial channels on each RX antenna - @param frame_parms Pointer to frame descriptor - @param symbol Symbol on which to operate - @param first_symbol_flag set to 1 on first DLSCH symbol - @param mod_order Modulation order of allocation - @param nb_rb Number of RBs in allocation - @param output_shift Rescaling for compensated output (should be energy-normalizing) - @param phy_measurements Pointer to UE PHY measurements -*/ -void nr_dlsch_channel_compensation(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **rxdataF_comp, - int32_t **rho, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t symbol, - uint8_t start_symbol, - uint8_t first_symbol_flag, - uint8_t mod_order, - uint16_t nb_rb, - uint8_t output_shift, - PHY_NR_MEASUREMENTS *phy_measurements); - -void nr_dlsch_channel_compensation_core(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - int **rho, - unsigned char n_tx, - unsigned char n_rx, - unsigned char mod_order, - unsigned char output_shift, - int length, - int start_point); - -void nr_dlsch_deinterleaving(uint8_t symbol, - uint8_t start_symbol, - uint16_t L, - uint16_t *llr, - uint16_t *llr_deint, - uint16_t nb_rb_pdsch); - -void dlsch_dual_stream_correlation(NR_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift); - -void dlsch_dual_stream_correlationTM34(NR_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift0, - unsigned char output_shift1); -//This function is used to compute multiplications in Hhermitian * H matrix -void conjch0_mult_ch1(int *ch0, - int *ch1, - int32_t *ch0conj_ch1, - unsigned short nb_rb, - unsigned char output_shift0); - -void construct_HhH_elements(int *ch0conj_ch0, - int *ch1conj_ch1, - int *ch2conj_ch2, - int *ch3conj_ch3, - int *ch0conj_ch1, - int *ch1conj_ch0, - int *ch2conj_ch3, - int *ch3conj_ch2, - int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - unsigned short nb_rb); - -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb); - -void dlsch_channel_level_TM34_meas(int *ch00, - int *ch01, - int *ch10, - int *ch11, - int *avg_0, - int *avg_1, - unsigned short nb_rb); - -void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, - int32_t *median, - int n_tx, - int n_rx, - int length, - int start_point); - -void nr_dlsch_detection_mrc_core(int **rxdataF_comp, - int **rxdataF_comp_i, - int **rho, - int **rho_i, - int **dl_ch_mag, - int **dl_ch_magb, - int **dl_ch_mag_i, - int **dl_ch_magb_i, - unsigned char n_tx, - unsigned char n_rx, - int length, - int start_point); - -void det_HhH(int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - int32_t *det_fin_128, - unsigned short nb_rb); - -void numer(int32_t *Hh_h_00_sq, - int32_t *Hh_h_01_sq, - int32_t *Hh_h_10_sq, - int32_t *Hh_h_11_sq, - int32_t *num_fin, - unsigned short nb_rb); - -uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00, - int *dl_ch_estimates_01, - int *dl_ch_estimates_10, - int *dl_ch_estimates_11, - unsigned short nb_rb); - -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - NR_DL_FRAME_PARMS *frame_parms, - PHY_NR_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off); - - -void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms, - NR_UE_PDSCH *lte_ue_pdsch_vars, - PHY_NR_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned char output_shift0, - unsigned char output_shift1); - - -/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal - @param dl_ch_estimates_ext Channel estimates in allocated RBs - @param frame_parms Pointer to frame descriptor - @param avg Pointer to average signal strength - @param pilots_flag Flag to indicate pilots in symbol - @param nb_rb Number of allocated RBs -*/ -void nr_dlsch_channel_level(int **dl_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t symbol, - uint32_t len, - unsigned short nb_rb); - - -void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - unsigned char *pmi_ext, - int *avg_0, - int *avg_1, - uint8_t symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode); - - -void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - unsigned char *pmi_ext, - int32_t *avg, - uint8_t symbol_mod, - uint16_t nb_rb); - -void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t pilots_flag, - uint16_t nb_rb); - -void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext, - NR_DL_FRAME_PARMS *frame_parms, - NR_UE_DLSCH_t **dlsch_ue, - uint8_t symbol, - uint8_t start_symbol, - uint16_t nb_rb); - -/** \brief This is the top-level entry point for DLSCH decoding in UE. It should be replicated on several - threads (on multi-core machines) corresponding to different HARQ processes. The routine first - computes the segmentation information, followed by rate dematching and sub-block deinterleaving the of the - received LLRs computed by dlsch_demodulation for each transport block segment. It then calls the - turbo-decoding algorithm for each segment and stops after either after unsuccesful decoding of at least - one segment or correct decoding of all segments. Only the segment CRCs are check for the moment, the - overall CRC is ignored. Finally transport block reassembly is performed. - @param phy_vars_ue Pointer to ue variables - @param dlsch_llr Pointer to LLR values computed by dlsch_demodulation - @param lte_frame_parms Pointer to frame descriptor - @param dlsch Pointer to DLSCH descriptor - @param frame Frame number - @param subframe Subframe number - @param num_pdcch_symbols Number of PDCCH symbols - @param is_crnti indicates if PDSCH belongs to a CRNTI (necessary for parallelizing decoding threads) - @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used - @returns 0 on success, 1 on unsuccessful decoding -*/ - -uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, - short *dlsch_llr, - NR_DL_FRAME_PARMS *frame_parms, - NR_UE_DLSCH_t *dlsch, - NR_DL_UE_HARQ_t *harq_process, - uint32_t frame, - uint16_t nb_symb_sch, - uint8_t nr_tti_rx, - uint8_t harq_pid, - uint8_t is_crnti, - uint8_t llr8_flag); - -int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, - NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid); - -uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, - UE_nr_rxtx_proc_t *proc, - int eNB_id, - short *dlsch_llr, - NR_DL_FRAME_PARMS *frame_parms, - NR_UE_DLSCH_t *dlsch, - NR_DL_UE_HARQ_t *harq_process, - uint32_t frame, - uint16_t nb_symb_sch, - uint8_t nr_tti_rx, - uint8_t harq_pid, - uint8_t is_crnti, - uint8_t llr8_flag); - -void *nr_dlsch_decoding_2thread0(void *arg); - -void *nr_dlsch_decoding_2thread1(void *arg); - -void nr_dlsch_unscrambling(int16_t* llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI); - -uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue, - uint8_t subframe, - PDSCH_t dlsch_id, - uint8_t eNB_id); - -/** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation. It performs - - RB extraction (signal and channel estimates) - - channel compensation (matched filtering) - - RE extraction (pilot, PBCH, synch. signals) - - antenna combining (MRC, Alamouti, cycling) - - LLR computation - This function supports TM1, 2, 3, 5, and 6. - @param PHY_VARS_NR_UE Pointer to PHY variables - @param type Type of PDSCH (SI_PDSCH,RA_PDSCH,PDSCH,PMCH) - @param eNB_id eNb index (Nid1) 0,1,2 - @param eNB_id_i Interfering eNB index (Nid1) 0,1,2, or 3 in case of MU-MIMO IC receiver - @param subframe Subframe number - @param symbol Symbol on which to act (within sub-frame) - @param first_symbol_flag set to 1 on first DLSCH symbol - @param rx_type. rx_type=RX_IC_single_stream will enable interference cancellation of a second stream when decoding the first stream. In case of TM1, 2, 5, and this can cancel interference from a neighbouring cell given by eNB_id_i. In case of TM5, eNB_id_i should be set to n_connected_eNB to perform multi-user interference cancellation. In case of TM3, eNB_id_i should be set to eNB_id to perform co-channel interference cancellation; this option should be used together with an interference cancellation step [...]. In case of TM3, if rx_type=RX_IC_dual_stream, both streams will be decoded by applying the IC single stream receiver twice. - @param i_mod Modulation order of the interfering stream -*/ -int32_t nr_rx_pdsch(PHY_VARS_NR_UE *phy_vars_ue, - PDSCH_t type, - uint8_t eNB_id, - uint8_t eNB_id_i, - uint32_t frame, - uint8_t subframe, - uint8_t symbol, - uint8_t first_symbol_flag, - RX_type_t rx_type, - uint8_t i_mod, - uint8_t harq_pid); - -/*! \brief Extract PSS and SSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] pss_ext contain the PSS signals after the extraction - @param[out] sss_ext contain the SSS signals after the extraction - @returns 0 on success -*/ -int pss_sss_extract(PHY_VARS_NR_UE *phy_vars_ue, - int32_t pss_ext[4][72], - int32_t sss_ext[4][72], - uint8_t subframe); - -/*! \brief Extract only PSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] pss_ext contain the PSS signals after the extraction - @returns 0 on success -*/ -int pss_only_extract(PHY_VARS_NR_UE *phy_vars_ue, - int32_t pss_ext[4][72], - uint8_t subframe); - -/*! \brief Extract only SSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] sss_ext contain the SSS signals after the extraction - @returns 0 on success -*/ -int sss_only_extract(PHY_VARS_NR_UE *phy_vars_ue, - int32_t sss_ext[4][72], - uint8_t subframe); - -/*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix) - @param phy_vars_ue Pointer to UE variables - @param tot_metric Pointer to variable containing maximum metric under framing hypothesis (to be compared to other hypotheses - @param flip_max Pointer to variable indicating if start of frame is in second have of RX buffer (i.e. PSS/SSS is flipped) - @param phase_max Pointer to variable (0 ... 6) containing rought phase offset between PSS and SSS (can be used for carrier - frequency adjustment. 0 means -pi/3, 6 means pi/3. - @returns 0 on success -*/ -int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max); - -/*! \brief receiver for the PBCH - \returns number of tx antennas or -1 if error -*/ -int nr_rx_pbch( PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - NR_UE_PBCH *nr_ue_pbch_vars, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t eNB_id, - uint8_t i_ssb, - MIMO_mode_t mimo_mode, - uint32_t high_speed_flag); - -int nr_pbch_detection(UE_nr_rxtx_proc_t *proc, - PHY_VARS_NR_UE *ue, - int pbch_initial_symbol, - runmode_t mode); - -uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue, - uint8_t eNB_id, - uint8_t pbch_phase); - - -/*! \brief PBCH unscrambling - This is similar to pbch_scrabling with the difference that inputs are signed s16s (llr values) and instead of flipping bits we change signs. - \param frame_parms Pointer to frame descriptor - \param llr Output of the demodulator - \param length Length of the sequence - \param frame_mod4 Frame number modulo 4*/ -void pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms, - int8_t* llr, - uint32_t length, - uint8_t frame_mod4); - - -void generate_64qam_table(void); -void generate_16qam_table(void); -void generate_qpsk_table(void); - -uint16_t extract_crc(uint8_t *dci,uint8_t DCI_LENGTH); - -/*! \brief LLR from two streams. This function takes two streams (qpsk modulated) and calculates the LLR, considering one stream as interference. - \param stream0_in pointer to first stream0 - \param stream1_in pointer to first stream1 - \param stream0_out pointer to output stream - \param rho01 pointer to correlation matrix - \param length*/ -void qpsk_qpsk_TM3456(short *stream0_in, - short *stream1_in, - short *stream0_out, - short *rho01, - int length - ); - -/** \brief Attempt decoding of a particular DCI with given length and format. - @param DCI_LENGTH length of DCI in bits - @param DCI_FMT Format of DCI - @param e e-sequence (soft bits) - @param decoded_output Output of Viterbi decoder -*/ -void dci_decoding(uint8_t DCI_LENGTH, - uint8_t DCI_FMT, - int8_t *e, - uint8_t *decoded_output); - -/** \brief Do 36.213 DCI decoding procedure by searching different RNTI options and aggregation levels. Currently does - not employ the complexity reducing procedure based on RNTI. - @param phy_vars_ue UE variables - @param dci_alloc Pointer to DCI_ALLOC_t array to store results for DLSCH/ULSCH programming - @param do_common If 1 perform search in common search-space else ue-specific search-space - @param eNB_id eNB Index on which to act - @param subframe Index of subframe - @returns bitmap of occupied CCE positions (i.e. those detected) -*/ -uint16_t dci_decoding_procedure(PHY_VARS_NR_UE *phy_vars_ue, - DCI_ALLOC_t *dci_alloc, - int do_common, - int16_t eNB_id, - uint8_t subframe); - -uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_NR_UE *ue, - DCI_ALLOC_t *dci_alloc, - uint8_t DCIFormat, - uint8_t agregationLevel, - int16_t eNB_id, - uint8_t subframe); - -uint16_t dci_decoding_procedure_emul(NR_UE_PDCCH **lte_ue_pdcch_vars, - uint8_t num_ue_spec_dci, - uint8_t num_common_dci, - DCI_ALLOC_t *dci_alloc_tx, - DCI_ALLOC_t *dci_alloc_rx, - int16_t eNB_id); - -/** \brief Compute Q (modulation order) based on I_MCS PDSCH. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS */ -uint8_t get_Qm(uint8_t I_MCS); - -/** \brief Compute Q (modulation order) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213. - @param I_MCS */ -uint8_t get_Qm_ul(uint8_t I_MCS); - -/** \brief Compute I_TBS (transport-block size) based on I_MCS for PDSCH. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS */ -uint8_t get_I_TBS(uint8_t I_MCS); - -/** \brief Compute I_TBS (transport-block size) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213. - @param I_MCS */ -unsigned char get_I_TBS_UL(unsigned char I_MCS); - -/** \brief Compute Q (modulation order) based on downlink I_MCS. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS - @param nb_rb - @return Transport block size */ -uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb); - -/** \brief Compute Q (modulation order) based on uplink I_MCS. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS - @param nb_rb - @return Transport block size */ -uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb); - -/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type - @param N_RB_DL number of PRB on DL - @param indicator for even/odd slot - @param vrb vrb index - @param Ngap Gap indicator -*/ -uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap); - -/* \brief Return prb for a given vrb index - @param vrb_type VRB type (0=localized,1=distributed) - @param rb_alloc_dci rballoc field from DCI -*/ -uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci); - - -/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type - @returns Transmission mode (1-7) -*/ -uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); - - -/* \brief - @param ra_header Header of resource allocation (0,1) (See sections 7.1.6.1/7.1.6.2 of 36.213 Rel8.6) - @param rb_alloc Bitmap allocation from DCI (format 1,2) - @returns number of physical resource blocks -*/ -uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL); - -int get_G(NR_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe, uint8_t beamforming_mode); - -int adjust_G(NR_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe); -int adjust_G2(NR_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe,uint8_t symbol); - - -#ifndef modOrder -#define modOrder(I_MCS,I_TBS) ((I_MCS-I_TBS)*2+2) // Find modulation order from I_TBS and I_MCS -#endif - -/** \fn uint8_t I_TBS2I_MCS(uint8_t I_TBS); - \brief This function maps I_tbs to I_mcs according to Table 7.1.7.1-1 in 3GPP TS 36.213 V8.6.0. Where there is two supported modulation orders for the same I_TBS then either high or low modulation is chosen by changing the equality of the two first comparisons in the if-else statement. - \param I_TBS Index of Transport Block Size - \return I_MCS given I_TBS -*/ -uint8_t I_TBS2I_MCS(uint8_t I_TBS); - -/** \fn uint8_t SE2I_TBS(float SE, - uint8_t N_PRB, - uint8_t symbPerRB); - \brief This function maps a requested throughput in number of bits to I_tbs. The throughput is calculated as a function of modulation order, RB allocation and number of symbols per RB. The mapping orginates in the "Transport block size table" (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0) - \param SE Spectral Efficiency (before casting to integer, multiply by 1024, remember to divide result by 1024!) - \param N_PRB Number of PhysicalResourceBlocks allocated \sa lte_frame_parms->N_RB_DL - \param symbPerRB Number of symbols per resource block allocated to this channel - \return I_TBS given an SE and an N_PRB -*/ -uint8_t SE2I_TBS(float SE, - uint8_t N_PRB, - uint8_t symbPerRB); -/** \brief This function generates the sounding reference symbol (SRS) for the uplink according to 36.211 v8.6.0. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence. - @param frame_parms LTE DL Frame Parameters - @param soundingrs_ul_config_dedicated Dynamic configuration from RRC during Connection Establishment - @param txdataF pointer to the frequency domain TX signal - @returns 0 on success*/ -int generate_srs(NR_DL_FRAME_PARMS *frame_parms, - SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, - int *txdataF, - int16_t amp, - uint32_t subframe); - - -/*! - \brief This function is similar to generate_srs_tx but generates a conjugate sequence for channel estimation. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence. - @param phy_vars_ue Pointer to PHY_VARS structure - @param eNB_id Index of destination eNB for this SRS - @param amp Linear amplitude of SRS - @param subframe Index of subframe on which to act - @returns 0 on success, -1 on error with message -*/ - -int32_t generate_srs_tx(PHY_VARS_NR_UE *phy_vars_ue, - uint8_t eNB_id, - int16_t amp, - uint32_t subframe); - -/*! - \brief This function generates the downlink reference signal for the PUSCH according to 36.211 v8.6.0. The DRS occuies the RS defined by rb_alloc and the symbols 2 and 8 for extended CP and 3 and 10 for normal CP. -*/ - -int32_t generate_drs_pusch(PHY_VARS_NR_UE *phy_vars_ue, - UE_nr_rxtx_proc_t *proc, - uint8_t eNB_id, - int16_t amp, - uint32_t subframe, - uint32_t first_rb, - uint32_t nb_rb, - uint8_t ant); - -/*! - \brief This function initializes the Group Hopping, Sequence Hopping and nPRS sequences for PUCCH/PUSCH according to 36.211 v8.6.0. It should be called after configuration of UE (reception of SIB2/3) and initial configuration of eNB (or after reconfiguration of cell-specific parameters). - @param frame_parms Pointer to a NR_DL_FRAME_PARMS structure (eNB or UE)*/ -void init_ul_hopping(NR_DL_FRAME_PARMS *frame_parms); - - -/*! - \brief This function implements the initialization of paging parameters for UE (See Section 7, 36.304).It must be called after setting IMSImod1024 during UE startup and after receiving SIB2 - @param ue Pointer to UE context - @param defaultPagingCycle T from 36.304 (0=32,1=64,2=128,3=256) - @param nB nB from 36.304 (0=4T,1=2T,2=T,3=T/2,4=T/4,5=T/8,6=T/16,7=T/32*/ -int init_ue_paging_info(PHY_VARS_NR_UE *ue, long defaultPagingCycle, long nB); - -int32_t compareints (const void * a, const void * b); - - -void ulsch_modulation(int32_t **txdataF, - int16_t amp, - frame_t frame, - uint32_t subframe, - NR_DL_FRAME_PARMS *frame_parms, - NR_UE_ULSCH_t *ulsch); - - - - - - -int generate_ue_dlsch_params_from_dci(int frame, - uint8_t subframe, - void *dci_pdu, - rnti_t rnti, - DCI_format_t dci_format, - NR_UE_PDCCH *pdcch_vars, - NR_UE_PDSCH *pdsch_vars, - NR_UE_DLSCH_t **dlsch, - NR_DL_FRAME_PARMS *frame_parms, - PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint8_t beamforming_mode, - uint16_t tc_rnti); - - -int generate_ue_ulsch_params_from_dci(void *dci_pdu, - rnti_t rnti, - uint8_t subframe, - DCI_format_t dci_format, - PHY_VARS_NR_UE *phy_vars_ue, - UE_nr_rxtx_proc_t *proc, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint16_t cba_rnti, - uint8_t eNB_id, - uint8_t use_srs); - -int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_NR_UE *phy_vars_ue, - UE_nr_rxtx_proc_t *proc, - uint8_t eNB_id); -double sinr_eff_cqi_calc(PHY_VARS_NR_UE *phy_vars_ue, - uint8_t eNB_id, - uint8_t subframe); - -uint8_t sinr2cqi(double sinr,uint8_t trans_mode); - - -int dump_dci(NR_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci); - -int dump_ue_stats(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, char* buffer, int length, runmode_t mode, int input_level_dBm); - -void init_transport_channels(uint8_t); - -void generate_RIV_tables(void); - -/*! - \brief Encoding of PUSCH/ACK/RI/ACK from 36-212. - @param a Pointer to ulsch SDU - @param frame_parms Pointer to Frame parameters - @param ulsch Pointer to ulsch descriptor - @param harq_pid HARQ process ID - @param tmode Transmission mode (1-7) - @param control_only_flag Generate PUSCH with control information only - @param Nbundled Parameter for ACK/NAK bundling (36.213 Section 7.3) -*/ -uint32_t ulsch_encoding(uint8_t *a, - PHY_VARS_NR_UE *phy_vars_ue, - uint8_t harq_pid, - uint8_t eNB_id, - uint8_t subframe_rx, - uint8_t tmode, - uint8_t control_only_flag, - uint8_t Nbundled); - -void print_CQI(void *o,UCI_format_t uci_format,uint8_t eNB_id,int N_RB_DL); - -void fill_CQI(NR_UE_ULSCH_t *ulsch,PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id, uint8_t harq_pid,int N_RB_DL, rnti_t rnti, uint8_t trans_mode,double sinr_eff); - -void reset_cba_uci(void *o); - -/** \brief This routine computes the subband PMI bitmap based on measurements (0,1,2,3 for rank 0 and 0,1 for rank 1) in the format needed for UCI - @param meas pointer to measurements - @param eNB_id eNB_id - @param nb_subbands number of subbands - @returns subband PMI bitmap -*/ -uint16_t quantize_subband_pmi(PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id,int nb_subbands); - -int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb); - -uint16_t quantize_subband_pmi2(PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands); - - - -uint64_t cqi2hex(uint32_t cqi); - -uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - -int get_nCCE_offset_l1(int *CCE_table, - const unsigned char L, - const int nCCE, - const int common_dci, - const unsigned short rnti, - const unsigned char subframe); - -uint16_t get_nCCE(uint8_t num_pdcch_symbols,NR_DL_FRAME_PARMS *frame_parms,uint8_t mi); - -uint16_t get_nquad(uint8_t num_pdcch_symbols,NR_DL_FRAME_PARMS *frame_parms,uint8_t mi); - -uint8_t get_mi(NR_DL_FRAME_PARMS *frame,uint8_t subframe); - -uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe); - -uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); - -void pdcch_interleaving(NR_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi); - -void pdcch_unscrambling(NR_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - int8_t* llr, - uint32_t length); - - - -void dlsch_unscrambling(NR_DL_FRAME_PARMS *frame_parms, - int mbsfn_flag, - NR_UE_DLSCH_t *dlsch, - int G, - int16_t* llr, - uint8_t q, - uint8_t Ns); - -void init_ncs_cell(NR_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]); - -void generate_pucch1x(int32_t **txdataF, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n1_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe); - -void generate_pucch2x(int32_t **txdataF, - NR_DL_FRAME_PARMS *fp, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n2_pucch, - uint8_t *payload, - int A, - int B2, - int16_t amp, - uint8_t subframe, - uint16_t rnti); - -void generate_pucch3x(int32_t **txdataF, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n3_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe, - uint16_t rnti); - - -void init_ulsch_power_LUT(void); - -/*! - \brief Check for PRACH TXop in subframe - @param frame_parms Pointer to NR_DL_FRAME_PARMS - @param frame frame index to check - @param subframe subframe index to check - @returns 0 on success -*/ -int is_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe); - -/*! - \brief Generate PRACH waveform - @param phy_vars_ue Pointer to ue top-level descriptor - @param eNB_id Index of destination eNB - @param subframe subframe index to operate on - @param index of preamble (0-63) - @param Nf System frame number - @returns 0 on success - -*/ -int32_t generate_prach(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint16_t Nf); - - -/*! - \brief Helper for MAC, returns number of available PRACH in TDD for a particular configuration index - @param frame_parms Pointer to NR_DL_FRAME_PARMS structure - @returns 0-5 depending on number of available prach -*/ -uint8_t get_num_prach_tdd(module_id_t Mod_id); - -/*! - \brief Return the PRACH format as a function of the Configuration Index and Frame type. - @param prach_ConfigIndex PRACH Configuration Index - @param frame_type 0-FDD, 1-TDD - @returns 0-1 accordingly -*/ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); - -/*! - \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index - @param frame_parms Pointer to NR_DL_FRAME_PARMS structure - @returns 0-5 depending on number of available prach -*/ -uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index); - -/*! - \brief Comp ute DFT of PRACH ZC sequences. Used for generation of prach in UE and reception of PRACH in eNB. - @param rootSequenceIndex PRACH root sequence - #param prach_ConfigIndex PRACH Configuration Index - @param zeroCorrelationZoneConfig PRACH ncs_config - @param highSpeedFlat PRACH High-Speed Flag - @param frame_type TDD/FDD flag - @param Xu DFT output -*/ -void compute_prach_seq(uint16_t rootSequenceIndex, - uint8_t prach_ConfigIndex, - uint8_t zeroCorrelationZoneConfig, - uint8_t highSpeedFlag, - lte_frame_type_t frame_type, - uint32_t X_u[64][839]); - -void compute_nr_prach_seq(uint8_t short_sequence, - uint8_t num_sequences, - uint8_t rootSequenceIndex, - uint32_t X_u[64][839]); - -void init_prach_tables(int N_ZC); -void init_nr_prach_tables(int N_ZC); - -void init_unscrambling_lut(void); -void init_scrambling_lut(void); - -/*! - \brief Return the status of MBSFN in this frame/subframe - @param frame Frame index - @param subframe Subframe index - @param frame_parms Pointer to frame parameters - @returns 1 if subframe is for MBSFN -*/ -int is_pmch_subframe(frame_t frame, int subframe, NR_DL_FRAME_PARMS *frame_parms); - -uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots); - -uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); - -uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, - NR_DL_FRAME_PARMS *lte_frame_parms, - NR_UE_DLSCH_t *dlsch, - uint8_t subframe, - uint8_t num_pdcch_symbols); - -// DL power control functions -double get_pa_dB(uint8_t pa); - - -double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - NR_UE_DLSCH_t *dlsch_ue, - uint8_t dl_power_off, - uint8_t n_antenna_port); - -double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - PDSCH_CONFIG_COMMON *pdsch_config_common, - uint8_t n_antenna_port, - NR_UE_DLSCH_t *dlsch_ue, - uint8_t dl_power_off); - -/*void compute_sqrt_RhoAoRhoB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - PDSCH_CONFIG_COMMON *pdsch_config_common, - uint8_t n_antenna_port, - NR_UE_DLSCH_t *dlsch_ue); -*/ - -uint8_t get_prach_prb_offset(NR_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf); - -uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset); - -int nr_rx_pdsch(PHY_VARS_NR_UE *ue, - PDSCH_t type, - unsigned char eNB_id, - unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference - uint32_t frame, - uint8_t nr_tti_rx, - unsigned char symbol, - unsigned char first_symbol_flag, - RX_type_t rx_type, - unsigned char i_mod, - unsigned char harq_pid); - -uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) ; - -uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, - short *dlsch_llr, - NR_DL_FRAME_PARMS *frame_parms, - NR_UE_DLSCH_t *dlsch, - NR_DL_UE_HARQ_t *harq_process, - uint32_t frame, - uint16_t nb_symb_sch, - uint8_t nr_tti_rx, - uint8_t harq_pid, - uint8_t is_crnti, - uint8_t llr8_flag); - -/**@}*/ -#endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 1874bb401c..a966db5844 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -232,7 +232,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, unsigned short start_re, re, nb_re_pusch; unsigned char aarx; - uint8_t K_ptrs; + uint8_t K_ptrs = 0; uint32_t rxF_ext_index = 0; uint32_t ul_ch0_ext_index = 0; uint32_t ul_ch0_index = 0; @@ -282,21 +282,18 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, else is_dmrs_re = 0; - if ( ((pusch_pdu->pdu_bit_map)>>2)& 0x01 ) { - + if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { K_ptrs = (pusch_pdu->pusch_ptrs.ptrs_freq_density)?4:2; - is_ptrs_symbol_flag = is_ptrs_symbol(symbol, - (start_re + re)%frame_parms->ofdm_symbol_size, - n_rnti, - pusch_pdu->rb_size, - pusch_pdu->nr_of_symbols, - aarx, - K_ptrs, - pusch_vars->ptrs_symbols, - start_re, - frame_parms->ofdm_symbol_size, - pusch_pdu->dmrs_config_type, - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); + if(is_ptrs_symbol(symbol, pusch_vars->ptrs_symbols)) + is_ptrs_symbol_flag = is_ptrs_subcarrier((start_re + re) % frame_parms->ofdm_symbol_size, + n_rnti, + aarx, + pusch_pdu->dmrs_config_type, + K_ptrs, + pusch_pdu->rb_size, + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_re, + frame_parms->ofdm_symbol_size); if (is_ptrs_symbol_flag == 1) num_ptrs_symbols++; @@ -304,7 +301,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, } #ifdef DEBUG_RB_EXT - printf("re = %d, symbol = %d\n", re, symbol); + printf("re = %d, is_ptrs_symbol_flag = %d, symbol = %d\n", re, is_ptrs_symbol_flag, symbol); #endif if ( is_dmrs_re == 0 && is_ptrs_symbol_flag == 0) { @@ -1021,7 +1018,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, unsigned char harq_pid) { - uint8_t aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol + uint8_t aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol uint32_t nb_re_pusch, bwp_start_subcarrier; uint8_t L_ptrs = 0; // PTRS parameter int avgs; @@ -1030,7 +1027,6 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; dmrs_symbol_flag = 0; - ptrs_symbol_flag = 0; gNB->pusch_vars[ulsch_id]->ptrs_sc_per_ofdm_symbol = 0; if(symbol == rel15_ul->start_symbol_index){ @@ -1039,16 +1035,14 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[ulsch_id]->cl_done = 0; gNB->pusch_vars[ulsch_id]->ptrs_symbols = 0; - if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu + if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu L_ptrs = 1<<(rel15_ul->pusch_ptrs.ptrs_time_density); set_ptrs_symb_idx(&gNB->pusch_vars[ulsch_id]->ptrs_symbols, rel15_ul->nr_of_symbols, rel15_ul->start_symbol_index, - rel15_ul->dmrs_config_type, L_ptrs, - 1, // only dmrs of length 1 is currently supported - frame_parms->ofdm_symbol_size); + rel15_ul->ul_dmrs_symb_pos); } } @@ -1073,23 +1067,9 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; } - if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu - ptrs_symbol_flag = is_ptrs_symbol(symbol, - 0, - rel15_ul->rnti, - rel15_ul->rb_size, - rel15_ul->nr_of_symbols, - 0, - (rel15_ul->pusch_ptrs.ptrs_freq_density)?4:2, - gNB->pusch_vars[ulsch_id]->ptrs_symbols, - 0, - frame_parms->ofdm_symbol_size, - rel15_ul->dmrs_config_type, - rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset); - } - - if (ptrs_symbol_flag == 1){ - gNB->pusch_vars[ulsch_id]->ptrs_symbol_index = symbol; + if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu + if(is_ptrs_symbol(symbol, gNB->pusch_vars[ulsch_id]->ptrs_symbols)) + gNB->pusch_vars[ulsch_id]->ptrs_symbol_index = symbol; } @@ -1109,7 +1089,6 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, //--------------------- RBs extraction --------------------- //---------------------------------------------------------- - if (nb_re_pusch > 0) { start_meas(&gNB->ulsch_rbs_extraction_stats); @@ -1148,6 +1127,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+1; gNB->pusch_vars[ulsch_id]->cl_done = 1; } + start_meas(&gNB->ulsch_channel_compensation_stats); nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext, gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, @@ -1176,8 +1156,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, //---------------------------------------------------------- //-------------------- LLRs computation -------------------- //---------------------------------------------------------- - start_meas(&gNB->ulsch_llr_stats); + AssertFatal(gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order+nb_re_pusch*rel15_ul->qam_mod_order < (8*((3*8*6144)+12)) , "Mysterious llr buffer size check"); nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], gNB->pusch_vars[ulsch_id]->ul_ch_mag0, gNB->pusch_vars[ulsch_id]->ul_ch_magb0, @@ -1192,4 +1172,5 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset = gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset + nb_re_pusch; return (0); + } diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index d3943f5265..501df8bb35 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -20,15 +20,15 @@ */ /*! \file PHY/NR_TRANSPORT/pucch_rx.c -* \brief Top-level routines for decoding the PUCCH physical channel -* \author A. Mico Pereperez, Padarthi Naga Prasanth, Francesco Mani, Raymond Knopp -* \date 2020 -* \version 0.2 -* \company Eurecom -* \email: -* \note -* \warning -*/ + * \brief Top-level routines for decoding the PUCCH physical channel + * \author A. Mico Pereperez, Padarthi Naga Prasanth, Francesco Mani, Raymond Knopp + * \date 2020 + * \version 0.2 + * \company Eurecom + * \email: + * \note + * \warning + */ #include #include #include @@ -42,8 +42,8 @@ #include "PHY/defs_gNB.h" #include "PHY/sse_intrin.h" #include "PHY/NR_UE_TRANSPORT/pucch_nr.h" +#include #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_REFSIG/nr_refsig.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" @@ -201,7 +201,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, * Defining cyclic shift hopping TS 38.211 Subclause 6.3.2.2.2 */ // alpha is cyclic shift - double alpha; + //double alpha; // lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission //uint8_t lnormal; // lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213] @@ -238,9 +238,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, int16_t x_n_re[nr_sequences][24],x_n_im[nr_sequences][24]; for(i=0;inr_of_symbols; l++){ - alpha = nr_cyclic_shift_hopping(pucch_pdu->hopping_id,pucch_pdu->initial_cyclic_shift,mcs[i],l,pucch_pdu->start_symbol_index,slot); + double alpha = nr_cyclic_shift_hopping(pucch_pdu->hopping_id,pucch_pdu->initial_cyclic_shift,mcs[i],l,pucch_pdu->start_symbol_index,slot); #ifdef DEBUG_NR_PUCCH_RX printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d/%d,mcs %d)\n",u,v,alpha,l,l+pucch_pdu->start_symbol_index,mcs[i]); printf("lut output %d\n",gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index]); @@ -248,14 +248,14 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, alpha=0.0; for (n=0; n<12; n++){ x_n_re[i][(12*l)+n] = (int16_t)((int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15) - - (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15)))); // Re part of base sequence shifted by alpha + - (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15)))); // Re part of base sequence shifted by alpha x_n_im[i][(12*l)+n] =(int16_t)((int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15) - + (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15)))); // Im part of base sequence shifted by alpha + + (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15)))); // Im part of base sequence shifted by alpha #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \tx_n(l=%d,n=%d)=(%d,%d) %d,%d\n", - u,v,alpha,l,n,x_n_re[i][(12*l)+n],x_n_im[i][(12*l)+n], - (int32_t)(round(32767*cos(alpha*n))), - (int32_t)(round(32767*sin(alpha*n)))); + printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \tx_n(l=%d,n=%d)=(%d,%d) %d,%d\n", + u,v,alpha,l,n,x_n_re[i][(12*l)+n],x_n_im[i][(12*l)+n], + (int32_t)(round(32767*cos(alpha*n))), + (int32_t)(round(32767*sin(alpha*n)))); #endif } } @@ -277,12 +277,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, r_re[(12*l)+n]=((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[0]; r_im[(12*l)+n]=((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[1]; - #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch0] mapping to RE \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \ttxptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", - frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,(l2*frame_parms->ofdm_symbol_size)+re_offset, - l,n,((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[0], - ((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[1]); - #endif +#ifdef DEBUG_NR_PUCCH_RX + printf("\t [nr_generate_pucch0] mapping to RE \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \ttxptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,(l2*frame_parms->ofdm_symbol_size)+re_offset, + l,n,((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[0], + ((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[1]); +#endif re_offset++; if (re_offset>= frame_parms->ofdm_symbol_size) re_offset-=frame_parms->ofdm_symbol_size; @@ -311,9 +311,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, } #else - int16_t *x_re = table_5_2_2_2_2_Re[u],*x_im = table_5_2_2_2_2_Im[u]; + const int16_t *x_re = table_5_2_2_2_2_Re[u],*x_im = table_5_2_2_2_2_Im[u]; int16_t xr[24] __attribute__((aligned(32))); - int16_t xrt[24] __attribute__((aligned(32))); + //int16_t xrt[24] __attribute__((aligned(32))); int32_t xrtmag=0; int maxpos=0; int n2=0; @@ -347,7 +347,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, n2=0; for (l=0;lnr_of_symbols;l++) { - seq_index = (pucch_pdu->initial_cyclic_shift+ + seq_index = (pucch_pdu->initial_cyclic_shift+ mcs[i]+ gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; for (n=0;n<12;n++,n2+=2) { @@ -374,7 +374,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, index=maxpos; #endif // first bit of bitmap for sr presence and second bit for acknack presence - uci_pdu->pdu_bit_map = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1); + uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1); uci_pdu->pucch_format = 0; // format 0 uci_pdu->ul_cqi = 0xff; // currently not valid uci_pdu->timing_advance = 0xffff; // currently not valid @@ -439,7 +439,7 @@ void nr_decode_pucch1( int32_t **rxdataF, uint8_t timeDomainOCC, uint8_t nr_bit) { #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%d m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n", + printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%lp m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n", nr_tti_tx,payload,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,timeDomainOCC,nr_bit); #endif /* @@ -449,7 +449,7 @@ void nr_decode_pucch1( int32_t **rxdataF, // complex-valued symbol d_re, d_im containing complex-valued symbol d(0): int16_t d_re=0, d_im=0,d1_re=0,d1_im=0; #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch1] sequence modulation: payload=%x \tde_re=%d \tde_im=%d\n",payload,d_re,d_im); + printf("\t [nr_generate_pucch1] sequence modulation: payload=%lp \tde_re=%d \tde_im=%d\n",payload,d_re,d_im); #endif /* * Defining cyclic shift hopping TS 38.211 Subclause 6.3.2.2.2 @@ -543,7 +543,7 @@ void nr_decode_pucch1( int32_t **rxdataF, z_re_rx[i+n] = ((int16_t *)&rxdataF[0][re_offset])[0]; z_im_rx[i+n] = ((int16_t *)&rxdataF[0][re_offset])[1]; #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch1] mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch1] mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+n,re_offset, l,n,((int16_t *)&rxdataF[0][re_offset])[0],((int16_t *)&rxdataF[0][re_offset])[1]); #endif @@ -552,13 +552,13 @@ void nr_decode_pucch1( int32_t **rxdataF, if (l%2 == 0) { // mapping DM-RS signal according to TS38.211 subclause 6.4.1.3.1 z_dmrs_re_rx[i+n] = ((int16_t *)&rxdataF[0][re_offset])[0]; z_dmrs_im_rx[i+n] = ((int16_t *)&rxdataF[0][re_offset])[1]; -// printf("%d\t%d\t%d\n",l,z_dmrs_re_rx[i+n],z_dmrs_im_rx[i+n]); + // printf("%d\t%d\t%d\n",l,z_dmrs_re_rx[i+n],z_dmrs_im_rx[i+n]); #ifdef DEBUG_NR_PUCCH_RX - printf("\t [nr_generate_pucch1] mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch1] mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+n,re_offset, l,n,((int16_t *)&rxdataF[0][re_offset])[0],((int16_t *)&rxdataF[0][re_offset])[1]); #endif -// printf("l=%d\ti=%d\tre_offset=%d\treceived dmrs re=%d\tim=%d\n",l,i,re_offset,z_dmrs_re_rx[i+n],z_dmrs_im_rx[i+n]); + // printf("l=%d\ti=%d\tre_offset=%d\treceived dmrs re=%d\tim=%d\n",l,i,re_offset,z_dmrs_re_rx[i+n],z_dmrs_im_rx[i+n]); } re_offset++; @@ -577,7 +577,7 @@ void nr_decode_pucch1( int32_t **rxdataF, l,lprime); #endif // y_n contains the complex value d multiplied by the sequence r_u_v - if ((intraSlotFrequencyHopping == 1) && (l >= (int)floor(nrofSymbols/2))) n_hop = 1; // n_hop = 1 for second hop + if ((intraSlotFrequencyHopping == 1) && (l >= (int)floor(nrofSymbols/2))) n_hop = 1; // n_hop = 1 for second hop #ifdef DEBUG_NR_PUCCH_RX printf("\t [nr_generate_pucch1] entering function nr_group_sequence_hopping with n_hop=%d, nr_tti_tx=%d\n", @@ -595,18 +595,18 @@ void nr_decode_pucch1( int32_t **rxdataF, } else{ r_u_v_alpha_delta_dmrs_re[n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15) - - (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15))); // Re part of DMRS base sequence shifted by alpha + - (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15))); // Re part of DMRS base sequence shifted by alpha r_u_v_alpha_delta_dmrs_im[n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15) - + (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15))); // Im part of DMRS base sequence shifted by alpha + + (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15))); // Im part of DMRS base sequence shifted by alpha r_u_v_alpha_delta_dmrs_re[n] = (int16_t)(((int32_t)(amp*r_u_v_alpha_delta_dmrs_re[n]))>>15); r_u_v_alpha_delta_dmrs_im[n] = (int16_t)(((int32_t)(amp*r_u_v_alpha_delta_dmrs_im[n]))>>15); } -// printf("symbol=%d\tr_u_rx_re=%d\tr_u_rx_im=%d\n",l,r_u_v_alpha_delta_dmrs_re[n], r_u_v_alpha_delta_dmrs_im[n]); + // printf("symbol=%d\tr_u_rx_re=%d\tr_u_rx_im=%d\n",l,r_u_v_alpha_delta_dmrs_re[n], r_u_v_alpha_delta_dmrs_im[n]); // PUCCH sequence = DM-RS sequence multiplied by d(0) -/* y_n_re[n] = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*d_re)>>15) - - (((int32_t)(r_u_v_alpha_delta_im[n])*d_im)>>15))); // Re part of y(n) - y_n_im[n] = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*d_im)>>15) - + (((int32_t)(r_u_v_alpha_delta_im[n])*d_re)>>15))); // Im part of y(n) */ + /* y_n_re[n] = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*d_re)>>15) + - (((int32_t)(r_u_v_alpha_delta_im[n])*d_im)>>15))); // Re part of y(n) + y_n_im[n] = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*d_im)>>15) + + (((int32_t)(r_u_v_alpha_delta_im[n])*d_re)>>15))); // Im part of y(n) */ #ifdef DEBUG_NR_PUCCH_RX printf("\t [nr_generate_pucch1] sequence generation \tu=%d \tv=%d \talpha=%lf \tr_u_v_alpha_delta[n=%d]=(%d,%d) \ty_n[n=%d]=(%d,%d)\n", u,v,alpha,n,r_u_v_alpha_delta_re[n],r_u_v_alpha_delta_im[n],n,y_n_re[n],y_n_im[n]); @@ -656,12 +656,12 @@ void nr_decode_pucch1( int32_t **rxdataF, if(floor(l/2)*12==(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)){ for (int n=0; n<12 ; n++) { z_re_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_im_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]=z_re_temp; z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]=z_im_temp; -// printf("symbol=%d\tz_re_rx=%d\tz_im_rx=%d\t",l,(int)z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); + // printf("symbol=%d\tz_re_rx=%d\tz_im_rx=%d\t",l,(int)z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); #ifdef DEBUG_NR_PUCCH_RX printf("\t [nr_generate_pucch1] block-wise spread with wi(m) (mprime=%d, m=%d, n=%d) z[%d] = ((%d * %d - %d * %d), (%d * %d + %d * %d)) = (%d,%d)\n", mprime, m, n, (mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n, @@ -671,15 +671,15 @@ void nr_decode_pucch1( int32_t **rxdataF, #endif // multiplying with conjugate of low papr sequence z_re_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - + (((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_im_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - - (((int32_t)(r_u_v_alpha_delta_im[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(r_u_v_alpha_delta_im[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_re_temp; z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_im_temp; -/* if(z_re_temp<0){ - printf("\nBug detection %d\t%d\t%d\t%d\n",r_u_v_alpha_delta_re[n],z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(((int32_t)(r_u_v_alpha_delta_re[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15),(((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15)); - } - printf("z1_re_rx=%d\tz1_im_rx=%d\n",(int)z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); */ + /* if(z_re_temp<0){ + printf("\nBug detection %d\t%d\t%d\t%d\n",r_u_v_alpha_delta_re[n],z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(((int32_t)(r_u_v_alpha_delta_re[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15),(((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15)); + } + printf("z1_re_rx=%d\tz1_im_rx=%d\n",(int)z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); */ } } } @@ -690,12 +690,12 @@ void nr_decode_pucch1( int32_t **rxdataF, if(floor(l/2)*12==(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)){ for (int n=0; n<12 ; n++) { z_dmrs_re_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_im_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_re_temp; z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_im_temp; -// printf("symbol=%d\tz_dmrs_re_rx=%d\tz_dmrs_im_rx=%d\t",l,(int)z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); + // printf("symbol=%d\tz_dmrs_re_rx=%d\tz_dmrs_im_rx=%d\t",l,(int)z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); #ifdef DEBUG_NR_PUCCH_RX printf("\t [nr_generate_pucch1] block-wise spread with wi(m) (mprime=%d, m=%d, n=%d) z[%d] = ((%d * %d - %d * %d), (%d * %d + %d * %d)) = (%d,%d)\n", mprime, m, n, (mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n, @@ -705,17 +705,17 @@ void nr_decode_pucch1( int32_t **rxdataF, #endif //finding channel coeffcients by dividing received dmrs with actual dmrs and storing them in z_dmrs_re_rx and z_dmrs_im_rx arrays z_dmrs_re_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - + (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_im_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - - (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); -/* if(z_dmrs_re_temp<0){ - printf("\nBug detection %d\t%d\t%d\t%d\n",r_u_v_alpha_delta_dmrs_re[n],z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15),(((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15)); - }*/ + - (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + /* if(z_dmrs_re_temp<0){ + printf("\nBug detection %d\t%d\t%d\t%d\n",r_u_v_alpha_delta_dmrs_re[n],z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15),(((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15)); + }*/ z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_re_temp; z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_im_temp; -// printf("z1_dmrs_re_rx=%d\tz1_dmrs_im_rx=%d\n",(int)z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); - /* z_dmrs_re_rx[(int)(l/2)*12+n]=z_dmrs_re_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_re[n]; - z_dmrs_im_rx[(int)(l/2)*12+n]=z_dmrs_im_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_im[n]; */ + // printf("z1_dmrs_re_rx=%d\tz1_dmrs_im_rx=%d\n",(int)z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],(int)z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); + /* z_dmrs_re_rx[(int)(l/2)*12+n]=z_dmrs_re_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_re[n]; + z_dmrs_im_rx[(int)(l/2)*12+n]=z_dmrs_im_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_im[n]; */ } } } @@ -742,9 +742,9 @@ void nr_decode_pucch1( int32_t **rxdataF, if(floor(l/2)*12==(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)){ for (int n=0; n<12 ; n++) { z_re_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_im_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_1][w_index][m])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_1][w_index][m])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_re_temp; z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_im_temp; #ifdef DEBUG_NR_PUCCH_RX @@ -755,9 +755,9 @@ void nr_decode_pucch1( int32_t **rxdataF, z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n],z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n]); #endif z_re_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - + (((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(r_u_v_alpha_delta_im[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_im_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_re[n])*z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15) - - (((int32_t)(r_u_v_alpha_delta_im[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(r_u_v_alpha_delta_im[n])*z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n])>>15))>>1); z_re_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_re_temp; z_im_rx[(mprime*12*N_SF_mprime0_PUCCH_1)+(m*12)+n] = z_im_temp; } @@ -770,9 +770,9 @@ void nr_decode_pucch1( int32_t **rxdataF, if(floor(l/2)*12==(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)){ for (int n=0; n<12 ; n++) { z_dmrs_re_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_im_temp = (int16_t)(((((int32_t)(table_6_3_2_4_1_2_Wi_Re[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(table_6_3_2_4_1_2_Wi_Im[N_SF_mprime_PUCCH_DMRS_1][w_index][m])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_re_temp; z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_im_temp; #ifdef DEBUG_NR_PUCCH_RX @@ -784,14 +784,14 @@ void nr_decode_pucch1( int32_t **rxdataF, #endif //finding channel coeffcients by dividing received dmrs with actual dmrs and storing them in z_dmrs_re_rx and z_dmrs_im_rx arrays z_dmrs_re_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - + (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + + (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_im_temp = (int16_t)(((((int32_t)(r_u_v_alpha_delta_dmrs_re[n])*z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15) - - (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); + - (((int32_t)(r_u_v_alpha_delta_dmrs_im[n])*z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n])>>15))>>1); z_dmrs_re_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_re_temp; z_dmrs_im_rx[(mprime*12*N_SF_mprime0_PUCCH_DMRS_1)+(m*12)+n] = z_dmrs_im_temp; - /* z_dmrs_re_rx[(int)(l/2)*12+n]=z_dmrs_re_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_re[n]; - z_dmrs_im_rx[(int)(l/2)*12+n]=z_dmrs_im_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_im[n]; */ + /* z_dmrs_re_rx[(int)(l/2)*12+n]=z_dmrs_re_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_re[n]; + z_dmrs_im_rx[(int)(l/2)*12+n]=z_dmrs_im_rx[(int)(l/2)*12+n]/r_u_v_alpha_delta_dmrs_im[n]; */ } } } @@ -843,8 +843,8 @@ void nr_decode_pucch1( int32_t **rxdataF, for(int n=0;n<12;n++){ y_n_re[n]=round(z_re_rx[l*12+n]/floor(nrofSymbols/4))+y_n_re[n]; y_n_im[n]=round(z_im_rx[l*12+n]/floor(nrofSymbols/4))+y_n_im[n]; - } - } + } + } else{ for(int n=0;n<12;n++){ y1_n_re[n]=round(z_re_rx[l*12+n]/round(nrofSymbols/4))+y1_n_re[n]; @@ -876,12 +876,12 @@ void nr_decode_pucch1( int32_t **rxdataF, } //Decoding QPSK or BPSK symbols to obtain payload bits if(nr_bit==1){ - if((d_re+d_im)>0){ - *payload=0; - } - else{ - *payload=1; - } + if((d_re+d_im)>0){ + *payload=0; + } + else{ + *payload=1; + } } else if(nr_bit==2){ if((d_re>0)&&(d_im>0)){ @@ -919,6 +919,9 @@ __m256i *pucch2_lut[9]={pucch2_3bit, pucch2_10bit, pucch2_11bit}; +__m64 pucch2_polar_4bit[16]; +__m128i pucch2_polar_llr_num_lut[256],pucch2_polar_llr_den_lut[256]; + void init_pucch2_luts() { uint32_t out; @@ -927,7 +930,9 @@ void init_pucch2_luts() { for (int b=3;b<12;b++) { for (uint16_t i=0;i<(1< 0 ? -1 : 1; @@ -996,6 +1001,62 @@ void init_pucch2_luts() { *lut_ip1 = _mm256_insert_epi16(*lut_ip1,bit,15); } } + for (uint16_t i=0;i<16;i++) { + __m64 *lut_i=&pucch2_polar_4bit[i]; + + bit = (i&0x1) > 0 ? -1 : 1; + *lut_i = _mm_insert_pi16(*lut_i,bit,0); + bit = (i&0x2) > 0 ? -1 : 1; + *lut_i = _mm_insert_pi16(*lut_i,bit,1); + bit = (i&0x4) > 0 ? -1 : 1; + *lut_i = _mm_insert_pi16(*lut_i,bit,2); + bit = (i&0x8) > 0 ? -1 : 1; + *lut_i = _mm_insert_pi16(*lut_i,bit,3); + } + for (int i=0;i<256;i++) { + __m128i *lut_num_i=&pucch2_polar_llr_num_lut[i]; + __m128i *lut_den_i=&pucch2_polar_llr_den_lut[i]; + bit = (i&0x1) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,0); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,0); + + bit = (i&0x10) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,1); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,1); + + bit = (i&0x2) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,2); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,2); + + bit = (i&0x20) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,3); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,3); + + bit = (i&0x4) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,4); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,4); + + bit = (i&0x40) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,5); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,5); + + bit = (i&0x8) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,6); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,6); + + bit = (i&0x80) > 0 ? 0 : 1; + *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,7); + *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,7); + printf("i %d, lut_num (%d,%d,%d,%d,%d,%d,%d,%d)\n",i, + ((int16_t *)lut_num_i)[0], + ((int16_t *)lut_num_i)[1], + ((int16_t *)lut_num_i)[2], + ((int16_t *)lut_num_i)[3], + ((int16_t *)lut_num_i)[4], + ((int16_t *)lut_num_i)[5], + ((int16_t *)lut_num_i)[6], + ((int16_t *)lut_num_i)[7]); + } } @@ -1006,7 +1067,9 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); + //pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); + + AssertFatal(pucch_pdu->nr_of_symbols==1 || pucch_pdu->nr_of_symbols==2, "Illegal number of symbols for PUCCH 2 %d\n",pucch_pdu->nr_of_symbols); @@ -1014,7 +1077,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, //extract pucch and dmrs first - int l2; + int l2=pucch_pdu->start_symbol_index; int re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset; if (re_offset>= frame_parms->ofdm_symbol_size) re_offset-=frame_parms->ofdm_symbol_size; @@ -1031,6 +1094,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, int16_t r_im_ext2[Prx2][8*pucch_pdu->nr_of_symbols*pucch_pdu->prb_size] __attribute__((aligned(32))); int16_t rd_re_ext[Prx2][4*pucch_pdu->nr_of_symbols*pucch_pdu->prb_size] __attribute__((aligned(32))); int16_t rd_im_ext[Prx2][4*pucch_pdu->nr_of_symbols*pucch_pdu->prb_size] __attribute__((aligned(32))); + int16_t *r_re_ext_p,*r_im_ext_p,*rd_re_ext_p,*rd_im_ext_p; int16_t *rp[Prx2]; __m64 dmrs_re,dmrs_im; @@ -1047,156 +1111,166 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, for (int aa=0;aanr_of_symbols == 1) { - AssertFatal((pucch_pdu->prb_size&1) == 0,"prb_size %d is not a multiple of 2\n",pucch_pdu->prb_size); - // 24 PRBs contains 48x16-bit, so 6x8x16-bit - for (int prb=0;prbprb_size;prb+=2) { - for (int aa=0;aaprb_size&1) == 0,"prb_size %d is not a multiple of 2\n",pucch_pdu->prb_size); + // 24 PRBs contains 48x16-bit, so 6x8x16-bit + for (int prb=0;prbprb_size;prb+=2) { + for (int aa=0;aa (%d,%d)\n",aa,prb+(i>>2),i,rd_re_ext[aa][i],rd_im_ext[aa],i); + for (int i=0;i<8;i++) printf("Ant %d PRB %d dmrs[%d] -> (%d,%d)\n",aa,prb+(i>>2),i,rd_re_ext_p[i],rd_im_ext_p[i]); + for (int i=0;i<16;i++) printf("Ant %d PRB %d data[%d] -> (%d,%d)\n",aa,prb+(i>>3),i,r_re_ext_p[i],r_im_ext_p[i]); #endif - } // aa - } // prb + rp[aa]+=48; + } // aa + } // prb - // first compute DMRS component - uint32_t x1, x2, s=0; - x2 = (((1<<17)*((14*slot) + (pucch_pdu->start_symbol_index) + 1)*((2*pucch_pdu->dmrs_scrambling_id) + 1)) + (2*pucch_pdu->dmrs_scrambling_id))%(1U<<31); // c_init calculation according to TS38.211 subclause + // first compute DMRS component + uint32_t x1, x2, s=0; + x2 = (((1<<17)*((14*slot) + (pucch_pdu->start_symbol_index) + 1)*((2*pucch_pdu->dmrs_scrambling_id) + 1)) + (2*pucch_pdu->dmrs_scrambling_id))%(1U<<31); // c_init calculation according to TS38.211 subclause #ifdef DEBUG_NR_PUCCH_RX - printf("slot %d, start_symbol_index %d, dmrs_scrambling_id %d\n", - slot,pucch_pdu->start_symbol_index,pucch_pdu->dmrs_scrambling_id); + printf("slot %d, start_symbol_index %d, dmrs_scrambling_id %d\n", + slot,pucch_pdu->start_symbol_index,pucch_pdu->dmrs_scrambling_id); #endif - s = lte_gold_generic(&x1, &x2, 1); + s = lte_gold_generic(&x1, &x2, 1); + for (int group=0;group>=5; + corr32_im[group][aa]>>=5; #ifdef DEBUG_NR_PUCCH_RX - printf("Group %d: rd ((%d,%d),(%d,%d),(%d,%d),(%d,%d))\n", - group, - rd_re_ext[aa][4],rd_im_ext[aa][4], - rd_re_ext[aa][5],rd_im_ext[aa][5], - rd_re_ext[aa][6],rd_im_ext[aa][6], - rd_re_ext[aa][7],rd_im_ext[aa][7]); + printf("Group %d: corr32 (%d,%d)\n",group,corr32_re[group][aa],corr32_im[group][aa]); #endif - corr32_re[group][aa]+=(rd_re_ext[aa][4]*((int16_t*)&dmrs_re)[0] + rd_im_ext[aa][4]*((int16_t*)&dmrs_im)[0]); - corr32_im[group][aa]+=(-rd_re_ext[aa][4]*((int16_t*)&dmrs_im)[0] + rd_im_ext[aa][4]*((int16_t*)&dmrs_re)[0]); - corr32_re[group][aa]+=(rd_re_ext[aa][5]*((int16_t*)&dmrs_re)[1] + rd_im_ext[aa][5]*((int16_t*)&dmrs_im)[1]); - corr32_im[group][aa]+=(-rd_re_ext[aa][5]*((int16_t*)&dmrs_im)[1] + rd_im_ext[aa][5]*((int16_t*)&dmrs_re)[1]); - corr32_re[group][aa]+=(rd_re_ext[aa][6]*((int16_t*)&dmrs_re)[2] + rd_im_ext[aa][6]*((int16_t*)&dmrs_im)[2]); - corr32_im[group][aa]+=(-rd_re_ext[aa][6]*((int16_t*)&dmrs_im)[2] + rd_im_ext[aa][6]*((int16_t*)&dmrs_re)[2]); - corr32_re[group][aa]+=(rd_re_ext[aa][7]*((int16_t*)&dmrs_re)[3] + rd_im_ext[aa][7]*((int16_t*)&dmrs_im)[3]); - corr32_im[group][aa]+=(-rd_re_ext[aa][7]*((int16_t*)&dmrs_im)[3] + rd_im_ext[aa][7]*((int16_t*)&dmrs_re)[3]); - corr32_re[group][aa]>>=5; - corr32_im[group][aa]>>=5; -#ifdef DEBUG_NR_PUCCH_RX - printf("Group %d: corr32 (%d,%d)\n",group,corr32_re[group][aa],corr32_im[group][aa]); -#endif - } //aa + } //aa - if ((group&3) == 3) s = lte_gold_generic(&x1, &x2, 0); - } // group + if ((group&1) == 1) s = lte_gold_generic(&x1, &x2, 0); + } // group } else { // 2 symbol case - AssertFatal(1==0, "Fill in 2 symbol PUCCH2 case\n"); + AssertFatal(1==0, "Fill in 2 symbol PUCCH2 case\n"); } uint32_t x1, x2, s=0; @@ -1221,47 +1295,47 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, for (int aa=0;aabit_len_csi_part1 + pucch_pdu->bit_len_csi_part2 == 0,"no csi for now\n"); - AssertFatal((pucch_pdu->bit_len_harq+pucch_pdu->sr_flag > 2 ) && (pucch_pdu->bit_len_harq+pucch_pdu->sr_flag < 12),"illegal length (%d,%d)\n",pucch_pdu->bit_len_harq,pucch_pdu->sr_flag); - int nb_bit = pucch_pdu->bit_len_harq+pucch_pdu->sr_flag; - __m256i *rp_re[Prx2]; - __m256i *rp2_re[Prx2]; - __m256i *rp_im[Prx2]; - __m256i *rp2_im[Prx2]; - for (int aa=0;aa>1], - ((int16_t*)&pucch2_lut[nb_bit-3][cw<<1])[1+(i>>1)]); - } printf("\n"); #endif - // do complex correlation - for (int aa=0;aa corr) { - corr = corr_tmp; - cw_ML=cw; - } } - uint8_t corr_dB = dB_fixed64((uint64_t)corr); - LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); - uci_pdu->harq.harq_bit_len = pucch_pdu->bit_len_harq; + int nb_bit = pucch_pdu->bit_len_harq+pucch_pdu->sr_flag+pucch_pdu->bit_len_csi_part1+pucch_pdu->bit_len_csi_part2; + AssertFatal(nb_bit > 2 && nb_bit< 65,"illegal length (%d : %d,%d,%d,%d)\n",nb_bit,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,pucch_pdu->bit_len_csi_part1,pucch_pdu->bit_len_csi_part2); - - int harq_bytes=pucch_pdu->bit_len_harq>>3; - if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++; - uci_pdu->harq.harq_payload = (nfapi_nr_harq_t*)malloc(harq_bytes); - uci_pdu->harq.harq_crc = 2; - for (int i=0;iharq.harq_payload[i] = cw_ML & 255; - cw_ML>>=8; + uint64_t decodedPayload[2]; + uint8_t corr_dB; + int decoderState=2; + if (nb_bit < 12) { // short blocklength case + __m256i *rp_re[Prx2]; + __m256i *rp2_re[Prx2]; + __m256i *rp_im[Prx2]; + __m256i *rp2_im[Prx2]; + for (int aa=0;aa>1], + ((int16_t*)&pucch2_lut[nb_bit-3][cw<<1])[1+(i>>1)]); + } + printf("\n"); +#endif + // do complex correlation + for (int aa=0;aa (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",aa, + ((int16_t*)&prod_re[aa])[0],((int16_t*)&prod_re[aa])[1],((int16_t*)&prod_re[aa])[2],((int16_t*)&prod_re[aa])[3], + ((int16_t*)&prod_re[aa])[4],((int16_t*)&prod_re[aa])[5],((int16_t*)&prod_re[aa])[6],((int16_t*)&prod_re[aa])[7], + ((int16_t*)&prod_re[aa])[8],((int16_t*)&prod_re[aa])[9],((int16_t*)&prod_re[aa])[10],((int16_t*)&prod_re[aa])[11], + ((int16_t*)&prod_re[aa])[12],((int16_t*)&prod_re[aa])[13],((int16_t*)&prod_re[aa])[14],((int16_t*)&prod_re[aa])[15]); + printf("prod_im[%d] => (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",aa, + ((int16_t*)&prod_im[aa])[0],((int16_t*)&prod_im[aa])[1],((int16_t*)&prod_im[aa])[2],((int16_t*)&prod_im[aa])[3], + ((int16_t*)&prod_im[aa])[4],((int16_t*)&prod_im[aa])[5],((int16_t*)&prod_im[aa])[6],((int16_t*)&prod_im[aa])[7], + ((int16_t*)&prod_im[aa])[8],((int16_t*)&prod_im[aa])[9],((int16_t*)&prod_im[aa])[10],((int16_t*)&prod_im[aa])[11], + ((int16_t*)&prod_im[aa])[12],((int16_t*)&prod_im[aa])[13],((int16_t*)&prod_im[aa])[14],((int16_t*)&prod_im[aa])[15]); + +#endif + prod_re[aa] = _mm256_hadds_epi16(prod_re[aa],prod_re[aa]);// 0+1 + prod_im[aa] = _mm256_hadds_epi16(prod_im[aa],prod_im[aa]); + prod_re[aa] = _mm256_hadds_epi16(prod_re[aa],prod_re[aa]);// 0+1+2+3 + prod_im[aa] = _mm256_hadds_epi16(prod_im[aa],prod_im[aa]); + prod_re[aa] = _mm256_hadds_epi16(prod_re[aa],prod_re[aa]);// 0+1+2+3+4+5+6+7 + prod_im[aa] = _mm256_hadds_epi16(prod_im[aa],prod_im[aa]); + prod_re[aa] = _mm256_hadds_epi16(prod_re[aa],prod_re[aa]);// 0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15 + prod_im[aa] = _mm256_hadds_epi16(prod_im[aa],prod_im[aa]); + } + int64_t corr_re=0,corr_im=0; + + int64_t corr_tmp = 0; + for (int aa=0;aa corr) { + corr = corr_tmp; + cw_ML=cw; + } + } + corr_dB = dB_fixed64((uint64_t)corr); + LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); + decodedPayload[0]=(uint64_t)cw_ML; + } + else { // polar coded case + + t_nrPolar_params *currentPtr = nr_polar_params(2,nb_bit,pucch_pdu->prb_size,1,&gNB->uci_polarParams); + __m64 *rp_re[Prx2]; + __m64 *rp2_re[Prx2]; + __m64 *rp_im[Prx2]; + __m64 *rp2_im[Prx2]; + __m128i llrs[pucch_pdu->prb_size*2]; + + for (int aa=0;aa>1]); + } + printf("\n"); + } +#endif + + // non-coherent LLR computation on groups of 4 REs (half-PRBs) + int32_t corr_re,corr_im,corr_tmp; + __m128i corr16,llr_num,llr_den; + uint64_t corr = 0; + + for (int half_prb=0;half_prb<(2*pucch_pdu->prb_size);half_prb++) { + llr_num=_mm_set1_epi16(0);llr_den=_mm_set1_epi16(0); + for (int cw=0;cw<256;cw++) { + corr_tmp=0; + for (int aa=0;aa>4],rp_im[aa][half_prb])),5); + prod_im[aa] = _mm_srai_pi16(_mm_subs_pi16(_mm_mullo_pi16(pucch2_polar_4bit[cw&15],rp2_im[aa][half_prb]), + _mm_mullo_pi16(pucch2_polar_4bit[cw>>4],rp2_re[aa][half_prb])),5); + prod_re[aa] = _mm_hadds_pi16(prod_re[aa],prod_re[aa]);// 0+1 + prod_im[aa] = _mm_hadds_pi16(prod_im[aa],prod_im[aa]); + prod_re[aa] = _mm_hadds_pi16(prod_re[aa],prod_re[aa]);// 0+1+2+3 + prod_im[aa] = _mm_hadds_pi16(prod_im[aa],prod_im[aa]); + + // this is for UL CQI measurement + if (cw==0) corr += ((int64_t)corr32_re[half_prb>>2][aa]*corr32_re[half_prb>>2][aa])+ + ((int64_t)corr32_im[half_prb>>2][aa]*corr32_im[half_prb>>2][aa]); + + + corr_re = ( corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]); + corr_im = ( corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]); + corr_tmp += corr_re*corr_re + corr_im*corr_im; + /* + LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n", + half_prb,cw,cw&15,cw>>4,aa, + ((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0], + ((int16_t*)&pucch2_polar_4bit[cw&15])[1],((int16_t*)&pucch2_polar_4bit[cw>>4])[1], + ((int16_t*)&pucch2_polar_4bit[cw&15])[2],((int16_t*)&pucch2_polar_4bit[cw>>4])[2], + ((int16_t*)&pucch2_polar_4bit[cw&15])[3],((int16_t*)&pucch2_polar_4bit[cw>>4])[3], + ((int16_t*)&rp_re[aa][half_prb])[0],((int16_t*)&rp_im[aa][half_prb])[0], + ((int16_t*)&rp_re[aa][half_prb])[1],((int16_t*)&rp_im[aa][half_prb])[1], + ((int16_t*)&rp_re[aa][half_prb])[2],((int16_t*)&rp_im[aa][half_prb])[2], + ((int16_t*)&rp_re[aa][half_prb])[3],((int16_t*)&rp_im[aa][half_prb])[3], + corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2),corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2), + ((int16_t*)(&prod_re[aa]))[0], + ((int16_t*)(&prod_im[aa]))[0], + corr_re, + corr_im, + corr_tmp); + */ + } + corr16 = _mm_set1_epi16((int16_t)(corr_tmp>>8)); + /* + LOG_D(PHY,"half_prb %d cw %d corr16 %d\n",half_prb,cw,corr_tmp>>8); + */ + llr_num = _mm_max_epi16(_mm_mullo_epi16(corr16,pucch2_polar_llr_num_lut[cw]),llr_num); + llr_den = _mm_max_epi16(_mm_mullo_epi16(corr16,pucch2_polar_llr_den_lut[cw]),llr_den); + /* + LOG_D(PHY,"lut_num (%d,%d,%d,%d,%d,%d,%d,%d)\n", + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[0], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[1], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[2], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[3], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[4], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[5], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[6], + ((int16_t*)&pucch2_polar_llr_num_lut[cw])[7]); + + LOG_D(PHY,"llr_num (%d,%d,%d,%d,%d,%d,%d,%d)\n", + ((int16_t*)&llr_num)[0], + ((int16_t*)&llr_num)[1], + ((int16_t*)&llr_num)[2], + ((int16_t*)&llr_num)[3], + ((int16_t*)&llr_num)[4], + ((int16_t*)&llr_num)[5], + ((int16_t*)&llr_num)[6], + ((int16_t*)&llr_num)[7]); + LOG_D(PHY,"llr_den (%d,%d,%d,%d,%d,%d,%d,%d)\n", + ((int16_t*)&llr_den)[0], + ((int16_t*)&llr_den)[1], + ((int16_t*)&llr_den)[2], + ((int16_t*)&llr_den)[3], + ((int16_t*)&llr_den)[4], + ((int16_t*)&llr_den)[5], + ((int16_t*)&llr_den)[6], + ((int16_t*)&llr_den)[7]); + */ + } + // compute llrs + llrs[half_prb] = _mm_subs_epi16(llr_num,llr_den); + LOG_D(PHY,"llrs[%d] : (%d,%d,%d,%d,%d,%d,%d,%d)\n", + half_prb, + ((int16_t*)&llrs[half_prb])[0], + ((int16_t*)&llrs[half_prb])[1], + ((int16_t*)&llrs[half_prb])[2], + ((int16_t*)&llrs[half_prb])[3], + ((int16_t*)&llrs[half_prb])[4], + ((int16_t*)&llrs[half_prb])[5], + ((int16_t*)&llrs[half_prb])[6], + ((int16_t*)&llrs[half_prb])[7]); + } // half_prb + // run polar decoder on llrs + decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, currentPtr); + LOG_D(PHY,"UCI decoderState %d, payload[0] %llux\n",decoderState,(unsigned long long)decodedPayload[0]); + if (decoderState>0) decoderState=1; + corr_dB = dB_fixed64(corr); + LOG_D(PHY,"metric %d dB\n",corr_dB); + } + uci_pdu->harq.harq_bit_len = pucch_pdu->bit_len_harq; + uci_pdu->pduBitmap=0; + uci_pdu->rnti=pucch_pdu->rnti; + uci_pdu->handle=pucch_pdu->handle; + uci_pdu->pucch_format=0; + uci_pdu->ul_cqi=corr_dB; + // need to fill these field! + uci_pdu->timing_advance=31; + uci_pdu->rssi=0; + if (pucch_pdu->bit_len_harq>0) { + int harq_bytes=pucch_pdu->bit_len_harq>>3; + if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++; + uci_pdu->pduBitmap|=1; + uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes); + uci_pdu->harq.harq_crc = decoderState > 0 ? 1 : 0; + int i=0; + for (;iharq.harq_payload[i] = decodedPayload[0] & 255; + decodedPayload[0]>>=8; + } + uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<<(pucch_pdu->bit_len_harq&7))-1); + decodedPayload[0] >>= pucch_pdu->bit_len_harq; } if (pucch_pdu->sr_flag == 1) { + uci_pdu->pduBitmap|=2; uci_pdu->sr.sr_bit_len = 1; uci_pdu->sr.sr_payload = malloc(1); - uci_pdu->sr.sr_payload[0] = cw_ML; + uci_pdu->sr.sr_payload[0] = decodedPayload[0]&1; + decodedPayload[0] = decodedPayload[0]>>1; } + // csi + if (pucch_pdu->bit_len_csi_part1>0) { + uci_pdu->pduBitmap|=4; + int csi_part1_bytes=pucch_pdu->bit_len_csi_part1>>3; + if ((pucch_pdu->bit_len_csi_part1&7) > 0) csi_part1_bytes++; + uci_pdu->csi_part1.csi_part1_payload = (uint8_t*)malloc(csi_part1_bytes); + uci_pdu->csi_part1.csi_part1_crc = decoderState > 0 ? 1 : 0; + int i=0; + for (;icsi_part1.csi_part1_payload[i] = decodedPayload[0] & 255; + decodedPayload[0]>>=8; + } + uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<(pucch_pdu->bit_len_csi_part1&7))-1); + decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1; + } + + if (pucch_pdu->bit_len_csi_part2>0) { + uci_pdu->pduBitmap|=8; + } + } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index d140442523..b49443c03c 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -35,6 +35,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, PHY_VARS_NR_UE *ue, module_id_t gNB_id, + uint8_t frame, uint8_t subframe, unsigned char clear, short coef) @@ -104,6 +105,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, //mac_resynch(); //dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id); ue->UE_mode[0] = PRACH; + ue->prach_resources[gNB_id]->sync_frame = frame; + ue->prach_resources[gNB_id]->init_msg1 = 0; } else { ue->UE_mode[0] = PUSCH; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 19564bd8d0..71a5771f5b 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -618,7 +618,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PDCCH - printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fr, diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 6326ed9446..1837664391 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -75,6 +75,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, PHY_VARS_NR_UE *ue, module_id_t eNB_id, + uint8_t frame, uint8_t subframe, unsigned char clear, short coef); diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 8a86192557..7cde6e31c1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -29,11 +29,15 @@ * \note * \warning */ + #ifdef USER_MODE #include #include #include #endif + +#include "executables/softmodem-common.h" + #include "nr_transport_proto_ue.h" #include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h" #include "PHY/phy_extern_nr_ue.h" @@ -799,22 +803,22 @@ void pdcch_scrambling(NR_DL_FRAME_PARMS *frame_parms, #ifdef NR_PDCCH_DCI_RUN -void nr_pdcch_unscrambling(uint16_t crnti, NR_DL_FRAME_PARMS *frame_parms, uint8_t slot, - int16_t *z, int16_t *z2,uint32_t length, uint16_t pdcch_DMRS_scrambling_id) { +void nr_pdcch_unscrambling(int16_t *z, + uint16_t scrambling_RNTI, + uint32_t length, + uint16_t pdcch_DMRS_scrambling_id, + int16_t *z2) { int i; uint8_t reset; uint32_t x1, x2, s = 0; uint16_t n_id; //{0,1,...,65535} - uint32_t n_rnti; + uint32_t rnti = (uint32_t) scrambling_RNTI; reset = 1; // x1 is set in first call to lte_gold_generic - //do_common=1; - n_id = pdcch_DMRS_scrambling_id; - n_rnti = (uint32_t)crnti; + n_id = pdcch_DMRS_scrambling_id; + x2 = ((rnti<<16) + n_id); //mod 2^31 is implicit //this is c_init in 38.211 v15.1.0 Section 7.3.2.3 - x2 = (((1<<16)*n_rnti)+n_id); //mod 2^31 is implicit //this is c_init in 38.211 v15.1.0 Section 7.3.2.3 - - LOG_D(PHY,"PDCCH Unscrambling x2 %x : n_RNTI %x\n",x2,n_rnti); + LOG_D(PHY,"PDCCH Unscrambling x2 %x : scrambling_RNTI %x\n", x2, rnti); for (i = 0; i < length; i++) { if ((i & 0x1f) == 0) { @@ -842,38 +846,48 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, rel15 = &pdcch_vars->pdcch_config[i]; int dci_length = rel15->dci_length; + //int gNB_id = 0; int16_t tmp_e[16*108]; + rnti_t n_rnti; for (int j=0;jnumber_of_candidates;j++) { - LOG_D(PHY,"Trying DCI candidate %d, CCE %d (%d), L %d\n",j,rel15->CCE[j],rel15->CCE[j]*9*6*2,rel15->L[j]); int CCEind = rel15->CCE[j]; int L = rel15->L[j]; uint64_t dci_estimation[2]= {0}; - const t_nrPolar_params *currentPtrDCI=nr_polar_params(1, dci_length, L,1,&ue->polarList); + const t_nrPolar_params *currentPtrDCI = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L, 1, &ue->polarList); - nr_pdcch_unscrambling(rel15->coreset.scrambling_rnti, - &ue->frame_parms, - slot, - &pdcch_vars->e_rx[CCEind*108], - tmp_e, - L*108, - // get_nCCE(n_pdcch_symbols, frame_parms, mi) * 72, - rel15->coreset.pdcch_dmrs_scrambling_id); + LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d\n", j, rel15->number_of_candidates, CCEind, CCEind*9*6*2, L); + + nr_pdcch_unscrambling(&pdcch_vars->e_rx[CCEind*108], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); + + #ifdef DEBUG_DCI_DECODING + uint32_t * z = (uint32_t *) &pdcch_vars->e_rx[CCEind*108]; + for (int index_z = 0; index_z < 96; index_z++){ + for (int i=0; i<9; i++) { + LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); + } + } + #endif uint16_t crc = polar_decoder_int16(tmp_e, dci_estimation, 1, currentPtrDCI); - LOG_D(PHY,"Decoded crc %x\n",crc); - if (crc == rel15->rnti) { + + n_rnti = rel15->rnti; + + if (crc == n_rnti) { + LOG_D(PHY,"Decoded crc %x matches rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format); dci_ind->SFN = frame; dci_ind->slot = slot; - dci_ind->dci_list[dci_ind->number_of_dcis].rnti = rel15->rnti; + dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind; dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format; dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->number_of_dcis++; + } else { + LOG_D(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format); } } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.h b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.h index 95b6cfd2e2..5f1321dd32 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.h @@ -29,6 +29,10 @@ * \note * \warning */ + +#ifndef __PHY_NR_UE_TRANSPORT_DCI_NR__H__ +#define __PHY_NR_UE_TRANSPORT_DCI_NR__H__ + #ifndef USER_MODE #include "PHY/types.h" #else @@ -118,4 +122,5 @@ typedef struct NR_DCI_INFO_EXTRACTED NR_DCI_INFO_EXTRACTED_t; #endif +#endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 5c2221805f..1a6006c3ba 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -43,6 +43,7 @@ #include "SIMULATION/TOOLS/sim.h" #include "executables/nr-uesoftmodem.h" #include "PHY/CODING/nrLDPC_extern.h" +#include "LAYER2/NR_MAC_gNB/mac_proto.h" //#define DEBUG_DLSCH_DECODING //#define ENABLE_PHY_PAYLOAD_DEBUG 1 @@ -266,7 +267,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, uint8_t dmrs_Type = harq_process->dmrsConfigType; AssertFatal(dmrs_Type == 1 || dmrs_Type == 2,"Illegal dmrs_type %d\n",dmrs_Type); - uint8_t nb_re_dmrs = 12;//(dmrs_Type==1)?6:4; + uint8_t nb_re_dmrs = (dmrs_Type==1)?6:4; // should be changed based on MAC parameters uint16_t dmrs_length = get_num_dmrs(harq_process->dlDmrsSymbPos); AssertFatal(dmrs_length == 1 || dmrs_length == 2,"Illegal dmrs_length %d\n",dmrs_length); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 43545bada2..7f941e5567 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -30,6 +30,7 @@ */ #include "PHY/defs_nr_UE.h" #include "PHY/phy_extern_nr_ue.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "nr_transport_proto_ue.h" //#include "SCHED/defs.h" //#include "PHY/defs.h" @@ -131,7 +132,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, unsigned short nb_rb = 0, round; int avgs = 0;// rb; - NR_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; + NR_DL_UE_HARQ_t *dlsch0_harq, *dlsch1_harq = NULL; uint8_t beamforming_mode; @@ -156,82 +157,90 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, int32_t median[16]; uint32_t len; - switch (type) { case SI_PDSCH: pdsch_vars = ue->pdsch_vars_SI; dlsch = &ue->dlsch_SI[eNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; - beamforming_mode = 0; + beamforming_mode = 0; break; case RA_PDSCH: pdsch_vars = ue->pdsch_vars_ra; dlsch = &ue->dlsch_ra[eNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; - beamforming_mode = 0; + beamforming_mode = 0; + break; case PDSCH: pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]]; dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id]; - dlsch[0]->harq_processes[harq_pid]->Qm = nr_get_Qm_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table); - dlsch[0]->harq_processes[harq_pid]->R = nr_get_code_rate_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table); - + beamforming_mode = ue->transmission_mode[eNB_id] < 7 ? 0 :ue->transmission_mode[eNB_id]; + + dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; + dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; + //printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status); - LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", - frame,nr_tti_rx,symbol,harq_pid, - dlsch[0]->harq_processes[harq_pid]->status, - dlsch[1]->harq_processes[harq_pid]->status); - - if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) && - (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE)){ - codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword; - codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword; + LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", frame, nr_tti_rx, symbol, harq_pid, dlsch0_harq->status, dlsch1_harq->status); + + if ((dlsch0_harq->status == ACTIVE) && (dlsch1_harq->status == ACTIVE)){ + codeword_TB0 = dlsch0_harq->codeword; + codeword_TB1 = dlsch1_harq->codeword; dlsch0_harq = dlsch[codeword_TB0]->harq_processes[harq_pid]; dlsch1_harq = dlsch[codeword_TB1]->harq_processes[harq_pid]; -#ifdef DEBUG_HARQ - printf("[DEMOD] I am assuming both TBs are active\n"); -#endif - } - else if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) && - (dlsch[1]->harq_processes[harq_pid]->status != ACTIVE) ) { - codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword; + + #ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming both TBs are active\n"); + #endif + + } else if ((dlsch0_harq->status == ACTIVE) && (dlsch1_harq->status != ACTIVE) ) { + codeword_TB0 = dlsch0_harq->codeword; + codeword_TB1 = -1; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch1_harq = NULL; - codeword_TB1 = -1; -#ifdef DEBUG_HARQ - printf("[DEMOD] I am assuming only TB0 is active\n"); -#endif - } - else if ((dlsch[0]->harq_processes[harq_pid]->status != ACTIVE) && - (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE) ){ - codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword; - dlsch0_harq = dlsch[1]->harq_processes[harq_pid]; - dlsch1_harq = NULL; + + #ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming only TB0 is active\n"); + #endif + + } else if ((dlsch0_harq->status != ACTIVE) && (dlsch1_harq->status == ACTIVE)){ codeword_TB0 = -1; -#ifdef DEBUG_HARQ - printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch0_harq->codeword); -#endif - } - else { - LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n",nr_tti_rx); + codeword_TB1 = dlsch1_harq->codeword; + dlsch0_harq = NULL; + dlsch1_harq = dlsch[1]->harq_processes[codeword_TB1]; + + #ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch1_harq->codeword); + #endif + + AssertFatal(1 == 0, "[UE][FATAL] DLSCH: TB0 not active and TB1 active case is not supported\n"); + + } else { + LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n", nr_tti_rx); return(-1); } - beamforming_mode = ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]; - break; - - default: - AssertFatal(1==0,"[UE][FATAL] nr_tti_rx %d: Unknown PDSCH format %d\n",nr_tti_rx,type); - return(-1); - break; + + break; + + default: + AssertFatal(1 == 0, "[UE][FATAL] nr_tti_rx %d: Unknown PDSCH format %d\n", nr_tti_rx, type); + return(-1); + break; + } -#ifdef DEBUG_HARQ - printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode); - printf("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1); -#endif - + if (dlsch0_harq == NULL) + AssertFatal(1 == 0, "Done\n"); + + dlsch0_harq->Qm = nr_get_Qm_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table); + dlsch0_harq->R = nr_get_code_rate_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table); + + #ifdef DEBUG_HARQ + printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode); + printf("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1); + #endif + start_rb = dlsch0_harq->start_rb; nb_rb_pdsch = dlsch0_harq->nb_rb; @@ -269,7 +278,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, return(-1); } - if (dlsch0_harq->mimo_mode==NR_DUALSTREAM) { DevAssert(dlsch1_harq); } @@ -964,45 +972,46 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, return(-1); break; } + if (dlsch1_harq) { - switch (nr_get_Qm_dl(dlsch1_harq->mcs,dlsch1_harq->mcs_table)) { - case 2 : - if (rx_type==rx_standard) { - nr_dlsch_qpsk_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pllr_symbol_cw0, - symbol,len,first_symbol_flag,nb_rb, - beamforming_mode); + switch (nr_get_Qm_dl(dlsch1_harq->mcs,dlsch1_harq->mcs_table)) { + case 2 : + if (rx_type==rx_standard) { + nr_dlsch_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pllr_symbol_cw0, + symbol,len,first_symbol_flag,nb_rb, + beamforming_mode); + } + break; + case 4: + if (rx_type==rx_standard) { + nr_dlsch_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->llr[0], + pdsch_vars[eNB_id]->dl_ch_mag0, + symbol,len,first_symbol_flag,nb_rb, + pdsch_vars[eNB_id]->llr128, + beamforming_mode); + } + break; + case 6 : + if (rx_type==rx_standard) { + nr_dlsch_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pllr_symbol_cw0, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + symbol,len,first_symbol_flag,nb_rb, + pdsch_vars[eNB_id]->llr_offset[symbol], + beamforming_mode); + } + break; + default: + LOG_W(PHY,"rx_dlsch.c : Unknown mod_order!!!!\n"); + return(-1); + break; } - break; - case 4: - if (rx_type==rx_standard) { - nr_dlsch_16qam_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pdsch_vars[eNB_id]->llr[0], - pdsch_vars[eNB_id]->dl_ch_mag0, - symbol,len,first_symbol_flag,nb_rb, - pdsch_vars[eNB_id]->llr128, - beamforming_mode); - } - break; - case 6 : - if (rx_type==rx_standard) { - nr_dlsch_64qam_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pllr_symbol_cw0, - pdsch_vars[eNB_id]->dl_ch_mag0, - pdsch_vars[eNB_id]->dl_ch_magb0, - symbol,len,first_symbol_flag,nb_rb, - pdsch_vars[eNB_id]->llr_offset[symbol], - beamforming_mode); - } - break; - default: - LOG_W(PHY,"rx_dlsch.c : Unknown mod_order!!!!\n"); - return(-1); - break; - } } //nr_dlsch_deinterleaving(symbol,bundle_L,(int16_t*)pllr_symbol_cw0,(int16_t*)pllr_symbol_cw0_deint, nb_rb_pdsch); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 61748a8e56..cee9a45fac 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -135,7 +135,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini stop_meas(&ue->dlsch_channel_estimation_stats); #endif - current_ssb->metric = current_ssb->c_re*current_ssb->c_re + current_ssb->c_im+current_ssb->c_re; + current_ssb->metric = current_ssb->c_re*current_ssb->c_re + current_ssb->c_im*current_ssb->c_im; // generate a list of SSB structures if (best_ssb == NULL) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 60306d8e53..612dc6283d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -505,7 +505,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, return(-1); } */ - if (symbol==1) { + if (symbol==2) { nr_pbch_quantize(pbch_e_rx, (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]), 144); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 82af0b88e5..79c542cd61 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -35,15 +35,14 @@ #include "PHY/impl_defs_nr.h" #include "PHY/defs_nr_UE.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "T.h" -#include -#define NR_PRACH_DEBUG 1 +//#define NR_PRACH_DEBUG 1 extern uint16_t NCS_unrestricted_delta_f_RA_125[16]; extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15]; @@ -81,7 +80,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx; int16_t prach_tmp[98304*2*4] __attribute__((aligned(32))); - int16_t Ncp, amp, *prach, *prach2, *prachF, *Xu; + int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; int32_t Xu_re, Xu_im, samp_count; int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k; //int restricted_Type; @@ -125,7 +124,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ prach_start = slot*samp_count - ue->N_TA_offset; #endif - if (prach_start<0) prach_start += (fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index d20457de06..bde9ae03f1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -37,6 +37,9 @@ #include #include "nfapi_interface.h" +#define NR_PUSCH_x 2 // UCI placeholder bit TS 38.212 V15.4.0 subclause 5.3.3.1 +#define NR_PUSCH_y 3 // UCI placeholder bit + // Functions below implement 36-211 and 36-212 /** @addtogroup _PHY_TRANSPORT_ @@ -66,24 +69,6 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch,unsigned char N_RB_UL); NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag); -void fill_UE_dlsch_MCH(PHY_VARS_NR_UE *ue,int mcs,int ndi,int rvidx,int eNB_id); - -int rx_pmch(PHY_VARS_NR_UE *phy_vars_ue, - unsigned char eNB_id, - uint8_t subframe, - unsigned char symbol); - -/** \brief Dump OCTAVE/MATLAB files for PMCH debugging - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param coded_bits_per_codeword G from 36.211 - @param subframe Index of subframe - @returns 0 on success -*/ -void dump_mch(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe); - - - /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. @param stream0_in Input from channel compensated (MR combined) stream 0 @param stream1_in Input from channel compensated (MR combined) stream 1 @@ -1053,7 +1038,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid); + uint8_t harq_pid, + unsigned int G); /*! \brief Perform PUSCH scrambling. TS 38.211 V15.4.0 subclause 6.3.1.1 @param[in] in, Pointer to input bits @@ -1401,8 +1387,10 @@ void ulsch_modulation(int32_t **txdataF, NR_UE_ULSCH_t *ulsch); - - +uint8_t allowed_ulsch_re_in_dmrs_symbol(uint16_t k, + uint16_t start_sc, + uint8_t numDmrsCdmGrpsNoData, + uint8_t dmrs_type); int generate_ue_dlsch_params_from_dci(int frame, @@ -1539,11 +1527,11 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,NR_DL_FRAME void pdcch_interleaving(NR_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi); -void nr_pdcch_unscrambling(uint16_t crnti, NR_DL_FRAME_PARMS *frame_parms, uint8_t slot, - int16_t *z, int16_t *z2,uint32_t length, uint16_t pdcch_DMRS_scrambling_id); - - - +void nr_pdcch_unscrambling(int16_t *z, + uint16_t scrambling_RNTI, + uint32_t length, + uint16_t pdcch_DMRS_scrambling_id, + int16_t *z2); void dlsch_unscrambling(NR_DL_FRAME_PARMS *frame_parms, int mbsfn_flag, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 643e70c442..6b2d5e7255 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -42,7 +42,8 @@ #include "UTIL/LISTS/list.h" #endif -//#include "../LTE_TRANSPORT/transport_common.h" +#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" + // structures below implement 36-211 and 36-212 @@ -84,40 +85,26 @@ typedef struct { #endif typedef struct { + /// NDAPI struct for UE + nfapi_nr_ue_pusch_pdu_t pusch_pdu; /// Indicator of first transmission uint8_t first_tx; - /// Last Ndi received for this process on DCI (used for C-RNTI only) - uint8_t DCINdi; /// HARQ tx status harq_result_t tx_status; - /// Flag indicating that this ULSCH has a new packet (start of new round) - // uint8_t Ndi; /// Status Flag indicating for this ULSCH (idle,active,disabled) SCH_status_t status; /// Subframe scheduling indicator (i.e. Transmission opportunity indicator) uint8_t subframe_scheduling_flag; /// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator) uint8_t subframe_cba_scheduling_flag; - /// First Allocated RB - uint16_t first_rb; - /// Current Number of RBs - uint16_t nb_rb; - /// number of layers - uint8_t Nl; /// Last TPC command uint8_t TPC; - /// Transport block size - uint32_t TBS; /// The payload + CRC size in bits, "B" from 36-212 uint32_t B; /// Length of ACK information (bits) uint8_t O_ACK; /// Index of current HARQ round for this ULSCH uint8_t round; - /// MCS format of this ULSCH - uint8_t mcs; - /// Redundancy-version of the current sub-frame - uint8_t rvidx; /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8) unsigned char *a; /// Pointer to the payload + CRC @@ -150,19 +137,11 @@ typedef struct { uint32_t G; // Number of modulated symbols carrying data uint32_t num_of_mod_symbols; - // This is "L" in TS 38.214 V15.4.0 subclause 6.1.2.1 - uint8_t number_of_symbols; - // This is "S" in TS 38.214 V15.4.0 subclause 6.1.2.1 - uint8_t start_symbol; // decode phich uint8_t decode_phich; } NR_UL_UE_HARQ_t; typedef struct { - /// number of DMRS resource elements - uint8_t nb_re_dmrs; - /// DMRS length - uint8_t length_dmrs; /// SRS active flag uint8_t srs_active; //#if defined(UPGRADE_RAT_NR) @@ -224,8 +203,6 @@ typedef struct { uint8_t power_offset; // for cooperative communication uint8_t cooperation_flag; - /// RNTI attributed to this ULSCH - uint16_t rnti; /// RNTI type uint8_t rnti_type; /// Cell ID diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 5cc8a2b6aa..a9f2305b05 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -216,15 +216,15 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, NR_DL_FRAME_PARMS* frame_parms, - uint8_t harq_pid) + uint8_t harq_pid, + unsigned int G) { /////////////////////////parameters and variables declaration///////////////////////// /////////// - unsigned int G,crc; + unsigned int crc; NR_UL_UE_HARQ_t *harq_process; uint16_t nb_rb ; - uint8_t nb_symb_sch ; uint32_t A, Z, F; uint32_t *pz; uint8_t mod_order; @@ -234,8 +234,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, uint32_t E,Kb; uint8_t Ilbrm; uint32_t Tbslbrm; - uint8_t nb_re_dmrs; - uint16_t length_dmrs; uint16_t R; float Coderate; @@ -248,20 +246,17 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, crc = 1; harq_process = ulsch->harq_processes[harq_pid]; - nb_rb = harq_process->nb_rb; - nb_symb_sch = harq_process->number_of_symbols; - A = harq_process->TBS; + nb_rb = harq_process->pusch_pdu.rb_size; + A = harq_process->pusch_pdu.pusch_data.tb_size; pz = &Z; - mod_order = nr_get_Qm_ul(harq_process->mcs,0); - R = nr_get_code_rate_ul(harq_process->mcs, 0); + mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); Kr=0; r_offset=0; BG = 1; F=0; Ilbrm = 0; Tbslbrm = 950984; //max tbs - nb_re_dmrs = ulsch->nb_re_dmrs; - length_dmrs = ulsch->length_dmrs; Coderate = 0.0; /////////// @@ -270,10 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); - LOG_D(PHY,"ulsch coding nb_rb %d nb_symb_sch %d nb_re_dmrs %d, length_dmrs %d, harq_process->Nl = %d\n", nb_rb,nb_symb_sch, nb_re_dmrs,length_dmrs, harq_process->Nl); - - - G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,harq_process->Nl); + LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); // if (harq_process->Ndi == 1) { // this is a new packet @@ -433,15 +425,15 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, //start_meas(rm_stats); #ifdef DEBUG_DLSCH_CODING - printf("rvidx in encoding = %d\n", harq_process->rvidx); + printf("rvidx in encoding = %d\n", harq_process->pusch_pdu.pusch_data.rv_index); #endif ///////////////////////// d---->| Rate matching bit selection |---->e ///////////////////////// /////////// - E = nr_get_E(G, harq_process->C, mod_order, harq_process->Nl, r); + E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); - Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->Nl,harq_process->C); + Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers,harq_process->C); nr_rate_matching_ldpc(Ilbrm, Tbslbrm, @@ -452,7 +444,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, harq_process->C, F, Kr-F-2*(*pz), - harq_process->rvidx, + harq_process->pusch_pdu.pusch_data.rv_index, E); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 2df38e754b..887a3b8a9e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -98,7 +98,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t thread_id, int gNB_id) { - uint32_t available_bits; + uint32_t available_bits, TBS; uint8_t mod_order, cwd_index, num_of_codewords, l; uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; uint32_t ***pusch_dmrs; @@ -106,11 +106,11 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int32_t **txdataF; uint16_t start_sc, start_rb; int8_t Wf[2], Wt[2], l_prime[2], delta; - uint16_t n_dmrs, code_rate, number_dmrs_symbols, k; - uint8_t dmrs_type; + uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k; + uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl; int ap, start_symbol, Nid_cell, i; int sample_offsetF, N_RE_prime, N_PRB_oh; - uint16_t n_rnti; + uint16_t ul_dmrs_symb_pos; uint8_t data_existing =0; uint8_t L_ptrs, K_ptrs; // PTRS parameters uint16_t beta_ptrs; // PTRS parameter related to power control @@ -120,58 +120,54 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id]; uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES]; - ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; + // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; num_of_codewords = 1; // tmp assumption - n_rnti = 0x1234; Nid_cell = 0; N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig number_dmrs_symbols = 0; - uint8_t mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; - for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) { ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index]; harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; - start_symbol = harq_process_ul_ue->start_symbol; + start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index; + ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos; + number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols; + dmrs_type = harq_process_ul_ue->pusch_pdu.dmrs_config_type; - for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) - number_dmrs_symbols += is_dmrs_symbol((mapping_type)?i-start_symbol:i, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size); + for (i = start_symbol; i < start_symbol + number_of_symbols; i++) { + if((ul_dmrs_symb_pos >> i) & 0x01) + number_dmrs_symbols += 1; - ulsch_ue->length_dmrs = number_dmrs_symbols; // pusch.MaxLenght is redundant here as number_dmrs_symbols - // contains all dmrs symbols even for double symbol dmrs - ulsch_ue->rnti = n_rnti; + } + + rnti = harq_process_ul_ue->pusch_pdu.rnti; ulsch_ue->Nid_cell = Nid_cell; - ulsch_ue->nb_re_dmrs = 12; //FIXME temprary for no data in dmrs symbol -//((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; - N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*number_dmrs_symbols - N_PRB_oh; + nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data; - harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords; + N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; - mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0); - code_rate = nr_get_code_rate_ul(harq_process_ul_ue->mcs, 0); + nb_rb = harq_process_ul_ue->pusch_pdu.rb_size; - harq_process_ul_ue->TBS = nr_compute_tbs(mod_order, + harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords; + + mcs = harq_process_ul_ue->pusch_pdu.mcs_index; + Nl = harq_process_ul_ue->pusch_pdu.nrOfLayers; + mod_order = nr_get_Qm_ul(mcs, 0); + code_rate = nr_get_code_rate_ul(mcs, 0); + + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = nr_compute_tbs(mod_order, code_rate, - harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, - ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs, + nb_rb, + number_of_symbols, + nb_dmrs_re_per_rb*number_dmrs_symbols, 0, 0, - harq_process_ul_ue->Nl); - + harq_process_ul_ue->pusch_pdu.nrOfLayers); uint8_t access_mode = SCHEDULED_ACCESS; @@ -179,14 +175,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, // to be removed later when MAC is ready if (harq_process_ul_ue != NULL){ + TBS = harq_process_ul_ue->pusch_pdu.pusch_data.tb_size; data_existing = 0; + if (IS_SOFTMODEM_NOS1){ data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame, - slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode); + slot, 0, ulsch_input_buffer, TBS/8, &access_mode); //IP traffic to be transmitted if(data_existing){ //harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char)); - memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8); + memcpy(harq_process_ul_ue->a, ulsch_input_buffer, TBS/8); } } //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity @@ -198,20 +196,20 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should //have a valid LCID (nr_process_mac_pdu function) - harq_process_ul_ue->a[0] = 0x31; + harq_process_ul_ue->a[0] = 0x31; - for (i = 1; i < harq_process_ul_ue->TBS / 8; i++) { + for (i = 1; i < TBS / 8; i++) { harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); } } - #ifdef DEBUG_MAC_PDU - LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8); - for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { +#ifdef DEBUG_MAC_PDU + LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", TBS/8); + for (i = 0; i < TBS / 8; i++) { printf("%02x",harq_process_ul_ue->a[i]); } printf("\n"); - #endif +#endif } else { LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); return; @@ -222,8 +220,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH coding///////////////////////// /////////// - - nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid); + unsigned int G = nr_get_G(nb_rb, number_of_symbols, + nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); + nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); /////////// //////////////////////////////////////////////////////////////////// @@ -231,21 +230,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH scrambling///////////////////////// /////////// - mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0); - - available_bits = nr_get_G(harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, - ulsch_ue->nb_re_dmrs, - ulsch_ue->length_dmrs, - mod_order, - 1); + available_bits = G; memset(scrambled_output[cwd_index], 0, ((available_bits>>5)+1)*sizeof(uint32_t)); nr_pusch_codeword_scrambling(ulsch_ue->g, available_bits, ulsch_ue->Nid_cell, - ulsch_ue->rnti, + rnti, scrambled_output[cwd_index]); // assume one codeword for the moment @@ -272,11 +264,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////DMRS Modulation///////////////////////// /////////// - ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; //FIXME temprary here for no data in dmrs symbol pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; - n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs); + n_dmrs = (nb_rb*((dmrs_type == pusch_dmrs_type1) ? 6:4)*number_dmrs_symbols); int16_t mod_dmrs[n_dmrs<<1]; - dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type; /////////// //////////////////////////////////////////////////////////////////////// @@ -284,26 +274,23 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////PTRS parameters' initialization///////////////////////// /////////// - int16_t mod_ptrs[(harq_process_ul_ue->nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation + int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation K_ptrs = 0; // just to avoid a warning - if (UE->ptrs_configured == 1) { + if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { - K_ptrs = get_K_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->nb_rb); - - L_ptrs = get_L_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->mcs); + K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2; + L_ptrs = 1<pusch_pdu.pusch_ptrs.ptrs_time_density; beta_ptrs = 1; // temp value until power control is implemented ulsch_ue->ptrs_symbols = 0; set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols, - harq_process_ul_ue->number_of_symbols, + number_of_symbols, start_symbol, - dmrs_type, L_ptrs, - ulsch_ue->length_dmrs, - frame_parms->ofdm_symbol_size); + ul_dmrs_symb_pos); } /////////// @@ -315,7 +302,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, tx_layers = (int16_t **)pusch_ue->txdataF_layers; nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id], - harq_process_ul_ue->Nl, + Nl, available_bits/mod_order, tx_layers); @@ -332,24 +319,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint32_t nb_re_pusch, nb_re_dmrs_per_rb; uint32_t y_offset = 0; - for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) { + for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { + + if((ul_dmrs_symb_pos >> l) & 0x01) + is_dmrs = 1; + else + is_dmrs = 0; - is_dmrs = is_dmrs_symbol((mapping_type)?l-start_symbol:l, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); - if (is_dmrs == 1) - nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs; + nb_re_dmrs_per_rb = nb_dmrs_re_per_rb; else nb_re_dmrs_per_rb = 0; - nb_re_pusch = harq_process_ul_ue->nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb); + nb_re_pusch = nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb); nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); @@ -369,13 +351,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, txdataF = UE->common_vars.txdataF; - start_rb = harq_process_ul_ue->first_rb; + start_rb = harq_process_ul_ue->pusch_pdu.rb_start; start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; - for (ap=0; apNl; ap++) { + for (ap=0; ap< Nl; ap++) { // DMRS params for this ap get_Wt(Wt, ap, dmrs_type); @@ -384,47 +366,41 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t k_prime=0; - uint8_t is_dmrs, is_ptrs; - uint8_t l_ref; + uint8_t is_dmrs, is_ptrs, is_dmrs_symbol; uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0; - for (l=start_symbol; lnumber_of_symbols; l++) { + for (l=start_symbol; lnb_rb*NR_NB_SC_PER_RB; i++) { + for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) { sample_offsetF = l*frame_parms->ofdm_symbol_size + k; is_dmrs = 0; is_ptrs = 0; + is_dmrs_symbol = 0; - is_dmrs = is_dmrs_symbol(l_ref, - k, - start_sc, - k_prime, - n, - delta, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); + if((ul_dmrs_symb_pos >> l) & 0x01) { + is_dmrs_symbol = 1; + if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) + is_dmrs = 1; + } - if (UE->ptrs_configured == 1){ - is_ptrs = is_ptrs_symbol(l, - k, - ulsch_ue->rnti, - harq_process_ul_ue->nb_rb, - harq_process_ul_ue->number_of_symbols, - ap, - K_ptrs, - ulsch_ue->ptrs_symbols, - start_sc, - frame_parms->ofdm_symbol_size, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - ptrs_Uplink_Config->resourceElementOffset); + if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS){ + + if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) + is_ptrs = is_ptrs_subcarrier(k, + rnti, + ap, + dmrs_type, + K_ptrs, + nb_rb, + harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_sc, + frame_parms->ofdm_symbol_size); } if (is_dmrs == 1) { @@ -451,7 +427,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } else if (is_ptrs == 1) { if (k == start_sc){ - nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb/2, DMRS_MOD_ORDER, mod_ptrs); + nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs); } ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15; @@ -459,29 +435,24 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ptrs_idx++; - } else { + } else if (!is_dmrs_symbol || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data,dmrs_type)) { - if (!is_dmrs_symbol((mapping_type)?l-start_symbol:l, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size)) - { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; - #ifdef DEBUG_PUSCH_MAPPING - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif + #ifdef DEBUG_PUSCH_MAPPING + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); + #endif + + m++; + + } else { + + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = 0; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = 0; - m++; - } } if (++k >= frame_parms->ofdm_symbol_size) @@ -491,6 +462,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } //} + NR_UL_UE_HARQ_t *harq_process_ulsch=NULL; + harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]; + harq_process_ulsch->status = SCH_IDLE; /////////// //////////////////////////////////////////////////////////////////////// @@ -510,7 +484,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, int32_t **txdata; int32_t **txdataF; int timing_advance; - uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->Nl; // cw 0 + uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers; // cw 0 /////////////////////////IFFT/////////////////////// /////////// diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index 2a08d54c5a..b0c0519735 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -38,6 +38,7 @@ #include "PHY/NR_UE_TRANSPORT/pucch_nr.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" +#include #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" @@ -53,7 +54,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, int32_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + long pucch_GroupHopping, + long hoppingId, int16_t amp, int nr_tti_tx, uint8_t m0, @@ -110,7 +112,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, for (int l=0; lpucch_config_common_nr->pucch_GroupHopping,ue->pucch_config_common_nr->hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value + nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value alpha = nr_cyclic_shift_hopping(ue->pucch_config_common_nr->hoppingId,m0,mcs,l,startingSymbolIndex,nr_tti_tx); #ifdef DEBUG_NR_PUCCH_TX printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u,v,alpha,l); @@ -798,27 +800,47 @@ void nr_generate_pucch1_old(PHY_VARS_NR_UE *ue, } #endif //0 -inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id,uint32_t B,uint8_t *btilde) __attribute__((always_inline)); -inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id,uint32_t B,uint8_t *btilde) { +inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id,uint64_t *B64,uint8_t *btilde) __attribute__((always_inline)); +inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id,uint64_t *B64,uint8_t *btilde) { uint32_t x1, x2, s=0; int i; uint8_t c; // c_init=nRNTI*2^15+n_id according to TS 38.211 Subclause 6.3.2.6.1 //x2 = (rnti) + ((uint32_t)(1+nr_tti_tx)<<16)*(1+(fp->Nid_cell<<1)); x2 = ((rnti)<<15)+n_id; - s = lte_gold_generic(&x1, &x2, 1); #ifdef DEBUG_NR_PUCCH_TX - printf("\t\t [nr_pucch2_3_4_scrambling] gold sequence s=%x\n",s); + printf("\t\t [nr_pucch2_3_4_scrambling] gold sequence s=%x, M_bit %d\n",s,M_bit); #endif - for (i=0; i>i)&1); - btilde[i] = (((B>>i)&1) ^ c); + uint8_t *btildep=btilde; + int M_bit2=M_bit > 31 ? 32 : (M_bit&31), M_bit3=M_bit; + uint32_t B; + for (int iprime=0;iprime<=(M_bit>>5);iprime++,btildep+=32) { + s = lte_gold_generic(&x1, &x2, (iprime==0) ? 1 : 0); + B=((uint32_t*)B64)[iprime]; + for (int n=0;n>n)&1, + (B>>(n+1))&1, + (B>>(n+2))&1, + (B>>(n+3))&1, + (B>>(n+4))&1, + (B>>(n+5))&1, + (B>>(n+6))&1, + (B>>(n+7))&1 + ); + for (i=0; i>i)&1); + btildep[i] = (((B>>i)&1) ^ c); #ifdef DEBUG_NR_PUCCH_TX - //printf("\t\t\t btilde[%d]=%lx from scrambled bit %d\n",i,btilde[i],((B>>i)&1)); + printf("\t\t\t btilde[%d]=%lx from unscrambled bit %d and scrambling %d (%x)\n",i+(iprime<<5),btilde[i],((B>>i)&1),c,s>>i); #endif + } + M_bit3-=32; + M_bit2=M_bit3 > 31 ? 32 : (M_bit3&31); } + #ifdef DEBUG_NR_PUCCH_TX printf("\t\t [nr_pucch2_3_4_scrambling] scrambling M_bit=%d bits\n", M_bit); #endif @@ -908,24 +930,13 @@ void nr_uci_encoding(uint64_t payload, // CRC bits are not attached, and coding small block lengths (subclause 5.3.3) b[0] = encodeSmallBlock((uint16_t*)&payload,A); } else if (A>=12) { - AssertFatal(1==0,"Polar encoding not supported yet for UCI\n"); - // procedure in subclause 6.3.1.2.1 (UCI encoded by Polar code -> subclause 6.3.1.3.1) - /*if ((A>=360 && E>=1088)||(A>=1013)) { - I_seg = 1; - } else { - I_seg = 0; - }*/ - - /*if (A>=20) { - // parity bits (subclause 5.2.1) computed by setting L=11 and using generator polynomial gCRC11(D) (subclause 5.1) - L=11; - } else if (A<=19) { - // parity bits (subclause 5.2.1) computed by setting L=6 and using generator polynomial gCRC6(D) (subclause 5.1) - L=6; - }*/ - - // code block segmentation and CRC attachment is performed according to subclause 5.2.1 - // polar coding subclause 5.3.1 + AssertFatal(A<65,"Polar encoding not supported yet for UCI with more than 64 bits\n"); + t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_UCI_PUCCH_MESSAGE_TYPE, + A, + nrofPRB, + 1, + NULL); + polar_encoder_fast(&payload, b, 0,0,currentPtr); } } @@ -949,7 +960,7 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue, printf("\t [nr_generate_pucch2] start function at slot(nr_tti_tx)=%d with payload=%lu and nr_bit=%d\n",nr_tti_tx, payload, nr_bit); #endif // b is the block of bits transmitted on the physical channel after payload coding - uint64_t b; + uint64_t b[16]; // limit to 1024-bit encoded length // M_bit is the number of bits of block b (payload after encoding) uint16_t M_bit; nr_uci_encoding(payload,nr_bit,pucch_format2_nr,0,nrofSymbols,nrofPRB,1,0,0,&b,&M_bit); diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h index a2446dccf9..0e81045d66 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h @@ -49,7 +49,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, int32_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + long pucch_GroupHopping, + long hoppingId, int16_t amp, int nr_tti_tx, uint8_t m0, diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 67ec027a9d..dfb148d34e 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -9,6 +9,8 @@ * * http://www.openairinterface.org/?page_id=698 * + * Author and copyright: Laurent Thomas, open-cells.com + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +26,10 @@ #include #include "nr_phy_scope.h" #include "executables/nr-softmodem-common.h" +#include #define TPUT_WINDOW_LENGTH 100 +#define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe)); int otg_enabled; FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; @@ -36,836 +40,29 @@ float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; - -static void ia_receiver_on_off( FL_OBJECT *button, long arg) -{ - - if (fl_get_button(button)) { - fl_set_object_label(button, "IA Receiver ON"); - // PHY_vars_UE_g[0][0]->use_ia_receiver = 1; - fl_set_object_color(button, FL_GREEN, FL_GREEN); - } else { - fl_set_object_label(button, "IA Receiver OFF"); - // PHY_vars_UE_g[0][0]->use_ia_receiver = 0; - fl_set_object_color(button, FL_RED, FL_RED); - } -} - -static void dl_traffic_on_off( FL_OBJECT *button, long arg) -{ - - if (fl_get_button(button)) { - fl_set_object_label(button, "DL Traffic ON"); - otg_enabled = 1; - fl_set_object_color(button, FL_GREEN, FL_GREEN); - } else { - fl_set_object_label(button, "DL Traffic OFF"); - otg_enabled = 0; - fl_set_object_color(button, FL_RED, FL_RED); - } -} - -FD_phy_scope_gnb *create_phy_scope_gnb( void ) -{ - - FL_OBJECT *obj; - FD_phy_scope_gnb *fdui = fl_malloc( sizeof *fdui ); - - // Define form - fdui->phy_scope_gnb = fl_bgn_form( FL_NO_BOX, 800, 800 ); - - // This the whole UI box - obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" ); - fl_set_object_color( obj, FL_BLACK, FL_BLACK ); - - // Received signal - fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); - fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color - fl_set_xyplot_ybounds(fdui->rxsig_t,10,70); - - // Time-domain channel response - fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "SRS Frequency Response (samples, abs)" ); - fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color - - // Frequency-domain channel response - fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); - fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color - fl_set_xyplot_ybounds( fdui->chest_f,30,70); - - // LLR of PUSCH - fdui->pusch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pusch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pusch_llr, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pusch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pusch_llr,2); - - // I/Q PUSCH comp - fdui->pusch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 200, "PUSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pusch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pusch_comp, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pusch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pusch_comp,2); - fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR); - - // I/Q PUCCH comp (format 1) - fdui->pucch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 480, 240, 100, "PUCCH1 Energy (SR)" ); - fl_set_object_boxtype( fdui->pucch_comp1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pucch_comp1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pucch_comp1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pucch_comp1,2); - // fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR); - - // I/Q PUCCH comp (fromat 1a/b) - fdui->pucch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 600, 240, 100, "PUCCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pucch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pucch_comp, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pucch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pucch_comp,2); - // fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR); - - // Throughput on PUSCH - fdui->pusch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 480, 500, 100, "PUSCH Throughput [frame]/[kbit/s]" ); - fl_set_object_boxtype( fdui->pusch_tput, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pusch_tput, FL_BLACK, FL_WHITE ); - fl_set_object_lcolor( fdui->pusch_tput, FL_WHITE ); // Label color - - // Generic eNB Button - fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" ); - fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); - fl_set_button(fdui->button_0,0); - otg_enabled = 0; - fl_set_object_label(fdui->button_0, "DL Traffic OFF"); - fl_set_object_color(fdui->button_0, FL_RED, FL_RED); - fl_set_object_callback(fdui->button_0, dl_traffic_on_off, 0 ); - - fl_end_form( ); - fdui->phy_scope_gnb->fdui = fdui; - - return fdui; -} - -void phy_scope_gNB(FD_phy_scope_gnb *form, - PHY_VARS_gNB *phy_vars_gnb, - RU_t *phy_vars_ru, - int UE_id) -{ - int i, arx; //int i,i2,arx,atx,ind,k; - NR_DL_FRAME_PARMS *frame_parms = &phy_vars_gnb->frame_parms; - //int nsymb_ce = 12*frame_parms->N_RB_UL*frame_parms->symbols_per_tti; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - //uint8_t nb_antennas_tx = 1; // frame_parms->nb_antennas_tx; // in LTE Rel. 8 and 9 only a single transmit antenna is assumed at the UE - int16_t **rxsig_t, **rxsig_f; - // int16_t **chest_t=NULL; - // int16_t **chest_f=NULL; - // int16_t *pusch_llr=NULL; - // int32_t *pusch_comp=NULL; - // int32_t *pucch1_comp=NULL; - // int32_t *pucch1_thres=NULL; - // int32_t *pucch1ab_comp=NULL; - // float Re,Im,ymax; - float *llr, *bit; - // float I[nsymb_ce*2], Q[nsymb_ce*2]; - // float I_pucch[10240],Q_pucch[10240],A_pucch[10240],B_pucch[10240],C_pucch[10240]; - float *rxsig_t_dB[nb_antennas_rx]; - float *rxsig_f_dB[nb_antennas_rx]; - float time[frame_parms->samples_per_frame]; - // float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; - // uint32_t total_dlsch_bitrate = phy_vars_gnb->total_dlsch_bitrate; - int coded_bits_per_codeword = 0; - // uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2 - int Qm = 2; - - /* - if (!RC.nrmac[0]->UE_info.active[UE_id]) - return; - - // choose max MCS to compute coded_bits_per_codeword - if (phy_vars_gnb->ulsch[UE_id][0]!=NULL) { - for (harq_pid=0; harq_pid<3; harq_pid++) { - //Qm = cmax(phy_vars_gnb->ulsch[UE_id][0]->harq_processes->Qm,Qm); - } - } - */ - coded_bits_per_codeword = frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; - - for (arx=0; arxsamples_per_frame,sizeof(float)); - rxsig_f_dB[arx] = (float*) calloc(frame_parms->samples_per_slot_wCP,sizeof(float)); - } - llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero - bit = malloc(coded_bits_per_codeword*sizeof(float)); - - rxsig_t = (int16_t**) phy_vars_ru->common.rxdata; - rxsig_f = (int16_t**) phy_vars_ru->common.rxdataF; - //chest_t = (int16_t**) phy_vars_gnb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; - /* chest_t = (int16_t**) phy_vars_gnb->srs_vars[UE_id].srs_ch_estimates; - chest_f = (int16_t**) phy_vars_gnb->pusch_vars[UE_id]->drs_ch_estimates; - pusch_llr = (int16_t*) phy_vars_gnb->pusch_vars[UE_id]->llr; - pusch_comp = (int32_t*) phy_vars_gnb->pusch_vars[UE_id]->rxdataF_comp; - pucch1_comp = (int32_t*) phy_vars_gnb->pucch1_stats[UE_id]; - pucch1_thres = (int32_t*) phy_vars_gnb->pucch1_stats_thres[UE_id]; - pucch1ab_comp = (int32_t*) phy_vars_gnb->pucch1ab_stats[UE_id]; - */ - - // Received signal in time domain of receive antenna 0 - if (rxsig_t != NULL) { - if (rxsig_t[0] != NULL) { - for (i=0; isamples_per_frame; i++) { - rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((rxsig_t[0][2*i])*(rxsig_t[0][2*i])+(rxsig_t[0][2*i+1])*(rxsig_t[0][2*i+1]))); - time[i] = (float) i; - } - - fl_set_xyplot_data(form->rxsig_t,time,rxsig_t_dB[0],frame_parms->samples_per_frame,"","",""); - } - - for (arx=1; arxsamples_per_frame; i++) { - rxsig_t_dB[arx][i] = 10*log10(1.0+(float) ((rxsig_t[arx][2*i])*(rxsig_t[arx][2*i])+(rxsig_t[arx][2*i+1])*(rxsig_t[arx][2*i+1]))); - } - - fl_add_xyplot_overlay(form->rxsig_t,arx,time,rxsig_t_dB[arx],frame_parms->samples_per_frame,rx_antenna_colors[arx]); - } - } - } - - /* - // Channel Impulse Response - if (chest_t != NULL) { - ymax = 0; - - if (chest_t[0] !=NULL) { - for (i=0; i<(frame_parms->ofdm_symbol_size); i++) { - //i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; - i2=i; - //time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); - time2[i] = (float)i; - chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1])); - - if (chest_t_abs[0][i] > ymax) - ymax = chest_t_abs[0][i]; - } - - fl_set_xyplot_data(form->chest_t,time2,chest_t_abs[0],(frame_parms->ofdm_symbol_size),"","",""); - } - - for (arx=1; arxofdm_symbol_size>>3); i++) { - chest_t_abs[arx][i] = 10*log10((float) (1+chest_t[arx][2*i]*chest_t[arx][2*i]+chest_t[arx][2*i+1]*chest_t[arx][2*i+1])); - - if (chest_t_abs[arx][i] > ymax) - ymax = chest_t_abs[arx][i]; - } - - fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); - fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); - } - } - - // Avoid flickering effect - // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); - fl_set_xyplot_ybounds(form->chest_t,0,ymax); - } - */ - - // Channel Frequency Response - if (rxsig_f != NULL) { - if (rxsig_f[0] != NULL) { - for (i=0; isamples_per_slot_wCP; i++) { - rxsig_f_dB[0][i] = 10*log10(1.0+(float) ((rxsig_f[0][2*i])*(rxsig_f[0][2*i])+(rxsig_f[0][2*i+1])*(rxsig_f[0][2*i+1]))); - time[i] = (float) i; - } - - fl_set_xyplot_data(form->chest_t,time,rxsig_f_dB[0],frame_parms->samples_per_slot_wCP,"","",""); - } - } - - /* - - for (arx=0; arxchest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); - fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,3); - fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); - fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); - - for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - - // other tx antennas - if (nb_antennas_tx > 1) { - if (nb_antennas_rx > 1) { - for (atx=1; atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } else { // 1 rx antenna - atx=1; - arx=0; - fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } - - // PUSCH LLRs - if (pusch_llr != NULL) { - for (i=0; ipusch_llr,bit,llr,coded_bits_per_codeword,"","",""); - } - - // PUSCH I/Q of MF Output - if (pusch_comp!=NULL) { - ind=0; - - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_UL; i++) { - I[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i]; - Q[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i+1]; - ind++; - } - } - - fl_set_xyplot_data(form->pusch_comp,I,Q,ind,"","",""); - } - - // PUSCH I/Q of MF Output - if (pucch1ab_comp!=NULL) { - for (ind=0; ind<10240; ind++) { - - I_pucch[ind] = (float)pucch1ab_comp[2*(ind)]; - Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1]; - A_pucch[ind] = pucch1_comp?(10*log10(pucch1_comp[ind])):0; - B_pucch[ind] = ind; - C_pucch[ind] = pucch1_thres?(float)pucch1_thres[ind]:0; - } - fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","",""); - fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","",""); - fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED); - fl_set_xyplot_ybounds(form->pucch_comp,-5000,5000); - fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000); - - fl_set_xyplot_ybounds(form->pucch_comp1,0,80); - } - - - // PUSCH Throughput - memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); - memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); - - tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) 0; -// tput_enb[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; - - fl_set_xyplot_data(form->pusch_tput,tput_time_enb[UE_id],tput_enb[UE_id],TPUT_WINDOW_LENGTH,"","",""); - - // fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax); - // fl_set_xyplot_ybounds(form->pusch_tput,0,ymax); - - */ - - fl_check_forms(); - - free(llr); - free(bit); -} - -FD_phy_scope_nrue *create_phy_scope_nrue( void ) -{ - - FL_OBJECT *obj; - FD_phy_scope_nrue *fdui = fl_malloc( sizeof *fdui ); - - // Define form - fdui->phy_scope_nrue = fl_bgn_form( FL_NO_BOX, 800, 900 ); - - // This the whole UI box - obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 900, "" ); - fl_set_object_color( obj, FL_BLACK, FL_BLACK ); - - // Received signal - fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); - fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color - fl_set_xyplot_ybounds(fdui->rxsig_t,10,70); - - // Time-domain channel response - fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); - fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color - - // Frequency-domain channel response - fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); - fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color - fl_set_xyplot_ybounds( fdui->chest_f,30,70); - - // LLR of PBCH - fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_llr, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_llr,2); - fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR); - //fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920); - - // I/Q PBCH comp - fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_comp,2); - // fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100); - // fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100); - - // LLR of PDCCH - fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_llr,2); - - // I/Q PDCCH comp - fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_comp, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_comp,2); - fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR); - - // LLR of PDSCH - fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR); - - // I/Q PDSCH comp - fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp,2); - - // Throughput on PDSCH - fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" ); - fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE ); - fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color - - // Generic UE Button - fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); - fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); - //openair_daq_vars.use_ia_receiver = 0; - fl_set_button(fdui->button_0,0); - fl_set_object_label(fdui->button_0, "IA Receiver OFF"); - fl_set_object_color(fdui->button_0, FL_RED, FL_RED); - fl_set_object_callback(fdui->button_0, ia_receiver_on_off, 0 ); - fl_hide_object(fdui->button_0); - - fl_end_form( ); - fdui->phy_scope_nrue->fdui = fdui; - - return fdui; -} - -void phy_scope_nrUE(FD_phy_scope_nrue *form, - PHY_VARS_NR_UE *phy_vars_ue, - int eNB_id, - int UE_id, - uint8_t subframe) -{ - int i,arx,atx,ind,k; - NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; - //int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti; - int samples_per_frame = frame_parms->samples_per_frame; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB; - int16_t **rxsig_t; - float **rxsig_t_dB; - float *time; - float *corr; - int16_t **chest_t; - int16_t **chest_f; - int16_t *pdsch_llr; - int16_t *pdsch_comp; - //int16_t *pdsch_mag; - int8_t *pdcch_llr; - int16_t *pdcch_comp; - int16_t *pbch_llr; - int16_t *pbch_comp; - float llr_pbch[1920], bit_pbch[1920]; - float *llr, *bit; - float *llr_pdcch, *bit_pdcch; - float *I, *Q; - int num_pdcch_symbols=2; - int num_re = 4500; - int Qm = 2; - int coded_bits_per_codeword = num_re*Qm; - int symbol, first_symbol=2,nb_re; - int nb_rb_pdsch=50,nb_symb_sch=9; - float ymax=1; - float **chest_t_abs; - float Re,Im; - float *chest_f_abs; - float *freq; - static int overlay = 0; - /* - int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; - int mcs = 0; - unsigned char harq_pid = 0; - */ - - /* - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid; - - if (harq_pid>=8) - return; - - mcs = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs; - - // Button 0 - if(!phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { - // we are in TM5 - fl_show_object(form->button_0); - } - } - - if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) { - num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols; - } - - // coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - coded_bits_per_codeword = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - } - */ - I = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot*2,sizeof(float)); - Q = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot*2,sizeof(float)); - - chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*)); - - for (arx=0; arxofdm_symbol_size,sizeof(float)); - } - - chest_f_abs = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); - freq = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); - - llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero - bit = malloc(coded_bits_per_codeword*sizeof(float)); - - llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero - bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); - - rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdata; - rxsig_t_dB = calloc(nb_antennas_rx,sizeof(float*)); - for (arx=0; arxpbch_vars[eNB_id]->dl_ch_estimates_time; - chest_f = (int16_t**) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; - - pbch_llr = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->llr; - pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; - - pdcch_llr = (int8_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr; - pdcch_comp = (int16_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0]; - pdsch_llr = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0 - // pdsch_llr = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0]; // stream 0 - pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; - //pdsch_mag = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; - - // Received signal in time domain of receive antenna 0 - if (rxsig_t != NULL) { - if (rxsig_t[0] != NULL) { - for (i=0; irxsig_t,time,rxsig_t_dB[0],samples_per_frame,"","",""); - } - - /* - for (arx=1; arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); - } - } - */ - } - - if (phy_vars_ue->is_synchronized==0) { - for (ind=0;ind<3;ind++) { - /* - if (pss_corr_ue[ind]) { - for (i=0; ichest_t,time,corr,samples_per_frame,"","",""); - else - fl_add_xyplot_overlay(form->chest_t,ind,time,corr,samples_per_frame,rx_antenna_colors[ind]); - - overlay = 1; - } - */ - } - } - else { - - if (overlay) { //there was a previous overlay - fl_clear_xyplot(form->chest_t); - overlay = 0; - } - - // Channel Impulse Response - if (chest_t != NULL) { - ymax = 0; - - if (chest_t[0] !=NULL) { - for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { - chest_t_abs[0][i] = (float) (chest_t[0][2*i]*chest_t[0][2*i]+chest_t[0][2*i+1]*chest_t[0][2*i+1]); - time[i] = (float) i; - - if (chest_t_abs[0][i] > ymax) - ymax = chest_t_abs[0][i]; - } - - fl_set_xyplot_data(form->chest_t,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","",""); - } - /* - for (arx=1; arxofdm_symbol_size>>3); i++) { - chest_t_abs[arx][i] = (float) (chest_t[arx][4*i]*chest_t[arx][4*i]+chest_t[arx][4*i+1]*chest_t[arx][4*i+1]); - - if (chest_t_abs[arx][i] > ymax) - ymax = chest_t_abs[arx][i]; - } - - fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); - fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); - } - } - */ - // Avoid flickering effect - // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); // Does not always work... - fl_set_xyplot_ybounds(form->chest_t,0,(double) ymax); - } - } - - // Channel Frequency Response (includes 5 complex sample for filter) - if (chest_f != NULL) { - ind = 0; - - for (atx=0; atxofdm_symbol_size; k++) { - freq[ind] = (float)ind; - Re = (float)(chest_f[(atx<<1)+arx][6144+(2*k)]); - Im = (float)(chest_f[(atx<<1)+arx][6144+(2*k)+1]); - - chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im)); - ind++; - } - } - } - } - - // tx antenna 0 - //fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); - //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); - // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); - //fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); - fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,frame_parms->ofdm_symbol_size,"","",""); - - /* - for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - - // other tx antennas - if (nb_antennas_tx > 1) { - if (nb_antennas_rx > 1) { - for (atx=1; atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } else { // 1 rx antenna - atx=1; - arx=0; - fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - */ - } - - // PBCH LLRs - if (pbch_llr != NULL) { - for (i=0; i<864; i++) { - llr_pbch[i] = (float) pbch_llr[i]; - bit_pbch[i] = (float) i; - } - - fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,864,"","",""); - } - - first_symbol=1; - - // PBCH I/Q of MF Output - if (pbch_comp!=NULL) { - for (symbol=first_symbol; symbol<(first_symbol+3); symbol++) { - if (symbol == 2 || symbol == 6) - nb_re = 72; - else - nb_re = 180; - for (i=0; ipbch_comp,I,Q,432,"","",""); - } - - // PDCCH LLRs - if (pdcch_llr != NULL) { - for (i=0; i<100; i++) { //12*frame_parms->N_RB_DL*2*num_pdcch_symbols - llr_pdcch[i] = (float) pdcch_llr[2*24*9 +i]; - bit_pdcch[i] = (float) i; - } - - fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); - } - - // PDCCH I/Q of MF Output - if (pdcch_comp!=NULL) { - for (i=0; i<100; i++) { - I[i] = pdcch_comp[2*50*12+2*i]; - Q[i] = pdcch_comp[2*50*12+2*i+1]; - } - fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); - } - - // PDSCH LLRs - if (pdsch_llr != NULL) { - for (i=0; ipdsch_llr,0,coded_bits_per_codeword); - fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","",""); - } - - first_symbol = 2; - ind = 0; - // PDSCH I/Q of MF Output - if (pdsch_comp!=NULL) { - for (symbol=0;symbolN_RB_DL*12+i) ]; - Q[ind] = pdsch_comp[2*((first_symbol+symbol)*frame_parms->N_RB_DL*12+i)+1]; - ind++; - } - } - - fl_set_xyplot_data(form->pdsch_comp,I,Q,nb_symb_sch*nb_rb_pdsch*12,"","",""); - } - /* - - // PDSCH Throughput - memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); - memmove( tput_ue[UE_id], &tput_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); - - tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; - tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; - - if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) { - tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; - } - - fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); - - fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); - */ - - fl_check_forms(); - - free(time); - free(corr); - for (arx=0; arx graph->maxX || maxY > graph->maxY || minX < graph->minX || minY < graph->minY ) { + graph->maxX=max(graph->maxX,maxX); + graph->minX=min(graph->minX,minX); + graph->maxY=max(graph->maxY,maxY); + graph->minY=min(graph->minY,minY); + fl_set_xyplot_ybounds(graph->graph, graph->minY, graph->maxY); + fl_set_xyplot_xbounds(graph->graph, graph->minX, graph->maxX); + } +} + +static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, int NoAutoScale) { + if (layer==0) + fl_set_xyplot_data(graph->graph,x,y,len,"","",""); + else + fl_add_xyplot_overlay(graph->graph,layer,x,y,len,rx_antenna_colors[layer]); + + if ( NoAutoScale && graph->iteration%NoAutoScale == 0) { + float maxX=0, maxY=0, minX=0, minY=0; + + for (int k=0; kiteration++; +} + +static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { + float *values=malloc(len*sizeof(*values)); + float *time=malloc(len*sizeof(*time)); + + for (int ant=0; antcommon.rxdata) + return; + + NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; + genericLogPowerPerAntena(graph, frame_parms->nb_antennas_rx, + (const scopeSample_t **)phy_vars_ru->common.rxdata, + frame_parms->samples_per_frame); +} + +static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { + const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; + float values[len]; + float time[len]; + const int ant=0; // display antenna 0 for each UE + + for (int ue=0; uepusch_vars[ue]->ul_ch_estimates_time[ant]; + + if (data != NULL) { + for (int i=0; iframe_parms; + genericLogPowerPerAntena(graph, frame_parms->nb_antennas_rx, + (const scopeSample_t **)phy_vars_ru->common.rxdataF, + frame_parms->samples_per_slot_wCP); +} + +static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { + //int Qm = 2; + int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; + float llr[coded_bits_per_codeword]; + float bit[coded_bits_per_codeword]; + + for (int ue=0; uepusch_vars[ue]->llr; + + if (pusch_llr) { + for (int i=0; iframe_parms; + int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; + float I[sz], Q[sz]; + + for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; + + if (pusch_comp) { + for (int k=0; kpucch1ab_stats[UE_id]; + int32_t *pucch1_comp = (int32_t *) NULL; //phy_vars_gnb->pucch1_stats[UE_id]; + float I_pucch[10240],Q_pucch[10240],A_pucch[10240],B_pucch[10240],C_pucch[10240]; + + for (int ind=0; ind<10240; ind++) { + I_pucch[ind] = (float)pucch1ab_comp[2*(ind)]; + Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1]; + A_pucch[ind] = pucch1_comp?(10*log10(pucch1_comp[ind])):0; + B_pucch[ind] = ind; + int32_t *pucch1_thres = (int32_t *) NULL; // phy_vars_gnb->pucch1_stats_thres[UE_id]; + C_pucch[ind] = pucch1_thres?(float)pucch1_thres[ind]:0; + } + + fl_set_xyplot_data(graph,I_pucch,Q_pucch,10240,"","",""); + fl_set_xyplot_data(graph,B_pucch,A_pucch,1024,"","",""); + fl_add_xyplot_overlay(graph,1,B_pucch,C_pucch,1024,FL_RED); + fl_set_xyplot_ybounds(graph,-5000,5000); + fl_set_xyplot_xbounds(graph,-5000,5000); + fl_set_xyplot_ybounds(graph,0,80); + } + */ +} + +static void pucchIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +} + +static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { + // PUSCH Throughput + /* + memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); + memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); + tput_time_enb[UE_id][TPUT_WINDOW_LENGTH-1] = (float) 0; + // tput_enb[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; + fl_set_xyplot_data(graph,tput_time_enb[UE_id],tput_enb[UE_id],TPUT_WINDOW_LENGTH,"","",""); + // fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax); + // fl_set_xyplot_ybounds(form->pusch_tput,0,ymax); + */ +} + +static OAI_phy_scope_t *create_phy_scope_gnb(void) { + FL_OBJECT *obj; + OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + // Define form + fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" ); + fl_set_object_color( obj, FL_BLACK, FL_WHITE ); + int curY=0,x,y,w,h; + // Received signal + fdui->graph[0] = gNBcommonGraph( timeSignal, FL_NORMAL_XYPLOT, 0, curY, 400, 100, + "Received Signal (Time-Domain, dB)", FL_RED ); + // Time-domain channel response + fdui->graph[1] = gNBcommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100, + "SRS Frequency Response (samples, abs)", FL_RED ); + fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + curY+=h; + // Frequency-domain channel response + fdui->graph[2] = gNBcommonGraph( frequencyResponse, FL_NORMAL_XYPLOT, 0, curY, 800, 100, + "Channel Frequency Response (RE, dB)", FL_RED ); + fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); + curY+=h; + // LLR of PUSCH + fdui->graph[3] = gNBcommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, + "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); + // I/Q PUSCH comp + fdui->graph[4] = gNBcommonGraph( puschIQ, FL_POINTS_XYPLOT, 500, curY, 300, 200, + "PUSCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[3].graph,&x, &y,&w, &h); + curY+=h; + // I/Q PUCCH comp (format 1) + fdui->graph[5] = gNBcommonGraph( pucchEnergy, FL_POINTS_XYPLOT, 0, curY, 300, 100, + "PUCCH1 Energy (SR)", FL_YELLOW ); + // fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR); + // I/Q PUCCH comp (fromat 1a/b) + fdui->graph[6] = gNBcommonGraph( pucchIQ, FL_POINTS_XYPLOT, 500, curY, 300, 100, + "PUCCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[6].graph,&x, &y,&w, &h); + curY+=h; + // Throughput on PUSCH + fdui->graph[7] = gNBcommonGraph( puschThroughtput, FL_NORMAL_XYPLOT, 0, curY, 500, 100, + "PUSCH Throughput [frame]/[kbit/s]", FL_WHITE ); + fdui->graph[8].graph=NULL; + fl_end_form( ); + fdui->phy_scope->fdui = fdui; + fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); + return fdui; +} + +static const int scope_enb_num_ue = 1; +void phy_scope_gNB(OAI_phy_scope_t *form, + PHY_VARS_gNB *phy_vars_gnb, + RU_t *phy_vars_ru, + int UE_id) { + static OAI_phy_scope_t *remeberForm=NULL; + + if (form==NULL) + form=remeberForm; + else + remeberForm=form; + + if (form==NULL) return; + + int i=0; + + while (form->graph[i].graph) { + form->graph[i].gNBfunct(form->graph+i, phy_vars_gnb, phy_vars_ru, UE_id); + i++; + } + + fl_check_forms(); +} + +static void *scope_thread_gNB(void *arg) { + scopeParms_t *p=(scopeParms_t *) arg; + //# ifdef ENABLE_XFORMS_WRITE_STATS + // FILE *gNB_stats = fopen("gNB_stats.txt", "w"); + //#endif + size_t stksize=0; + pthread_attr_t atr= {0}; + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + sleep(3); // no clean interthread barriers + fl_initialize (p->argc, p->argv, NULL, 0, 0); + int nb_ue=min(NUMBER_OF_UE_MAX, scope_enb_num_ue); + OAI_phy_scope_t *form_gnb = create_phy_scope_gnb(); + + while (!oai_exit) { + phy_scope_gNB(form_gnb, p->gNB, p->ru, nb_ue); + usleep(99*1000); + } + + return NULL; +} + +void gNBinitScope(scopeParms_t *p) { + static scopeParms_t parms; + memcpy(&parms,p,sizeof(parms)); + pthread_t forms_thread; + threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW); +} + +static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // Received signal in time domain of receive antenna 0 + genericLogPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx, + (const scopeSample_t **) phy_vars_ue->common_vars.rxdata, + phy_vars_ue->frame_parms.samples_per_frame); +} + +static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // Channel Impulse Response + genericPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx, + (const scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time, + phy_vars_ue->frame_parms.ofdm_symbol_size>>3); +} + +static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // Channel Frequency Response (includes 5 complex sample for filter) + if (!phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates) + return; + + NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB; + scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; + int ind = 0; + float chest_f_abs[frame_parms->ofdm_symbol_size]; + float freq[frame_parms->ofdm_symbol_size]; + + for (int atx=0; atxofdm_symbol_size; k++) { + freq[ind] = (float)ind; + chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k])); + ind++; + } + } + } + } + + // tx antenna 0 + //fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); + //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); + // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); + //fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); + oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10); +} + +static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // PBCH LLRs + if ( !phy_vars_ue->pbch_vars[eNB_id]->llr) + return; + + int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; + float llr_pbch[864], bit_pbch[864]; + + for (int i=0; i<864; i++) { + llr_pbch[i] = (float) pbch_llr[i]; + bit_pbch[i] = (float) i; + } + + oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10); +} + +static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // PBCH I/Q of MF Output + if (!phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]) + return; + + scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; + localBuff(I,180*3); + localBuff(Q,180*3); + int first_symbol=1; + int base=0; + + for (int symbol=first_symbol; symbol<(first_symbol+3); symbol++) { + int nb_re; + + if (symbol == 2 || symbol == 6) + nb_re = 72; + else + nb_re = 180; + + AssertFatal(base+nb_re<180*3,""); + + for (int i=0; ipdcch_vars[0][eNB_id]->llr) + return; + + NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx; + scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; + int ind = 0; + float chest_f_abs[frame_parms->ofdm_symbol_size]; + float freq[frame_parms->ofdm_symbol_size]; + + for (int atx=0; atxofdm_symbol_size; k++) { + freq[ind] = (float)ind; + chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k])); + ind++; + } + } + } + } + + // tx antenna 0 + //fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); + //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); + // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); + //fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); + oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10); +} + +static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // PDCCH I/Q of MF Output + if (!phy_vars_ue->pdcch_vars[0][eNB_id]->rxdataF_comp[0]) + return; + + int nb=4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols + localBuff(I,nb*RX_NB_TH_MAX); + localBuff(Q,nb*RX_NB_TH_MAX); + int base=0; + + for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { + scopeSample_t *pdcch_comp = (scopeSample_t *) phy_vars_ue->pdcch_vars[thr][eNB_id]->rxdataF_comp[0]; + + for (int i=0; i< nb; i++) { + I[base+i] = pdcch_comp[i].r; + Q[base+i] = pdcch_comp[i].i; + } + + base+=nb; + } + + oai_xygraph(graph,I,Q,base,0,10); +} + +static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // PDSCH LLRs + if (!phy_vars_ue->pdsch_vars[0][eNB_id]->llr[0]) + return; + + int num_re = 4500; + int Qm = 2; + int coded_bits_per_codeword = num_re*Qm; + localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX); + localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX); + int base=0; + + for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { + int16_t *pdsch_llr = (int16_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->llr[0]; // stream 0 + + for (int i=0; ipdsch_llr,0,coded_bits_per_codeword); + oai_xygraph(graph,bit,llr,base,0,10); +} + +static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // PDSCH I/Q of MF Output + if (!phy_vars_ue->pdsch_vars[0][eNB_id]->rxdataF_comp0[0]) + return; + + NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + int sz=7*2*frame_parms->N_RB_DL*12; // size of the malloced buffer + localBuff(I,sz*RX_NB_TH_MAX); + localBuff(Q,sz*RX_NB_TH_MAX); + int base=0; + + for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { + scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->rxdataF_comp0[0]; + + for (int s=0; s tput_ue_max[UE_id]) { + tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; + } + + fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); + + fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); + */ +} + +static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { + FL_OBJECT *obj; + OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + // Define form + fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 900 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 900, "" ); + fl_set_object_color( obj, FL_BLACK, FL_BLACK ); + int curY=0,x,y,w,h; + // Received signal + fdui->graph[0] = nrUEcommonGraph(ueTimeResponse, + FL_NORMAL_XYPLOT, 0, curY, 400, 100, "Received Signal (Time-Domain, dB)", FL_RED ); + // Time-domain channel response + fdui->graph[1] = nrUEcommonGraph(ueChannelResponse, + FL_NORMAL_XYPLOT, 400, curY, 400, 100, "Channel Impulse Response (samples, abs)", FL_RED ); + fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + curY+=h; + // Frequency-domain channel response + fdui->graph[2] = nrUEcommonGraph(uePbchFrequencyResp, + FL_IMPULSE_XYPLOT, 0, curY, 800, 100, "Channel Frequency data (RE, dB)", FL_RED ); + fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); + curY+=h; + // LLR of PBCH + fdui->graph[3] = nrUEcommonGraph(uePbchLLR, + FL_POINTS_XYPLOT, 0, curY, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)", FL_GREEN ); + fl_set_xyplot_xgrid(fdui->graph[3].graph,FL_GRID_MAJOR); + // I/Q PBCH comp + fdui->graph[4] = nrUEcommonGraph(uePbchIQ, + FL_POINTS_XYPLOT, 500, curY, 300, 100, "PBCH I/Q of MF Output", FL_GREEN ); + fl_get_object_bbox(fdui->graph[3].graph,&x, &y,&w, &h); + curY+=h; + // LLR of PDCCH + fdui->graph[5] = nrUEcommonGraph(uePcchLLR, + FL_POINTS_XYPLOT, 0, curY, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)", FL_CYAN ); + // I/Q PDCCH comp + fdui->graph[6] = nrUEcommonGraph(uePcchIQ, + FL_POINTS_XYPLOT, 500, curY, 300, 100, "PDCCH I/Q of MF Output", FL_CYAN ); + fl_get_object_bbox(fdui->graph[5].graph,&x, &y,&w, &h); + curY+=h; + // LLR of PDSCH + fdui->graph[7] = nrUEcommonGraph(uePdschLLR, + FL_POINTS_XYPLOT, 0, curY, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); + // I/Q PDSCH comp + fdui->graph[8] = nrUEcommonGraph(uePdschIQ, + FL_POINTS_XYPLOT, 500, curY, 300, 200, "PDSCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[8].graph,&x, &y,&w, &h); + curY+=h; + // Throughput on PDSCH + fdui->graph[9] = nrUEcommonGraph(uePdschThroughput, + FL_NORMAL_XYPLOT, 0, curY, 500, 100, "PDSCH Throughput [frame]/[kbit/s]", FL_WHITE ); + fdui->graph[10].graph=NULL; + // Generic UE Button +#if 0 + fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); + fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); + //openair_daq_vars.use_ia_receiver = 0; + fl_set_button(fdui->button_0,0); + fl_set_object_label(fdui->button_0, "IA Receiver OFF"); + fl_set_object_color(fdui->button_0, FL_RED, FL_RED); + fl_set_object_callback(fdui->button_0, ia_receiver_on_off, 0 ); + fl_hide_object(fdui->button_0); +#endif + fl_end_form( ); + fdui->phy_scope->fdui = fdui; + char buf[100]; + sprintf(buf,"NR DL SCOPE UE %d", ID); + fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, buf); + return fdui; +} + +void phy_scope_nrUE(OAI_phy_scope_t *form, + PHY_VARS_NR_UE *phy_vars_ue, + int eNB_id, + int UE_id) { + static OAI_phy_scope_t *remeberForm=NULL; + + if (form==NULL) + form=remeberForm; + else + remeberForm=form; + + if (form==NULL) + return; + + int i=0; + + while (form->graph[i].graph) { + form->graph[i].nrUEfunct(form->graph+i, phy_vars_ue, eNB_id, UE_id); + i++; + } + + fl_check_forms(); +} + + +static void *nrUEscopeThread(void *arg) { + PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; + size_t stksize; + pthread_attr_t atr; + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + int fl_argc=1; + char *name="5G-UE-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); + OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0); + + while (!oai_exit) { + phy_scope_nrUE(form_nrue, + ue, + 0,0); + usleep(99*1000); + } + + pthread_exit((void *)arg); +} + +void nrUEinitScope(PHY_VARS_NR_UE *ue) { + pthread_t forms_thread; + threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); +} + +// Kept to put back the functionality soon +#if 0 //FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; //char title[255]; -unsigned char scope_enb_num_ue = 1; //static pthread_t forms_thread; //xforms - - -void reset_stats_gNB(FL_OBJECT *button, - long arg) -{ +static void reset_stats_gNB(FL_OBJECT *button, + long arg) { int i,k; //PHY_VARS_gNB *phy_vars_gNB = RC.gNB[0][0]; for (i=0; idlsch[i][0]->Mlimit; j++) { - phy_vars_gNB->UE_stats[i].dlsch_NAK[k][j]=0; - phy_vars_gNB->UE_stats[i].dlsch_ACK[k][j]=0; - phy_vars_gNB->UE_stats[i].dlsch_trials[k][j]=0; - } - phy_vars_gNB->UE_stats[i].dlsch_l2_errors[k]=0; - phy_vars_gNB->UE_stats[i].ulsch_errors[k]=0; - phy_vars_gNB->UE_stats[i].ulsch_consecutive_errors=0; - phy_vars_gNB->UE_stats[i].dlsch_sliding_cnt=0; - phy_vars_gNB->UE_stats[i].dlsch_NAK_round0=0; - phy_vars_gNB->UE_stats[i].dlsch_mcs_offset=0;*/ - } - } -} - - -static void *scope_thread_gNB(void *arg) { - int UE_id; - int ue_cnt=0; -//# ifdef ENABLE_XFORMS_WRITE_STATS -// FILE *gNB_stats = fopen("gNB_stats.txt", "w"); -//#endif - - while (!oai_exit) { - ue_cnt=0; - - for(UE_id=0; UE_idUE_stats[i].dlsch_NAK[k][j]=0; + phy_vars_gNB->UE_stats[i].dlsch_ACK[k][j]=0; + phy_vars_gNB->UE_stats[i].dlsch_trials[k][j]=0; } + phy_vars_gNB->UE_stats[i].dlsch_l2_errors[k]=0; + phy_vars_gNB->UE_stats[i].ulsch_errors[k]=0; + phy_vars_gNB->UE_stats[i].ulsch_consecutive_errors=0; + phy_vars_gNB->UE_stats[i].dlsch_sliding_cnt=0; + phy_vars_gNB->UE_stats[i].dlsch_NAK_round0=0; + phy_vars_gNB->UE_stats[i].dlsch_mcs_offset=0;*/ } - sleep(1); } - -// printf("%s",stats_buffer); -/*#ifdef ENABLE_XFORMS_WRITE_STATS - - if (eNB_stats) { - rewind (gNB_stats); - fwrite (stats_buffer, 1, len, gNB_stats); - fclose (gNB_stats); - } - -#endif - pthread_exit((void *)arg); -}*/ - - return NULL; } -FD_stats_form * create_form_stats_form( void ) { +static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; - FD_stats_form *fdui = fl_malloc( sizeof *fdui ); + FD_stats_form *fdui = calloc(( sizeof *fdui ),1); fdui->vdata = fdui->cdata = NULL; fdui->ldata = 0; fdui->stats_form = fl_bgn_form( FL_NO_BOX, 1115, 900 ); @@ -964,24 +813,8 @@ FD_stats_form * create_form_stats_form( void ) { fdui->stats_form->fdui = fdui; return fdui; } +#endif + + -void startScope(scopeParms_t * p) { - //FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; - char title[255]; - fl_initialize (p->argc, p->argv, NULL, 0, 0); - /* - form_stats_l2 = create_form_stats_form(); - fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); - form_stats = create_form_stats_form(); - fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); - */ - - for(int UE_id=0; UE_idphy_scope_gnb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - } // UE_id - pthread_t forms_thread; - threadCreate(&forms_thread, scope_thread_gNB, NULL, "scope", -1, OAI_PRIORITY_RT_LOW); -} diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h index 3df6b81a03..429537141a 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.h +++ b/openair1/PHY/TOOLS/nr_phy_scope.h @@ -28,68 +28,20 @@ #include #include "common/ran_context.h" #include -#include #include "PHY/defs_gNB.h" //#include "PHY/defs_nrUE.h" //#include "PHY/impl_defs_top.h" #include "PHY/defs_nr_UE.h" -/* Forms and Objects */ -typedef struct { - FL_FORM * phy_scope_gnb; - FL_OBJECT * rxsig_t; - FL_OBJECT * chest_f; - FL_OBJECT * chest_t; - FL_OBJECT * pusch_comp; - FL_OBJECT * pucch_comp; - FL_OBJECT * pucch_comp1; - FL_OBJECT * pusch_llr; - FL_OBJECT * pusch_tput; - FL_OBJECT * button_0; -} FD_phy_scope_gnb; - -typedef struct { - FL_FORM * phy_scope_nrue; - FL_OBJECT * rxsig_t; - FL_OBJECT * chest_f; - FL_OBJECT * chest_t; - FL_OBJECT * pbch_comp; - FL_OBJECT * pbch_llr; - FL_OBJECT * pdcch_comp; - FL_OBJECT * pdcch_llr; - FL_OBJECT * pdsch_comp; - FL_OBJECT * pdsch_llr; - FL_OBJECT * pdsch_comp1; - FL_OBJECT * pdsch_llr1; - FL_OBJECT * pdsch_tput; - FL_OBJECT * button_0; -} FD_phy_scope_nrue; - typedef struct { int *argc; char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; } scopeParms_t; -extern unsigned char scope_enb_num_ue; -FD_phy_scope_gnb * create_phy_scope_gnb( void ); -FD_phy_scope_nrue * create_phy_scope_nrue( void ); - - -void phy_scope_gNB(FD_phy_scope_gnb *form, - PHY_VARS_gNB *phy_vars_gnb, - RU_t *phy_vars_ru, - int UE_id); - - -void phy_scope_nrUE(FD_phy_scope_nrue *form, - PHY_VARS_NR_UE *phy_vars_ue, - int eNB_id, - int UE_id, - uint8_t subframe); - - -void startScope(scopeParms_t * p); - +void gNBinitScope(scopeParms_t *p); +void nrUEinitScope(PHY_VARS_NR_UE *ue); extern RAN_CONTEXT_t RC; #endif diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 7d3cf0d2c0..25244eeff5 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -9607,6 +9607,7 @@ int dfts_autoinit(void) init_rad3(12288,twa12288,twb12288); init_rad3(18432,twa18432,twb18432); init_rad3(24576,twa24576,twb24576); + init_rad3(36864,twa36864,twb36864); init_rad3(49152,twa49152,twb49152); init_rad3(98304,twa98304,twb98304); @@ -10588,7 +10589,7 @@ int main(int argc, char**argv) reset_meas(&ts); for (i=0; i<10000; i++) { start_meas(&ts); - idft36864((int16_t *)x,(int16_t *)y,1); + dft36864((int16_t *)x,(int16_t *)y,1); stop_meas(&ts); } diff --git a/openair1/PHY/TOOLS/smbv.h b/openair1/PHY/TOOLS/smbv.h index ef40a9ed7d..f8fab67d01 100644 --- a/openair1/PHY/TOOLS/smbv.h +++ b/openair1/PHY/TOOLS/smbv.h @@ -23,6 +23,8 @@ This library offers some functions to remotely program the R&S SMBV100A. */ +#ifndef __PHY_TOOLS_SMBV__H__ +#define __PHY_TOOLS_SMBV__H__ #include #include @@ -93,3 +95,4 @@ int smbv_configure_common_dci(const char* fname, uint8_t subframe, const char* t // item is the row in the DCI table int smbv_configure_ue_spec_dci(const char* fname, uint8_t subframe, uint8_t user, DCI_ALLOC_t *dci_alloc, uint8_t item); #endif +#endif diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index f0fd7661c7..1f8c0b8eee 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -148,11 +148,7 @@ static inline void* malloc16_clear( size_t size ) #define NB_BANDS_MAX_NB_IoT 8 -#ifdef OCP_FRAMEWORK -#include -#else typedef enum {normal_txrx_NB_IoT=0,rx_calib_ue_NB_IoT=1,rx_calib_ue_med_NB_IoT=2,rx_calib_ue_byp_NB_IoT=3,debug_prach_NB_IoT=4,no_L2_connect_NB_IoT=5,calib_prach_tx_NB_IoT=6,rx_dump_frame_NB_IoT=7,loop_through_memory_NB_IoT=8} runmode_NB_IoT_t; -#endif /* enum transmission_access_mode { NO_ACCESS=0, diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 128a40b02e..b8083b5ecf 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -44,9 +44,6 @@ #define MAX_RRU_CONFIG_SIZE 1024 -#ifdef OCP_FRAMEWORK -#include -#else typedef enum { normal_txrx=0, @@ -92,7 +89,6 @@ typedef enum { synch_to_other, // synch to another source_(timer, other RU) synch_to_mobipass_standalone // special case for mobipass in standalone mode } node_timing_t; -#endif typedef struct { @@ -552,6 +548,8 @@ typedef struct RU_t_s { void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *gNB, struct RU_t_s *ru, int frame, int subframe); /// function pointer to wakeup routine in lte-enb. void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru, int frame, int subframe); + /// function pointer to start a thread of tx write for USRP. + int (*start_write_thread)(struct RU_t_s *ru); /// function pointer to NB entry routine void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index f52558b632..75b2d54dc6 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -99,9 +99,6 @@ #define NB_RX_ANTENNAS_MAX 64 -#ifdef OCP_FRAMEWORK -#include "enums.h" -#else typedef enum {TDD=1,FDD=0} lte_frame_type_t; @@ -122,7 +119,6 @@ typedef enum { one=6, two=12 } PHICH_RESOURCE_t; -#endif /// PHICH-Config from 36.331 RRC spec typedef struct { /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1). @@ -250,12 +246,10 @@ typedef struct { } UL_REFERENCE_SIGNALS_PUSCH_t; /// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode. -#ifndef OCP_FRAMEWORK typedef enum { interSubFrame=0, intraAndInterSubFrame=1 } PUSCH_HOPPING_t; -#endif /// PUSCH-ConfigCommon from 36.331 RRC spec. typedef struct { @@ -434,7 +428,6 @@ typedef struct { uint8_t filterCoefficient; } UL_POWER_CONTROL_DEDICATED; -#ifndef OCP_FRAMEWORK /// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha. typedef enum { al0=0, @@ -446,7 +439,6 @@ typedef enum { al09=6, al1=7 } PUSCH_alpha_t; -#endif /// \note UNUSED typedef enum { diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 7a050e2cc3..e2cdebff3a 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -689,6 +689,8 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords] NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p; NR_gNB_DLSCH_t *dlsch_PCH; + t_nrPolar_params *uci_polarParams; + uint8_t pbch_configured; char gNB_generate_rar; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index ac71f708ec..9bdf892ceb 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -884,8 +884,6 @@ typedef struct { fapi_nr_config_request_t nrUE_config; - uint16_t frame_gap; - // the following structures are not part of PHY_vars_UE anymore as it is not thread safe. They are now on the stack of the functions that actually need them //nr_downlink_indication_t dl_indication; @@ -956,9 +954,6 @@ typedef struct { /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; - /// flag to indicate if PTRS is configured - uint8_t ptrs_configured; - uint32_t X_u[64][839]; uint32_t high_speed_flag; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 9caf3bc682..584962c55c 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -221,8 +221,10 @@ typedef struct { uint16_t ra_RNTI; /// Pointer to Msg3 payload for UL-grant uint8_t *Msg3; - /// Flag for the Msg1 generation - uint8_t generate_nr_prach; + /// Frame of last completed synch + uint8_t sync_frame; + /// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync + uint8_t init_msg1; } NR_PRACH_RESOURCES_t; typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS; diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index deb7087c8c..165ed961b3 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -38,7 +38,7 @@ extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; extern unsigned int DAQ_MBOX; extern int number_of_cards; -extern short conjugate[8],conjugate2[8]; +extern const short conjugate[8],conjugate2[8]; extern RAN_CONTEXT_t RC; @@ -73,8 +73,8 @@ extern int flag_LA; extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; extern double sinr_bler_map_up[MCS_COUNT][2][16]; extern int table_length[MCS_COUNT]; -extern double sinr_to_cqi[4][16]; -extern int cqi_to_mcs[16]; +extern const double sinr_to_cqi[4][16]; +extern const int cqi_to_mcs[16]; //for MU-MIMO abstraction using MIESM //this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively @@ -82,23 +82,22 @@ extern double MI_map_4qam[3][162]; extern double MI_map_16qam[3][197]; extern double MI_map_64qam[3][227]; -extern double beta1_dlsch_MI[6][MCS_COUNT]; -extern double beta2_dlsch_MI[6][MCS_COUNT]; +extern const double beta1_dlsch_MI[6][MCS_COUNT]; +extern const double beta2_dlsch_MI[6][MCS_COUNT]; -extern double q_qpsk[8]; -extern double q_qam16[8]; -extern double q_qam64[8]; +extern const double q_qpsk[8]; +extern const double q_qam16[8]; +extern const double q_qam64[8]; +extern const double p_qpsk[8]; +extern const double p_qam16[8]; +extern const double p_qam64[8]; -extern double p_qpsk[8]; -extern double p_qam16[8]; -extern double p_qam64[8]; +extern const double beta1_dlsch[6][MCS_COUNT]; +extern const double beta2_dlsch[6][MCS_COUNT]; -extern double beta1_dlsch[6][MCS_COUNT]; -extern double beta2_dlsch[6][MCS_COUNT]; - -extern char NB_functions[7][20]; -extern char NB_timing[2][20]; -extern char ru_if_types[MAX_RU_IF_TYPES][20]; +extern const char NB_functions[7][20]; +extern const char NB_timing[2][20]; +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; extern int16_t unscrambling_lut[65536*16]; extern uint8_t scrambling_lut[65536*16]; diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h index 569bec6851..2f2a0427f4 100644 --- a/openair1/PHY/phy_extern_nr_ue.h +++ b/openair1/PHY/phy_extern_nr_ue.h @@ -34,7 +34,7 @@ extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; //#include "PHY/LTE_TRANSPORT/transport_extern.h" -extern short conjugate[8],conjugate2[8]; +extern const short conjugate[8],conjugate2[8]; extern int number_of_cards; @@ -70,8 +70,8 @@ extern int flag_LA; extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; extern double sinr_bler_map_up[MCS_COUNT][2][16]; extern int table_length[MCS_COUNT]; -extern double sinr_to_cqi[4][16]; -extern int cqi_to_mcs[16]; +extern const double sinr_to_cqi[4][16]; +extern const int cqi_to_mcs[16]; //for MU-MIMO abstraction using MIESM //this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively @@ -79,23 +79,19 @@ extern double MI_map_4qam[3][162]; extern double MI_map_16qam[3][197]; extern double MI_map_64qam[3][227]; -extern double beta1_dlsch_MI[6][MCS_COUNT]; -extern double beta2_dlsch_MI[6][MCS_COUNT]; +extern const double beta1_dlsch_MI[6][MCS_COUNT]; +extern const double beta2_dlsch_MI[6][MCS_COUNT]; -extern double q_qpsk[8]; -extern double q_qam16[8]; -extern double q_qam64[8]; +extern const double q_qpsk[8]; +extern const double q_qam16[8]; +extern const double q_qam64[8]; -extern double p_qpsk[8]; -extern double p_qam16[8]; -extern double p_qam64[8]; +extern const double beta1_dlsch[6][MCS_COUNT]; +extern const double beta2_dlsch[6][MCS_COUNT]; -extern double beta1_dlsch[6][MCS_COUNT]; -extern double beta2_dlsch[6][MCS_COUNT]; - -extern char NB_functions[7][20]; -extern char NB_timing[2][20]; -extern char ru_if_types[MAX_RU_IF_TYPES][20]; +extern const char NB_functions[7][20]; +extern const char NB_timing[2][20]; +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; extern int16_t unscrambling_lut[65536*16]; extern uint8_t scrambling_lut[65536*16]; diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h index 4f9ed0f26b..622551c2fe 100644 --- a/openair1/PHY/phy_extern_ue.h +++ b/openair1/PHY/phy_extern_ue.h @@ -36,7 +36,7 @@ extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; extern int number_of_cards; -extern short conjugate[8],conjugate2[8]; +extern const short conjugate[8],conjugate2[8]; extern PHY_VARS_UE ***PHY_vars_UE_g; @@ -70,8 +70,8 @@ extern int flag_LA; extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; extern double sinr_bler_map_up[MCS_COUNT][2][16]; extern int table_length[MCS_COUNT]; -extern double sinr_to_cqi[4][16]; -extern int cqi_to_mcs[16]; +extern const double sinr_to_cqi[4][16]; +extern const int cqi_to_mcs[16]; //for MU-MIMO abstraction using MIESM //this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively @@ -79,23 +79,23 @@ extern double MI_map_4qam[3][162]; extern double MI_map_16qam[3][197]; extern double MI_map_64qam[3][227]; -extern double beta1_dlsch_MI[6][MCS_COUNT]; -extern double beta2_dlsch_MI[6][MCS_COUNT]; +extern const double beta1_dlsch_MI[6][MCS_COUNT]; +extern const double beta2_dlsch_MI[6][MCS_COUNT]; -extern double q_qpsk[8]; -extern double q_qam16[8]; -extern double q_qam64[8]; +extern const double q_qpsk[8]; +extern const double q_qam16[8]; +extern const double q_qam64[8]; -extern double p_qpsk[8]; -extern double p_qam16[8]; -extern double p_qam64[8]; +extern const double p_qpsk[8]; +extern const double p_qam16[8]; +extern const double p_qam64[8]; -extern double beta1_dlsch[6][MCS_COUNT]; -extern double beta2_dlsch[6][MCS_COUNT]; +extern const double beta1_dlsch[6][MCS_COUNT]; +extern const double beta2_dlsch[6][MCS_COUNT]; -extern char NB_functions[7][20]; -extern char NB_timing[2][20]; -extern char ru_if_types[MAX_RU_IF_TYPES][20]; +extern const char NB_functions[7][20]; +extern const char NB_timing[2][20]; +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; extern int16_t unscrambling_lut[65536*16]; extern uint8_t scrambling_lut[65536*16]; diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index 26540f6fc8..a74d148479 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -50,8 +50,8 @@ unsigned short rev[2048],rev_times4[8192],rev_half[1024]; unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; -short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; +const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; +const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; #include "SIMULATION/ETH_TRANSPORT/vars.h" @@ -84,29 +84,29 @@ double MI_map_16qam[3][197]; double MI_map_64qam[3][227]; // here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs -double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, +const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} }; //int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; -int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; +const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; //for SNR to MI conversion 7 th order Polynomial coeff -double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; -double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; -double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; +const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; +const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; +const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; //for MI to SNR conversion 7 th order Polynomial coeff -double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; -double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; -double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; +const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; +const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; +const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; // ideal CE MIESM -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; +const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; +const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; //real CE MIESM /* @@ -116,8 +116,8 @@ double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.8 //ideal channel estimation values //double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; //double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; -double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; +const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; +const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; //real channel estimation valus /* @@ -126,13 +126,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682 */ -#ifdef OCP_FRAMEWORK -#include -#else -char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; -char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; -#endif +const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; +const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; +const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; /// lookup table for unscrambling in RX int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h index bd077b5b0c..1843d8d5bc 100644 --- a/openair1/PHY/phy_vars_nr_ue.h +++ b/openair1/PHY/phy_vars_nr_ue.h @@ -49,8 +49,8 @@ unsigned short rev[2048],rev_times4[8192],rev_half[1024]; unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; -short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; +const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; +const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; #include "SIMULATION/ETH_TRANSPORT/vars.h" @@ -84,29 +84,29 @@ double MI_map_16qam[3][197]; double MI_map_64qam[3][227]; // here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs -double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, +const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} }; //int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; -int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; +const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; //for SNR to MI conversion 7 th order Polynomial coeff -double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; -double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; -double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; +const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; +const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; +const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; //for MI to SNR conversion 7 th order Polynomial coeff -double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; -double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; -double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; +const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; +const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; +const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; // ideal CE MIESM -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; +const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; +const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; //real CE MIESM /* @@ -116,8 +116,8 @@ double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.8 //ideal channel estimation values //double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; //double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; -double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; +const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; +const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; //real channel estimation valus /* @@ -126,13 +126,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682 */ -#ifdef OCP_FRAMEWORK -#include -#else -char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; -char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; -#endif +const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; +const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; +const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; /// lookup table for unscrambling in RX int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index 05f2e1b8f1..e90c2641aa 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#ifndef __PHY_VARS_H__ -#define __PHY_VARS_H__ +#ifndef __PHY_VARS_UE__H__ +#define __PHY_VARS_UE__H__ #include "PHY/types.h" #include "PHY/defs_UE.h" @@ -43,8 +43,8 @@ unsigned short rev[2048],rev_times4[8192],rev_half[1024]; unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; -short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; -short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; +const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; +const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; #include "SIMULATION/ETH_TRANSPORT/vars.h" @@ -77,29 +77,29 @@ double MI_map_16qam[3][197]; double MI_map_64qam[3][227]; // here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs -double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, +const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} }; //int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; -int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; +const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; //for SNR to MI conversion 7 th order Polynomial coeff -double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; -double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; -double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; +const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; +const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; +const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; //for MI to SNR conversion 7 th order Polynomial coeff -double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; -double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; -double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; +const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; +const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; +const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; // ideal CE MIESM -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; +const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; +const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; //real CE MIESM /* @@ -109,8 +109,8 @@ double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.8 //ideal channel estimation values //double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; //double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; -double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; -double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; +const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; +const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; //real channel estimation valus /* @@ -119,13 +119,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682 */ -#ifdef OCP_FRAMEWORK -#include -#else -char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; -char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; -#endif +const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",}; +const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; +const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; /// lookup table for unscrambling in RX int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); @@ -133,4 +129,4 @@ int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); uint8_t scrambling_lut[65536*16] __attribute__((aligned(32))); uint8_t max_turbo_iterations=4; -#endif /*__PHY_VARS_H__ */ +#endif /* __PHY_VARS_UE__H__ */ diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index ba03e79e62..fc9407f8d0 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1419,7 +1419,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes; // estimate timing advance for MAC - sync_pos = lte_est_timing_advance_pusch(eNB,UE_id); + sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[UE_id]->drs_ch_estimates_time); timing_advance_update = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check // if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);} diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 8846b77af9..cb03821388 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -693,12 +693,6 @@ void ru_fep_full_2thread(RU_t *ru, 3/(fp->symbols_per_tti/2),// Ns = slot number fp); - /*lte_ul_channel_estimation((PHY_VARS_eNB *)NULL, - proc, - ru->idx, - 3%(fp->symbols_per_tti/2), - 3/(fp->symbols_per_tti/2)); - */ lte_ul_channel_estimation_RRU(fp, calibration->drs_ch_estimates, calibration->drs_ch_estimates_time, @@ -713,7 +707,7 @@ void ru_fep_full_2thread(RU_t *ru, 0,//interpolate, 0 /*eNB->ulsch[ru->idx]->rnti rnti or ru->ulsch[eNB_id]->rnti*/); - check_sync_pos = lte_est_timing_advance_pusch((PHY_VARS_eNB *)NULL, ru->idx); + check_sync_pos = lte_est_timing_advance_pusch(ru->frame_parms, ru->calibration.drs_ch_estimates_time); if (ru->state == RU_CHECK_SYNC) { if ((check_sync_pos >= 0 && check_sync_pos<8) || (check_sync_pos < 0 && check_sync_pos>-8)) { LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index dccb7fab27..ddebcc3e06 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -31,7 +31,6 @@ */ #include "fapi_nr_l1.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_dci.h" diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 88ee2832cc..a5d459a7c6 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -32,7 +32,7 @@ #include "PHY/defs_gNB.h" #include "PHY/phy_extern.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "nfapi_nr_interface_scf.h" #include "fapi_nr_l1.h" #include "nfapi_pnf.h" @@ -77,7 +77,6 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot, } } - rx_nr_prach(gNB, prach_pdu, frame, diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index a36cebd6ae..0ccb13fc7c 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -369,6 +369,73 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) } } +/******************************************************************* +* +* NAME : nr_ue_slot_select +* +* DESCRIPTION : function for the UE equivalent to nr_slot_select +* +*********************************************************************/ + +int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti) { + /* for FFD all slot can be considered as an uplink */ + int mu = cfg->ssb_config.scs_common, check_slot = 0; + + if (cfg->cell_config.frame_duplex_type == FDD) { + return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT); + } + + if (nr_frame%2 == 0) { + for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) { + check_slot++; + } + } + + if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) { + return (NR_UPLINK_SLOT); + } + + check_slot = 0; + + for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config == 0) { + check_slot++; + } + } + + if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) { + return (NR_DOWNLINK_SLOT); + } else { + return (NR_MIXED_SLOT); + } + } else { + for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[((1<tdd_table.max_tdd_periodicity_list[((1< /************** DEFINE ********************************************/ #define TDD_CONFIG_NB_FRAMES (2) @@ -79,6 +80,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); @returns nr_slot_t : downlink or uplink */ nr_slot_t nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti); +int nr_ue_slot_select(fapi_nr_config_request_t *cfg, int nr_frame, int nr_tti); /** \brief This function frees tdd configuration for nr * @param frame_parms NR DL Frame parameters diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 2439c7ef1a..01e0c419db 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -23,7 +23,6 @@ #include "PHY/defs_gNB.h" #include "sched_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" @@ -267,6 +266,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH G); stop_meas(&gNB->ulsch_decoding_stats); + if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations){ LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id); nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); @@ -382,7 +382,6 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { - LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx); for (int i=0;irnti > 0)) { + (ulsch->rnti > 0)) { // for for an active HARQ process for (harq_pid=0;harq_pidharq_processes[harq_pid]; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index d8e2db7f01..e41bdd4ccc 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -53,8 +53,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // Note: we have to handle the thread IDs for this. To be revisited completely. thread_id = PHY_vars_UE_g[module_id][cc_id]->current_thread_id[slot]; + NR_UE_DLSCH_t *dlsch0 = NULL; NR_UE_PDCCH *pdcch_vars = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0]; - NR_UE_DLSCH_t *dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0]; NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0]; NR_DL_FRAME_PARMS frame_parms = PHY_vars_UE_g[module_id][cc_id]->frame_parms; PRACH_RESOURCES_t *prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[0]; @@ -77,7 +77,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1; LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space); - } else { //FAPI_NR_DL_CONFIG_TYPE_DLSCH + } else { + + if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){ + dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0]; + } + else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){ + dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0]; + } fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr; @@ -88,7 +95,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti; //dlsch0->harq_processes[0]->mcs = &dlsch_config_pdu->mcs; dlsch0_harq = dlsch0->harq_processes[current_harq_pid]; - if (dlsch0_harq != NULL){ + + if (dlsch0_harq){ + dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart; dlsch0_harq->BWPSize = dlsch_config_pdu->BWPSize; dlsch0_harq->nb_rb = dlsch_config_pdu->number_rbs; @@ -105,6 +114,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0_harq->Nl=1; dlsch0_harq->mcs_table=0; dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type); + dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai; LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs); } } @@ -121,10 +131,10 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type, pucch_resource_id, current_harq_pid, format, gNB_id = 0; /* PRACH */ - NR_PRACH_RESOURCES_t *prach_resources; + //NR_PRACH_RESOURCES_t *prach_resources; fapi_nr_ul_config_prach_pdu *prach_config_pdu; /* PUSCH */ - fapi_nr_ul_config_pusch_pdu_rel15_t *pusch_config_pdu; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu; /* PUCCH */ fapi_nr_ul_config_pucch_pdu *pucch_config_pdu; PUCCH_ConfigCommon_nr_t *pucch_config_common_nr; @@ -135,17 +145,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ case (FAPI_NR_UL_CONFIG_TYPE_PUSCH): // pusch config pdu - pusch_config_pdu = &ul_config->ul_config_list[i].ulsch_config_pdu.ulsch_pdu_rel15; - current_harq_pid = pusch_config_pdu->harq_process_nbr; - ulsch0->harq_processes[current_harq_pid]->nb_rb = pusch_config_pdu->number_rbs; - ulsch0->harq_processes[current_harq_pid]->first_rb = pusch_config_pdu->start_rb; - ulsch0->harq_processes[current_harq_pid]->number_of_symbols = pusch_config_pdu->number_symbols; - ulsch0->harq_processes[current_harq_pid]->start_symbol = pusch_config_pdu->start_symbol; - ulsch0->harq_processes[current_harq_pid]->mcs = pusch_config_pdu->mcs; - ulsch0->harq_processes[current_harq_pid]->DCINdi = pusch_config_pdu->ndi; - ulsch0->harq_processes[current_harq_pid]->rvidx = pusch_config_pdu->rv; - ulsch0->harq_processes[current_harq_pid]->Nl = pusch_config_pdu->n_layers; + pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; + current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; + nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch0->harq_processes[current_harq_pid]->pusch_pdu; + + memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); + ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; + ulsch0->harq_processes[current_harq_pid]->status = ACTIVE; break; case (FAPI_NR_UL_CONFIG_TYPE_PUCCH): @@ -194,7 +201,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ case (FAPI_NR_UL_CONFIG_TYPE_PRACH): // prach config pdu - prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[gNB_id]; + //prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[gNB_id]; prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu; memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu)); PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_Config_enabled = 1; @@ -216,6 +223,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ } + + int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){ fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config; diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 31dcfcacbe..3c3017d658 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -296,7 +296,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u /* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */ if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */ ulsch->harq_processes[harq_pid]->first_tx = 0; - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; @@ -306,8 +306,8 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u } /* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */ /* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */ - else if ((ulsch->harq_processes[harq_pid]->DCINdi != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */ - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ + else if ((ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; @@ -317,7 +317,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u } /* 38.321 5.4.2.1 2> else (i.e. retransmission): */ else { - ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* ndi has not toggled si this is a retransmission */ + ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* ndi has not toggled si this is a retransmission */ ulsch->harq_processes[harq_pid]->round++; /* increment number of retransmission */ result_harq = RETRANSMISSION_HARQ; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index d05dde4667..dae6229657 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -88,17 +88,6 @@ char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; extern double cpuf; - - -int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, - uint32_t frame, - uint32_t slot); - -uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, - int frame, - int nr_tti_rx, - fapi_nr_dci_indication_t *dci_ind); - /* int nr_generate_ue_ul_dlsch_params_from_dci(PHY_VARS_NR_UE *ue, uint8_t eNB_id, @@ -1303,7 +1292,7 @@ void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_com PHY_vars_UE_g[Mod_id][CC_id]->timing_advance += (ta_command - 31) * bw_scaling / factor_mu; - LOG_D(PHY, "[UE %d] Got timing advance command %u from MAC, new value is %u\n", Mod_id, ta_command, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance); + LOG_D(PHY, "[UE %d] Got timing advance command %u from MAC, new value is %d\n", Mod_id, ta_command, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance); } // WIP @@ -2238,6 +2227,8 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); + memset(ue->common_vars.txdataF[0], 0, sizeof(int)*14*ue->frame_parms.ofdm_symbol_size); + LOG_I(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); #if UE_TIMING_TRACE @@ -2245,7 +2236,9 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, #endif if (ue->UE_mode[gNB_id] == PUSCH || get_softmodem_params()->phy_test == 1){ - nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, thread_id, gNB_id); + if (ue->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE) + nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, thread_id, gNB_id); + /* if (ue->UE_mode[eNB_id] == PUSCH) { @@ -2256,11 +2249,13 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, } // UE_mode==PUSCH */ - LOG_D(PHY, "Sending PUCCH\n"); - pucch_procedures_ue_nr(ue, - gNB_id, - proc, - TRUE); + if (get_softmodem_params()->do_ra==1) { + LOG_D(PHY, "Sending PUCCH\n"); + pucch_procedures_ue_nr(ue, + gNB_id, + proc, + TRUE); + } LOG_D(PHY, "Sending data \n"); nr_ue_pusch_common_procedures(ue, @@ -2277,9 +2272,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) { nr_ue_prach_procedures(ue, proc, gNB_id, mode); } - else { - ue->prach_resources[gNB_id]->generate_nr_prach = 0; - } } LOG_I(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); @@ -2490,8 +2482,11 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ue->pbch_vars[gNB_id]->pdu_errors_conseq = 0; // Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed - if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1) + if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){ ue->UE_mode[gNB_id] = PRACH; + ue->prach_resources[gNB_id]->sync_frame = frame_rx; + ue->prach_resources[gNB_id]->init_msg1 = 0; + } #ifdef DEBUG_PHY_PROC uint16_t frame_tx; @@ -2787,11 +2782,12 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, //LOG_D(PHY,"[UE %d][PUSCH] Frame %d nr_tti_rx %d PHICH RX\n",ue->Mod_id,frame_rx,nr_tti_rx); for (int i=0; i rnti %x : format %d\n", - ue->Mod_id,frame_rx%1024,nr_tti_rx,nr_mode_string[ue->UE_mode[gNB_id]], - i, - dci_ind.dci_list[i].rnti, - dci_ind.dci_list[i].dci_format); + LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d, Mode %s: DCI %i of %d total DCIs found --> rnti %x : format %d\n", + ue->Mod_id,frame_rx%1024,nr_tti_rx,nr_mode_string[ue->UE_mode[gNB_id]], + i + 1, + dci_cnt, + dci_ind.dci_list[i].rnti, + dci_ind.dci_list[i].dci_format); } ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dci_received += dci_cnt; @@ -3040,7 +3036,7 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB int first_symbol_flag=0; if (!dlsch0) - return; + return; if (dlsch0->active == 0) return; @@ -3049,9 +3045,9 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB uint16_t BWPStart = dlsch0->harq_processes[harq_pid]->BWPStart; // uint16_t BWPSize = dlsch0->harq_processes[harq_pid]->BWPSize; uint16_t pdsch_start_rb = dlsch0->harq_processes[harq_pid]->start_rb; - uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; - uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol; - uint16_t s1 = dlsch0->harq_processes[harq_pid]->nb_symbols; + uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; + uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol; + uint16_t s1 = dlsch0->harq_processes[harq_pid]->nb_symbols; LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_tti_rx %d, harq_pid %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_tti_rx,harq_pid,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos); @@ -3101,7 +3097,17 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB dlsch0->current_harq_pid); else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) if (pdsch == RA_PDSCH) ue->pdsch_vars_ra[eNB_id]->llr_offset[m]=ue->pdsch_vars_ra[eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; + else if (pdsch == PDSCH) nr_rx_pdsch(ue, + pdsch, + eNB_id, + eNB_id_i, + proc->frame_rx, + nr_tti_rx, // nr_tti_rx, + m, + first_symbol_flag, + dual_stream_UE, + i_mod, + dlsch0->current_harq_pid); else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]); @@ -3285,9 +3291,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, NR_UE_PDSCH *pdsch_vars; uint8_t is_cw0_active = 0; uint8_t is_cw1_active = 0; - //nfapi_nr_config_request_t *cfg = &ue->nrUE_config; - //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value; - uint8_t nb_re_dmrs = 12; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; + nfapi_nr_config_request_t *cfg = &ue->nrUE_config; + uint8_t dmrs_type = cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_mappingType[0].value; // TODO: HARDCODED pdsch index + uint8_t nb_re_dmrs = (dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; // TODO: should changed my mac uint16_t length_dmrs = 1; //cfg->pdsch_config.dmrs_max_length.value; uint16_t nb_symb_sch = 9; nr_downlink_indication_t dl_indication; @@ -3310,14 +3316,11 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, if (dlsch0==NULL) AssertFatal(0,"dlsch0 should be defined at this level \n"); - harq_pid = dlsch0->current_harq_pid; is_cw0_active = dlsch0->harq_processes[harq_pid]->status; nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol; - - if(dlsch1) is_cw1_active = dlsch1->harq_processes[harq_pid]->status; @@ -3384,10 +3387,10 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_unscrambling_stats); #endif nr_dlsch_unscrambling(pdsch_vars->llr[0], - dlsch0->harq_processes[harq_pid]->G, - 0, - ue->frame_parms.Nid_cell, - dlsch0->rnti); + dlsch0->harq_processes[harq_pid]->G, + 0, + ue->frame_parms.Nid_cell, + dlsch0->rnti); #if UE_TIMING_TRACE @@ -3468,10 +3471,10 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_unscrambling_stats); #endif nr_dlsch_unscrambling(pdsch_vars->llr[1], - dlsch1->harq_processes[harq_pid]->G, - 0, - ue->frame_parms.Nid_cell, - dlsch1->rnti); + dlsch1->harq_processes[harq_pid]->G, + 0, + ue->frame_parms.Nid_cell, + dlsch1->rnti); #if UE_TIMING_TRACE stop_meas(&ue->dlsch_unscrambling_stats); #endif @@ -3492,31 +3495,31 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, #ifdef UE_DLSCH_PARALLELISATION ret1 = nr_dlsch_decoding_mthread(ue, - proc, - eNB_id, - pdsch_vars->llr[1], - &ue->frame_parms, - dlsch1, - dlsch1->harq_processes[harq_pid], - frame_rx, - nb_symb_sch, - nr_tti_rx, - harq_pid, - pdsch==PDSCH?1:0, - dlsch1->harq_processes[harq_pid]->TBS>256?1:0); + proc, + eNB_id, + pdsch_vars->llr[1], + &ue->frame_parms, + dlsch1, + dlsch1->harq_processes[harq_pid], + frame_rx, + nb_symb_sch, + nr_tti_rx, + harq_pid, + pdsch==PDSCH?1:0, + dlsch1->harq_processes[harq_pid]->TBS>256?1:0); LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret1 = %d\n", ret1); #else ret1 = nr_dlsch_decoding(ue, - pdsch_vars->llr[1], - &ue->frame_parms, - dlsch1, - dlsch1->harq_processes[harq_pid], - frame_rx, - nb_symb_sch, - nr_tti_rx, - harq_pid, - pdsch==PDSCH?1:0,//proc->decoder_switch, - dlsch1->harq_processes[harq_pid]->TBS>256?1:0); + pdsch_vars->llr[1], + &ue->frame_parms, + dlsch1, + dlsch1->harq_processes[harq_pid], + frame_rx, + nb_symb_sch, + nr_tti_rx, + harq_pid, + pdsch==PDSCH?1:0,//proc->decoder_switch, + dlsch1->harq_processes[harq_pid]->TBS>256?1:0); LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret1 = %d\n", ret1); printf("start cw1 dlsch decoding\n"); #endif @@ -3538,45 +3541,46 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, #endif LOG_I(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", frame_rx%1024, nr_tti_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[nr_tti_rx]].p_time)/(cpuf*1000.0)); + + LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_tti_rx); - - LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d, TBS expected dlsch1: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS, dlsch1->harq_processes[harq_pid]->TBS); + LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS); if(retmax_ldpc_iterations+1){ - // fill dl_indication message - dl_indication.module_id = ue->Mod_id; - dl_indication.cc_id = ue->CC_id; - dl_indication.gNB_index = eNB_id; - dl_indication.frame = frame_rx; - dl_indication.slot = nr_tti_rx; - dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance - dl_indication.proc=proc; + // fill dl_indication message + dl_indication.module_id = ue->Mod_id; + dl_indication.cc_id = ue->CC_id; + dl_indication.gNB_index = eNB_id; + dl_indication.frame = frame_rx; + dl_indication.slot = nr_tti_rx; + dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance + dl_indication.proc=proc; - //dl_indication.rx_ind->number_pdus - switch (pdsch) { - case RA_PDSCH: - rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR; - break; - case PDSCH: - rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH; - break; - default: - break; - } + //dl_indication.rx_ind->number_pdus + switch (pdsch) { + case RA_PDSCH: + rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR; + break; + case PDSCH: + rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH; + break; + default: + break; + } - rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; - rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3; - LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); - rx_ind.number_pdus = 1; + rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; + rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3; + LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); + rx_ind.number_pdus = 1; - //ue->dl_indication.rx_ind = &dlsch1->harq_processes[harq_pid]->b; //no data, only dci for now - dl_indication.dci_ind = NULL; //&ue->dci_ind; - // send to mac - if (ue->if_inst && ue->if_inst->dl_indication) - ue->if_inst->dl_indication(&dl_indication, ul_time_alignment); + //ue->dl_indication.rx_ind = &dlsch1->harq_processes[harq_pid]->b; //no data, only dci for now + dl_indication.dci_ind = NULL; //&ue->dci_ind; + // send to mac + if (ue->if_inst && ue->if_inst->dl_indication) + ue->if_inst->dl_indication(&dl_indication, ul_time_alignment); } // TODO CRC check for CW0 @@ -3894,7 +3898,6 @@ void *UE_thread_slot1_dl_processing(void *arg) { } //printf("[slot1 dl processing] AbsSubframe %d.%d LLR Computation Start wait DCI %d\n",frame_rx,nr_tti_rx,wait); - /**** Pdsch Procedure Slot1 ****/ // start slot1 thread for Pdsch Procedure (slot1) // do procedures for C-RNTI @@ -3982,7 +3985,6 @@ void *UE_thread_slot1_dl_processing(void *arg) { #endif #endif - if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); exit_fun("noting to add"); @@ -4031,18 +4033,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, int nr_tti_rx = proc->nr_tti_rx; int slot_pbch; NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; - NR_UE_DLSCH_t **dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id]; fapi_nr_config_request_t *cfg = &ue->nrUE_config; - uint8_t *harq_pid = &ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->current_harq_pid; - NR_DL_UE_HARQ_t *dlsch0_harq = dlsch[0]->harq_processes[*harq_pid]; - uint16_t nb_symb_sch = dlsch0_harq->nb_symbols; - uint16_t start_symb_sch = dlsch0_harq->start_symbol; + uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - + LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx); /* @@ -4050,7 +4048,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); */ - int coreset_nb_rb=0; int coreset_start_rb=0; if (pdcch_vars->nb_search_space > 0) @@ -4085,11 +4082,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if (ue->no_timing_correction==0) { LOG_I(PHY,"start adjust sync slot = %d no timing %d\n", nr_tti_rx, ue->no_timing_correction); nr_adjust_synch_ue(fp, - ue, - eNB_id, - nr_tti_rx, - 0, - 16384); + ue, + eNB_id, + frame_rx, + nr_tti_rx, + 0, + 16384); } } @@ -4104,10 +4102,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, #endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); nr_slot_fep(ue, - l, - nr_tti_rx, - 0, - 0); + l, + nr_tti_rx, + 0, + 0); // note: this only works if RBs for PDCCH are contigous! LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", @@ -4134,41 +4132,41 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if (dci_cnt > 0) { - LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n",ue->Mod_id,frame_rx,nr_tti_rx,dci_cnt); + LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_tti_rx, dci_cnt); - } else { - LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: No DCIs found\n",ue->Mod_id,frame_rx,nr_tti_rx); - } -#endif //NR_PDCCH_SCHED + NR_UE_DLSCH_t *dlsch = NULL; + if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1){ + dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]; + } else if (ue->dlsch_ra[0]->active == 1){ + dlsch = ue->dlsch_ra[0]; + } + AssertFatal(dlsch != NULL, "Unsupported mode\n"); + uint8_t harq_pid = dlsch->current_harq_pid; + NR_DL_UE_HARQ_t *dlsch0_harq = dlsch->harq_processes[harq_pid]; + uint16_t nb_symb_sch = dlsch0_harq->nb_symbols; + uint16_t start_symb_sch = dlsch0_harq->start_symbol; + int symb_dmrs = -1; - - if (dci_cnt > 0){ LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx); //to update from pdsch config - dlsch0_harq = dlsch[0]->harq_processes[*harq_pid]; - start_symb_sch = dlsch0_harq->start_symbol; - int symb_dmrs=-1; + for (int i=0;i<4;i++) if (((1<dlDmrsSymbPos) > 0) {symb_dmrs=i;break;} AssertFatal(symb_dmrs>=0,"no dmrs in 0..3\n"); LOG_D(PHY,"Initializing dmrs for symb %d DMRS mask %x\n",symb_dmrs,dlsch0_harq->dlDmrsSymbPos); nr_gold_pdsch(ue,symb_dmrs,0, 1); - - nb_symb_sch = dlsch0_harq->nb_symbols; for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){ nr_slot_fep(ue, - m, //to be updated from higher layer - nr_tti_rx, - 0, - 0); - - + m, //to be updated from higher layer + nr_tti_rx, + 0, + 0); } - //set active for testing, to be removed - ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 1; + } else { + LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: No DCIs found\n", ue->Mod_id, frame_rx, nr_tti_rx); } - else - ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 0; + +#endif //NR_PDCCH_SCHED #if UE_TIMING_TRACE start_meas(&ue->generic_stat); @@ -4182,7 +4180,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, PDSCH, ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0], NULL); - + //printf("phy procedure pdsch start measurement\n"); nr_ue_measurement_procedures(2,ue,proc,eNB_id,nr_tti_rx,mode); @@ -4194,7 +4192,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1); write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0); */ - + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } @@ -4263,7 +4261,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1) { - + LOG_D(PHY, "DLSCH data reception at nr_tti_rx: %d \n \n", nr_tti_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); @@ -4293,6 +4291,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, #endif + // deactivate dlsch once dlsch proc is done + ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 0; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } @@ -4509,6 +4510,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t uint8_t mod_id = ue->Mod_id; UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id); NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id]; + uint8_t nr_prach = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN); @@ -4517,7 +4519,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t prach_resources->ra_TDD_map_index = 0; prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10; prach_resources->ra_RNTI = 0x1234; - prach_resources->generate_nr_prach = 1; + nr_prach = 1; } else { // ask L2 for RACH transport if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) { @@ -4528,13 +4530,17 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->ulsch_Msg3_active[i] = 0; } } - nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx); + nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx); } } - if (ue->prach_resources[gNB_id] != NULL && prach_resources->generate_nr_prach == 1) { - + if (!prach_resources->init_msg1 && (frame_tx > ue->prach_resources[gNB_id]->sync_frame + 150)){ ue->prach_cnt = 0; + prach_resources->init_msg1 = 1; + } + + if (ue->prach_resources[gNB_id] != NULL && nr_prach == 1 && prach_resources->init_msg1) { + pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id); LOG_D(PHY,"runmode %d\n",runmode); @@ -4542,7 +4548,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->tx_power_dBm[nr_tti_tx] = prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER + pathloss; } - LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_tti_tx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %d\n", + LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_tti_tx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x\n", ue->Mod_id, frame_tx, nr_tti_tx, @@ -4594,18 +4600,18 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t prach_resources->ra_PreambleIndex, ue->tx_power_dBm[nr_tti_tx], pathloss); + + LOG_D(PHY,"[UE %d] frame %d nr_tti_tx %d : prach_cnt %d\n", ue->Mod_id, frame_tx, nr_tti_tx, ue->prach_cnt); + + ue->prach_cnt++; + + if (ue->prach_cnt == 3) + ue->prach_cnt = 0; } // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue if (runmode == calib_prach_tx) ue->prach_resources[gNB_id] = NULL; - LOG_D(PHY,"[UE %d] frame %d nr_tti_tx %d : generate_nr_prach %d, prach_cnt %d\n", ue->Mod_id, frame_tx, nr_tti_tx, ue->prach_resources[gNB_id]->generate_nr_prach, ue->prach_cnt); - - ue->prach_cnt++; - - if (ue->prach_cnt == 3) - prach_resources->generate_nr_prach = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); } diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index de6605b08d..4b2ee9a3a1 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -347,7 +347,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ /**********************************************/ else if ((pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) && (pucch_resource_id != MAX_NB_OF_PUCCH_RESOURCES)) { /* check that current configuration is supported */ - if ((mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH[0] != FALSE) + if ((mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL) || (mac->scg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) { LOG_E(PHY,"PUCCH Unsupported cell group configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); return(FALSE); @@ -356,11 +356,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ LOG_E(PHY,"PUCCH Unsupported code block group for serving cell config : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); return(FALSE); } - pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id]; + pucch_resource = select_resource_by_id(pucch_resource_id, mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup); format = pucch_resource->format.present; nb_symbols_total = get_nb_symbols_pucch(pucch_resource, format); - starting_symbol_index = pucch_resource->startingPRB; - starting_prb = get_starting_symb_idx(pucch_resource, format); + starting_symbol_index = get_starting_symb_idx(pucch_resource, format); + starting_prb = pucch_resource->startingPRB; second_hop = starting_prb; if (format==pucch_format1_nr) time_domain_occ = pucch_resource->format.choice.format1->timeDomainOCC; @@ -580,7 +580,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ { nr_generate_pucch0(ue,ue->common_vars.txdataF, &ue->frame_parms, - &ue->pucch_config_dedicated[gNB_id], + mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping, + mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0], tx_amp, nr_tti_tx, (uint8_t)m_0, @@ -743,7 +744,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t } else { - dai_current = harq_status->vDAI_DL; + dai_current = harq_status->vDAI_DL+1; // DCI DAI to counter DAI conversion if (dai_current == 0) { LOG_E(PHY,"PUCCH Downlink dai is invalid : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); @@ -756,11 +757,11 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t ack_data[code_word][dai_current - 1] = harq_status->ack; dai[code_word][dai_current - 1] = dai_current; } + if (do_reset == TRUE) { + init_downlink_harq_status(ue->dlsch[thread_idx][gNB_id][code_word]->harq_processes[dl_harq_pid]); + } } } - if (do_reset == TRUE) { - init_downlink_harq_status(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]); - } } } @@ -779,7 +780,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t U_DAI_c = number_harq_feedback/number_of_code_word; N_m_c_rx = number_harq_feedback; int N_SPS_c = 0; /* FFS TODO_NR multicells and SPS are not supported at the moment */ - if (mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH[0] == FALSE) { + if (mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH == NULL) { int N_TB_max_DL = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0]; *n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c; NR_TST_PHY_PRINTF("PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", *n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx); @@ -1094,31 +1095,33 @@ boolean_t check_pucch_format(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, pucch_format pucch_format_nr_t selected_pucch_format_second; NR_SetupRelease_PUCCH_FormatConfig_t *identified_format; - switch (format_pucch) { - case pucch_format1_nr: - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) - identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1; - break; + if (format_pucch != pucch_format0_nr) { + switch (format_pucch) { + case pucch_format1_nr: + if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) + identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1; + break; - case pucch_format2_nr: - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2 != NULL) - identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2; - break; + case pucch_format2_nr: + if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2 != NULL) + identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2; + break; - case pucch_format3_nr: - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3 != NULL) - identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3; - break; + case pucch_format3_nr: + if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3 != NULL) + identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3; + break; - case pucch_format4_nr: - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4 != NULL) - identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4; - break; - } + case pucch_format4_nr: + if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4 != NULL) + identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4; + break; + } - if (identified_format->choice.setup->nrofSlots != 1) { - LOG_E(PHY,"PUCCH not implemented multislots transmission : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); - return (FALSE); + if (identified_format->choice.setup->nrofSlots != 1) { + LOG_E(PHY,"PUCCH not implemented multislots transmission : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + return (FALSE); + } } if (nb_symbols_for_tx <= 2) { @@ -1320,3 +1323,17 @@ int get_ics_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_ } } +NR_PUCCH_Resource_t *select_resource_by_id(int resource_id, NR_PUCCH_Config_t *pucch_config) +{ + int n_list = pucch_config->resourceToAddModList->list.count; + NR_PUCCH_Resource_t *pucchres; + AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n"); + + for (int i=0; iresourceToAddModList->list.array[i]; + if (pucchres->pucch_ResourceId == resource_id) + return pucchres; + } + return NULL; +} + diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 8fea1d5ab3..089fae9f55 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -240,4 +240,6 @@ uint8_t get_nb_symbols_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_n uint16_t get_starting_symb_idx(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type); int get_ics_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type); + +NR_PUCCH_Resource_t *select_resource_by_id(int resource_id, NR_PUCCH_Config_t *pucch_config); #endif /* PUCCH_UCI_UE_NR_H */ diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.h b/openair1/SIMULATION/ETH_TRANSPORT/socket.h index c7a2224375..e9ca36bee2 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/socket.h +++ b/openair1/SIMULATION/ETH_TRANSPORT/socket.h @@ -28,8 +28,9 @@ * \email: lionel.gauthier@eurecom.fr */ -#ifndef __SOCKET_H__ -# define __SOCKET_H__ +#ifndef __SIMULATION_ETH_TRANSPORT_SOCKET__H__ +#define __SIMULATION_ETH_TRANSPORT_SOCKET__H__ + # ifdef SOCKET_C # define private_socket(x) x # define public_socket(x) x diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index fedf9394da..9374050e58 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -40,7 +40,7 @@ #include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "SCHED_NR/sched_nr.h" #include "openair1/SIMULATION/TOOLS/sim.h" @@ -66,6 +66,8 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; +void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} + int main(int argc, char **argv) { char c; @@ -428,7 +430,7 @@ int main(int argc, char **argv) uint8_t is_crnti = 0, llr8_flag = 0; unsigned int TBS = 8424; unsigned int available_bits; - uint8_t nb_re_dmrs = 12; // No data in dmrs symbol + uint8_t nb_re_dmrs = 6; // No data in dmrs symbol uint16_t length_dmrs = 1; unsigned char mod_order; uint16_t rate; @@ -455,6 +457,7 @@ int main(int argc, char **argv) rel15->dmrsConfigType = NFAPI_NR_DMRS_TYPE1; rel15->dlDmrsSymbPos = 4; rel15->mcsIndex[0] = Imcs; + rel15->numDmrsCdmGrpsNoData = 1; double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384); short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index a50ff371df..c289c7dd84 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -41,7 +41,7 @@ #include "PHY/MODULATION/modulation_UE.h" #include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "SCHED_NR/fapi_nr_l1.h" #include "SCHED_NR/sched_nr.h" @@ -211,7 +211,7 @@ int main(int argc, char **argv) FILE *scg_fd=NULL; - while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:")) != -1) { + while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:w")) != -1) { switch (c) { case 'f': scg_fd = fopen(optarg,"r"); @@ -394,6 +394,10 @@ int main(int argc, char **argv) eff_tp_check = (float)atoi(optarg)/100; break; + case 'w': + output_fd = fopen("txdata.dat", "w+"); + break; + default: case 'h': printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", @@ -425,6 +429,7 @@ int main(int argc, char **argv) printf("-e MSC index\n"); printf("-t Acceptable effective throughput (in percentage)\n"); printf("-P Print DLSCH performances\n"); + printf("-w Write txdata to binary file (one frame)\n"); exit (-1); break; } @@ -731,11 +736,11 @@ int main(int argc, char **argv) NR_UE_DLSCH_t *dlsch0 = UE->dlsch[UE->current_thread_id[UE_proc.nr_tti_rx]][0][0]; - int harq_pid = dlsch0->current_harq_pid; + int harq_pid = slot; NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid]; NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0]; - nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_processes[slot]->pdsch_pdu.pdsch_pdu_rel15; UE_harq_process->harq_ack.ack = 0; round = 0; @@ -747,10 +752,11 @@ int main(int argc, char **argv) memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int)); clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot); - UE_list->UE_sched_ctrl[0].harq_processes[0].ndi = !(trial&1); + UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].ndi = !(trial&1); - UE_list->UE_sched_ctrl[0].harq_processes[0].round = round; - gNB->dlsch[0][0]->harq_processes[0]->round = round; + UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].round = round; + UE_list->UE_sched_ctrl[0].current_harq_pid = harq_pid; + gNB->dlsch[0][0]->harq_processes[harq_pid]->round = round; if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config); else nr_schedule_css_dlsch_phytest(0,frame,slot); @@ -802,8 +808,10 @@ int main(int argc, char **argv) if (gNB->frame_parms.nb_antennas_tx>1) LOG_M("txsig1.m","txs1", txdata[1],frame_length_complex_samples,1,1); } - if (output_fd) + if (output_fd) { + printf("writing txdata to binary file\n"); fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd); + } int txlev = signal_energy(&txdata[0][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); @@ -858,7 +866,7 @@ int main(int argc, char **argv) NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE->current_thread_id[UE_proc.nr_tti_rx]]; int16_t *UE_llr = pdsch_vars[0]->llr[0]; - TBS = rel15->TBSize[0]; + TBS = UE_harq_process->TBS;//rel15->TBSize[0]; uint16_t length_dmrs = 1; uint16_t nb_rb = rel15->rbSize; uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4; @@ -897,7 +905,7 @@ int main(int argc, char **argv) if (errors_scrambling > 0) { if (n_trials == 1) - printf("errors_scrambling = %d/%d (trial %d)\n", errors_scrambling, available_bits,trial); + printf("errors_scrambling = %u/%u (trial %d)\n", errors_scrambling, available_bits,trial); } if (errors_bit > 0) { @@ -1019,6 +1027,8 @@ int main(int argc, char **argv) if (input_fd) fclose(input_fd); + if (scg_fd) + fclose(scg_fd); return(n_errors); } diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c index e62155e54e..bfb9150868 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c @@ -91,7 +91,7 @@ void nr_get_prach_resources(module_id_t mod_id, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon; // NR_BeamFailureRecoveryConfig_t *beam_failure_recovery_config = &mac->RA_BeamFailureRecoveryConfig; // todo - int messagePowerOffsetGroupB, messageSizeGroupA, PLThreshold, sizeOfRA_PreamblesGroupA, numberOfRA_Preambles, i, deltaPreamble_Msg3; + int messagePowerOffsetGroupB = 0, messageSizeGroupA, PLThreshold, sizeOfRA_PreamblesGroupA, numberOfRA_Preambles, i, deltaPreamble_Msg3 = 0; uint8_t noGroupB = 0, s_id, f_id, ul_carrier_id, msg1_FDM, prach_ConfigIndex, SFN_nbr, Msg3_size; // NR_RSRP_Range_t rsrp_ThresholdSSB; // todo diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 9d14391f71..2144652f86 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -37,7 +37,7 @@ #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "PHY/phy_vars.h" @@ -62,6 +62,8 @@ uint16_t NB_UE_INST = 1; openair0_config_t openair0_cfg[MAX_CARDS]; uint64_t get_softmodem_optmask(void) {return 0;} +void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} + void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, int N_RB_DL, int N_RB_UL, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 5187ac23b8..5d514a741f 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -41,8 +41,8 @@ #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "nr_unitary_defs.h" #include "OCG_vars.h" @@ -173,21 +173,27 @@ int main(int argc, char **argv){ case 'H': channel_model=Rayleigh8; + break; case 'I': channel_model=Rayleigh1; + break; case 'J': channel_model=Rayleigh1_corr; + break; case 'K': channel_model=Rayleigh1_anticorr; + break; case 'L': channel_model=Rice8; + break; case 'M': channel_model=Rice1; + break; case 'N': channel_model=Rayleigh1_800; @@ -530,6 +536,7 @@ int main(int argc, char **argv){ printf("raPreamble %d\n",preamble_tx); UE->prach_resources[0]->ra_PreambleIndex = preamble_tx; + UE->prach_resources[0]->init_msg1 = 1; // Configure channel bw = N_RB_UL*(180e3)*(1 << frame_parms->numerology_index); @@ -684,10 +691,10 @@ int main(int argc, char **argv){ } } } else { - n_bytes = fread(&ru->common.rxdata[0][rx_prach_start+frame_parms->samples_per_subframe/2],sizeof(int32_t),frame_parms->samples_per_subframe/2,input_fd); + n_bytes = fread(&ru->common.rxdata[0][rx_prach_start],sizeof(int32_t),frame_parms->samples_per_subframe,input_fd); printf("fread %d bytes from file %s\n",n_bytes,input_file); - if (n_bytes!=frame_parms->samples_per_subframe/2) { - printf("expected %d bytes\n",frame_parms->samples_per_subframe/2); + if (n_bytes!=frame_parms->samples_per_subframe) { + printf("expected %d bytes\n",frame_parms->samples_per_subframe); exit(-1); } } @@ -721,11 +728,13 @@ int main(int argc, char **argv){ #endif } } + printf("SNR %f dB, UE Speed %f km/h: errors %d/%d (delay %f)\n", SNR, ue_speed, prach_errors, n_frames, delay_avg/(double)(n_frames-prach_errors)); if (input_fd) break; if (prach_errors) break; + } // UE Speed loop if (!prach_errors) { printf("PRACH test OK\n"); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index d36f42f6c6..e1ffe7eb6c 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -37,7 +37,7 @@ #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/pucch_nr.h" #include "SCHED_NR/sched_nr.h" @@ -59,6 +59,8 @@ uint16_t NB_UE_INST = 1; // needed for some functions PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}}; +void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} + int main(int argc, char **argv) { char c; @@ -84,7 +86,7 @@ int main(int argc, char **argv) int format=0; //uint8_t extended_prefix_flag=0; FILE *input_fd=NULL; - uint8_t nacktoack_flag=0; + //uint8_t nacktoack_flag=0; int16_t amp=0x7FFF; int nr_tti_tx=0; uint64_t actual_payload=0,payload_received; @@ -283,7 +285,7 @@ int main(int argc, char **argv) actual_payload=atoi(optarg); break; case 'T': - nacktoack_flag=(uint8_t)atoi(optarg); + //nacktoack_flag=(uint8_t)atoi(optarg); target_error_rate=0.001; break; default: @@ -336,7 +338,7 @@ int main(int argc, char **argv) } AssertFatal(((format < 2)&&(nr_bit<3)&&(actual_payload<4)) || - ((format == 2)&&(nr_bit>2)&&(nr_bit<12)),"illegal combination format %d, nr_bit %d\n", + ((format == 2)&&(nr_bit>2)&&(nr_bit<65)),"illegal combination format %d, nr_bit %d\n", format,nr_bit); actual_payload &= ((1<pucch_config_common_nr->pucch_GroupHopping; uint32_t hopping_id=UE->pucch_config_common_nr->hoppingId; uint32_t dmrs_scrambling_id = 0, data_scrambling_id=0; + //t_nrPolar_params *currentPtr; + if(format==0){ // for now we are not considering SR just HARQ-ACK if (nr_bit ==0) @@ -465,9 +469,10 @@ int main(int argc, char **argv) mcs=table1_mcs[actual_payload]; else if(nr_bit==2) mcs=table2_mcs[actual_payload]; - else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n"); + else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag); } - + else if (format == 2 && nr_bit > 11) gNB->uci_polarParams = nr_polar_params(2, nr_bit, nrofPRB, 1, NULL); + for(SNR=snr0;SNR<=snr1;SNR=SNR+1){ ack_nack_errors=0; n_errors = 0; @@ -498,7 +503,7 @@ int main(int argc, char **argv) } int rxlev = signal_energy(&rxdataF[aa][startingSymbolIndex*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size); - // printf("rxlev %d (%d dB), sigma2 %f dB, SNR %f, TX %f\n",rxlev,dB_fixed(rxlev),sigma2_dB,SNR,10*log10((double)txlev*UE->frame_parms.ofdm_symbol_size/12)); + if (n_trials==1) printf("rxlev %d (%d dB), sigma2 %f dB, SNR %f, TX %f\n",rxlev,dB_fixed(rxlev),sigma2_dB,SNR,10*log10((double)txlev*UE->frame_parms.ofdm_symbol_size/12)); if(format==0){ nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu; nfapi_nr_pucch_pdu_t pucch_pdu; @@ -506,6 +511,8 @@ int main(int argc, char **argv) pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1; pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1; pucch_pdu.bit_len_harq = nr_bit; + pucch_pdu.bit_len_csi_part1 = 0; + pucch_pdu.bit_len_csi_part2 = 0; pucch_pdu.sr_flag = sr_flag; pucch_pdu.nr_of_symbols = nrofSymbols; pucch_pdu.hopping_id = hopping_id; @@ -534,7 +541,9 @@ int main(int argc, char **argv) pucch_pdu.subcarrier_spacing = 1; pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1; pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1; - pucch_pdu.bit_len_harq = nr_bit; + pucch_pdu.bit_len_csi_part1 = nr_bit; + pucch_pdu.bit_len_harq = 0; + pucch_pdu.bit_len_csi_part2 = 0; pucch_pdu.sr_flag = 0; pucch_pdu.nr_of_symbols = nrofSymbols; pucch_pdu.hopping_id = hopping_id; @@ -545,14 +554,15 @@ int main(int argc, char **argv) pucch_pdu.dmrs_scrambling_id = dmrs_scrambling_id; pucch_pdu.data_scrambling_id = data_scrambling_id; nr_decode_pucch2(gNB,nr_tti_tx,&uci_pdu,&pucch_pdu); - int harq_bytes=pucch_pdu.bit_len_harq>>3; - if ((pucch_pdu.bit_len_harq&7) > 0) harq_bytes++; - for (int i=0;i>3; + if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++; + for (int i=0;i>1)+(((actual_payload^payload_received)&4)>>2)+n_errors; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index d0710f6734..b0557ef1b4 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -37,7 +37,7 @@ #include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" +#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" @@ -54,6 +54,8 @@ PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} + double cpuf; uint8_t nfapi_mode = 0; uint16_t NB_UE_INST = 1; @@ -402,7 +404,6 @@ int main(int argc, char **argv) rel15_ul->mcs_index = Imcs; rel15_ul->pusch_data.rv_index = rvidx; rel15_ul->nrOfLayers = Nl; - //rel15_ul->length_dmrs = length_dmrs; rel15_ul->target_code_rate = code_rate; rel15_ul->pusch_data.tb_size = TBS>>3; /////////////////////////////////////////////////// @@ -424,15 +425,6 @@ int main(int argc, char **argv) for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - - /////////////////////////[adk] preparing NR_UE_ULSCH_t parameters///////////////////////// A HOT FIX until creating nfapi_nr_ul_config_ulsch_pdu_rel15_t - /////////// - ulsch_ue->nb_re_dmrs = nb_re_dmrs; - ulsch_ue->length_dmrs = length_dmrs; - ulsch_ue->rnti = n_rnti; - /////////// - //////////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////[adk] preparing UL harq_process parameters///////////////////////// /////////// NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; @@ -442,13 +434,14 @@ int main(int argc, char **argv) if (harq_process_ul_ue) { - harq_process_ul_ue->mcs = Imcs; - harq_process_ul_ue->Nl = Nl; - harq_process_ul_ue->nb_rb = nb_rb; - harq_process_ul_ue->number_of_symbols = nb_symb_sch; + harq_process_ul_ue->pusch_pdu.rnti = n_rnti; + harq_process_ul_ue->pusch_pdu.mcs_index = Imcs; + harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl; + harq_process_ul_ue->pusch_pdu.rb_size = nb_rb; + harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords; - harq_process_ul_ue->rvidx = rvidx; - harq_process_ul_ue->TBS = TBS; + harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx; + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS; harq_process_ul_ue->a = &test_input[0]; } @@ -461,9 +454,10 @@ int main(int argc, char **argv) /////////////////////////ULSCH coding///////////////////////// /////////// + unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl); if (input_fd == NULL) { - nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid); + nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); } printf("\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 114d086ee2..3e993c74de 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -41,7 +41,6 @@ #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" -#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" @@ -114,13 +113,13 @@ int main(int argc, char **argv) double sigma, sigma_dB; double snr_step = 1; uint8_t snr1set = 0; - int slot = 17, frame = 0; + int slot = 8, frame = 0; FILE *output_fd = NULL; //uint8_t write_output_file = 0; int trial, n_trials = 1, n_errors = 0, n_false_positive = 0, delay = 0; uint8_t n_tx = 1, n_rx = 1; //uint8_t transmission_mode = 1; - uint16_t Nid_cell = 0; + //uint16_t Nid_cell = 0; channel_desc_t *gNB2UE; uint8_t extended_prefix_flag = 0; //int8_t interf1 = -21, interf2 = -21; @@ -131,9 +130,9 @@ int main(int argc, char **argv) int frame_length_complex_samples,frame_length_complex_samples_no_prefix; NR_DL_FRAME_PARMS *frame_parms; int loglvl = OAILOG_WARNING; - uint64_t SSB_positions=0x01; + //uint64_t SSB_positions=0x01; uint16_t nb_symb_sch = 12; - int start_symbol = 0; + int start_symbol = 2; uint16_t nb_rb = 50; uint8_t Imcs = 9; uint8_t precod_nbr_layers = 1; @@ -321,11 +320,11 @@ int main(int argc, char **argv) break; case 'M': - SSB_positions = atoi(optarg); + // SSB_positions = atoi(optarg); break; case 'N': - Nid_cell = atoi(optarg); + // Nid_cell = atoi(optarg); break; case 'R': @@ -378,6 +377,7 @@ int main(int argc, char **argv) printf("-P Print ULSCH performances\n"); exit(-1); break; + } } @@ -545,20 +545,33 @@ int main(int argc, char **argv) fapi_nr_ul_config_request_t ul_config; unsigned int TBS; - uint16_t number_dmrs_symbols = 1; + uint16_t number_dmrs_symbols = 0; unsigned int available_bits; - - uint8_t nb_re_dmrs=12; // no PUSCH REs - uint8_t length_dmrs = 1; + uint8_t nb_re_dmrs; unsigned char mod_order; uint16_t code_rate; + uint8_t ptrs_mcs1 = 2; + uint8_t ptrs_mcs2 = 4; + uint8_t ptrs_mcs3 = 10; + uint16_t n_rb0 = 25; + uint16_t n_rb1 = 75; + uint8_t mcs_table = 0; + uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS; + uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct + uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct + uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table); + uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); + + if(1<= nb_symb_sch) + pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS + + for (i = 0; i < nb_symb_sch; i++) { + number_dmrs_symbols += (l_prime_mask >> i) & 0x01; + } mod_order = nr_get_Qm_ul(Imcs, 0); - code_rate = nr_get_code_rate_ul(Imcs, 0); - available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1); - TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, precod_nbr_layers); printf("\n"); @@ -622,21 +635,21 @@ int main(int argc, char **argv) pusch_pdu->bwp_size = abwp_size; } - pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; + pusch_pdu->pdu_bit_map = pdu_bit_map; pusch_pdu->rnti = n_rnti; pusch_pdu->mcs_index = Imcs; - pusch_pdu->mcs_table = 0; + pusch_pdu->mcs_table = mcs_table; pusch_pdu->target_code_rate = code_rate; pusch_pdu->qam_mod_order = mod_order; pusch_pdu->transform_precoding = 1; pusch_pdu->data_scrambling_id = *scc->physCellId; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = (1<ul_dmrs_symb_pos = l_prime_mask << start_symbol; pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; pusch_pdu->scid = 0; pusch_pdu->dmrs_ports = 1; - pusch_pdu->num_dmrs_cdm_grps_no_data = 2; + pusch_pdu->num_dmrs_cdm_grps_no_data = 1; pusch_pdu->resource_alloc = 1; pusch_pdu->rb_start = start_rb; pusch_pdu->rb_size = nb_rb; @@ -648,8 +661,11 @@ int main(int argc, char **argv) pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.harq_process_id = 0; pusch_pdu->pusch_data.new_data_indicator = 0; - pusch_pdu->pusch_data.tb_size = TBS>>3; pusch_pdu->pusch_data.num_cb = 0; + pusch_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density; + pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; // prepare ULSCH/PUSCH reception nr_schedule_response(Sched_INFO); @@ -667,47 +683,65 @@ int main(int argc, char **argv) ul_config.slot = slot; ul_config.number_pdus = 1; ul_config.ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config.ul_config_list[0].ulsch_config_pdu.rnti = n_rnti; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = nb_rb; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = start_rb; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = nb_symb_sch; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = Imcs; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers; - ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid; + ul_config.ul_config_list[0].pusch_config_pdu.rnti = n_rnti; + ul_config.ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map; + ul_config.ul_config_list[0].pusch_config_pdu.rb_size = nb_rb; + ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb; + ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; + ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol; + ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol; + ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = 0; + ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; + ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; + ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0; + ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_pid; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); + ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; //there are plenty of other parameters that we don't seem to be using for now. e.g. - //ul_config.ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.absolute_delta_PUSCH = 0; + ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0; - if (input_fd != NULL) { - // set FAPI parameters for UE, put them in the scheduled response and call - nr_ue_scheduled_response(&scheduled_response); - - /////////////////////////phy_procedures_nr_ue_TX/////////////////////// - /////////// - - phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, 0); - - if (n_trials==1) - LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_length_complex_samples,1,1); - - /////////// - //////////////////////////////////////////////////// - tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); - - txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], - frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); - - txlev_float = (double)txlev; // output of signal_energy is fixed point representation - - n_errors = 0; - n_false_positive = 0; - - //AWGN - sigma_dB = 10*log10(txlev_float)-SNR; - sigma = pow(10,sigma_dB/10); - } + nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4); + + available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, 1); + TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers); + + + if (input_fd == NULL) { + pusch_pdu->pusch_data.tb_size = TBS>>3; + ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS; + // set FAPI parameters for UE, put them in the scheduled response and call + nr_ue_scheduled_response(&scheduled_response); + + + /////////////////////////phy_procedures_nr_ue_TX/////////////////////// + /////////// + + phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, 0); + + if (n_trials==1) + LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_length_complex_samples,1,1); + + /////////// + //////////////////////////////////////////////////// + tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); + + txlev = signal_energy_amp_shift(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + + txlev_float = (double)txlev/(double)AMP; // output of signal_energy is fixed point representation + + n_errors = 0; + n_false_positive = 0; + + //AWGN + sigma_dB = 10*log10(txlev_float)-SNR; + sigma = pow(10,sigma_dB/10); + } else n_trials = 1; for (trial = 0; trial < n_trials; trial++) { @@ -799,7 +833,7 @@ int main(int argc, char **argv) if (errors_scrambling > 0) { if (n_trials==1) - printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in unscrambling = %d\n" "\x1B[0m", frame, trial, errors_scrambling); + printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in unscrambling = %u\n" "\x1B[0m", frame, trial, errors_scrambling); } for (i = 0; i < TBS; i++) { @@ -817,13 +851,13 @@ int main(int argc, char **argv) if (errors_decoding > 0) { n_false_positive++; if (n_trials==1) - printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %d\n" "\x1B[0m", frame, trial, errors_decoding); + printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding); } } // trial loop printf("*****************************************\n"); - printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %d/%d\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, n_trials); + printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%d\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, n_trials); printf("\n"); printf("SNR %f: Channel BLER %e, Channel BER %e\n", SNR,(double)n_errors/n_trials,(double)errors_scrambling/available_bits/n_trials); printf("*****************************************\n"); @@ -866,5 +900,8 @@ int main(int argc, char **argv) if (input_fd) fclose(input_fd); + if (scg_fd) + fclose(scg_fd); + return (n_errors); } diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 4b1b7edcdd..6071e1e743 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -432,15 +432,6 @@ void multipath_tv_channel(channel_desc_t *desc, /**@} */ /**@} */ -void rxAddInput( struct complex16 *input_sig, - struct complex16 *after_channel_sig, - int rxAnt, - channel_desc_t *channelDesc, - int nbSamples, - uint64_t TS, - uint32_t CirSize - ); - int modelid_fromname(char *modelname); double channelmod_get_snr_dB(void); double channelmod_get_sinr_dB(void); diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index 7225ae31b3..befab4ebdf 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -79,7 +79,6 @@ * the key length is 32 bytes (256 bits) */ #define SECURITY_KEY_LENGTH 32 -#ifndef OCP_FRAMEWORK typedef enum cell_type_e { CELL_MACRO_ENB, CELL_HOME_ENB, @@ -111,7 +110,6 @@ typedef enum cn_domain_s { CN_DOMAIN_PS = 1, CN_DOMAIN_CS = 2 } cn_domain_t; -#endif typedef struct net_ip_address_s { unsigned ipv4:1; @@ -127,7 +125,6 @@ typedef struct ambr_s { bitrate_t br_dl; } ambr_t; -#ifndef OCP_FRAMEWORK typedef enum priority_level_s { PRIORITY_LEVEL_SPARE = 0, PRIORITY_LEVEL_HIGHEST = 1, @@ -146,7 +143,6 @@ typedef enum pre_emp_vulnerability_e { PRE_EMPTION_VULNERABILITY_DISABLED = 1, PRE_EMPTION_VULNERABILITY_MAX, } pre_emp_vulnerability_t; -#endif typedef struct allocation_retention_priority_s { priority_level_t priority_level; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index 38b3b7d653..f0743e60a5 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -315,7 +315,7 @@ typedef struct x2ap_senb_addition_req_ack_s { typedef struct x2ap_ENDC_sgnb_addition_req_s { int ue_x2_id; - + LTE_PhysCellId_t target_physCellId; /* used for RRC->X2AP in source eNB */ int rnti; @@ -386,6 +386,7 @@ typedef struct x2ap_ENDC_reconf_complete_s { int MeNB_ue_x2_id; int SgNB_ue_x2_id; + LTE_PhysCellId_t target_physCellId; x2ap_sgNB_reconf_response_information_t reconf_response; diff --git a/openair2/DOCS/TEMPLATES/CODE/example_doxy.h b/openair2/DOCS/TEMPLATES/CODE/example_doxy.h index c51bdbccab..30d8ddb600 100644 --- a/openair2/DOCS/TEMPLATES/CODE/example_doxy.h +++ b/openair2/DOCS/TEMPLATES/CODE/example_doxy.h @@ -31,6 +31,9 @@ * \warning this is a warning */ +#ifndef __DOCS_TEMPLATES_CODE_EXAMPLE_DOXY__H__ +#define __DOCS_TEMPLATES_CODE_EXAMPLE_DOXY__H__ + //-----------------------------------begin group----------------------------- @@ -138,3 +141,4 @@ struct frame { int init(int src, int dst); //-----------------------end func proto------------------- +#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 975ac4e96f..603ff25198 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1579,10 +1579,6 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id) return 0; } -AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id) -{ - return agent_mac_xface[mod_id]; -} void flexran_create_config_structures(mid_t mod_id) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 92c9917622..ec907a1956 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -921,7 +921,4 @@ int flexran_agent_unregister_rrc_xface(mid_t mod_id) return 0; } -AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id) -{ - return agent_rrc_xface[mod_id]; -} + diff --git a/openair2/ENB_APP/L1_paramdef.h b/openair2/ENB_APP/L1_paramdef.h index 210b753afb..72e77c3800 100644 --- a/openair2/ENB_APP/L1_paramdef.h +++ b/openair2/ENB_APP/L1_paramdef.h @@ -30,6 +30,8 @@ * \warning */ +#ifndef __ENB_APP_L1_PARAMDEF__H__ +#define __ENB_APP_L1_PARAMDEF__H__ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -114,3 +116,5 @@ #define L1_PUCCH1_DTX_EMTC3_THRESHOLD_IDX 22 #define L1_PUCCH1AB_DTX_EMTC3_THRESHOLD_IDX 23 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ + +#endif diff --git a/openair2/ENB_APP/MACRLC_paramdef.h b/openair2/ENB_APP/MACRLC_paramdef.h index 724dde6557..55ce9d5059 100644 --- a/openair2/ENB_APP/MACRLC_paramdef.h +++ b/openair2/ENB_APP/MACRLC_paramdef.h @@ -31,6 +31,8 @@ */ +#ifndef __ENB_APP_MACRLC_PARAMDEF__H__ +#define __ENB_APP_MACRLC_PARAMDEF__H__ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -104,3 +106,5 @@ #define MACRLC_PUSCH10xSNR_IDX 18 #define MACRLC_PUCCH10xSNR_IDX 19 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ + +#endif diff --git a/openair2/ENB_APP/NB_IoT_paramdef.h b/openair2/ENB_APP/NB_IoT_paramdef.h index 6409fe63ee..8778f6d2e4 100644 --- a/openair2/ENB_APP/NB_IoT_paramdef.h +++ b/openair2/ENB_APP/NB_IoT_paramdef.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __ENB_APP_NB_IOT_PARAMDEF__H__ +#define __ENB_APP_NB_IOT_PARAMDEF__H__ + #include "common/config/config_paramdesc.h" #include "SystemInformationBlockType2.h" #include "DL-GapConfig-NB-r13.h" @@ -398,3 +401,5 @@ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* NB IoT L1 configuration list section name */ #define NBIOT_L1LIST_CONFIG_STRING "NB-IoT_L1s" + +#endif diff --git a/openair2/ENB_APP/enb_paramdef_emtc.h b/openair2/ENB_APP/enb_paramdef_emtc.h index 7ec6f4940a..de774c4ea6 100644 --- a/openair2/ENB_APP/enb_paramdef_emtc.h +++ b/openair2/ENB_APP/enb_paramdef_emtc.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __ENB_APP_ENB_PARAMDEF_EMTC__H__ +#define __ENB_APP_ENB_PARAMDEF_EMTC__H__ + #include "common/config/config_paramdesc.h" #include "RRC_paramsvalues.h" @@ -405,3 +408,5 @@ typedef struct ccparams_eMTC_s { {"sib2_interval_ULHoppingConfigCommonModeB_r13_val", NULL, 0, iptr:&eMTCconfig->sib2_interval_ULHoppingConfigCommonModeB_r13_val, defintval:0, TYPE_UINT, 0}, \ {"sib2_mpdcch_pdsch_hoppingOffset_r13", NULL, 0, iptr:&eMTCconfig->sib2_mpdcch_pdsch_hoppingOffset_r13, defintval:1, TYPE_UINT, 0} \ } + +#endif diff --git a/openair2/ENB_APP/enb_paramdef_mce.h b/openair2/ENB_APP/enb_paramdef_mce.h index 8a4dd15766..fdc2731e16 100644 --- a/openair2/ENB_APP/enb_paramdef_mce.h +++ b/openair2/ENB_APP/enb_paramdef_mce.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __ENB_APP_ENB_PARAMDEF_MCE__H__ +#define __ENB_APP_ENB_PARAMDEF_MCE__H__ + #include "common/config/config_paramdesc.h" #include "RRC_paramsvalues.h" @@ -235,5 +238,4 @@ #define MCE_CONFIG_STRING_NUM_FRAME_IDX 2 #define MCE_CONFIG_STRING_SUBFRAME_ALLOCATION_IDX 3 - - +#endif diff --git a/openair2/ENB_APP/enb_paramdef_mme.h b/openair2/ENB_APP/enb_paramdef_mme.h index 0ff1df765c..fde9b1c3a8 100644 --- a/openair2/ENB_APP/enb_paramdef_mme.h +++ b/openair2/ENB_APP/enb_paramdef_mme.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __ENB_APP_ENB_PARAMDEF_MME__H__ +#define __ENB_APP_ENB_PARAMDEF_MME__H__ + #include "common/config/config_paramdesc.h" #include "RRC_paramsvalues.h" @@ -77,6 +80,4 @@ {MME_CONFIG_STRING_MME_PORT_FOR_M3C, NULL, 0, uptr:&mme_port_for_m3c, defintval:36444L, TYPE_UINT, 0}, \ } - - - +#endif diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index 119bc3d44c..5f17cf4841 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -41,10 +41,15 @@ AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id); /* Control module interface for the communication of the MAC Control Module with the agent */ -AGENT_MAC_xface *flexran_agent_get_mac_xface(mid_t mod_id); + +extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; +#define flexran_agent_get_mac_xface(mod_id) (agent_mac_xface[mod_id]) +/* Control module interface for the communication of the RRC Control Module with the agent */ /* Control module interface for the communication of the RRC Control Module with the agent */ -AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); +// AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); +extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; +#define flexran_agent_get_rrc_xface(mod_id) (agent_rrc_xface[mod_id]) /* Control module interface for the communication of the RRC Control Module with the agent */ AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id); diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 889a50c814..a5a808c281 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -30,6 +30,8 @@ * \warning */ +#ifndef __GNB_APP_L1_NR_PARAMDEF__H__ +#define __GNB_APP_L1_NR_PARAMDEF__H__ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -71,3 +73,4 @@ #define L1_REMOTE_N_PORTD_IDX 8 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ +#endif diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index b55aeacdce..308af2eeb9 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -31,6 +31,8 @@ */ +#ifndef __GNB_APP_MACRLC_NR_PARAMDEF__H__ +#define __GNB_APP_MACRLC_NR_PARAMDEF__H__ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -96,3 +98,4 @@ #define MACRLC_LOCAL_S_PORTD_IDX 15 #define MACRLC_REMOTE_S_PORTD_IDX 16 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#endif diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 821174deda..9bdd709262 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -75,12 +75,12 @@ static void configure_nr_rrc(uint32_t gnb_id) static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) { uint32_t gnb_id; - MessageDef *msg_p; + //MessageDef *msg_p; uint32_t register_gnb_pending = 0; for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { - s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse + //s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse // note: there is an implicit relationship between the data structure and the message name /*msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse @@ -131,8 +131,7 @@ void *gNB_app_task(void *args_p) uint32_t gnb_nb = RC.nb_nr_inst; uint32_t gnb_id_start = 0; uint32_t gnb_id_end = gnb_id_start + gnb_nb; - uint32_t x2_register_gnb_pending = 0; - uint32_t register_gnb_pending=0; + uint32_t gnb_id; MessageDef *msg_p = NULL; const char *msg_name = NULL; @@ -171,13 +170,13 @@ void *gNB_app_task(void *args_p) if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type) LOG_I(X2AP, "X2AP enabled \n"); - x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end); + __attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end); } if (EPC_MODE_ENABLED) { /* Try to register each gNB */ //registered_gnb = 0; - register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); + __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); } else { /* Start L2L1 task */ msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 3235dabb45..61aa10e47b 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -259,11 +259,6 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { if (*scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder!=0) scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder = NULL; - // fix libconfig (asn1c uses long) - scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower-=((long)1<<32); - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->p0_NominalWithGrant-=((long)1<<32); - *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal-=((long)1<<32); - // fix DL and UL Allocation lists for (int i=scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count-1;i>=0;i--) { diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 2d9ecb8c8a..84045fc622 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __GNB_APP_GNB_PARAMDEF__H__ +#define __GNB_APP_GNB_PARAMDEF__H__ + #include "common/config/config_paramdesc.h" #include "RRC_nr_paramsvalues.h" @@ -430,3 +433,4 @@ typedef struct ccparams_nr_x2 { #define CONFIG_HLP_WORKER "coding and FEP worker thread WORKER_DISABLE or WORKER_ENABLE\n" #define CONFIG_HLP_PARALLEL "PARALLEL_SINGLE_THREAD, PARALLEL_RU_L1_SPLIT, or PARALLEL_RU_L1_TRX_SPLIT(RU_L1_TRX_SPLIT by defult)\n" /*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#endif diff --git a/openair2/LAYER2/MAC/config_NB_IoT.h b/openair2/LAYER2/MAC/config_NB_IoT.h index fb8c85ebed..1821b4e12d 100644 --- a/openair2/LAYER2/MAC/config_NB_IoT.h +++ b/openair2/LAYER2/MAC/config_NB_IoT.h @@ -8,8 +8,8 @@ * */ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ +#ifndef __LAYER2_MAC_CONFIG_NB_IOT__H__ +#define __LAYER2_MAC_CONFIG_NB_IOT__H__ //#include "NB_IoT_Message_definitions.h" diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index b900bef5bf..c46005ee2d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -35,7 +35,6 @@ #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_proto.h" - #include "common/utils/LOG/log.h" #include "nfapi/oai_integration/vendor_ext.h" #include "common/utils/LOG/vcd_signal_dumper.h" diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index dbf5b57b6b..cee6066a9e 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -60,7 +60,7 @@ extern uint16_t NB_THREAD_INST; extern unsigned char NB_RN_INST; extern unsigned short NODE_ID[1]; -extern int cqi_to_mcs[16]; +extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index c4dd6b8419..8569d8f166 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -36,6 +36,7 @@ #include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac_proto.h" #include "LAYER2/MAC/mac_extern.h" +#include #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index e1c8e6fac0..d8ba18e4bf 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -24,8 +24,8 @@ * \author R. Knopp, K.H. HSU, G. Casati * \date 2019 * \version 0.1 - * \company Eurecom / NTUST / Fraunhofer IIS - * \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr, guido.casati@iis.fraunhofer.de + * \company Eurecom / NTUST / Fraunhofer IIS + * \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr, guido.casati@iis.fraunhofer.de * \note * \warning */ @@ -71,72 +71,130 @@ // R: Reserved bit, set to zero. typedef struct { - uint8_t LCID:6; // octet 1 [5:0] - uint8_t F:1; // octet 1 [6] - uint8_t R:1; // octet 1 [7] - uint8_t L:8; // octet 2 [7:0] + uint8_t LCID: 6; // octet 1 [5:0] + uint8_t F: 1; // octet 1 [6] + uint8_t R: 1; // octet 1 [7] + uint8_t L: 8; // octet 2 [7:0] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT; typedef struct { - uint8_t LCID:6; // octet 1 [5:0] - uint8_t F:1; // octet 1 [6] - uint8_t R:1; // octet 1 [7] - uint8_t L1:8; // octet 2 [7:0] - uint8_t L2:8; // octet 3 [7:0] + uint8_t LCID: 6; // octet 1 [5:0] + uint8_t F: 1; // octet 1 [6] + uint8_t R: 1; // octet 1 [7] + uint8_t L1: 8; // octet 2 [7:0] + uint8_t L2: 8; // octet 3 [7:0] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; typedef struct { - uint8_t LCID:6; // octet 1 [5:0] - uint8_t R:2; // octet 1 [7:6] + uint8_t LCID: 6; // octet 1 [5:0] + uint8_t R: 2; // octet 1 [7:6] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; // BSR MAC CEs // TS 38.321 ch. 6.1.3.1 // Short BSR for a specific logical channel group ID typedef struct { - uint8_t Buffer_size:5; // octet 1 LSB - uint8_t LcgID:3; // octet 1 MSB + uint8_t Buffer_size: 5; // octet 1 LSB + uint8_t LcgID: 3; // octet 1 MSB } __attribute__ ((__packed__)) NR_BSR_SHORT; typedef NR_BSR_SHORT NR_BSR_SHORT_TRUNCATED; // Long BSR for all logical channel group ID typedef struct { - uint8_t Buffer_size7:8; - uint8_t Buffer_size6:8; - uint8_t Buffer_size5:8; - uint8_t Buffer_size4:8; - uint8_t Buffer_size3:8; - uint8_t Buffer_size2:8; - uint8_t Buffer_size1:8; - uint8_t Buffer_size0:8; - uint8_t LcgID0:1; - uint8_t LcgID1:1; - uint8_t LcgID2:1; - uint8_t LcgID3:1; - uint8_t LcgID4:1; - uint8_t LcgID5:1; - uint8_t LcgID6:1; - uint8_t LcgID7:1; + uint8_t Buffer_size7: 8; + uint8_t Buffer_size6: 8; + uint8_t Buffer_size5: 8; + uint8_t Buffer_size4: 8; + uint8_t Buffer_size3: 8; + uint8_t Buffer_size2: 8; + uint8_t Buffer_size1: 8; + uint8_t Buffer_size0: 8; + uint8_t LcgID0: 1; + uint8_t LcgID1: 1; + uint8_t LcgID2: 1; + uint8_t LcgID3: 1; + uint8_t LcgID4: 1; + uint8_t LcgID5: 1; + uint8_t LcgID6: 1; + uint8_t LcgID7: 1; } __attribute__ ((__packed__)) NR_BSR_LONG; typedef NR_BSR_LONG NR_BSR_LONG_TRUNCATED; // 38.321 ch. 6.1.3.4 typedef struct { - uint8_t TA_COMMAND:6; // octet 1 [5:0] - uint8_t TAGID:2; // octet 1 [7:6] + uint8_t TA_COMMAND: 6; // octet 1 [5:0] + uint8_t TAGID: 2; // octet 1 [7:6] } __attribute__ ((__packed__)) NR_MAC_CE_TA; // single Entry PHR MAC CE // TS 38.321 ch. 6.1.3.8 typedef struct { - uint8_t PH:6; - uint8_t R1:2; - uint8_t PCMAX:6; - uint8_t R2:6; + uint8_t PH: 6; + uint8_t R1: 2; + uint8_t PCMAX: 6; + uint8_t R2: 6; } __attribute__ ((__packed__)) NR_SINGLE_ENTRY_PHR_MAC_CE; + +// SP ZP CSI-RS Resource Set Activation/Deactivation MAC CE +// 38.321 ch. 6.1.3.19 +typedef struct { + uint8_t BWPID: 2; // octet 1 [1:0] + uint8_t CELLID: 5; // octet 1 [6:2] + uint8_t A_D: 1; // octet 1 [7] + uint8_t CSIRS_RSC_ID: 4; // octet 2 [3:0] + uint8_t R: 4; // octet 2 [7:4] +} __attribute__ ((__packed__)) NR_MAC_CE_SP_ZP_CSI_RS_RES_SET; + +//TS 38.321 Sec 6.1.3.15, TCI State indicaton for UE-Specific PDCCH MAC CE +typedef struct { + uint8_t CoresetId1: 3; //Octect 1 [2:0] + uint8_t ServingCellId: 5; //Octect 1 [7:3] + uint8_t TciStateId: 7; //Octect 2 [6:0] + uint8_t CoresetId2: 1; //Octect 2 [7] +} __attribute__ ((__packed__)) NR_TCI_PDCCH; + +//TS 38.321 Sec 6.1.3.14, TCI State activation/deactivation for UE Specific PDSCH MAC CE +typedef struct { + uint8_t BWP_Id: 2; //Octect 1 [1:0] + uint8_t ServingCellId: 5; //Octect 1 [6:2] + uint8_t R: 1; //Octect 1 [7] + uint8_t T[]; //Octects 2 to MAX TCI States/8 +} __attribute__ ((__packed__)) NR_TCI_PDSCH_APERIODIC_CSI; + +//TS 6.1.3.16, SP CSI reporting on PUCCH Activation/Deactivation MAC CE +typedef struct { + uint8_t BWP_Id: 2; //Octect 1 [1:0] + uint8_t ServingCellId: 5; //Octect 1 [6:2] + uint8_t R1: 1; //Octect 1 [7] + uint8_t S0: 1; //Octect 2 [0] + uint8_t S1: 1; //Octect 2 [1] + uint8_t S2: 1; //Octect 2 [2] + uint8_t S3: 1; //Octect 2 [3] + uint8_t R2: 4; //Octect 2 [7:4] +} __attribute__ ((__packed__)) NR_PUCCH_CSI_REPORTING; + + +//TS 38.321 sec 6.1.3.12 +//SP CSI-RS / CSI-IM Resource Set Activation/Deactivation MAC CE +typedef struct { + uint8_t BWP_ID: 2; + uint8_t SCID: 5; + uint8_t A_D: 1; + uint8_t SP_CSI_RSID: 6; + uint8_t IM: 1; + uint8_t R1: 1; + uint8_t SP_CSI_IMID: 6; + uint8_t R2: 2; + struct TCI_S { + uint8_t TCI_STATE_ID: 6; + uint8_t R: 2; + } __attribute__ ((__packed__)) TCI_STATE; +} __attribute__ ((__packed__)) CSI_RS_CSI_IM_ACT_DEACT_MAC_CE; + + //* RAR MAC subheader // TS 38.321 ch. 6.1.5, 6.2.2 *// // - E: The Extension field is a flag indicating if the MAC subPDU including this MAC subheader is the last MAC subPDU or not in the MAC PDU // - T: The Type field is a flag indicating whether the MAC subheader contains a Random Access Preamble ID or a Backoff Indicator (0, BI) (1, RAPID) @@ -146,30 +204,30 @@ typedef struct { /*!\brief RAR MAC subheader with RAPID */ typedef struct { - uint8_t RAPID:6; - uint8_t T:1; - uint8_t E:1; + uint8_t RAPID: 6; + uint8_t T: 1; + uint8_t E: 1; } __attribute__ ((__packed__)) NR_RA_HEADER_RAPID; /*!\brief RAR MAC subheader with Backoff Indicator */ typedef struct { - uint8_t BI:4; - uint8_t R:2; - uint8_t T:1; - uint8_t E:1; + uint8_t BI: 4; + uint8_t R: 2; + uint8_t T: 1; + uint8_t E: 1; } __attribute__ ((__packed__)) NR_RA_HEADER_BI; // TS 38.321 ch. 6.2.3 typedef struct { - uint8_t TA1:7; // octet 1 [6:0] - uint8_t R:1; // octet 1 [7] - uint8_t UL_GRANT_1:3; // octet 2 [2:0] - uint8_t TA2:5; // octet 2 [7:3] - uint8_t UL_GRANT_2:8; // octet 3 [7:0] - uint8_t UL_GRANT_3:8; // octet 4 [7:0] - uint8_t UL_GRANT_4:8; // octet 5 [7:0] - uint8_t TCRNTI_1:8; // octet 6 [7:0] - uint8_t TCRNTI_2:8; // octet 7 [7:0] + uint8_t TA1: 7; // octet 1 [6:0] + uint8_t R: 1; // octet 1 [7] + uint8_t UL_GRANT_1: 3; // octet 2 [2:0] + uint8_t TA2: 5; // octet 2 [7:3] + uint8_t UL_GRANT_2: 8; // octet 3 [7:0] + uint8_t UL_GRANT_3: 8; // octet 4 [7:0] + uint8_t UL_GRANT_4: 8; // octet 5 [7:0] + uint8_t TCRNTI_1: 8; // octet 6 [7:0] + uint8_t TCRNTI_2: 8; // octet 7 [7:0] } __attribute__ ((__packed__)) NR_MAC_RAR; // DCI pdu structures. Used by both gNB and UE. @@ -240,7 +298,7 @@ typedef struct { #define DL_SCH_LCID_CCCH 0x00 #define DL_SCH_LCID_DCCH 0x01 #define DL_SCH_LCID_DCCH1 0x02 -#define DL_SCH_LCID_DTCH 0x03 +#define DL_SCH_LCID_DTCH 0x04 #define DL_SCH_LCID_RECOMMENDED_BITRATE 0x2F #define DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT 0x30 #define DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT 0x31 @@ -249,7 +307,7 @@ typedef struct { #define DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH 0x34 #define DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH 0x35 #define DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL 0x36 -#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT 0X37 +#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT 0X37 #define DL_SCH_LCID_DUPLICATION_ACT 0X38 #define DL_SCH_LCID_SCell_ACT_4_OCT 0X39 #define DL_SCH_LCID_SCell_ACT_1_OCT 0X3A @@ -277,9 +335,9 @@ typedef struct { #define UL_SCH_LCID_L_BSR 0x3E #define UL_SCH_LCID_PADDING 0x3F -#define NR_MAX_NUM_LCID 32 -#define NR_MAX_NUM_LCGID 8 -#define MAX_RLC_SDU_SUBHEADER_SIZE 3 +#define NR_MAX_NUM_LCID 32 +#define NR_MAX_NUM_LCGID 8 +#define MAX_RLC_SDU_SUBHEADER_SIZE 3 #endif /*__LAYER2_MAC_H__ */ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index c99fa187a5..fd45a791c4 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -32,6 +32,8 @@ #include "LAYER2/NR_MAC_gNB/mac_proto.h" +const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; + // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz uint16_t NCS_unrestricted_delta_f_RA_125[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419}; uint16_t NCS_restricted_TypeA_delta_f_RA_125[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case set Type A @@ -877,7 +879,77 @@ int get_format0(uint8_t index, return format; } - + +void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, + uint16_t *slot_period, + uint16_t *offset) { + + switch(ss->monitoringSlotPeriodicityAndOffset->present) { + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1: + *slot_period = 1; + *offset = 0; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2: + *slot_period = 2; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4: + *slot_period = 4; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl4; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5: + *slot_period = 5; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl5; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8: + *slot_period = 8; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl8; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10: + *slot_period = 10; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl10; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16: + *slot_period = 16; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl16; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20: + *slot_period = 20; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl20; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40: + *slot_period = 40; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl40; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80: + *slot_period = 80; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl80; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160: + *slot_period = 160; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl160; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320: + *slot_period = 320; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl320; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640: + *slot_period = 640; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl640; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280: + *slot_period = 1280; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl1280; + break; + case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560: + *slot_period = 2560; + *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2560; + break; + default: + AssertFatal(1==0,"Invalid monitoring slot periodicity and offset value\n"); + break; + } +} int get_nr_prach_info_from_index(uint8_t index, int frame, @@ -954,7 +1026,7 @@ int get_nr_prach_info_from_index(uint8_t index, if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1]; *format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8); - LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %d) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", frame, + LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %ld) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", frame, slot, index, table_6_3_3_2_3_prachConfig_Index[index][6], pointa, @@ -1166,6 +1238,47 @@ nr_bandentry_t nr_bandtable[] = { {261,27500000,28350000,27500000,28350000, 2,2070833, 120} }; + +// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 +// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. + +int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) +{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) +{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) +}; + + +// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 + +int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) +{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) +{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) +}; + #define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) void get_band(uint64_t downlink_frequency, @@ -1656,6 +1769,113 @@ uint8_t getAntPortBitWidth(NR_SetupRelease_DMRS_DownlinkConfig_t *typeA, NR_Setu return nbits; } + +/******************************************************************* +* +* NAME : get_l0_ul +* +* PARAMETERS : mapping_type : PUSCH mapping type +* dmrs_typeA_position : higher layer parameter +* +* RETURN : demodulation reference signal for PUSCH +* +* DESCRIPTION : see TS 38.211 V15.4.0 Demodulation reference signals for PUSCH +* +*********************************************************************/ + +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { + + return ((mapping_type==typeA)?dmrs_typeA_position:0); + +} + +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { + + uint8_t row, colomn; + int32_t l_prime; + + colomn = additional_pos; + + if (mapping_type == typeB) + colomn += 4; + + if (duration_in_symbols < 4) + row = 0; + else + row = duration_in_symbols - 3; + + if (pusch_maxLength == pusch_len1) + l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; + else + l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; + + AssertFatal(l_prime>0,"invalid l_prime < 0\n"); + + return l_prime; +} + +/******************************************************************* +* +* NAME : get_L_ptrs +* +* PARAMETERS : mcs(i) higher layer parameter in PTRS-UplinkConfig +* I_mcs MCS index used for PUSCH +* mcs_table 0 for table 5.1.3.1-1, 1 for table 5.1.3.1-1 +* +* RETURN : the parameter L_ptrs +* +* DESCRIPTION : 3GPP TS 38.214 section 6.2.3.1 +* +*********************************************************************/ + +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table) { + + uint8_t mcs4; + + if(mcs_table == 0) + mcs4 = 29; + else + mcs4 = 28; + + if (I_mcs < mcs1) { + LOG_I(PHY, "PUSH PT-RS is not present.\n"); + return -1; + } else if (I_mcs >= mcs1 && I_mcs < mcs2) + return 2; + else if (I_mcs >= mcs2 && I_mcs < mcs3) + return 1; + else if (I_mcs >= mcs3 && I_mcs < mcs4) + return 0; + else { + LOG_I(PHY, "PT-RS time-density determination is obtained from the DCI for the same transport block in the initial transmission\n"); + return -1; + } +} + +/******************************************************************* +* +* NAME : get_K_ptrs +* +* PARAMETERS : ptrs_UplinkConfig PTRS uplink configuration +* N_RB number of RBs scheduled for PUSCH +* +* RETURN : the parameter K_ptrs +* +* DESCRIPTION : 3GPP TS 38.214 6.2.3 Table 6.2.3.1-2 +* +*********************************************************************/ + +uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { + + if (N_RB < nrb0) { + LOG_I(PHY,"PUSH PT-RS is not present.\n"); + return -1; + } else if (N_RB >= nrb0 && N_RB < nrb1) + return 0; + else + return 1; +} + uint16_t nr_dci_size(NR_CellGroupConfig_t *secondaryCellGroup, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index fccc7b8dc7..2f7f144983 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -33,7 +33,8 @@ #define __LAYER2_NR_MAC_COMMON_H__ #include "NR_PDSCH-Config.h" -#include "NR_ServingCellConfigCommon.h" +#include "NR_CellGroupConfig.h" +#include "nr_mac.h" typedef enum { NR_DL_DCI_FORMAT_1_0 = 0, @@ -76,6 +77,17 @@ int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); +uint16_t nr_dci_size(NR_CellGroupConfig_t *secondaryCellGroup, + dci_pdu_rel15_t *dci_pdu, + nr_dci_format_t format, + nr_rnti_type_t rnti_type, + uint16_t N_RB, + int bwp_id); + +void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, + uint16_t *slot_period, + uint16_t *offset); + int get_nr_prach_info_from_index(uint8_t index, int frame, int slot, @@ -95,4 +107,11 @@ int get_format0(uint8_t index, uint8_t unpaired); uint16_t get_NCS(uint8_t index, uint16_t format, uint8_t restricted_set_config); +int get_num_dmrs(uint16_t dmrs_mask ); +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); + +uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); +uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); + #endif diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index c33b0e42e0..5c714e4a93 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -43,7 +43,7 @@ extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; extern UE_RRC_INST *UE_rrc_inst; -extern int cqi_to_mcs[16]; +extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; extern mac_rlc_am_muilist_t rlc_am_mui; @@ -51,8 +51,6 @@ extern SCHEDULER_MODES global_scheduler_mode; extern unsigned char NB_UE_INST;*/ -extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 -extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 extern unsigned char NB_INST; extern unsigned char NB_eNB_INST; extern unsigned char NB_RN_INST; @@ -65,7 +63,7 @@ extern mac_rlc_am_muilist_t rlc_am_mui; extern SCHEDULER_MODES global_scheduler_mode; /*#if defined(PRE_SCD_THREAD) -extern int cqi_to_mcs[16]; +extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 67782c3ef0..5775e5bfb9 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -188,6 +188,8 @@ typedef struct { /* Random Access parameters */ /// state of RA procedure RA_state_t ra_state; + /// RA rx frame offset: compensate RA rx offset introduced by OAI gNB. + uint8_t RA_offset; /// RA-rnti uint16_t ra_rnti; /// Temporary CRNTI @@ -220,6 +222,10 @@ typedef struct { uint32_t RA_tx_frame; /// Random-access variable for window calculation (subframe of last change in window counter) uint8_t RA_tx_subframe; + /// Scheduled RX frame for RA Msg2 + uint16_t msg2_rx_frame; + /// Scheduled RX slot for RA Msg2 + uint16_t msg2_rx_slot; /// Random-access Group B maximum path-loss /// Random-access variable for backoff (frame of last change in backoff counter) uint32_t RA_backoff_frame; @@ -239,6 +245,8 @@ typedef struct { uint8_t RA_RAPID_found; /// Flag to monitor if BI was received in RAR uint8_t RA_BI_found; + /// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot + uint8_t generate_nr_prach; //// FAPI-like interface message fapi_nr_tx_request_t tx_request; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 38083c4836..e9d7a97a5d 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -84,23 +84,9 @@ NR_UE_MAC_INST_t *get_mac_inst( /**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures. - \param module_id module id - \param gNB_index corresponding gNB index - \param cc_id component carrier id - \param rx_frame receive frame number - \param rx_slot receive slot number - \param tx_frame transmit frame number - \param tx_slot transmit slot number*/ -NR_UE_L2_STATE_t nr_ue_scheduler( - const module_id_t module_id, - const uint8_t gNB_index, - const int cc_id, - const frame_t rx_frame, - const slot_t rx_slot, - const int32_t ssb_index, - const frame_t tx_frame, - const slot_t tx_slot); - + \param dl_info DL indication + \param ul_info UL indication*/ +NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info); /* \brief Get SR payload (0,1) from UE MAC @param Mod_id Instance id of UE in machine @@ -153,7 +139,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment); -unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, +uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, uint8_t *pdu, uint8_t num_sdus, uint16_t *sdu_lengths, @@ -168,7 +154,7 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len); -void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_config,int frame,int slot); +void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot); void nr_extract_dci_info(NR_UE_MAC_INST_t *mac, int dci_format, @@ -249,14 +235,14 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 @param frame @param gNB_id gNB index @param nr_tti_tx slot for PRACH transmission -@returns void */ -void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, - module_id_t mod_id, - int CC_id, - UE_MODE_t UE_mode, - frame_t frame, - uint8_t gNB_id, - int nr_tti_tx); +@returns indication to generate PRACH to phy */ +uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, + module_id_t mod_id, + int CC_id, + UE_MODE_t UE_mode, + frame_t frame, + uint8_t gNB_id, + int nr_tti_tx); /* \brief Function implementing the routine for the selection of Random Access resources (5.1.2 TS 38.321). @param module_idP Index of UE instance @@ -277,5 +263,6 @@ void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id); +void nr_ue_msg2_scheduler(module_id_t mod_id, uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot); #endif /** @}*/ diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 2e758d51da..bae8e0d3c0 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -51,7 +51,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) //LOG_I(MAC, "[MAIN] init UE MAC functions \n"); //init mac here - nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST); + nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST); if (rrc_inst) { nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c index 5d99acfc3a..f8bb1e5f8e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c @@ -91,8 +91,8 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma prachConfigIndex = nr_rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; if (prach_sequence_length == 0) { + AssertFatal(prach_format < 4, "Illegal PRACH format %d for sequence length 839\n", prach_format); switch (prach_format) { - AssertFatal(prach_format < 4, "Illegal PRACH format %d for sequence length 839\n", prach_format); // long preamble formats case 0: @@ -130,6 +130,7 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma AssertFatal(1 == 0, "[UE %d] ue_procedures.c: FATAL, Illegal preambleFormat %d, prachConfigIndex %d\n", mod_id, prach_format, prachConfigIndex); } } + return 0; } /* TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration */ @@ -149,4 +150,4 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (mac->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP; return receivedTargerPower; -} \ No newline at end of file +} diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 3e00dba46d..56ae14f98b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -64,9 +64,12 @@ extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9]; extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9]; +extern const uint16_t nr_slots_per_frame[5]; //extern uint8_t nfapi_mode; +void nr_get_RA_window(NR_UE_MAC_INST_t *mac); + // WIP // This routine implements Section 5.1.2 (UE Random Access Resource Selection) // and Section 5.1.3 (Random Access Preamble Transmission) from 3GPP TS 38.321 @@ -85,7 +88,7 @@ void nr_get_prach_resources(module_id_t mod_id, // NR_BeamFailureRecoveryConfig_t *beam_failure_recovery_config = &mac->RA_BeamFailureRecoveryConfig; // todo - int messagePowerOffsetGroupB, messageSizeGroupA, PLThreshold, sizeOfRA_PreamblesGroupA, numberOfRA_Preambles, i, deltaPreamble_Msg3; + int messagePowerOffsetGroupB = 0, messageSizeGroupA, PLThreshold, sizeOfRA_PreamblesGroupA = 0, numberOfRA_Preambles, i, deltaPreamble_Msg3 = 0; uint8_t noGroupB = 0, s_id, f_id, ul_carrier_id, prach_ConfigIndex, SFN_nbr, Msg3_size; AssertFatal(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id); @@ -331,26 +334,26 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint // - retrieve TBS // - add mac_rrc_nr_data_req_ue, etc ... // - add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator) -void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, - module_id_t mod_id, - int CC_id, - UE_MODE_t UE_mode, - frame_t frame, - uint8_t gNB_id, - int nr_tti_tx){ + +uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, + module_id_t mod_id, + int CC_id, + UE_MODE_t UE_mode, + frame_t frame, + uint8_t gNB_id, + int nr_tti_tx){ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload, ra_ResponseWindow; - uint8_t config_index, mu; - int is_nr_prach_slot; + uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload; + //uint8_t ra_ResponseWindow; uint16_t size_sdu = 0; unsigned short post_padding; - fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; + //fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; NR_ServingCellConfigCommon_t *scc = mac->scc; NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; - NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + //NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = mac->rach_ConfigDedicated; // int32_t frame_diff = 0; @@ -361,32 +364,11 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, AssertFatal(CC_id == 0,"Transmission on secondary CCs is not supported yet\n"); - if (UE_mode == PRACH) { + if (UE_mode == PRACH && prach_resources->init_msg1) { LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active); - config_index = rach_ConfigGeneric->prach_ConfigurationIndex; - if (setup->msg1_SubcarrierSpacing) - mu = *setup->msg1_SubcarrierSpacing; - else - mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - - is_nr_prach_slot = get_nr_prach_info_from_index(config_index, - (int)frame, - (int)nr_tti_tx, - frequencyInfoDL->absoluteFrequencyPointA, - mu, - cfg->cell_config.frame_duplex_type, - NULL, - NULL, - NULL, - NULL); - if (is_nr_prach_slot) - prach_resources->generate_nr_prach = 1; - else - prach_resources->generate_nr_prach = 0; - - AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id); + AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id); if (mac->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ @@ -446,10 +428,10 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, size_sdu += sdu_lengths[0]; } - mac->RA_tx_frame = frame; - mac->RA_tx_subframe = nr_tti_tx; - mac->RA_backoff_frame = frame; - mac->RA_backoff_subframe = nr_tti_tx; + //mac->RA_tx_frame = frame; + //mac->RA_tx_subframe = nr_tti_tx; + //mac->RA_backoff_frame = frame; + //mac->RA_backoff_subframe = nr_tti_tx; if (size_sdu > 0) { @@ -464,36 +446,10 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac->RA_active = 1; prach_resources->Msg3 = payload; - ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow; - switch (ra_ResponseWindow) { - case 0: - mac->RA_window_cnt = 1; - break; - case 1: - mac->RA_window_cnt = 2; - break; - case 2: - mac->RA_window_cnt = 4; - break; - case 3: - mac->RA_window_cnt = 8; - break; - case 4: - mac->RA_window_cnt = 10; - break; - case 5: - mac->RA_window_cnt = 20; - break; - case 6: - mac->RA_window_cnt = 40; - break; - case 7: - mac->RA_window_cnt = 80; - break; - } + nr_get_RA_window(mac); // Fill in preamble and PRACH resources - if (is_nr_prach_slot) + if (mac->generate_nr_prach) nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, prach_resources, rach_ConfigDedicated); offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer @@ -528,24 +484,25 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // - handle backoff and raResponseWindow params // - disabled contention resolution as OAI NSA is contention-free based - LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n", - mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe); + // LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n", + // mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe); if (mac->RA_BI_found){ - prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator; + prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator; } else { prach_resources->RA_PREAMBLE_BACKOFF = 0; } - if (mac->RA_window_cnt > 0 && mac->RA_RAPID_found == 1) { - // mac->ra_state = WAIT_CONTENTION_RESOLUTION; - } else { - LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n", - mod_id, - frame, - nr_tti_tx, - mac->RA_window_cnt); + if (mac->RA_window_cnt >= 0 && mac->RA_RAPID_found == 1) { + // mac->ra_state = WAIT_CONTENTION_RESOLUTION; + LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR successfully received \n", mod_id, frame, nr_tti_tx); + + } else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) { + + LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception failed \n", mod_id, frame, nr_tti_tx); + + mac->ra_state = RA_UE_IDLE; mac->RA_PREAMBLE_TRANSMISSION_COUNTER++; preambleTransMax = -1; @@ -585,6 +542,9 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, break; } + // Resetting RA window + nr_get_RA_window(mac); + if (mac->RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax + 1){ LOG_D(MAC, "[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n", mod_id, frame, preambleTransMax); mac->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1); @@ -608,11 +568,25 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // LOG_D(MAC, "[MAC][UE %d][RAPROC] Frame %d, subframe %d: RA Active, adjusted window cnt %d\n", mod_id, frame, nr_tti_tx, mac->RA_window_cnt); // } - mac->RA_tx_frame = frame; - mac->RA_tx_subframe = nr_tti_tx; + // mac->RA_tx_frame = frame; + // mac->RA_tx_subframe = nr_tti_tx; // Fill in preamble and PRACH resources - if (is_nr_prach_slot) + if (mac->generate_nr_prach) + nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated); + + } else { + + mac->RA_window_cnt--; + + LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n", + mod_id, + frame, + nr_tti_tx, + mac->RA_window_cnt); + + // Fill in preamble and PRACH resources + if (mac->generate_nr_prach) nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated); } @@ -621,5 +595,50 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id); AssertFatal(1 == 0, ""); } - return; + return mac->generate_nr_prach; +} + +void nr_get_RA_window(NR_UE_MAC_INST_t *mac){ + + uint8_t mu, ra_ResponseWindow; + NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; + NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + + ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow; + + if (setup->msg1_SubcarrierSpacing) + mu = *setup->msg1_SubcarrierSpacing; + else + mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + mac->RA_window_cnt = mac->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB + + switch (ra_ResponseWindow) { + case 0: + mac->RA_window_cnt += 1; + break; + case 1: + mac->RA_window_cnt += 2; + break; + case 2: + mac->RA_window_cnt += 4; + break; + case 3: + mac->RA_window_cnt += 8; + break; + case 4: + mac->RA_window_cnt += 10; + break; + case 5: + mac->RA_window_cnt += 20; + break; + case 6: + mac->RA_window_cnt += 40; + break; + case 7: + mac->RA_window_cnt += 80; + break; + } } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index a546cea06f..a79b4083e3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -21,11 +21,11 @@ /* \file nr_ue_dci_configuration.c * \brief functions for generating dci search procedures based on RRC Serving Cell Group Configuration - * \author R. Knopp + * \author R. Knopp, G. Casati * \date 2020 - * \version 0.1 - * \company Eurecom - * \email: knopp@eurecom.fr + * \version 0.2 + * \company Eurecom, Fraunhofer IIS + * \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de * \note * \warning */ @@ -36,6 +36,7 @@ #include "LAYER2/NR_MAC_UE/mac_extern.h" #include "mac_defs.h" #include "common/utils/nr/nr_common.h" +#include "executables/softmodem-common.h" #include #ifdef NR_PDCCH_DCI_TOOLS_DEBUG @@ -61,132 +62,217 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd } -void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_config,int frame,int slot) { +void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) { def_dci_pdu_rel15 = calloc(1,sizeof(dci_pdu_rel15_t)); - int bwp_id = 1; // FIXME - // check if DL slot - if (is_nr_DL_slot(mac->scc,slot)==1) { + NR_BWP_Downlink_t *bwp; + NR_BWP_DownlinkCommon_t *bwp_Common; + NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated; + NR_SetupRelease_PDCCH_Config_t *pdcch_Config; + NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon; + struct NR_PDCCH_Config__controlResourceSetToAddModList *controlResourceSetToAddModList; + struct NR_PDCCH_Config__searchSpacesToAddModList *searchSpacesToAddModList; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *uplinkBWP_ToAddModList; + NR_SearchSpace_t *NR_SearchSpace; + NR_ControlResourceSet_t *coreset; + + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; + NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; + + uint8_t bwp_id = 1; + int ss_id, sps; + + // get PDCCH configuration(s) (Coreset, SearchSpace, etc...) from BWP Dedicated in serving cell config dedicated (scd) + // get BWP 1, Coreset ID 0, SearchSpace ID 0 (i.e. configured in MIB and in ServingCellConfigCommon) + + // Check dedicated DL BWP + if (mac->DLbwp[0] == NULL) { + NR_SearchSpace_t *ss; + int ss_id = 0; + + AssertFatal(scd->downlinkBWP_ToAddModList != NULL, "downlinkBWP_ToAddModList is null\n"); + AssertFatal(scd->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count); + mac->DLbwp[0] = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]; + + dl_bwp_Dedicated = mac->DLbwp[0]->bwp_Dedicated; + AssertFatal(dl_bwp_Dedicated != NULL, "dl_bwp_Dedicated is null\n"); + + bwp_Common = mac->DLbwp[0]->bwp_Common; + AssertFatal(bwp_Common != NULL, "bwp_Common is null\n"); + + pdcch_Config = dl_bwp_Dedicated->pdcch_Config; + AssertFatal(pdcch_Config != NULL, "pdcch_Config is null\n"); + + pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + AssertFatal(pdcch_ConfigCommon != NULL, "pdcch_ConfigCommon is null\n"); + AssertFatal(pdcch_ConfigCommon->choice.setup->ra_SearchSpace != NULL, "ra_SearchSpace must be available in DL BWP\n"); + + controlResourceSetToAddModList = pdcch_Config->choice.setup->controlResourceSetToAddModList; + AssertFatal(controlResourceSetToAddModList != NULL, "controlResourceSetToAddModList is null\n"); + + AssertFatal(controlResourceSetToAddModList->list.count == 1, "controlResourceSetToAddModList->list.count=%d\n", controlResourceSetToAddModList->list.count); + + mac->coreset[0][0] = controlResourceSetToAddModList->list.array[0]; + coreset = mac->coreset[0][0]; + AssertFatal(coreset != NULL, "coreset[0][0] is null\n"); - // get BWP 1, Coreset 0, SearchSpace 0 - if (mac->DLbwp[0]==NULL) { - AssertFatal(mac->scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList!=NULL,"downlinkBWP_ToAddModList is null\n"); - AssertFatal(mac->scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count==1,"downlinkBWP_ToAddModList->list->count is %d\n", - mac->scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); - mac->DLbwp[0] = mac->scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0]; - AssertFatal(mac->DLbwp[0]->bwp_Dedicated!=NULL,"bwp_Dedicated is null\n"); - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config!=NULL,"pdcch_Config is null\n"); - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList!=NULL,"controlResourceSetToAddModList is null\n"); - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.count==1,"controlResourceSetToAddModList->list.count=%d\n", - mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.count); - mac->coreset[0][0] = mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[0]; - AssertFatal(mac->coreset[0][0]!=NULL,"coreset[0][0] is null\n"); - - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n"); - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0, - "searchPsacesToAddModList is empty\n"); - NR_SearchSpace_t *ss; - int ss_id=0; - AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.countDLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count); - for (int i=0;iDLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) { - ss=mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; - AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n"); - AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n"); - AssertFatal(*ss->controlResourceSetId == mac->coreset[0][0]->controlResourceSetId,"ss->controlResourceSetId is unknown\n"); - mac->SSpace[0][0][ss_id] = ss; - ss_id++; - } - } - if (mac->ULbwp[0]==NULL) { - AssertFatal(mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList!=NULL,"uplinkBWP_ToAddModList is null\n"); - AssertFatal(mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count==1,"uplinkBWP_ToAddModList->list->count is %d\n", - mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count); - mac->ULbwp[0] = mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; - AssertFatal(mac->ULbwp[0]->bwp_Dedicated!=NULL,"bwp_Dedicated is null\n"); - } - // check search spaces - - int ss_id=0; - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; - int sps =mac->DLbwp[0]->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; - - while(mac->SSpace[0][0][ss_id]!=NULL && - ss_id < mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count) { - - AssertFatal(mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); - AssertFatal(mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); - + searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList; + AssertFatal(searchSpacesToAddModList != NULL, "searchSpacesToAddModList is null\n"); + AssertFatal(searchSpacesToAddModList->list.count > 0, "searchSpacesToAddModList is empty\n"); + AssertFatal(searchSpacesToAddModList->list.count < FAPI_NR_MAX_SS_PER_CORESET, "too many searchpaces per coreset %d\n", searchSpacesToAddModList->list.count); + + for (int i = 0; i < searchSpacesToAddModList->list.count; i++) { + ss = searchSpacesToAddModList->list.array[i]; + AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); + AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n"); + AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); + mac->SSpace[0][0][ss_id] = ss; ss_id++; } - if (mac->ra_state == WAIT_RAR) { - // check for RAR - rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; - rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot); // WIP - dl_config->number_pdus = dl_config->number_pdus + 1; + } + + // Check dedicated UL BWP + if (mac->ULbwp[0] == NULL) { + uplinkBWP_ToAddModList = scd->uplinkConfig->uplinkBWP_ToAddModList; + AssertFatal(uplinkBWP_ToAddModList != NULL, "uplinkBWP_ToAddModList is null\n"); + AssertFatal(uplinkBWP_ToAddModList->list.count == 1, "uplinkBWP_ToAddModList->list->count is %d\n", uplinkBWP_ToAddModList->list.count); + mac->ULbwp[0] = uplinkBWP_ToAddModList->list.array[bwp_id - 1]; + AssertFatal(mac->ULbwp[0]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n"); + } + + bwp = mac->DLbwp[0]; + bwp_Common = bwp->bwp_Common; + pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + dl_bwp_Dedicated = bwp->bwp_Dedicated; + pdcch_Config = dl_bwp_Dedicated->pdcch_Config; + searchSpacesToAddModList = pdcch_Config->choice.setup->searchSpacesToAddModList; + + // check USSs + ss_id = 0; + NR_SearchSpace = mac->SSpace[0][0][ss_id]; + while(NR_SearchSpace != NULL && ss_id < searchSpacesToAddModList->list.count) { + AssertFatal(NR_SearchSpace->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n"); + AssertFatal(NR_SearchSpace->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n"); + ss_id++; + } + + if (mac->crnti > 0) { + + NR_SearchSpace_t *css; + NR_SearchSpace_t *uss = NULL; + NR_ServingCellConfigCommon_t *scc; + NR_SearchSpaceId_t ra_SearchSpaceId; + rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + uint16_t monitoringSymbolsWithinSlot; + uint8_t add_dci = 1; + + AssertFatal(mac->scc != NULL, "scc is null\n"); + + scc = mac->scc; + rel15->dci_format = NR_DL_DCI_FORMAT_1_1; + + // CoReSet configuration + coreset = mac->coreset[0][0]; + rel15->coreset.duration = coreset->duration; + for (int i = 0; i < 6; i++) + rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i]; + + rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED; + + if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) { + struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved; + rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize); + rel15->coreset.InterleaverSize = (interleaved->interleaverSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2 + interleaved->interleaverSize); + AssertFatal(scc->physCellId != NULL, "mac->scc->physCellId is null\n"); + rel15->coreset.ShiftIndex = interleaved->shiftIndex != NULL ? *interleaved->shiftIndex : *scc->physCellId; + } else { + rel15->coreset.RegBundleSize = 0; + rel15->coreset.InterleaverSize = 0; + rel15->coreset.ShiftIndex = 0; } - else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION) { - rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + rel15->coreset.CoreSetType = 1; + rel15->coreset.precoder_granularity = coreset->precoderGranularity; + + if (mac->ra_state == WAIT_RAR){ + + NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + AssertFatal(commonSearchSpaceList->list.count > 0, "PDCCH CSS list has 0 elements\n"); + + ra_SearchSpaceId = *pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + + // fetch the CSS for RA from the CSS list + for (int i = 0; i < commonSearchSpaceList->list.count; i++) { + css = commonSearchSpaceList->list.array[i]; + if(css->searchSpaceId == ra_SearchSpaceId) + break; + } + + // check CSSs + if(css != NULL) { + AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n"); + AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n"); + } + + if (frame == mac->msg2_rx_frame && slot == mac->msg2_rx_slot){ + sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; + monitoringSymbolsWithinSlot = (css->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (css->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = mac->ra_rnti; + rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); // NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; + rel15->dci_length = nr_dci_size(mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id); + for (int i = 0; i < sps; i++) + if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) { + rel15->coreset.StartSymbolIndex = i; + break; + } + fill_dci_search_candidates(css, rel15); + } else { + add_dci = 0; + } + } else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION){ + rel15->rnti = mac->t_crnti; - dl_config->number_pdus = dl_config->number_pdus + 1; - } - if (mac->crnti>0) { - rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + } else { + rel15->rnti = mac->crnti; - rel15->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - rel15->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - rel15->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; - // get UE-specific search space - for (ss_id=0;ss_idSSpace[0][0][ss_id]!=NULL;ss_id++) - if (mac->SSpace[0][0][ss_id]->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) break; - AssertFatal(ss_idSSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | - (mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - - for (int i=0; i>(sps-1-i))&1) { - rel15->coreset.StartSymbolIndex=i; - break; - } - rel15->coreset.duration = mac->coreset[0][0]->duration; - for (int i=0;i<6;i++) - rel15->coreset.frequency_domain_resource[i] = mac->coreset[0][0]->frequencyDomainResources.buf[i]; - - rel15->coreset.CceRegMappingType = mac->coreset[0][0]->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved? - FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED; - if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) { - rel15->coreset.RegBundleSize = (mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->reg_BundleSize); - rel15->coreset.InterleaverSize = (mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->interleaverSize); - AssertFatal(mac->scc->physCellId != NULL,"mac->scc->physCellId is null\n"); - rel15->coreset.ShiftIndex = mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->shiftIndex : *mac->scc->physCellId; - } - else { - rel15->coreset.RegBundleSize = 0; - rel15->coreset.InterleaverSize = 0; - rel15->coreset.ShiftIndex = 0; - } - rel15->coreset.CoreSetType = 1; - rel15->coreset.precoder_granularity = mac->coreset[0][0]->precoderGranularity; - if (mac->coreset[0][0]->pdcch_DMRS_ScramblingID) { - rel15->coreset.pdcch_dmrs_scrambling_id = *mac->coreset[0][0]->pdcch_DMRS_ScramblingID; - rel15->coreset.scrambling_rnti = mac->t_crnti; - } - else { - rel15->coreset.pdcch_dmrs_scrambling_id = *mac->scc->physCellId; - rel15->coreset.scrambling_rnti = 0; - } - fill_dci_search_candidates(mac->SSpace[0][0][ss_id],rel15); - rel15->dci_format = NR_DL_DCI_FORMAT_1_1; + rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); + rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; rel15->dci_length = nr_dci_size(mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id); + // get UE-specific search space + for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[0][0][ss_id] != NULL; ss_id++){ + uss = mac->SSpace[0][0][ss_id]; + if (uss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) break; + } + AssertFatal(ss_id < FAPI_NR_MAX_SS_PER_CORESET, "couldn't find a UE-specific SS\n"); + sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + // for SPS=14 8 MSBs in positions 13 down to 6 + monitoringSymbolsWithinSlot = (uss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (uss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + for (int i = 0; i < sps; i++) + if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) { + rel15->coreset.StartSymbolIndex = i; + break; + } + fill_dci_search_candidates(uss, rel15); + } + + // Scrambling RNTI + if (coreset->pdcch_DMRS_ScramblingID) { + rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID; + rel15->coreset.scrambling_rnti = mac->t_crnti; + } else { + rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId; + rel15->coreset.scrambling_rnti = 0; + } + + if (add_dci){ dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI; dl_config->number_pdus = dl_config->number_pdus + 1; } } } - - - - diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c5a53d168a..163855a093 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -42,6 +42,7 @@ #include "NR_RACH-ConfigCommon.h" #include "NR_RACH-ConfigGeneric.h" #include "NR_FrequencyInfoDL.h" +#include "NR_PDCCH-ConfigCommon.h" /* MAC */ #include "mac_defs.h" @@ -75,6 +76,7 @@ extern int bwp_id; extern dci_pdu_rel15_t *def_dci_pdu_rel15; +extern const uint16_t nr_slots_per_frame[5]; extern void mac_rlc_data_ind ( const module_id_t module_idP, @@ -129,7 +131,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, //fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; nr_phy_config_t *phy_config = &mac->phy_config; - //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; // First we need to verify if DCI ind contains a ul-sch to be perfomred. If it does, we will handle a PUSCH in the UL_CONFIG_REQ. ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH; for (int i=0; i<10; i++) { @@ -139,29 +141,28 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, } if (ul_config->ul_config_list[ul_config->number_pdus].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { // fill in the elements in config request inside P5 message - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.bandwidth_part_ind = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.number_rbs = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.start_rb = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.frame_offset = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.number_symbols = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.pusch_freq_hopping = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.mcs = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.rv = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.accumulated_delta_PUSCH = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.absolute_delta_PUSCH = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.tpmi = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_dmrs_cdm_groups = 0; - for (int i=0;i<4;i++) ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.dmrs_ports[i]=0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.n_front_load_symb = 0; - //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.srs_config = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.csi_reportTriggerSize = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.maxCodeBlockGroupsPerTransportBlock = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.ptrs_dmrs_association_port = 0; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15.beta_offset_ind = 0; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.bandwidth_part_ind = 0; //FIXME + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rb_size = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rb_start = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.nr_of_symbols = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.start_symbol_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.frequency_hopping = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.mcs_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.new_data_indicator = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.rv_index = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.pusch_data.harq_process_id = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.absolute_delta_PUSCH = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.nrOfLayers = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.transform_precoding = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.dmrs_ports = 0; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.dmrs_config_type = 0; + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.n_front_load_symb = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.srs_config = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.csi_reportTriggerSize = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.maxCodeBlockGroupsPerTransportBlock = 0; //FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.ptrs_dmrs_association_port = 0; FIXME + //ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.beta_offset_ind = 0; //FIXME } else { // If DCI ind is not format 0_0 or 0_1, we will handle a PUCCH in the UL_CONFIG_REQ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH; // If we handle PUCCH common @@ -653,109 +654,301 @@ uint32_t get_ssb_frame(uint32_t test){ // 1. TODO: Call RRC for link status return to PHY // 2. TODO: Perform SR/BSR procedures for scheduling feedback // 3. TODO: Perform PHR procedures -NR_UE_L2_STATE_t nr_ue_scheduler(const module_id_t module_id, - const uint8_t gNB_index, - const int cc_id, - const frame_t rx_frame, - const slot_t rx_slot, - const int32_t ssb_index, - const frame_t tx_frame, - const slot_t tx_slot ){ +NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_indication_t *ul_info){ uint32_t search_space_mask = 0; - NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; - - // check type0 from 38.213 13 if we have no CellGroupConfig - if ( mac->scg == NULL) { - if( ssb_index != -1){ - - if(mac->type0_pdcch_ss_mux_pattern == 1){ - // 38.213 chapter 13 - if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_0) && !(rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){ - search_space_mask = search_space_mask | type0_pdcch; - mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; - } - if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_1) && (rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){ - search_space_mask = search_space_mask | type0_pdcch; - mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; - } + if (dl_info){ + + module_id_t mod_id = dl_info->module_id; + uint32_t gNB_index = dl_info->gNB_index; + int cc_id = dl_info->cc_id; + frame_t rx_frame = dl_info->frame; + slot_t rx_slot = dl_info->slot; + NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + + fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; + nr_scheduled_response_t scheduled_response; + nr_dcireq_t dcireq; + + // check type0 from 38.213 13 if we have no CellGroupConfig + // TODO: implementation to be completed + if (mac->scg == NULL) { + if(dl_info->ssb_index != -1){ + + if(mac->type0_pdcch_ss_mux_pattern == 1){ + // 38.213 chapter 13 + if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_0) && !(rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){ + search_space_mask = search_space_mask | type0_pdcch; + mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; + } + if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_1) && (rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){ + search_space_mask = search_space_mask | type0_pdcch; + mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; + } + } + if(mac->type0_pdcch_ss_mux_pattern == 2){ + // 38.213 Table 13-13, 13-14 + if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){ + search_space_mask = search_space_mask | type0_pdcch; + mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; + } + } + if(mac->type0_pdcch_ss_mux_pattern == 3){ + // 38.213 Table 13-15 + if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){ + search_space_mask = search_space_mask | type0_pdcch; + mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; + } + } + } // ssb_index != -1 + + // Type0 PDCCH search space + if((search_space_mask & type0_pdcch) || ( mac->type0_pdcch_consecutive_slots != 0 )){ + mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_consecutive_slots - 1; + + dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15 = mac->type0_pdcch_dci_config; + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI; + + /* + dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti = 0xaaaa; // to be set + dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106; // to be set + + LOG_I(MAC,"nr_ue_scheduler Type0 PDCCH with rnti %x, BWP %d\n", + dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti, + dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP); + */ + dl_config->number_pdus = dl_config->number_pdus + 1; + mac->scheduled_response.dl_config = dl_config; } - if(mac->type0_pdcch_ss_mux_pattern == 2){ - // 38.213 Table 13-13, 13-14 - if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){ - search_space_mask = search_space_mask | type0_pdcch; - mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; - } + } else { // we have an scg + + dcireq.module_id = mod_id; + dcireq.gNB_index = gNB_index; + dcireq.cc_id = cc_id; + dcireq.frame = rx_frame; + dcireq.slot = rx_slot; + nr_ue_dcireq(&dcireq); //to be replaced with function pointer later + + // we should have received a DL DCI here, so configure DL accordingly + scheduled_response.dl_config = &dcireq.dl_config_req; + scheduled_response.ul_config = NULL; + scheduled_response.tx_request = NULL; + scheduled_response.module_id = mod_id; + scheduled_response.CC_id = cc_id; + scheduled_response.frame = rx_frame; + scheduled_response.slot = rx_slot; + + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){ + mac->if_module->scheduled_response(&scheduled_response); } - if(mac->type0_pdcch_ss_mux_pattern == 3){ - // 38.213 Table 13-15 - if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){ - search_space_mask = search_space_mask | type0_pdcch; - mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.coreset.duration; - } - } - } // ssb_index != -1 - - // Type0 PDCCH search space - if((search_space_mask & type0_pdcch) || ( mac->type0_pdcch_consecutive_slots != 0 )){ - mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_consecutive_slots - 1; - - dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15 = mac->type0_pdcch_dci_config; - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI; - + /* - dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti = 0xaaaa; // to be set - dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106; // to be set - - LOG_I(MAC,"nr_ue_scheduler Type0 PDCCH with rnti %x, BWP %d\n", - dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti, - dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP); - */ - dl_config->number_pdus = dl_config->number_pdus + 1; + if(search_space_mask & type0a_pdcch){ + } + + if(search_space_mask & type1_pdcch){ + } + + if(search_space_mask & type2_pdcch){ + } + + if(search_space_mask & type3_pdcch){ + } + */ } + } else if (ul_info && ul_info->slot_tx == 8) { + module_id_t mod_id = ul_info->module_id; + uint32_t gNB_index = ul_info->gNB_index; + int cc_id = ul_info->cc_id; + frame_t rx_frame = ul_info->frame_rx; + slot_t rx_slot = ul_info->slot_rx; + NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + + // program PUSCH. this should actually be done upon reception of an UL DCI + nr_dcireq_t dcireq; + nr_scheduled_response_t scheduled_response; + + //--------------------------Temporary configuration-----------------------------// + uint16_t rnti = 0x1234; + uint32_t rb_size = 50; + uint32_t rb_start = 0; + uint8_t nr_of_symbols = 12; + uint8_t start_symbol_index = 2; + uint8_t nrOfLayers = 1; + uint8_t mcs_index = 9; + uint8_t mcs_table = 0; + uint8_t harq_process_id = 0; + uint8_t rv_index = 0; + uint16_t l_prime_mask = get_l_prime(nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + uint8_t dmrs_config_type = 0; + uint8_t ptrs_mcs1 = 2; + uint8_t ptrs_mcs2 = 4; + uint8_t ptrs_mcs3 = 10; + uint16_t n_rb0 = 25; + uint16_t n_rb1 = 75; + uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; + uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, mcs_index, mcs_table); + uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, rb_size); + //------------------------------------------------------------------------------// + + dcireq.module_id = mod_id; + dcireq.gNB_index = gNB_index; + dcireq.cc_id = cc_id; + dcireq.frame = rx_frame; + dcireq.slot = rx_slot; + + scheduled_response.dl_config = NULL; + scheduled_response.ul_config = &dcireq.ul_config_req; + scheduled_response.tx_request = NULL; + scheduled_response.module_id = mod_id; + scheduled_response.CC_id = cc_id; + scheduled_response.frame = rx_frame; + scheduled_response.slot = rx_slot; + + scheduled_response.ul_config->slot = ul_info->slot_tx; + scheduled_response.ul_config->number_pdus = 1; + scheduled_response.ul_config->ul_config_list[0].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rnti = rnti; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_size = rb_size; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.rb_start = rb_start; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nr_of_symbols = nr_of_symbols; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_index = mcs_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = rv_index; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.nrOfLayers = nrOfLayers; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_data.harq_process_id = harq_process_id; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map = pdu_bit_map; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_time_density = ptrs_time_density; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_freq_density = ptrs_freq_density; + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + + if (1 << ptrs_time_density >= nr_of_symbols) { + scheduled_response.ul_config->ul_config_list[0].pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS + } + + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){ + mac->if_module->scheduled_response(&scheduled_response); + } + + // TODO: expand + // Note: Contention resolution is currently not active + if (mac->RA_contention_resolution_timer_active == 1) + ue_contention_resolution(mod_id, gNB_index, cc_id, ul_info->frame_tx); } - else { // get PDCCH configuration(s) from SCGConfig - - - - - // get Coreset and SearchSpace Information from spCellConfigDedicated - - - - /* - if(search_space_mask & type0a_pdcch){ - } - - if(search_space_mask & type1_pdcch){ - } - - if(search_space_mask & type2_pdcch){ - } - - if(search_space_mask & type3_pdcch){ - } - */ - } - - if (mac->RA_contention_resolution_timer_active == 1) { - ue_contention_resolution(module_id, gNB_index, cc_id, tx_frame); - } - - mac->scheduled_response.dl_config = dl_config; - return UE_CONNECTION_OK; } +// Notes: +// - Type1-PDCCH CSS configuration from ra-SearchSpace. +// - Msg2 is scheduled in the mixed slot or in the last dl slot if they are allowed by the Type 1 Common Search Space configuration +// todo: +// - if Type1-PDCCH CSS is not configured in RRC message (Coreset and SearchSpace), UE searches in Type 0 PDCCH CSS. +void nr_ue_msg2_scheduler(module_id_t mod_id, + uint16_t rach_frame, + uint16_t rach_slot, + uint16_t *msg2_frame, + uint16_t *msg2_slot){ + + uint8_t bwp_id = 1; + NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + NR_CellGroupConfig_t *scg = mac->scg; + NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id - 1]; + NR_SearchSpace_t *ss; + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + uint8_t mu = *scc->ssbSubcarrierSpacing; + uint8_t response_window = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.ra_ResponseWindow; + uint8_t slot_window, slot_limit, frame_limit; + uint16_t start_next_period, monitoring_slot_period, monitoring_offset; + + // number of mixed slot or of last dl slot if there is no mixed slot + uint16_t last_dl_slot_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; + uint16_t nr_dl_symbols = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols; + uint16_t nr_ul_symbols = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; + + // lenght of tdd period in slots + uint16_t tdd_period_slot = last_dl_slot_period + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + + AssertFatal(commonSearchSpaceList->list.count > 0, "PDCCH common SearchSpace list has 0 elements\n"); + + LOG_D(MAC, "Frame %d, Slot %d: Scheduling Msg2 reception \n", rach_frame, rach_slot); + + // Common searchspace list + for (int i = 0; i < commonSearchSpaceList->list.count; i++) { + ss = commonSearchSpaceList->list.array[i]; + if(ss->searchSpaceId == *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace) + // retrieving ra pdcch monitoring period and offset + find_monitoring_periodicity_offset_common(ss, &monitoring_slot_period, &monitoring_offset); + } + + if (nr_dl_symbols == 0) + last_dl_slot_period--; + if ((nr_dl_symbols > 0) || (nr_ul_symbols > 0)) + tdd_period_slot++; + + // computing start of next period + start_next_period = (rach_slot - (rach_slot % tdd_period_slot) + tdd_period_slot) % nr_slots_per_frame[mu]; + *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot + *msg2_frame = (*msg2_slot > rach_slot) ? rach_frame : (rach_frame +1); + + switch(response_window){ + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1: + slot_window = 1; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl2: + slot_window = 2; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl4: + slot_window = 4; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl8: + slot_window = 8; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl10: + slot_window = 10; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl20: + slot_window = 20; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl40: + slot_window = 40; + break; + case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl80: + slot_window = 80; + break; + default: + AssertFatal(1==0,"Invalid response window value %d\n",response_window); + } + AssertFatal(slot_window<=nr_slots_per_frame[mu], "Msg2 response window needs to be lower or equal to 10ms"); + + // slot and frame limit to transmit msg2 according to response window + slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu]; + frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + + // go to previous slot if the current scheduled slot is beyond the response window + // and if the slot is not among the PDCCH monitored ones (38.213 10.1) + while ((*msg2_slot > slot_limit) || ((*msg2_frame*nr_slots_per_frame[mu] + *msg2_slot - monitoring_offset) % monitoring_slot_period != 0)) { + if((*msg2_slot % tdd_period_slot) > 0) + (*msg2_slot)--; + else + AssertFatal(1 == 0, "No available DL slot to schedule reception of msg2 has been found"); + } + LOG_D(MAC, "Scheduled Msg2 reception in Frame %d, Slot %d: \n", *msg2_frame, *msg2_slot); +} + // This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x // It fills the PRACH PDU per each FD occasion. // PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3. // - todo: // - Partial configuration is actually already stored in (fapi_nr_prach_config_t) &mac->phy_config.config_req->prach_config -//// however we need rach_ConfigGeneric to retrieve the config_index void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { uint8_t config_index, mu, N_dur, N_t_slot, start_symbol; @@ -775,6 +968,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; config_index = rach_ConfigGeneric->prach_ConfigurationIndex; + mac->RA_offset = 2; // to compensate the rx frame offset at the gNB + if (is_nr_UL_slot(scc, slotP)) { if (setup->msg1_SubcarrierSpacing) @@ -792,7 +987,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s &start_symbol, &N_t_slot, &N_dur); - if (is_nr_prach_slot) { + + if (is_nr_prach_slot && mac->ra_state == RA_UE_IDLE) { + + mac->generate_nr_prach = 1; fdm = rach_ConfigGeneric->msg1_FDM; @@ -892,6 +1090,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s } } } + } else { + mac->generate_nr_prach = 0; } mac->scheduled_response.ul_config = ul_config; } @@ -1863,7 +2063,7 @@ uint8_t table_7_3_2_3_3_4_twoCodeword[6][10] = { {2,0,1,2,3,6,7,8,0,2}, {2,0,1,2,3,6,7,8,9,2} }; -int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu, +int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint16_t n_RB_ULBWP, uint16_t n_RB_DLBWP, @@ -1886,7 +2086,7 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pd dlsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_DLBWP); } - if(ulsch_config_pdu != NULL){ + if(pusch_config_pdu != NULL){ /* * TS 38.214 subclause 6.1.2.2 Resource allocation in frequency domain (uplink) */ @@ -1897,14 +2097,14 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(fapi_nr_ul_config_pusch_pd * TS 38.214 subclause 6.1.2.2.2 Uplink resource allocation type 1 */ - ulsch_config_pdu->number_rbs = NRRIV2BW(riv,n_RB_ULBWP); - ulsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_ULBWP); + pusch_config_pdu->rb_size = NRRIV2BW(riv,n_RB_ULBWP); + pusch_config_pdu->rb_start = NRRIV2PRBOFFSET(riv,n_RB_ULBWP); } return 0; } int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu, + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint8_t time_domain_ind ){ @@ -2043,9 +2243,6 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, SLIV2SL(startSymbolAndLength,&S,&L); dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; - dlsch_config_pdu->frame_offset = pdsch_TimeDomainAllocationList->list.array[time_domain_ind]->k0!=NULL ? - *pdsch_TimeDomainAllocationList->list.array[time_domain_ind]->k0 : - 0; } else {// Default configuration from tables k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -2060,14 +2257,13 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, // k_offset = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - dlsch_config_pdu->frame_offset = k_offset; dlsch_config_pdu->number_symbols = sliv_L; dlsch_config_pdu->start_symbol = sliv_S; } } /* * TS 38.214 subclause 6.1.2.1 Resource allocation in time domain (uplink) */ - if(ulsch_config_pdu != NULL){ + if(pusch_config_pdu != NULL){ NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config) pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; @@ -2079,12 +2275,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, int startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->startSymbolAndLength; int S,L; SLIV2SL(startSymbolAndLength,&S,&L); - ulsch_config_pdu->start_symbol=S; - ulsch_config_pdu->number_symbols=L; - ulsch_config_pdu->frame_offset = pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2!=NULL ? - *pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2 : - mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing < NR_SubcarrierSpacing_kHz60 ? 1 : - mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing < NR_SubcarrierSpacing_kHz120 ? 2 : 3; + pusch_config_pdu->start_symbol_index=S; + pusch_config_pdu->nr_of_symbols=L; } else { k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -2093,9 +2285,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, // k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - ulsch_config_pdu->frame_offset = k_offset; - ulsch_config_pdu->number_symbols = sliv_L; - ulsch_config_pdu->start_symbol = sliv_S; + pusch_config_pdu->nr_of_symbols = sliv_L; + pusch_config_pdu->start_symbol_index = sliv_S; } } return 0; @@ -2148,45 +2339,42 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc * 50 SUL_IND_0_0: */ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_0 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_UL */ - nr_ue_process_dci_freq_dom_resource_assignment(ulsch_config_pdu_0_0,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val); + nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_0,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val); /* TIME_DOM_RESOURCE_ASSIGNMENT */ nr_ue_process_dci_time_dom_resource_assignment(mac, - ulsch_config_pdu_0_0,NULL, + pusch_config_pdu_0_0,NULL, dci->time_domain_assignment.val); /* FREQ_HOPPING_FLAG */ if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0)) - ulsch_config_pdu_0_0->pusch_freq_hopping = (dci->frequency_hopping_flag.val == 0)? pusch_freq_hopping_disabled:pusch_freq_hopping_enabled; + pusch_config_pdu_0_0->frequency_hopping = dci->frequency_hopping_flag.val; + /* MCS */ - ulsch_config_pdu_0_0->mcs = dci->mcs; + pusch_config_pdu_0_0->mcs_index = dci->mcs; /* NDI */ - ulsch_config_pdu_0_0->ndi = dci->ndi; + pusch_config_pdu_0_0->pusch_data.new_data_indicator = dci->ndi; /* RV */ - ulsch_config_pdu_0_0->rv = dci->rv; + pusch_config_pdu_0_0->pusch_data.rv_index = dci->rv; /* HARQ_PROCESS_NUMBER */ - ulsch_config_pdu_0_0->harq_process_nbr = dci->harq_pid; + pusch_config_pdu_0_0->pusch_data.harq_process_id = dci->harq_pid; /* TPC_PUSCH */ // according to TS 38.213 Table Table 7.1.1-1 if (dci->tpc == 0) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = -1; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = -4; + pusch_config_pdu_0_0->absolute_delta_PUSCH = -4; } if (dci->tpc == 1) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 0; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = -1; + pusch_config_pdu_0_0->absolute_delta_PUSCH = -1; } if (dci->tpc == 2) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 1; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = 1; + pusch_config_pdu_0_0->absolute_delta_PUSCH = 1; } if (dci->tpc == 3) { - ulsch_config_pdu_0_0->accumulated_delta_PUSCH = 3; - ulsch_config_pdu_0_0->absolute_delta_PUSCH = 4; + pusch_config_pdu_0_0->absolute_delta_PUSCH = 4; } /* SUL_IND_0_0 */ // To be implemented, FIXME!!! @@ -2223,49 +2411,45 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc * 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space */ ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; - ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; - fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15; + ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu.rnti = rnti; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu_0_1 = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; /* IDENTIFIER_DCI_FORMATS */ /* CARRIER_IND */ /* SUL_IND_0_1 */ /* BANDWIDTH_PART_IND */ - ulsch_config_pdu_0_1->bandwidth_part_ind = dci->bwp_indicator.val; + //pusch_config_pdu_0_1->bandwidth_part_ind = dci->bwp_indicator.val; /* FREQ_DOM_RESOURCE_ASSIGNMENT_UL */ - nr_ue_process_dci_freq_dom_resource_assignment(ulsch_config_pdu_0_1,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val); + nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_1,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val); /* TIME_DOM_RESOURCE_ASSIGNMENT */ - nr_ue_process_dci_time_dom_resource_assignment(mac,ulsch_config_pdu_0_1,NULL, + nr_ue_process_dci_time_dom_resource_assignment(mac,pusch_config_pdu_0_1,NULL, dci->time_domain_assignment.val); /* FREQ_HOPPING_FLAG */ if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0)) - ulsch_config_pdu_0_1->pusch_freq_hopping = (dci->frequency_hopping_flag.val == 0)? pusch_freq_hopping_disabled:pusch_freq_hopping_enabled; + pusch_config_pdu_0_1->frequency_hopping = dci->frequency_hopping_flag.val; /* MCS */ - ulsch_config_pdu_0_1->mcs = dci->mcs; + pusch_config_pdu_0_1->mcs_index = dci->mcs; /* NDI */ - ulsch_config_pdu_0_1->ndi = dci->ndi; + pusch_config_pdu_0_1->pusch_data.new_data_indicator = dci->ndi; /* RV */ - ulsch_config_pdu_0_1->rv = dci->rv; + pusch_config_pdu_0_1->pusch_data.rv_index = dci->rv; /* HARQ_PROCESS_NUMBER */ - ulsch_config_pdu_0_1->harq_process_nbr = dci->harq_pid; + pusch_config_pdu_0_1->pusch_data.harq_process_id = dci->harq_pid; /* FIRST_DAI */ //To be implemented, FIXME!!! /* SECOND_DAI */ //To be implemented, FIXME!!! /* TPC_PUSCH */ // according to TS 38.213 Table Table 7.1.1-1 if (dci->tpc == 0) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = -1; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = -4; + pusch_config_pdu_0_1->absolute_delta_PUSCH = -4; } if (dci->tpc == 1) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 0; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = -1; + pusch_config_pdu_0_1->absolute_delta_PUSCH = -1; } if (dci->tpc == 2) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 1; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = 1; + pusch_config_pdu_0_1->absolute_delta_PUSCH = 1; } if (dci->tpc == 3) { - ulsch_config_pdu_0_1->accumulated_delta_PUSCH = 3; - ulsch_config_pdu_0_1->absolute_delta_PUSCH = 4; + pusch_config_pdu_0_1->absolute_delta_PUSCH = 4; } /* SRS_RESOURCE_IND */ //FIXME!! @@ -2282,16 +2466,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 3) || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 4))){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][0]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][1]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][0]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][1]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_partialAndNonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][2]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][3]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][2]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][3]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][4]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][5]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][4]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][5]; } } // Table 7.3.1.1.2-3: transformPrecoder= enabled, or transformPrecoder=disabled and maxRank = 1 @@ -2299,16 +2483,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled)) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][6]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][7]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][6]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][7]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_partialAndNonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][8]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][9]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][8]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][9]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][10]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][11]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][10]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][11]; } } } @@ -2317,12 +2501,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 2)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][12]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][13]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][12]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][13]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][14]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][15]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][14]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][15]; } } // Table 7.3.1.1.2-5: transformPrecoder= enabled, or transformPrecoder= disabled and maxRank = 1 @@ -2330,12 +2514,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc || (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled)) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1)){ if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][16]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][17]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][16]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][17]; } if (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.codebook_subset == codebook_subset_nonCoherent){ - ulsch_config_pdu_0_1->n_layers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][18]; - ulsch_config_pdu_0_1->tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][19]; + pusch_config_pdu_0_1->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][18]; + pusch_config_pdu_0_1->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][19]; } } } @@ -2345,146 +2529,158 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-6 - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = dci->antenna_ports.val; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = dci->antenna_ports.val; //TBC } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-7 - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports.val > 3)?(dci->antenna_ports.val-4):(dci->antenna_ports.val); - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 3)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports.val > 3)?(dci->antenna_ports.val-4):(dci->antenna_ports.val); //TBC + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports > 3)?2:1; //FIXME } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-8/9/10/11 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 1)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val-2):(dci->antenna_ports.val); + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val-2):(dci->antenna_ports.val); //TBC } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 0)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 2 ?0:2):0; - ulsch_config_pdu_0_1->dmrs_ports[1] = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 2 ?2:3):1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?0:2):0; + //pusch_config_pdu_0_1->dmrs_ports[1] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?2:3):1; } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; - ulsch_config_pdu_0_1->dmrs_ports[3] = 3; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; + //pusch_config_pdu_0_1->dmrs_ports[3] = 3; } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-12/13/14/15 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 1)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 5 ?(dci->antenna_ports.val-6):(dci->antenna_ports.val-2)):dci->antenna_ports.val; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 6)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 5 ?(dci->antenna_ports.val-6):(dci->antenna_ports.val-2)):dci->antenna_ports.val; //TBC + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 6)?2:1; //FIXME } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 0)?2:1; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_13[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_13[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 3)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?2:1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_13[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_13[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 3)?2:1; // FIXME } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_14[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_14[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_14[dci->antenna_ports.val][3]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 1)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_14[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_14[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_14[dci->antenna_ports.val][3]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 1)?2:1; //FIXME } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_15[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_15[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_15[dci->antenna_ports.val][3]; - ulsch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_15[dci->antenna_ports.val][4]; - ulsch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 1)?2:1; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_15[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_15[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_15[dci->antenna_ports.val][3]; + //pusch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_15[dci->antenna_ports.val][4]; + //pusch_config_pdu_0_1->n_front_load_symb = (dci->antenna_ports.val > 1)?2:1; //FIXME } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-16/17/18/19 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 1)?((dci->antenna_ports.val > 5)?3:2):1; - ulsch_config_pdu_0_1->dmrs_ports[0] = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 5 ?(dci->antenna_ports.val-6):(dci->antenna_ports.val-2)):dci->antenna_ports.val; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?((dci->antenna_ports.val > 5)?3:2):1; //TBC + pusch_config_pdu_0_1->dmrs_ports = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val > 5 ?(dci->antenna_ports.val-6):(dci->antenna_ports.val-2)):dci->antenna_ports.val; //TBC } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 0)?((dci->antenna_ports.val > 2)?3:2):1; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_17[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_17[dci->antenna_ports.val][2]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?((dci->antenna_ports.val > 2)?3:2):1; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_17[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_17[dci->antenna_ports.val][2]; } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = (dci->antenna_ports.val > 0)?3:2; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_18[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_18[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_18[dci->antenna_ports.val][3]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?3:2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_18[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_18[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_18[dci->antenna_ports.val][3]; } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = dci->antenna_ports.val + 2; - ulsch_config_pdu_0_1->dmrs_ports[0] = 0; - ulsch_config_pdu_0_1->dmrs_ports[1] = 1; - ulsch_config_pdu_0_1->dmrs_ports[2] = 2; - ulsch_config_pdu_0_1->dmrs_ports[3] = 3; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = dci->antenna_ports.val + 2; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = 0; + //pusch_config_pdu_0_1->dmrs_ports[1] = 1; + //pusch_config_pdu_0_1->dmrs_ports[2] = 2; + //pusch_config_pdu_0_1->dmrs_ports[3] = 3; } } if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-20/21/22/23 if (rank == 1){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_20[dci->antenna_ports.val][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_20[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_20[dci->antenna_ports.val][2]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_20[dci->antenna_ports.val][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = table_7_3_1_1_2_20[dci->antenna_ports.val][1]; //TBC + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_20[dci->antenna_ports.val][2]; //FIXME } if (rank == 2){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_21[dci->antenna_ports.val][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_21[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_21[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_21[dci->antenna_ports.val][3]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_21[dci->antenna_ports.val][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_21[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_21[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_21[dci->antenna_ports.val][3]; //FIXME } if (rank == 3){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_22[dci->antenna_ports.val][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_22[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_22[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_22[dci->antenna_ports.val][3]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_22[dci->antenna_ports.val][4]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_22[dci->antenna_ports.val][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_22[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_22[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_22[dci->antenna_ports.val][3]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_22[dci->antenna_ports.val][4]; //FIXME } if (rank == 4){ - ulsch_config_pdu_0_1->n_dmrs_cdm_groups = table_7_3_1_1_2_23[dci->antenna_ports.val][0]; - ulsch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_23[dci->antenna_ports.val][1]; - ulsch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_23[dci->antenna_ports.val][2]; - ulsch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_23[dci->antenna_ports.val][3]; - ulsch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_23[dci->antenna_ports.val][4]; - ulsch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_23[dci->antenna_ports.val][5]; + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_23[dci->antenna_ports.val][0]; //TBC + pusch_config_pdu_0_1->dmrs_ports = 0; //FIXME + //pusch_config_pdu_0_1->dmrs_ports[0] = table_7_3_1_1_2_23[dci->antenna_ports.val][1]; + //pusch_config_pdu_0_1->dmrs_ports[1] = table_7_3_1_1_2_23[dci->antenna_ports.val][2]; + //pusch_config_pdu_0_1->dmrs_ports[2] = table_7_3_1_1_2_23[dci->antenna_ports.val][3]; + //pusch_config_pdu_0_1->dmrs_ports[3] = table_7_3_1_1_2_23[dci->antenna_ports.val][4]; + //pusch_config_pdu_0_1->n_front_load_symb = table_7_3_1_1_2_23[dci->antenna_ports.val][5]; //FIXME } } /* SRS_REQUEST */ // if SUL is supported in the cell, there is an additional bit in thsi field and the value of this bit represents table 7.1.1.1-1 TS 38.212 FIXME!!! - ulsch_config_pdu_0_1->srs_config.aperiodicSRS_ResourceTrigger = (dci->srs_request.val & 0x11); // as per Table 7.3.1.1.2-24 TS 38.212 + //pusch_config_pdu_0_1->srs_config.aperiodicSRS_ResourceTrigger = (dci->srs_request.val & 0x11); // as per Table 7.3.1.1.2-24 TS 38.212 //FIXME /* CSI_REQUEST */ - ulsch_config_pdu_0_1->csi_reportTriggerSize = dci->csi_request.val; + //pusch_config_pdu_0_1->csi_reportTriggerSize = dci->csi_request.val; //FIXME /* CBGTI */ - ulsch_config_pdu_0_1->maxCodeBlockGroupsPerTransportBlock = dci->cbgti.val; + //pusch_config_pdu_0_1->maxCodeBlockGroupsPerTransportBlock = dci->cbgti.val; //FIXME /* PTRS_DMRS */ if (((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_disabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.ptrs_uplink_config == 0)) || ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.max_rank == 1))){ } else { - ulsch_config_pdu_0_1->ptrs_dmrs_association_port = dci->ptrs_dmrs_association.val; + //pusch_config_pdu_0_1->ptrs_dmrs_association_port = dci->ptrs_dmrs_association.val; //FIXME } /* BETA_OFFSET_IND */ // Table 9.3-3 in [5, TS 38.213] - ulsch_config_pdu_0_1->beta_offset_ind = dci->beta_offset_indicator.val; + //pusch_config_pdu_0_1->beta_offset_ind = dci->beta_offset_indicator.val; //FIXME /* DMRS_SEQ_INI */ // FIXME!! /* UL_SCH_IND */ @@ -2601,7 +2797,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc /* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/ dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = dci->pdsch_to_harq_feedback_timing_indicator.val; - LOG_D(MAC,"(nr_ue_procedures.c) rnti=%d dl_config->number_pdus=%d\n", + LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n", dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti, dl_config->number_pdus); LOG_D(MAC,"(nr_ue_procedures.c) frequency_domain_resource_assignment=%d \t number_rbs=%d \t start_rb=%d\n", @@ -2624,7 +2820,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc dlsch_config_pdu_1_0->pucch_resource_id, dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind); - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + if (mac->ra_rnti == rnti) + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; + else + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + // dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP; LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); @@ -3609,7 +3809,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP, /////* ULSCH MAC PDU generation (6.1.2 TS 38.321) *///// //////////////////////////////////////////////////////// -unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, +uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, uint8_t *pdu, uint8_t num_sdus, uint16_t *sdu_lengths, @@ -3624,7 +3824,8 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) pdu; unsigned char last_size = 0, i, mac_header_control_elements[16], *ce_ptr, bsr = 0; - int mac_ce_size, offset; + int mac_ce_size; + uint16_t offset = 0; LOG_D(MAC, "[UE] Generating ULSCH PDU : num_sdus %d\n", num_sdus); @@ -3774,7 +3975,7 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, // compute final offset offset = ((unsigned char *) mac_pdu_ptr - pdu); - //printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - mac_pdu)); + //printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - pdu)); return offset; } diff --git a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c index e9d3f8c327..31a865f317 100644 --- a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c +++ b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c @@ -44,6 +44,7 @@ #include "NR_MAC_UE/mac.h" #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC_COMMON/nr_mac_extern.h" +#include #define DEBUG_RAR @@ -105,7 +106,7 @@ uint16_t nr_ue_process_rar(module_id_t mod_id, NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer uint8_t n_subPDUs = 0; // number of RAR payloads uint8_t n_subheaders = 0; // number of MAC RAR subheaders - uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs + //uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs unsigned char freq_hopping, msg3_t_alloc, mcs, tpc_command, csi_req; uint16_t ta_command = 0, msg3_f_alloc, bwp_size; int f_alloc, mask; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 5e4e7b207c..fad20e501d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -59,7 +59,7 @@ #include "executables/softmodem-common.h" -const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; +const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; void clear_nr_nfapi_information(gNB_MAC_INST * gNB, @@ -368,9 +368,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, gNB_MAC_INST *gNB = RC.nrmac[module_idP]; NR_UE_list_t *UE_list = &gNB->UE_list; NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels; + NR_COMMON_channels_t *cc = gNB->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - int num_slots_per_tdd = (nr_slots_per_frame[*scc->ssbSubcarrierSpacing])>>(7-scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); + int num_slots_per_tdd = (slots_per_frame[*scc->ssbSubcarrierSpacing])>>(7-scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) @@ -399,7 +399,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // hardcoding dlsch to be in slot 1 if (!(slot_txP%num_slots_per_tdd)) { if(slot_txP==0) - *dlsch_in_slot_bitmap = 0x7e; + *dlsch_in_slot_bitmap = 0x02; else *dlsch_in_slot_bitmap = 0x00; } @@ -435,7 +435,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, rnti = 0;//UE_RNTI(module_idP, i); CC_id = 0;//UE_PCCID(module_idP, i); - + } //END if (UE_list->active[i]) } //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++) */ @@ -445,26 +445,31 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_mib(module_idP, frame_txP, slot_txP); } - // TbD once RACH is available, start ta_timer when UE is connected - if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--; - - if (ue_sched_ctl->ta_timer == 0) { - gNB->ta_command = ue_sched_ctl->ta_update; - /* if time is up, then set the timer to not send it for 5 frames - // regardless of the TA value */ - ue_sched_ctl->ta_timer = 100; - /* reset ta_update */ - ue_sched_ctl->ta_update = 31; - /* MAC CE flag indicating TA length */ - gNB->ta_len = 2; - } - if (get_softmodem_params()->phy_test == 0) nr_schedule_RA(module_idP, frame_txP, slot_txP); else UE_list->fiveG_connected[UE_id] = true; // Phytest scheduling + + if (get_softmodem_params()->phy_test) { + + // TbD once RACH is available, start ta_timer when UE is connected + if (ue_sched_ctl->ta_timer) + ue_sched_ctl->ta_timer--; + + if (ue_sched_ctl->ta_timer == 0) { + gNB->ta_command = ue_sched_ctl->ta_update; + /* if time is up, then set the timer to not send it for 5 frames + // regardless of the TA value */ + ue_sched_ctl->ta_timer = 100; + /* reset ta_update */ + ue_sched_ctl->ta_update = 31; + /* MAC CE flag indicating TA length */ + gNB->ta_len = 2; + } + } + if (UE_list->fiveG_connected[UE_id] && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot_txP%num_slots_per_tdd))) { ue_sched_ctl->current_harq_pid = slot_txP % num_slots_per_tdd; nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, num_slots_per_tdd, NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 31bdfc6a1b..db93734a7d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -44,6 +44,7 @@ extern RAN_CONTEXT_t RC; const uint8_t nr_slots_per_frame_mac[5] = {10, 20, 40, 80, 160}; + uint8_t DELTA[4]= {2,3,4,6}; void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { @@ -220,13 +221,14 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, // slot and frame limit to transmit msg2 according to response window uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame_mac[mu]; - uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + //uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + // go to previous slot if the current scheduled slot is beyond the response window // and if the slot is not among the PDCCH monitored ones (38.213 10.1) while ((*msg2_slot>slot_limit) || ((*msg2_frame*nr_slots_per_frame_mac[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0)) { if((*msg2_slot%tdd_period_slot) > 0) - *msg2_slot--; + (*msg2_slot)--; else AssertFatal(1==0,"No available DL slot to schedule msg2 has been found"); } @@ -762,7 +764,8 @@ void nr_fill_rar(uint8_t Mod_idP, NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); unsigned char csi_req = 0, tpc_command; - uint8_t N_UL_Hop, valid_bits; + //uint8_t N_UL_Hop; + uint8_t valid_bits; uint32_t ul_grant; uint16_t f_alloc, prb_alloc, bwp_size, truncation=0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7777e307fb..cf2323f571 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -47,6 +47,10 @@ //////////////////////////////////////////////////////// /////* DLSCH MAC PDU generation (6.1.2 TS 38.321) *///// //////////////////////////////////////////////////////// +#define OCTET 8 +#define HALFWORD 16 +#define WORD 32 +//#define SIZE_OF_POINTER sizeof (void *) int nr_generate_dlsch_pdu(module_id_t module_idP, unsigned char *sdus_payload, @@ -56,19 +60,23 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, unsigned char *sdu_lcids, unsigned char drx_cmd, unsigned char *ue_cont_res_id, - unsigned short post_padding){ - + unsigned short post_padding) { gNB_MAC_INST *gNB = RC.nrmac[module_idP]; - NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) mac_pdu; - unsigned char * dlsch_buffer_ptr = sdus_payload; + unsigned char *dlsch_buffer_ptr = sdus_payload; uint8_t last_size = 0; int offset = 0, mac_ce_size, i, timing_advance_cmd, tag_id = 0; - // MAC CEs + // MAC CEs uint8_t mac_header_control_elements[16], *ce_ptr; ce_ptr = &mac_header_control_elements[0]; + uint16_t UE_id = 0; //TODO need to get as a function parameter or need to invoke api to UE_id using module Id and RNTI + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + NR_UE_list_t *UE_list = &gNB_mac->UE_list; + NR_UE_sched_ctrl_t *ue_sched_ctl = NULL; + //NR_CellGroupConfig_t *config = UE_list->secondaryCellGroup[UE_id]; + ue_sched_ctl = &(UE_list->UE_sched_ctrl[UE_id]); - // 1) Compute MAC CE and related subheaders + // 1) Compute MAC CE and related subheaders // DRX command subheader (MAC CE size 0) if (drx_cmd != 255) { @@ -83,25 +91,23 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, // now TA is always send when ta_timer resets regardless of its value // this is done to avoid issues with the timeAlignmentTimer which is // supposed to monitor if the UE received TA or not */ - if (gNB->ta_len){ + if (gNB->ta_len) { mac_pdu_ptr->R = 0; mac_pdu_ptr->LCID = DL_SCH_LCID_TA_COMMAND; //last_size = 1; mac_pdu_ptr++; - // TA MAC CE (1 octet) timing_advance_cmd = gNB->ta_command; - AssertFatal(timing_advance_cmd < 64,"timing_advance_cmd %d > 63\n", timing_advance_cmd); + AssertFatal(timing_advance_cmd < 64, "timing_advance_cmd %d > 63\n", timing_advance_cmd); ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND = timing_advance_cmd; //(timing_advance_cmd+31)&0x3f; - if (gNB->tag->tag_Id != 0){ - tag_id = gNB->tag->tag_Id; + + if (gNB->tag->tag_Id != 0) { + tag_id = gNB->tag->tag_Id; ((NR_MAC_CE_TA *) ce_ptr)->TAGID = tag_id; } LOG_D(MAC, "NR MAC CE timing advance command = %d (%d) TAG ID = %d\n", timing_advance_cmd, ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND, tag_id); - mac_ce_size = sizeof(NR_MAC_CE_TA); - // Copying bytes for MAC CEs to the mac pdu pointer memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size); ce_ptr += mac_ce_size; @@ -111,27 +117,189 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, // Contention resolution fixed subheader and MAC CE if (ue_cont_res_id) { mac_pdu_ptr->R = 0; - mac_pdu_ptr->LCID = DL_SCH_LCID_CON_RES_ID; + mac_pdu_ptr->LCID = DL_SCH_LCID_CON_RES_ID; mac_pdu_ptr++; //last_size = 1; - // contention resolution identity MAC ce has a fixed 48 bit size - // this contains the UL CCCH SDU. If UL CCCH SDU is longer than 48 bits, + // this contains the UL CCCH SDU. If UL CCCH SDU is longer than 48 bits, // it contains the first 48 bits of the UL CCCH SDU LOG_T(MAC, "[gNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n", - ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2], - ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]); - + ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2], + ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]); // Copying bytes (6 octects) to CEs pointer mac_ce_size = 6; memcpy(ce_ptr, ue_cont_res_id, mac_ce_size); - // Copying bytes for MAC CEs to mac pdu pointer memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size); ce_ptr += mac_ce_size; mac_pdu_ptr += (unsigned char) mac_ce_size; } + //TS 38.321 Sec 6.1.3.15 TCI State indication for UE Specific PDCCH MAC CE SubPDU generation + if (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.is_scheduled) { + //filling subheader + mac_pdu_ptr->R = 0; + mac_pdu_ptr->LCID = DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH; + mac_pdu_ptr++; + //Creating the instance of CE structure + NR_TCI_PDCCH nr_UESpec_TCI_StateInd_PDCCH; + //filling the CE structre + nr_UESpec_TCI_StateInd_PDCCH.CoresetId1 = ((ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId) & 0xF) >> 1; //extracting MSB 3 bits from LS nibble + nr_UESpec_TCI_StateInd_PDCCH.ServingCellId = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.servingCellId) & 0x1F; //extracting LSB 5 Bits + nr_UESpec_TCI_StateInd_PDCCH.TciStateId = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.tciStateId) & 0x7F; //extracting LSB 7 bits + nr_UESpec_TCI_StateInd_PDCCH.CoresetId2 = (ue_sched_ctl->UE_mac_ce_ctrl.pdcch_state_ind.coresetId) & 0x1; //extracting LSB 1 bit + LOG_D(MAC, "NR MAC CE TCI state indication for UE Specific PDCCH = %d \n", nr_UESpec_TCI_StateInd_PDCCH.TciStateId); + mac_ce_size = sizeof(NR_TCI_PDCCH); + // Copying bytes for MAC CEs to the mac pdu pointer + memcpy((void *) mac_pdu_ptr, (void *)&nr_UESpec_TCI_StateInd_PDCCH, mac_ce_size); + //incrementing the PDU pointer + mac_pdu_ptr += (unsigned char) mac_ce_size; + } + + //TS 38.321 Sec 6.1.3.16, SP CSI reporting on PUCCH Activation/Deactivation MAC CE + if (ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.is_scheduled) { + //filling the subheader + mac_pdu_ptr->R = 0; + mac_pdu_ptr->LCID = DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT; + mac_pdu_ptr++; + //creating the instance of CE structure + NR_PUCCH_CSI_REPORTING nr_PUCCH_CSI_reportingActDeact; + //filling the CE structure + nr_PUCCH_CSI_reportingActDeact.BWP_Id = (ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.bwpId) & 0x3; //extracting LSB 2 bibs + nr_PUCCH_CSI_reportingActDeact.ServingCellId = (ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.servingCellId) & 0x1F; //extracting LSB 5 bits + nr_PUCCH_CSI_reportingActDeact.S0 = ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.s0tos3_actDeact[0]; + nr_PUCCH_CSI_reportingActDeact.S1 = ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.s0tos3_actDeact[1]; + nr_PUCCH_CSI_reportingActDeact.S2 = ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.s0tos3_actDeact[2]; + nr_PUCCH_CSI_reportingActDeact.S3 = ue_sched_ctl->UE_mac_ce_ctrl.SP_CSI_reporting_pucch.s0tos3_actDeact[3]; + nr_PUCCH_CSI_reportingActDeact.R2 = 0; + mac_ce_size = sizeof(NR_PUCCH_CSI_REPORTING); + // Copying MAC CE data to the mac pdu pointer + memcpy((void *) mac_pdu_ptr, (void *)&nr_PUCCH_CSI_reportingActDeact, mac_ce_size); + //incrementing the PDU pointer + mac_pdu_ptr += (unsigned char) mac_ce_size; + } + + //TS 38.321 Sec 6.1.3.14, TCI State activation/deactivation for UE Specific PDSCH MAC CE + if (ue_sched_ctl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.is_scheduled) { + //Computing the number of octects to be allocated for Flexible array member + //of MAC CE structure + uint8_t num_octects = (ue_sched_ctl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.highestTciStateActivated) / 8 + 1; //Calculating the number of octects for allocating the memory + //filling the subheader + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->R = 0; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t); + last_size = 2; + //Incrementing the PDU pointer + mac_pdu_ptr += last_size; + //allocating memory for CE Structure + NR_TCI_PDSCH_APERIODIC_CSI *nr_UESpec_TCI_StateInd_PDSCH = (NR_TCI_PDSCH_APERIODIC_CSI *)malloc(sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t)); + //initializing to zero + memset((void *)nr_UESpec_TCI_StateInd_PDSCH, 0, sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t)); + //filling the CE Structure + nr_UESpec_TCI_StateInd_PDSCH->BWP_Id = (ue_sched_ctl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.bwpId) & 0x3; //extracting LSB 2 Bits + nr_UESpec_TCI_StateInd_PDSCH->ServingCellId = (ue_sched_ctl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.servingCellId) & 0x1F; //extracting LSB 5 bits + + for(i = 0; i < (num_octects * 8); i++) { + if(ue_sched_ctl->UE_mac_ce_ctrl.pdsch_TCI_States_ActDeact.tciStateActDeact[i]) + nr_UESpec_TCI_StateInd_PDSCH->T[i / 8] = nr_UESpec_TCI_StateInd_PDSCH->T[i / 8] | (1 << (i % 8)); + } + + mac_ce_size = sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t); + //Copying bytes for MAC CEs to the mac pdu pointer + memcpy((void *) mac_pdu_ptr, (void *)nr_UESpec_TCI_StateInd_PDSCH, mac_ce_size); + //incrementing the mac pdu pointer + mac_pdu_ptr += (unsigned char) mac_ce_size; + //freeing the allocated memory + free(nr_UESpec_TCI_StateInd_PDSCH); + } + + //TS38.321 Sec 6.1.3.13 Aperiodic CSI Trigger State Subselection MAC CE + if (ue_sched_ctl->UE_mac_ce_ctrl.aperi_CSI_trigger.is_scheduled) { + //Computing the number of octects to be allocated for Flexible array member + //of MAC CE structure + uint8_t num_octects = (ue_sched_ctl->UE_mac_ce_ctrl.aperi_CSI_trigger.highestTriggerStateSelected) / 8 + 1; //Calculating the number of octects for allocating the memory + //filling the subheader + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->R = 0; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL; + ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t); + last_size = 2; + //Incrementing the PDU pointer + mac_pdu_ptr += last_size; + //allocating memory for CE structure + NR_TCI_PDSCH_APERIODIC_CSI *nr_Aperiodic_CSI_Trigger = (NR_TCI_PDSCH_APERIODIC_CSI *)malloc(sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t)); + //initializing to zero + memset((void *)nr_Aperiodic_CSI_Trigger, 0, sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t)); + //filling the CE Structure + nr_Aperiodic_CSI_Trigger->BWP_Id = (ue_sched_ctl->UE_mac_ce_ctrl.aperi_CSI_trigger.bwpId) & 0x3; //extracting LSB 2 bits + nr_Aperiodic_CSI_Trigger->ServingCellId = (ue_sched_ctl->UE_mac_ce_ctrl.aperi_CSI_trigger.servingCellId) & 0x1F; //extracting LSB 5 bits + nr_Aperiodic_CSI_Trigger->R = 0; + + for(i = 0; i < (num_octects * 8); i++) { + if(ue_sched_ctl->UE_mac_ce_ctrl.aperi_CSI_trigger.triggerStateSelection[i]) + nr_Aperiodic_CSI_Trigger->T[i / 8] = nr_Aperiodic_CSI_Trigger->T[i / 8] | (1 << (i % 8)); + } + + mac_ce_size = sizeof(NR_TCI_PDSCH_APERIODIC_CSI) + num_octects * sizeof(uint8_t); + // Copying bytes for MAC CEs to the mac pdu pointer + memcpy((void *) mac_pdu_ptr, (void *)nr_Aperiodic_CSI_Trigger, mac_ce_size); + //incrementing the mac pdu pointer + mac_pdu_ptr += (unsigned char) mac_ce_size; + //freeing the allocated memory + free(nr_Aperiodic_CSI_Trigger); + } + + if (ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.is_scheduled) { + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT; + mac_pdu_ptr++; + ((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->A_D = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.act_deact; + ((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->CELLID = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.serv_cell_id & 0x1F; //5 bits + ((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->BWPID = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.bwpid & 0x3; //2 bits + ((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->CSIRS_RSC_ID = ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.rsc_id & 0xF; //4 bits + ((NR_MAC_CE_SP_ZP_CSI_RS_RES_SET *) mac_pdu_ptr)->R = 0; + LOG_D(MAC, "NR MAC CE of ZP CSIRS Serv cell ID = %d BWPID= %d Rsc set ID = %d\n", ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.serv_cell_id, ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.bwpid, + ue_sched_ctl->UE_mac_ce_ctrl.sp_zp_csi_rs.rsc_id); + mac_ce_size = sizeof(NR_MAC_CE_SP_ZP_CSI_RS_RES_SET); + mac_pdu_ptr += (unsigned char) mac_ce_size; + } + + if (ue_sched_ctl->UE_mac_ce_ctrl.csi_im.is_scheduled) { + mac_pdu_ptr->R = 0; + mac_pdu_ptr->LCID = DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT; + mac_pdu_ptr++; + CSI_RS_CSI_IM_ACT_DEACT_MAC_CE csi_rs_im_act_deact_ce; + csi_rs_im_act_deact_ce.A_D = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.act_deact; + csi_rs_im_act_deact_ce.SCID = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.serv_cellid & 0x3F;//gNB_PHY -> ssb_pdu.ssb_pdu_rel15.PhysCellId; + csi_rs_im_act_deact_ce.BWP_ID = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.bwp_id; + csi_rs_im_act_deact_ce.R1 = 0; + csi_rs_im_act_deact_ce.IM = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.im;// IF set CSI IM Rsc id will presesent else CSI IM RSC ID is abscent + csi_rs_im_act_deact_ce.SP_CSI_RSID = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.nzp_csi_rsc_id; + + if ( csi_rs_im_act_deact_ce.IM ) { //is_scheduled if IM is 1 else this field will not present + csi_rs_im_act_deact_ce.R2 = 0; + csi_rs_im_act_deact_ce.SP_CSI_IMID = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.csi_im_rsc_id; + mac_ce_size = sizeof ( csi_rs_im_act_deact_ce ) - sizeof ( csi_rs_im_act_deact_ce.TCI_STATE ); + } else { + mac_ce_size = sizeof ( csi_rs_im_act_deact_ce ) - sizeof ( csi_rs_im_act_deact_ce.TCI_STATE ) - 1; + } + + memcpy ((void *) mac_pdu_ptr, (void *) & ( csi_rs_im_act_deact_ce), mac_ce_size); + mac_pdu_ptr += (unsigned char) mac_ce_size; + + if (csi_rs_im_act_deact_ce.A_D ) { //Following IE is_scheduled only if A/D is 1 + mac_ce_size = sizeof ( struct TCI_S); + + for ( i = 0; i < ue_sched_ctl->UE_mac_ce_ctrl.csi_im.nb_tci_resource_set_id; i++) { + csi_rs_im_act_deact_ce.TCI_STATE.R = 0; + csi_rs_im_act_deact_ce.TCI_STATE.TCI_STATE_ID = ue_sched_ctl->UE_mac_ce_ctrl.csi_im.tci_state_id [i] & 0x7F; + memcpy ((void *) mac_pdu_ptr, (void *) & (csi_rs_im_act_deact_ce.TCI_STATE), mac_ce_size); + mac_pdu_ptr += (unsigned char) mac_ce_size; + } + } + } + // 2) Generation of DLSCH MAC subPDUs including subheaders and MAC SDUs for (i = 0; i < num_sdus; i++) { LOG_D(MAC, "[gNB] Generate DLSCH header num sdu %d len sdu %d\n", num_sdus, sdu_lengths[i]); @@ -152,10 +320,9 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, } mac_pdu_ptr += last_size; - // 3) cycle through SDUs, compute each relevant and place dlsch_buffer in memcpy((void *) mac_pdu_ptr, (void *) dlsch_buffer_ptr, sdu_lengths[i]); - dlsch_buffer_ptr+= sdu_lengths[i]; + dlsch_buffer_ptr += sdu_lengths[i]; mac_pdu_ptr += sdu_lengths[i]; } @@ -164,19 +331,16 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = DL_SCH_LCID_PADDING; mac_pdu_ptr++; - - } else { + } else { // no MAC subPDU with padding } // compute final offset offset = ((unsigned char *) mac_pdu_ptr - mac_pdu); - //printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - mac_pdu)); - return offset; } /* functionalities of this function have been moved to nr_schedule_uss_dlsch_phytest */ -void nr_schedule_ue_spec(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ +void nr_schedule_ue_spec(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 8713dc5e32..12b7f7bfcf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -252,7 +252,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, int configure_fapi_dl_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req, - NR_sched_pucch *pucch_sched, + NR_sched_pucch *pucch_sched, uint8_t *mcsIndex, uint16_t *rbSize, uint16_t *rbStart) { @@ -315,7 +315,7 @@ int configure_fapi_dl_pdu(int Mod_idP, pdsch_pdu_rel15->qamModOrder[0] = 2; pdsch_pdu_rel15->mcsIndex[0] = mcs; pdsch_pdu_rel15->mcsTable[0] = 0; - pdsch_pdu_rel15->rvIndex[0] = UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round; + pdsch_pdu_rel15->rvIndex[0] = (get_softmodem_params()->phy_test==1) ? 0 : UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; @@ -439,7 +439,7 @@ int configure_fapi_dl_pdu(int Mod_idP, fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,bwp_id); - LOG_D(MAC, "DCI params: rnti %d, rnti_type %d, dci_format %d\n \ + LOG_D(MAC, "DCI params: rnti %x, rnti_type %d, dci_format %d\n \ coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", pdcch_pdu_rel15->dci_pdu.RNTI[0], rnti_types[0], @@ -573,7 +573,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, /*TBS_bytes = configure_fapi_dl_pdu(module_idP, dl_req, - pucch_sched, + pucch_sched, dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL, dlsch_config!=NULL ? &dlsch_config->rbSize : NULL, dlsch_config!=NULL ? &dlsch_config->rbStart : NULL); @@ -689,12 +689,12 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, // fill dlsch_buffer with random data for (i = 0; i < TBS_bytes; i++){ - //mac_sdus[i] = (unsigned char) rand(); - ((uint8_t *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) (lrand48()&0xff); + mac_sdus[i] = (unsigned char) (lrand48()&0xff); + //((uint8_t *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) (lrand48()&0xff); } //Sending SDUs with size 1 //Initialize elements of sdu_lcids and sdu_lengths - sdu_lcids[0] = 0x05; // DRB + sdu_lcids[0] = 0x3f; // DRB sdu_lengths[0] = TBS_bytes - ta_len - 3; header_length_total += 2 + (sdu_lengths[0] >= 128); sdu_length_total += sdu_lengths[0]; @@ -728,7 +728,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, offset = nr_generate_dlsch_pdu(module_idP, (unsigned char *) mac_sdus, - (unsigned char *) gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0], //(unsigned char *) mac_pdu, + (unsigned char *) gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0], num_sdus, //num_sdus sdu_lengths, sdu_lcids, @@ -839,13 +839,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; //It equals the higher-layer parameter Data-scrambling-Identity if configured and the RNTI equals the C-RNTI, otherwise L2 needs to set it to physical cell id.; pusch_pdu->nrOfLayers = 1; - //DMRS - pusch_pdu->ul_dmrs_symb_pos = 1<<2; //for now the gnb assumes dmrs in the first symbol of the scheduled pusch resource - pusch_pdu->dmrs_config_type = 0; //dmrs-type 1 (the one with a single DMRS symbol in the beginning) - pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id. - pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0. - pusch_pdu->num_dmrs_cdm_grps_no_data = 1; - //pusch_pdu->dmrs_ports; //DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports. Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011 and for each bit 0: DMRS port not used 1: DMRS port used + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] pusch_pdu->resource_alloc = 1; //type 1 //pusch_pdu->rb_bitmap;// for ressource alloc type 0 @@ -858,6 +852,40 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, //Resource Allocation in time domain pusch_pdu->start_symbol_index = 2; pusch_pdu->nr_of_symbols = 12; + + // -------------------- + // ------- DMRS ------- + // -------------------- + uint16_t l_prime_mask = get_l_prime(pusch_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << pusch_pdu->start_symbol_index; + pusch_pdu->dmrs_config_type = 0; // dmrs-type 1 (the one with a single DMRS symbol in the beginning) + pusch_pdu->ul_dmrs_scrambling_id = 0; // If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id + pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1] + // Should match what is sent in DCI 0_1, otherwise set to 0 + pusch_pdu->num_dmrs_cdm_grps_no_data = 1; + //pusch_pdu->dmrs_ports; // DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports + // Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011, + // and for each bit 0: DMRS port not used 1: DMRS port used + // -------------------------------------------------------------------------------------------------------------------------------------------- + + // -------------------- + // ------- PTRS ------- + // -------------------- + uint8_t ptrs_mcs1 = 2; // higher layer parameter in PTRS-UplinkConfig + uint8_t ptrs_mcs2 = 4; // higher layer parameter in PTRS-UplinkConfig + uint8_t ptrs_mcs3 = 10; // higher layer parameter in PTRS-UplinkConfig + uint16_t n_rb0 = 25; // higher layer parameter in PTRS-UplinkConfig + uint16_t n_rb1 = 75; // higher layer parameter in PTRS-UplinkConfig + pusch_pdu->pusch_ptrs.ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, pusch_pdu->mcs_index, pusch_pdu->mcs_table); + pusch_pdu->pusch_ptrs.ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, pusch_pdu->rb_size); + pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + + if(1<pusch_ptrs.ptrs_time_density >= pusch_pdu->nr_of_symbols) + pusch_pdu->pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS + // -------------------------------------------------------------------------------------------------------------------------------------------- + + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] //Optional Data only included if indicated in pduBitmap pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.harq_process_id = 0; @@ -885,6 +913,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, 0, pusch_pdu->nrOfLayers)>>3; + pusch_pdu->pusch_data.num_cb = 0; //CBG not supported //pusch_pdu->pusch_data.cb_present_and_position; //pusch_pdu->pusch_uci; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index a87f406571..44f4edd3ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1470,77 +1470,6 @@ void nr_update_pucch_scheduling(int Mod_idP, } -void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, - uint16_t *slot_period, - uint16_t *offset) { - - switch(ss->monitoringSlotPeriodicityAndOffset->present) { - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1: - *slot_period = 1; - *offset = 0; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2: - *slot_period = 2; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4: - *slot_period = 4; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl4; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5: - *slot_period = 5; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl5; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8: - *slot_period = 8; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl8; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10: - *slot_period = 10; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl10; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16: - *slot_period = 16; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl16; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20: - *slot_period = 20; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl20; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40: - *slot_period = 40; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl40; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80: - *slot_period = 80; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl80; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160: - *slot_period = 160; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl160; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320: - *slot_period = 320; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl320; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640: - *slot_period = 640; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl640; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280: - *slot_period = 1280; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl1280; - break; - case NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560: - *slot_period = 2560; - *offset = ss->monitoringSlotPeriodicityAndOffset->choice.sl2560; - break; - default: - AssertFatal(1==0,"Invalid monitoring slot periodicity and offset value\n"); - break; - } -} - void find_aggregation_candidates(uint8_t *aggregation_level, uint8_t *nr_of_candidates, NR_SearchSpace_t *ss) { @@ -1567,6 +1496,7 @@ void find_aggregation_candidates(uint8_t *aggregation_level, } } + /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, nfapi_nr_search_space_t *search_space) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 03161ea940..89c3fe69fe 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -209,7 +209,7 @@ void nr_process_mac_pdu( mac_subheader_len = 2; } - LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); + LOG_D(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); @@ -249,7 +249,7 @@ void nr_process_mac_pdu( pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); if (pdu_len < 0) { - LOG_E(MAC, "%s() residual mac pdu length < 0!\n", __func__); + LOG_E(MAC, "%s() residual mac pdu length < 0!, pdu_len: %d\n", __func__, pdu_len); return; } } @@ -270,7 +270,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, int current_rnti = 0, UE_id = -1, harq_pid = 0; gNB_MAC_INST *gNB_mac = NULL; NR_UE_list_t *UE_list = NULL; - UE_sched_ctrl_t *UE_scheduling_control = NULL; + NR_UE_sched_ctrl_t *UE_scheduling_control = NULL; current_rnti = rntiP; UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti); @@ -280,13 +280,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_id != -1) { UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]); - LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n", + LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d\n", gnb_mod_idP, harq_pid, CC_idP, frameP, slotP, - UE_scheduling_control->round_UL[CC_idP][harq_pid], current_rnti, UE_id, ul_cqi); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b190866c5d..ccbdd8c839 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -246,15 +246,6 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP); int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP); -int get_num_dmrs(uint16_t dmrs_mask ); - -uint16_t nr_dci_size(NR_CellGroupConfig_t *secondaryCellGroup, - dci_pdu_rel15_t *dci_pdu, - nr_dci_format_t format, - nr_rnti_type_t rnti_type, - uint16_t N_RB, - int bwp_id); - int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int bwp_id, int coreset_id, @@ -290,9 +281,6 @@ void nr_generate_Msg2(module_id_t module_idP, void nr_schedule_reception_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP); -void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, - uint16_t *slot_period, - uint16_t *offset); void nr_process_mac_pdu( module_id_t module_idP, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0125535071..f84e7a900c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -179,6 +179,72 @@ typedef struct { uint8_t num_sf_allocation_pattern; } NR_COMMON_channels_t; + +// SP ZP CSI-RS Resource Set Activation/Deactivation MAC CE +typedef struct sp_zp_csirs { + bool is_scheduled; //ZP CSI-RS ACT/Deact MAC CE is scheduled + bool act_deact; //Activation/Deactivation indication + uint8_t serv_cell_id; //Identity of Serving cell for which MAC CE applies + uint8_t bwpid; //Downlink BWP id + uint8_t rsc_id; //SP ZP CSI-RS resource set +} sp_zp_csirs_t; + +//SP CSI-RS / CSI-IM Resource Set Activation/Deactivation MAC CE +#define MAX_CSI_RESOURCE_SET 64 +typedef struct csi_rs_im { + bool is_scheduled; + bool act_deact; + uint8_t serv_cellid; + uint8_t bwp_id; + bool im; + uint8_t csi_im_rsc_id; + uint8_t nzp_csi_rsc_id; + uint8_t nb_tci_resource_set_id; + uint8_t tci_state_id [ MAX_CSI_RESOURCE_SET ]; +} csi_rs_im_t; + +typedef struct pdcchStateInd { + bool is_scheduled; + uint8_t servingCellId; + uint8_t coresetId; + uint8_t tciStateId; +} pdcchStateInd_t; + +typedef struct SPCSIReportingpucch { + bool is_scheduled; + uint8_t servingCellId; + uint8_t bwpId; + bool s0tos3_actDeact[4]; +} SPCSIReportingpucch_t; + +#define MAX_APERIODIC_TRIGGER_STATES 128 //38.331 +typedef struct aperiodicCSI_triggerStateSelection { + bool is_scheduled; + uint8_t servingCellId; + uint8_t bwpId; + uint8_t highestTriggerStateSelected; + bool triggerStateSelection[MAX_APERIODIC_TRIGGER_STATES]; +} aperiodicCSI_triggerStateSelection_t; + +#define MAX_TCI_STATES 128 //38.331 +typedef struct pdschTciStatesActDeact { + bool is_scheduled; + uint8_t servingCellId; + uint8_t bwpId; + uint8_t highestTciStateActivated; + bool tciStateActDeact[MAX_TCI_STATES]; +} pdschTciStatesActDeact_t; + +typedef struct UE_info { + sp_zp_csirs_t sp_zp_csi_rs; + csi_rs_im_t csi_im; + pdcchStateInd_t pdcch_state_ind; + SPCSIReportingpucch_t SP_CSI_reporting_pucch; + aperiodicCSI_triggerStateSelection_t aperi_CSI_trigger; + pdschTciStatesActDeact_t pdsch_TCI_States_ActDeact; +} NR_UE_mac_ce_ctrl_t; + + typedef struct NR_sched_pucch { int frame; int ul_slot; @@ -203,6 +269,8 @@ typedef struct { int16_t ta_update; uint8_t current_harq_pid; NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; + int dummy; + NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information } NR_UE_sched_ctrl_t; typedef struct NR_preamble_ue { @@ -229,7 +297,7 @@ typedef struct { NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB]; } NR_UE_list_t; -/*! \brief top level gNB MAC structure */ +/*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface eth_params_t eth_params_n; @@ -270,7 +338,7 @@ typedef struct gNB_MAC_INST_s { /// UL handle uint32_t ul_handle; - // MAC function execution peformance profiler + // MAC function execution peformance profiler /// processing time of eNB scheduler time_stats_t eNB_scheduler; /// processing time of eNB scheduler for SI diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 03e5dd5d0b..33f268f07f 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -503,8 +503,6 @@ pdcp_data_ind( //----------------------------------------------------------------------------- { pdcp_t *pdcp_p = NULL; - list_t *sdu_list_p = NULL; - mem_block_t *new_sdu_p = NULL; uint8_t pdcp_header_len = 0; uint8_t pdcp_tailer_len = 0; pdcp_sn_t sequence_number = 0; @@ -576,7 +574,6 @@ pdcp_data_ind( } } - sdu_list_p = &pdcp_sdu_list; if (sdu_buffer_sizeP == 0) { LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!\n"); @@ -974,9 +971,8 @@ pdcp_data_ind( #endif if (FALSE == packet_forwarded) { - new_sdu_p = get_free_mem_block(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t), __func__); + notifiedFIFO_elt_t * new_sdu_p = newNotifiedFIFO_elt(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t), 0, NULL, NULL); - if (new_sdu_p) { if ((MBMS_flagP == 0) && (pdcp_p->rlc_mode == RLC_MODE_AM)) { pdcp_p->last_submitted_pdcp_rx_sn = sequence_number; } @@ -984,14 +980,15 @@ pdcp_data_ind( /* * Prepend PDCP indication header which is going to be removed at pdcp_fifo_flush_sdus() */ - memset(new_sdu_p->data, 0, sizeof (pdcp_data_ind_header_t)); - ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size = sdu_buffer_sizeP - payload_offset; + pdcp_data_ind_header_t * pdcpHead=(pdcp_data_ind_header_t *)NotifiedFifoData(new_sdu_p); + memset(pdcpHead, 0, sizeof (pdcp_data_ind_header_t)); + pdcpHead->data_size = sdu_buffer_sizeP - payload_offset; AssertFatal((sdu_buffer_sizeP - payload_offset >= 0), "invalid PDCP SDU size!"); // Here there is no virtualization possible // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here if (ctxt_pP->enb_flag == ENB_FLAG_NO) { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id; + pdcpHead->rb_id = rb_id; if (EPC_MODE_ENABLED) { /* for the UE compiled in S1 mode, we need 1 here @@ -1002,45 +999,40 @@ pdcp_data_ind( #ifdef UESIM_EXPANSION if (UE_NAS_USE_TUN) { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id; + pdcpHead->inst = ctxt_pP->module_id; } else { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 0; + pdcpHead->inst = 0; } #else - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id; + pdcpHead->inst = ctxt_pP->module_id; #endif } else { // nfapi_mode if (UE_NAS_USE_TUN) { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id; + pdcpHead->inst = ctxt_pP->module_id; } else { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = 1; + pdcpHead->inst = 1; } } // nfapi_mode } } else { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB); - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->module_id; + pdcpHead->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB); + pdcpHead->inst = ctxt_pP->module_id; } if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { static uint32_t pdcp_inst = 0; - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = pdcp_inst++; - LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size); + pdcpHead->inst = pdcp_inst++; + LOG_D(PDCP, "inst=%d size=%d\n", pdcpHead->inst, pdcpHead->data_size); } - memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], + memcpy(pdcpHead+1, &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset); - - #if defined(ENABLE_PDCP_PAYLOAD_DEBUG) - LOG_I(PDCP, "Printing first bytes of PDCP SDU before adding it to the list: \n"); - for (int i=0; i<30; i++){ - LOG_I(PDCP, "%x", sdu_buffer_pP->data[i]); - } - #endif - list_add_tail_eurecom (new_sdu_p, sdu_list_p); - } + if( LOG_DEBUGFLAG(DEBUG_PDCP) ) + log_dump(PDCP, pdcpHead+1, min(sdu_buffer_sizeP - payload_offset,30) , LOG_DUMP_CHAR, + "Printing first bytes of PDCP SDU before adding it to the list: \n"); + pushNotifiedFIFO(&pdcp_sdu_list, new_sdu_p); /* Print octets of incoming data in hexadecimal form */ LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n", @@ -2372,7 +2364,7 @@ void pdcp_layer_init(void) /* * Initialize SDU list */ - list_init(&pdcp_sdu_list, NULL); + initNotifiedFIFO(&pdcp_sdu_list); pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free); AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed"); @@ -2445,7 +2437,8 @@ void pdcp_layer_init(void) void pdcp_layer_cleanup (void) //----------------------------------------------------------------------------- { - list_free (&pdcp_sdu_list); + //list_free (&pdcp_sdu_list); + while(pollNotifiedFIFO(&pdcp_sdu_list)) {}; hashtable_destroy(&pdcp_coll_p); #ifdef MBMS_MULTICAST_OUT diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index e9ac85866c..de8a1b385b 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -34,10 +34,6 @@ #ifndef __PDCP_H__ # define __PDCP_H__ //----------------------------------------------------------------------------- -#ifndef NON_ACCESS_STRATUM - #include "UTIL/MEM/mem_block.h" - #include "UTIL/LISTS/list.h" -#endif //NON_ACCESS_STRATUM //----------------------------------------------------------------------------- #include "RRC/LTE/rrc_defs.h" #include "COMMON/platform_constants.h" @@ -522,7 +518,7 @@ pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceC sdu_size_t pdcp_output_sdu_bytes_to_write; sdu_size_t pdcp_output_header_bytes_to_write; -list_t pdcp_sdu_list; +notifiedFIFO_t pdcp_sdu_list; int pdcp_sent_a_sdu; pdcp_data_req_header_t pdcp_input_header; unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index d203408e55..6c23332687 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -55,7 +55,6 @@ extern int otg_enabled; #include "common/utils/LOG/log.h" #include "UTIL/OTG/otg_tx.h" #include "nfapi/oai_integration/vendor_ext.h" -#include "UTIL/FIFO/pad_list.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "platform_constants.h" #include "msc.h" @@ -91,7 +90,6 @@ extern struct msghdr nas_msg_rx; extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; #endif -extern Packet_OTG_List_t *otg_pdcp_buffer; # include "gtpv1u_eNB_task.h" @@ -111,69 +109,58 @@ void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) { } //----------------------------------------------------------------------------- int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { - mem_block_t *sdu_p; + notifiedFIFO_elt_t *sdu_p; int pdcp_nb_sdu_sent = 0; int ret=0; + while ((sdu_p = pollNotifiedFIFO(&pdcp_sdu_list)) != NULL ) { + pdcp_data_ind_header_t * pdcpHead=(pdcp_data_ind_header_t *)NotifiedFifoData(sdu_p); + AssertFatal(pdcpHead->inst==ctxt_pP->module_id, "To implement correctly multi module id\n"); - while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) { - ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; - int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; + int rb_id = pdcpHead->rb_id; int sizeToWrite= sizeof (pdcp_data_ind_header_t) + - ((pdcp_data_ind_header_t *) sdu_p->data)->data_size; - + pdcpHead->data_size; + void * pdcpData=(void*)(pdcpHead+1); if (rb_id == 10) { //hardcoded for PC5-Signaling if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { - debug_pdcp_pc5s_sdu((sidelink_pc5s_element *)&(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), + debug_pdcp_pc5s_sdu((sidelink_pc5s_element *)pdcpData, "pdcp_fifo_flush_sdus sends a aPC5S message"); } - ret = sendto(pdcp_pc5_sockfd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), + ret = sendto(pdcp_pc5_sockfd, pdcpData, sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr,sizeof(prose_pdcp_addr) ); } else if (UE_NAS_USE_TUN) { //ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); if(rb_id == mbms_rab_id){ - ret = write(nas_sock_mbms_fd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); - LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite); + ret = write(nas_sock_mbms_fd, pdcpData,sizeToWrite ); + LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n", + ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite); } else { - #if defined(ENABLE_PDCP_PAYLOAD_DEBUG) - LOG_I(PHY, "PDCP output to be sent to TUN interface: \n"); - for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) { - printf("%02x ",(unsigned char)sdu_p->data[i]); - } - printf("\n"); - #endif - ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); - //LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite); + if( LOG_DEBUGFLAG(DEBUG_PDCP) ) + log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[ctxt_pP->module_id], pdcpData,sizeToWrite ); + LOG_T(PDCP,"[UE PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n", + ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite); } } else if (ENB_NAS_USE_TUN) { - #if defined(ENABLE_PDCP_PAYLOAD_DEBUG) - LOG_I(PHY, "PDCP output to be sent to TUN interface: \n"); - for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) { - printf("%02x ",(unsigned char)sdu_p->data[i]); - } - printf("\n"); - #endif - ret = write(nas_sock_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), sizeToWrite); - + if( LOG_DEBUGFLAG(DEBUG_PDCP) ) + log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[0], pdcpData, sizeToWrite); + LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],sizeToWrite); } else if (PDCP_USE_NETLINK) { - memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) sdu_p->data, sizeToWrite); + memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) pdcpHead, sizeToWrite); nas_nlh_tx->nlmsg_len = sizeToWrite; ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); } // PDCP_USE_NETLINK AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]); - #if defined(ENABLE_PDCP_PAYLOAD_DEBUG) - LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n"); - for (int i=0; i<30; i++){ - LOG_I(PDCP, "%x", sdu_p->data[i]); - } - #endif - list_remove_head (&pdcp_sdu_list); - free_mem_block (sdu_p, __func__); + if( LOG_DEBUGFLAG(DEBUG_PDCP) ) + log_dump(PDCP, pdcpData, min(sizeToWrite,30) , LOG_DUMP_CHAR, + "Printing first bytes of PDCP SDU before removing it from the list: \n"); + delNotifiedFIFO_elt (sdu_p); pdcp_nb_sdu_sent ++; } @@ -181,12 +168,13 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { } int pdcp_fifo_flush_mbms_sdus(const protocol_ctxt_t *const ctxt_pP) { - mem_block_t *sdu_p; + notifiedFIFO_elt_t *sdu_p; int pdcp_nb_sdu_sent = 0; //int ret=0; - while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) { - ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + while ((sdu_p = pollNotifiedFIFO(&pdcp_sdu_list)) != NULL ) { + pdcp_data_ind_header_t * pdcpHead=(pdcp_data_ind_header_t *)NotifiedFifoData(sdu_p); + AssertFatal(pdcpHead->inst==ctxt_pP->module_id, "To implement correctly multi module id\n"); //int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; //int sizeToWrite= sizeof (pdcp_data_ind_header_t) + //((pdcp_data_ind_header_t *) sdu_p->data)->data_size; @@ -212,8 +200,8 @@ int pdcp_fifo_flush_mbms_sdus(const protocol_ctxt_t *const ctxt_pP) { //} // PDCP_USE_NETLINK //AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno)); - list_remove_head (&pdcp_sdu_list); - free_mem_block (sdu_p, __func__); + //AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno)); + delNotifiedFIFO_elt (sdu_p); pdcp_nb_sdu_sent ++; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h deleted file mode 100644 index b9f62acc3c..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/* - pdcp_proto_extern.h - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - ***************************************************************************/ -#ifndef __PDCP_PROTO_EXTERN_H__ -# define __PDCP_PROTO_EXTERN_H__ - -//# include "pdcp_entity.h" -//# include "rb_mux.h" -# include "mem_block.h" - -#ifdef ROHC -extern void pdcp_data_ind (module_id_t module_idP, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t *sduP); -extern void pdcp_data_req (struct pdcp_entity *pdcpP, mem_block *sduP); -extern void send_pdcp_control_primitive (struct pdcp_entity *pdcpP, mem_block *cprimitiveP); -extern void control_pdcp (struct pdcp_entity *pdcpP); -extern void pdcp_process_input_sdus_high(struct pdcp_entity *pdcpP); -extern void pdcp_process_input_sdus_am (struct pdcp_entity *pdcpP, uint16_t data_sizeP, mem_block *sduP); -extern void pdcp_process_output_sdus (struct pdcp_entity *pdcpP, mem_block *sduP, uint8_t rb_idP); -extern void pdcp_process_output_sdus_high (struct pdcp_entity *pdcpP, mem_block *sduP, uint16_t data_sizeP, uint16_t rb_idP); -extern void pdcp_process_input_sdus_um (struct pdcp_entity *pdcpP, uint16_t data_sizeP, mem_block *sduP); -extern void pdcp_process_input_sdus_tr (struct pdcp_entity *pdcpP, uint16_t data_sizeP, mem_block *sduP); -extern void init_pdcp (struct pdcp_entity *pdcpP, struct rb_dispatcher *rbP, uint8_t rb_idP); -extern void *pdcp_tx (struct pdcp_entity *pdcpP, uint16_t data_sizeP, mem_block *sduP); -extern int reception_from_rohc_mt(void); -extern int reception_from_rohc_bs(void); -#else -extern BOOL pdcp_data_ind (module_id_t module_idP, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t *sduP, uint8_t is_data_plane); -extern BOOL pdcp_data_req (module_id_t module_id, uint32_t frame, uint8_t eNB_flag, rb_id_t rab_id, uint32_t muiP, uint32_t confirmP, sdu_size_t sdu_buffer_size, unsigned char *sdu_buffer, - uint8_t is_data_pdu,const uint32_t *const sourceL2Id,const uint32_t *const destinationL2Id - ); -//extern BOOL pdcp_data_req (struct pdcp_entity *pdcpP, mem_block * sduP); -extern void send_pdcp_control_primitive (struct pdcp_entity *pdcpP, mem_block *cprimitiveP); -extern void control_pdcp (struct pdcp_entity *pdcpP); -extern void pdcp_process_input_sdus_am (struct pdcp_entity *pdcpP); -extern void pdcp_process_output_sdus (struct pdcp_entity *pdcpP, mem_block *sduP, uint8_t rb_idP); -extern void pdcp_process_input_sdus_um (struct pdcp_entity *pdcpP); -extern void pdcp_process_input_sdus_tr (struct pdcp_entity *pdcpP); -extern void init_pdcp (struct pdcp_entity *pdcpP, struct rb_dispatcher *rbP, uint8_t rb_idP); -extern void *pdcp_tx (void *argP); -#endif - -extern void pdcp_pc5_socket_init(void); - -#endif diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 3e0a8c46a1..6d2bec29f7 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -79,8 +79,8 @@ void mac_rlc_data_ind ( LOG_I(RLC, "RLC instance for the given UE was not found \n"); switch (channel_idP) { - case 1 ... 2: rb = ue->srb[channel_idP - 1]; break; - case 3 ... 7: rb = ue->drb[channel_idP - 3]; break; + case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; + case 4 ... 8: rb = ue->drb[channel_idP - 4]; break; default: rb = NULL; break; } @@ -120,8 +120,8 @@ tbs_size_t mac_rlc_data_req( ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); switch (channel_idP) { - case 1 ... 2: rb = ue->srb[channel_idP - 1]; break; - case 3 ... 7: rb = ue->drb[channel_idP - 3]; break; + case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; + case 4 ... 8: rb = ue->drb[channel_idP - 4]; break; default: rb = NULL; break; } @@ -130,7 +130,7 @@ tbs_size_t mac_rlc_data_req( maxsize = tb_sizeP; ret = rb->generate_pdu(rb, buffer_pP, maxsize); } else { - LOG_E(RLC, "%s:%d:%s: fatal: data req for unknown RB\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(RLC, "%s:%d:%s: fatal: data req for unknown RB, channel_idP: %d\n", __FILE__, __LINE__, __FUNCTION__, channel_idP); exit(1); ret = 0; } @@ -173,8 +173,8 @@ mac_rlc_status_resp_t mac_rlc_status_ind( ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); switch (channel_idP) { - case 1 ... 2: rb = ue->srb[channel_idP - 1]; break; - case 3 ... 7: rb = ue->drb[channel_idP - 3]; break; + case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; + case 4 ... 8: rb = ue->drb[channel_idP - 4]; break; default: rb = NULL; break; } @@ -234,8 +234,8 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); switch (channel_idP) { - case 1 ... 2: rb = ue->srb[channel_idP - 1]; break; - case 3 ... 7: rb = ue->drb[channel_idP - 3]; break; + case 1 ... 3: rb = ue->srb[channel_idP - 1]; break; + case 4 ... 8: rb = ue->drb[channel_idP - 4]; break; default: rb = NULL; break; } @@ -661,7 +661,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ exit(1); } - if (channel_id != drb_id + 2) { + if (channel_id != drb_id + 3) { LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -744,7 +744,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ exit(1); } - if (channel_id != drb_id + 2) { + if (channel_id != drb_id + 3) { LOG_E(RLC, "%s:%d:%s: todo, remove this limitation\n", __FILE__, __LINE__, __FUNCTION__); exit(1); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index 464cf3d083..f578faaf38 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -28,7 +28,7 @@ typedef void nr_rlc_ue_manager_t; typedef struct nr_rlc_ue_t { int rnti; - nr_rlc_entity_t *srb[2]; + nr_rlc_entity_t *srb[3]; nr_rlc_entity_t *drb[5]; } nr_rlc_ue_t; diff --git a/openair2/M2AP/m2ap_MCE_handler.h b/openair2/M2AP/m2ap_MCE_handler.h index e9faae8f5d..68cab5c8ac 100644 --- a/openair2/M2AP/m2ap_MCE_handler.h +++ b/openair2/M2AP/m2ap_MCE_handler.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M2AP_MCE_HANDLERS_H_ -#define M2AP_MCE_HANDLERS_H_ +#ifndef __M2AP_MCE_HANDLERS__H__ +#define __M2AP_MCE_HANDLERS__H__ #include "m2ap_MCE_defs.h" @@ -40,4 +40,4 @@ int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre //const uint8_t * const data, const uint32_t data_length); -#endif /* M2AP_MCE_HANDLERS_H_ */ +#endif /* __M2AP_MCE_HANDLERS__H__ */ diff --git a/openair2/M2AP/m2ap_MCE_management_procedures.h b/openair2/M2AP/m2ap_MCE_management_procedures.h index 9e13e723c9..4e8997dbc5 100644 --- a/openair2/M2AP/m2ap_MCE_management_procedures.h +++ b/openair2/M2AP/m2ap_MCE_management_procedures.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M2AP_MCE_MANAGEMENT_PROCEDURES_H_ -#define M2AP_MCE_MANAGEMENT_PROCEDURES_H +#ifndef __M2AP_MCE_MANAGEMENT_PROCEDURES__H__ +#define __M2AP_MCE_MANAGEMENT_PROCEDURES__H__ void m2ap_MCE_prepare_internal_data(void); @@ -51,4 +51,4 @@ struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -#endif /* M2AP_MCE_MANAGEMENT_PROCEDURES_H_ */ +#endif /* __M2AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.h b/openair2/M2AP/m2ap_eNB_generate_messages.h index 49247405f7..793f7f18cf 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.h +++ b/openair2/M2AP/m2ap_eNB_generate_messages.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M2AP_ENB_GENERATE_MESSAGES_H_ -#define M2AP_ENB_GENERATE_MESSAGES_H_ +#ifndef __M2AP_ENB_GENERATE_MESSAGES__H__ +#define __M2AP_ENB_GENERATE_MESSAGES__H__ #include "m2ap_eNB_defs.h" #include "m2ap_common.h" @@ -60,4 +60,4 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // int m2_ue_id, // m2ap_handover_cancel_cause_t cause); -#endif /* M2AP_ENB_GENERATE_MESSAGES_H_ */ +#endif /* __M2AP_ENB_GENERATE_MESSAGES__H__ */ diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.h b/openair2/M2AP/m2ap_eNB_management_procedures.h index fbc49d0169..2b1dc4a44b 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.h +++ b/openair2/M2AP/m2ap_eNB_management_procedures.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M2AP_ENB_MANAGEMENT_PROCEDURES_H_ -#define M2AP_ENB_MANAGEMENT_PROCEDURES_H +#ifndef __M2AP_ENB_MANAGEMENT_PROCEDURES__H__ +#define __M2AP_ENB_MANAGEMENT_PROCEDURES__H__ void m2ap_eNB_prepare_internal_data(void); @@ -51,4 +51,4 @@ struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -#endif /* M2AP_ENB_MANAGEMENT_PROCEDURES_H_ */ +#endif /* __M2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/NETWORK_DRIVER/LITE/proto_extern.h b/openair2/NETWORK_DRIVER/LITE/proto_extern.h index f07083921f..d4289ca1f2 100644 --- a/openair2/NETWORK_DRIVER/LITE/proto_extern.h +++ b/openair2/NETWORK_DRIVER/LITE/proto_extern.h @@ -30,8 +30,8 @@ ***************************************************************************/ -#ifndef _NAS_PROTO_H -#define _NAS_PROTO_H +#ifndef __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__ +#define __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__ #include #include diff --git a/openair2/NETWORK_DRIVER/MESH/proto_extern.h b/openair2/NETWORK_DRIVER/MESH/proto_extern.h index 2eae034257..ac92b2f8bd 100644 --- a/openair2/NETWORK_DRIVER/MESH/proto_extern.h +++ b/openair2/NETWORK_DRIVER/MESH/proto_extern.h @@ -29,8 +29,8 @@ ***************************************************************************/ -#ifndef _NAS_PROTO_H -#define _NAS_PROTO_H +#ifndef __NETWORK_DRIVER_MESH_PROTO_EXTERN__H__ +#define __NETWORK_DRIVER_MESH_PROTO_EXTERN__H__ #include #include diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 2b8dc0ec02..ec969c6741 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -38,6 +38,7 @@ #include "LAYER2/MAC/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/ran_context.h" +#include "executables/softmodem-common.h" #define MAX_IF_MODULES 100 @@ -87,34 +88,36 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) { case NFAPI_NR_UCI_PDCCH_PDU_TYPE: break; case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1; - // handle harq - int harq_idx_s = 0; - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_pdu->harq->num_harq; harq_bit++) { - // search for the right harq process - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - if (uci_pdu->harq->harq_list[harq_bit].harq_value == 0) + if (get_softmodem_params()->phy_test == 0) { + nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1; + // handle harq + int harq_idx_s = 0; + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_pdu->harq->num_harq; harq_bit++) { + // search for the right harq process + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if (uci_pdu->harq->harq_list[harq_bit].harq_value == 0) + sched_ctrl->harq_processes[harq_idx].round++; + if ((uci_pdu->harq->harq_list[harq_bit].harq_value == 1) || + (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds)) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + break; + } + // if gNB fails to receive a ACK/NACK + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { sched_ctrl->harq_processes[harq_idx].round++; - if ((uci_pdu->harq->harq_list[harq_bit].harq_value == 1) || - (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds)) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - break; - } - // if gNB fails to receive a ACK/NACK - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; } } } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 87ddd97366..b18831b546 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -113,17 +113,18 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ mac->dl_config_request.number_pdus = 0; // clean previous FAPI messages - ret = nr_ue_scheduler(ul_info->module_id, - ul_info->gNB_index, - ul_info->cc_id, - ul_info->frame_rx, - ul_info->slot_rx, - ul_info->ssb_index, - ul_info->frame_tx, - ul_info->slot_tx); + ret = nr_ue_scheduler(NULL, ul_info); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) + if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra){ nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); + if (mac->generate_nr_prach){ + //uint16_t monitoring_slot_period, monitoring_offset; + uint16_t rach_frame = mac->scheduled_response.ul_config->sfn; + uint16_t rx_rach_frame = (rach_frame + mac->RA_offset) % MAX_FRAME_NUMBER; // compensate 2 frames offset delay at gNB side + uint16_t rach_slot = mac->scheduled_response.ul_config->slot; + nr_ue_msg2_scheduler(module_id, rx_rach_frame, rach_slot, &mac->msg2_rx_frame, &mac->msg2_rx_slot); + } + } switch(ret){ case UE_CONNECTION_OK: @@ -144,7 +145,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ } int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){ - + int32_t i; uint32_t ret_mask = 0x0; module_id_t module_id = dl_info->module_id; @@ -152,129 +153,98 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request; - dl_config->number_pdus = 0; - ul_config->number_pdus = 0; - //hook up pointers - mac->scheduled_response.dl_config = dl_config; - mac->scheduled_response.ul_config = ul_config; - mac->scheduled_response.tx_request = &mac->tx_request; - mac->scheduled_response.module_id = dl_info->module_id; - mac->scheduled_response.CC_id = dl_info->cc_id; - mac->scheduled_response.frame = dl_info->frame; - mac->scheduled_response.slot = dl_info->slot; + if (!dl_info->dci_ind && !dl_info->rx_ind) { + // UL indication to schedule reception DCI reception + nr_ue_scheduler(dl_info, NULL); + } else { + // UL indication after reception of DCI or DL PDU + dl_config->number_pdus = 0; + ul_config->number_pdus = 0; + //hook up pointers + mac->scheduled_response.dl_config = dl_config; + mac->scheduled_response.ul_config = ul_config; + mac->scheduled_response.tx_request = &mac->tx_request; + mac->scheduled_response.module_id = dl_info->module_id; + mac->scheduled_response.CC_id = dl_info->cc_id; + mac->scheduled_response.frame = dl_info->frame; + mac->scheduled_response.slot = dl_info->slot; - if(dl_info->dci_ind != NULL){ - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); - for(i=0; idci_ind->number_of_dcis; ++i){ - LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); - // fapi_nr_dci_pdu_rel15_t *dci = &dl_info->dci_ind->dci_list[i].dci; + if(dl_info->dci_ind != NULL){ + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); + for(i=0; idci_ind->number_of_dcis; ++i){ + LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); - ret_mask |= (handle_dci(dl_info->module_id, - dl_info->cc_id, - dl_info->gNB_index, - dl_info->dci_ind->dci_list+i)<< FAPI_NR_DCI_IND); + ret_mask |= (handle_dci(dl_info->module_id, + dl_info->cc_id, + dl_info->gNB_index, + dl_info->dci_ind->dci_list+i)<< FAPI_NR_DCI_IND); - AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is void!\n" ); - nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response); - - - /*switch((dl_info->dci_ind->dci_list+i)->dci_type){ - case FAPI_NR_DCI_TYPE_0_0: - case FAPI_NR_DCI_TYPE_0_1: - case FAPI_NR_DCI_TYPE_1_1: - case FAPI_NR_DCI_TYPE_2_0: - case FAPI_NR_DCI_TYPE_2_1: - case FAPI_NR_DCI_TYPE_2_2: - case FAPI_NR_DCI_TYPE_2_3: - AssertFatal(1==0, "Not yet support at this moment!\n"); - break; - - case FAPI_NR_DCI_TYPE_1_0: - - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; - - // mapping into DL_CONFIG_REQ for DL-SCH - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - - dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = 0x0000; // TX RNTI: UE-spec - memcpy(dlsch_config_pdu, dci, sizeof(fapi_nr_dci_pdu_rel15_t)); - - dl_config->number_pdus = dl_config->number_pdus + 1; - - ret_mask |= (handle_dci( - dl_info->module_id, - dl_info->cc_id, - dl_info->gNB_index, - dci, - (dl_info->dci_ind->dci_list+i)->rnti, - (dl_info->dci_ind->dci_list+i)->dci_type)) << FAPI_NR_DCI_IND; - - - - break; - - default: - break; - }*/ - - //(dl_info->dci_list+i)->rnti - } - } - - if(dl_info->rx_ind != NULL){ - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); - for(i=0; irx_ind->number_pdus; ++i){ - switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ - case FAPI_NR_RX_PDU_TYPE_MIB: - ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, - (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu, - (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits, - (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index, - (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length, - (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB; - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], MIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); - /*ret_mask |= (handle_bcch_bch( dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, - dl_info->rx_ind->rx_indication_body[i].mib_pdu.pdu, - dl_info->rx_ind->rx_indication_body[i].mib_pdu.additional_bits, - dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_index, - dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_length, - dl_info->rx_ind->rx_indication_body[i].mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;*/ - break; - case FAPI_NR_RX_PDU_TYPE_SIB: - ret_mask |= (handle_bcch_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, - (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.sibs_mask, - (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu, - (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length )) << FAPI_NR_RX_PDU_TYPE_SIB; - break; - case FAPI_NR_RX_PDU_TYPE_DLSCH: - // ret_mask |= (0) << FAPI_NR_RX_PDU_TYPE_DLSCH; - ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind, - (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu, - (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length, dl_info->frame, dl_info->slot, ul_time_alignment)) << FAPI_NR_RX_PDU_TYPE_DLSCH; - - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], DLSCH case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); - - /* - // dl_config structure just stores what was received - not really needed - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; - dl_config->number_pdus = dl_config->number_pdus + 1; - */ - break; - - case FAPI_NR_RX_PDU_TYPE_RAR: - ret_mask |= (handle_rar(dl_info)) << FAPI_NR_RX_PDU_TYPE_RAR; - break; - - default: - break; + AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is void!\n" ); + nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response); } } + + if(dl_info->rx_ind != NULL){ + + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); + + for(i=0; irx_ind->number_pdus; ++i){ + + switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ + + case FAPI_NR_RX_PDU_TYPE_MIB: + ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, + (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu, + (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits, + (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index, + (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length, + (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_MIB; + + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], MIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); + + break; + + case FAPI_NR_RX_PDU_TYPE_SIB: + + ret_mask |= (handle_bcch_dlsch(dl_info->module_id, + dl_info->cc_id, dl_info->gNB_index, + (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.sibs_mask, + (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu, + (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; + + break; + + case FAPI_NR_RX_PDU_TYPE_DLSCH: + + ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, + dl_info->dci_ind, + (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu, + (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length, + dl_info->frame, + dl_info->slot, + ul_time_alignment)) << FAPI_NR_RX_PDU_TYPE_DLSCH; + + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], DLSCH case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); + + break; + + case FAPI_NR_RX_PDU_TYPE_RAR: + + ret_mask |= (handle_rar(dl_info)) << FAPI_NR_RX_PDU_TYPE_RAR; + + break; + + default: + break; + } + } + } + + //clean up nr_downlink_indication_t *dl_info + dl_info->rx_ind = NULL; + dl_info->dci_ind = NULL; + } - - //clean up nr_downlink_indication_t *dl_info - dl_info->rx_ind = NULL; - dl_info->dci_ind = NULL; - return 0; } @@ -312,7 +282,12 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) { dl_config->sfn=UE_mac->dl_config_request.sfn; dl_config->slot=UE_mac->dl_config_request.slot; dl_config->number_pdus=0; - - ue_dci_configuration(UE_mac,dl_config,dcireq->frame,dcireq->slot); + + //printf(" UE_mac->dl_config_request.slot %d VS dcireq->slot %d \n", UE_mac->dl_config_request.slot, dcireq->slot); + + LOG_D(PHY, "Entering UE DCI configuration frame %d slot %d \n", dcireq->frame, dcireq->slot); + + ue_dci_configuration(UE_mac, dl_config, dcireq->frame, dcireq->slot); + return 0; } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index b7ddfc0c57..df2d78f0cb 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -72,7 +72,8 @@ typedef struct { /// NR UE FAPI-like P7 message, direction: L1 to L2 /// data reception indication structure fapi_nr_rx_indication_t *rx_ind; - + /// ssb_index, if ssb is not present in current TTI, value set to -1 + int ssb_index; /// dci reception indication structure fapi_nr_dci_indication_t *dci_ind; @@ -94,8 +95,6 @@ typedef struct { frame_t frame_tx; /// slot tx uint32_t slot_tx; - /// ssb_index, if ssb is not present in current TTI, thie value set to -1 - int ssb_index; /// dci reception indication structure fapi_nr_dci_indication_t *dci_ind; } nr_uplink_indication_t; diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 52b06b9f11..42fa5f6de1 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -40,6 +40,10 @@ #include "rrc_types.h" //#include "PHY/phy_defs.h" #include "LAYER2/RLC/rlc.h" +#include "RRC/NR/nr_rrc_types.h" +#include "NR_UE-MRDC-Capability.h" +#include "NR_UE-NR-Capability.h" + #include "COMMON/platform_constants.h" #include "COMMON/platform_types.h" @@ -569,6 +573,10 @@ typedef struct eNB_RRC_UE_s { LTE_UE_EUTRA_Capability_t *UE_Capability; int UE_Capability_size; + NR_UE_MRDC_Capability_t *UE_Capability_MRDC; + int UE_MRDC_Capability_size; + NR_UE_NR_Capability_t *UE_Capability_nr; + int UE_NR_Capability_size; ImsiMobileIdentity_t imsi; /* KeNB as derived from KASME received from EPC */ @@ -614,7 +622,7 @@ typedef struct eNB_RRC_UE_s { /* Number of e_rab to be modified in the list */ uint8_t nb_of_modify_e_rabs; uint8_t nb_of_failed_e_rabs; - uint8_t nb_of_modify_endc_e_rabs; + uint8_t nb_of_modify_endc_e_rabs; e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB]; /* list of e_rab to be setup by RRC layers */ e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB]; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 652a390122..12f079f772 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -96,6 +96,10 @@ #include "SIMULATION/TOOLS/sim.h" // for taus +#define ASN_MAX_ENCODE_SIZE 4096 +#define NUMBEROF_DRBS_TOBE_ADDED 1 +static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size); +static int is_en_dc_supported(LTE_UE_EUTRA_Capability_t *c); extern RAN_CONTEXT_t RC; @@ -113,8 +117,9 @@ extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t extern int rrc_eNB_process_security(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, security_capabilities_t *security_capabilities_pP); extern void process_eNB_security_key (const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, uint8_t *security_key_pP); extern int derive_keNB_star(const uint8_t *kenb_32, const uint16_t pci, const uint32_t earfcn_dl, const bool is_rel8_only, uint8_t *kenb_star); -extern int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, rrc_eNB_ue_context_t *ue_context, unsigned char *buffer, int buffer_size, OCTET_STRING_t *scg_group_config, OCTET_STRING_t *scg_RB_config); -extern struct rrc_eNB_ue_context_s * get_first_ue_context(eNB_RRC_INST *rrc_instance_pP); +extern int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, rrc_eNB_ue_context_t *ue_context, unsigned char *buffer, int buffer_size, OCTET_STRING_t *scg_group_config, + OCTET_STRING_t *scg_RB_config); +extern struct rrc_eNB_ue_context_s *get_first_ue_context(eNB_RRC_INST *rrc_instance_pP); pthread_mutex_t rrc_release_freelist; RRC_release_list_t rrc_release_info; @@ -162,7 +167,7 @@ init_SI( AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_MBMS!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_MBMS allocated\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = do_SIB1_MBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id, - configuration + configuration ); LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB1-MBMS\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP) @@ -2119,7 +2124,27 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); } - +#if 0 +void rrc_generate_SgNBReleaseRequest( + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + MessageDef *msg; + msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_RELEASE_REQ); + memset(&(X2AP_ENDC_SGNB_RELEASE_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_release_req_t)); + // X2AP_ENDC_SGNB_RELEASE_REQ(msg).MeNB_ue_x2_id = ; + // X2AP_ENDC_SGNB_RELEASE_REQ(msg).SgNB_ue_x2_id = ; + // X2AP_ENDC_SGNB_RELEASE_REQ(msg).cause = ; + // X2AP_ENDC_SGNB_RELEASE_REQ(msg).target_physCellId = ; + LOG_I(RRC, + "[eNB %d] frame %d UE rnti %x transmitting sgnb release request to sgnb \n", + ctxt_pP->module_id,ctxt_pP->frame,ctxt_pP->rnti); + itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); + return; +} +#endif //----------------------------------------------------------------------------- /* * Generate the RRC Connection Release to UE. @@ -2139,6 +2164,15 @@ rrc_eNB_generate_RRCConnectionRelease( memset(buffer, 0, RRC_BUF_SIZE); T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); +#if 0 + + if(ue_context_pP != NULL) { + if(ue_context_pP->ue_context.Status == RRC_NR_NSA) { + //rrc_eNB_generate_SgNBReleaseRequest(ctxt_pP,ue_context_pP); + } + } + +#endif size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_release_timer = 0; @@ -2837,7 +2871,6 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t uint16_t size; int i; MessageDef *message_p = NULL; - /* Configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE */ eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; @@ -3029,7 +3062,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t module_id_t module_id = ctxt_pP->module_id; LOG_D(RRC, "Processing the DRX configuration in RRC Connection Reconfiguration\n"); - /* Process the IE drx_Config */ + /* Process the IE drx_Config */ if (NODE_IS_MONOLITHIC(rrc_inst->node_type)) { mac_MainConfig->drx_Config = do_DrxConfig(cc_id, &rrc_inst->configuration, UEcap); // drx_Config IE @@ -3044,8 +3077,8 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t LOG_D(RRC, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); } } - /* End of CDRX configuration */ + /* End of CDRX configuration */ sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2 = 2*SR mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); @@ -3153,7 +3186,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t if (ue_context_pP->ue_context.does_nr) { MeasId6 = calloc(1, sizeof(LTE_MeasIdToAddMod_t)); + if (MeasId6 == NULL) exit(1); + MeasId6->measId = 7; MeasId6->measObjectId = 2; MeasId6->reportConfigId = 7; @@ -3211,7 +3246,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t if (ue_context_pP->ue_context.does_nr) { MeasObj2 = calloc(1, sizeof(LTE_MeasObjectToAddMod_t)); + if (MeasObj2 == NULL) exit(1); + MeasObj2->measObjectId = 2; MeasObj2->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectNR_r15; MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 =641272; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016) @@ -3221,12 +3258,15 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz30; MeasObj2->measObject.choice.measObjectNR_r15.quantityConfigSet_r15 = 1; MeasObj2->measObject.choice.measObjectNR_r15.ext1 = calloc(1, sizeof(struct LTE_MeasObjectNR_r15__ext1)); + if (MeasObj2->measObject.choice.measObjectNR_r15.ext1 == NULL) exit(1); + MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15 = calloc(1, sizeof(struct LTE_MeasObjectNR_r15__ext1__bandNR_r15)); + if (MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15 == NULL) exit(1); + MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->present = LTE_MeasObjectNR_r15__ext1__bandNR_r15_PR_setup; MeasObj2->measObject.choice.measObjectNR_r15.ext1->bandNR_r15->choice.setup = 78; - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj2); } @@ -3242,9 +3282,11 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + if (ue_context_pP->ue_context.does_nr) { ReportConfig_NR = CALLOC(1, sizeof(*ReportConfig_NR)); } + ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -3365,9 +3407,13 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportInterval = LTE_ReportInterval_ms120; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportAmount = LTE_ReportConfigInterRAT__reportAmount_infinity; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 = calloc(1, sizeof(struct LTE_ReportConfigInterRAT__ext7)); + if (ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 == NULL) exit(1); + ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15 = calloc(1, sizeof(struct LTE_ReportQuantityNR_r15)); + if (ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15 == NULL) exit(1); + ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15->ss_rsrp = TRUE; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15->ss_rsrq = TRUE; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15->ss_sinr = TRUE; @@ -3569,7 +3615,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt uint16_t size; int i; MessageDef *message_p = NULL; - /* Configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE */ eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; @@ -3615,7 +3660,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt LTE_C_RNTI_t *cba_RNTI = NULL; int measurements_enabled; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - #ifdef CBA // Contention Based Access uint8_t *cba_RNTI_buf; cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t)); @@ -3641,8 +3685,8 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt frameP, ue_mod_idP); } -#endif +#endif T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), @@ -3777,7 +3821,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf200; // sf20 = 20 subframes // LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf1000 mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3; // Value dB1 =1 dB, dB3 = 3 dB - /* CDRX Configuration */ mac_MainConfig->drx_Config = NULL; rnti_t rnti = ue_context_pP->ue_id_rnti; @@ -3785,11 +3828,11 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt uint8_t cc_id = ue_context_pP->ue_context.primaryCC_id; LTE_UE_EUTRA_Capability_t *UEcap = ue_context_pP->ue_context.UE_Capability; LOG_D(RRC, "Processing the DRX configuration in RRC Connection Reconfiguration\n"); - + /* Process the IE drx_Config */ if (NODE_IS_MONOLITHIC(rrc_inst->node_type)) { mac_MainConfig->drx_Config = do_DrxConfig(cc_id, &rrc_inst->configuration, UEcap); // drx_Config IE - + if (mac_MainConfig->drx_Config == NULL) { LOG_W(RRC, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); } else { @@ -3801,8 +3844,8 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt LOG_D(RRC, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); } } - /* End of CDRX configuration */ + /* End of CDRX configuration */ sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2 = 2*SR mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); @@ -4319,6 +4362,182 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( } + +//----------------------------------------------------------------------------- +/** + * @fn :encode_CG_ConfigInfo + * @param :enc_buf to store the encoded bits + * @param :ue_context_pP ue context used to fill CG-ConfigInfo + * @param :enc_size to store thre size of encoded size + * this api is to fill and encode CG-ConfigInfo + */ +static int encode_CG_ConfigInfo( + char *buffer, + int buffer_size, + rrc_eNB_ue_context_t *const ue_context_pP, + int *enc_size +) { + struct NR_CG_ConfigInfo *cg_configinfo = NULL; + struct NR_RadioBearerConfig *rb_config = NULL; + asn_enc_rval_t enc_rval; + int RRC_OK = 1; + int index = 0; + char temp_buff[ASN_MAX_ENCODE_SIZE]; + LTE_UE_CapabilityRAT_ContainerList_t *ue_cap_rat_container_list = NULL; + LTE_UE_CapabilityRAT_Container_t ue_cap_rat_container_MRDC; + LTE_UE_CapabilityRAT_Container_t ue_cap_rat_container_nr; + int RAT_Container_count = 0; + rb_config = calloc(1,sizeof(struct NR_RadioBearerConfig)); + AssertFatal(rb_config != NULL,"failed to allocate memory for rb_config"); + + if(ue_context_pP->ue_context.DRB_configList->list.count != 0) { + rb_config->drb_ToAddModList = calloc(1,sizeof(struct NR_DRB_ToAddModList )); + AssertFatal(rb_config->drb_ToAddModList != NULL,"failed to allocated memory for drbtoaddmodlist"); + rb_config->drb_ToAddModList->list.count = NUMBEROF_DRBS_TOBE_ADDED; + rb_config->drb_ToAddModList->list.array + = calloc(NUMBEROF_DRBS_TOBE_ADDED, sizeof(struct NR_DRB_ToAddMod *)); + AssertFatal( rb_config->drb_ToAddModList->list.array != NULL, + "falied to allocate memory for list.array"); + + for(index = 0; index < NUMBEROF_DRBS_TOBE_ADDED; index++) { + rb_config->drb_ToAddModList->list.array[index] + = calloc(1,sizeof(struct NR_DRB_ToAddMod)); + AssertFatal(rb_config->drb_ToAddModList->list.array[index] != NULL, + "failed to allocate memory for drb_toaddmod"); + rb_config->drb_ToAddModList->list.array[index]->drb_Identity + = ue_context_pP->ue_context.DRB_configList->list.array[index]->drb_Identity; + + if(ue_context_pP->ue_context.DRB_configList->list.array[index]->eps_BearerIdentity) { + rb_config->drb_ToAddModList->list.array[index]->cnAssociation + = calloc(1,sizeof(struct NR_DRB_ToAddMod__cnAssociation)); + AssertFatal(rb_config->drb_ToAddModList->list.array[index]->cnAssociation != NULL, + "failed to allocate memory cnAssociation"); + rb_config->drb_ToAddModList->list.array[index]->cnAssociation->present + = NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity; + rb_config->drb_ToAddModList->list.array[index]->cnAssociation->choice.eps_BearerIdentity + = *(ue_context_pP->ue_context.DRB_configList->list.array[index]->eps_BearerIdentity); + } + + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config = calloc(1,sizeof(struct NR_PDCP_Config)); + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb = calloc(1,sizeof(struct NR_PDCP_Config__drb)); + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->discardTimer = calloc(1,sizeof(long)); + *rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->discardTimer + = *(ue_context_pP->ue_context.DRB_configList->list.array[index]->pdcp_Config->discardTimer); + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(long)); + *rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeUL + = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(long)); + *rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeDL + = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits; + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->headerCompression.present + = NR_PDCP_Config__drb__headerCompression_PR_notUsed; + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->headerCompression.choice.notUsed = 0; + rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->t_Reordering = calloc(1,sizeof(long)); + *rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->t_Reordering + = NR_PDCP_Config__t_Reordering_ms0; + } + + rb_config->securityConfig = calloc(1,sizeof(struct NR_SecurityConfig )); + rb_config->securityConfig->securityAlgorithmConfig = calloc(1,sizeof(struct NR_SecurityAlgorithmConfig)); + rb_config->securityConfig->securityAlgorithmConfig->cipheringAlgorithm = NR_CipheringAlgorithm_nea0; + rb_config->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm = NULL; + rb_config->securityConfig->keyToUse = calloc(1,sizeof(long)); + *rb_config->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master; + } + + cg_configinfo = calloc(1,sizeof(struct NR_CG_ConfigInfo)); + AssertFatal(cg_configinfo != NULL,"failed to allocate memory for cg_configinfo"); + cg_configinfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1; + cg_configinfo->criticalExtensions.choice.c1 + = calloc(1, sizeof(struct NR_CG_ConfigInfo__criticalExtensions__c1)); + AssertFatal(cg_configinfo->criticalExtensions.choice.c1 != NULL, + "failed to allocate memory for cg_configinfo->criticalExtensions.choice.c1"); + cg_configinfo->criticalExtensions.choice.c1->present + = NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo; + cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo + = calloc(1,sizeof(struct NR_CG_ConfigInfo_IEs)); + AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo != NULL, + "failed to allocate memory for cg_configinfo_IEs"); + cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo + = calloc(1,sizeof( OCTET_STRING_t)); + AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo-> + ue_CapabilityInfo != NULL, "failed to allocate memory for ue_capabilityinfo"); + + if(ue_context_pP->ue_context.UE_Capability_MRDC) { + RAT_Container_count++; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_MRDC_Capability,NULL, + (void *)ue_context_pP->ue_context.UE_Capability_MRDC,temp_buff,ASN_MAX_ENCODE_SIZE); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + ue_cap_rat_container_MRDC.rat_Type = LTE_RAT_Type_eutra_nr; + OCTET_STRING_fromBuf(&ue_cap_rat_container_MRDC.ueCapabilityRAT_Container, + (const char *)temp_buff,(enc_rval.encoded+7)>>3); + memset((void *)temp_buff,0,sizeof(temp_buff)); + } + + if(ue_context_pP->ue_context.UE_Capability_nr) { + RAT_Container_count++; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_NR_Capability,NULL, + (void *)ue_context_pP->ue_context.UE_Capability_nr,temp_buff,ASN_MAX_ENCODE_SIZE); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + ue_cap_rat_container_nr.rat_Type = LTE_RAT_Type_nr; + OCTET_STRING_fromBuf(&ue_cap_rat_container_nr.ueCapabilityRAT_Container, + (const char *)temp_buff,(enc_rval.encoded+7)>>3); + memset((void *)temp_buff,0,sizeof(temp_buff)); + } + + ue_cap_rat_container_list = calloc(1,sizeof(LTE_UE_CapabilityRAT_ContainerList_t)); + ue_cap_rat_container_list->list.count = RAT_Container_count; + ue_cap_rat_container_list->list.size = RAT_Container_count * sizeof(LTE_UE_CapabilityRAT_Container_t); + ue_cap_rat_container_list->list.array = calloc(RAT_Container_count,sizeof(LTE_UE_CapabilityRAT_Container_t *)); + + if(ue_context_pP->ue_context.UE_Capability_MRDC) { + ue_cap_rat_container_list->list.array[0] = calloc(1,sizeof(LTE_UE_CapabilityRAT_Container_t)); + memcpy(ue_cap_rat_container_list->list.array[0],&ue_cap_rat_container_MRDC,sizeof(LTE_UE_CapabilityRAT_Container_t)); + } + + if(ue_context_pP->ue_context.UE_Capability_nr) { + ue_cap_rat_container_list->list.array[1] = calloc(1,sizeof(LTE_UE_CapabilityRAT_Container_t)); + memcpy(ue_cap_rat_container_list->list.array[1],&ue_cap_rat_container_nr,sizeof(LTE_UE_CapabilityRAT_Container_t)); + } + + //this xer_fprint logs can be enabled for additional debugging logs + //xer_fprint(stdout,&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,ue_cap_rat_container_list); + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL, + (void *)ue_cap_rat_container_list,temp_buff,ASN_MAX_ENCODE_SIZE); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + OCTET_STRING_fromBuf(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo, + (const char *)temp_buff, (enc_rval.encoded+7)>>3); + cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config + = calloc(1,sizeof(OCTET_STRING_t)); + AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo-> + mcg_RB_Config != NULL, "failed to allocate memory for mcg_rb_config"); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig,NULL,(void *)rb_config,temp_buff,ASN_MAX_ENCODE_SIZE); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + OCTET_STRING_fromBuf(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config, + (const char *)temp_buff, (enc_rval.encoded+7)>>3); + // this xer_fprint can be enabled for additional debugging messages + // xer_fprint(stdout,&asn_DEF_NR_CG_ConfigInfo,(void *)cg_configinfo); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CG_ConfigInfo,NULL,(void *)cg_configinfo, + buffer,buffer_size); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + *enc_size = (enc_rval.encoded+7)/8; + ASN_STRUCT_FREE(asn_DEF_NR_RadioBearerConfig,rb_config); + ASN_STRUCT_FREE(asn_DEF_NR_CG_ConfigInfo,cg_configinfo); + ASN_STRUCT_FREE(asn_DEF_LTE_UE_CapabilityRAT_ContainerList,ue_cap_rat_container_list); + return RRC_OK; +} +//----------------------------------------------------------------------------- + + + + + + //----------------------------------------------------------------------------- void rrc_eNB_process_MeasurementReport( @@ -4334,6 +4553,8 @@ rrc_eNB_process_MeasurementReport( long ncell_max = -150; uint32_t earfcn_dl; uint8_t KeNB_star[32] = { 0 }; + char enc_buf[ASN_MAX_ENCODE_SIZE] = {0}; + int enc_size = 0; T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); @@ -4396,24 +4617,37 @@ rrc_eNB_process_MeasurementReport( MessageDef *msg; ue_context_pP->ue_context.Status = RRC_NR_NSA; - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ); - X2AP_ENDC_SGNB_ADDITION_REQ(msg).rnti = ctxt_pP->rnti; - //For the moment we have a single E-RAB which will be the one to be added to the gNB - //Not sure how to select bearers to be added if there are multiple. - X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded = 1; - for (int e_rab=0; e_rab < X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded; e_rab++){ - X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; - X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].gtp_teid = ue_context_pP->ue_context.e_rab[e_rab].param.gtp_teid; - X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].drb_ID = 1; - memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr, - &ue_context_pP->ue_context.e_rab[e_rab].param.sgw_addr, - sizeof(transport_layer_addr_t)); + if(is_en_dc_supported(ue_context_pP->ue_context.UE_Capability)) { + /** to add gNB as Secondary node CG-ConfigInfo to be added as per 36.423 r15 **/ + if(encode_CG_ConfigInfo(enc_buf,sizeof(enc_buf),ue_context_pP,&enc_size) == RRC_OK) + LOG_I(RRC,"CG-ConfigInfo encoded successfully\n"); + + msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ); + memset(&(X2AP_ENDC_SGNB_ADDITION_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_addition_req_t)); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).rnti = ctxt_pP->rnti; + memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer,enc_buf,enc_size); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId + = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId; + //For the moment we have a single E-RAB which will be the one to be added to the gNB + //Not sure how to select bearers to be added if there are multiple. + X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded = 1; + + for (int e_rab=0; e_rab < X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded; e_rab++) { + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].gtp_teid = ue_context_pP->ue_context.e_rab[e_rab].param.gtp_teid; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].drb_ID = 1; + memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr, + &ue_context_pP->ue_context.e_rab[e_rab].param.sgw_addr, + sizeof(transport_layer_addr_t)); + } + + LOG_I(RRC, + "[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n", + ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->subframe, ctxt_pP->rnti); + itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); + return; } - LOG_I(RRC, - "[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n", - ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->subframe, ctxt_pP->rnti); - itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); - return; } } @@ -4531,6 +4765,7 @@ rrc_eNB_process_MeasurementReport( } } + //----------------------------------------------------------------------------- void rrc_eNB_generate_HandoverPreparationInformation( @@ -6058,6 +6293,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; } } + LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration handover (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); @@ -6228,10 +6464,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; LTE_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; LTE_DRB_Identity_t *drb_id_p = NULL; - ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // reset rrc inactivity timer - /* CDRX: activated when RRC Connection Reconfiguration Complete is received */ rnti_t rnti = ue_context_pP->ue_id_rnti; module_id_t module_id = ctxt_pP->module_id; @@ -6252,8 +6486,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( LOG_I(RRC, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n"); } } - /* End of CDRX processing */ + /* End of CDRX processing */ T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), @@ -6514,7 +6748,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ue_context_pP->ue_context.nr_capabilities_requested = 1; rrc_eNB_generate_NR_UECapabilityEnquiry(ctxt_pP, ue_context_pP); } - } //----------------------------------------------------------------------------- @@ -6693,14 +6926,6 @@ char openair_rrc_eNB_configuration( LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Init...\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); -#if OCP_FRAMEWORK - - while ( RC.rrc[enb_mod_idP] == NULL ) { - LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n"); - sleep(1); - } - -#endif AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); AssertFatal(MAX_MOBILES_PER_ENB < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); AssertFatal(configuration!=NULL,"configuration input is null\n"); @@ -7345,33 +7570,34 @@ is_en_dc_supported( */ #define NCE nonCriticalExtension return c != NULL - && c->NCE != NULL - && c->NCE->NCE != NULL - && c->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL - && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 == LTE_IRAT_ParametersNR_r15__en_DC_r15_supported; + && c->NCE != NULL + && c->NCE->NCE != NULL + && c->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL + && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 == + LTE_IRAT_ParametersNR_r15__en_DC_r15_supported; #undef NCE } @@ -7560,37 +7786,36 @@ rrc_eNB_decode_dcch( //Looking for a condition to trigger S1AP E-RAB-Modification-indication, based on the reception of RRCConnectionReconfigurationComplete //including NR specific elements. Not sure if this is the correct one and the correct placement /*if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> - scg_ConfigResponseNR_r15->buf!=NULL){ - //Trigger E-RAB Modification Indication - rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p); + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> + scg_ConfigResponseNR_r15->buf!=NULL){ + //Trigger E-RAB Modification Indication + rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p); }*/ if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension!=NULL){ - if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension!=NULL){ - if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL){ - if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL){ - if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL){ - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL){ - if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension - ->scg_ConfigResponseNR_r15!=NULL){ - /*Trigger E-RAB Modification Indication */ - rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p); - } - } - } - } - } - } + nonCriticalExtension!=NULL) { + if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension!=NULL) { + if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) { + if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) { + if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) { + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) { + if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. + nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension + ->scg_ConfigResponseNR_r15!=NULL) { + /*Trigger E-RAB Modification Indication */ + rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p); + } + } + } + } + } + } } - } else { dedicated_DRB = 1; ue_context_p->ue_context.Status = RRC_RECONFIGURED; @@ -7938,15 +8163,74 @@ rrc_eNB_decode_dcch( } LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); - int eutra_index = -1; for (i = 0; i < ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count; i++) { - if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == LTE_RAT_Type_eutra) { + if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == + LTE_RAT_Type_nr) { + if(ue_context_p->ue_context.UE_Capability_nr) { + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); + ue_context_p->ue_context.UE_Capability_nr = 0; + } + + dec_rval = uper_decode(NULL, + &asn_DEF_NR_UE_NR_Capability, + (void **)&ue_context_p->ue_context.UE_Capability_nr, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.size, + 0, 0); + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr); + } + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode nr UE capabilities (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed); + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); + ue_context_p->ue_context.UE_Capability_nr = 0; + } + + ue_context_p->ue_context.UE_NR_Capability_size = + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.size; + } + + if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == + LTE_RAT_Type_eutra_nr) { + if(ue_context_p->ue_context.UE_Capability_MRDC) { + ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); + ue_context_p->ue_context.UE_Capability_MRDC = 0; + } + + dec_rval = uper_decode(NULL, + &asn_DEF_NR_UE_MRDC_Capability, + (void **)&ue_context_p->ue_context.UE_Capability_MRDC, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.size, + 0, 0); + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC); + } + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode MRDC UE capabilities (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed); + ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); + ue_context_p->ue_context.UE_Capability_MRDC = 0; + } + + ue_context_p->ue_context.UE_MRDC_Capability_size = + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->ueCapabilityRAT_Container.size; + } + + if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == + LTE_RAT_Type_eutra) { if (eutra_index != -1) { LOG_E(RRC, "fatal: more than 1 eutra capability\n"); exit(1); } + eutra_index = i; } } @@ -7968,7 +8252,8 @@ rrc_eNB_decode_dcch( ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[eutra_index]->ueCapabilityRAT_Container.buf, ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[eutra_index]->ueCapabilityRAT_Container.size, 0, 0); - ue_context_p->ue_context.UE_Capability_size = ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[eutra_index]->ueCapabilityRAT_Container.size; + ue_context_p->ue_context.UE_Capability_size = + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[eutra_index]->ueCapabilityRAT_Container.size; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_LTE_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); @@ -8705,117 +8990,109 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP, x2ap_ENDC_sgnb_addition_req_ACK_t *m) { + NR_CG_Config_t *CG_Config = NULL; + { + int i; + printf("%d: ", m->rrc_buffer_size); + for (i=0; irrc_buffer_size; i++) printf("%2.2x", (unsigned char)m->rrc_buffer[i]); - NR_CG_Config_t *CG_Config = NULL; + printf("\n"); + } + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_CG_Config, + (void **)&CG_Config, + (uint8_t *)m->rrc_buffer, + (int) m->rrc_buffer_size);//m->rrc_buffer_size); - { - int i; - printf("%d: ", m->rrc_buffer_size); - for (i=0; irrc_buffer_size; i++) printf("%2.2x", (unsigned char)m->rrc_buffer[i]); - printf("\n"); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_CG_Config, CG_Config, 1 ); + return; + } - } - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_NR_CG_Config, - (void **)&CG_Config, - (uint8_t *)m->rrc_buffer, - (int) m->rrc_buffer_size);//m->rrc_buffer_size); + xer_fprint(stdout,&asn_DEF_NR_CG_Config, CG_Config); + // recreate enough of X2 EN-DC Container + AssertFatal(CG_Config->criticalExtensions.choice.c1->present == NR_CG_Config__criticalExtensions__c1_PR_cg_Config, + "CG_Config not present\n"); + OCTET_STRING_t *scg_CellGroupConfig = NULL; + OCTET_STRING_t *nr1_conf = NULL; - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n"); - // free the memory - SEQUENCE_free( &asn_DEF_NR_CG_Config, CG_Config, 1 ); - return; - } - xer_fprint(stdout,&asn_DEF_NR_CG_Config, CG_Config); - // recreate enough of X2 EN-DC Container - - AssertFatal(CG_Config->criticalExtensions.choice.c1->present == NR_CG_Config__criticalExtensions__c1_PR_cg_Config, - "CG_Config not present\n"); - - OCTET_STRING_t *scg_CellGroupConfig = NULL; - OCTET_STRING_t *nr1_conf = NULL; - - if(CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig){ - scg_CellGroupConfig = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig; + if(CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig) { + scg_CellGroupConfig = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig; #ifdef DEBUG_SCG_CONFIG - { - int size_s = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig->size; - int i; - LOG_I(RRC, "Dumping scg_CellGroupConfig: %d", size_s); - for (i=0; icriticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig->buf[i]); - printf("\n"); + { + int size_s = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig->size; + int i; + LOG_I(RRC, "Dumping scg_CellGroupConfig: %d", size_s); - } + for (i=0; icriticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig->buf[i]); + + printf("\n"); + } #endif + } else { + LOG_W(RRC, "SCG Cell group configuration is not present in the Addition Response message \n"); + return; + } - } - else{ - LOG_W(RRC, "SCG Cell group configuration is not present in the Addition Response message \n"); - return; - } - if(CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config){ - nr1_conf = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config; + if(CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config) { + nr1_conf = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config; #ifdef DEBUG_SCG_CONFIG - { - int size_s = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config->size; - int i; - LOG_I(RRC, "Dumping scg_RB_Config: %d", size_s); - for (i=0; icriticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config->buf[i]); - printf("\n"); + { + int size_s = CG_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config->size; + int i; + LOG_I(RRC, "Dumping scg_RB_Config: %d", size_s); - } + for (i=0; icriticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config->buf[i]); + + printf("\n"); + } #endif - } - else{ - LOG_W(RRC, "SCG RB configuration is not present in the Addition Response message \n"); - return; + } else { + LOG_W(RRC, "SCG RB configuration is not present in the Addition Response message \n"); + return; + } + + protocol_ctxt_t ctxt; + rrc_eNB_ue_context_t *ue_context; + unsigned char buffer[8192]; + int size; + ue_context = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], m->rnti); + ue_context->ue_context.nb_of_modify_endc_e_rabs = m->nb_e_rabs_admitted_tobeadded; + int j=0; + + while(j < m->nb_e_rabs_admitted_tobeadded) { + for (int e_rab_idx=0; e_rab_idxue_context.setup_e_rabs; e_rab_idx++) { + //Update ue_context information with gNB's address and new GTP tunnel ID + if( ue_context->ue_context.e_rab[e_rab_idx].param.e_rab_id == m->e_rabs_admitted_tobeadded[j].e_rab_id) { + memcpy(ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].buffer, + m->e_rabs_admitted_tobeadded[j].gnb_addr.buffer, + m->e_rabs_admitted_tobeadded[j].gnb_addr.length); + ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].length = m->e_rabs_admitted_tobeadded[j].gnb_addr.length; + ue_context->ue_context.gnb_gtp_endc_teid[e_rab_idx] = m->e_rabs_admitted_tobeadded[j].gtp_teid; + ue_context->ue_context.e_rab[e_rab_idx].status = E_RAB_STATUS_TOMODIFY; + break; + } } - protocol_ctxt_t ctxt; - rrc_eNB_ue_context_t *ue_context; - unsigned char buffer[8192]; - int size; + j++; + } - ue_context = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], m->rnti); - - ue_context->ue_context.nb_of_modify_endc_e_rabs = m->nb_e_rabs_admitted_tobeadded; - - int j=0; - while(j < m->nb_e_rabs_admitted_tobeadded){ - for (int e_rab_idx=0; e_rab_idxue_context.setup_e_rabs; e_rab_idx++){ - //Update ue_context information with gNB's address and new GTP tunnel ID - if( ue_context->ue_context.e_rab[e_rab_idx].param.e_rab_id == m->e_rabs_admitted_tobeadded[j].e_rab_id){ - memcpy(ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].buffer, - m->e_rabs_admitted_tobeadded[j].gnb_addr.buffer, - m->e_rabs_admitted_tobeadded[j].gnb_addr.length); - ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].length = m->e_rabs_admitted_tobeadded[j].gnb_addr.length; - ue_context->ue_context.gnb_gtp_endc_teid[e_rab_idx] = m->e_rabs_admitted_tobeadded[j].gtp_teid; - ue_context->ue_context.e_rab[e_rab_idx].status = E_RAB_STATUS_TOMODIFY; - break; - } - } - j++; - } - - - - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - 0, - ENB_FLAG_YES, - m->rnti, - 0, 0); - - size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf); - - rrc_data_req(&ctxt, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + 0, + ENB_FLAG_YES, + m->rnti, + 0, 0); + size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf); + rrc_data_req(&ctxt, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } @@ -9098,11 +9375,10 @@ void *rrc_enb_process_itti_msg(void *notUsed) { } case X2AP_ENDC_SGNB_ADDITION_REQ_ACK: { - rrc_eNB_process_AdditionResponseInformation(ENB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg_p)); - break; + rrc_eNB_process_AdditionResponseInformation(ENB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg_p)); + break; } - /* Messages from eNB app */ case RRC_CONFIGURATION_REQ: LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); @@ -9122,36 +9398,36 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; case M2AP_SETUP_RESP: - rrc_eNB_process_M2AP_SETUP_RESP(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_SETUP_RESP(msg_p)); + rrc_eNB_process_M2AP_SETUP_RESP(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_SETUP_RESP(msg_p)); break; case M2AP_MBMS_SCHEDULING_INFORMATION: - rrc_eNB_process_M2AP_MBMS_SCHEDULING_INFORMATION(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_MBMS_SCHEDULING_INFORMATION(msg_p)); - break; + rrc_eNB_process_M2AP_MBMS_SCHEDULING_INFORMATION(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_MBMS_SCHEDULING_INFORMATION(msg_p)); + break; case M2AP_MBMS_SESSION_START_REQ: - rrc_eNB_process_M2AP_MBMS_SESSION_START_REQ(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_MBMS_SESSION_START_REQ(msg_p)); - break; + rrc_eNB_process_M2AP_MBMS_SESSION_START_REQ(&ctxt,0/*CC_id*/,ENB_INSTANCE_TO_MODULE_ID(instance),&M2AP_MBMS_SESSION_START_REQ(msg_p)); + break; case M2AP_MBMS_SESSION_STOP_REQ: - rrc_eNB_process_M2AP_MBMS_SESSION_STOP_REQ(&ctxt,&M2AP_MBMS_SESSION_STOP_REQ(msg_p)); - break; + rrc_eNB_process_M2AP_MBMS_SESSION_STOP_REQ(&ctxt,&M2AP_MBMS_SESSION_STOP_REQ(msg_p)); + break; case M2AP_RESET: - rrc_eNB_process_M2AP_RESET(&ctxt,&M2AP_RESET(msg_p)); - break; + rrc_eNB_process_M2AP_RESET(&ctxt,&M2AP_RESET(msg_p)); + break; case M2AP_ENB_CONFIGURATION_UPDATE_ACK: - rrc_eNB_process_M2AP_ENB_CONFIGURATION_UPDATE_ACK(&ctxt,&M2AP_ENB_CONFIGURATION_UPDATE_ACK(msg_p)); - break; + rrc_eNB_process_M2AP_ENB_CONFIGURATION_UPDATE_ACK(&ctxt,&M2AP_ENB_CONFIGURATION_UPDATE_ACK(msg_p)); + break; case M2AP_ERROR_INDICATION: - rrc_eNB_process_M2AP_ERROR_INDICATION(&ctxt,&M2AP_ERROR_INDICATION(msg_p)); - break; + rrc_eNB_process_M2AP_ERROR_INDICATION(&ctxt,&M2AP_ERROR_INDICATION(msg_p)); + break; case M2AP_MBMS_SERVICE_COUNTING_REQ: - rrc_eNB_process_M2AP_MBMS_SERVICE_COUNTING_REQ(&ctxt,&M2AP_MBMS_SERVICE_COUNTING_REQ(msg_p)); - break; + rrc_eNB_process_M2AP_MBMS_SERVICE_COUNTING_REQ(&ctxt,&M2AP_MBMS_SERVICE_COUNTING_REQ(msg_p)); + break; case M2AP_MCE_CONFIGURATION_UPDATE: rrc_eNB_process_M2AP_MCE_CONFIGURATION_UPDATE(&ctxt,&M2AP_MCE_CONFIGURATION_UPDATE(msg_p)); @@ -9188,17 +9464,16 @@ rrc_enb_task( //----------------------------------------------------------------------------- { rrc_enb_init(); - itti_mark_task_ready(TASK_RRC_ENB); LOG_I(RRC,"Entering main loop of RRC message task\n"); while (1) { (void) rrc_enb_process_itti_msg(NULL); -{ - //extern volatile int go_nr; - void rrc_go_nr(void); - //if (go_nr) rrc_go_nr(); -} + { + //extern volatile int go_nr; + void rrc_go_nr(void); + //if (go_nr) rrc_go_nr(); + } } } diff --git a/openair2/RRC/LTE/rrc_eNB_UE_context.h b/openair2/RRC/LTE/rrc_eNB_UE_context.h index 289b4d69d6..e22f517d50 100644 --- a/openair2/RRC/LTE/rrc_eNB_UE_context.h +++ b/openair2/RRC/LTE/rrc_eNB_UE_context.h @@ -28,6 +28,8 @@ * \email: lionel.gauthier@eurecom.fr */ #ifndef __RRC_ENB_UE_CONTEXT_H__ +#define __RRC_ENB_UE_CONTEXT_H__ + #include "collection/tree.h" #include "COMMON/platform_types.h" #include "rrc_defs.h" diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index cb23b6d5e6..317282c814 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -65,7 +65,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( struct rrc_gNB_ue_context_s *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP); -void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m); +void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t * cg_config_info); void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m); @@ -82,7 +82,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon int n_physical_antenna_ports, int initial_csi_index); -void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, long eps_BearerIdentity, long drb_Identity); +void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig); int generate_CG_Config(gNB_RRC_INST *rrc, NR_CG_Config_t *cg_Config, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index c22f522494..1f341cfdf9 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -95,12 +95,10 @@ mui_t rrc_gNB_mui = 0; void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) { LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP)); - rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1); RC.nrrrc[ctxt_pP->module_id]->carrier.SI.Active = 1; rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.Srb0, CCCH, 1); RC.nrrrc[ctxt_pP->module_id]->carrier.Srb0.Active = 1; - } ///---------------------------------------------------------------------------------------------------------------/// @@ -173,7 +171,6 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ue_context_pP->ue_context.primaryCC_id, physicalCellGroupConfig, physicalcellgroup_config); - do_SpCellConfig(RC.nrrrc[ctxt_pP->module_id], spCellConfig); } @@ -182,57 +179,47 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ///---------------------------------------------------------------------------------------------------------------/// static void init_NR_SI(gNB_RRC_INST *rrc) { - - LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - - - - rrc->carrier.MIB = (uint8_t*) malloc16(4); + rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); - - LOG_I(NR_RRC,"Done init_NR_SI\n"); - - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, - 0, - 0, // WIP hardcoded rnti - (NR_CellGroupConfig_t *)NULL - ); - + 0, + 0, // WIP hardcoded rnti + (NR_CellGroupConfig_t *)NULL + ); if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { // This is for phytest only, emulate first X2 message if uecap.raw file is present FILE *fd; - fd = fopen("uecap.raw","r"); + if (fd != NULL) { char buffer[4096]; int msg_len=fread(buffer,1,4096,fd); LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len); LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message; - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_LTE_UL_DCCH_Message, - (void **)<E_UL_DCCH_Message, - (uint8_t *)buffer, - msg_len); - + &asn_DEF_LTE_UL_DCCH_Message, + (void **)<E_UL_DCCH_Message, + (uint8_t *)buffer, + msg_len); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n"); - // free the memory - SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 ); - return; - } + // free the memory + SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 ); + return; + } + fclose(fd); xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message); // recreate enough of X2 EN-DC Container AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation, - "ueCapabilityInformation not present\n"); + "ueCapabilityInformation not present\n"); NR_CG_ConfigInfo_t *CG_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo)); CG_ConfigInfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1; CG_ConfigInfo->criticalExtensions.choice.c1 = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1)); @@ -240,49 +227,37 @@ static void init_NR_SI(gNB_RRC_INST *rrc) { CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo)); NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo; cg_ConfigInfo->ue_CapabilityInfo = calloc(1,sizeof(*cg_ConfigInfo->ue_CapabilityInfo)); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,(void*)<E_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,buffer,4096); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL, + (void *)<E_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,buffer,4096); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + enc_rval.failed_type->name, enc_rval.encoded); OCTET_STRING_fromBuf(cg_ConfigInfo->ue_CapabilityInfo, - (const char *)buffer, - (enc_rval.encoded+7)>>3); + (const char *)buffer, + (enc_rval.encoded+7)>>3); parse_CG_ConfigInfo(rrc,CG_ConfigInfo,NULL); - } - else { + } else { struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc); - - LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); + LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); rrc_add_nsa_user(rrc,ue_context_p,NULL); - } + } } } char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigurationReq *configuration) { protocol_ctxt_t ctxt; - gNB_RRC_INST *rrc=RC.nrrrc[gnb_mod_idP]; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, GNB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); - LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Init...\n", PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); -#if OCP_FRAMEWORK - while (rrc == NULL ) { - LOG_E(NR_RRC, "RC.nrrrc not yet initialized, waiting 1 second\n"); - sleep(1); - } -#endif AssertFatal(rrc != NULL, "RC.nrrrc not initialized!"); AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); AssertFatal(configuration!=NULL,"configuration input is null\n"); rrc->module_id = gnb_mod_idP; rrc->Nb_ue = 0; - rrc->carrier.Srb0.Active = 0; - nr_uid_linear_allocator_init(&rrc->uid_allocator); RB_INIT(&rrc->rrc_ue_head); rrc->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); @@ -292,7 +267,6 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; /// System Information INIT LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); - init_NR_SI(rrc); rrc_init_nr_global_param(); openair_nr_rrc_on(&ctxt); @@ -301,43 +275,26 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_addition_req_t *m) { + struct NR_CG_ConfigInfo *cg_configinfo = NULL; + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_CG_ConfigInfo, + (void **)&cg_configinfo, + (uint8_t *)m->rrc_buffer, + (int) m->rrc_buffer_size);//m->rrc_buffer_size); + gNB_RRC_INST *rrc=RC.nrrrc[gnb_mod_idP]; + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n"); + // free the memory + SEQUENCE_free(&asn_DEF_NR_CG_ConfigInfo, cg_configinfo, 1); + return; + } - LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message = NULL; - - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_LTE_UL_DCCH_Message, - (void **)<E_UL_DCCH_Message, - (uint8_t *)m->rrc_buffer, - (int) m->rrc_buffer_size);//m->rrc_buffer_size); - - gNB_RRC_INST *rrc=RC.nrrrc[gnb_mod_idP]; - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n"); - // free the memory - SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 ); - return; - } - xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message); - // recreate enough of X2 EN-DC Container - AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation, - "ueCapabilityInformation not present\n"); - NR_CG_ConfigInfo_t *CG_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo)); - CG_ConfigInfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1; - CG_ConfigInfo->criticalExtensions.choice.c1 = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1)); - CG_ConfigInfo->criticalExtensions.choice.c1->present = NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo; - CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo)); - NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo; - cg_ConfigInfo->ue_CapabilityInfo = calloc(1,sizeof(*cg_ConfigInfo->ue_CapabilityInfo)); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,(void*)<E_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,m->rrc_buffer,m->rrc_buffer_size); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - OCTET_STRING_fromBuf(cg_ConfigInfo->ue_CapabilityInfo, - (const char *)m->rrc_buffer, - (enc_rval.encoded+7)>>3); - parse_CG_ConfigInfo(rrc,CG_ConfigInfo,m); - + xer_fprint(stdout,&asn_DEF_NR_CG_ConfigInfo, cg_configinfo); + // recreate enough of X2 EN-DC Container + AssertFatal(cg_configinfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo, + "ueCapabilityInformation not present\n"); + parse_CG_ConfigInfo(rrc,cg_configinfo,m); } ///---------------------------------------------------------------------------------------------------------------/// @@ -435,16 +392,15 @@ void *rrc_gnb_task(void *args_p) { openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(instance), &NRRRC_CONFIGURATION_REQ(msg_p)); break; - /* Messages from X2AP */ + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: - LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); - rrc_gNB_process_AdditionRequestInformation(GNB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_SGNB_ADDITION_REQ(msg_p)); - break; + LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); + rrc_gNB_process_AdditionRequestInformation(GNB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_SGNB_ADDITION_REQ(msg_p)); + break; case X2AP_ENDC_SGNB_RECONF_COMPLETE: - LOG_I(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n"); - break; - + LOG_I(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n"); + break; default: LOG_E(NR_RRC, "[gNB %d] Received unexpected message %s\n", instance, msg_name_p); diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.h b/openair2/RRC/NR/rrc_gNB_UE_context.h index 762d964289..d703c4c34c 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.h +++ b/openair2/RRC/NR/rrc_gNB_UE_context.h @@ -27,8 +27,9 @@ * \company Eurecom * \email: lionel.gauthier@eurecom.fr */ -#ifndef __RRC_ENB_UE_CONTEXT_H__ -#define __RRC_ENB_UE_CONTEXT_H__ +#ifndef __RRC_GNB_UE_CONTEXT_H__ +#define __RRC_GNB_UE_CONTEXT_H__ + #include "collection/tree.h" #include "COMMON/platform_types.h" #include "nr_rrc_defs.h" diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c index 916f4d63da..cacff5cf5c 100644 --- a/openair2/RRC/NR/rrc_gNB_internode.c +++ b/openair2/RRC/NR/rrc_gNB_internode.c @@ -39,47 +39,48 @@ #include "NR_CG-Config.h" int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m) { - if (CG_ConfigInfo->criticalExtensions.present == NR_CG_ConfigInfo__criticalExtensions_PR_c1) { if (CG_ConfigInfo->criticalExtensions.choice.c1) { if (CG_ConfigInfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo) { - NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo; - if (cg_ConfigInfo->ue_CapabilityInfo) { - // Decode UE-CapabilityRAT-ContainerList + NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo; + + if (cg_ConfigInfo->ue_CapabilityInfo) { + // Decode UE-CapabilityRAT-ContainerList LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList=NULL; - asn_dec_rval_t dec_rval = uper_decode(NULL, - &asn_DEF_LTE_UE_CapabilityRAT_ContainerList, - (void**)&UE_CapabilityRAT_ContainerList, - cg_ConfigInfo->ue_CapabilityInfo->buf, - cg_ConfigInfo->ue_CapabilityInfo->size, 0, 0); + UE_CapabilityRAT_ContainerList = calloc(1,sizeof(LTE_UE_CapabilityRAT_ContainerList_t)); + asn_dec_rval_t dec_rval = uper_decode(NULL, + &asn_DEF_LTE_UE_CapabilityRAT_ContainerList, + (void **)&UE_CapabilityRAT_ContainerList, + cg_ConfigInfo->ue_CapabilityInfo->buf, + cg_ConfigInfo->ue_CapabilityInfo->size, 0, 0); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %lu\n", - dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size); - } - rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList, m); - } - if (cg_ConfigInfo->candidateCellInfoListMN) AssertFatal(1==0,"Can't handle candidateCellInfoListMN yet\n"); - } - else AssertFatal(1==0,"c1 extension is not cg_ConfigInfo, returning\n"); - } - else { + AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %lu\n", + dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size); + } + + rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList, m,cg_ConfigInfo); + } + + if (cg_ConfigInfo->candidateCellInfoListMN) AssertFatal(1==0,"Can't handle candidateCellInfoListMN yet\n"); + } else AssertFatal(1==0,"c1 extension is not cg_ConfigInfo, returning\n"); + } else { LOG_E(RRC,"c1 extension not found, returning\n"); - return(-1); + return(-1); } } else { LOG_E(RRC,"Ignoring unknown CG_ConfigInfo extensions\n"); return(-1); } - return(0); + + return(0); } -int generate_CG_Config(gNB_RRC_INST *rrc, - NR_CG_Config_t *cg_Config, - NR_RRCReconfiguration_t *reconfig, - NR_RadioBearerConfig_t *rbconfig) { - - +int generate_CG_Config(gNB_RRC_INST *rrc, + NR_CG_Config_t *cg_Config, + NR_RRCReconfiguration_t *reconfig, + NR_RadioBearerConfig_t *rbconfig) { cg_Config->criticalExtensions.present = NR_CG_Config__criticalExtensions_PR_c1; cg_Config->criticalExtensions.choice.c1 = calloc(1,sizeof(*cg_Config->criticalExtensions.choice.c1)); cg_Config->criticalExtensions.choice.c1->present = NR_CG_Config__criticalExtensions__c1_PR_cg_Config; @@ -91,36 +92,37 @@ int generate_CG_Config(gNB_RRC_INST *rrc, enc_rval.failed_type->name, enc_rval.encoded); cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig = calloc(1,sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig, - (const char *)buffer, - (enc_rval.encoded+7)>>3); + (const char *)buffer, + (enc_rval.encoded+7)>>3); total_size = (enc_rval.encoded+7)>>3; - LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3); - for (int i=0;i<(enc_rval.encoded+7)>>3;i++) { + + for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { printf("%02x",((uint8_t *)buffer)[i]); } + printf("\n"); FILE *fd = fopen("reconfig.raw","w"); - fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); + fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); fclose(fd); - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded); cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config = calloc(1,sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config, - (const char *)buffer, - (enc_rval.encoded+7)>>3); + (const char *)buffer, + (enc_rval.encoded+7)>>3); LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3); - for (int i=0;i<(enc_rval.encoded+7)>>3;i++) { - printf("%02x",((uint8_t*)buffer)[i]); + + for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { + printf("%02x",((uint8_t *)buffer)[i]); } + printf("\n"); fd = fopen("rbconfig.raw","w"); - fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); + fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); fclose(fd); total_size = total_size + ((enc_rval.encoded+7)>>3); - return(total_size); } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 0419d321ed..1775c22a51 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -39,6 +39,7 @@ //#include "NR_SRB-ToAddModList.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h" +#include "executables/softmodem-common.h" extern boolean_t nr_rrc_pdcp_config_asn1_req( const protocol_ctxt_t *const ctxt_pP, @@ -62,8 +63,7 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); -void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m) { - +void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) { struct rrc_gNB_ue_context_s *ue_context_p = NULL; OCTET_STRING_t *ueCapabilityRAT_Container_nr=NULL; @@ -73,10 +73,11 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_Container AssertFatal(UE_CapabilityRAT_ContainerList!=NULL,"UE_CapabilityRAT_ContainerList is null\n"); AssertFatal((list_size=UE_CapabilityRAT_ContainerList->list.count) >= 2, "UE_CapabilityRAT_ContainerList->list.size %d < 2\n",UE_CapabilityRAT_ContainerList->list.count); - for (int i=0;ilist.array[i]->rat_Type == LTE_RAT_Type_nr) ueCapabilityRAT_Container_nr = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container; else if (UE_CapabilityRAT_ContainerList->list.array[i]->rat_Type == LTE_RAT_Type_eutra_nr) ueCapabilityRAT_Container_MRDC = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container; - } + } // decode and store capabilities ue_context_p = rrc_gNB_allocate_new_UE_context(rrc); @@ -90,10 +91,10 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_Container if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { LOG_E(RRC, "Failed to decode UE NR capabilities (%zu bytes) container size %lu\n", dec_rval.consumed,ueCapabilityRAT_Container_nr->size); - ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, - ue_context_p->ue_context.UE_Capability_nr); - ue_context_p->ue_context.UE_Capability_nr = 0; - AssertFatal(1==0,"exiting\n"); + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, + ue_context_p->ue_context.UE_Capability_nr); + ue_context_p->ue_context.UE_Capability_nr = 0; + AssertFatal(1==0,"exiting\n"); } } @@ -105,163 +106,160 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_Container ueCapabilityRAT_Container_MRDC->size, 0, 0); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, "Failed to decode UE MRDC capabilities (%zu bytes)\n", dec_rval.consumed); - ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability, - ue_context_p->ue_context.UE_Capability_MRDC); - ue_context_p->ue_context.UE_Capability_MRDC = 0; - AssertFatal(1==0,"exiting\n"); + LOG_E(RRC, "Failed to decode UE MRDC capabilities (%zu bytes)\n", dec_rval.consumed); + ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability, + ue_context_p->ue_context.UE_Capability_MRDC); + ue_context_p->ue_context.UE_Capability_MRDC = 0; + AssertFatal(1==0,"exiting\n"); } } // dump ue_capabilities if ( LOG_DEBUGFLAG(DEBUG_ASN1 && ueCapabilityRAT_Container_nr != NULL) ) { - xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr); - } + xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr); + } if ( LOG_DEBUGFLAG(DEBUG_ASN1 && ueCapabilityRAT_Container_MRDC != NULL) ) { - xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC); - } + xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC); + } + if(cg_config_info && cg_config_info->mcg_RB_Config) { + asn_dec_rval_t dec_rval = uper_decode(NULL, + &asn_DEF_NR_RadioBearerConfig, + (void **)&ue_context_p->ue_context.rb_config, + cg_config_info->mcg_RB_Config->buf, + cg_config_info->mcg_RB_Config->size, 0, 0); + + if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0,"[InterNode] Failed to decode mcg_rb_config (%zu bits), size of OCTET_STRING %lu\n", + dec_rval.consumed, cg_config_info->mcg_RB_Config->size); + } + } + + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)ue_context_p->ue_context.rb_config); rrc_add_nsa_user(rrc,ue_context_p, m); } void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m) { - -// generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) - + // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) rrc_gNB_carrier_data_t *carrier=&rrc->carrier; - MessageDef *msg; msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; protocol_ctxt_t ctxt; - -// NR RRCReconfiguration - + // NR RRCReconfiguration AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n"); - ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t)); ue_context_p->ue_context.secondaryCellGroup = calloc(1,sizeof(NR_CellGroupConfig_t)); - memset((void*)ue_context_p->ue_context.reconfig,0,sizeof(NR_RRCReconfiguration_t)); + memset((void *)ue_context_p->ue_context.reconfig,0,sizeof(NR_RRCReconfiguration_t)); ue_context_p->ue_context.reconfig->rrc_TransactionIdentifier=0; ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t)); ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies; carrier->initial_csi_index[rrc->Nb_ue] = 0; + if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1){ + ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t)); + fill_default_rbconfig(ue_context_p->ue_context.rb_config); + } fill_default_reconfig(carrier->servingcellconfigcommon, - reconfig_ies, - ue_context_p->ue_context.secondaryCellGroup, - carrier->pdsch_AntennaPorts, - carrier->initial_csi_index[rrc->Nb_ue]); - - ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t)); - //NR_CellGroupConfig_t *secondaryCellGroup = ue_context_p->ue_context.secondaryCellGroup; - //secondaryCellGroup->rlc_BearerToAddModList->list.array[0]->rlc_Config - - if(m!=NULL) - fill_default_rbconfig(ue_context_p->ue_context.rb_config, m->e_rabs_tobeadded[0].e_rab_id, m->e_rabs_tobeadded[0].drb_ID); - else - fill_default_rbconfig(ue_context_p->ue_context.rb_config, 5, 1); + reconfig_ies, + ue_context_p->ue_context.secondaryCellGroup, + carrier->pdsch_AntennaPorts, + carrier->initial_csi_index[rrc->Nb_ue]); ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); - memset((void*)CG_Config,0,sizeof(*CG_Config)); + memset((void *)CG_Config,0,sizeof(*CG_Config)); //int CG_Config_size = generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config); generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config); - if(m!=NULL){ - uint8_t inde_list[m->nb_e_rabs_tobeadded]; - memset(inde_list, 0, m->nb_e_rabs_tobeadded*sizeof(uint8_t)); + if(m!=NULL) { + uint8_t inde_list[m->nb_e_rabs_tobeadded]; + memset(inde_list, 0, m->nb_e_rabs_tobeadded*sizeof(uint8_t)); - if (m->nb_e_rabs_tobeadded>0){ - for (int i=0; inb_e_rabs_tobeadded; i++){ - // Add the new E-RABs at the corresponding rrc ue context of the gNB - ue_context_p->ue_context.e_rab[i].param.e_rab_id = m->e_rabs_tobeadded[i].e_rab_id; - ue_context_p->ue_context.e_rab[i].param.gtp_teid = m->e_rabs_tobeadded[i].gtp_teid; - memcpy(&ue_context_p->ue_context.e_rab[i].param.sgw_addr, &m->e_rabs_tobeadded[i].sgw_addr, sizeof(transport_layer_addr_t)); - ue_context_p->ue_context.nb_of_e_rabs++; - //Fill the required E-RAB specific information for the creation of the S1-U tunnel between the gNB and the SGW - create_tunnel_req.eps_bearer_id[i] = ue_context_p->ue_context.e_rab[i].param.e_rab_id; - create_tunnel_req.sgw_S1u_teid[i] = ue_context_p->ue_context.e_rab[i].param.gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[i], &ue_context_p->ue_context.e_rab[i].param.sgw_addr, sizeof(transport_layer_addr_t)); - inde_list[i] = i; - LOG_I(RRC,"S1-U tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\n", - i, - create_tunnel_req.sgw_addr[i].buffer[0], - create_tunnel_req.sgw_addr[i].buffer[1], - create_tunnel_req.sgw_addr[i].buffer[2], - create_tunnel_req.sgw_addr[i].buffer[3], - create_tunnel_req.sgw_addr[i].length, - create_tunnel_req.sgw_S1u_teid[i]); - } - //PM: Is this where we should extract the rnti from? - create_tunnel_req.rnti = ue_context_p->ue_id_rnti; - create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded; - RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p); + if (m->nb_e_rabs_tobeadded>0) { + for (int i=0; inb_e_rabs_tobeadded; i++) { + // Add the new E-RABs at the corresponding rrc ue context of the gNB + ue_context_p->ue_context.e_rab[i].param.e_rab_id = m->e_rabs_tobeadded[i].e_rab_id; + ue_context_p->ue_context.e_rab[i].param.gtp_teid = m->e_rabs_tobeadded[i].gtp_teid; + memcpy(&ue_context_p->ue_context.e_rab[i].param.sgw_addr, &m->e_rabs_tobeadded[i].sgw_addr, sizeof(transport_layer_addr_t)); + ue_context_p->ue_context.nb_of_e_rabs++; + //Fill the required E-RAB specific information for the creation of the S1-U tunnel between the gNB and the SGW + create_tunnel_req.eps_bearer_id[i] = ue_context_p->ue_context.e_rab[i].param.e_rab_id; + create_tunnel_req.sgw_S1u_teid[i] = ue_context_p->ue_context.e_rab[i].param.gtp_teid; + memcpy(&create_tunnel_req.sgw_addr[i], &ue_context_p->ue_context.e_rab[i].param.sgw_addr, sizeof(transport_layer_addr_t)); + inde_list[i] = i; + LOG_I(RRC,"S1-U tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\n", + i, + create_tunnel_req.sgw_addr[i].buffer[0], + create_tunnel_req.sgw_addr[i].buffer[1], + create_tunnel_req.sgw_addr[i].buffer[2], + create_tunnel_req.sgw_addr[i].buffer[3], + create_tunnel_req.sgw_addr[i].length, + create_tunnel_req.sgw_S1u_teid[i]); + } - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id); - gtpv1u_create_s1u_tunnel( - ctxt.instance, - &create_tunnel_req, - &create_tunnel_resp); - rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( - &ctxt, - &create_tunnel_resp, - &inde_list[0]); - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded; - for(int i=0; iue_context.nb_of_e_rabs; i++){ - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].e_rab_id = ue_context_p->ue_context.e_rab[i].param.e_rab_id; - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid = create_tunnel_resp.enb_S1u_teid[i]; - memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr, &create_tunnel_resp.enb_addr, sizeof(transport_layer_addr_t)); + create_tunnel_req.rnti = ue_context_p->ue_id_rnti; + create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded; + RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id); + gtpv1u_create_s1u_tunnel( + ctxt.instance, + &create_tunnel_req, + &create_tunnel_resp); + rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( + &ctxt, + &create_tunnel_resp, + &inde_list[0]); + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded; + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id; - //The length field in the X2AP targetting structure is expected in bits but the create_tunnel_resp returns the address length in bytes - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.length = create_tunnel_resp.enb_addr.length*8; - - LOG_I(RRC,"S1-U create_tunnel_resp tunnel: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", - i, - create_tunnel_resp.enb_addr.buffer[0], - create_tunnel_resp.enb_addr.buffer[1], - create_tunnel_resp.enb_addr.buffer[2], - create_tunnel_resp.enb_addr.buffer[3], - create_tunnel_resp.enb_addr.length, - create_tunnel_resp.enb_S1u_teid[i]); - LOG_I(RRC,"X2AP sGNB Addition Request: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", - i, - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[0], - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[1], - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[2], - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[3], - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.length, - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid); - } - } - else - LOG_W(RRC, "No E-RAB to be added received from SgNB Addition Request message \n"); + for(int i=0; iue_context.nb_of_e_rabs; i++) { + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].e_rab_id = ue_context_p->ue_context.e_rab[i].param.e_rab_id; + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid = create_tunnel_resp.enb_S1u_teid[i]; + memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr, &create_tunnel_resp.enb_addr, sizeof(transport_layer_addr_t)); + //The length field in the X2AP targetting structure is expected in bits but the create_tunnel_resp returns the address length in bytes + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.length = create_tunnel_resp.enb_addr.length*8; + LOG_I(RRC,"S1-U create_tunnel_resp tunnel: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", + i, + create_tunnel_resp.enb_addr.buffer[0], + create_tunnel_resp.enb_addr.buffer[1], + create_tunnel_resp.enb_addr.buffer[2], + create_tunnel_resp.enb_addr.buffer[3], + create_tunnel_resp.enb_addr.length, + create_tunnel_resp.enb_S1u_teid[i]); + LOG_I(RRC,"X2AP sGNB Addition Request: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", + i, + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[0], + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[1], + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[2], + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.buffer[3], + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr.length, + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid); + } + } else + LOG_W(RRC, "No E-RAB to be added received from SgNB Addition Request message \n"); } - //X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = CG_Config_size; //Need to verify correct value for the buffer_size // Send to X2 entity to transport to MeNB asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CG_Config, - NULL, - (void *)CG_Config, - X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer, - 1024); - + NULL, + (void *)CG_Config, + X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer, + 1024); X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3; - itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding - rrc->Nb_ue++; // configure MAC and RLC rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, - NULL, - 1, // add_ue flag - ue_context_p->ue_id_rnti, - ue_context_p->ue_context.secondaryCellGroup); + NULL, + 1, // add_ue flag + ue_context_p->ue_id_rnti, + ue_context_p->ue_context.secondaryCellGroup); nr_rrc_pdcp_config_asn1_req( &ctxt, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 5457835126..42535db1e9 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -49,23 +49,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_CellGroupConfig_t *secondaryCellGroup, - int scg_id, - int servCellIndex, - int n_physical_antenna_ports, - int initial_csi_index) { + NR_CellGroupConfig_t *secondaryCellGroup, + int scg_id, + int servCellIndex, + int n_physical_antenna_ports, + int initial_csi_index) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); - memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); secondaryCellGroup->cellGroupId = scg_id; - NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); - - RLC_BearerConfig->logicalChannelIdentity = 3; + RLC_BearerConfig->logicalChannelIdentity = 4; RLC_BearerConfig->servedRadioBearer = calloc(1,sizeof(*RLC_BearerConfig->servedRadioBearer)); - RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; - + RLC_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; RLC_BearerConfig->servedRadioBearer->choice.drb_Identity=1; RLC_BearerConfig->reestablishRLC=calloc(1,sizeof(*RLC_BearerConfig->reestablishRLC)); *RLC_BearerConfig->reestablishRLC=NR_RLC_BearerConfig__reestablishRLC_true; @@ -85,17 +81,15 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco /*RLC_BearerConfig->rlc_Config->present = NR_RLC_Config_PR_am; RLC_BearerConfig->rlc_Config->choice.am = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am)); RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength)); - *RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; + *RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45; RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64; RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB500; RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t32; - RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength)); *RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18; RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms15; RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms15;*/ - RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig)); RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters)); RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority = 1; @@ -111,10 +105,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = false; RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false; RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULL; - secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); - secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig)); secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL; secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = NULL; @@ -138,25 +130,20 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->dummy=false; secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false; secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real; - secondaryCellGroup->mac_CellGroupConfig->skipUplinkTxDynamic=false; secondaryCellGroup->mac_CellGroupConfig->ext1 = NULL; - - secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig)); - secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH=NULL; secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH=NULL; secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1)); *secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=20; - secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook=NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; + secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook=NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; secondaryCellGroup->physicalCellGroupConfig->tpc_SRS_RNTI=NULL; secondaryCellGroup->physicalCellGroupConfig->tpc_PUCCH_RNTI=NULL; secondaryCellGroup->physicalCellGroupConfig->tpc_PUSCH_RNTI=NULL; secondaryCellGroup->physicalCellGroupConfig->sp_CSI_RNTI=NULL; secondaryCellGroup->physicalCellGroupConfig->cs_RNTI=NULL; secondaryCellGroup->physicalCellGroupConfig->ext1=NULL; - secondaryCellGroup->spCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig)); secondaryCellGroup->spCellConfig->servCellIndex = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->servCellIndex)); *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex; @@ -166,7 +153,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL; secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL; - /* contention free ra */ secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; @@ -174,7 +160,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); - memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); + memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, + &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); //secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); //*secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= NULL; @@ -186,7 +173,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ssbElem->ra_PreambleIndex= 63; ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem); secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup)); @@ -195,21 +181,18 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311_v1530 = NR_RLF_TimersAndConstants__ext1__t311_v1530_ms30000; - secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - - - secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup = calloc(1, + sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1, + sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); @@ -584,6 +567,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; @@ -2026,15 +2010,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_RRCReconfiguration_IEs_t *reconfig, - NR_CellGroupConfig_t *secondaryCellGroup, - int n_physical_antenna_ports, - int initial_csi_index) { - + NR_RRCReconfiguration_IEs_t *reconfig, + NR_CellGroupConfig_t *secondaryCellGroup, + int n_physical_antenna_ports, + int initial_csi_index) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); - // radioBearerConfig reconfig->radioBearerConfig=NULL; // secondaryCellGroup @@ -2044,12 +2026,10 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon char scg_buffer[1024]; asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)secondaryCellGroup, scg_buffer, 1024); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded); - - reconfig->secondaryCellGroup = calloc(1,sizeof(*reconfig->secondaryCellGroup)); OCTET_STRING_fromBuf(reconfig->secondaryCellGroup, - (const char*)scg_buffer, - (enc_rval.encoded+7)>>3); + (const char *)scg_buffer, + (enc_rval.encoded+7)>>3); // measConfig reconfig->measConfig=NULL; // lateNonCriticalExtension @@ -2058,7 +2038,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon reconfig->nonCriticalExtension = NULL; } -void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, long eps_BearerIdentity, long drb_Identity) { +void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig) { rbconfig->srb_ToAddModList = NULL; rbconfig->srb3_ToRelease = NULL; @@ -2066,8 +2046,8 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, long eps_BearerIden NR_DRB_ToAddMod_t *drb_ToAddMod = calloc(1,sizeof(*drb_ToAddMod)); drb_ToAddMod->cnAssociation = calloc(1,sizeof(*drb_ToAddMod->cnAssociation)); drb_ToAddMod->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity; - drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity= eps_BearerIdentity; //5; - drb_ToAddMod->drb_Identity = drb_Identity; + drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity= 5; + drb_ToAddMod->drb_Identity = 1; drb_ToAddMod->reestablishPDCP = NULL; drb_ToAddMod->recoverPDCP = NULL; drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config)); @@ -2081,15 +2061,15 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, long eps_BearerIden drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed; drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0; - drb_ToAddMod->pdcp_Config->drb->integrityProtection=NULL; - drb_ToAddMod->pdcp_Config->drb->statusReportRequired=NULL; + drb_ToAddMod->pdcp_Config->drb->integrityProtection=NULL; + drb_ToAddMod->pdcp_Config->drb->statusReportRequired=NULL; drb_ToAddMod->pdcp_Config->drb->outOfOrderDelivery=NULL; drb_ToAddMod->pdcp_Config->moreThanOneRLC = NULL; drb_ToAddMod->pdcp_Config->t_Reordering = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->t_Reordering)); *drb_ToAddMod->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0; drb_ToAddMod->pdcp_Config->ext1 = NULL; - + ASN_SEQUENCE_ADD(&rbconfig->drb_ToAddModList->list,drb_ToAddMod); rbconfig->drb_ToReleaseList = NULL; @@ -2103,4 +2083,5 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, long eps_BearerIden xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); } + #endif diff --git a/openair2/UTIL/OCG/OCG_if.h b/openair2/UTIL/OCG/OCG_if.h index c515d9746d..cc55b56f36 100644 --- a/openair2/UTIL/OCG/OCG_if.h +++ b/openair2/UTIL/OCG/OCG_if.h @@ -30,8 +30,8 @@ * \warning */ -#ifndef __CONFIGEN_IF_H__ -#define __CONFIG_IF_H__ +#ifndef __UTIL_OCG_OCG_IF__H__ +#define __UTIL_OCG_OCG_IF__H__ #ifdef __cplusplus extern "C" { diff --git a/openair2/UTIL/OPT/mac_pcap.h b/openair2/UTIL/OPT/mac_pcap.h index 48b31bb3c0..3141d17d59 100644 --- a/openair2/UTIL/OPT/mac_pcap.h +++ b/openair2/UTIL/OPT/mac_pcap.h @@ -1,3 +1,6 @@ +#ifndef __UTIL_OPT_MAC_PCAP__H__ +#define __UTIL_OPT_MAC_PCAP__H__ + #include #include #include @@ -42,4 +45,4 @@ typedef struct MAC_Context_Info_t { unsigned int subframesSinceCaptureStart; } MAC_Context_Info_t; - +#endif diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h index 86f1a045d8..6861e09cb1 100644 --- a/openair2/UTIL/OPT/opt.h +++ b/openair2/UTIL/OPT/opt.h @@ -88,16 +88,12 @@ typedef guint8 gboolean; { .s5= {NULL }} , \ } -#ifdef OCP_FRAMEWORK -#include -#else typedef enum trace_mode_e { OPT_WIRESHARK, OPT_PCAP, OPT_TSHARK, OPT_NONE } trace_mode_t; -#endif typedef enum radio_type_e { RADIO_TYPE_FDD = 1, diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h index 4dfbe7912e..2d36e02df4 100644 --- a/openair2/UTIL/OPT/packet-mac-lte.h +++ b/openair2/UTIL/OPT/packet-mac-lte.h @@ -22,6 +22,8 @@ modified to be used in OpenAir to create the LTE MAC/RLC encapsulated in UDP as per Wireshark feature */ +#ifndef __UTIL_OPT_PACKET_MAC_LTE__H__ +#define __UTIL_OPT_PACKET_MAC_LTE__H__ #include "ws_symbol_export.h" @@ -376,3 +378,5 @@ typedef enum { * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */ + +#endif diff --git a/openair2/UTIL/OSA/osa_defs.h b/openair2/UTIL/OSA/osa_defs.h index 4812d82d91..3df350541f 100644 --- a/openair2/UTIL/OSA/osa_defs.h +++ b/openair2/UTIL/OSA/osa_defs.h @@ -29,8 +29,8 @@ * @ingroup security */ -#ifndef SECU_DEFS_H_ -#define SECU_DEFS_H_ +#ifndef __UTIL_OSA_OSA_DEFS__H__ +#define __UTIL_OSA_OSA_DEFS__H__ #define EIA0_ALG_ID 0x00 #define EIA1_128_ALG_ID 0x01 @@ -115,4 +115,4 @@ int stream_decrypt(uint8_t algorithm, stream_cipher_t *stream_cipher, uint8_t ** int stream_check_integrity(uint8_t algorithm, stream_cipher_t *stream_cipher, uint8_t *expected); #undef SECU_DEBUG -#endif /* SECU_DEFS_H_ */ +#endif /* __UTIL_OSA_OSA_DEFS__H__ */ diff --git a/openair2/UTIL/OTG/traffic_config.h b/openair2/UTIL/OTG/traffic_config.h index 2f47682706..c0a64a3465 100644 --- a/openair2/UTIL/OTG/traffic_config.h +++ b/openair2/UTIL/OTG/traffic_config.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef __UTIL_OTG_TRAFFIC_CONFIG__H__ +#define __UTIL_OTG_TRAFFIC_CONFIG__H__ + //IDT DISTRIBUTION PARAMETERS #define IDT_DIST GAUSSIAN #define IDT_MIN 2 @@ -40,3 +43,5 @@ //SOCKET MODE #define DST_PORT 1234; #define DST_IP "127.0.0.1" + +#endif diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index debe5e0712..6a037b8ee3 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -359,7 +359,7 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf( * Failure means multi_sd < 0. */ if (instance->multi_sd < 0) { - X2AP_ERROR("Error: be sure to properly configure X22 in your configuration file.\n"); + X2AP_ERROR("Error: be sure to properly configure X2 in your configuration file.\n"); DevAssert(instance->multi_sd >= 0); } @@ -454,10 +454,12 @@ void x2ap_eNB_handle_sgNB_add_req(instance_t instance, x2ap_eNB_instance_t *instance_p; x2ap_eNB_data_t *x2ap_eNB_data; int ue_id; - - /* TODO: remove hardcoded value */ - x2ap_eNB_data = x2ap_is_eNB_id_in_list(3584); + LTE_PhysCellId_t target_pci; + target_pci = x2ap_ENDC_sgnb_addition_req->target_physCellId; + x2ap_eNB_data = x2ap_is_eNB_pci_in_list(target_pci); DevAssert(x2ap_eNB_data != NULL); + DevAssert(x2ap_ENDC_sgnb_addition_req != NULL); + instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); @@ -474,7 +476,8 @@ void x2ap_eNB_handle_sgNB_add_req(instance_t instance, x2ap_set_ids(id_manager, ue_id, x2ap_ENDC_sgnb_addition_req->rnti, ue_id, -1); x2ap_id_set_state(id_manager, ue_id, X2ID_STATE_NSA_PREPARE); - x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_ENDC_sgnb_addition_req, x2ap_eNB_data, ue_id); + x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_ENDC_sgnb_addition_req, + x2ap_eNB_data, ue_id); } static @@ -489,16 +492,31 @@ void x2ap_gNB_trigger_sgNB_add_req_ack(instance_t instance, * as far as I understand.. CROUX */ - + x2ap_id_manager *id_manager; x2ap_eNB_instance_t *instance_p; x2ap_eNB_data_t *target; - /*int source_assoc_id = x2ap_ENDC_sgnb_addition_req_ACK->source_assoc_id; int ue_id; + /*int source_assoc_id = x2ap_ENDC_sgnb_addition_req_ACK->source_assoc_id; int id_source; int id_target;*/ instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); + target = x2ap_get_eNB(NULL,x2ap_ENDC_sgnb_addition_req_ACK->target_assoc_id, 0); + DevAssert(target != NULL); + + /* allocate x2ap ID */ + id_manager = &instance_p->id_manager; + ue_id = x2ap_allocate_new_id(id_manager); + if (ue_id == -1) { + X2AP_ERROR("could not allocate a new X2AP UE ID\n"); + exit(1); + } + /* id_source is ue_id, id_target is unknown yet */ + x2ap_set_ids(id_manager, ue_id, x2ap_ENDC_sgnb_addition_req_ACK->rnti, ue_id, + x2ap_ENDC_sgnb_addition_req_ACK->MeNB_ue_x2_id); + x2ap_id_set_state(id_manager, ue_id, X2ID_STATE_SOURCE_OVERALL); + /*target = x2ap_get_eNB(NULL, source_assoc_id, 0); DevAssert(target != NULL);*/ @@ -511,10 +529,36 @@ void x2ap_gNB_trigger_sgNB_add_req_ack(instance_t instance, x2ap_set_ids(&instance_p->id_manager, ue_id, x2ap_handover_req_ack->rnti, id_source, id_target);*/ - //target = x2ap_get_eNB(NULL, 17, 0); - target = x2ap_is_eNB_id_in_list (3585); //Currently hardcoded. Need to extract it differently + x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK(instance_p, target, + x2ap_ENDC_sgnb_addition_req_ACK, ue_id); +} + +/** + * @fn : Function triggers sgnb reconfiguration complete + * @param : IN instance, IN x2ap_reconf_complete +**/ +static +void x2ap_eNB_trigger_sgnb_reconfiguration_complete(instance_t instance, + x2ap_ENDC_reconf_complete_t *x2ap_reconf_complete) +{ + x2ap_eNB_instance_t *instance_p = NULL; + x2ap_eNB_data_t *target = NULL; + int id_source = -1; + int id_target = -1; + LTE_PhysCellId_t target_pci; + + instance_p = x2ap_eNB_get_instance(instance); + DevAssert(instance_p != NULL); + DevAssert(x2ap_reconf_complete != NULL); + + target_pci = x2ap_reconf_complete->target_physCellId; + target = x2ap_is_eNB_pci_in_list(target_pci); DevAssert(target != NULL); - x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK(instance_p, target, x2ap_ENDC_sgnb_addition_req_ACK, 0); + + id_source = x2ap_reconf_complete->MeNB_ue_x2_id; + id_target = x2ap_reconf_complete->SgNB_ue_x2_id; + x2ap_eNB_generate_ENDC_x2_SgNB_reconfiguration_complete(instance_p, target, id_source, id_target); + } @@ -594,6 +638,10 @@ void *x2ap_task(void *arg) { LOG_I(X2AP, "Received elements for X2AP_ENDC_SGNB_ADDITION_REQ_ACK \n"); break; + case X2AP_ENDC_SGNB_RECONF_COMPLETE: + x2ap_eNB_trigger_sgnb_reconfiguration_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &X2AP_ENDC_SGNB_RECONF_COMPLETE(received_msg)); + break; case SCTP_INIT_MSG_MULTI_CNF: x2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); diff --git a/openair2/X2AP/x2ap_eNB_decoder.c b/openair2/X2AP/x2ap_eNB_decoder.c index 93b82c2765..3762bc06dc 100644 --- a/openair2/X2AP/x2ap_eNB_decoder.c +++ b/openair2/X2AP/x2ap_eNB_decoder.c @@ -144,9 +144,9 @@ int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint3 length, 0, 0); - //if (asn1_xer_print) { + if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, pdu); - //} + } if (dec_ret.code != RC_OK) { X2AP_ERROR("Failed to decode pdu\n"); diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index 1f50801ccc..a96fa14f48 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -1496,7 +1496,8 @@ int x2ap_eNB_generate_ENDC_x2_setup_response( } int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( - x2ap_eNB_instance_t *instance_p, x2ap_ENDC_sgnb_addition_req_t *x2ap_ENDC_sgnb_addition_req, x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id) + x2ap_eNB_instance_t *instance_p, x2ap_ENDC_sgnb_addition_req_t *x2ap_ENDC_sgnb_addition_req, + x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id) { X2AP_X2AP_PDU_t pdu; X2AP_SgNBAdditionRequest_t *out; @@ -1507,42 +1508,21 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( uint8_t *buffer; uint32_t len; int ret = 0; - - // Currently hardcoded (dummy) values filling the fields of SgNB_addition_request message. To be substituted - // with values coming from RRC. - uint16_t nRencryptionAlgorithms = 0; - uint16_t nRintegrityProtectionAlgorithms = 0; + uint16_t nRencryptionAlgorithms = x2ap_ENDC_sgnb_addition_req->security_capabilities.encryption_algorithms; + uint16_t nRintegrityProtectionAlgorithms = x2ap_ENDC_sgnb_addition_req->security_capabilities + .integrity_algorithms; uint8_t SgNBSecurityKey[32] = { 0 }; - int uEaggregateMaximumBitRateDownlink = 100000000; - int uEaggregateMaximumBitRateUplink = 100000000; - int e_rabs_tobeadded = 1; + int uEaggregateMaximumBitRateDownlink = x2ap_ENDC_sgnb_addition_req->ue_ambr.br_dl; + int uEaggregateMaximumBitRateUplink = x2ap_ENDC_sgnb_addition_req->ue_ambr.br_ul; + int e_rabs_tobeadded = x2ap_ENDC_sgnb_addition_req->nb_e_rabs_tobeadded; long int pDCPatSgNB = X2AP_EN_DC_ResourceConfiguration__pDCPatSgNB_present; long int mCGresources = X2AP_EN_DC_ResourceConfiguration__mCGresources_not_present; long int sCGresources = X2AP_EN_DC_ResourceConfiguration__sCGresources_not_present; - long qCI = 1; - X2AP_Pre_emptionCapability_t pre_emptionCapability = X2AP_Pre_emptionCapability_shall_not_trigger_pre_emption; - X2AP_Pre_emptionVulnerability_t pre_emptionVulnerability = X2AP_Pre_emptionVulnerability_not_pre_emptable; - priority_level_t priority_level = PRIORITY_LEVEL_NO_PRIORITY; - e_rab_tobe_added_t e_MCG_rabs_tobeadded; - e_MCG_rabs_tobeadded.gtp_teid = 0; - e_MCG_rabs_tobeadded.sgw_addr.length = 24; - uint8_t buf[20] = { 0 }; - memcpy(e_MCG_rabs_tobeadded.sgw_addr.buffer, buf, 20*sizeof(uint8_t)); - - FILE *fd; - fd = fopen("../../../executables/uecap.raw","r"); - if (fd != NULL) { - OCTET_STRING_t CG_Config_Info; - CG_Config_Info.size = 4096; - CG_Config_Info.buf = (uint8_t *)calloc(4096, sizeof(uint8_t)); - int msg_len=fread(CG_Config_Info.buf,1,CG_Config_Info.size,fd); - CG_Config_Info.size = msg_len; - - /*char buffer[4096]; - int msg_len=fread(buffer,1,4096,fd);*/ - LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len); - - + long qCI = 0; + X2AP_Pre_emptionCapability_t pre_emptionCapability; + X2AP_Pre_emptionVulnerability_t pre_emptionVulnerability; + priority_level_t priority_level; + memcpy(SgNBSecurityKey, x2ap_ENDC_sgnb_addition_req->kgnb, sizeof(x2ap_ENDC_sgnb_addition_req->kgnb)); /*OCTET_STRING_t CG_Config_Info; CG_Config_Info.size = 4096; CG_Config_Info.buf = (uint8_t *)calloc(4096, sizeof(uint8_t));*/ @@ -1618,7 +1598,11 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( e_RABS_ToBeAdded_SgNBAddReq_Item->en_DC_ResourceConfiguration.mCGresources = mCGresources; e_RABS_ToBeAdded_SgNBAddReq_Item->en_DC_ResourceConfiguration.sCGresources = sCGresources; if (pDCPatSgNB == X2AP_EN_DC_ResourceConfiguration__pDCPatSgNB_present){ - e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.present = X2AP_E_RABs_ToBeAdded_SgNBAddReq_Item__resource_configuration_PR_sgNBPDCPpresent; + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.present = X2AP_E_RABs_ToBeAdded_SgNBAddReq_Item__resource_configuration_PR_sgNBPDCPpresent; + qCI = x2ap_ENDC_sgnb_addition_req->e_rab_param[i].qos.qci; + priority_level = x2ap_ENDC_sgnb_addition_req->e_rab_param[i].qos.allocation_retention_priority.priority_level; + pre_emptionCapability = x2ap_ENDC_sgnb_addition_req->e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability; + pre_emptionVulnerability = x2ap_ENDC_sgnb_addition_req->e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability; e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.qCI = qCI; e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability = pre_emptionCapability; @@ -1646,25 +1630,24 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( ie->id = X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer; ie->criticality = X2AP_Criticality_reject; ie->value.present = X2AP_SgNBAdditionRequest_IEs__value_PR_MeNBtoSgNBContainer; - ie->value.choice.MeNBtoSgNBContainer.buf = (uint8_t *)calloc(CG_Config_Info.size, sizeof(uint8_t)); - memcpy(ie->value.choice.MeNBtoSgNBContainer.buf, CG_Config_Info.buf, CG_Config_Info.size); - ie->value.choice.MeNBtoSgNBContainer.size = CG_Config_Info.size; //4096; + if(NULL == (ie->value.choice.MeNBtoSgNBContainer.buf = (uint8_t *) + calloc(x2ap_ENDC_sgnb_addition_req->rrc_buffer_size, sizeof(uint8_t)))) { + X2AP_ERROR("Memory ALLocation failed\n"); + exit(1); + } + memcpy(ie->value.choice.MeNBtoSgNBContainer.buf, x2ap_ENDC_sgnb_addition_req->rrc_buffer, + x2ap_ENDC_sgnb_addition_req->rrc_buffer_size); + ie->value.choice.MeNBtoSgNBContainer.size = x2ap_ENDC_sgnb_addition_req->rrc_buffer_size; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { X2AP_ERROR("Failed to encode ENDC X2 SgNB_addition request message\n"); return -1; } - + free(ie->value.choice.MeNBtoSgNBContainer.buf); MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); - fclose(fd); - } - else { - LOG_I(RRC, "uecap.raw file could not be opened... \n"); - return -1; - } return ret; @@ -1684,27 +1667,14 @@ int x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *in uint8_t *buffer; uint32_t len; int ret = 0; - int MeNB_UE_X2AP_id = ue_id; - int SgNB_UE_X2AP_id = 0; - // Currently hardcoded (dummy) values filling the fields of SgNB_addition_request message. To be substituted - // with values coming from RRC. - - //uint16_t nRencryptionAlgorithms = 0; - //uint16_t nRintegrityProtectionAlgorithms = 0; - //uint8_t SgNBSecurityKey[32] = { 0 }; - //int uEaggregateMaximumBitRateDownlink = 100000000; - //int uEaggregateMaximumBitRateUplink = 100000000; - - int e_rabs_admitted_tobeadded = 1; + int MeNB_UE_X2AP_id = x2ap_sgnb_addition_req_ACK->MeNB_ue_x2_id; + int SgNB_UE_X2AP_id = ue_id; + int e_rabs_admitted_tobeadded = x2ap_sgnb_addition_req_ACK->nb_e_rabs_admitted_tobeadded; long int pDCPatSgNB = X2AP_EN_DC_ResourceConfiguration__pDCPatSgNB_present; long int mCGresources = X2AP_EN_DC_ResourceConfiguration__mCGresources_not_present; long int sCGresources = X2AP_EN_DC_ResourceConfiguration__sCGresources_not_present; - e_rab_setup_t e_SCG_rabs_tobeadded; - e_SCG_rabs_tobeadded.gtp_teid = 0; - e_SCG_rabs_tobeadded.eNB_addr.length = 24; - uint8_t buf[20] = { 0 }; - memcpy(e_SCG_rabs_tobeadded.eNB_addr.buffer, buf, 20*sizeof(uint8_t)); + DevAssert(instance_p != NULL); DevAssert(x2ap_eNB_data_p != NULL); diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 792982100b..1c6c98cd81 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -1652,7 +1652,6 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, x2ap_eNB_instance_t *instance_p; x2ap_eNB_data_t *x2ap_eNB_data; MessageDef *msg; - int ue_id; DevAssert (pdu != NULL); x2SgNBAdditionRequest = &pdu->choice.initiatingMessage.value.choice.SgNBAdditionRequest; @@ -1683,20 +1682,9 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); return -1; } - - - // allocate a new X2AP UE ID - ue_id = x2ap_allocate_new_id(&instance_p->id_manager); - if (ue_id == -1) { - X2AP_ERROR("could not allocate a new X2AP UE ID\n"); - // TODO: cancel handover: send HO preparation failure to source eNB - exit(1); - } - // rnti is unknown yet, must not be set to -1, 0 is fine - x2ap_set_ids(&instance_p->id_manager, ue_id, 0, ie->value.choice.UE_X2AP_ID, ue_id); - x2ap_id_set_state(&instance_p->id_manager, ue_id, X2ID_STATE_TARGET); - - X2AP_ENDC_SGNB_ADDITION_REQ(msg).ue_x2_id = ue_id; + /* ue_x2_id = MeNB X2AP Id */ + X2AP_ENDC_SGNB_ADDITION_REQ(msg).ue_x2_id = ie->value.choice.UE_X2AP_ID; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_assoc_id = assoc_id; /* X2AP_ProtocolIE_ID_id_NRUESecurityCapabilities */ diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.h b/openair2/X2AP/x2ap_eNB_management_procedures.h index c5217341c5..7082f5ac95 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.h +++ b/openair2/X2AP/x2ap_eNB_management_procedures.h @@ -26,8 +26,8 @@ * \version 1.0 */ -#ifndef X2AP_ENB_MANAGEMENT_PROCEDURES_H_ -#define X2AP_ENB_MANAGEMENT_PROCEDURES_H +#ifndef __X2AP_ENB_MANAGEMENT_PROCEDURES__H__ +#define __X2AP_ENB_MANAGEMENT_PROCEDURES__H__ void x2ap_eNB_prepare_internal_data(void); @@ -51,4 +51,4 @@ struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -#endif /* X2AP_ENB_MANAGEMENT_PROCEDURES_H_ */ +#endif /* __X2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c index 1a75214d65..f13bf13794 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ b/openair3/GTPV1-U/gtpv1u_gNB.c @@ -129,14 +129,14 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req( case NW_GTPV1U_ULP_API_RECV_TPDU: { uint8_t buffer[4096]; uint32_t buffer_len; - uint16_t msgType = NW_GTP_GPDU; - NwGtpv1uMsgT *pMsg = NULL; + //uint16_t msgType = NW_GTP_GPDU; + //NwGtpv1uMsgT *pMsg = NULL; /* Nw-gptv1u stack has processed a PDU. we can schedule it to PDCP * for transmission. */ teid = pUlpApi->apiInfo.recvMsgInfo.teid; - pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg; - msgType = pMsg->msgType; + //pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg; + //msgType = pMsg->msgType; if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, buffer, &buffer_len)) { diff --git a/openair3/M3AP/m3ap_MCE_generate_messages.h b/openair3/M3AP/m3ap_MCE_generate_messages.h index 0884e8216e..1a5733acc3 100644 --- a/openair3/M3AP/m3ap_MCE_generate_messages.h +++ b/openair3/M3AP/m3ap_MCE_generate_messages.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M2AP_ENB_GENERATE_MESSAGES_H_ -#define M2AP_ENB_GENERATE_MESSAGES_H_ +#ifndef __M3AP_MCE_GENERATE_MESSAGES__H__ +#define __M3AP_MCE_GENERATE_MESSAGES__H__ #include "m2ap_eNB_defs.h" #include "m2ap_common.h" @@ -37,27 +37,8 @@ int m2ap_eNB_generate_m2_setup_request(m2ap_eNB_instance_t *instance_p, int m2ap_MCE_generate_m2_setup_response(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p); -/*int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, - M2AP_Cause_PR cause_type, - long cause_value, - long time_to_wait);*/ - int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, M2AP_Cause_PR cause_type, long cause_value); -//int m2ap_eNB_generate_m2_handover_request (m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p, -// m2ap_handover_req_t *m2ap_handover_req, int ue_id); -// -//int m2ap_eNB_generate_m2_handover_request_ack (m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p, -// m2ap_handover_req_ack_t *m2ap_handover_req_ack); -// -//int m2ap_eNB_generate_m2_ue_context_release (m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p, -// m2ap_ue_context_release_t *m2ap_ue_context_release); -// -//int m2ap_eNB_generate_m2_handover_cancel (m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p, -// int m2_ue_id, -// m2ap_handover_cancel_cause_t cause); - -#endif /* M2AP_ENB_GENERATE_MESSAGES_H_ */ +#endif /* __M3AP_MCE_GENERATE_MESSAGES__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_handler.h b/openair3/M3AP/m3ap_MCE_handler.h index ce4997e80d..09eca351b6 100644 --- a/openair3/M3AP/m3ap_MCE_handler.h +++ b/openair3/M3AP/m3ap_MCE_handler.h @@ -19,15 +19,15 @@ * contact@openairinterface.org */ -/*! \file m2ap_handler.h - * \brief m2ap handler procedures for eNB +/*! \file m3ap_handler.h + * \brief m3ap handler procedures for eNB * \author Javier Morgade * \date 2019 * \version 0.1 */ -#ifndef M2AP_MCE_HANDLERS_H_ -#define M2AP_MCE_HANDLERS_H_ +#ifndef __M3AP_MCE_HANDLER__H__ +#define __M3AP_MCE_HANDLER__H__ #include "m2ap_MCE_defs.h" @@ -40,4 +40,4 @@ int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre const uint8_t * const data, const uint32_t data_length); -#endif /* M2AP_MCE_HANDLERS_H_ */ +#endif /* __M3AP_MCE_HANDLER__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.h b/openair3/M3AP/m3ap_MCE_management_procedures.h index 2d18df8c26..27e8c928a0 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.h +++ b/openair3/M3AP/m3ap_MCE_management_procedures.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M3AP_MCE_MANAGEMENT_PROCEDURES_H_ -#define M3AP_MCE_MANAGEMENT_PROCEDURES_H +#ifndef __M3AP_MCE_MANAGEMENT_PROCEDURES__H__ +#define __M3AP_MCE_MANAGEMENT_PROCEDURES__H__ void m3ap_MCE_prepare_internal_data(void); @@ -50,4 +50,4 @@ struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -#endif /* M3AP_MCE_MANAGEMENT_PROCEDURES_H_ */ +#endif /* __M3AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_MME_generate_messages.h b/openair3/M3AP/m3ap_MME_generate_messages.h index 1632dc807a..146f58825a 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.h +++ b/openair3/M3AP/m3ap_MME_generate_messages.h @@ -19,15 +19,15 @@ * contact@openairinterface.org */ -/*! \file m2ap_MCE_generate_messages.h - * \brief m2ap procedures for MCE +/*! \file m3ap_MCE_generate_messages.h + * \brief m3ap procedures for MCE * \author Javier Morgade * \date 2019 * \version 0.1 */ -#ifndef M2AP_MCE_GENERATE_MESSAGES_H_ -#define M2AP_MCE_GENERATE_MESSAGES_H_ +#ifndef M3AP_MCE_GENERATE_MESSAGES_H_ +#define M3AP_MCE_GENERATE_MESSAGES_H_ #include "m2ap_MCE_defs.h" #include "m2ap_common.h" diff --git a/openair3/M3AP/m3ap_MME_management_procedures.h b/openair3/M3AP/m3ap_MME_management_procedures.h index e966ee1f17..b21189b915 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.h +++ b/openair3/M3AP/m3ap_MME_management_procedures.h @@ -26,8 +26,8 @@ * \version 0.1 */ -#ifndef M3AP_MME_MANAGEMENT_PROCEDURES_H_ -#define M3AP_MME_MANAGEMENT_PROCEDURES_H +#ifndef __M3AP_MME_MANAGEMENT_PROCEDURES__H__ +#define __M3AP_MME_MANAGEMENT_PROCEDURES__H__ void m3ap_MME_prepare_internal_data(void); @@ -51,4 +51,4 @@ struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -#endif /* M3AP_MME_MANAGEMENT_PROCEDURES_H_ */ +#endif /* __M3AP_MME_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/MME_APP/enb_paramdef_mme.h b/openair3/MME_APP/enb_paramdef_mme.h index 3d65036553..127c1855e7 100644 --- a/openair3/MME_APP/enb_paramdef_mme.h +++ b/openair3/MME_APP/enb_paramdef_mme.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __MME_APP_ENB_PARAMDEF_MME__H__ +#define __MME_APP_ENB_PARAMDEF_MME__H__ + #include "common/config/config_paramdesc.h" #include "RRC_paramsvalues.h" @@ -172,3 +175,4 @@ typedef struct ccparams_MME_s { { .s5= {NULL }} \ } +#endif diff --git a/openair3/MME_APP/mme_config.h b/openair3/MME_APP/mme_config.h index 4371ad55f6..2eb0a66e85 100644 --- a/openair3/MME_APP/mme_config.h +++ b/openair3/MME_APP/mme_config.h @@ -26,8 +26,9 @@ EMAIL : javier.morgade@ieee.org */ -#ifndef MME_CONFIG_H_ -#define MME_CONFIG_H_ +#ifndef __MME_APP_MME_CONFIG__H__ +#define __MME_APP_MME_CONFIG__H__ + #include #include #include @@ -48,5 +49,5 @@ int RCconfig_MME(void); -#endif /* MME_CONFIG_H_ */ +#endif /* __MME_APP_MME_CONFIG__H__ */ /** @} */ diff --git a/openair3/NAS/COMMON/API/NETWORK/as_message.h b/openair3/NAS/COMMON/API/NETWORK/as_message.h deleted file mode 100644 index 30810a325e..0000000000 --- a/openair3/NAS/COMMON/API/NETWORK/as_message.h +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ - - -/***************************************************************************** - -Source as_message.h - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the messages supported by the Access Stratum sublayer - protocol (usually RRC and S1AP for E-UTRAN) and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __AS_MESSAGE_H__ -#define __AS_MESSAGE_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Access Stratum message types - * -------------------------------------------------------------------------- - */ -#define AS_REQUEST 0x0100 -#define AS_RESPONSE 0x0200 -#define AS_INDICATION 0x0400 -#define AS_CONFIRM 0x0800 - -/* - * -------------------------------------------------------------------------- - * Access Stratum message identifiers - * -------------------------------------------------------------------------- - */ - -/* Broadcast information */ -#define AS_BROADCAST_INFO 0x01 -#define AS_BROADCAST_INFO_IND (AS_BROADCAST_INFO | AS_INDICATION) - -/* Cell information relevant for cell selection processing */ -#define AS_CELL_INFO 0x02 -#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST) -#define AS_CELL_INFO_CNF (AS_CELL_INFO | AS_CONFIRM) -#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION) - -/* Paging information */ -#define AS_PAGING 0x03 -#define AS_PAGING_REQ (AS_PAGING | AS_REQUEST) -#define AS_PAGING_IND (AS_PAGING | AS_INDICATION) - -/* NAS signalling connection establishment */ -#define AS_NAS_ESTABLISH 0x04 -#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST) -#define AS_NAS_ESTABLISH_IND (AS_NAS_ESTABLISH | AS_INDICATION) -#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE) -#define AS_NAS_ESTABLISH_CNF (AS_NAS_ESTABLISH | AS_CONFIRM) - -/* NAS signalling connection release */ -#define AS_NAS_RELEASE 0x05 -#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST) -#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION) - -/* Uplink information transfer */ -#define AS_UL_INFO_TRANSFER 0x06 -#define AS_UL_INFO_TRANSFER_REQ (AS_UL_INFO_TRANSFER | AS_REQUEST) -#define AS_UL_INFO_TRANSFER_CNF (AS_UL_INFO_TRANSFER | AS_CONFIRM) -#define AS_UL_INFO_TRANSFER_IND (AS_UL_INFO_TRANSFER | AS_INDICATION) - -/* Downlink information transfer */ -#define AS_DL_INFO_TRANSFER 0x07 -#define AS_DL_INFO_TRANSFER_REQ (AS_DL_INFO_TRANSFER | AS_REQUEST) -#define AS_DL_INFO_TRANSFER_CNF (AS_DL_INFO_TRANSFER | AS_CONFIRM) -#define AS_DL_INFO_TRANSFER_IND (AS_DL_INFO_TRANSFER | AS_INDICATION) - -/* Radio Access Bearer establishment */ -#define AS_RAB_ESTABLISH 0x08 -#define AS_RAB_ESTABLISH_REQ (AS_RAB_ESTABLISH | AS_REQUEST) -#define AS_RAB_ESTABLISH_IND (AS_RAB_ESTABLISH | AS_INDICATION) -#define AS_RAB_ESTABLISH_RSP (AS_RAB_ESTABLISH | AS_RESPONSE) -#define AS_RAB_ESTABLISH_CNF (AS_RAB_ESTABLISH | AS_CONFIRM) - -/* Radio Access Bearer release */ -#define AS_RAB_RELEASE 0x09 -#define AS_RAB_RELEASE_REQ (AS_RAB_RELEASE | AS_REQUEST) -#define AS_RAB_RELEASE_IND (AS_RAB_RELEASE | AS_INDICATION) - -/* NAS Cause */ -#define EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED (8) -#define EPS_SERVICES_NOT_ALLOWED (7) -#define PLMN_NOT_ALLOWED (11) -#define TRACKING_AREA_NOT_ALLOWED (12) -#define ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA (13) -#define EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN (14) -#define NO_SUITABLE_CELLS_IN_TRACKING_AREA (15) -#define NETWORK_FAILURE (17) -#define ESM_FAILURE (19) - -typedef enum nas_cause_s { - NAS_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, - NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_NOT_ALLOWED, - NAS_CAUSE_PLMN_NOT_ALLOWED = PLMN_NOT_ALLOWED, - NAS_CAUSE_TRACKING_AREA_NOT_ALLOWED = TRACKING_AREA_NOT_ALLOWED, - NAS_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA = ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA, - NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN, - NAS_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA = NO_SUITABLE_CELLS_IN_TRACKING_AREA, - NAS_CAUSE_NETWORK_FAILURE = NETWORK_FAILURE, - NAS_CAUSE_ESM_FAILURE = ESM_FAILURE -} nas_cause_t; - -/* - * -------------------------------------------------------------------------- - * Access Stratum message global parameters - * -------------------------------------------------------------------------- - */ - -/* Error code */ -typedef enum nas_error_code_s { - AS_SUCCESS = 1, /* Success code, transaction is going on */ - AS_TERMINATED_NAS, /* Transaction terminated by NAS */ - AS_TERMINATED_AS, /* Transaction terminated by AS */ - AS_FAILURE /* Failure code */ -} nas_error_code_t; - -/* Core network domain */ -typedef enum core_network_s { - AS_PS = 1, /* Packet-Switched */ - AS_CS /* Circuit-Switched */ -} core_network_t; - -/* SAE Temporary Mobile Subscriber Identity */ -typedef struct as_stmsi_s { - uint8_t MMEcode; /* MME code that allocated the GUTI */ - uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ -} as_stmsi_t; - -/* Dedicated NAS information */ -typedef struct as_nas_info_s { - uint32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ -} as_nas_info_t; - -/* Radio Access Bearer identity */ -typedef uint8_t as_rab_id_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Broadcast information - * -------------------------------------------------------------------------- - */ - -/* - * AS->NAS - Broadcast information indication - * AS may asynchronously report to NAS available PLMNs within specific - * location area - */ -typedef struct broadcast_info_ind_s { -#define PLMN_LIST_MAX_SIZE 6 - PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */ - ci_t cellID; /* Identity of the cell serving the listed PLMNs */ - tac_t tac; /* Code of the tracking area the cell belongs to */ -} broadcast_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Cell information relevant for cell selection processing - * -------------------------------------------------------------------------- - */ - -/* Radio access technologies supported by the network */ -#define AS_GSM (1 << NET_ACCESS_GSM) -#define AS_COMPACT (1 << NET_ACCESS_COMPACT) -#define AS_UTRAN (1 << NET_ACCESS_UTRAN) -#define AS_EGPRS (1 << NET_ACCESS_EGPRS) -#define AS_HSDPA (1 << NET_ACCESS_HSDPA) -#define AS_HSUPA (1 << NET_ACCESS_HSUPA) -#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) -#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) - -/* - * NAS->AS - Cell Information request - * NAS request AS to search for a suitable cell belonging to the selected - * PLMN to camp on. - */ -typedef struct cell_info_req_s { - plmn_t plmnID; /* Selected PLMN identity */ - Byte_t rat; /* Bitmap - set of radio access technologies */ -} cell_info_req_t; - -/* - * AS->NAS - Cell Information confirm - * AS search for a suitable cell and respond to NAS. If found, the cell - * is selected to camp on. - */ -typedef struct cell_info_cnf_s { - uint8_t errCode; /* Error code */ - ci_t cellID; /* Identity of the cell serving the selected PLMN */ - tac_t tac; /* Code of the tracking area the cell belongs to */ - AcT_t rat; /* Radio access technology supported by the cell */ - uint8_t rsrq; /* Reference signal received quality */ - uint8_t rsrp; /* Reference signal received power */ -} cell_info_cnf_t; - -/* - * AS->NAS - Cell Information indication - * AS may change cell selection if a more suitable cell is found. - */ -typedef struct cell_info_ind_s { - ci_t cellID; /* Identity of the new serving cell */ - tac_t tac; /* Code of the tracking area the cell belongs to */ -} cell_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Paging information - * -------------------------------------------------------------------------- - */ - -/* Paging cause */ -typedef enum paging_cause_s { - AS_CONNECTION_ESTABLISH, /* Establish NAS signalling connection */ - AS_EPS_ATTACH, /* Perform local detach and initiate EPS - * attach procedure */ - AS_CS_FALLBACK /* Inititate CS fallback procedure */ -} paging_cause_t; - -/* - * NAS->AS - Paging Information request - * NAS requests the AS that NAS signalling messages or user data is pending - * to be sent. - */ -typedef struct paging_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - uint8_t CN_domain; /* Core network domain */ -} paging_req_t; - -/* - * AS->NAS - Paging Information indication - * AS reports to the NAS that appropriate procedure has to be initiated. - */ -typedef struct paging_ind_s { - paging_cause_t cause; /* Paging cause */ -} paging_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection establishment - * -------------------------------------------------------------------------- - */ - -/* Cause of RRC connection establishment */ -typedef enum as_cause_s { - AS_CAUSE_UNKNOWN = 0, - AS_CAUSE_EMERGENCY = NET_ESTABLISH_CAUSE_EMERGENCY, - AS_CAUSE_HIGH_PRIO = NET_ESTABLISH_CAUSE_HIGH_PRIO, - AS_CAUSE_MT_ACCESS = NET_ESTABLISH_CAUSE_MT_ACCESS, - AS_CAUSE_MO_SIGNAL = NET_ESTABLISH_CAUSE_MO_SIGNAL, - AS_CAUSE_MO_DATA = NET_ESTABLISH_CAUSE_MO_DATA, - AS_CAUSE_V1020 = NET_ESTABLISH_CAUSE_V1020 -} as_cause_t; - -/* Type of the call associated to the RRC connection establishment */ -typedef enum as_call_type_s { - AS_TYPE_ORIGINATING_SIGNAL = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL, - AS_TYPE_EMERGENCY_CALLS = NET_ESTABLISH_TYPE_EMERGENCY_CALLS, - AS_TYPE_ORIGINATING_CALLS = NET_ESTABLISH_TYPE_ORIGINATING_CALLS, - AS_TYPE_TERMINATING_CALLS = NET_ESTABLISH_TYPE_TERMINATING_CALLS, - AS_TYPE_MO_CS_FALLBACK = NET_ESTABLISH_TYPE_MO_CS_FALLBACK -} as_call_type_t; - -/* - * NAS->AS - NAS signalling connection establishment request - * NAS requests the AS to perform the RRC connection establishment procedure - * to transfer initial NAS message to the network while UE is in IDLE mode. - */ -typedef struct nas_establish_req_s { - as_cause_t cause; /* RRC connection establishment cause */ - as_call_type_t type; /* RRC associated call type */ - as_stmsi_t s_tmsi; /* UE identity */ - plmn_t plmnID; /* Selected PLMN identity */ - as_nas_info_t initialNasMsg; /* Initial NAS message to transfer */ -} nas_establish_req_t; - -/* - * AS->NAS - NAS signalling connection establishment indication - * AS transfers the initial NAS message to the NAS. - */ -typedef struct nas_establish_ind_s { - uint32_t UEid; /* UE lower layer identifier */ - tac_t tac; /* Code of the tracking area the initiating - * UE belongs to */ - as_cause_t asCause; /* Establishment cause */ - as_nas_info_t initialNasMsg; /* Initial NAS message to transfer */ -} nas_establish_ind_t; - -/* - * NAS->AS - NAS signalling connection establishment response - * NAS responds to the AS that initial answer message has to be provided to - * the UE. - */ -typedef struct nas_establish_rsp_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - nas_error_code_t errCode; /* Transaction status */ - as_nas_info_t nasMsg; /* NAS message to transfer */ - uint32_t nas_ul_count; /* UL NAS COUNT */ - uint16_t selected_encryption_algorithm; - uint16_t selected_integrity_algorithm; -} nas_establish_rsp_t; - -/* - * AS->NAS - NAS signalling connection establishment confirm - * AS transfers the initial answer message to the NAS. - */ -typedef struct nas_establish_cnf_s { - uint32_t UEid; /* UE lower layer identifier */ - nas_error_code_t errCode; /* Transaction status */ - as_nas_info_t nasMsg; /* NAS message to transfer */ - uint32_t ul_nas_count; - uint16_t selected_encryption_algorithm; - uint16_t selected_integrity_algorithm; -} nas_establish_cnf_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection release - * -------------------------------------------------------------------------- - */ - -/* Release cause */ -typedef enum release_cause_s { - AS_AUTHENTICATION_FAILURE = 1, /* Authentication procedure failed */ - AS_DETACH /* Detach requested */ -} release_cause_t; - -/* - * NAS->AS - NAS signalling connection release request - * NAS requests the termination of the connection with the UE. - */ -typedef struct nas_release_req_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - release_cause_t cause; /* Release cause */ -} nas_release_req_t; - -/* - * AS->NAS - NAS signalling connection release indication - * AS reports that connection has been terminated by the network. - */ -typedef struct nas_release_ind_s { - release_cause_t cause; /* Release cause */ -} nas_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS information transfer - * -------------------------------------------------------------------------- - */ - -/* - * NAS->AS - Uplink data transfer request - * NAS requests the AS to transfer uplink information to the NAS that - * operates at the network side. - */ -typedef struct ul_info_transfer_req_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - as_nas_info_t nasMsg; /* Uplink NAS message */ -} ul_info_transfer_req_t; - -/* - * AS->NAS - Uplink data transfer confirm - * AS immediately notifies the NAS whether uplink information has been - * successfully sent to the network or not. - */ -typedef struct ul_info_transfer_cnf_s { - uint32_t UEid; /* UE lower layer identifier */ - nas_error_code_t errCode; /* Transaction status */ -} ul_info_transfer_cnf_t; - -/* - * AS->NAS - Uplink data transfer indication - * AS delivers the uplink information message to the NAS that operates - * at the network side. - */ -typedef struct ul_info_transfer_ind_s { - uint32_t UEid; /* UE lower layer identifier */ - as_nas_info_t nasMsg; /* Uplink NAS message */ -} ul_info_transfer_ind_t; - -/* - * NAS->AS - Downlink data transfer request - * NAS requests the AS to transfer downlink information to the NAS that - * operates at the UE side. - */ -typedef ul_info_transfer_req_t dl_info_transfer_req_t; - -/* - * AS->NAS - Downlink data transfer confirm - * AS immediately notifies the NAS whether downlink information has been - * successfully sent to the network or not. - */ -typedef ul_info_transfer_cnf_t dl_info_transfer_cnf_t; - -/* - * AS->NAS - Downlink data transfer indication - * AS delivers the downlink information message to the NAS that operates - * at the UE side. - */ -typedef ul_info_transfer_ind_t dl_info_transfer_ind_t; - -/* - * -------------------------------------------------------------------------- - * Radio Access Bearer establishment - * -------------------------------------------------------------------------- - */ - -/* TODO: Quality of Service parameters */ -typedef struct {} as_qos_t; - -/* - * NAS->AS - Radio access bearer establishment request - * NAS requests the AS to allocate transmission resources to radio access - * bearer initialized at the network side. - */ -typedef struct rab_establish_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ - as_qos_t QoS; /* Requested Quality of Service */ -} rab_establish_req_t; - -/* - * AS->NAS - Radio access bearer establishment indication - * AS notifies the NAS that specific radio access bearer has to be setup. - */ -typedef struct rab_establish_ind_s { - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_establish_ind_t; - -/* - * NAS->AS - Radio access bearer establishment response - * NAS responds to AS whether the specified radio access bearer has been - * successfully setup or not. - */ -typedef struct rab_establish_rsp_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ - nas_error_code_t errCode; /* Transaction status */ -} rab_establish_rsp_t; - -/* - * AS->NAS - Radio access bearer establishment confirm - * AS notifies NAS whether the specified radio access bearer has been - * successfully setup at the UE side or not. - */ -typedef struct rab_establish_cnf_s { - as_rab_id_t rabID; /* Radio access bearer identity */ - nas_error_code_t errCode; /* Transaction status */ -} rab_establish_cnf_t; - -/* - * -------------------------------------------------------------------------- - * Radio Access Bearer release - * -------------------------------------------------------------------------- - */ - -/* - * NAS->AS - Radio access bearer release request - * NAS requests the AS to release transmission resources previously allocated - * to specific radio access bearer at the network side. - */ -typedef struct rab_release_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_release_req_t; - -/* - * AS->NAS - Radio access bearer release indication - * AS notifies NAS that specific radio access bearer has been released. - */ -typedef struct rab_release_ind_s { - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * Structure of the AS messages handled by the network sublayer - * -------------------------------------------------------------------------- - */ -typedef struct as_message_s { - uint16_t msgID; - union { - broadcast_info_ind_t broadcast_info_ind; - cell_info_req_t cell_info_req; - cell_info_cnf_t cell_info_cnf; - cell_info_ind_t cell_info_ind; - paging_req_t paging_req; - paging_ind_t paging_ind; - nas_establish_req_t nas_establish_req; - nas_establish_ind_t nas_establish_ind; - nas_establish_rsp_t nas_establish_rsp; - nas_establish_cnf_t nas_establish_cnf; - nas_release_req_t nas_release_req; - nas_release_ind_t nas_release_ind; - ul_info_transfer_req_t ul_info_transfer_req; - ul_info_transfer_cnf_t ul_info_transfer_cnf; - ul_info_transfer_ind_t ul_info_transfer_ind; - dl_info_transfer_req_t dl_info_transfer_req; - dl_info_transfer_cnf_t dl_info_transfer_cnf; - dl_info_transfer_ind_t dl_info_transfer_ind; - rab_establish_req_t rab_establish_req; - rab_establish_ind_t rab_establish_ind; - rab_establish_rsp_t rab_establish_rsp; - rab_establish_cnf_t rab_establish_cnf; - rab_release_req_t rab_release_req; - rab_release_ind_t rab_release_ind; - } __attribute__((__packed__)) msg; -} as_message_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int as_message_decode(const char* buffer, as_message_t* msg, int length); - -int as_message_encode(char* buffer, as_message_t* msg, int length); - -/* Implemented in the network_api.c body file */ -int as_message_send(as_message_t* as_msg); - -#endif /* __AS_MESSAGE_H__*/ diff --git a/openair3/NAS/COMMON/UTIL/socket.h b/openair3/NAS/COMMON/UTIL/socket.h index 033046d98c..58bc6b8527 100644 --- a/openair3/NAS/COMMON/UTIL/socket.h +++ b/openair3/NAS/COMMON/UTIL/socket.h @@ -35,8 +35,8 @@ Author Frederic Maurel Description Implements TCP socket handlers *****************************************************************************/ -#ifndef __SOCKET_H__ -#define __SOCKET_H__ +#ifndef __NAS_COMMON_UTIL_SOCKET__H__ +#define __NAS_COMMON_UTIL_SOCKET__H__ #include @@ -71,4 +71,4 @@ ssize_t socket_send(const void* id, const char* buffer, size_t length); void socket_close(void* id); -#endif /* __SOCKET_H__*/ +#endif /* __NAS_COMMON_UTIL_SOCKET__H__ */ diff --git a/openair3/NAS/COMMON/commonDef.h b/openair3/NAS/COMMON/commonDef.h deleted file mode 100644 index e9f769db55..0000000000 --- a/openair3/NAS/COMMON/commonDef.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ -/* - -Source commonDef.h - -Version 0.1 - -Date 2012/02/27 - -Product NAS stack - -Subsystem include - -Author Frederic Maurel - -Description Contains global common definitions - -*****************************************************************************/ -#ifndef __COMMONDEF_H__ -#define __COMMONDEF_H__ - -#include -#include -#include - -typedef signed char boolean_t; - -#if !defined(TRUE) -#define TRUE (boolean_t)0x01 -#endif - -#if !defined(FALSE) -#define FALSE (boolean_t)0x00 -#endif - -#define BOOL_NOT(b) (b^TRUE) - -#define NAS_UE_ID_FMT "0x%06x" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -#define RETURNok (0) -#define RETURNerror (-1) - -/* - * Name of the environment variable which defines the default directory - * where the NAS application is executed and where are located files - * where non-volatile data are stored - */ -#define DEFAULT_NAS_PATH "PWD" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* ------------------------------------------------------------------------------ - Standard data type definitions ------------------------------------------------------------------------------ -*/ -typedef int8_t SByte_t; /* 8 bit signed integer */ -typedef uint8_t Byte_t; /* 8 bit unsigned integer */ - - -/* ------------------------------------------------------------------------------ - Common NAS data type definitions ------------------------------------------------------------------------------ -*/ - -typedef uint8_t Stat_t; /* Registration status */ -typedef uint16_t lac_t; /* Location Area Code */ -typedef uint8_t rac_t; /* Routing Area Code */ -typedef uint16_t tac_t; /* Tracking Area Code */ -typedef uint32_t ci_t; /* Cell Identifier */ -typedef uint8_t AcT_t; /* Access Technology */ - -/* - * International Mobile Subscriber Identity - */ -typedef struct { - Byte_t length; - union { - struct { - Byte_t digit2:4; - Byte_t digit1:4; - Byte_t digit4:4; - Byte_t digit3:4; - Byte_t digit6:4; - Byte_t digit5:4; - Byte_t digit8:4; - Byte_t digit7:4; - Byte_t digit10:4; - Byte_t digit9:4; - Byte_t digit12:4; - Byte_t digit11:4; - Byte_t digit14:4; - Byte_t digit13:4; -#define EVEN_PARITY 0 -#define ODD_PARITY 1 - Byte_t parity:4; - Byte_t digit15:4; - } num; -#define IMSI_SIZE 8 - Byte_t value[IMSI_SIZE]; - } u; -} imsi_t; - -#define NAS_IMSI2STR(iMsI_t_PtR,iMsI_sTr, MaXlEn) \ - {\ - int l_offset = 0;\ - int l_ret = 0;\ - l_ret = snprintf(iMsI_sTr + l_offset, MaXlEn - l_offset, "%u%u%u%u%u",\ - iMsI_t_PtR->u.num.digit1, iMsI_t_PtR->u.num.digit2,\ - iMsI_t_PtR->u.num.digit3, iMsI_t_PtR->u.num.digit4,\ - iMsI_t_PtR->u.num.digit5);\ - if ((iMsI_t_PtR->u.num.digit6 != 0xf) && (l_ret > 0)) {\ - l_offset += l_ret;\ - l_ret = snprintf(iMsI_sTr + l_offset, MaXlEn - l_offset, "%u", iMsI_t_PtR->u.num.digit6);\ - }\ - if (l_ret > 0) {\ - l_offset += l_ret;\ - l_ret = snprintf(iMsI_sTr + l_offset, MaXlEn - l_offset, "%u%u%u%u%u%u%u%u",\ - iMsI_t_PtR->u.num.digit7, iMsI_t_PtR->u.num.digit8,\ - iMsI_t_PtR->u.num.digit9, iMsI_t_PtR->u.num.digit10,\ - iMsI_t_PtR->u.num.digit11, iMsI_t_PtR->u.num.digit12,\ - iMsI_t_PtR->u.num.digit13, iMsI_t_PtR->u.num.digit14);\ - }\ - if ((iMsI_t_PtR->u.num.digit15 != 0xf) && (l_ret > 0)) {\ - l_offset += l_ret;\ - l_ret = snprintf(iMsI_sTr + l_offset, MaXlEn - l_offset, "%u", iMsI_t_PtR->u.num.digit15);\ - }\ - } - -/* - * Mobile subscriber dialing number - */ -typedef struct { - Byte_t ext:1; - /* Type Of Number */ -#define MSISDN_TON_UNKNOWKN 0b000 -#define MSISDN_TON_INTERNATIONAL 0b001 -#define MSISDN_TON_NATIONAL 0b010 -#define MSISDN_TON_NETWORK 0b011 -#define MSISDN_TON_SUBCRIBER 0b100 -#define MSISDN_TON_ABBREVIATED 0b110 -#define MSISDN_TON_RESERVED 0b111 - Byte_t ton:3; - /* Numbering Plan Identification */ -#define MSISDN_NPI_UNKNOWN 0b0000 -#define MSISDN_NPI_ISDN_TELEPHONY 0b0001 -#define MSISDN_NPI_GENERIC 0b0010 -#define MSISDN_NPI_DATA 0b0011 -#define MSISDN_NPI_TELEX 0b0100 -#define MSISDN_NPI_MARITIME_MOBILE 0b0101 -#define MSISDN_NPI_LAND_MOBILE 0b0110 -#define MSISDN_NPI_ISDN_MOBILE 0b0111 -#define MSISDN_NPI_PRIVATE 0b1110 -#define MSISDN_NPI_RESERVED 0b1111 - Byte_t npi:4; - /* Dialing Number */ - struct { - Byte_t lsb:4; - Byte_t msb:4; -#define MSISDN_DIGIT_SIZE 10 - } digit[MSISDN_DIGIT_SIZE]; -} msisdn_t; - -/* - * International Mobile Equipment Identity - */ -typedef imsi_t imei_t; - -/* - * Public Land Mobile Network identifier - * PLMN = BCD encoding (Mobile Country Code + Mobile Network Code) - */ -typedef struct { - Byte_t MCCdigit2:4; - Byte_t MCCdigit1:4; - Byte_t MNCdigit3:4; - Byte_t MCCdigit3:4; - Byte_t MNCdigit2:4; - Byte_t MNCdigit1:4; -} plmn_t; - -/* - * Location Area Identification - */ -typedef struct { - plmn_t plmn; /* + */ - lac_t lac; /* Location Area Code */ -} lai_t; - -/* - * GPRS Routing Area Identification - */ -typedef struct { - plmn_t plmn; /* + */ - lac_t lac; /* Location Area Code */ - rac_t rac; /* Routing Area Code */ -} RAI_t; - -/* - * EPS Tracking Area Identification - */ -typedef struct { - plmn_t plmn; /* + */ - tac_t tac; /* Tracking Area Code */ -} tai_t; - -/* - * EPS Globally Unique MME Identity - */ -typedef struct { - plmn_t plmn; /* + */ - uint16_t MMEgid; /* MME group identifier */ - uint8_t MMEcode; /* MME code */ -} gummei_t; - -/* - * EPS Globally Unique Temporary UE Identity - */ -typedef struct { - gummei_t gummei; /* Globally Unique MME Identity */ - uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ -} GUTI_t; -#define GUTI2STR(GuTi_PtR, GuTi_StR, MaXlEn) \ - {\ - int l_offset = 0;\ - int l_ret = 0;\ - l_ret += snprintf(GuTi_StR + l_offset,MaXlEn-l_offset, "%03u.",\ - GuTi_PtR->gummei.plmn.MCCdigit3 * 100 +\ - GuTi_PtR->gummei.plmn.MCCdigit2 * 10 +\ - GuTi_PtR->gummei.plmn.MCCdigit1);\ - if (l_ret > 0) {\ - l_offset += l_ret;\ - } else {\ - l_offset = MaXlEn;\ - }\ - if (GuTi_PtR->gummei.plmn.MNCdigit1 != 0xf) {\ - l_ret += snprintf(GuTi_StR + l_offset,MaXlEn-l_offset, "%03u|%04x|%02x|%08x",\ - GuTi_PtR->gummei.plmn.MNCdigit3 * 100 +\ - GuTi_PtR->gummei.plmn.MNCdigit2 * 10 +\ - GuTi_PtR->gummei.plmn.MNCdigit1,\ - GuTi_PtR->gummei.MMEgid,\ - GuTi_PtR->gummei.MMEcode,\ - GuTi_PtR->m_tmsi);\ - } else {\ - l_ret += snprintf(GuTi_StR + l_offset,MaXlEn-l_offset, "%02u|%04x|%02x|%08x",\ - GuTi_PtR->gummei.plmn.MNCdigit2 * 10 +\ - GuTi_PtR->gummei.plmn.MNCdigit1,\ - GuTi_PtR->gummei.MMEgid,\ - GuTi_PtR->gummei.MMEcode,\ - GuTi_PtR->m_tmsi);\ - }\ - } - - - - -/* Checks PLMN validity */ -#define PLMN_IS_VALID(plmn) (((plmn).MCCdigit1 & \ - (plmn).MCCdigit2 & \ - (plmn).MCCdigit3) != 0x0F) - -/* Checks TAC validity */ -#define TAC_IS_VALID(tac) (((tac) != 0x0000) && ((tac) != 0xFFF0)) - -/* Checks TAI validity */ -#define TAI_IS_VALID(tai) (PLMN_IS_VALID((tai).plmn) && \ - TAC_IS_VALID((tai).tac)) -/* - * A list of PLMNs - */ -#define PLMN_LIST_T(SIZE) struct {Byte_t n_plmns; plmn_t plmn[SIZE];} - -/* - * A list of TACs - */ -#define TAC_LIST_T(SIZE) struct {Byte_t n_tacs; TAC_t tac[SIZE];} - -/* - * A list of TAIs - */ -#define TAI_LIST_T(SIZE) struct {Byte_t n_tais; tai_t tai[SIZE];} - -typedef enum eps_protocol_discriminator_e { - /* Protocol discriminator identifier for EPS Mobility Management */ - EPS_MOBILITY_MANAGEMENT_MESSAGE = 0x7, - - /* Protocol discriminator identifier for EPS Session Management */ - EPS_SESSION_MANAGEMENT_MESSAGE = 0x2, -} eps_protocol_discriminator_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __COMMONDEF_H__*/ diff --git a/openair3/NAS/COMMON/networkDef.h b/openair3/NAS/COMMON/networkDef.h deleted file mode 100644 index 5390eac2f0..0000000000 --- a/openair3/NAS/COMMON/networkDef.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ - -/***************************************************************************** - -Source networkDef.h - -Version 0.1 - -Date 2012/09/21 - -Product NAS stack - -Subsystem include - -Author Frederic Maurel - -Description Contains network's global definitions - -*****************************************************************************/ -#ifndef __NETWORKDEF_H__ -#define __NETWORKDEF_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * ---------------------- - * Network selection mode - * ---------------------- - */ -#define NET_PLMN_AUTO 0 -#define NET_PLMN_MANUAL 1 - -/* - * --------------------------- - * Network registration status - * --------------------------- - */ -/* not registered, not currently searching an operator to register to */ -#define NET_REG_STATE_OFF 0 -/* registered, home network */ -#define NET_REG_STATE_HN 1 -/* not registered, currently trying to attach or searching an operator - * to register to */ -#define NET_REG_STATE_ON 2 -/* registration denied */ -#define NET_REG_STATE_DENIED 3 -/* unknown (e.g. out of GERAN/UTRAN/E-UTRAN coverage) */ -#define NET_REG_STATE_UNKNOWN 4 -/* registered, roaming */ -#define NET_REG_STATE_ROAMING 5 -/* registered for "SMS only", home network */ -#define NET_REG_STATE_SMS_HN 6 -/* registered, for "SMS only", roaming */ -#define NET_REG_STATE_SMS_ROAMING 7 -/* attached for emergency bearer services only (applicable to UTRAN) */ -#define NET_REG_STATE_EMERGENCY 8 - -/* - * ------------------------------------ - * Network access technology indicators - * ------------------------------------ - */ -#define NET_ACCESS_UNAVAILABLE (-1) /* Not available */ -#define NET_ACCESS_GSM 0 /* GSM */ -#define NET_ACCESS_COMPACT 1 /* GSM Compact */ -#define NET_ACCESS_UTRAN 2 /* UTRAN */ -#define NET_ACCESS_EGPRS 3 /* GSM w/EGPRS */ -#define NET_ACCESS_HSDPA 4 /* UTRAN w/HSDPA */ -#define NET_ACCESS_HSUPA 5 /* UTRAN w/HSUPA */ -#define NET_ACCESS_HSDUPA 6 /* UTRAN w/HSDPA and HSUPA */ -#define NET_ACCESS_EUTRAN 7 /* E-UTRAN */ - -/* - * --------------------------------------- - * Network operator representation formats - * --------------------------------------- - */ -#define NET_FORMAT_LONG 0 /* long format alphanumeric */ -#define NET_FORMAT_SHORT 1 /* short format alphanumeric */ -#define NET_FORMAT_NUM 2 /* numeric format */ - -#define NET_FORMAT_MAX_SIZE NET_FORMAT_LONG_SIZE - -/* - * ----------------------------- - * Network operator availability - * ----------------------------- - */ -#define NET_OPER_UNKNOWN 0 /* unknown operator */ -#define NET_OPER_AVAILABLE 1 /* available operator */ -#define NET_OPER_CURRENT 2 /* currently selected operator */ -#define NET_OPER_FORBIDDEN 3 /* forbidden operator */ - -/* - * -------------------------------------- - * Network connection establishment cause - * -------------------------------------- - */ -#define NET_ESTABLISH_CAUSE_EMERGENCY 0x01 -#define NET_ESTABLISH_CAUSE_HIGH_PRIO 0x02 -#define NET_ESTABLISH_CAUSE_MT_ACCESS 0x03 -#define NET_ESTABLISH_CAUSE_MO_SIGNAL 0x04 -#define NET_ESTABLISH_CAUSE_MO_DATA 0x05 -#define NET_ESTABLISH_CAUSE_V1020 0x06 - -/* - * -------------------------------------- - * Network connection establishment type - * -------------------------------------- - */ -#define NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL 0x10 -#define NET_ESTABLISH_TYPE_EMERGENCY_CALLS 0x20 -#define NET_ESTABLISH_TYPE_ORIGINATING_CALLS 0x30 -#define NET_ESTABLISH_TYPE_TERMINATING_CALLS 0x40 -#define NET_ESTABLISH_TYPE_MO_CS_FALLBACK 0x50 - -/* - * ------------------- - * PDN connection type - * ------------------- - */ -#define NET_PDN_TYPE_IPV4 (0 + 1) -#define NET_PDN_TYPE_IPV6 (1 + 1) -#define NET_PDN_TYPE_IPV4V6 (2 + 1) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * --------------------- - * PDN connection status - * --------------------- - */ -typedef enum { - /* MT = The Mobile Terminal, NW = The Network */ - NET_PDN_MT_DEFAULT_ACT = 1, /* MT has activated a PDN connection */ - NET_PDN_NW_DEFAULT_DEACT, /* NW has deactivated a PDN connection */ - NET_PDN_MT_DEFAULT_DEACT, /* MT has deactivated a PDN connection */ - NET_PDN_NW_DEDICATED_ACT, /* NW has activated an EPS bearer context */ - NET_PDN_MT_DEDICATED_ACT, /* MT has activated an EPS bearer context */ - NET_PDN_NW_DEDICATED_DEACT, /* NW has deactivated an EPS bearer context */ - NET_PDN_MT_DEDICATED_DEACT, /* MT has deactivated an EPS bearer context */ -} network_pdn_state_t; - -/* - * --------------------------- - * Network operator identifier - * --------------------------- - */ -typedef struct { -#define NET_FORMAT_LONG_SIZE 16 /* Long alphanumeric format */ -#define NET_FORMAT_SHORT_SIZE 8 /* Short alphanumeric format */ -#define NET_FORMAT_NUM_SIZE 6 /* Numeric format (PLMN identifier */ - union { - unsigned char alpha_long[NET_FORMAT_LONG_SIZE+1]; - unsigned char alpha_short[NET_FORMAT_SHORT_SIZE+1]; - unsigned char num[NET_FORMAT_NUM_SIZE+1]; - } id; -} network_plmn_t; - -/* - * ------------------------------- - * EPS bearer level QoS parameters - * ------------------------------- - */ -typedef struct { - int gbrUL; /* Guaranteed Bit Rate for uplink */ - int gbrDL; /* Guaranteed Bit Rate for downlink */ - int mbrUL; /* Maximum Bit Rate for uplink */ - int mbrDL; /* Maximum Bit Rate for downlink */ - int qci; /* QoS Class Identifier */ -} network_qos_t; - -/* - * ----------------------------- - * IPv4 packet filter parameters - * ----------------------------- - */ -typedef struct { - unsigned char protocol; /* Protocol identifier */ - unsigned char tos; /* Type of service */ -#define NET_PACKET_FILTER_IPV4_ADDR_SIZE 4 - unsigned char addr[NET_PACKET_FILTER_IPV4_ADDR_SIZE]; - unsigned char mask[NET_PACKET_FILTER_IPV4_ADDR_SIZE]; -} network_ipv4_data_t; - -/* - * ----------------------------- - * IPv6 packet filter parameters - * ----------------------------- - */ -typedef struct { - unsigned char nh; /* Next header type */ - unsigned char tf; /* Traffic class */ -#define NET_PACKET_FILTER_IPV6_ADDR_SIZE 16 - unsigned char addr[NET_PACKET_FILTER_IPV6_ADDR_SIZE]; - unsigned char mask[NET_PACKET_FILTER_IPV6_ADDR_SIZE]; - unsigned int ipsec; /* IPSec security parameter index */ - unsigned int fl; /* Flow label */ -} network_ipv6_data_t; - -/* - * ------------- - * Packet Filter - * ------------- - */ -typedef struct { - unsigned char id; /* Packet filter identifier */ -#define NET_PACKET_FILTER_DOWNLINK 0x01 -#define NET_PACKET_FILTER_UPLINK 0x02 -#define NET_PACKET_FILTER_BIDIR 0x03 - unsigned char dir; /* Packet filter direction */ - unsigned char precedence; /* Evaluation precedence */ - union { - network_ipv4_data_t ipv4; - network_ipv6_data_t ipv6; - } data; - unsigned short lport; /* Local (UE) port number */ - unsigned short rport; /* Remote (network) port number */ -} network_pkf_t; - -/* - * --------------------- - * Traffic Flow Template - * --------------------- - */ -typedef struct { - int n_pkfs; -#define NET_PACKET_FILTER_MAX 16 - network_pkf_t* pkf[NET_PACKET_FILTER_MAX]; -} network_tft_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __NETWORKDEF_H__*/ diff --git a/openair3/NAS/TEST/USER/user_parser.h b/openair3/NAS/TEST/USER/user_parser.h index d1972de028..e7fc07ee32 100644 --- a/openair3/NAS/TEST/USER/user_parser.h +++ b/openair3/NAS/TEST/USER/user_parser.h @@ -39,8 +39,8 @@ Description Command line parser of the user simulator process *****************************************************************************/ -#ifndef __USER_PARSER_H__ -#define __USER_PARSER__H__ +#ifndef __NAS_TEST_USER_USER_PARSER__H__ +#define __NAS_TEST_USER_USER_PARSER__H__ /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -74,4 +74,4 @@ const char* user_parser_get_port(void); const char* user_parser_get_devpath(void); const char* user_parser_get_devattr(void); -#endif /* __USER_PARSER_H__*/ +#endif /* __NAS_TEST_USER_USER_PARSER__H__ */ diff --git a/openair3/NAS/TOOLS/conf_network.c b/openair3/NAS/TOOLS/conf_network.c index 7e71c9b4ee..054189a130 100644 --- a/openair3/NAS/TOOLS/conf_network.c +++ b/openair3/NAS/TOOLS/conf_network.c @@ -43,7 +43,7 @@ void gen_network_record_from_conf(const plmn_conf_param_t *conf, network_record_ strcpy(record->fullname, conf->fullname); strcpy(record->shortname, conf->shortname); - char num[6]; + char num[60]; sprintf(num, "%s%s", conf->mcc, conf->mnc); record->num = atoi(num); diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c index 86536ac525..227a3cb6a9 100644 --- a/openair3/S1AP/s1ap_eNB_encoder.c +++ b/openair3/S1AP/s1ap_eNB_encoder.c @@ -129,9 +129,9 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu, return -1; } - //if (asn1_xer_print) { + if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu); - //} + } memset(&res, 0, sizeof(res)); res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu); diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index b8a4b98fef..c668e32d1b 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -1791,8 +1791,8 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication( S1AP_E_RABToBeModifiedItemBearerModInd_t *E_RAB_ToBeModifiedItem_BearerModInd = NULL; S1AP_E_RABToBeModifiedItemBearerModIndIEs_t *E_RAB_ToBeModifiedItem_BearerModInd_IEs = NULL; - S1AP_E_RABNotToBeModifiedItemBearerModInd_t *E_RAB_NotToBeModifiedItem_BearerModInd = NULL; - S1AP_E_RABNotToBeModifiedItemBearerModIndIEs_t *E_RAB_NotToBeModifiedItem_BearerModInd_IEs = NULL; + //S1AP_E_RABNotToBeModifiedItemBearerModInd_t *E_RAB_NotToBeModifiedItem_BearerModInd = NULL; + //S1AP_E_RABNotToBeModifiedItemBearerModIndIEs_t *E_RAB_NotToBeModifiedItem_BearerModInd_IEs = NULL; s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; @@ -1804,10 +1804,10 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication( DevAssert(e_rab_modification_ind != NULL); int num_e_rabs_tobemodified = e_rab_modification_ind->nb_of_e_rabs_tobemodified; - int num_e_rabs_nottobemodified = e_rab_modification_ind->nb_of_e_rabs_nottobemodified; + //int num_e_rabs_nottobemodified = e_rab_modification_ind->nb_of_e_rabs_nottobemodified; - uint32_t CSG_id = 0; - uint32_t pseudo_gtp_teid = 10; + //uint32_t CSG_id = 0; + //uint32_t pseudo_gtp_teid = 10; if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, e_rab_modification_ind->eNB_ue_s1ap_id)) == NULL) { diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h b/openair3/TEST/oaisim_mme_test_s1c_s1ap.h index 3633f11e86..4faec0e66e 100644 --- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h +++ b/openair3/TEST/oaisim_mme_test_s1c_s1ap.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef __TEST_OAISIM_MME_TEST_S1C_S1AP__H__ +#define __TEST_OAISIM_MME_TEST_S1C_S1AP__H__ + #define _GNU_SOURCE #include #include @@ -53,3 +56,5 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, uint16_t out_streams); void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB); void *s1ap_eNB_task(void *arg); + +#endif diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario.h b/openair3/TEST/oaisim_mme_test_s1c_scenario.h index 8c33f45741..8b9a8dd54a 100644 --- a/openair3/TEST/oaisim_mme_test_s1c_scenario.h +++ b/openair3/TEST/oaisim_mme_test_s1c_scenario.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +#ifndef __TEST_OAISIM_MME_TEST_S1C_SCENARIO__H__ +#define __TEST_OAISIM_MME_TEST_S1C_SCENARIO__H__ + #include #include @@ -49,3 +52,5 @@ int compare_buffer(const uint8_t *buffer, const uint32_t length_buffer, con unsigned decode_hex_length(const char *h); int decode_hex(uint8_t *dst, const char *h); uint8_t *decode_hex_dup(const char *hex); + +#endif diff --git a/openair3/UTILS/mme_config.h b/openair3/UTILS/mme_config.h index 37b7dff865..417c8bbd5f 100644 --- a/openair3/UTILS/mme_config.h +++ b/openair3/UTILS/mme_config.h @@ -19,14 +19,14 @@ * contact@openairinterface.org */ +#ifndef __UTILS_MME_CONFIG__H__ +#define __UTILS_MME_CONFIG__H__ + #include #include #include "mme_default_values.h" -#ifndef MME_CONFIG_H_ -#define MME_CONFIG_H_ - #define MME_CONFIG_STRING_MME_CONFIG "MME" #define MME_CONFIG_STRING_REALM "REALM" #define MME_CONFIG_STRING_MAXENB "MAXENB" @@ -183,4 +183,4 @@ int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config); //int yyparse(struct mme_config_s *mme_config_p); -#endif /* MME_CONFIG_H_ */ +#endif /* __UTILS_MME_CONFIG__H__ */ diff --git a/openair3/UTILS/queue.h b/openair3/UTILS/queue.h deleted file mode 100644 index f8665c0f1a..0000000000 --- a/openair3/UTILS/queue.h +++ /dev/null @@ -1,592 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The - * elements are singly linked for minimum space and pointer manipulation - * overhead at the expense of O(n) removal for arbitrary elements. New - * elements can be added to the list after an existing element or at the - * head of the list. Elements being removed from the head of the list - * should use the explicit macro for this purpose for optimum - * efficiency. A singly-linked list may only be traversed in the forward - * direction. Singly-linked lists are ideal for applications with large - * datasets and few or no removals or for implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - * SLIST LIST STAILQ TAILQ CIRCLEQ - * _HEAD + + + + + - * _HEAD_INITIALIZER + + + + + - * _ENTRY + + + + + - * _INIT + + + + + - * _EMPTY + + + + + - * _FIRST + + + + + - * _NEXT + + + + + - * _PREV - - - + + - * _LAST - - + + + - * _FOREACH + + + + + - * _FOREACH_REVERSE - - - + + - * _INSERT_HEAD + + + + + - * _INSERT_BEFORE - + - + + - * _INSERT_AFTER + + + + + - * _INSERT_TAIL - - + + + - * _REMOVE_HEAD + - + - - - * _REMOVE + + + + + - */ - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ -#define LIST_INIT(head) do { \ - (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) - -/* - * List access methods. - */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) do { \ - (head)->slh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while(curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) - -/* - * Singly-linked List access methods. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first; /* first element */ \ - struct type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) do { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (listelm)->field.stqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->stqh_first; \ - while (curelm->field.stqe_next != (elm)) \ - curelm = curelm->field.stqe_next; \ - if ((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define STAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->stqh_first); \ - (var); \ - (var) = ((var)->field.stqe_next)) - -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Singly-linked Tail queue access methods. - */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ -} - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ - if ((head)->sqh_first == (elm)) { \ - SIMPLEQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->sqh_first; \ - while (curelm->field.sqe_next != (elm)) \ - curelm = curelm->field.sqe_next; \ - if ((curelm->field.sqe_next = \ - curelm->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(curelm)->field.sqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->sqh_first); \ - (var); \ - (var) = ((var)->field.sqe_next)) - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - - -/* - * Tail queue definitions. - */ -#define _TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} -#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define _TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} -#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) - -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Tail queue access methods. - */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { (void *)&head, (void *)&head } - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->cqh_first); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_next)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = ((head)->cqh_last); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_prev)) - -/* - * Circular queue access methods. - */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ - (((elm)->field.cqe_next == (void *)(head)) \ - ? ((head)->cqh_first) \ - : (elm->field.cqe_next)) -#define CIRCLEQ_LOOP_PREV(head, elm, field) \ - (((elm)->field.cqe_prev == (void *)(head)) \ - ? ((head)->cqh_last) \ - : (elm->field.cqe_prev)) - -#endif /* sys/queue.h */ diff --git a/openair3/UTILS/tree.h b/openair3/UTILS/tree.h deleted file mode 100644 index 351df9dfc5..0000000000 --- a/openair3/UTILS/tree.h +++ /dev/null @@ -1,678 +0,0 @@ -/* - * Copyright 2002 Niels Provos - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYS_TREE_H_ -#define _SYS_TREE_H_ - -/* - * This file defines data structures for different types of trees: - * splay trees and red-black trees. - * - * A splay tree is a self-organizing data structure. Every operation - * on the tree causes a splay to happen. The splay moves the requested - * node to the root of the tree and partly rebalances it. - * - * This has the benefit that request locality causes faster lookups as - * the requested nodes move to the top of the tree. On the other hand, - * every lookup causes memory writes. - * - * The Balance Theorem bounds the total access time for m operations - * and n inserts on an initially empty tree as O((m + n)lg n). The - * amortized cost for a sequence of m accesses to a splay tree is O(lg n); - * - * A red-black tree is a binary search tree with the node color as an - * extra attribute. It fulfills a set of conditions: - * - every search path from the root to a leaf consists of the - * same number of black nodes, - * - each red node (except for the root) has a black parent, - * - each leaf node is black. - * - * Every operation on a red-black tree is bounded as O(lg n). - * The maximum height of a red-black tree is 2lg (n+1). - */ - -#define SPLAY_HEAD(name, type) \ -struct name { \ - struct type *sph_root; /* root of the tree */ \ -} - -#define SPLAY_INITIALIZER(root) \ - { NULL } - -#define SPLAY_INIT(root) do { \ - (root)->sph_root = NULL; \ -} while (0) - -#define SPLAY_ENTRY(type) \ -struct { \ - struct type *spe_left; /* left element */ \ - struct type *spe_right; /* right element */ \ -} - -#define SPLAY_LEFT(elm, field) (elm)->field.spe_left -#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right -#define SPLAY_ROOT(head) (head)->sph_root -#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL) - -/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */ -#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (0) - -#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (0) - -#define SPLAY_LINKLEFT(head, tmp, field) do { \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ -} while (0) - -#define SPLAY_LINKRIGHT(head, tmp, field) do { \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ -} while (0) - -#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ - SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ - SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ -} while (0) - -/* Generates prototypes and inline functions */ - -#define SPLAY_PROTOTYPE(name, type, field, cmp) \ -void name##_SPLAY(struct name *, struct type *); \ -void name##_SPLAY_MINMAX(struct name *, int); \ -struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ -struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ - \ -/* Finds the node with the same key as elm */ \ -static __inline struct type * \ -name##_SPLAY_FIND(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) \ - return(NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) \ - return (head->sph_root); \ - return (NULL); \ -} \ - \ -static __inline struct type * \ -name##_SPLAY_NEXT(struct name *head, struct type *elm) \ -{ \ - name##_SPLAY(head, elm); \ - if (SPLAY_RIGHT(elm, field) != NULL) { \ - elm = SPLAY_RIGHT(elm, field); \ - while (SPLAY_LEFT(elm, field) != NULL) { \ - elm = SPLAY_LEFT(elm, field); \ - } \ - } else \ - elm = NULL; \ - return (elm); \ -} \ - \ -static __inline struct type * \ -name##_SPLAY_MIN_MAX(struct name *head, int val) \ -{ \ - name##_SPLAY_MINMAX(head, val); \ - return (SPLAY_ROOT(head)); \ -} - -/* Main splay operation. - * Moves node close to the key of elm to top - */ -#define SPLAY_GENERATE(name, type, field, cmp) \ -struct type * \ -name##_SPLAY_INSERT(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) { \ - SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \ - } else { \ - int __comp; \ - name##_SPLAY(head, elm); \ - __comp = (cmp)(elm, (head)->sph_root); \ - if(__comp < 0) { \ - SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\ - SPLAY_RIGHT(elm, field) = (head)->sph_root; \ - SPLAY_LEFT((head)->sph_root, field) = NULL; \ - } else if (__comp > 0) { \ - SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\ - SPLAY_LEFT(elm, field) = (head)->sph_root; \ - SPLAY_RIGHT((head)->sph_root, field) = NULL; \ - } else \ - return ((head)->sph_root); \ - } \ - (head)->sph_root = (elm); \ - return (NULL); \ -} \ - \ -struct type * \ -name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *__tmp; \ - if (SPLAY_EMPTY(head)) \ - return (NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) { \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\ - } else { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\ - name##_SPLAY(head, elm); \ - SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ - } \ - return (elm); \ - } \ - return (NULL); \ -} \ - \ -void \ -name##_SPLAY(struct name *head, struct type *elm) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ - int __comp; \ -\ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ - __left = __right = &__node; \ -\ - while ((__comp = (cmp)(elm, (head)->sph_root))) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) > 0){ \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} \ - \ -/* Splay with either the minimum or the maximum element \ - * Used to find minimum or maximum element in tree. \ - */ \ -void name##_SPLAY_MINMAX(struct name *head, int __comp) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ -\ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ - __left = __right = &__node; \ -\ - while (1) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp > 0) { \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} - -#define SPLAY_NEGINF -1 -#define SPLAY_INF 1 - -#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y) -#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y) -#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y) -#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y) -#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF)) -#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_INF)) - -#define SPLAY_FOREACH(x, name, head) \ - for ((x) = SPLAY_MIN(name, head); \ - (x) != NULL; \ - (x) = SPLAY_NEXT(name, head, x)) - -/* Macros that define a red-back tree */ -#define RB_HEAD(name, type) \ -struct name { \ - struct type *rbh_root; /* root of the tree */ \ -} - -#define RB_INITIALIZER(root) \ - { NULL } - -#define RB_INIT(root) do { \ - (root)->rbh_root = NULL; \ -} while (0) - -#define RB_BLACK 0 -#define RB_RED 1 -#define RB_ENTRY(type) \ -struct { \ - struct type *rbe_left; /* left element */ \ - struct type *rbe_right; /* right element */ \ - struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ -} - -#define RB_LEFT(elm, field) (elm)->field.rbe_left -#define RB_RIGHT(elm, field) (elm)->field.rbe_right -#define RB_PARENT(elm, field) (elm)->field.rbe_parent -#define RB_COLOR(elm, field) (elm)->field.rbe_color -#define RB_ROOT(head) (head)->rbh_root -#define RB_EMPTY(head) (RB_ROOT(head) == NULL) - -#define RB_SET(elm, parent, field) do { \ - RB_PARENT(elm, field) = parent; \ - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ - RB_COLOR(elm, field) = RB_RED; \ -} while (0) - -#define RB_SET_BLACKRED(black, red, field) do { \ - RB_COLOR(black, field) = RB_BLACK; \ - RB_COLOR(red, field) = RB_RED; \ -} while (0) - -#ifndef RB_AUGMENT -#define RB_AUGMENT(x) -#endif - -#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ - (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))) { \ - RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_LEFT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) - -#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ - (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))) { \ - RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_RIGHT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) - -/* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ -void name##_RB_INSERT_COLOR(struct name *, struct type *); \ -void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ -struct type *name##_RB_REMOVE(struct name *, struct type *); \ -struct type *name##_RB_INSERT(struct name *, struct type *); \ -struct type *name##_RB_FIND(struct name *, struct type *); \ -struct type *name##_RB_NEXT(struct type *); \ -struct type *name##_RB_MINMAX(struct name *, int); \ - \ - -/* Main rb operation. - * Moves node close to the key of elm to top - */ -#define RB_GENERATE(name, type, field, cmp) \ -void \ -name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ -{ \ - struct type *parent, *gparent, *tmp; \ - while ((parent = RB_PARENT(elm, field)) && \ - RB_COLOR(parent, field) == RB_RED) { \ - gparent = RB_PARENT(parent, field); \ - if (parent == RB_LEFT(gparent, field)) { \ - tmp = RB_RIGHT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field);\ - elm = gparent; \ - continue; \ - } \ - if (RB_RIGHT(parent, field) == elm) { \ - RB_ROTATE_LEFT(head, parent, tmp, field);\ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_RIGHT(head, gparent, tmp, field); \ - } else { \ - tmp = RB_LEFT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field);\ - elm = gparent; \ - continue; \ - } \ - if (RB_LEFT(parent, field) == elm) { \ - RB_ROTATE_RIGHT(head, parent, tmp, field);\ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_LEFT(head, gparent, tmp, field); \ - } \ - } \ - RB_COLOR(head->rbh_root, field) = RB_BLACK; \ -} \ - \ -void \ -name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ -{ \ - struct type *tmp; \ - while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \ - elm != RB_ROOT(head)) { \ - if (RB_LEFT(parent, field) == elm) { \ - tmp = RB_RIGHT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_LEFT(head, parent, tmp, field);\ - tmp = RB_RIGHT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\ - struct type *oleft; \ - if ((oleft = RB_LEFT(tmp, field)))\ - RB_COLOR(oleft, field) = RB_BLACK;\ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_RIGHT(head, tmp, oleft, field);\ - tmp = RB_RIGHT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field);\ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_RIGHT(tmp, field)) \ - RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\ - RB_ROTATE_LEFT(head, parent, tmp, field);\ - elm = RB_ROOT(head); \ - break; \ - } \ - } else { \ - tmp = RB_LEFT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_RIGHT(head, parent, tmp, field);\ - tmp = RB_LEFT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\ - struct type *oright; \ - if ((oright = RB_RIGHT(tmp, field)))\ - RB_COLOR(oright, field) = RB_BLACK;\ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_LEFT(head, tmp, oright, field);\ - tmp = RB_LEFT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field);\ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_LEFT(tmp, field)) \ - RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\ - RB_ROTATE_RIGHT(head, parent, tmp, field);\ - elm = RB_ROOT(head); \ - break; \ - } \ - } \ - } \ - if (elm) \ - RB_COLOR(elm, field) = RB_BLACK; \ -} \ - \ -struct type * \ -name##_RB_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *child, *parent, *old = elm; \ - int color; \ - if (RB_LEFT(elm, field) == NULL) \ - child = RB_RIGHT(elm, field); \ - else if (RB_RIGHT(elm, field) == NULL) \ - child = RB_LEFT(elm, field); \ - else { \ - struct type *left; \ - elm = RB_RIGHT(elm, field); \ - while ((left = RB_LEFT(elm, field))) \ - elm = left; \ - child = RB_RIGHT(elm, field); \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ - if (RB_PARENT(elm, field) == old) \ - parent = elm; \ - (elm)->field = (old)->field; \ - if (RB_PARENT(old, field)) { \ - if (RB_LEFT(RB_PARENT(old, field), field) == old)\ - RB_LEFT(RB_PARENT(old, field), field) = elm;\ - else \ - RB_RIGHT(RB_PARENT(old, field), field) = elm;\ - RB_AUGMENT(RB_PARENT(old, field)); \ - } else \ - RB_ROOT(head) = elm; \ - RB_PARENT(RB_LEFT(old, field), field) = elm; \ - if (RB_RIGHT(old, field)) \ - RB_PARENT(RB_RIGHT(old, field), field) = elm; \ - if (parent) { \ - left = parent; \ - do { \ - RB_AUGMENT(left); \ - } while ((left = RB_PARENT(left, field))); \ - } \ - goto color; \ - } \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ -color: \ - if (color == RB_BLACK) \ - name##_RB_REMOVE_COLOR(head, parent, child); \ - return (old); \ -} \ - \ -/* Inserts a node into the RB tree */ \ -struct type * \ -name##_RB_INSERT(struct name *head, struct type *elm) \ -{ \ - struct type *tmp; \ - struct type *parent = NULL; \ - int comp = 0; \ - tmp = RB_ROOT(head); \ - while (tmp) { \ - parent = tmp; \ - comp = (cmp)(elm, parent); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - RB_SET(elm, parent, field); \ - if (parent != NULL) { \ - if (comp < 0) \ - RB_LEFT(parent, field) = elm; \ - else \ - RB_RIGHT(parent, field) = elm; \ - RB_AUGMENT(parent); \ - } else \ - { \ - RB_ROOT(head) = elm; \ - } \ - name##_RB_INSERT_COLOR(head, elm); \ - return (NULL); \ -} \ - \ -/* Finds the node with the same key as elm */ \ -struct type * \ -name##_RB_FIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - int comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (NULL); \ -} \ - \ -struct type * \ -name##_RB_NEXT(struct type *elm) \ -{ \ - if (RB_RIGHT(elm, field)) { \ - elm = RB_RIGHT(elm, field); \ - while (RB_LEFT(elm, field)) \ - elm = RB_LEFT(elm, field); \ - } else { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - } \ - return (elm); \ -} \ - \ -struct type * \ -name##_RB_MINMAX(struct name *head, int val) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *parent = NULL; \ - while (tmp) { \ - parent = tmp; \ - if (val < 0) \ - tmp = RB_LEFT(tmp, field); \ - else \ - tmp = RB_RIGHT(tmp, field); \ - } \ - return (parent); \ -} - -#define RB_NEGINF -1 -#define RB_INF 1 - -#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) -#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) -#define RB_FIND(name, x, y) name##_RB_FIND(x, y) -#define RB_NEXT(name, x, y) name##_RB_NEXT(y) -#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) -#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) - -#define RB_FOREACH(x, name, head) \ - for ((x) = RB_MIN(name, head); \ - (x) != NULL; \ - (x) = name##_RB_NEXT(x)) - -#endif /* _SYS_TREE_H_ */ diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c index c4e593ca92..af5ab5ad6d 100644 --- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c +++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c @@ -330,7 +330,10 @@ int trx_brf_set_gains(openair0_device* device, { return(0); } - +int trx_brf_write_init(openair0_device *device) +{ + return 0; +} #define RXDCLENGTH 16384 int16_t cos_fsover8[8] = {2047, 1447, 0, -1448, -2047, -1448, 0, 1447}; @@ -1145,6 +1148,7 @@ int device_init(openair0_device *device, device->trx_stop_func = trx_brf_stop; device->trx_set_freq_func = trx_brf_set_freq; device->trx_set_gains_func = trx_brf_set_gains; + device->trx_write_init = trx_brf_write_init; device->openair0_cfg = openair0_cfg; device->priv = (void *)brf; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index ecadb68c0c..d086c0e13a 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -52,6 +52,9 @@ #define RAU_LOCAL_RADIO_HEAD 0 #define RAU_REMOTE_RADIO_HEAD 1 +#define MAX_WRITE_THREAD_PACKAGE 10 +#define MAX_WRITE_THREAD_BUFFER_SIZE 8 + #ifndef MAX_CARDS #define MAX_CARDS 8 #endif @@ -69,13 +72,9 @@ typedef enum { max_gain=0,med_gain,byp_gain } rx_gain_t; -#if OCP_FRAMEWORK -#include -#else typedef enum { duplex_mode_TDD=1,duplex_mode_FDD=0 } duplex_mode_t; -#endif /** @addtogroup _GENERIC_PHY_RF_INTERFACE_ @@ -275,8 +274,37 @@ typedef struct { void *rx; } if_buffer_t; +typedef struct { + openair0_timestamp timestamp; + void *buff[MAX_WRITE_THREAD_BUFFER_SIZE];// buffer to be write; + int nsamps; + int cc; + signed char first_packet; + signed char last_packet; + int flags_msb; +} openair0_write_package_t; + +typedef struct { + openair0_write_package_t write_package[MAX_WRITE_THREAD_PACKAGE]; + int start; + int end; + /// \internal This variable is protected by \ref mutex_write + int count_write; + /// pthread struct for trx write thread + pthread_t pthread_write; + /// pthread attributes for trx write thread + pthread_attr_t attr_write; + /// condition varible for trx write thread + pthread_cond_t cond_write; + /// mutex for trx write thread + pthread_mutex_t mutex_write; +} openair0_thread_t; + /*!\brief structure holds the parameters to configure USRP devices */ struct openair0_device_t { + /*!tx write thread*/ + openair0_thread_t write_thread; + /*!brief Module ID of this device */ int Mod_id; @@ -400,6 +428,12 @@ struct openair0_device_t { * \param arg pointer to capabilities or configuration */ void (*configure_rru)(int idx, void *arg); + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + int (*trx_write_init)(openair0_device *device); }; /* type of device init function, implemented in shared lib */ diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index c5822a3650..c72e7d4130 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -197,6 +197,10 @@ int trx_eth_reset_stats(openair0_device* device) return(0); } +int trx_eth_write_init(openair0_device *device) +{ + return 0; +} int ethernet_tune(openair0_device *device, unsigned int option, @@ -415,8 +419,9 @@ int transport_init(openair0_device *device, device->trx_reset_stats_func = trx_eth_reset_stats; device->trx_end_func = trx_eth_end; device->trx_stop_func = trx_eth_stop; - device->trx_set_freq_func = trx_eth_set_freq; - device->trx_set_gains_func = trx_eth_set_gains; + device->trx_set_freq_func = trx_eth_set_freq; + device->trx_set_gains_func = trx_eth_set_gains; + device->trx_write_init = trx_eth_write_init; if (eth->flags == ETH_RAW_MODE) { device->trx_write_func = trx_eth_write_raw; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h index 95d0029027..0f2147847a 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __ETHERNET_USERSPACE_LIB_IF_DEFS__H__ +#define __ETHERNET_USERSPACE_LIB_IF_DEFS__H__ + #include #include @@ -37,15 +40,11 @@ #include "PHY/LTE_TRANSPORT/if5_tools.h" // ETH transport preference modes -#ifdef OCP_FRAMEWORK -#include "enums.h" -#else #define ETH_UDP_MODE 0 #define ETH_RAW_MODE 1 #define ETH_UDP_IF4p5_MODE 2 #define ETH_RAW_IF4p5_MODE 3 #define ETH_RAW_IF5_MOBIPASS 4 -#endif // COMMOM HEADER LENGTHS @@ -84,3 +83,5 @@ #define RAW_IF5_MOBIPASS_BLOCK_SIZE_BYTES 1280 #define RAW_IF5_MOBIPASS_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + RAW_IF5_MOBIPASS_BLOCK_SIZE_BYTES) #define PAYLOAD_MOBIPASS_NUM_SAMPLES 640 + +#endif diff --git a/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp index 5b20d8a8c7..1273097f3b 100644 --- a/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp +++ b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp @@ -510,6 +510,11 @@ int trx_iris_reset_stats(openair0_device *device) { } +int trx_iris_write_init(openair0_device *device) +{ + return 0; +} + extern "C" { /*! \brief Initialize Openair Iris target. It returns 0 if OK @@ -831,6 +836,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->trx_set_freq_func = trx_iris_set_freq; device->trx_set_gains_func = trx_iris_set_gains; device->openair0_cfg = openair0_cfg; + device->trx_write_init = trx_iris_write_init; s->sample_rate = openair0_cfg[0].sample_rate; // TODO: diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index 9fcfbdf571..79a389bfeb 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -350,6 +350,10 @@ void trx_lms_end(openair0_device *device) { } +int trx_lms_write_init(openair0_device *device) +{ + return 0; +} extern "C" { /*! \brief Initialize Openair LMSSDR target. It returns 0 if OK * \param device the hardware to use @@ -406,6 +410,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){ device->trx_stop_func = trx_lms_stop; device->trx_set_freq_func = trx_lms_set_freq; device->trx_set_gains_func = trx_lms_set_gains; + device->trx_write_init = trx_lms_write_init; device->openair0_cfg = openair0_cfg; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 90b0a2e554..62f77699a4 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -50,6 +50,8 @@ #include "common_lib.h" #include "assertions.h" +#include "common/utils/LOG/vcd_signal_dumper.h" + #include #ifdef __SSE4_1__ @@ -68,6 +70,8 @@ * @{ */ +extern int usrp_tx_thread; + typedef struct { @@ -341,37 +345,12 @@ static int trx_usrp_write(openair0_device *device, int flags_lsb = flags&0xff; int flags_msb = (flags>>8)&0xff; - -#if defined(__x86_64) || defined(__i386__) - #ifdef __AVX2__ - nsamps2 = (nsamps+7)>>3; - __m256i buff_tx[8][nsamps2]; - #else - nsamps2 = (nsamps+3)>>2; - __m128i buff_tx[8][nsamps2]; - #endif -#elif defined(__arm__) - nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tx[8][nsamps2]; -#else -#error Unsupported CPU architecture, USRP device cannot be built -#endif - // bring RX data into 12 LSBs for softmodem RX - for (int i=0; iwrite_thread; + openair0_write_package_t *write_package = write_thread->write_package; + AssertFatal( MAX_WRITE_THREAD_BUFFER_SIZE >= cc,"Do not support more than %d cc number\n", MAX_WRITE_THREAD_BUFFER_SIZE); boolean_t first_packet_state=false,last_packet_state=false; @@ -404,7 +383,37 @@ static int trx_usrp_write(openair0_device *device, last_packet_state = true; } - + if(usrp_tx_thread == 0){ +#if defined(__x86_64) || defined(__i386__) + #ifdef __AVX2__ + nsamps2 = (nsamps+7)>>3; + __m256i buff_tx[8][nsamps2]; + #else + nsamps2 = (nsamps+3)>>2; + __m128i buff_tx[8][nsamps2]; + #endif +#elif defined(__arm__) + nsamps2 = (nsamps+3)>>2; + int16x8_t buff_tx[8][nsamps2]; +#else +#error Unsupported CPU architecture, USRP device cannot be built +#endif + + // bring RX data into 12 LSBs for softmodem RX + for (int i=0; itx_md.has_time_spec = true; s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet_state; s->tx_md.end_of_burst = last_packet_state; @@ -432,11 +441,170 @@ static int trx_usrp_write(openair0_device *device, ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); } - if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps); + if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps); + return ret; + } + else{ + pthread_mutex_lock(&write_thread->mutex_write); + + if(write_thread->count_write >= MAX_WRITE_THREAD_PACKAGE){ + LOG_W(HW,"Buffer overflow, count_write = %d, start = %d end = %d, resetting write package\n", write_thread->count_write, write_thread->start, write_thread->end); + write_thread->end = write_thread->start; + write_thread->count_write = 0; + } + + end = write_thread->end; + write_package[end].timestamp = timestamp; + write_package[end].nsamps = nsamps; + write_package[end].cc = cc; + write_package[end].first_packet = first_packet_state; + write_package[end].last_packet = last_packet_state; + write_package[end].flags_msb = flags_msb; + for (int i = 0; i < cc; i++) + write_package[end].buff[i] = buff[i]; + write_thread->count_write++; + write_thread->end = (write_thread->end + 1)% MAX_WRITE_THREAD_PACKAGE; + pthread_cond_signal(&write_thread->cond_write); + pthread_mutex_unlock(&write_thread->mutex_write); + return 0; + } - return ret; } +//-----------------------start-------------------------- +/*! \brief Called to send samples to the USRP RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at which the first sample MUST be sent + @param buff Buffer which holds the samples + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple antennas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied +*/ +void *trx_usrp_write_thread(void * arg){ + int ret=0; + openair0_device *device=(openair0_device *)arg; + openair0_thread_t *write_thread = &device->write_thread; + openair0_write_package_t *write_package = write_thread->write_package; + + usrp_state_t *s; + int nsamps2; // aligned to upper 32 or 16 byte boundary + int start; + openair0_timestamp timestamp; + void **buff; + int nsamps; + int cc; + signed char first_packet; + signed char last_packet; + int flags_msb; + + while(1){ + pthread_mutex_lock(&write_thread->mutex_write); + while (write_thread->count_write == 0) { + pthread_cond_wait(&write_thread->cond_write,&write_thread->mutex_write); // this unlocks mutex_rxtx while waiting and then locks it again + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 1 ); + s = (usrp_state_t *)device->priv; + start = write_thread->start; + timestamp = write_package[start].timestamp; + buff = write_package[start].buff; + nsamps = write_package[start].nsamps; + cc = write_package[start].cc; + first_packet = write_package[start].first_packet; + last_packet = write_package[start].last_packet; + flags_msb = write_package[start].flags_msb; + write_thread->start = (write_thread->start + 1)% MAX_WRITE_THREAD_PACKAGE; + write_thread->count_write--; + pthread_mutex_unlock(&write_thread->mutex_write); + /*if(write_thread->count_write != 0){ + LOG_W(HW,"count write = %d, start = %d, end = %d\n", write_thread->count_write, write_thread->start, write_thread->end); + }*/ + + #if defined(__x86_64) || defined(__i386__) + #ifdef __AVX2__ + nsamps2 = (nsamps+7)>>3; + __m256i buff_tx[8][nsamps2]; + #else + nsamps2 = (nsamps+3)>>2; + __m128i buff_tx[8][nsamps2]; + #endif + #elif defined(__arm__) + nsamps2 = (nsamps+3)>>2; + int16x8_t buff_tx[8][nsamps2]; + #else + #error Unsupported CPU architecture, USRP device cannot be built + #endif + + // bring RX data into 12 LSBs for softmodem RX + for (int i=0; itx_md.has_time_spec = true; + s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet; + s->tx_md.end_of_burst = last_packet; + s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate); + s->tx_count++; + + // bit 3 enables gpio (for backward compatibility) + if (flags_msb&8) { + // push GPIO bits 7-9 from flags_msb + int gpio789=(flags_msb&7)<<7; + s->usrp->set_command_time(s->tx_md.time_spec); + s->usrp->set_gpio_attr("FP0", "OUT", gpio789, 0x380); + s->usrp->clear_command_time(); + } + + if (cc>1) { + std::vector buff_ptrs; + + for (int i=0; itx_stream->send(buff_ptrs, nsamps, s->tx_md); + } + else { + ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); + } + + if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, ret ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 0 ); + + if(0) break; + } + + return NULL; +} + +int trx_usrp_write_init(openair0_device *device){ + + uhd::set_thread_priority_safe(1.0); + openair0_thread_t *write_thread = &device->write_thread; + printf("initializing tx write thread\n"); + + write_thread->start = 0; + write_thread->end = 0; + write_thread->count_write = 0; + printf("end of tx write thread\n"); + + pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); + + return(0); +} + +//---------------------end------------------------- + /*! \brief Receive samples from hardware. * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for * the first channel. *ptimestamp is the time at which the first sample @@ -765,6 +933,7 @@ extern "C" { device->trx_stop_func = trx_usrp_stop; device->trx_set_freq_func = trx_usrp_set_freq; device->trx_set_gains_func = trx_usrp_set_gains; + device->trx_write_init = trx_usrp_write_init; // hotfix! to be checked later diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index faf84bb0aa..7aa5d78bf8 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -34,6 +34,9 @@ #include #include #include +#include +#include +#include /* Legacy study: @@ -99,8 +102,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si } //l } - out_ptr->r += round(rx_tmp.x*pathLossLinear + noise_per_sample*gaussdouble(0.0,1.0)); - out_ptr->i += round(rx_tmp.y*pathLossLinear + noise_per_sample*gaussdouble(0.0,1.0)); + out_ptr->r += round(rx_tmp.x*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); + out_ptr->i += round(rx_tmp.y*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); out_ptr++; } @@ -112,3 +115,4 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si channelDesc->path_loss_dB, 10*log10(noise_per_sample)); } + diff --git a/targets/ARCH/rfsimulator/new_channel_sim.c b/targets/ARCH/rfsimulator/new_channel_sim.c new file mode 100644 index 0000000000..0501babd20 --- /dev/null +++ b/targets/ARCH/rfsimulator/new_channel_sim.c @@ -0,0 +1,108 @@ +/* +* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The OpenAirInterface Software Alliance licenses this file to You under +* the OAI Public License, Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.openairinterface.org/?page_id=698 +* +* Author and copyright: Laurent Thomas, open-cells.com +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*------------------------------------------------------------------------------- +* For more information about the OpenAirInterface (OAI) Software Alliance: +* contact@openairinterface.org +*/ + + +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +// Ziggurat +static double wn[128],fn[128]; +static uint32_t iz,jz,jsr=123456789,kn[128]; +static int32_t hz; +#define SHR3 (jz=jsr, jsr^=(jsr<<13),jsr^=(jsr>>17),jsr^=(jsr<<5),jz+jsr) +#define UNI (0.5+(signed) SHR3 * 0.2328306e-9) + +double nfix(void) { + const double r = 3.442620; + static double x, y; + + for (;;) { + x=hz * wn[iz]; + + if (iz==0) { + do { + x = - 0.2904764 * log (UNI); + y = - log (UNI); + } while (y+y < x*x); + + return (hz>0)? r+x : -r-x; + } + + if (fn[iz]+UNI*(fn[iz-1]-fn[iz]) +#include #define PORT 4043 //default TCP port for this simulator #define CirSize 307200 // 100ms is enough @@ -146,6 +147,12 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) { // the value channel_model->path_loss_dB seems only a storage place (new_channel_desc_scm() only copy the passed value) // Legacy changes directlty the variable channel_model->path_loss_dB place to place // while calling new_channel_desc_scm() with path losses = 0 + static bool init_done=false; + if (!init_done) { + randominit(0); + tableNor(0); + init_done=true; + } ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels, bridge->channelmod, bridge->sample_rate, @@ -469,14 +476,16 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi b->trashingPacket=true; } else if ( b->lastReceivedTS < b->th.timestamp) { int nbAnt= b->th.nbAnt; - + if ( b->th.timestamp-b->lastReceivedTS < CirSize ) { for (uint64_t index=b->lastReceivedTS; index < b->th.timestamp; index++ ) { for (int a=0; a < nbAnt; a++) { b->circularBuf[(index*nbAnt+a)%CirSize].r = 0; b->circularBuf[(index*nbAnt+a)%CirSize].i = 0; } } - + } else { + memset(b->circularBuf, 0, sampleToByte(CirSize,1)); + } if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS > 50 ) LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS ); b->lastReceivedTS=b->th.timestamp; @@ -561,6 +570,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo pthread_mutex_unlock(&Sockmutex); usleep(10000); pthread_mutex_lock(&Sockmutex); + if ( t->lastWroteTS < t->nextTimestamp ) { // Assuming Tx is not done fully in another thread // We can never write is the past from the received time @@ -574,6 +584,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo for ( int i=0; i < t->tx_num_channels; i++) samplesVoid[i]=(void *)&v; + LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n", t->lastWroteTS, t->nextTimestamp); rfsimulator_write_internal(t, t->nextTimestamp, @@ -637,10 +648,11 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ); else { // no channel modeling sample_t *out=(sample_t *)samplesVoid[a]; - + const int64_t base=t->nextTimestamp*nbAnt+a; for ( int i=0; i < nsamps; i++ ) { - out[i].r+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt+a)%CirSize].r; - out[i].i+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt+a)%CirSize].i; + const int idx=(i*nbAnt+base)%CirSize; + out[i].r+=ptr->circularBuf[idx].r; + out[i].i+=ptr->circularBuf[idx].i; } } // end of no channel modeling } // end for a... @@ -679,6 +691,9 @@ int rfsimulator_set_freq(openair0_device *device, openair0_config_t *openair0_cf int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) { return 0; } +int rfsimulator_write_init(openair0_device *device){ + return 0; +} __attribute__((__visibility__("default"))) int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line @@ -702,6 +717,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->type = USRP_B200_DEV; device->openair0_cfg=&openair0_cfg[0]; device->priv = rfsimulator; + device->trx_write_init = rfsimulator_write_init; for (int i=0; ibuf[i].conn_sock=-1; @@ -712,7 +728,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; rfsimulator->sample_rate=openair0_cfg->sample_rate; rfsimulator->tx_bw=openair0_cfg->tx_bw; - randominit(0); + //randominit(0); set_taus_seed(0); return 0; } diff --git a/targets/ARCH/tcp_bridge/tcp_bridge.c b/targets/ARCH/tcp_bridge/tcp_bridge.c index 8b287acfa1..f8c12dcb7a 100644 --- a/targets/ARCH/tcp_bridge/tcp_bridge.c +++ b/targets/ARCH/tcp_bridge/tcp_bridge.c @@ -243,6 +243,11 @@ ts += nsamps; return nsamps; } +int tcp_bridge_write_init(openair0_device *device) +{ + return 0; +} + __attribute__((__visibility__("default"))) int device_init(openair0_device* device, openair0_config_t *openair0_cfg) { @@ -267,6 +272,7 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg) device->trx_set_gains_func = tcp_bridge_set_gains; device->trx_write_func = tcp_bridge_write; device->trx_read_func = tcp_bridge_read; + device->trx_write_init = tcp_bridge_write_init; device->priv = tcp_bridge; diff --git a/targets/COMMON/create_tasks_mbms.h b/targets/COMMON/create_tasks_mbms.h deleted file mode 100644 index 843897cefb..0000000000 --- a/targets/COMMON/create_tasks_mbms.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef CREATE_TASKS_H_ -#define CREATE_TASKS_H_ - -/* External declaration of L2L1 task that depend on the target */ -extern void *l2l1_task(void *arg); - -int create_tasks(uint32_t enb_nb); -int create_tasks_ue(uint32_t ue_nb); -int create_tasks_mbms(uint32_t enb_nb); - -#endif /* CREATE_TASKS_H_ */ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index 8fec9fdaab..2c37e0d03f 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -248,8 +248,8 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2"; - #clock_src = "external"; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 688fae9b0f..0b04dc82d1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -33,10 +33,10 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 633032; + absoluteFrequencySSB = 641032; dl_frequencyBand = 78; - # this is 3480 MHz - dl_absoluteFrequencyPointA = 632000; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -153,7 +153,7 @@ gNBs = # ssb_PositionsInBurs_BitmapPR # 1=short, 2=medium, 3=long ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 255; + ssb_PositionsInBurst_Bitmap = 1; # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 @@ -242,7 +242,8 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "type=x300"; + sdr_addrs = "type=x300"; + clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf index 7c3a6e4ac0..464ce6b9aa 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf @@ -242,7 +242,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2"; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf index 58e4e86873..ea105d86b6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf @@ -258,7 +258,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 118; eNB_instances = [0]; - + clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index db8aef33ba..b63939add2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -100,7 +100,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -118; + preambleReceivedTargetPower = -100; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -185,7 +185,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; //0; //4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -259,7 +259,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - clock_src = "internal"; + clock_src = "external"; } ); diff --git a/targets/RT/USER/gNB_usrp.gtkw b/targets/RT/USER/gNB_usrp.gtkw index e6726e7d9f..6ece894bb6 100644 --- a/targets/RT/USER/gNB_usrp.gtkw +++ b/targets/RT/USER/gNB_usrp.gtkw @@ -1,21 +1,25 @@ [*] [*] GTKWave Analyzer v3.3.61 (w)1999-2014 BSI -[*] Tue Dec 17 15:31:51 2019 +[*] Wed Mar 4 14:05:43 2020 [*] -[dumpfile] "/tmp/gNB.vcd" -[dumpfile_mtime] "Tue Dec 17 15:25:49 2019" -[dumpfile_size] 6343431 +[dumpfile] "/tmp/gNB_trx_thread.vcd" +[dumpfile_mtime] "Wed Mar 4 14:05:10 2020" +[dumpfile_size] 10750468 [savefile] "/home/wangts/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw" -[timestart] 1517712000 -[size] 1920 1018 -[pos] -9 -33 -*-19.276148 1518358451 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[timestart] 31148700000 +[size] 1916 1002 +[pos] -1 -25 +*-23.852516 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 [sst_width] 386 [signals_width] 344 [sst_expanded] 1 -[sst_vpaned_height] 267 +[sst_vpaned_height] 262 @28 functions.trx_read +functions.trx_write_thread +@25 +variables.trx_write_flags[63:0] +@28 functions.trx_write @420 variables.frame_number_TX0_UE[63:0] diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index cb04480d33..147bc955ae 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -851,9 +851,7 @@ void init_eNB_proc(int inst) { for (CC_id=0; CC_idproc; L1_proc = &proc->L1_proc; L1_proc_tx = &proc->L1_proc_tx; @@ -1247,9 +1245,7 @@ void init_eNB(int single_thread_flag, eNB->abstraction_flag = 0; eNB->single_thread_flag = single_thread_flag; LOG_I(PHY,"Initializing eNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag); -#ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id); -#endif LOG_I(PHY,"Registering with MAC interface module\n"); AssertFatal((eNB->if_inst = IF_Module_init(inst))!=NULL,"Cannot register interface"); eNB->if_inst->schedule_response = schedule_response; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 8c9b143100..4d89020077 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -679,7 +679,11 @@ void rx_rf(RU_t *ru, resynch=1; } - proc->timestamp_rx = ts-ru->ts_offset; + if(get_softmodem_params()->emulate_rf) { + proc->timestamp_rx = old_ts + fp->samples_per_tti; + } else { + proc->timestamp_rx = ts-ru->ts_offset; + } // AssertFatal(rxs == fp->samples_per_tti, // "rx_rf: Asked for %d samples, got %d from SDR\n",fp->samples_per_tti,rxs); @@ -2233,9 +2237,7 @@ void init_RU_proc(RU_t *ru) { RU_proc_t *proc; pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL, *attr_prach=NULL, *attr_asynch=NULL, *attr_synch=NULL, *attr_emulateRF=NULL, *attr_ctrl=NULL, *attr_prach_br=NULL; //pthread_attr_t *attr_fep=NULL; -#ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); -#endif proc = &ru->proc; memset((void *)proc,0,sizeof(RU_proc_t)); proc->ru = ru; @@ -2339,19 +2341,22 @@ void init_RU_proc(RU_t *ru) { LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__); pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void *)ru ); ru->state=RU_RUN; - fill_rf_config(ru,ru->rf_config_file); - init_frame_parms(ru->frame_parms,1); - ru->frame_parms->nb_antennas_rx = ru->nb_rx; - phy_init_RU(ru); - ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); - if (ret < 0) { - LOG_I(PHY,"Exiting, cannot load device. Make sure that your SDR board is connected!\n"); - exit(1); - } + if(!get_softmodem_params()->emulate_rf) + { + fill_rf_config(ru,ru->rf_config_file); + init_frame_parms(ru->frame_parms,1); + ru->frame_parms->nb_antennas_rx = ru->nb_rx; + phy_init_RU(ru); + ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); + if (ret < 0) { + LOG_I(PHY,"Exiting, cannot load device. Make sure that your SDR board is connected!\n"); + exit(1); + } - if (setup_RU_buffers(ru)!=0) { - LOG_I(PHY,"Exiting, cannot initialize RU Buffers\n"); - exit(1); + if (setup_RU_buffers(ru)!=0) { + LOG_I(PHY,"Exiting, cannot initialize RU Buffers\n"); + exit(1); + } } } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d8c5e25593..4715a4e995 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -170,6 +170,7 @@ extern void init_eNB_afterRU(void); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; +int usrp_tx_thread = 0; THREAD_STRUCT thread_struct; /* struct for ethernet specific parameters given in eNB conf file */ @@ -659,6 +660,7 @@ int main ( int argc, char **argv ) initTpool("n", L1proc->threadPool, true); initNotifiedFIFO(L1proc->respEncode); initNotifiedFIFO(L1proc->respDecode); + RC.eNB[x][CC_id]->proc.L1_proc_tx.threadPool = L1proc->threadPool; } diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index c5fdb5f546..1c537dabe3 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -155,6 +155,10 @@ extern int sync_var; extern int transmission_mode; extern double cpuf; +extern int emulate_rf; +extern int numerology; +extern int usrp_tx_thread; + // In lte-enb.c extern void stop_eNB(int); extern void kill_eNB_proc(int inst); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2c9271888b..a45ecd2298 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -171,6 +171,8 @@ extern void get_uethreads_params(void); int transmission_mode=1; +int usrp_tx_thread = 0; + char *usrp_args=NULL; char *usrp_clksrc=NULL;